From 693e26e2ad074f8cc9d37098a0568cd93ae30f52 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 12 May 2008 02:52:50 +0000 Subject: commit of the patches from codeoverload to implement tagging, will not work without manual modification of database, yes.. this commit breaks things cope --- lib/class/dba.class.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'lib/class/dba.class.php') diff --git a/lib/class/dba.class.php b/lib/class/dba.class.php index 62df46fe..6515b71f 100644 --- a/lib/class/dba.class.php +++ b/lib/class/dba.class.php @@ -53,7 +53,10 @@ 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'); @@ -188,10 +191,26 @@ class Dba { $select_db = mysql_select_db($database,$dbh); if (!$select_db) { debug_event('Database','Error unable to select ' . $database . ' error ' . mysql_error(),'1'); } + if ($_REQUEST['profiling']) { + mysql_query('set profiling=1', $dbh); + mysql_query('set profiling_history_size=50', $dbh); + mysql_query('set query_cache_type=0', $dbh); + } return $dbh; } // _connect + 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) . '
'; + } + } /** * dbh * This is called by the class to return the database handle -- cgit