How to fetch the columns in a single row in reverse order with PHPCassa?
Asked
Active
Viewed 539 times
2 Answers
3
From phpcassa documentation
public function get($key,
$columns=null,
$column_start="",
$column_finish="",
$column_reversed=False,
$column_count=self::DEFAULT_COLUMN_COUNT,
$super_column=null,
$read_consistency_level=null)
See "@param bool $column_reversed
fetch the columns in reverse order"
Setting this parameter to "true" will fetch the columns in reverse order.
You can even set this parameter for multiget, get_range and get_indexed_slices queries.
For More Detail see: phpcassa columnfamily documentation

samarth
- 3,866
- 7
- 45
- 60
-
1The docs you linked to seem to be for an old version (basically 0.8.a.2). The most recent version can be found here: http://thobbs.github.com/phpcassa/api/class-phpcassa.ColumnFamily.html#_get – Tyler Hobbs Jun 05 '12 at 04:40
2
Trick is done with empty column slice object.
...
$cf = new ColumnFamily($pool, 'mycolumnfamily');
// normal order
$rows = $cf->get('mykey');
print_r($rows);
// reverse order, 5 is column count, true is reverse order
$rows = $cf->get('mykey', new ColumnSlice(null, null, 5, true) );
print_r($rows);

Nick
- 9,962
- 4
- 42
- 80