evseevnn-zz / php-cassandra-binary

PHP library for Cassandra database via a binary protocol.
http://evseevnn.github.io/php-cassandra-binary/
MIT License
69 stars 33 forks source link

Conditional updates are not supported #68

Open CBox opened 9 years ago

CBox commented 9 years ago

Is there a way to make Conditional updates supported?

When I'm adding IF NOT EXISTS I'm getting: Invalid: Conditional updates are not supported by the protocol version in use. You need to upgrade to a driver using the native protocol v2.

Thanks!

mistercorea commented 9 years ago

It's working on mine. Can you post your whole CQL and table setup?

for mine $db->beginBatch(); $q = "INSERT INTO sessions (id,data) VALUES (:id,:data) IF NOT EXISTS"; $db->query($q,['id'=>$id,'data'=>$data]); $db->applyBatch();

make sure your query is valid on cqlsh before you run it on this library

CBox commented 9 years ago

This right, It's really working when using Batch, if not there is an error. Good enough for me, Thanks!

CBox commented 9 years ago

When using IF NOT EXISTS in a batch, even if one row exists the batch will not insert or update anything. Is there way to get around that? So each statement in a batch will be not related to the other when using if not exists?