我无法获得TimeUUIDType与phpcassa
问题描述:
Noob here。我无法获得TimeUUIDType与phpcassa
我有一个超级列家庭按timeuuidtype排序,它有多个条目。我试图用phpcassa执行一个简单的get函数,它不会工作。我试图从TimeUUID排序的SC中的UTF8排序列中返回特定值。确切的代码适用于按BytesType排序的类似SC系列。
这里是我试图从哪里我通过-cli进入的scf的信息。
ColumnFamily: testSCF (Super)
Columns sorted by: org.apache.cassandra.db.marshal.TimeUUIDType/org.apache.cassandra.db.marshal.UTF8Type
RowKey: TestKey
=> (super_column=48dd0330-5bd6-11e0-adc5-343960c1b6b8,
(column=test, value=74657374, timestamp=1301603831288000))
=> (super_column=141a69b0-5c6e-11e0-bcce-343960c1b6b8,
(column=new test, value=6e657774657374, timestamp=1301669004440000))
这里是我用来检索数据的phpcassa脚本。
<?php
require_once('.../connection.php');
require_once('.../columnfamily.php');
$conn = new Connection('siteRoot');
$scf = 'testSCF';
$key = 'testKey';
$super = '141a69b0-5c6e-11e0-bcce-343960c1b6b8';
$col = 'new test';
$entry = new ColumnFamily($conn, $scf);
$q = ($entry->get($key, $columns=array($super)));
echo $q[$super][$col];
?>
另外,如果我没有指定像这样的SC。
$q = ($entry->get($key));
print_r($q);
它返回:
Array ([HÝ0[ÖàÅ49`Á¶¸] => Array ([test] => test) [i°\nà¼Î49`Á¶¸] => Array ([new test] => newtest))
我知道这个问题的一部分可能已经在How do I insert a row with a TimeUUIDType column in Cassandra? 长大的,但它并没有真正帮助我,因为我大概已经接受timeuuidtypes。
感谢任何帮助家伙。
答
假设我没有努力去开始。事实上,答案是与链接有关的所有事情。
看来,-cli接受了链接中描述的插入时的timeUUID(141a69b0-5c6e-11e0-bcce-343960c1b6b8)的32字节表示形式。这使我困惑。
当你'()'与“原始”16字节的形式(HÝ0[ÅàÅÅ49])工作正常。
干杯。
你需要使用 “阵列”,请检查: http://stackoverflow.com/questions/11741284/using-uuid1-with-phpcassa – Nick 2013-06-08 14:54:46