diff options
author | Nils Adermann <naderman@naderman.de> | 2006-08-01 16:14:14 +0000 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2006-08-01 16:14:14 +0000 |
commit | 09081e410fc015c71dbd460aeafade42d7070b78 (patch) | |
tree | 351a3d34ce43138a2251806bcefa007b48c84a87 /phpBB/includes/db/sqlite.php | |
parent | ced8624b8e86bc6aac143163e538f87376319079 (diff) | |
download | forums-09081e410fc015c71dbd460aeafade42d7070b78.tar forums-09081e410fc015c71dbd460aeafade42d7070b78.tar.gz forums-09081e410fc015c71dbd460aeafade42d7070b78.tar.bz2 forums-09081e410fc015c71dbd460aeafade42d7070b78.tar.xz forums-09081e410fc015c71dbd460aeafade42d7070b78.zip |
- acm_file uses an index pointer to the current row instead of shifting the result array now [Bug #2451]
- all dbals adjusted to use the cache in sql_fetchfield, sql_rowseek, sql_numrows and sql_freeresult [Bug #2451]
- use include_once for dbal.php to at least theoretically allow connections to multiple databases at once
- added a space to an SQL query [Bug #3506]
- detailed information on adding friends/foes [Bugs #2509, #2499]
- e modifier stands for evil, so I removed it ;-)
- corrected progress_bar image filename in imageset.cfg [Bug #3374]
git-svn-id: file:///svn/phpbb/trunk@6225 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/db/sqlite.php')
-rw-r--r-- | phpBB/includes/db/sqlite.php | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php index 95f12175c3..152adfa42c 100644 --- a/phpBB/includes/db/sqlite.php +++ b/phpBB/includes/db/sqlite.php @@ -22,7 +22,7 @@ if (!defined('SQL_LAYER')) { define('SQL_LAYER', 'sqlite'); - include($phpbb_root_path . 'includes/db/dbal.' . $phpEx); + include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); /** * Sqlite Database Abstraction Layer @@ -87,6 +87,12 @@ class dbal_sqlite extends dbal /** * Base query method + * + * @param string $query Contains the SQL query which shall be executed + * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache + * @return mixed When casted to bool the returned value returns true on success and false on failure + * + * @access public */ function sql_query($query = '', $cache_ttl = 0) { @@ -169,11 +175,18 @@ class dbal_sqlite extends dbal */ function sql_numrows($query_id = false) { + global $cache; + if (!$query_id) { $query_id = $this->query_result; } + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_numrows($query_id); + } + return ($query_id) ? @sqlite_num_rows($query_id) : false; } @@ -211,6 +224,8 @@ class dbal_sqlite extends dbal */ function sql_fetchfield($field, $rownum = false, $query_id = false) { + global $cache; + if (!$query_id) { $query_id = $this->query_result; @@ -218,15 +233,17 @@ class dbal_sqlite extends dbal if ($query_id) { - if ($rownum === false) + if ($rownum !== false) { - return @sqlite_column($query_id, $field); + $this->sql_rowseek($rownum, $query_id); } - else + + if (isset($cache->sql_rowset[$query_id])) { - $this->sql_rowseek($rownum, $query_id); - return @sqlite_column($query_id, $field); + return $cache->sql_fetchfield($query_id, $field); } + + return @sqlite_column($query_id, $field); } return false; @@ -238,11 +255,18 @@ class dbal_sqlite extends dbal */ function sql_rowseek($rownum, $query_id = false) { + global $cache; + if (!$query_id) { $query_id = $this->query_result; } + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_rowseek($query_id, $rownum); + } + return ($query_id) ? @sqlite_seek($query_id, $rownum) : false; } @@ -259,6 +283,18 @@ class dbal_sqlite extends dbal */ function sql_freeresult($query_id = false) { + global $cache; + + if (!$query_id) + { + $query_id = $this->query_result; + } + + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_freeresult($query_id); + } + return true; } |