本文整理汇总了PHP中Debugger::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::query方法的具体用法?PHP Debugger::query怎么用?PHP Debugger::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debugger
的用法示例。
在下文中一共展示了Debugger::query方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($sql)
{
if (!$this->write_connection()) {
throw new Exception("Write connection not established");
return false;
}
//echo "<br> " . $sql . "<br>";
$start = microtime(true);
$result = $this->write->query($sql);
$end = microtime(true);
$database_name = $this->write_settings['server'] . " (" . $this->write_settings["host"];
if (isset($this->write_settings["port"])) {
$database_name .= ":" . $this->write_settings["port"];
}
$database_name .= ")";
if (!$result && $this->write->errno == 1205) {
error_log("Database::execute() failed with error 1205, retrying in 3 seconds.");
sleep(3);
$this->result = $this->write->query($sql);
}
Debugger::query($sql, $end - $start, $database_name);
if (!$result) {
$error = new MySqliError($this->write->errno, $this->write->error, $sql);
if (count($this->errors) > self::$MAX_ERRORS) {
array_shift($this->errors);
}
$this->errors[] = $error;
return false;
}
return $result;
}
示例2: write
function write($keyspace, $key, $column_family, $data, $consistency)
{
try {
Loader::load("vendor", "phpcassa/columnfamily.php");
$columnFamily = new columnFamily($this->connection($keyspace), $column_family);
//echo "use phpcassa!\n";
//exit;
if (Config::isLive() || Config::isStaging()) {
return $columnFamily->insert($key, $data, null, null, $consistency);
}
$time = $this->microsecond_timestamp();
$cassandra_mutations = array();
foreach ($data as $key => $value) {
$cassandra_mutations[$key][$column_family][] = new cassandra_Mutation(array("column_or_supercolumn" => new cassandra_ColumnOrSuperColumn(array("column" => new cassandra_Column(array("name" => $key, "value" => $value, "timestamp" => $time))))));
}
//Debugger::log("set keyspace $keyspace");
$this->set_keyspace($keyspace);
$start = microtime(true);
$this->get_client()->batch_mutate($cassandra_mutations, $this->consistency());
$end = microtime(true);
if (json_encode($cassandra_mutations) == null) {
print_r($cassandra_mutations);
exit;
}
//error_log("Thrift::batch_mutate(".json_encode($cassandra_mutations).") " . "(".$this->host .":".$this->settings["port"].")");
Debugger::query("Thrift::batch_mutate(" . json_encode($cassandra_mutations) . ")", $end - $start, $keyspace . "(" . $this->settings["ip"] . ":" . $this->settings["port"] . ")");
return true;
} catch (Exception $e) {
$info = isset($e->why) ? $e->why : get_class($e);
throw new Exception("Database connection is not available: {$info} {$this->host}");
return false;
}
}
示例3: set
static function set($key, $value, $ttl = 0)
{
if (self::isAvailable()) {
$start = microtime();
$start = explode(" ", $start);
$start = $start[1] + $start[0];
self::getInstance()->cache->set($key, $value, 0, $ttl);
$end = microtime();
$end = explode(" ", $end);
$end = $end[1] + $end[0];
$database_name = "MEMCACHE";
Debugger::query("***MemCache SET: {$key}***", $end - $start, __CLASS__);
} else {
error_log("MEMCACHE IS UNAVAILABLE. PLEASE CALL MemCache::isAvailable() before using!!!!");
}
}