aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/db')
-rw-r--r--phpBB/includes/db/db2.php45
-rw-r--r--phpBB/includes/db/dbal.php8
-rw-r--r--phpBB/includes/db/firebird.php43
-rw-r--r--phpBB/includes/db/mssql.php23
-rw-r--r--phpBB/includes/db/mssql_2005.php54
-rw-r--r--phpBB/includes/db/mssql_odbc.php54
-rw-r--r--phpBB/includes/db/mysql.php21
-rw-r--r--phpBB/includes/db/mysqli.php21
-rw-r--r--phpBB/includes/db/oracle.php38
-rw-r--r--phpBB/includes/db/postgres.php21
-rw-r--r--phpBB/includes/db/sqlite.php21
11 files changed, 18 insertions, 331 deletions
diff --git a/phpBB/includes/db/db2.php b/phpBB/includes/db/db2.php
index 09d56c709a..40909050c9 100644
--- a/phpBB/includes/db/db2.php
+++ b/phpBB/includes/db/db2.php
@@ -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);
@@ -284,49 +282,6 @@ class dbal_db2 extends dbal
}
/**
- * 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
*/
function sql_nextid()
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index 5fd6de7f50..0444dcd816 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -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);
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index a58371cf22..afb649a4f4 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -277,49 +277,6 @@ class dbal_firebird extends dbal
}
/**
- * 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
*/
function sql_nextid()
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php
index 7a1467bd9c..bf6190c79c 100644
--- a/phpBB/includes/db/mssql.php
+++ b/phpBB/includes/db/mssql.php
@@ -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;
@@ -237,27 +237,6 @@ class dbal_mssql extends dbal
}
/**
- * 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
*/
function sql_nextid()
diff --git a/phpBB/includes/db/mssql_2005.php b/phpBB/includes/db/mssql_2005.php
index ed9cd8edc6..9fc2e7027f 100644
--- a/phpBB/includes/db/mssql_2005.php
+++ b/phpBB/includes/db/mssql_2005.php
@@ -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;
@@ -228,49 +233,6 @@ class dbal_mssql_2005 extends dbal
}
/**
- * 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
*/
function sql_nextid()
diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php
index a9a0b1bc1d..de96939035 100644
--- a/phpBB/includes/db/mssql_odbc.php
+++ b/phpBB/includes/db/mssql_odbc.php
@@ -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;
@@ -240,49 +245,6 @@ class dbal_mssql_odbc extends dbal
}
/**
- * 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
*/
function sql_nextid()
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php
index 17daf7093c..1014fe6780 100644
--- a/phpBB/includes/db/mysql.php
+++ b/phpBB/includes/db/mysql.php
@@ -224,27 +224,6 @@ class dbal_mysql extends dbal
}
/**
- * 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
*/
function sql_nextid()
diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php
index ed43ec0a82..ffe39d63bf 100644
--- a/phpBB/includes/db/mysqli.php
+++ b/phpBB/includes/db/mysqli.php
@@ -220,27 +220,6 @@ class dbal_mysqli extends dbal
}
/**
- * 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
*/
function sql_nextid()
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index 36c80cf01c..fc7d177377 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -432,44 +432,6 @@ class dbal_oracle extends dbal
}
/**
- * 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
*/
function sql_nextid()
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index 023a8fda1b..0cce581558 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -257,27 +257,6 @@ class dbal_postgres extends dbal
}
/**
- * 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
*/
function sql_nextid()
diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php
index 9dedf09079..580a9fb1fb 100644
--- a/phpBB/includes/db/sqlite.php
+++ b/phpBB/includes/db/sqlite.php
@@ -193,27 +193,6 @@ class dbal_sqlite extends dbal
}
/**
- * 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
*/
function sql_nextid()