aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/mssql_odbc.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/db/mssql_odbc.php')
-rw-r--r--phpBB/includes/db/mssql_odbc.php36
1 files changed, 35 insertions, 1 deletions
diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php
index 8f37206817..e1b2675a23 100644
--- a/phpBB/includes/db/mssql_odbc.php
+++ b/phpBB/includes/db/mssql_odbc.php
@@ -22,7 +22,7 @@ if (!defined('SQL_LAYER'))
{
define('SQL_LAYER', 'mssql_odbc');
- include($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
+ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/**
* Unified ODBC functions
@@ -101,6 +101,12 @@ class dbal_mssql_odbc extends dbal
/**
* Base query method
+ *
+ * @param string $query Contains the SQL query which shall be executed
+ * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache
+ * @return mixed When casted to bool the returned value returns true on success and false on failure
+ *
+ * @access public
*/
function sql_query($query = '', $cache_ttl = 0)
{
@@ -205,11 +211,18 @@ class dbal_mssql_odbc extends dbal
*/
function sql_numrows($query_id = false)
{
+ global $cache;
+
if (!$query_id)
{
$query_id = $this->query_result;
}
+ if (isset($cache->sql_rowset[$query_id]))
+ {
+ return $cache->sql_numrows($query_id);
+ }
+
return ($query_id) ? @odbc_num_rows($query_id) : false;
}
@@ -247,6 +260,8 @@ class dbal_mssql_odbc extends dbal
*/
function sql_fetchfield($field, $rownum = false, $query_id = false)
{
+ global $cache;
+
if (!$query_id)
{
$query_id = $this->query_result;
@@ -259,6 +274,11 @@ class dbal_mssql_odbc extends dbal
$this->sql_rowseek($rownum, $query_id);
}
+ if (isset($cache->sql_rowset[$query_id]))
+ {
+ return $cache->sql_fetchfield($query_id, $field);
+ }
+
$row = $this->sql_fetchrow($query_id);
return isset($row[$field]) ? $row[$field] : false;
}
@@ -272,11 +292,18 @@ class dbal_mssql_odbc extends dbal
*/
function sql_rowseek($rownum, $query_id = false)
{
+ global $cache;
+
if (!$query_id)
{
$query_id = $this->query_result;
}
+ if (isset($cache->sql_rowset[$query_id]))
+ {
+ return $cache->sql_rowseek($query_id, $rownum);
+ }
+
$this->sql_freeresult($query_id);
$query_id = $this->sql_query($this->last_query_text);
@@ -323,11 +350,18 @@ class dbal_mssql_odbc extends dbal
*/
function sql_freeresult($query_id = false)
{
+ global $cache;
+
if (!$query_id)
{
$query_id = $this->query_result;
}
+ if (isset($cache->sql_rowset[$query_id]))
+ {
+ return $cache->sql_freeresult($query_id);
+ }
+
if (isset($this->open_queries[(int) $query_id]))
{
unset($this->open_queries[(int) $query_id]);