aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acm
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2006-08-01 16:14:14 +0000
committerNils Adermann <naderman@naderman.de>2006-08-01 16:14:14 +0000
commit09081e410fc015c71dbd460aeafade42d7070b78 (patch)
tree351a3d34ce43138a2251806bcefa007b48c84a87 /phpBB/includes/acm
parentced8624b8e86bc6aac143163e538f87376319079 (diff)
downloadforums-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/acm')
-rw-r--r--phpBB/includes/acm/acm_file.php63
1 files changed, 62 insertions, 1 deletions
diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php
index 8de53144ea..7cfc487518 100644
--- a/phpBB/includes/acm/acm_file.php
+++ b/phpBB/includes/acm/acm_file.php
@@ -19,6 +19,7 @@ class acm
var $is_modified = false;
var $sql_rowset = array();
+ var $sql_row_pointer = array();
/**
* Set cache path
@@ -56,6 +57,7 @@ class acm
unset($this->vars);
unset($this->var_expires);
unset($this->sql_rowset);
+ unset($this->sql_row_pointer);
}
/**
@@ -311,6 +313,8 @@ class acm
return false;
}
+ $this->sql_row_pointer[$query_id] = 0;
+
return $query_id;
}
@@ -331,6 +335,7 @@ class acm
$lines = array();
$query_id = sizeof($this->sql_rowset);
$this->sql_rowset[$query_id] = array();
+ $this->sql_row_pointer[$query_id] = 0;
while ($row = $db->sql_fetchrow($query_result))
{
@@ -361,7 +366,63 @@ class acm
*/
function sql_fetchrow($query_id)
{
- return array_shift($this->sql_rowset[$query_id]);
+ if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
+ {
+ return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++];
+ }
+
+ return false;
+ }
+
+ /**
+ * Fetch the number of rows from cache (database)
+ */
+ function sql_numrows($query_id)
+ {
+ return sizeof($this->sql_rowset[$query_id]);
+ }
+
+ /**
+ * Fetch a field from the current row of a cached database result (database)
+ */
+ function sql_fetchfield($query_id, $field)
+ {
+ if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
+ {
+ return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]];
+ }
+
+ return false;
+ }
+
+ /**
+ * Seek a specific row in an a cached database result (database)
+ */
+ function sql_rowseek($query_id, $rownum)
+ {
+ if ($rownum >= sizeof($this->sql_rowset[$query_id]))
+ {
+ return false;
+ }
+
+ $this->sql_row_pointer[$query_id] = $rownum;
+ return true;
+ }
+
+ /**
+ * Free memory used for a cached database result (database)
+ */
+ function sql_freeresult($query_id)
+ {
+ if (!isset($this->sql_rowset[$query_id]))
+ {
+ return false;
+ }
+
+ unset($this->sql_rowset[$query_id]);
+ unset($this->sql_row_pointer[$query_id]);
+
+ return true;
}
}