I know somebody has ask this question (http://www.datastax.com/support-forums/topic/java-driver-cql-3-bound-statements-in-clause#post-13114, Prepared Statement with collection in IN clause in Datastax Cassandra CQL driver)
However, I still do not know how to bind data. for example, my preparedStatement is
select * from cf where key in (?)
What I want is bind data and the cql is looks like
select * from cf where key in ('key1', 'key2')
Now I have a boundStatement.
when I use boundStatment.bind() api. I try to bind ? with a List or a Array, however , it says:
Column value is of type varchar, cannot set to a list
Ok, I set a string and use boundStatement.bind like this:
boundStatement.bind("'key1','key2'");
There is no exception, but the resultSet is empty. Why? I think because the driver parse it as
select * from cf where key in (''key1', 'key2'')
(notice a redundant quote because it thinks all the "'key1',and 'key2'" is a string).
So, I know datastax has support in clause. but I can not find some examples ..
Can any help me? Thanks!
The correct syntax is:
That will allow you to bind a List for the query parameter.