[英]Get value from Cassandra with PHPCASSA
我最近切换到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
对象。
我做错什么了吗?
感谢您的帮助。
由于您已经交叉发布到用户邮件列表(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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.