You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by Apache Wiki <wi...@apache.org> on 2009/07/27 23:58:10 UTC
[Cassandra Wiki] Trivial Update of "ClientExamples" by wadearnold
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Cassandra Wiki" for change notification.
The following page has been changed by wadearnold:
http://wiki.apache.org/cassandra/ClientExamples
------------------------------------------------------------------------------
{{{
<?php
$GLOBALS['THRIFT_ROOT'] = '/usr/share/php/Thrift';
-
require_once $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/Cassandra.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php';
require_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
@@ -22, +21 @@
$protocol = new TBinaryProtocol($transport);
$client = new CassandraClient($protocol);
$transport->open();
+
-
-
/* Insert some data into base attributes */
// Table name specified in storage=conf.xml
@@ -52, +50 @@
// Add a new column path to be altered.
$columnPath->column = 'age';
$columnPath= new cassandra_ColumnPath($columnPathArgs);
+
//Get a current timestamp
$timestamp = time();
+
// Update the value to be inserted for the updated column Path
$value = "24";
$client->insert($tableName, $keyUserId, $columnPath, $value, $timestamp, $block_for);
@@ -76, +76 @@
// Issue the Query
$result = $client->get_slice($tableName, $keyUserId, $columnParent, $start, $end, $is_ascending , $count);
-
print_r($result);
$transport->close();