duane9322 2013-06-18 13:35
浏览 43
已采纳

phpcassa给出了cql执行错误

I have recently created a column family with CREATE TABLE in cqlsh console.

I have the following column family;

CREATE TABLE user (
  id timeuuid PRIMARY KEY,
  balance decimal,
  is_free boolean,
  player_id bigint,
)

I want to insert the following type of data;

{
    "player_id": 104,
    "balance": "0.00",
    "is_free": false,
    "bonus": "3+3+3"
}

when I do insert from cqlsh console the insertion is the following;

INSERT INTO keyspace.user (player_id, balance,is_free,bonus, id) 
VALUES (104,0.00,'3+3+3',67c5cb00-d814-11e2-9e13-59eb8e4538e5)

Id is generated by UUID::uuid1()->string

When I try to insert from cqlsh, it gives no error. However, in phpcassa, it gives the following error :

Expected key 'ID' to be present in WHERE clause for 'users'

I already set the client's cql version to 3.0.0 by

$pool->get()->client->set_cql_version("3.0.0");

I already tried to insert timeuuid field like that '67c5cb00-d814-11e2-9e13-59eb8e4538e5'

By the way, the var_dump of the variable $cql that is executed is the following;

string 'INSERT INTO keyspace.user (player_id,balance,is_free,bonus,id) VALUES (104,0.00,false,'3+3+3','ca256040-d819-11e2-ae08-f78171d975c3')' 

What is the problem here ?

  • 写回答

1条回答 默认 最新

  • donglun1918 2013-06-19 16:09
    关注

    execute_cql_query() function does not seem to be working in cql_version 3.0.0

    although cql 3 support is not official in phpcassa, execute_cql3_query() function works stable & well for me by using the following code;

    $this->_connection_pool->get()->client->execute_cql3_query($cql, ConsistencyLevel::ONE);
    

    where $cql is the following;

    string 'INSERT INTO keyspace.user (player_id,balance,is_free,bonus,id)
            VALUES (104,0.00,false,'3+3+3',12128260-d8ea-11e2-b5b3-0be38f9377b6)'
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?