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.

Community
  • 1
  • 1
user1359680
  • 144
  • 5
  • 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 ^^) – shkschneider Jul 29 '12 at 19:06
  • 1
    The 64-bit integer question is a similar to [How to have 64-bit integer in PHP](http://stackoverflow.com/questions/864058/how-to-have-64-bit-integer-on-php) and [How to generate random 64-bit value as decimal string](http://stackoverflow.com/questions/5301034/how-to-generate-random-64-bit-value-as-decimal-string). – Stennie Aug 04 '12 at 01:57

1 Answers1

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
Greg
  • 21,235
  • 17
  • 84
  • 107