I'm not sure about using it in a SimpleStatement in the Java driver (you
might need to test this), but the QueryBuilder does have support for in()
where you pass a list is the parameter:
see
http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/querybuilder/QueryBuilder.html#in-jav
You need to specify the values themselves.
CREATE TABLE user (
id int,
type text,
val1 int,
val2 text,
PRIMARY KEY ((id, category), val1, val2)
);
SELECT * FROM user WHERE id = 1 AND type IN ('user', 'admin') AND val1 = 3
AND val2 IN ('a', 'v', 'd');
On Tue, 11 Oct 2016 at 07:11 Ali Akhtar wrot
Justin,
I'm asking how to bind a parameter for IN queries thru the java driver.
On Tue, Oct 11, 2016 at 7:22 PM, Justin Cameron
wrote:
> You need to specify the values themselves.
>
> CREATE TABLE user (
> id int,
> type text,
> val1 int,
> val2 text,
> PRIMARY KEY ((id, category), val1, val2)
Ah, thanks, good catch.
If I send a List / Array as value for the last param, will that get bound
as expected?
On Tue, Oct 11, 2016 at 7:16 PM, horschi wrote:
> Hi Ali,
>
> do you perhaps want "'Select * from my_table WHERE pk = ? And ck IN ?'" ?
> (Without the brackets around the question mark
Do you send the values themselves, or send them as an array / collection?
Or will both work?
On Tue, Oct 11, 2016 at 7:10 PM, Justin Cameron
wrote:
> You can pass multiple values to the IN clause, however they can only be
> used on the last column in the partition key and/or the last column in t
Hi Ali,
do you perhaps want "'Select * from my_table WHERE pk = ? And ck IN ?'" ?
(Without the brackets around the question mark)
regards,
Ch
On Tue, Oct 11, 2016 at 3:14 PM, Ali Akhtar wrote:
> If I wanted to create an accessor, and have a method which does a query
> like this:
>
> 'Select *
You can pass multiple values to the IN clause, however they can only be
used on the last column in the partition key and/or the last column in the
full primary key.
Example:
'Select * from my_table WHERE pk = 'test' And ck IN (1, 2)'
On Tue, 11 Oct 2016 at 06:15 Ali Akhtar wrote:
> If I wante
If I wanted to create an accessor, and have a method which does a query
like this:
'Select * from my_table WHERE pk = ? And ck IN (?)'
And there were multiple options that could go inside the IN() query, how
can I specify that? Will it e.g, let me pass in an array as the 2nd
variable?