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:
David M 2008-02-03 10:19:04 +00:00
parent e9e9e8e69c
commit 7b262babcd
21 changed files with 45 additions and 500 deletions

View file

@ -250,7 +250,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . "
WHERE group_name = '" . strtoupper($ug_id) . "'";
$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);
if (!$id)

View file

@ -98,7 +98,7 @@ function add_bots($bots)
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
$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_query('TRUNCATE TABLE ' . BOTS_TABLE);
@ -108,7 +108,7 @@ function add_bots($bots)
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'";
$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);
}

View file

@ -26,7 +26,6 @@ class acm
private $is_modified = false;
public $sql_rowset = array();
private $sql_row_pointer = array();
public $cache_dir = '';
/**
@ -62,11 +61,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();
}
/**
@ -161,12 +158,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;
}
@ -241,8 +236,6 @@ class acm
$this->sql_rowset[$query_id] = $temp;
$this->sql_row_pointer[$query_id] = 0;
return $query_id;
}
@ -287,7 +280,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))
{
@ -305,12 +297,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;
}
/**
@ -318,26 +307,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;
}
$row = current($this->sql_rowset[$query_id]);
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;
}
$this->sql_row_pointer[$query_id] = $rownum;
return true;
return ($row !== false && isset($row[$field])) ? $row[$field] : false;
}
/**
@ -351,7 +323,6 @@ class acm
}
unset($this->sql_rowset[$query_id]);
unset($this->sql_row_pointer[$query_id]);
return true;
}

View file

@ -26,7 +26,6 @@ class acm
private $is_modified = false;
public $sql_rowset = array();
private $sql_row_pointer = array();
public $cache_dir = '';
/**
@ -62,11 +61,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();
}
/**
@ -173,12 +170,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;
}
@ -257,8 +252,6 @@ class acm
$this->sql_rowset[$query_id] = $temp;
$this->sql_row_pointer[$query_id] = 0;
return $query_id;
}
@ -303,7 +296,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))
{
@ -321,12 +313,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;
}
/**
@ -334,26 +323,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;
}
$row = current($this->sql_rowset[$query_id]);
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;
}
$this->sql_row_pointer[$query_id] = $rownum;
return true;
return ($row !== false && isset($row[$field])) ? $row[$field] : false;
}
/**
@ -367,7 +339,6 @@ class acm
}
unset($this->sql_rowset[$query_id]);
unset($this->sql_row_pointer[$query_id]);
return true;
}

View file

@ -27,7 +27,6 @@ class acm
private $is_modified = false;
public $sql_rowset = array();
private $sql_row_pointer = array();
public $cache_dir = '';
/**
@ -65,12 +64,10 @@ class acm
unset($this->vars);
unset($this->var_expires);
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();
}
/**
@ -234,12 +231,10 @@ class acm
unset($this->vars);
unset($this->var_expires);
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;
}
@ -378,7 +373,6 @@ class acm
return false;
}
$this->sql_row_pointer[$query_id] = 0;
return $query_id;
}
@ -400,7 +394,6 @@ class acm
$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))
{
@ -426,12 +419,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;
}
/**
@ -439,26 +429,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;
}
$row = current($this->sql_rowset[$query_id]);
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;
}
$this->sql_row_pointer[$query_id] = $rownum;
return true;
return ($row !== false && isset($row[$field])) ? $row[$field] : false;
}
/**
@ -472,7 +445,6 @@ class acm
}
unset($this->sql_rowset[$query_id]);
unset($this->sql_row_pointer[$query_id]);
return true;
}

View file

@ -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;
}
$row = current($this->sql_rowset[$query_id]);
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;
}
$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;
}

View file

@ -26,7 +26,6 @@ class acm
private $is_modified = false;
public $sql_rowset = array();
private $sql_row_pointer = array();
public $cache_dir = '';
/**
@ -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();
}
/**
@ -166,12 +163,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;
}
@ -246,7 +241,6 @@ class acm
$this->sql_rowset[$query_id] = xcache_get('sql_' . $query_hash);
$this->sql_row_pointer[$query_id] = 0;
return $query_id;
}
@ -295,7 +289,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))
{
@ -313,12 +306,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;
}
/**
@ -326,26 +316,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;
}
$row = current($this->sql_rowset[$query_id]);
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;
}
$this->sql_row_pointer[$query_id] = $rownum;
return true;
return ($row !== false && isset($row[$field])) ? $row[$field] : false;
}
/**
@ -359,7 +332,6 @@ class acm
}
unset($this->sql_rowset[$query_id]);
unset($this->sql_row_pointer[$query_id]);
return true;
}

View file

@ -1008,7 +1008,7 @@ class postgres_extractor extends base_extractor
}
else
{
$row['rowdefault'] = $db->sql_fetchfield('rowdefault', false, $def_res);
$row['rowdefault'] = $db->sql_fetchfield('rowdefault', $def_res);
}
$db->sql_freeresult($def_res);

View file

@ -26,7 +26,6 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
class dbal_db2 extends dbal
{
var $multi_insert = true;
var $last_query_text = '';
// can't truncate a table
var $truncate = false;
@ -106,7 +105,6 @@ class dbal_db2 extends dbal
$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->sql_add_num_queries($this->query_result);
@ -283,49 +281,6 @@ class dbal_db2 extends dbal
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
*/

