Cache class rewritten to better convention
[mailer.git] / inc / db / lib-mysql3.php
index 7b6f3fc915edfb020bb44a0ffc440401f77926df..c2d781c655672cef838422009c56b92c9803410e 100644 (file)
@@ -38,7 +38,7 @@ if (!defined('__SECURITY')) {
 }
 
 // SQL queries
-function SQL_QUERY($sql_string, $F, $L) {
+function SQL_QUERY ($sql_string, $F, $L) {
        global $link, $CSS, $_CONFIG, $OK;
 
        // Remove \t, \n and \r from queries they may confuse some MySQL version I have heard
@@ -54,15 +54,15 @@ function SQL_QUERY($sql_string, $F, $L) {
 Query string:<br />
 ".$sql_string);
 
-       // Save last successfull query
-       $_CONFIG['db_last_query'] = $sql_string;
-
        // Ending time
        $querytimeAfter = array_sum(explode(' ', microtime()));
 
        // Calculate query time
        $queryTime = $querytimeAfter - $querytimeBefore;
 
+       // Save last successfull query
+       $_CONFIG['db_last_query'] = $sql_string;
+
        // Count this query
        if (!isset($_CONFIG['sql_count'])) $_CONFIG['sql_count'] = 0;
        $_CONFIG['sql_count']++;
@@ -197,6 +197,8 @@ function SQL_CLOSE(&$link, $F, $L) {
                // Skip double close
                return false;
        } // END - if
+
+       // Do we need to update cache/db counter?
        //* DEBUG: */ echo "DB=".$_CONFIG['db_hits'].",CACHE=".$_CONFIG['cache_hits']."<br />\n";
        if ((GET_EXT_VERSION("cache") >= "0.0.7") && (isset($_CONFIG['db_hits'])) && (isset($_CONFIG['cache_hits'])) && (is_object($cacheInstance))) {
                // Add new hits