Orange-OpenSource / YACassandraPDO

Cassandra PDO Driver fork
Apache License 2.0
85 stars 32 forks source link

how to do batched write using YACassandraPDO? #86

Closed jayeshjain24 closed 9 years ago

jayeshjain24 commented 9 years ago

I want to make 100 inserts with the entire process being atomic. Can I do it with this php driver?

sandro-lex commented 9 years ago

I never used atomic batches with this driver in production, and I know that it is not tested. But it should work. Have a try with something like: $db->exec("BEGIN BATCH UPDATE table set full_name='USER1' where my_key='u1' UPDATE table set full_name='USER2' where my_key='u2' APPLY BATCH;");

But I think best option is to use the new DataStax driver: https://github.com/datastax/php-driver

It has full support to atomic batch https://github.com/datastax/php-driver/tree/master/features#batch-statements

ghost commented 9 years ago

But I think best option is to use the new DataStax driver: https://github.com/datastax/php-driver

Thank you for the link!

jayeshjain24 commented 9 years ago

@sandro-lex Thx. Its working.

But when I var_dump the result ,it gives me 0 even when it inserts all the rows. Is there any way to get the acknowledgement whether the atomic operation was succesful or not?