aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acm/acm_memcache.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/acm/acm_memcache.php')
-rw-r--r--phpBB/includes/acm/acm_memcache.php36
1 files changed, 4 insertions, 32 deletions
diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php
index 4a1334a619..fc17b04942 100644
--- a/phpBB/includes/acm/acm_memcache.php
+++ b/phpBB/includes/acm/acm_memcache.php
@@ -26,7 +26,6 @@ class acm
private $is_modified = false;
public $sql_rowset = array();
- private $sql_row_pointer = array();
public $cache_dir = '';
private $memcache;
@@ -63,11 +62,9 @@ class acm
$this->save();
unset($this->vars);
unset($this->sql_rowset);
- unset($this->sql_row_pointer);
$this->vars = array();
$this->sql_rowset = array();
- $this->sql_row_pointer = array();
}
/**
@@ -162,12 +159,10 @@ class acm
unset($this->vars);
unset($this->sql_rowset);
- unset($this->sql_row_pointer);
$this->vars = array();
$this->var_expires = array();
$this->sql_rowset = array();
- $this->sql_row_pointer = array();
$this->is_modified = false;
}
@@ -242,7 +237,6 @@ class acm
$this->sql_rowset[$query_id] = $temp;
- $this->sql_row_pointer[$query_id] = 0;
return $query_id;
}
@@ -288,7 +282,6 @@ class acm
// store them in the right place
$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))
{
@@ -306,12 +299,9 @@ class acm
*/
public function sql_fetchrow($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]++];
- }
+ list(, $row) = each($this->sql_rowset[$query_id]);
- return false;
+ return ($row !== NULL) ? $row : false;
}
/**
@@ -319,26 +309,9 @@ class acm
*/
public function sql_fetchfield($query_id, $field)
{
- if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
- {
- return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field] : false;
- }
-
- return false;
- }
-
- /**
- * Seek a specific row in an a cached database result (database)
- */
- public function sql_rowseek($rownum, $query_id)
- {
- if ($rownum >= sizeof($this->sql_rowset[$query_id]))
- {
- return false;
- }
+ $row = current($this->sql_rowset[$query_id]);
- $this->sql_row_pointer[$query_id] = $rownum;
- return true;
+ return ($row !== false && isset($row[$field])) ? $row[$field] : false;
}
/**
@@ -352,7 +325,6 @@ class acm
}
unset($this->sql_rowset[$query_id]);
- unset($this->sql_row_pointer[$query_id]);
return true;
}