cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Cassandra Wiki] Update of "ClientExamples" by daniellockard
Date Wed, 19 Aug 2009 00:31:16 GMT
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 daniellockard:
http://wiki.apache.org/cassandra/ClientExamples

The comment on the change is:
changed to fit new api... No comments though...

------------------------------------------------------------------------------
  	
    /* Query for data */
  
-   // Specify what Column Family to query against. 
+   // Specify what Column Family to query against.
    $columnParent = new cassandra_ColumnParent();
    $columnParent->column_family = "base_attributes";
-   $columnParent->super_column = null;
+   $columnParent->super_column = NULL;
-     
-   // Start less than zero gets all results
-   $start = '';
-   // Specify a range that you want to get from. -1 ignores the range. 
-   $end = '';
-   // Controls the sorting of the results. Booleand value
-   $is_ascending = true;
-   // Count is used like an SQL limit for creating page-able results. 
-   $count = 10;
-   
+ 
+ 
+   $sliceRange = new cassandra_SliceRange();
+   $sliceRange->start = "";
+   $sliceRange->finish = "";
+   $predicate = new cassandra_SlicePredicate();
+   list() = $predicate->column_names;
+   $predicate->slice_range = $sliceRange;
+ 
+   $consistencyLevel = 1;
    // Issue the Query
+   $keyUserId = 1;
-   $result = $client->get_slice($tableName, $keyUserId, $columnParent, $start, $end, $is_ascending
, $count);
+   $result = $client->get_slice($tableName, $keyUserId, $columnParent, $predicate, $consistencyLevel);
-   
-   
+ 
+ 
    print_r($result);
    $transport->close();
+ 
+  
  
  } catch (TException $tx) {
     print 'TException: '.$tx->why. ' Error: '.$tx->getMessage() . "\n";

Mime
View raw message