本文整理汇总了PHP中Profiler::queryStart方法的典型用法代码示例。如果您正苦于以下问题:PHP Profiler::queryStart方法的具体用法?PHP Profiler::queryStart怎么用?PHP Profiler::queryStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profiler
的用法示例。
在下文中一共展示了Profiler::queryStart方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _connect
/**
* Creates a PDO object and connects to the database.
*
* @return void
* @throws \mysqli_sql_exception
*/
protected function _connect()
{
if ($this->_profiler) {
$q = $this->_profiler->queryStart('connect', Profiler::CONNECT);
}
$config = $this->_config;
if (!empty($config['driver_options'])) {
foreach ($config['driver_options'] as $option => $value) {
parent::options($option, $value);
}
}
//try {省略throw-catch-rethrow块,直接抛出\mysqli_sql_exception
parent::real_connect((empty($config['persistent']) ? '' : 'p:') . (isset($config['host']) ? $config['host'] : ini_get("mysqli.default_host")), isset($config['username']) ? $config['username'] : ini_get("mysqli.default_user"), isset($config['password']) ? $config['password'] : ini_get("mysqli.default_pw"), isset($config['dbname']) ? $config['dbname'] : "", isset($config['port']) ? $config['port'] : ini_get("mysqli.default_port"), isset($config['socket']) ? $config['socket'] : ini_get("mysqli.default_socket"));
if ($this->connect_errno) {
throw new ConnectException($this->connect_error, $this->connect_errno);
}
$this->_isConnected = true;
if ($this->_profiler) {
$this->_profiler->queryEnd($q);
}
if (!empty($config['charset'])) {
parent::set_charset($config['charset']);
}
}
示例2: rollBack
/**
* Roll back a transaction and return to autocommit mode.
*
* @return \Micro\Database\Adapter\AdapterAbstract
*/
public function rollBack()
{
$this->_connect();
$q = $this->_profiler->queryStart('rollback', \Micro\Database\Profiler::TRANSACTION);
$this->_rollBack();
$this->_profiler->queryEnd($q);
return $this;
}