public function batch_insert($keyspace, $key, $cfmap, $consistency_level) { $this->send_batch_insert($keyspace, $key, $cfmap, $consistency_level); $this->recv_batch_insert(); }
$column1->value = 'fooey value'; $column1->timestamp = time(); $column2 = new cassandra_Column(); $column2->name = 'bar'; $column2->value = 'bar like thing'; $column2->timestamp = time(); // build super column containing the columns $super_column = new cassandra_SuperColumn(); $super_column->name = 'SuperColumnName'; $super_column->columns = array($column1, $column2); // create columnorsupercolumn holder class that batch_insert uses $c_or_sc = new cassandra_ColumnOrSuperColumn(); $c_or_sc->super_column = $super_column; // create the mutation (a map of ColumnFamily names to lists ColumnsOrSuperColumns objects $mutation['Super1'] = array($c_or_sc); $client->batch_insert($keyspace, 'KeyName', $mutation, $consistency_level); /* Query for data */ // Specify what Column Family to query against. $columnParent = new cassandra_ColumnParent(); $columnParent->column_family = "Standard1"; $columnParent->super_column = NULL; $sliceRange = new cassandra_SliceRange(); $sliceRange->start = ""; $sliceRange->finish = ""; $predicate = new cassandra_SlicePredicate(); list() = $predicate->column_names; $predicate->slice_range = $sliceRange; // We want the consistency level to be ONE which means to only wait for 1 node $consistency_level = cassandra_ConsistencyLevel::ONE; // Issue the Query $keyUserId = 1;