mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Closes #3530, SQL log not shown when enabling debugging only for certain actions
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5988 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
eb6c94a01e
commit
656ab3a9ab
1 changed files with 6 additions and 8 deletions
|
@ -88,8 +88,6 @@ class DboSource extends DataSource {
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
function __construct($config = null, $autoConnect = true) {
|
function __construct($config = null, $autoConnect = true) {
|
||||||
$this->debug = Configure::read() > 0;
|
|
||||||
$this->fullDebug = Configure::read() > 1;
|
|
||||||
parent::__construct($config);
|
parent::__construct($config);
|
||||||
|
|
||||||
if ($autoConnect) {
|
if ($autoConnect) {
|
||||||
|
@ -158,7 +156,7 @@ class DboSource extends DataSource {
|
||||||
$this->error = $this->lastError();
|
$this->error = $this->lastError();
|
||||||
$this->numRows = $this->lastNumRows($this->_result);
|
$this->numRows = $this->lastNumRows($this->_result);
|
||||||
|
|
||||||
if ($this->fullDebug && Configure::read() > 1) {
|
if (Configure::read() > 1) {
|
||||||
$this->logQuery($sql);
|
$this->logQuery($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,11 +428,11 @@ class DboSource extends DataSource {
|
||||||
*/
|
*/
|
||||||
function showQuery($sql) {
|
function showQuery($sql) {
|
||||||
$error = $this->error;
|
$error = $this->error;
|
||||||
if (strlen($sql) > 200 && !$this->fullDebug && Configure::read() > 1) {
|
if (strlen($sql) > 200 && Configure::read() > 1) {
|
||||||
$sql = substr($sql, 0, 200) . '[...]';
|
$sql = substr($sql, 0, 200) . '[...]';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($this->debug || $error) && Configure::read() > 0) {
|
if (($error) && Configure::read() > 0) {
|
||||||
e("<p style = \"text-align:left\"><b>Query:</b> {$sql} ");
|
e("<p style = \"text-align:left\"><b>Query:</b> {$sql} ");
|
||||||
if ($error) {
|
if ($error) {
|
||||||
trigger_error("<span style = \"color:Red;text-align:left\"><b>SQL Error:</b> {$this->error}</span>", E_USER_WARNING);
|
trigger_error("<span style = \"color:Red;text-align:left\"><b>SQL Error:</b> {$this->error}</span>", E_USER_WARNING);
|
||||||
|
@ -1798,7 +1796,7 @@ class DboSource extends DataSource {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function close() {
|
function close() {
|
||||||
if ($this->fullDebug && Configure::read() > 1) {
|
if (Configure::read() > 1) {
|
||||||
$this->showLog();
|
$this->showLog();
|
||||||
}
|
}
|
||||||
$this->disconnect();
|
$this->disconnect();
|
||||||
|
|
Loading…
Add table
Reference in a new issue