You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Lex Lythius (JIRA)" <ji...@apache.org> on 2015/01/05 21:59:34 UTC

[jira] [Commented] (CASSANDRA-3025) PHP/PDO driver for Cassandra CQL

    [ https://issues.apache.org/jira/browse/CASSANDRA-3025?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14265088#comment-14265088 ] 

Lex Lythius commented on CASSANDRA-3025:
----------------------------------------

Would you mind reopening this bug? cassandra-pdo (CQL | PHP) has been dead for two and a half years.

The lack of a clear official roadmap towards a PHP driver for Cassandra has resulted in a long list of, regretably, suboptimal work(arounds), none of which (AFAIK) is production-ready:

- YACassandraPDO: forked from deceased cassandra-pdo, CQL3-only C++, thrift-based PDO driver (I've contributed some patches to this project without really being a C++ developer). Still has some issues with param binding and value parsing and proves tricky to build from source (because of thrift) and in Mac OS X. Works with C*1.x, but has issues with C*2.x.
- PHPCassa: probably the most stable solution currently, but not based around CQL and still uses Thrift.
- php-cassandra-binary: a pure PHP, native protocol-based driver that apparently has issues with return values when NULLs are involved.
- php-cassandra: a non-PDO wrapper around deprecated branch of official C++ native protocl driver. It reportedly has problems with collections.
- CQLSÍ: a showcase of what someone can do out of desperation to get a CQL driver, CQLSÍ wraps around CQLSH and parses its output. Not great for performance, floats and timestamps and probably for NULL values.
- Many of the others are pretty outdated.

I guess DataStax, understandably, lacks the resources to provide an official driver for PHP. But I think it would be greatly beneficial to everyone if it could provide *guidance and coordination of efforts* so there's not a bunch of us doing parallel, duplicate, incompatible and hardly production-ready attempts to remediate this.


> PHP/PDO driver for Cassandra CQL
> --------------------------------
>
>                 Key: CASSANDRA-3025
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3025
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: API
>            Reporter: Mikko Koppanen
>            Assignee: Mikko Koppanen
>              Labels: php
>         Attachments: pdo_cassandra-0.1.0.tgz, pdo_cassandra-0.1.1.tgz, pdo_cassandra-0.1.2.tgz, pdo_cassandra-0.1.3.tgz, pdo_cassandra-0.2.0.tgz, pdo_cassandra-0.2.1.tgz, php_test_results_20110818_2317.txt
>
>
> Hello,
> attached is the initial version of the PDO driver for Cassandra CQL language. This is a native PHP extension written in what I would call a combination of C and C++, due to PHP being C. The thrift API used is the C++.
> The API looks roughly following:
> {code}
> <?php
> $db = new PDO('cassandra:host=127.0.0.1;port=9160');
> $db->exec ("CREATE KEYSPACE mytest with strategy_class = 'SimpleStrategy' and strategy_options:replication_factor=1;");
> $db->exec ("USE mytest");
> $db->exec ("CREATE COLUMNFAMILY users (
> 			my_key varchar PRIMARY KEY,
> 			full_name varchar );");
> 			
> $stmt = $db->prepare ("INSERT INTO users (my_key, full_name) VALUES (:key, :full_name);");
> $stmt->execute (array (':key' => 'mikko', ':full_name' => 'Mikko K' ));
> {code}
> Currently prepared statements are emulated on the client side but I understand that there is a plan to add prepared statements to Cassandra CQL API as well. I will add this feature in to the extension as soon as they are implemented.
> Additional documentation can be found in github https://github.com/mkoppanen/php-pdo_cassandra, in the form of rendered MarkDown file. Tests are currently not included in the package file and they can be found in the github for now as well.
> I have created documentation in docbook format as well, but have not yet rendered it.
> Comments and feedback are welcome.
> Thanks,
> Mikko



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)