From 91007aa3d69d5f8c7f909593f0607e844de76b40 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Thu, 8 May 2008 06:07:00 +0000 Subject: [PATCH] include trace of executed queries --- libraries/dbi/mysql.dbi.lib.php | 15 +++++++++++++++ libraries/dbi/mysqli.dbi.lib.php | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/libraries/dbi/mysql.dbi.lib.php b/libraries/dbi/mysql.dbi.lib.php index 21eacc501..f65596b61 100644 --- a/libraries/dbi/mysql.dbi.lib.php +++ b/libraries/dbi/mysql.dbi.lib.php @@ -150,6 +150,21 @@ function PMA_DBI_try_query($query, $link = null, $options = 0) $_SESSION['debug']['queries'][$hash]['query'] = $query; $_SESSION['debug']['queries'][$hash]['time'] = $time; } + + $trace = array(); + foreach (debug_backtrace() as $trace_step) { + $trace[] = PMA_Error::relPath($trace_step['file']) . '#' + . $trace_step['line'] . ': ' + . (isset($trace_step['class']) ? $trace_step['class'] : '') + . (isset($trace_step['object']) ? get_class($trace_step['object']) : '') + . (isset($trace_step['type']) ? $trace_step['type'] : '') + . (isset($trace_step['function']) ? $trace_step['function'] : '') + . '(' + . (isset($trace_step['params']) ? implode(', ', $trace_step['params']) : '') + . ')' + ; + } + $_SESSION['debug']['queries'][$hash]['trace'][] = $trace; } return $r; diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php index 551c119cc..f87c4f6e0 100644 --- a/libraries/dbi/mysqli.dbi.lib.php +++ b/libraries/dbi/mysqli.dbi.lib.php @@ -172,6 +172,21 @@ function PMA_DBI_try_query($query, $link = null, $options = 0) $_SESSION['debug']['queries'][$hash]['query'] = $query; $_SESSION['debug']['queries'][$hash]['time'] = $time; } + + $trace = array(); + foreach (debug_backtrace() as $trace_step) { + $trace[] = PMA_Error::relPath($trace_step['file']) . '#' + . $trace_step['line'] . ': ' + . (isset($trace_step['class']) ? $trace_step['class'] : '') + . (isset($trace_step['object']) ? get_class($trace_step['object']) : '') + . (isset($trace_step['type']) ? $trace_step['type'] : '') + . (isset($trace_step['function']) ? $trace_step['function'] : '') + . '(' + . (isset($trace_step['params']) ? implode(', ', $trace_step['params']) : '') + . ')' + ; + } + $_SESSION['debug']['queries'][$hash]['trace'][] = $trace; } return $r;