From 752b1bd0ed2bf16450f090d337b2e87b5e0e59c4 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Wed, 1 Oct 2008 14:05:28 +0000 Subject: Added logging of querys to _sqllog if debug_sqllog is set --- it_dbi.class | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'it_dbi.class') diff --git a/it_dbi.class b/it_dbi.class index 356930e..c85b43f 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -418,7 +418,13 @@ function query($query, $p = array()) { $end = gettimeofday(); $msec = round(($end['sec'] - $start['sec']) * 1000 + ($end['usec'] - $start['usec']) / 1000); - it::log('sqllog', "$msec\t$query" . (EDC('sqltrace') ? "\t" . it_debug::backtrace(1) : "")); + $backtrace = EDC('sqltrace') ? it_debug::backtrace(1) : null; + it::log('sqllog', rtrim("$msec\t$query\t$backtrace")); + + $this->_sqllog[] = array( + 'time' => $msec, + 'query' => $query, + ) + ($backtrace ? array('backtrace' => $backtrace) : array()); } return $result; -- cgit v1.2.3