mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Alright, this should give some improved performance :)
This is the end of random seek access to rows. If you have a compelling reason as to why they should stay, contact me. Else, they are gone forevermore... The following API calls are deprecated: acm::sql_rowseek() -> no replacement $db->sql_fetchfield($field, $rownum = false, $query_id = false) -> $db->sql_fetchfield($field, $query_id = false) Initial tests show that phpBB3 over four percent of memory against phpBB3.1 on an empty board. So far so good :) Other cool things: db2, MS SQL ODBC and MS SQL 2005 all use less memory because they do not need to reference the last executed query to handle random access seeks :) P.S. The crazy people using SVN: please report any issues with the new way we itterate through caches, I do not want to miss anything :) git-svn-id: file:///svn/phpbb/trunk@8372 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
e9e9e8e69c
commit
7b262babcd
21 changed files with 45 additions and 500 deletions
|
@ -250,7 +250,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
|
||||||
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . "
|
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . "
|
||||||
WHERE group_name = '" . strtoupper($ug_id) . "'";
|
WHERE group_name = '" . strtoupper($ug_id) . "'";
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
$id = (int) $db->sql_fetchfield('group_id', 0, $result);
|
$id = (int) $db->sql_fetchfield('group_id', $result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!$id)
|
if (!$id)
|
||||||
|
|
|
@ -98,7 +98,7 @@ function add_bots($bots)
|
||||||
|
|
||||||
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
|
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$group_id = (int) $db->sql_fetchfield('group_id', false, $result);
|
$group_id = (int) $db->sql_fetchfield('group_id', $result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
$db->sql_query('TRUNCATE TABLE ' . BOTS_TABLE);
|
$db->sql_query('TRUNCATE TABLE ' . BOTS_TABLE);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ function add_bots($bots)
|
||||||
|
|
||||||
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
|
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$group_id = (int) $db->sql_fetchfield('group_id', false, $result);
|
$group_id = (int) $db->sql_fetchfield('group_id', $result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ class acm
|
||||||
private $is_modified = false;
|
private $is_modified = false;
|
||||||
|
|
||||||
public $sql_rowset = array();
|
public $sql_rowset = array();
|
||||||
private $sql_row_pointer = array();
|
|
||||||
public $cache_dir = '';
|
public $cache_dir = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,11 +61,9 @@ class acm
|
||||||
$this->save();
|
$this->save();
|
||||||
unset($this->vars);
|
unset($this->vars);
|
||||||
unset($this->sql_rowset);
|
unset($this->sql_rowset);
|
||||||
unset($this->sql_row_pointer);
|
|
||||||
|
|
||||||
$this->vars = array();
|
$this->vars = array();
|
||||||
$this->sql_rowset = array();
|
$this->sql_rowset = array();
|
||||||
$this->sql_row_pointer = array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,12 +158,10 @@ class acm
|
||||||
|
|
||||||
unset($this->vars);
|
unset($this->vars);
|
||||||
unset($this->sql_rowset);
|
unset($this->sql_rowset);
|
||||||
unset($this->sql_row_pointer);
|
|
||||||
|
|
||||||
$this->vars = array();
|
$this->vars = array();
|
||||||
$this->var_expires = array();
|
$this->var_expires = array();
|
||||||
$this->sql_rowset = array();
|
$this->sql_rowset = array();
|
||||||
$this->sql_row_pointer = array();
|
|
||||||
|
|
||||||
$this->is_modified = false;
|
$this->is_modified = false;
|
||||||
}
|
}
|
||||||
|
@ -241,8 +236,6 @@ class acm
|
||||||
|
|
||||||
$this->sql_rowset[$query_id] = $temp;
|
$this->sql_rowset[$query_id] = $temp;
|
||||||
|
|
||||||
$this->sql_row_pointer[$query_id] = 0;
|
|
||||||
|
|
||||||
return $query_id;
|
return $query_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +280,6 @@ class acm
|
||||||
// store them in the right place
|
// store them in the right place
|
||||||
$query_id = sizeof($this->sql_rowset);
|
$query_id = sizeof($this->sql_rowset);
|
||||||
$this->sql_rowset[$query_id] = array();
|
$this->sql_rowset[$query_id] = array();
|
||||||
$this->sql_row_pointer[$query_id] = 0;
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($query_result))
|
while ($row = $db->sql_fetchrow($query_result))
|
||||||
{
|
{
|
||||||
|
@ -305,12 +297,9 @@ class acm
|
||||||
*/
|
*/
|
||||||
public function sql_fetchrow($query_id)
|
public function sql_fetchrow($query_id)
|
||||||
{
|
{
|
||||||
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
list(, $row) = each($this->sql_rowset[$query_id]);
|
||||||
{
|
|
||||||
return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++];
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return ($row !== NULL) ? $row : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -318,26 +307,9 @@ class acm
|
||||||
*/
|
*/
|
||||||
public function sql_fetchfield($query_id, $field)
|
public function sql_fetchfield($query_id, $field)
|
||||||
{
|
{
|
||||||
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
$row = current($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;
|
return ($row !== false && isset($row[$field])) ? $row[$field] : 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sql_row_pointer[$query_id] = $rownum;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -351,7 +323,6 @@ class acm
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->sql_rowset[$query_id]);
|
unset($this->sql_rowset[$query_id]);
|
||||||
unset($this->sql_row_pointer[$query_id]);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ class acm
|
||||||
private $is_modified = false;
|
private $is_modified = false;
|
||||||
|
|
||||||
public $sql_rowset = array();
|
public $sql_rowset = array();
|
||||||
private $sql_row_pointer = array();
|
|
||||||
public $cache_dir = '';
|
public $cache_dir = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,11 +61,9 @@ class acm
|
||||||
$this->save();
|
$this->save();
|
||||||
unset($this->vars);
|
unset($this->vars);
|
||||||
unset($this->sql_rowset);
|
unset($this->sql_rowset);
|
||||||
unset($this->sql_row_pointer);
|
|
||||||
|
|
||||||
$this->vars = array();
|
$this->vars = array();
|
||||||
$this->sql_rowset = array();
|
$this->sql_rowset = array();
|
||||||
$this->sql_row_pointer = array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,12 +170,10 @@ class acm
|
||||||
|
|
||||||
unset($this->vars);
|
unset($this->vars);
|
||||||
unset($this->sql_rowset);
|
unset($this->sql_rowset);
|
||||||
unset($this->sql_row_pointer);
|
|
||||||
|
|
||||||
$this->vars = array();
|
$this->vars = array();
|
||||||
$this->var_expires = array();
|
$this->var_expires = array();
|
||||||
$this->sql_rowset = array();
|
$this->sql_rowset = array();
|
||||||
$this->sql_row_pointer = array();
|
|
||||||
|
|
||||||
$this->is_modified = false;
|
$this->is_modified = false;
|
||||||
}
|
}
|
||||||
|
@ -257,8 +252,6 @@ class acm
|
||||||
|
|
||||||
$this->sql_rowset[$query_id] = $temp;
|
$this->sql_rowset[$query_id] = $temp;
|
||||||
|
|
||||||
$this->sql_row_pointer[$query_id] = 0;
|
|
||||||
|
|
||||||
return $query_id;
|
return $query_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +296,6 @@ class acm
|
||||||
// store them in the right place
|
// store them in the right place
|
||||||
$query_id = sizeof($this->sql_rowset);
|
$query_id = sizeof($this->sql_rowset);
|
||||||
$this->sql_rowset[$query_id] = array();
|
$this->sql_rowset[$query_id] = array();
|
||||||
$this->sql_row_pointer[$query_id] = 0;
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($query_result))
|
while ($row = $db->sql_fetchrow($query_result))
|
||||||
{
|
{
|
||||||
|
@ -321,12 +313,9 @@ class acm
|
||||||
*/
|
*/
|
||||||
public function sql_fetchrow($query_id)
|
public function sql_fetchrow($query_id)
|
||||||
{
|
{
|
||||||
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
list(, $row) = each($this->sql_rowset[$query_id]);
|
||||||
{
|
|
||||||
return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++];
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return ($row !== NULL) ? $row : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -334,26 +323,9 @@ class acm
|
||||||
*/
|
*/
|
||||||
public function sql_fetchfield($query_id, $field)
|
public function sql_fetchfield($query_id, $field)
|
||||||
{
|
{
|
||||||
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
$row = current($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;
|
return ($row !== false && isset($row[$field])) ? $row[$field] : 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sql_row_pointer[$query_id] = $rownum;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -367,7 +339,6 @@ class acm
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->sql_rowset[$query_id]);
|
unset($this->sql_rowset[$query_id]);
|
||||||
unset($this->sql_row_pointer[$query_id]);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ class acm
|
||||||
private $is_modified = false;
|
private $is_modified = false;
|
||||||
|
|
||||||
public $sql_rowset = array();
|
public $sql_rowset = array();
|
||||||
private $sql_row_pointer = array();
|
|
||||||
public $cache_dir = '';
|
public $cache_dir = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,12 +64,10 @@ class acm
|
||||||
unset($this->vars);
|
unset($this->vars);
|
||||||
unset($this->var_expires);
|
unset($this->var_expires);
|
||||||
unset($this->sql_rowset);
|
unset($this->sql_rowset);
|
||||||
unset($this->sql_row_pointer);
|
|
||||||
|
|
||||||
$this->vars = array();
|
$this->vars = array();
|
||||||
$this->var_expires = array();
|
$this->var_expires = array();
|
||||||
$this->sql_rowset = array();
|
$this->sql_rowset = array();
|
||||||
$this->sql_row_pointer = array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -234,12 +231,10 @@ class acm
|
||||||
unset($this->vars);
|
unset($this->vars);
|
||||||
unset($this->var_expires);
|
unset($this->var_expires);
|
||||||
unset($this->sql_rowset);
|
unset($this->sql_rowset);
|
||||||
unset($this->sql_row_pointer);
|
|
||||||
|
|
||||||
$this->vars = array();
|
$this->vars = array();
|
||||||
$this->var_expires = array();
|
$this->var_expires = array();
|
||||||
$this->sql_rowset = array();
|
$this->sql_rowset = array();
|
||||||
$this->sql_row_pointer = array();
|
|
||||||
|
|
||||||
$this->is_modified = false;
|
$this->is_modified = false;
|
||||||
}
|
}
|
||||||
|
@ -378,7 +373,6 @@ class acm
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sql_row_pointer[$query_id] = 0;
|
|
||||||
|
|
||||||
return $query_id;
|
return $query_id;
|
||||||
}
|
}
|
||||||
|
@ -400,7 +394,6 @@ class acm
|
||||||
|
|
||||||
$query_id = sizeof($this->sql_rowset);
|
$query_id = sizeof($this->sql_rowset);
|
||||||
$this->sql_rowset[$query_id] = array();
|
$this->sql_rowset[$query_id] = array();
|
||||||
$this->sql_row_pointer[$query_id] = 0;
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($query_result))
|
while ($row = $db->sql_fetchrow($query_result))
|
||||||
{
|
{
|
||||||
|
@ -426,12 +419,9 @@ class acm
|
||||||
*/
|
*/
|
||||||
public function sql_fetchrow($query_id)
|
public function sql_fetchrow($query_id)
|
||||||
{
|
{
|
||||||
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
list(, $row) = each($this->sql_rowset[$query_id]);
|
||||||
{
|
|
||||||
return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++];
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return ($row !== NULL) ? $row : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -439,26 +429,9 @@ class acm
|
||||||
*/
|
*/
|
||||||
public function sql_fetchfield($query_id, $field)
|
public function sql_fetchfield($query_id, $field)
|
||||||
{
|
{
|
||||||
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
$row = current($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;
|
return ($row !== false && isset($row[$field])) ? $row[$field] : 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sql_row_pointer[$query_id] = $rownum;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -472,7 +445,6 @@ class acm
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->sql_rowset[$query_id]);
|
unset($this->sql_rowset[$query_id]);
|
||||||
unset($this->sql_row_pointer[$query_id]);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ class acm
|
||||||
private $is_modified = false;
|
private $is_modified = false;
|
||||||
|
|
||||||
public $sql_rowset = array();
|
public $sql_rowset = array();
|
||||||
private $sql_row_pointer = array();
|
|
||||||
public $cache_dir = '';
|
public $cache_dir = '';
|
||||||
private $memcache;
|
private $memcache;
|
||||||
|
|
||||||
|
@ -63,11 +62,9 @@ class acm
|
||||||
$this->save();
|
$this->save();
|
||||||
unset($this->vars);
|
unset($this->vars);
|
||||||
unset($this->sql_rowset);
|
unset($this->sql_rowset);
|
||||||
unset($this->sql_row_pointer);
|
|
||||||
|
|
||||||
$this->vars = array();
|
$this->vars = array();
|
||||||
$this->sql_rowset = array();
|
$this->sql_rowset = array();
|
||||||
$this->sql_row_pointer = array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,12 +159,10 @@ class acm
|
||||||
|
|
||||||
unset($this->vars);
|
unset($this->vars);
|
||||||
unset($this->sql_rowset);
|
unset($this->sql_rowset);
|
||||||
unset($this->sql_row_pointer);
|
|
||||||
|
|
||||||
$this->vars = array();
|
$this->vars = array();
|
||||||
$this->var_expires = array();
|
$this->var_expires = array();
|
||||||
$this->sql_rowset = array();
|
$this->sql_rowset = array();
|
||||||
$this->sql_row_pointer = array();
|
|
||||||
|
|
||||||
$this->is_modified = false;
|
$this->is_modified = false;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +237,6 @@ class acm
|
||||||
|
|
||||||
$this->sql_rowset[$query_id] = $temp;
|
$this->sql_rowset[$query_id] = $temp;
|
||||||
|
|
||||||
$this->sql_row_pointer[$query_id] = 0;
|
|
||||||
|
|
||||||
return $query_id;
|
return $query_id;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +282,6 @@ class acm
|
||||||
// store them in the right place
|
// store them in the right place
|
||||||
$query_id = sizeof($this->sql_rowset);
|
$query_id = sizeof($this->sql_rowset);
|
||||||
$this->sql_rowset[$query_id] = array();
|
$this->sql_rowset[$query_id] = array();
|
||||||
$this->sql_row_pointer[$query_id] = 0;
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($query_result))
|
while ($row = $db->sql_fetchrow($query_result))
|
||||||
{
|
{
|
||||||
|
@ -306,12 +299,9 @@ class acm
|
||||||
*/
|
*/
|
||||||
public function sql_fetchrow($query_id)
|
public function sql_fetchrow($query_id)
|
||||||
{
|
{
|
||||||
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
list(, $row) = each($this->sql_rowset[$query_id]);
|
||||||
{
|
|
||||||
return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++];
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return ($row !== NULL) ? $row : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -319,26 +309,9 @@ class acm
|
||||||
*/
|
*/
|
||||||
public function sql_fetchfield($query_id, $field)
|
public function sql_fetchfield($query_id, $field)
|
||||||
{
|
{
|
||||||
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
$row = current($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;
|
return ($row !== false && isset($row[$field])) ? $row[$field] : 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sql_row_pointer[$query_id] = $rownum;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -352,7 +325,6 @@ class acm
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->sql_rowset[$query_id]);
|
unset($this->sql_rowset[$query_id]);
|
||||||
unset($this->sql_row_pointer[$query_id]);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ class acm
|
||||||
private $is_modified = false;
|
private $is_modified = false;
|
||||||
|
|
||||||
public $sql_rowset = array();
|
public $sql_rowset = array();
|
||||||
private $sql_row_pointer = array();
|
|
||||||
public $cache_dir = '';
|
public $cache_dir = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,11 +62,9 @@ class acm
|
||||||
$this->save();
|
$this->save();
|
||||||
unset($this->vars);
|
unset($this->vars);
|
||||||
unset($this->sql_rowset);
|
unset($this->sql_rowset);
|
||||||
unset($this->sql_row_pointer);
|
|
||||||
|
|
||||||
$this->vars = array();
|
$this->vars = array();
|
||||||
$this->sql_rowset = array();
|
$this->sql_rowset = array();
|
||||||
$this->sql_row_pointer = array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -166,12 +163,10 @@ class acm
|
||||||
|
|
||||||
unset($this->vars);
|
unset($this->vars);
|
||||||
unset($this->sql_rowset);
|
unset($this->sql_rowset);
|
||||||
unset($this->sql_row_pointer);
|
|
||||||
|
|
||||||
$this->vars = array();
|
$this->vars = array();
|
||||||
$this->var_expires = array();
|
$this->var_expires = array();
|
||||||
$this->sql_rowset = array();
|
$this->sql_rowset = array();
|
||||||
$this->sql_row_pointer = array();
|
|
||||||
|
|
||||||
$this->is_modified = false;
|
$this->is_modified = false;
|
||||||
}
|
}
|
||||||
|
@ -246,7 +241,6 @@ class acm
|
||||||
|
|
||||||
$this->sql_rowset[$query_id] = xcache_get('sql_' . $query_hash);
|
$this->sql_rowset[$query_id] = xcache_get('sql_' . $query_hash);
|
||||||
|
|
||||||
$this->sql_row_pointer[$query_id] = 0;
|
|
||||||
|
|
||||||
return $query_id;
|
return $query_id;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +289,6 @@ class acm
|
||||||
// store them in the right place
|
// store them in the right place
|
||||||
$query_id = sizeof($this->sql_rowset);
|
$query_id = sizeof($this->sql_rowset);
|
||||||
$this->sql_rowset[$query_id] = array();
|
$this->sql_rowset[$query_id] = array();
|
||||||
$this->sql_row_pointer[$query_id] = 0;
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($query_result))
|
while ($row = $db->sql_fetchrow($query_result))
|
||||||
{
|
{
|
||||||
|
@ -313,12 +306,9 @@ class acm
|
||||||
*/
|
*/
|
||||||
public function sql_fetchrow($query_id)
|
public function sql_fetchrow($query_id)
|
||||||
{
|
{
|
||||||
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
list(, $row) = each($this->sql_rowset[$query_id]);
|
||||||
{
|
|
||||||
return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++];
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return ($row !== NULL) ? $row : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -326,26 +316,9 @@ class acm
|
||||||
*/
|
*/
|
||||||
public function sql_fetchfield($query_id, $field)
|
public function sql_fetchfield($query_id, $field)
|
||||||
{
|
{
|
||||||
if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
|
$row = current($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;
|
return ($row !== false && isset($row[$field])) ? $row[$field] : 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sql_row_pointer[$query_id] = $rownum;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -359,7 +332,6 @@ class acm
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->sql_rowset[$query_id]);
|
unset($this->sql_rowset[$query_id]);
|
||||||
unset($this->sql_row_pointer[$query_id]);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ class postgres_extractor extends base_extractor
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$row['rowdefault'] = $db->sql_fetchfield('rowdefault', false, $def_res);
|
$row['rowdefault'] = $db->sql_fetchfield('rowdefault', $def_res);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($def_res);
|
$db->sql_freeresult($def_res);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||||
class dbal_db2 extends dbal
|
class dbal_db2 extends dbal
|
||||||
{
|
{
|
||||||
var $multi_insert = true;
|
var $multi_insert = true;
|
||||||
var $last_query_text = '';
|
|
||||||
|
|
||||||
// can't truncate a table
|
// can't truncate a table
|
||||||
var $truncate = false;
|
var $truncate = false;
|
||||||
|
@ -106,7 +105,6 @@ class dbal_db2 extends dbal
|
||||||
$this->sql_report('start', $query);
|
$this->sql_report('start', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->last_query_text = $query;
|
|
||||||
$this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
|
@ -283,49 +281,6 @@ class dbal_db2 extends dbal
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek to given row number
|
|
||||||
* rownum is zero-based
|
|
||||||
*/
|
|
||||||
function sql_rowseek($rownum, $query_id = false)
|
|
||||||
{
|
|
||||||
global $cache;
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
$query_id = $this->query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($cache->sql_rowset[$query_id]))
|
|
||||||
{
|
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sql_freeresult($query_id);
|
|
||||||
$query_id = $this->sql_query($this->last_query_text);
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We do not fetch the row for rownum == 0 because then the next resultset would be the second row
|
|
||||||
for ($i = 0; $i < $rownum; $i++)
|
|
||||||
{
|
|
||||||
if (!$this->sql_fetchrow($query_id))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last inserted id after insert statement
|
* Get last inserted id after insert statement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -192,9 +192,8 @@ class dbal
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch field
|
* Fetch field
|
||||||
* if rownum is false, the current row is used, else it is pointing to the row (zero-based)
|
|
||||||
*/
|
*/
|
||||||
function sql_fetchfield($field, $rownum = false, $query_id = false)
|
function sql_fetchfield($field, $query_id = false)
|
||||||
{
|
{
|
||||||
global $cache;
|
global $cache;
|
||||||
|
|
||||||
|
@ -205,11 +204,6 @@ class dbal
|
||||||
|
|
||||||
if ($query_id !== false)
|
if ($query_id !== false)
|
||||||
{
|
{
|
||||||
if ($rownum !== false)
|
|
||||||
{
|
|
||||||
$this->sql_rowseek($rownum, $query_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_object($query_id) && isset($cache->sql_rowset[$query_id]))
|
if (!is_object($query_id) && isset($cache->sql_rowset[$query_id]))
|
||||||
{
|
{
|
||||||
return $cache->sql_fetchfield($query_id, $field);
|
return $cache->sql_fetchfield($query_id, $field);
|
||||||
|
|
|
@ -276,49 +276,6 @@ class dbal_firebird extends dbal
|
||||||
return (sizeof($row)) ? $row : false;
|
return (sizeof($row)) ? $row : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek to given row number
|
|
||||||
* rownum is zero-based
|
|
||||||
*/
|
|
||||||
function sql_rowseek($rownum, &$query_id)
|
|
||||||
{
|
|
||||||
global $cache;
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
$query_id = $this->query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($cache->sql_rowset[$query_id]))
|
|
||||||
{
|
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sql_freeresult($query_id);
|
|
||||||
$query_id = $this->sql_query($this->last_query_text);
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We do not fetch the row for rownum == 0 because then the next resultset would be the second row
|
|
||||||
for ($i = 0; $i < $rownum; $i++)
|
|
||||||
{
|
|
||||||
if (!$this->sql_fetchrow($query_id))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last inserted id after insert statement
|
* Get last inserted id after insert statement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -186,7 +186,7 @@ class dbal_mssql extends dbal
|
||||||
// Seek by $offset rows
|
// Seek by $offset rows
|
||||||
if ($offset)
|
if ($offset)
|
||||||
{
|
{
|
||||||
$this->sql_rowseek($offset, $result);
|
@mssql_data_seek($result, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -236,27 +236,6 @@ class dbal_mssql extends dbal
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek to given row number
|
|
||||||
* rownum is zero-based
|
|
||||||
*/
|
|
||||||
function sql_rowseek($rownum, &$query_id)
|
|
||||||
{
|
|
||||||
global $cache;
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
$query_id = $this->query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($cache->sql_rowset[$query_id]))
|
|
||||||
{
|
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($query_id !== false) ? @mssql_data_seek($query_id, $rownum) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last inserted id after insert statement
|
* Get last inserted id after insert statement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -25,7 +25,6 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||||
*/
|
*/
|
||||||
class dbal_mssql_2005 extends dbal
|
class dbal_mssql_2005 extends dbal
|
||||||
{
|
{
|
||||||
var $last_query_text = '';
|
|
||||||
var $dbms_type = 'mssql';
|
var $dbms_type = 'mssql';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,7 +111,6 @@ class dbal_mssql_2005 extends dbal
|
||||||
$this->sql_report('start', $query);
|
$this->sql_report('start', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->last_query_text = $query;
|
|
||||||
$this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
|
@ -177,7 +175,14 @@ class dbal_mssql_2005 extends dbal
|
||||||
// Seek by $offset rows
|
// Seek by $offset rows
|
||||||
if ($offset)
|
if ($offset)
|
||||||
{
|
{
|
||||||
$this->sql_rowseek($offset, $result);
|
// We do not fetch the row for rownum == 0 because then the next resultset would be the second row
|
||||||
|
for ($i = 0; $i < $offset; $i++)
|
||||||
|
{
|
||||||
|
if (!$this->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -227,49 +232,6 @@ class dbal_mssql_2005 extends dbal
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek to given row number
|
|
||||||
* rownum is zero-based
|
|
||||||
*/
|
|
||||||
function sql_rowseek($rownum, &$query_id)
|
|
||||||
{
|
|
||||||
global $cache;
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
$query_id = $this->query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($cache->sql_rowset[$query_id]))
|
|
||||||
{
|
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sql_freeresult($query_id);
|
|
||||||
$query_id = $this->sql_query($this->last_query_text);
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We do not fetch the row for rownum == 0 because then the next resultset would be the second row
|
|
||||||
for ($i = 0; $i < $rownum; $i++)
|
|
||||||
{
|
|
||||||
if (!$this->sql_fetchrow($query_id))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last inserted id after insert statement
|
* Get last inserted id after insert statement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,7 +31,6 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||||
*/
|
*/
|
||||||
class dbal_mssql_odbc extends dbal
|
class dbal_mssql_odbc extends dbal
|
||||||
{
|
{
|
||||||
var $last_query_text = '';
|
|
||||||
var $dbms_type = 'mssql';
|
var $dbms_type = 'mssql';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,7 +138,6 @@ class dbal_mssql_odbc extends dbal
|
||||||
$this->sql_report('start', $query);
|
$this->sql_report('start', $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->last_query_text = $query;
|
|
||||||
$this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
|
$this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
|
||||||
$this->sql_add_num_queries($this->query_result);
|
$this->sql_add_num_queries($this->query_result);
|
||||||
|
|
||||||
|
@ -204,7 +202,14 @@ class dbal_mssql_odbc extends dbal
|
||||||
// Seek by $offset rows
|
// Seek by $offset rows
|
||||||
if ($offset)
|
if ($offset)
|
||||||
{
|
{
|
||||||
$this->sql_rowseek($offset, $result);
|
// We do not fetch the row for rownum == 0 because then the next resultset would be the second row
|
||||||
|
for ($i = 0; $i < $offset; $i++)
|
||||||
|
{
|
||||||
|
if (!$this->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -239,49 +244,6 @@ class dbal_mssql_odbc extends dbal
|
||||||
return ($query_id !== false) ? @odbc_fetch_array($query_id) : false;
|
return ($query_id !== false) ? @odbc_fetch_array($query_id) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek to given row number
|
|
||||||
* rownum is zero-based
|
|
||||||
*/
|
|
||||||
function sql_rowseek($rownum, &$query_id)
|
|
||||||
{
|
|
||||||
global $cache;
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
$query_id = $this->query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($cache->sql_rowset[$query_id]))
|
|
||||||
{
|
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sql_freeresult($query_id);
|
|
||||||
$query_id = $this->sql_query($this->last_query_text);
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We do not fetch the row for rownum == 0 because then the next resultset would be the second row
|
|
||||||
for ($i = 0; $i < $rownum; $i++)
|
|
||||||
{
|
|
||||||
if (!$this->sql_fetchrow($query_id))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last inserted id after insert statement
|
* Get last inserted id after insert statement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -223,27 +223,6 @@ class dbal_mysql extends dbal
|
||||||
return ($query_id !== false) ? @mysql_fetch_assoc($query_id) : false;
|
return ($query_id !== false) ? @mysql_fetch_assoc($query_id) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek to given row number
|
|
||||||
* rownum is zero-based
|
|
||||||
*/
|
|
||||||
function sql_rowseek($rownum, &$query_id)
|
|
||||||
{
|
|
||||||
global $cache;
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
$query_id = $this->query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($cache->sql_rowset[$query_id]))
|
|
||||||
{
|
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($query_id !== false) ? @mysql_data_seek($query_id, $rownum) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last inserted id after insert statement
|
* Get last inserted id after insert statement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -219,27 +219,6 @@ class dbal_mysqli extends dbal
|
||||||
return ($query_id !== false) ? @mysqli_fetch_assoc($query_id) : false;
|
return ($query_id !== false) ? @mysqli_fetch_assoc($query_id) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek to given row number
|
|
||||||
* rownum is zero-based
|
|
||||||
*/
|
|
||||||
function sql_rowseek($rownum, &$query_id)
|
|
||||||
{
|
|
||||||
global $cache;
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
$query_id = $this->query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!is_object($query_id) && isset($cache->sql_rowset[$query_id]))
|
|
||||||
{
|
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($query_id !== false) ? @mysqli_data_seek($query_id, $rownum) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last inserted id after insert statement
|
* Get last inserted id after insert statement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -431,44 +431,6 @@ class dbal_oracle extends dbal
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek to given row number
|
|
||||||
* rownum is zero-based
|
|
||||||
*/
|
|
||||||
function sql_rowseek($rownum, &$query_id)
|
|
||||||
{
|
|
||||||
global $cache;
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
$query_id = $this->query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($cache->sql_rowset[$query_id]))
|
|
||||||
{
|
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset internal pointer
|
|
||||||
@oci_execute($query_id, OCI_DEFAULT);
|
|
||||||
|
|
||||||
// We do not fetch the row for rownum == 0 because then the next resultset would be the second row
|
|
||||||
for ($i = 0; $i < $rownum; $i++)
|
|
||||||
{
|
|
||||||
if (!$this->sql_fetchrow($query_id))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last inserted id after insert statement
|
* Get last inserted id after insert statement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -256,27 +256,6 @@ class dbal_postgres extends dbal
|
||||||
return ($query_id !== false) ? @pg_fetch_assoc($query_id, null) : false;
|
return ($query_id !== false) ? @pg_fetch_assoc($query_id, null) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek to given row number
|
|
||||||
* rownum is zero-based
|
|
||||||
*/
|
|
||||||
function sql_rowseek($rownum, &$query_id)
|
|
||||||
{
|
|
||||||
global $cache;
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
$query_id = $this->query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($cache->sql_rowset[$query_id]))
|
|
||||||
{
|
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($query_id !== false) ? @pg_result_seek($query_id, $rownum) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last inserted id after insert statement
|
* Get last inserted id after insert statement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -192,27 +192,6 @@ class dbal_sqlite extends dbal
|
||||||
return ($query_id !== false) ? @sqlite_fetch_array($query_id, SQLITE_ASSOC) : false;
|
return ($query_id !== false) ? @sqlite_fetch_array($query_id, SQLITE_ASSOC) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Seek to given row number
|
|
||||||
* rownum is zero-based
|
|
||||||
*/
|
|
||||||
function sql_rowseek($rownum, &$query_id)
|
|
||||||
{
|
|
||||||
global $cache;
|
|
||||||
|
|
||||||
if ($query_id === false)
|
|
||||||
{
|
|
||||||
$query_id = $this->query_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($cache->sql_rowset[$query_id]))
|
|
||||||
{
|
|
||||||
return $cache->sql_rowseek($rownum, $query_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($query_id !== false) ? @sqlite_seek($query_id, $rownum) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last inserted id after insert statement
|
* Get last inserted id after insert statement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2472,7 +2472,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
|
||||||
FROM ' . FORUMS_TABLE . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
WHERE forum_type = ' . FORUM_POST;
|
WHERE forum_type = ' . FORUM_POST;
|
||||||
$f_result = $db->sql_query_limit($sql, 1);
|
$f_result = $db->sql_query_limit($sql, 1);
|
||||||
$default_forum_id = (int) $db->sql_fetchfield('forum_id', false, $f_result);
|
$default_forum_id = (int) $db->sql_fetchfield('forum_id', $f_result);
|
||||||
$db->sql_freeresult($f_result);
|
$db->sql_freeresult($f_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1769,7 +1769,7 @@ function add_bots()
|
||||||
|
|
||||||
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name_clean = 'bots'";
|
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name_clean = 'bots'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$group_id = (int) $db->sql_fetchfield('group_id', false, $result);
|
$group_id = (int) $db->sql_fetchfield('group_id', $result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!$group_id)
|
if (!$group_id)
|
||||||
|
@ -1778,7 +1778,7 @@ function add_bots()
|
||||||
|
|
||||||
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name_clean = 'bots'";
|
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name_clean = 'bots'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$group_id = (int) $db->sql_fetchfield('group_id', false, $result);
|
$group_id = (int) $db->sql_fetchfield('group_id', $result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!$group_id)
|
if (!$group_id)
|
||||||
|
|
Loading…
Add table
Reference in a new issue