Пример #1
0
$tables = $client->getTableNames();
sort($tables);
foreach ($tables as $name) {
    echo nl2br("  found: {$name}\n");
}
$columns = array(new ColumnDescriptor(array('name' => 'entry:', 'maxVersions' => 10)), new ColumnDescriptor(array('name' => 'unused:')));
$t = "table1";
echo "creating table: {$t}\n";
try {
    $client->createTable($t, $columns);
} catch (AlreadyExists $ae) {
    echo "WARN: {$ae->message}\n";
}
$t = "test";
echo "column families in {$t}:\n";
$descriptors = $client->getColumnDescriptors($t);
asort($descriptors);
foreach ($descriptors as $col) {
    echo "  column: {$col->name}, maxVer: {$col->maxVersions}\n";
}
$t = "table1";
echo "column families in {$t}:\n";
$descriptors = $client->getColumnDescriptors($t);
asort($descriptors);
foreach ($descriptors as $col) {
    echo "  column: {$col->name}, maxVer: {$col->maxVersions}\n";
}
$t = "table1";
$row = "row_name";
$valid = "foobar-生ビ";
$mutations = array(new Mutation(array('column' => 'entry:foo', 'value' => $valid)));
Пример #2
0
sort($tables);
foreach ($tables as $name) {
    echo $name . "\r\n";
}
//create a fc and then create a table
$columns = array(new \Hbase\ColumnDescriptor(array('name' => 'id:', 'maxVersions' => 10)), new \Hbase\ColumnDescriptor(array('name' => 'name:')), new \Hbase\ColumnDescriptor(array('name' => 'score:')));
$tableName = "student";
/*
try {
    $client->createTable($tableName, $columns);
} catch (AlreadyExists $ae) {
    var_dump( "WARN: {$ae->message}\n" );
}
*/
// get table descriptors
$descriptors = $client->getColumnDescriptors($tableName);
asort($descriptors);
foreach ($descriptors as $col) {
    var_dump("  column: {$col->name}, maxVer: {$col->maxVersions}\n");
}
//set clomn
//add update column data
$time = time();
var_dump($time);
$row = '2';
$valid = "foobar-" . $time;
$mutations = array(new \Hbase\Mutation(array('column' => 'score', 'value' => $valid)));
$mutations1 = array(new \Hbase\Mutation(array('column' => 'score:a', 'value' => $time)));
$attributes = array();
//add row, write a row
$row1 = $time;