Skip to content

Commit

Permalink
esd
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangjincheng committed May 28, 2019
1 parent 1953c9a commit 9c6c8f7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Mysql/MysqliDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ class MysqliDb extends \MysqliDb
{
use GetLogger;

public function __construct($host = null, $username = null, $password = null, $db = null, $port = null, $charset = 'utf8', $socket = null)
{
parent::__construct($host, $username, $password, $db, $port, $charset, $socket);
$this->traceEnabled = Server::$instance->getServerConfig()->isDebug();
}

public function isTransactionInProgress(): bool
{
return $this->_transaction_in_progress ?? false;
Expand All @@ -30,9 +36,8 @@ public function reset()
{
$result = parent::reset();
if (Server::$instance->getServerConfig()->isDebug()) {
foreach ($result->trace as $trace) {
$this->debug($trace);
}
$this->debug("Mysql query trace: " . $this->trace[0][0] ?? null);
$this->debug("Mysql query time: " . $this->trace[0][1]*1000 ." ms" ?? null);
}
return $result;
}
Expand Down

0 comments on commit 9c6c8f7

Please sign in to comment.