View file

@ -192,9 +192,8 @@ class dbal
/**
* 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;
@ -205,11 +204,6 @@ class dbal
if ($query_id !== false)
{
if ($rownum !== false)
{
$this->sql_rowseek($rownum, $query_id);
}
if (!is_object($query_id) && isset($cache->sql_rowset[$query_id]))
{
return $cache->sql_fetchfield($query_id, $field);

View file

@ -276,49 +276,6 @@ class dbal_firebird extends dbal
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
*/

View file

@ -186,7 +186,7 @@ class dbal_mssql extends dbal
// Seek by $offset rows
if ($offset)
{
$this->sql_rowseek($offset, $result);
@mssql_data_seek($result, $offset);
}
return $result;
@ -236,27 +236,6 @@ class dbal_mssql extends dbal
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
*/

View file

@ -25,7 +25,6 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
*/
class dbal_mssql_2005 extends dbal
{
var $last_query_text = '';
var $dbms_type = 'mssql';
/**
@ -112,7 +111,6 @@ class dbal_mssql_2005 extends dbal
$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->sql_add_num_queries($this->query_result);
@ -177,7 +175,14 @@ class dbal_mssql_2005 extends dbal
// Seek by $offset rows
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;
@ -227,49 +232,6 @@ class dbal_mssql_2005 extends dbal
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
*/

View file

@ -31,7 +31,6 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
*/
class dbal_mssql_odbc extends dbal
{
var $last_query_text = '';
var $dbms_type = 'mssql';
/**
@ -139,7 +138,6 @@ class dbal_mssql_odbc extends dbal
$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->sql_add_num_queries($this->query_result);
@ -204,7 +202,14 @@ class dbal_mssql_odbc extends dbal
// Seek by $offset rows
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;
@ -239,49 +244,6 @@ class dbal_mssql_odbc extends dbal
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
*/

View file

@ -223,27 +223,6 @@ class dbal_mysql extends dbal
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
*/

View file

@ -219,27 +219,6 @@ class dbal_mysqli extends dbal
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
*/

View file

@ -431,44 +431,6 @@ class dbal_oracle extends dbal
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
*/

View file

@ -256,27 +256,6 @@ class dbal_postgres extends dbal
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
*/

View file

@ -192,27 +192,6 @@ class dbal_sqlite extends dbal
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
*/

View file

@ -2472,7 +2472,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST;
$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);
}

View file

@ -1769,7 +1769,7 @@ function add_bots()
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name_clean = 'bots'";
$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);
if (!$group_id)
@ -1778,7 +1778,7 @@ function add_bots()
$sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name_clean = 'bots'";
$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);
if (!$group_id)