我使用卡桑德拉和使用Datastax PHP CQL。datastax卡桑德拉查詢結果解碼在PHP
考慮下面的查詢,我應該怎麼解碼的結果?
$cql = SELECT * FROM company WHERE userid = 1001 ORDER BY gpsTime DESC LIMIT 1;
$statement = new Cassandra\SimpleStatement($cql);
$result = $this->session->execute($statement);
我試着用解碼:
foreach($result as $row){
// Get values from row and add to array
array_push($allVehicleInfo,array(
'userID' => $row['userid']->value,
'gpsTime' => $row['gpstime']->seconds,
'latitude' => $row['latitude']->value)
);
}
但是,我得到一個錯誤:
Message: Undefined property: Cassandra\Decimal::$value
我的表架構是:
$cql = "CREATE TABLE " company " (
userID bigint,
userName ascii,
latitude decimal,
longitude decimal,
accuracy float,
altitude float,
gpsTime timestamp);