31 public static function query($hql) {
33 return self::$_client->hql_query(self::$_namespace, $hql);
37 public static function insert($table, $row, $column, $value, $timestamp=0) {
40 $hql=
"INSERT INTO $table VALUES ('$row', '$column', '$value')";
42 $hql=
"INSERT INTO $table VALUES ('$timestamp', '$row', '$column', ".
44 return self::$_client->hql_query(self::$_namespace, $hql);
48 public static function delete($table, $row, $column, $timestamp=0) {
51 $hql=
"DELETE \"$column\" FROM $table WHERE ROW = \"$row\"";
53 $hql=
"DELETE \"$column\" FROM $table WHERE ROW = \"$row\" ".
55 return self::$_client->hql_query(self::$_namespace, $hql);
61 $epoch=(int)($ts/1000000000);
63 date_default_timezone_set(
'UTC');
64 return sprintf(
"%s:%u", date(
"Y-m-d H:i:s", $epoch), $rem);
71 $k=
new Hypertable_ThriftGen_Key();
73 $k->column_family=$cf;
74 return self::$_client->create_cell_unique(self::$_namespace,
79 public static function close() {
80 if (self::$_namespace) {
81 self::$_client->close_namespace(self::$_namespace);
82 self::$_namespace=null;
89 $bootstrap = Zend_Controller_Front::getInstance()->getParam(
'bootstrap');
90 $options = $bootstrap->getOptions();
91 if (!self::$_client) {
92 $host=$options[
'hypertable'][
'thriftclient'][
'hostname'];
93 $port=$options[
'hypertable'][
'thriftclient'][
'port'];
94 self::$_client=
new Hypertable_ThriftClient($host, $port);
96 if (!self::$_namespace) {
97 $ns=$options[
'hypertable'][
'namespace'];
98 self::$_namespace=self::$_client->open_namespace($ns);
void initialize(const String &name)
Public initialization function - creates a singleton instance of LogWriter.
static insert($table, $row, $column, $value, $timestamp=0)
static format_timestamp_ns($ts)
Copyright (C) 2007-2015 Hypertable, Inc.
static create_cell_unique($table, $row, $cf)