ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt <dromitl...@gmail.com>
Subject Re: SQL "= ANY (?)" supported?
Date Sun, 30 Apr 2017 08:25:50 GMT
Just a clarification, the code should have said "*query.setArgs(new
Object[]{params})*" but that is NOT the problem, I just pasted the wrong
version in here.

Also, in case this is not supported by Ignite/H2, a better idea would be to
use "*WHERE foo IN (?, ?, ?, ...)*" and then "*query.setArgs(params)"*
(without wrapping it), but I'm looking for a one-param query, which is
reusable.

Matt

On Sun, Apr 30, 2017 at 4:54 AM, Matt <dromitlabs@gmail.com> wrote:

> Hello,
>
> I'm trying to run a SQL standard query with a "WHERE foo = ANY(?)" but it
> seems it's not supported by Ignite.
>
> The code looks like this, it's fairly simple:
>
> ---
>
>
>
>
>
>
> *String sql = "SELECT * FROM Foo WHERE foo = ANY(?)";String[] params =
> {"aaa", "bbb"};SqlQuery<String, Foo> query = new SqlQuery<>(Foo.class,
> sql);query.setArgs(params);cache.query(query);*
> ---
>
> The error is "*IgniteSQLException: Failed to parse query*" and "*JdbcSQLException:
> Syntax error in SQL statement*" and it's caused by the "ANY(?)". I also
> tried writing the query without the params, hardcoding the values directly
> on the sql variable, but I'm getting the same result.
>
> Is this kind of query supported? Any workaround to load a list of objects
> dynamically (from an array) without writing multiple "foo = ? OR foo = ? OR
> ..." on the query?
>
> Best,
> Matt
>

Mime
View raw message