Line 138 | Line 138 |
---|
if ($this->query_result === false) {
|
if ($this->query_result === false) {
|
if (($this->query_result = @sqlsrv_query($this->db_connect_id, $query, array(), $this->query_options)) === false)
| try { $this->query_result = @sqlsrv_query($this->db_connect_id, $query, array(), $this->query_options); } catch (\Error $e) { // Do nothing as SQL driver will report the error }
if ($this->query_result === false)
|
{ $this->sql_error($query); }
|
{ $this->sql_error($query); }
|
// reset options for next query $this->query_options = array();
| // Reset options for the next query $this->query_options = [];
|
if ($this->debug_sql_explain) {
| if ($this->debug_sql_explain) {
|
Line 158 | Line 168 |
---|
{ return false; }
|
{ return false; }
|
| $safe_query_id = $this->clean_query_id($this->query_result);
|
if ($cache && $cache_ttl) {
|
if ($cache && $cache_ttl) {
|
$this->open_queries[(int) $this->query_result] = $this->query_result;
| $this->open_queries[$safe_query_id] = $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 = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); } else if (strpos($query, 'SELECT') === 0) {
|
$this->open_queries[(int) $this->query_result] = $this->query_result;
| $this->open_queries[$safe_query_id] = $this->query_result;
|
} } else if ($this->debug_sql_explain)
| } } else if ($this->debug_sql_explain)
|
Line 242 | Line 254 |
---|
$query_id = $this->query_result; }
|
$query_id = $this->query_result; }
|
if ($cache && $cache->sql_exists($query_id))
| $safe_query_id = $this->clean_query_id($query_id); if ($cache && $cache->sql_exists($safe_query_id))
|
{
|
{
|
return $cache->sql_fetchrow($query_id);
| return $cache->sql_fetchrow($safe_query_id);
|
}
if (!$query_id)
| }
if (!$query_id)
|
Line 271 | Line 284 |
---|
}
/**
|
}
/**
|
* {@inheritDoc}
| * {@inheritdoc}
|
*/
|
*/
|
function sql_nextid()
| public function sql_last_inserted_id()
|
{ $result_id = @sqlsrv_query($this->db_connect_id, 'SELECT @@IDENTITY');
| { $result_id = @sqlsrv_query($this->db_connect_id, 'SELECT @@IDENTITY');
|
Line 302 | Line 315 |
---|
$query_id = $this->query_result; }
|
$query_id = $this->query_result; }
|
if ($cache && !is_object($query_id) && $cache->sql_exists($query_id))
| $safe_query_id = $this->clean_query_id($query_id); if ($cache && $cache->sql_exists($safe_query_id))
|
{
|
{
|
return $cache->sql_freeresult($query_id);
| return $cache->sql_freeresult($safe_query_id);
|
}
|
}
|
if (isset($this->open_queries[(int) $query_id]))
| if (isset($this->open_queries[$safe_query_id]))
|
{
|
{
|
unset($this->open_queries[(int) $query_id]);
| unset($this->open_queries[$safe_query_id]);
|
return sqlsrv_free_stmt($query_id); }
| return sqlsrv_free_stmt($query_id); }
|