Skip to content

Commit

Permalink
Query类增加getSqlLog方法获取sql日志信息
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Oct 27, 2017
1 parent 6ea7e95 commit 558980d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/db/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public function connect(array $config = [], $linkNum = 0, $autoConnection = fals
}
} catch (\PDOException $e) {
if ($autoConnection) {
$this->log($e->getMessage(), 'error');
$this->log('[ ERR ] ' . $e->getMessage());
return $this->connect($autoConnection, $linkNum);
} else {
throw $e;
Expand Down Expand Up @@ -1840,7 +1840,7 @@ public function log($log)

public function getSqlLog()
{
return $this->log;
return self::$log;
}

/**
Expand Down
10 changes: 10 additions & 0 deletions src/db/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,16 @@ public function getLastSql()
return $this->connection->getLastSql();
}

/**
* 获取sql记录
* @access public
* @return string
*/
public function getSqlLog()
{
return $this->connection->getSqlLog();
}

/**
* 执行数据库事务
* @access public
Expand Down

0 comments on commit 558980d

Please sign in to comment.