From e4404f222d1698b582d5966b12d1c432fb7fe147 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Mon, 8 Oct 2007 11:48:23 +0000 Subject: Added debug parameter sqltrace (sqllog with backtrace included) --- it_dbi.class | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/it_dbi.class b/it_dbi.class index 6104d93..a18b9ed 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -36,6 +36,7 @@ class it_dbi 'classprefix' => "", 'persistent' => false, 'sqllog' => false, + 'sqltrace' => false, ); var $_key; # Key of currently loaded record or null (public readonly) @@ -63,7 +64,7 @@ function it_dbi($p = array(), $query = null) $p += $dp; # Combine our settings with user's defaults and class defaults - $p += (array)$GLOBALS['it_dbi_defaultconfig'] + array('sqllog' => EDC('sqllog'), 'db' => $GLOBALS['ULTRADB']) + $this->_defaultconfig; + $p += (array)$GLOBALS['it_dbi_defaultconfig'] + array('sqllog' => EDC('sqllog') || EDC('sqltrace'), 'sqltrace' => EDC('sqltrace'), 'db' => $GLOBALS['ULTRADB']) + $this->_defaultconfig; unset($this->_defaultconfig); # to shorten ED() output $p['dbid'] = "{$p['user']}@{$p['server']}:{$p['db']}"; @@ -404,7 +405,7 @@ function query($query) { $end = gettimeofday(); $msec = round(($end['sec'] - $start['sec']) * 1000 + ($end['usec'] - $start['usec']) / 1000); - it::log('sqllog', "$msec\t$query"); + it::log('sqllog', "$msec\t$query" . ($this->_p['sqltrace'] ? "\t" . it_debug::backtrace(1) : "")); } return $result; -- cgit v1.2.3