diff options
author | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2003-08-10 18:51:07 +0000 |
---|---|---|
committer | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2003-08-10 18:51:07 +0000 |
commit | ecbbf8366506a4f3df2615bae67cd01d74d97321 (patch) | |
tree | e93162419fb573bfcb3857a32520426725ce97de /phpBB/includes/db/mysql.php | |
parent | 0c3708ecc670bf54469e941b1f9c00ed2d712edf (diff) | |
download | forums-ecbbf8366506a4f3df2615bae67cd01d74d97321.tar forums-ecbbf8366506a4f3df2615bae67cd01d74d97321.tar.gz forums-ecbbf8366506a4f3df2615bae67cd01d74d97321.tar.bz2 forums-ecbbf8366506a4f3df2615bae67cd01d74d97321.tar.xz forums-ecbbf8366506a4f3df2615bae67cd01d74d97321.zip |
Renamed $expire_time to $max_age.
Added method_exists() checks for cache managers that would not support the caching of SQL data.
git-svn-id: file:///svn/phpbb/trunk@4366 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/db/mysql.php')
-rw-r--r-- | phpBB/includes/db/mysql.php | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 0e5a8d5c41..f7067adf4f 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -114,20 +114,20 @@ class sql_db } // Base query method - function sql_query($query = '', $expire_time = 0) + function sql_query($query = '', $max_age = 0) { if ($query != '') { global $cache; - if (!$expire_time || !$cache->sql_load($query, $expire_time)) + $this->query_result = false; + if ($max_age && method_exists($cache, 'sql_load')) { - if ($expire_time) - { - $cache_result = true; - } + $this->query_result = $cache->sql_load($query, $max_age); + } - $this->query_result = false; + if (!$this->query_result) + { $this->num_queries++; if (!empty($_GET['explain'])) @@ -194,7 +194,7 @@ class sql_db } } - if (!empty($cache_result)) + if ($max_age && method_exists($cache, 'sql_save')) { $cache->sql_save($query, $this->query_result); @mysql_free_result(array_pop($this->open_queries)); @@ -208,11 +208,10 @@ class sql_db return ($this->query_result) ? $this->query_result : false; } - // 20030406 Ashe: switched up $total and $offset as per MySQL manual - function sql_query_limit($query, $total, $offset = 0, $expire_time = 0) + function sql_query_limit($query, $total, $offset = 0, $max_age = 0) { if ($query != '') - { + { $this->query_result = false; // if $total is set to 0 we do not want to limit the number of rows @@ -223,7 +222,7 @@ class sql_db $query .= ' LIMIT ' . ((!empty($offset)) ? $offset . ', ' . $total : $total); - return $this->sql_query($query, $expire_time); + return $this->sql_query($query, $max_age); } else { @@ -315,7 +314,7 @@ class sql_db $query_id = $this->query_result; } - if ($cache->sql_exists($query_id)) + if (method_exists($cache, 'sql_fetchrow') && $cache->sql_exists($query_id)) { return $cache->sql_fetchrow($query_id); } |