mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-12 11:44:08 +02:00
[ticket/12387] Cleanup *_free_result call and remove @ on that call
PHPBB3-12387
This commit is contained in:
@@ -71,8 +71,8 @@ class mssql extends \phpbb\db\driver\driver
|
||||
$row = false;
|
||||
if ($result_id)
|
||||
{
|
||||
$row = @mssql_fetch_assoc($result_id);
|
||||
@mssql_free_result($result_id);
|
||||
$row = mssql_fetch_assoc($result_id);
|
||||
mssql_free_result($result_id);
|
||||
}
|
||||
|
||||
$this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0;
|
||||
@@ -153,6 +153,11 @@ class mssql extends \phpbb\db\driver\driver
|
||||
$this->sql_report('stop', $query);
|
||||
}
|
||||
|
||||
if (!$this->query_result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($cache && $cache_ttl)
|
||||
{
|
||||
$this->open_queries[(int) $this->query_result] = $this->query_result;
|
||||
@@ -233,12 +238,12 @@ class mssql extends \phpbb\db\driver\driver
|
||||
return $cache->sql_fetchrow($query_id);
|
||||
}
|
||||
|
||||
if ($query_id === false)
|
||||
if (!$query_id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$row = @mssql_fetch_assoc($query_id);
|
||||
$row = mssql_fetch_assoc($query_id);
|
||||
|
||||
// I hope i am able to remove this later... hopefully only a PHP or MSSQL bug
|
||||
if ($row)
|
||||
@@ -269,7 +274,7 @@ class mssql extends \phpbb\db\driver\driver
|
||||
return $cache->sql_rowseek($rownum, $query_id);
|
||||
}
|
||||
|
||||
return ($query_id !== false) ? @mssql_data_seek($query_id, $rownum) : false;
|
||||
return ($query_id) ? @mssql_data_seek($query_id, $rownum) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,12 +285,12 @@ class mssql extends \phpbb\db\driver\driver
|
||||
$result_id = @mssql_query('SELECT SCOPE_IDENTITY()', $this->db_connect_id);
|
||||
if ($result_id)
|
||||
{
|
||||
if ($row = @mssql_fetch_assoc($result_id))
|
||||
if ($row = mssql_fetch_assoc($result_id))
|
||||
{
|
||||
@mssql_free_result($result_id);
|
||||
mssql_free_result($result_id);
|
||||
return $row['computed'];
|
||||
}
|
||||
@mssql_free_result($result_id);
|
||||
mssql_free_result($result_id);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -311,7 +316,7 @@ class mssql extends \phpbb\db\driver\driver
|
||||
if (isset($this->open_queries[(int) $query_id]))
|
||||
{
|
||||
unset($this->open_queries[(int) $query_id]);
|
||||
return @mssql_free_result($query_id);
|
||||
return mssql_free_result($query_id);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -359,9 +364,9 @@ class mssql extends \phpbb\db\driver\driver
|
||||
$result_id = @mssql_query('SELECT @@ERROR as code', $this->db_connect_id);
|
||||
if ($result_id)
|
||||
{
|
||||
$row = @mssql_fetch_assoc($result_id);
|
||||
$row = mssql_fetch_assoc($result_id);
|
||||
$error['code'] = $row['code'];
|
||||
@mssql_free_result($result_id);
|
||||
mssql_free_result($result_id);
|
||||
}
|
||||
|
||||
// Get full error message if possible
|
||||
@@ -372,12 +377,12 @@ class mssql extends \phpbb\db\driver\driver
|
||||
|
||||
if ($result_id)
|
||||
{
|
||||
$row = @mssql_fetch_assoc($result_id);
|
||||
$row = mssql_fetch_assoc($result_id);
|
||||
if (!empty($row['message']))
|
||||
{
|
||||
$error['message'] .= '<br />' . $row['message'];
|
||||
}
|
||||
@mssql_free_result($result_id);
|
||||
mssql_free_result($result_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -423,13 +428,13 @@ class mssql extends \phpbb\db\driver\driver
|
||||
if ($result = @mssql_query($query, $this->db_connect_id))
|
||||
{
|
||||
@mssql_next_result($result);
|
||||
while ($row = @mssql_fetch_row($result))
|
||||
while ($row = mssql_fetch_row($result))
|
||||
{
|
||||
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
|
||||
}
|
||||
}
|
||||
@mssql_query('SET SHOWPLAN_TEXT OFF;', $this->db_connect_id);
|
||||
@mssql_free_result($result);
|
||||
mssql_free_result($result);
|
||||
|
||||
if ($html_table)
|
||||
{
|
||||
@@ -442,11 +447,14 @@ class mssql extends \phpbb\db\driver\driver
|
||||
$endtime = $endtime[0] + $endtime[1];
|
||||
|
||||
$result = @mssql_query($query, $this->db_connect_id);
|
||||
while ($void = @mssql_fetch_assoc($result))
|
||||
if ($result)
|
||||
{
|
||||
// Take the time spent on parsing rows into account
|
||||
while ($void = mssql_fetch_assoc($result))
|
||||
{
|
||||
// Take the time spent on parsing rows into account
|
||||
}
|
||||
mssql_free_result($result);
|
||||
}
|
||||
@mssql_free_result($result);
|
||||
|
||||
$splittime = explode(' ', microtime());
|
||||
$splittime = $splittime[0] + $splittime[1];
|
||||
|
Reference in New Issue
Block a user