Re: Binding Array in SQLTemplate

From: Evgeny Ryabitskiy (evgeny.ryabitski..mail.com)
Date: Fri Dec 11 2009 - 05:42:07 EST

  • Next message: Andrus Adamchik: "Re: Hudson unit test runs"

    No answer...
    But history points to Andrus :)

    Evgeny.

    10 ÄÅËÁÂÒÑ 2009 Ç. 10:55 ÐÏÌØÚÏ×ÁÔÅÌØ òÑÂÉÃËÉÊ å×ÇÅÎÉÊ
    <eryabitski..iasoft.ru> ÎÁÐÉÓÁÌ:
    > Hello!
    > I try to use array (like String[]) as a bind parameter.
    >
    > In follow lines:
    >
    > š š š šString[] artistNames = new String[2];
    > š š š šartistNames[0] = "Artist1";
    > š š š šartistNames[1] = "Artist3";
    > š š š šString sql = "SELECT * FROM ARTIST WHERE ARTIST_NAME in (#bind($ARTISTNAMES))";
    > š š š šSQLTemplate query = new SQLTemplate(Artist.class, sql);
    > š š š šquery.setParameters(Collections.singletonMap("ARTISTNAMES", artistNames));
    > š š š šList result = getDomain().createDataContext().performQuery(query);
    >
    > I got this query in logs:
    >
    > INFO: SELECT * FROM ARTIST WHERE ARTIST_NAME in (?) [bind: 1:< 'Artist1','Artist3'>]
    > 10.12.2009 10:48:09 org.apache.cayenne.access.QueryLogger logSelectCount
    > INFO: === returned 0 rows. - took 0 ms.
    >
    >
    > So... What does it mean? [bind: 1:< 'Artist1','Artist3'>] ?
    > I mean what is a purpose of using array in bind? For what queries it should be used?
    >
    > Evgeny.
    >



    This archive was generated by hypermail 2.0.0 : Fri Dec 11 2009 - 05:42:36 EST