PrepareStatment in clause with variadic parameter

20 views
Skip to first unread message

楊宗霖

unread,
Jun 18, 2018, 3:11:08 AM6/18/18
to DataStax PHP Driver for Apache Cassandra User Mailing List
Hi guys, thanks for all the great work.

I found that I can't use variadic parameter list for in clause with prepare statment.

Here's what I've tried (but failed).

In a simple statement I can do:

$stmt = 'SELECT * FROM some_table WHERE id in ?';
$inSet = Type::set(Type::varchar())->create('a','b','c');
$session->execute($stmt, ['arguments'=>[$inSet]];


But In a prepare statment I'll get:

PHP Fatal error: Uncaught Cassandra\Exception\InvalidArgumentException: Invalid value type

I've also tried to use an array:

$stmt = $session->prepare('SELECT * FROM some_table WHERE id in ?');
$inArr = ['a','b','c'];
$session->execute($stmt, ['arguments'=>[$inArr]]);

But get NOTHING!!!???? Without any error code nor result. Same when I used simple statment.

Accroding to https://issues.apache.org/jira/browse/CASSANDRA-4210

This feature should be supported in 2.0.1

I'm using 2.7.0 C/C++ driver

1.3.2 php7.0-cassandra-driver

So I think this could be a bug?

Thank you

Best regard
Lin

regis le bretonnic

unread,
Jun 24, 2018, 4:06:24 AM6/24/18
to DataStax PHP Driver for Apache Cassandra User Mailing List
Seems vey close to a question I ask in past... Not sure it is possible...

https://groups.google.com/a/lists.datastax.com/forum/#!msg/php-driver-user/jtdeVm_W1rk/CnqSfMcmBAAJ;context-place=forum/php-driver-user

Maybe you can build dynamically the select with all values of your array instead of trying to use a preparestatment
Reply all
Reply to author
Forward
0 new messages