duoshuo / php-cassandra

php Cassandra driver which support Protocol v3 (Cassandra 2.1) and asynchronous requests
MIT License
153 stars 53 forks source link

Timeuuid to Timestamp support? #83

Open ptcarino opened 7 years ago

ptcarino commented 7 years ago

Framework: Laravel 5.2 Cassandra version: 3.9

I managed to use the timeuuid function toTimestamp(now()) on my insert statements but when I used it on a select statement I got this error:

Invalid: Invalid call to function totimestamp, none of its type signatures match (known type signatures: system.totimestamp : (date) -> timestamp, system.totimestamp : (timeuuid) -> timestamp)

The select statement I've used is as follows: SELECT room_id, username, mac, message, toTimestamp(created_at), ts_created FROM chat

and for the insert statement that worked for me: INSERT INTO chat (room_id, username, mac, message, created_at, ts_created) VALUES (bbbcb63c-027e-427b-a6e5-b575a79de797, '$name', '$mac', '$msg', now(), toTimestamp(now()))

EDIT: I'm trying to return the result of the querySync in my situation on this issue.

$response = $connection->querySync($statement);
$result = $response->fetchAll();

return $result;