diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-05-12 05:58:17 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-05-12 05:58:17 +0000 |
commit | 3634ba80946b818de7f0505ed44d947e70dd41ec (patch) | |
tree | 03749fb9cc1f1fc6ef157ac187cea48f1f1a7098 /lib/class/dba.class.php | |
parent | 3e36e0b01e843ec8d4e8a63a72e5f7425921dab8 (diff) | |
download | ampache-3634ba80946b818de7f0505ed44d947e70dd41ec.tar.gz ampache-3634ba80946b818de7f0505ed44d947e70dd41ec.tar.bz2 ampache-3634ba80946b818de7f0505ed44d947e70dd41ec.zip |
added in some caching and add the database upgrade that will make the taging mostly work
Diffstat (limited to 'lib/class/dba.class.php')
-rw-r--r-- | lib/class/dba.class.php | 35 |
1 files changed, 20 insertions, 15 deletions
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 '<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>'; - } - } + + if (Config::get('sql_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>'; + } + } // show_profile + /** * dbh * This is called by the class to return the database handle |