[ticket/12387] mssql_query return true if a select query returns 0 row

PHPBB3-12387
This commit is contained in:
Tristan Darricau 2014-06-22 19:34:02 +02:00
parent 2276c1c0f2
commit adba7d4715

View file

@ -163,7 +163,7 @@ class mssql extends \phpbb\db\driver\driver
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); $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->query_result !== true)
{ {
$this->open_queries[(int) $this->query_result] = $this->query_result; $this->open_queries[(int) $this->query_result] = $this->query_result;
} }
@ -238,7 +238,7 @@ class mssql extends \phpbb\db\driver\driver
return $cache->sql_fetchrow($query_id); return $cache->sql_fetchrow($query_id);
} }
if (!$query_id) if (!$query_id || $query_id === true)
{ {
return false; return false;
} }
@ -269,6 +269,11 @@ class mssql extends \phpbb\db\driver\driver
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if ($query_id === true)
{
return false;
}
if ($cache && $cache->sql_exists($query_id)) if ($cache && $cache->sql_exists($query_id))
{ {
return $cache->sql_rowseek($rownum, $query_id); return $cache->sql_rowseek($rownum, $query_id);
@ -308,6 +313,11 @@ class mssql extends \phpbb\db\driver\driver
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if ($query_id === true)
{
return false;
}
if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
{ {
return $cache->sql_freeresult($query_id); return $cache->sql_freeresult($query_id);