本文整理汇总了PHP中wcf\system\WCF::benchmarkIsEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP WCF::benchmarkIsEnabled方法的具体用法?PHP WCF::benchmarkIsEnabled怎么用?PHP WCF::benchmarkIsEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wcf\system\WCF
的用法示例。
在下文中一共展示了WCF::benchmarkIsEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeUnbuffered
/**
* Executes a prepared statement.
*
* @param array $parameters
*/
public function executeUnbuffered(array $parameters = array()) {
$this->parameters = $parameters;
$this->database->incrementQueryCount();
try {
if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->start($this->query, Benchmark::TYPE_SQL_QUERY);
if (empty($parameters)) $this->pdoStatement->execute();
else $this->pdoStatement->execute($parameters);
if (WCF::benchmarkIsEnabled()) Benchmark::getInstance()->stop();
}
catch (\PDOException $e) {
throw new DatabaseException('Could not execute prepared statement: '.$e->getMessage(), $this->database, $this);
}
}
示例2: rollBackTransaction
/**
* Rolls back a transaction and returns true if the rollback was successfull.
*
* @return boolean
*/
public function rollBackTransaction()
{
if ($this->activeTransactions === 0) {
return false;
}
try {
$this->activeTransactions--;
if ($this->activeTransactions === 0) {
if (WCF::benchmarkIsEnabled()) {
Benchmark::getInstance()->start("ROLLBACK", Benchmark::TYPE_SQL_QUERY);
}
$result = $this->pdo->rollback();
} else {
if (WCF::benchmarkIsEnabled()) {
Benchmark::getInstance()->start("ROLLBACK TO SAVEPOINT level" . $this->activeTransactions, Benchmark::TYPE_SQL_QUERY);
}
$result = $this->pdo->exec("ROLLBACK TO SAVEPOINT level" . $this->activeTransactions) !== false;
}
if (WCF::benchmarkIsEnabled()) {
Benchmark::getInstance()->stop();
}
return $result;
} catch (\PDOException $e) {
throw new DatabaseException("Cannot rollback transaction: " . $e->getMessage(), $this);
}
}