Snowflake key algorithm in PHP using PHPCassa [duplicate]
Asked Answered
P

1

6

Possible Duplicate:
how to have 64 bit integer on PHP?

Is it possible to use a 64-bit Long integer as a key in Cassandra using PHPCassa?

For example,

$pool = new ConnectionPool('main', array("127.0.0.1")); 
$table = new ColumnFamily($pool, 'messages'); // ColumnFamily 
$table->insert("5601379860409749867", array("sampleKey" => "sampleValue)); 

Every time that I do the insert, I get 0 for the key. In this table, the key_validation_class is LongType.

Parol answered 26/4, 2012 at 21:9 Comment(2)
If your PHP is a 32 bits version, I think you just can't. Switch to 64 bits system or wait for a PHP way-to-fix (might be longer ^^)Bedraggled
The 64-bit integer question is a similar to How to have 64-bit integer in PHP and How to generate random 64-bit value as decimal string.Luana
P
0

This is totally dependant on your server's operating system capabilities, and not a limitation of PHPCassa.

Native 64-bit integers require 64-bit hardware AND the 64-bit version of PHP.

On 32-bit hardware:

$ php -r 'echo PHP_INT_MAX;'
2147483647

On 64-bit hardware:

$ php -r 'echo PHP_INT_MAX;'
9223372036854775807
Parcel answered 30/7, 2012 at 16:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.