From 3634ba80946b818de7f0505ed44d947e70dd41ec Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 12 May 2008 05:58:17 +0000 Subject: added in some caching and add the database upgrade that will make the taging mostly work --- lib/class/dba.class.php | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'lib/class/dba.class.php') diff --git a/lib/class/dba.class.php b/lib/class/dba.class.php index 6515b71f..a4685f21 100644 --- a/lib/class/dba.class.php +++ b/lib/class/dba.class.php @@ -32,8 +32,9 @@ if (INIT_LOADED != '1') { exit; } */ class Dba { - private static $_default_db; + public static $stats = array('query'=>0); + private static $_default_db; private static $_sql; private static $config; @@ -53,16 +54,14 @@ class Dba { * The mysql_query function */ public static function query($sql) { - /*if ($_REQUEST['profiling']) { - $sql = rtrim($sql, '; '); - $sql .= ' SQL_NO_CACHE'; - }*/ + // Run the query $resource = mysql_query($sql,self::dbh()); debug_event('Query',$sql,'6'); // Save the query, to make debug easier self::$_sql = $sql; + self::$stats['query']++; return $resource; @@ -200,17 +199,23 @@ class Dba { } // _connect + /** + * show_profile + * This function is used for debug, helps with profiling + */ public static function show_profile() { - if ($_REQUEST['profiling']) { - print '
Profiling data:
'; - $res = Dba::query('show profiles'); - print ''; - while ($r = Dba::fetch_row($res)) { - print ''; - } - print '
' . implode('', $r) . '
'; - } - } + + if (Config::get('sql_profiling')) { + print '
Profiling data:
'; + $res = Dba::query('show profiles'); + print ''; + while ($r = Dba::fetch_row($res)) { + print ''; + } + print '
' . implode('', $r) . '
'; + } + } // show_profile + /** * dbh * This is called by the class to return the database handle -- cgit