【问题标题】:Get value from Cassandra with PHPCASSA使用 PHPCASSA 从 Cassandra 获取价值
【发布时间】:2012-06-30 01:11:18
【问题描述】:

我最近切换到 PHPCassa 来管理我的 PHP 平台中的数据库连接。

这是我正在使用的代码:

$indexExpression = new IndexExpression("Username", $username);
$indexClause = new IndexClause(array($indexExpression));
$cf = new ColumnFamily($this->cassandra, "Users");
$rows = $cf->get_indexed_slices($indexClause);

问题在于实际上$rows 不是包含我要获取的数据的数组,而是包含IndexedColumnFamilyIterator 对象。

我做错了什么?

感谢您的帮助。

【问题讨论】:

    标签: php cassandra phpcassa


    【解决方案1】:

    由于您已经交叉发布到用户邮件列表(tisk,tisk :),我将链接到答案并将答案复制到此处以供其他人使用:https://groups.google.com/forum/?fromgroups#!topic/phpcassa/RrYTQc_jQ7s


    它返回一个迭代器,以便它可以自动将查询分解为可管理的块(默认为 100 行)。

    $row_iterator = $cf->get_indexed_slices($indexClause);
    foreach ($row_iterator as $key => $columns) {
        // do stuff
    }
    

    【讨论】:

      猜你喜欢
      • 2014-09-05
      • 1970-01-01
      • 2012-09-04
      • 2014-11-21
      • 1970-01-01
      • 2011-07-27
      • 2012-02-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多