Inheritance: extends HqlServiceClient
Example #1
0
<?php

$GLOBALS['THRIFT_ROOT'] = $_ENV['PHPTHRIFT_ROOT'];
require_once dirname(__FILE__) . '/ThriftClient.php';
$client = new Hypertable_ThriftClient("localhost", 38080);
print_r($client->hql_query("show tables"));
print_r($client->hql_query("select * from thrift_test"));
Example #2
0
#
# Hypertable is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
if (!isset($GLOBALS['THRIFT_ROOT'])) {
    $GLOBALS['THRIFT_ROOT'] = getenv('PHPTHRIFT_ROOT');
}
require_once dirname(__FILE__) . '/ThriftClient.php';
$client = new Hypertable_ThriftClient("localhost", 38080);
$namespace = $client->namespace_open("test");
echo "HQL examples\n";
print_r($client->hql_query($namespace, "show tables"));
print_r($client->hql_query($namespace, "select * from thrift_test revs=1 "));
echo "mutator examples\n";
$mutator = $client->mutator_open($namespace, "thrift_test", 0, 0);
$key = new Hypertable_ThriftGen_Key(array('row' => 'php-k1', 'column_family' => 'col'));
$cell = new Hypertable_ThriftGen_Cell(array('key' => $key, 'value' => 'php-v1'));
$client->mutator_set_cell($mutator, $cell);
$client->mutator_close($mutator);
echo "shared mutator examples\n";
$mutate_spec = new Hypertable_ThriftGen_MutateSpec(array('appname' => "test-php", 'flush_interval' => 1000, 'flags' => 0));
$key = new Hypertable_ThriftGen_Key(array('row' => 'php-put-k1', 'column_family' => 'col'));
$cell = new Hypertable_ThriftGen_Cell(array('key' => $key, 'value' => 'php-put-v1'));
$client->shared_mutator_set_cell($namespace, "thrift_test", $mutate_spec, $cell);
Example #3
0
<?php

$GLOBALS['THRIFT_ROOT'] = $_ENV['PHPTHRIFT_ROOT'];
require_once dirname(__FILE__) . '/ThriftClient.php';
$client = new Hypertable_ThriftClient("localhost", 38080);
echo "HQL examples\n";
print_r($client->hql_query("show tables"));
print_r($client->hql_query("select * from thrift_test revs=1"));
echo "mutator examples\n";
$mutator = $client->open_mutator("thrift_test");
$client->set_cell($mutator, new Hypertable_ThriftGen_Cell(array('row_key' => 'php-k1', 'column_family' => 'col', 'value' => 'php-v1')));
$client->close_mutator($mutator, true);
echo "scanner examples\n";
$scanner = $client->open_scanner("thrift_test", new Hypertable_ThriftGen_ScanSpec(array('revs' => 1)), true);
$cells = $client->next_cells($scanner);
while (!empty($cells)) {
    print_r($cells);
    $cells = $client->next_cells($scanner);
}
Example #4
0
<?php

$GLOBALS['THRIFT_ROOT'] = $_ENV['PHPTHRIFT_ROOT'];
require_once dirname(__FILE__) . '/ThriftClient.php';
$client = new Hypertable_ThriftClient("localhost", 38080);
$namespace = $client->open_namespace("test");
echo "HQL examples\n";
print_r($client->hql_query($namespace, "show tables"));
print_r($client->hql_query($namespace, "select * from thrift_test revs=1 "));
echo "mutator examples\n";
$mutator = $client->open_mutator($namespace, "thrift_test", 0, 0);
$key = new Hypertable_ThriftGen_Key(array('row' => 'php-k1', 'column_family' => 'col'));
$cell = new Hypertable_ThriftGen_Cell(array('key' => $key, 'value' => 'php-v1'));
$client->set_cell($mutator, $cell);
$client->close_mutator($mutator, true);
echo "shared mutator examples\n";
$mutate_spec = new Hypertable_ThriftGen_MutateSpec(array('appname' => "test-php", 'flush_interval' => 1000, 'flags' => 0));
$key = new Hypertable_ThriftGen_Key(array('row' => 'php-put-k1', 'column_family' => 'col'));
$cell = new Hypertable_ThriftGen_Cell(array('key' => $key, 'value' => 'php-put-v1'));
$client->offer_cell($namespace, "thrift_test", $mutate_spec, $cell);
$key = new Hypertable_ThriftGen_Key(array('row' => 'php-put-k2', 'column_family' => 'col'));
$cell = new Hypertable_ThriftGen_Cell(array('key' => $key, 'value' => 'php-put-v2'));
$client->refresh_shared_mutator($namespace, "thrift_test", $mutate_spec);
$client->offer_cell($namespace, "thrift_test", $mutate_spec, $cell);
sleep(2);
echo "scanner examples\n";
$scanner = $client->open_scanner($namespace, "thrift_test", new Hypertable_ThriftGen_ScanSpec(array('revs' => 1)), true);
$cells = $client->next_cells($scanner);
while (!empty($cells)) {
    print_r($cells);
    $cells = $client->next_cells($scanner);
Example #5
0
<?php

$GLOBALS['THRIFT_ROOT'] = $_ENV['PHPTHRIFT_ROOT'];
require_once dirname(__FILE__) . '/ThriftClient.php';
$client = new Hypertable_ThriftClient("localhost", 38080);
echo "HQL examples\n";
print_r($client->hql_query("show tables"));
print_r($client->hql_query("select * from thrift_test revs=1"));
echo "mutator examples\n";
$mutator = $client->open_mutator("thrift_test", 0, 0);
$key = new Hypertable_ThriftGen_Key(array('row' => 'php-k1', 'column_family' => 'col'));
$cell = new Hypertable_ThriftGen_Cell(array('key' => $key, 'value' => 'php-v1'));
$client->set_cell($mutator, $cell);
$client->close_mutator($mutator, true);
echo "shared mutator examples\n";
$mutate_spec = new Hypertable_ThriftGen_MutateSpec(array('appname' => "test-php", 'flush_interval' => 1000, 'flags' => 0));
$key = new Hypertable_ThriftGen_Key(array('row' => 'php-put-k1', 'column_family' => 'col'));
$cell = new Hypertable_ThriftGen_Cell(array('key' => $key, 'value' => 'php-put-v1'));
$client->put_cell("thrift_test", $mutate_spec, $cell);
$key = new Hypertable_ThriftGen_Key(array('row' => 'php-put-k2', 'column_family' => 'col'));
$cell = new Hypertable_ThriftGen_Cell(array('key' => $key, 'value' => 'php-put-v2'));
$client->put_cell("thrift_test", $mutate_spec, $cell);
sleep(2);
echo "scanner examples\n";
$scanner = $client->open_scanner("thrift_test", new Hypertable_ThriftGen_ScanSpec(array('revs' => 1)), true);
$cells = $client->next_cells($scanner);
while (!empty($cells)) {
    print_r($cells);
    $cells = $client->next_cells($scanner);
}