Orange-OpenSource / YACassandraPDO

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

issue #30: timestamp type is returns as bytestring rather than int. #51

Closed towr closed 10 years ago

towr commented 10 years ago

TimestampType was not considered in the function pdo_cassandra_get_cassandra_type

sandro-lex commented 10 years ago

thanks for the patch. In which version of cassandra have you tested it?

towr commented 10 years ago

I've tested it with Cassandra 2.0.7 (CQL 3.1.1)

Skunnyk commented 10 years ago

Thank you for the patch, it works here :)

cqlsh.mydb > SELECT published_at FROM table LIMIT 1;

 published_at
-----------------
 2014-05-30 17:00:00+0200

Without the patch :

$ php cassandra.php
Array
(
    [published_at] => FM�    �
)

With the patch :

$ php cassandra.php
Array
(
    [published_at] => 1401462000000
)
$ cat cassandra.php

$db_handle = new PDO("cassandra:host=localhost;port=9160;dbname=mydb");
$stmt = $db_handle->query('SELECT published_at FROM table LIMIT 1');
print_r($stmt->fetch(PDO::FETCH_ASSOC));

Both on cassandra 2.0.7

Skunnyk commented 10 years ago

Can you please merge it ?

sandvige commented 10 years ago

What would happen on 32bits PHP version?

mlornac-orange commented 10 years ago

Thanks for the patch. I am merging it to an untested branch called 2.0_experimental. We are currently using cassandra at the 1.2.x and we plan to migrate to the 2.0.9 quite soon. We will fix regressions and support new features then.