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/08/19 02:31:16 UTC

[Cassandra Wiki] Update of "ClientExamples" by daniellockard

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";