diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-05-12 02:52:50 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-05-12 02:52:50 +0000 |
commit | 693e26e2ad074f8cc9d37098a0568cd93ae30f52 (patch) | |
tree | 8588523335a337d0971df768da0456e325bb6b66 /lib/class/dba.class.php | |
parent | 003619c52c0370f03b9edb466addaaebac13ce41 (diff) | |
download | ampache-693e26e2ad074f8cc9d37098a0568cd93ae30f52.tar.gz ampache-693e26e2ad074f8cc9d37098a0568cd93ae30f52.tar.bz2 ampache-693e26e2ad074f8cc9d37098a0568cd93ae30f52.zip |
commit of the patches from codeoverload to implement tagging, will not work without manual modification of database, yes.. this commit breaks things cope
Diffstat (limited to 'lib/class/dba.class.php')
-rw-r--r-- | lib/class/dba.class.php | 21 |
1 files changed, 20 insertions, 1 deletions
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 '<br/>Profiling data: <br/>'; + $res = Dba::query('show profiles'); + print '<table>'; + while ($r = Dba::fetch_row($res)) { + print '<tr><td>' . implode('</td><td>', $r) . '</td></tr>'; + } + print '</table>'; + } + } /** * dbh * This is called by the class to return the database handle |