aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/driver/oracle.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-08-07 12:09:01 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-08-07 12:09:01 +0200
commit58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e (patch)
treeac804c383316e276dedb3c8058a4dd8676928376 /phpBB/phpbb/db/driver/oracle.php
parent89a6fed91d9344152f0b2a0779d3d458f3311ecf (diff)
parentcc32ee8a2848b902f7dc9d809499855a78cb41f4 (diff)
downloadforums-58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e.tar
forums-58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e.tar.gz
forums-58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e.tar.bz2
forums-58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e.tar.xz
forums-58d1dcc7f2872b2c9116254d0eae3a5ee1bea48e.zip
Merge pull request #2637 from Nicofuma/ticket/12387
[ticket/12387] Cleanup *_free_result call and remove @ on that call * Nicofuma/ticket/12387: [ticket/12387] Fix a call to sql_freeresult in full_text_native [ticket/12387] Fix \phpbb\db\driver\mysqli::sql_freeresult [ticket/12387] Use the hash as query_id for caching [ticket/12387] Remove unnecessary checks [ticket/12387] mssql_query return true if a select query returns 0 row [ticket/12387] Cleanup *_free_result call and remove @ on that call
Diffstat (limited to 'phpBB/phpbb/db/driver/oracle.php')
-rw-r--r--phpBB/phpbb/db/driver/oracle.php59
1 files changed, 38 insertions, 21 deletions
diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php
index d1a186f1ba..28fea59d8f 100644
--- a/phpBB/phpbb/db/driver/oracle.php
+++ b/phpBB/phpbb/db/driver/oracle.php
@@ -439,12 +439,17 @@ class oracle extends \phpbb\db\driver\driver
$this->sql_time += microtime(true) - $this->curtime;
}
+ if (!$this->query_result)
+ {
+ return false;
+ }
+
if ($cache && $cache_ttl)
{
$this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
}
- else if (strpos($query, 'SELECT') === 0 && $this->query_result)
+ else if (strpos($query, 'SELECT') === 0)
{
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
@@ -499,10 +504,10 @@ class oracle extends \phpbb\db\driver\driver
return $cache->sql_fetchrow($query_id);
}
- if ($query_id !== false)
+ if ($query_id)
{
$row = array();
- $result = @ocifetchinto($query_id, $row, OCI_ASSOC + OCI_RETURN_NULLS);
+ $result = ocifetchinto($query_id, $row, OCI_ASSOC + OCI_RETURN_NULLS);
if (!$result || !$row)
{
@@ -550,7 +555,7 @@ class oracle extends \phpbb\db\driver\driver
return $cache->sql_rowseek($rownum, $query_id);
}
- if ($query_id === false)
+ if (!$query_id)
{
return false;
}
@@ -583,18 +588,24 @@ class oracle extends \phpbb\db\driver\driver
{
$query = 'SELECT ' . $tablename[1] . '_seq.currval FROM DUAL';
$stmt = @ociparse($this->db_connect_id, $query);
- @ociexecute($stmt, OCI_DEFAULT);
+ if ($stmt)
+ {
+ $success = @ociexecute($stmt, OCI_DEFAULT);
- $temp_result = @ocifetchinto($stmt, $temp_array, OCI_ASSOC + OCI_RETURN_NULLS);
- @ocifreestatement($stmt);
+ if ($success)
+ {
+ $temp_result = ocifetchinto($stmt, $temp_array, OCI_ASSOC + OCI_RETURN_NULLS);
+ ocifreestatement($stmt);
- if ($temp_result)
- {
- return $temp_array['CURRVAL'];
- }
- else
- {
- return false;
+ if ($temp_result)
+ {
+ return $temp_array['CURRVAL'];
+ }
+ else
+ {
+ return false;
+ }
+ }
}
}
}
@@ -622,7 +633,7 @@ class oracle extends \phpbb\db\driver\driver
if (isset($this->open_queries[(int) $query_id]))
{
unset($this->open_queries[(int) $query_id]);
- return @ocifreestatement($query_id);
+ return ocifreestatement($query_id);
}
return false;
@@ -778,14 +789,20 @@ class oracle extends \phpbb\db\driver\driver
$endtime = $endtime[0] + $endtime[1];
$result = @ociparse($this->db_connect_id, $query);
- $success = @ociexecute($result, OCI_DEFAULT);
- $row = array();
-
- while (@ocifetchinto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS))
+ if ($result)
{
- // Take the time spent on parsing rows into account
+ $success = @ociexecute($result, OCI_DEFAULT);
+ if ($success)
+ {
+ $row = array();
+
+ while (ocifetchinto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS))
+ {
+ // Take the time spent on parsing rows into account
+ }
+ @ocifreestatement($result);
+ }
}
- @ocifreestatement($result);
$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];