[limb-svn] r6981 - 3.x/trunk/limb/dbal/src/drivers
svn at limb-project.com
svn at limb-project.com
Sun May 4 13:04:00 MSD 2008
Author: conf
Date: 2008-05-04 13:04:00 +0400 (Sun, 04 May 2008)
New Revision: 6981
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6981
Modified:
3.x/trunk/limb/dbal/src/drivers/lmbAuditDbConnection.class.php
Log:
-- fixed bug of not showing query text in CUD queries
-- added showing query backtrace
Modified: 3.x/trunk/limb/dbal/src/drivers/lmbAuditDbConnection.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/drivers/lmbAuditDbConnection.class.php 2008-05-04 08:26:58 UTC (rev 6980)
+++ 3.x/trunk/limb/dbal/src/drivers/lmbAuditDbConnection.class.php 2008-05-04 09:04:00 UTC (rev 6981)
@@ -11,6 +11,8 @@
lmbDecorator :: generate(get_class(lmbToolkit::instance()->getDefaultDbConnection()), 'lmbDbConnectionDecorator');
+lmb_require('limb/log/src/lmbBacktrace.class.php');
+
/**
* class lmbAuditDbConnection.
* Remembers stats for later analysis, especially useful in tests
@@ -24,6 +26,7 @@
function execute($sql)
{
$info = array('query' => $sql);
+ $info['trace'] = $this->getTrace();
$start_time = microtime(true);
$res = parent :: execute($sql);
$info['time'] = round(microtime(true) - $start_time, 6);
@@ -33,7 +36,8 @@
function executeStatement($stmt)
{
- $info = array('query' => get_class($stmt));
+ $info = array('query' => $stmt->getSQL());
+ $info['trace'] = $this->getTrace();
$start_time = microtime(true);
$res = parent :: executeStatement($stmt);
$info['time'] = round(microtime(true) - $start_time, 6);
@@ -71,6 +75,14 @@
return $res;
}
+ function getTrace() {
+ $trace_length = 8;
+ $offset = 4; // getting rid of useless trace elements
+
+ $trace = new lmbBacktrace($trace_length, $offset);
+ return $trace->toString();
+ }
+
function getStats()
{
return $this->stats;
More information about the limb-svn
mailing list