php-cassandra-binary
php-cassandra-binary copied to clipboard
How would I insert a decimal value?
I'm attempting to insert a value into a column with datatype decimal and am trouble getting the correct outcome...
cqlsh:test_keyspace> DESCRIBE TABLE test_decimal ;
CREATE TABLE test_decimal (
id int,
value decimal,
PRIMARY KEY (id)
) WITH
bloom_filter_fp_chance=0.010000 AND
caching='KEYS_ONLY' AND
comment='' AND
dclocal_read_repair_chance=0.100000 AND
gc_grace_seconds=864000 AND
index_interval=128 AND
read_repair_chance=0.000000 AND
replicate_on_write='true' AND
populate_io_cache_on_flush='false' AND
default_time_to_live=0 AND
speculative_retry='99.0PERCENTILE' AND
memtable_flush_period_in_ms=0 AND
compaction={'class': 'SizeTieredCompactionStrategy'} AND
compression={'sstable_compression': 'LZ4Compressor'};
// Insert using the php-cassandra-binary package
$database->query('INSERT INTO test_decimal (id, value) VALUES (:id, :value);', ['id' => 1, 'value' => 1.23]);
cqlsh:test_keyspace> INSERT INTO test_decimal (id, value) VALUES (2, 1.23);
cqlsh:test_keyspace> SELECT * FROM test_decimal ;
id | value
----+-------
1 | 1
2 | 1.23
(2 rows)
It appears that the decimal part is always lost when inserting via this package. (I'm using dev-master at revision 7185308)
Am I doing something wrong or is this a genuine bug?
Thanks for an awesome library that is helping me get away from pdo_cassandra and the Thrift protocol!
Regards, Adam
I am looking into this right now and it seems to be a bug at the current state. I am working on resolving it.