Is it possible to use PDOStatement with the Cassandra PHP driver?

220 views Asked by At

I'm trying to use in PHP Cassandra with this Driver: https://github.com/datastax/php-driver.

So, I want to know if is it possible to use to use [PDOStatement::fetch] (https://www.php.net/manual/fr/pdostatement.fetch.php) and [PDOStatement::rowCount] (https://www.php.net/manual/fr/pdostatement.rowcount.php) with Cassandra without any problem EXACTLY like it possible to use these PDO Functions with MySQL?

2

There are 2 answers

0
Martin Zeitler On

One likely needs to use a "PDO driver implementation for Cassandra CQL" ...
alike this one here: https://github.com/Orange-OpenSource/YACassandraPDO

Only then PDO would be able to produce CQL syntax.

0
Erick Ramirez On

I don't believe PDOStatement will work out of the box with the Cassandra PHP driver.

Years ago (around 2011), there was a Cassandra PDO driver available on Google Code which worked with Thrift -- https://code.google.com/archive/a/apache-extras.org/p/cassandra-pdo.

It was forked by Orange to provide CQL support -- https://github.com/Orange-OpenSource/YACassandraPDO. However, the last release was all the way back to 2014 and it doesn't look like there has been any work on it since 2015.

As a side note, the Cassandra PHP driver has been in maintenance mode for a number of years now with the last release (v1.3.2) going back to 2017. Although we continue to accept pull requests from contributors, I wouldn't recommend doing any new project that uses this driver given it has not been in active development for years. Cheers!