aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/driver/sqlite.php
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-06-22 18:08:38 +0200
committerTristan Darricau <github@nicofuma.fr>2014-06-22 18:16:21 +0200
commit2276c1c0f246a39dee8d0e979c89e8de0ee7a5de (patch)
tree2fa3ad4b6eaab11defa6ce3accc9ef95bca71bbb /phpBB/phpbb/db/driver/sqlite.php
parentafe9d3c3f39ca1c69146778882f2b0250dfa3ed7 (diff)
downloadforums-2276c1c0f246a39dee8d0e979c89e8de0ee7a5de.tar
forums-2276c1c0f246a39dee8d0e979c89e8de0ee7a5de.tar.gz
forums-2276c1c0f246a39dee8d0e979c89e8de0ee7a5de.tar.bz2
forums-2276c1c0f246a39dee8d0e979c89e8de0ee7a5de.tar.xz
forums-2276c1c0f246a39dee8d0e979c89e8de0ee7a5de.zip
[ticket/12387] Cleanup *_free_result call and remove @ on that call
PHPBB3-12387
Diffstat (limited to 'phpBB/phpbb/db/driver/sqlite.php')
-rw-r--r--phpBB/phpbb/db/driver/sqlite.php34
1 files changed, 20 insertions, 14 deletions
diff --git a/phpBB/phpbb/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php
index f4c5e240fc..9130b2b292 100644
--- a/phpBB/phpbb/db/driver/sqlite.php
+++ b/phpBB/phpbb/db/driver/sqlite.php
@@ -70,13 +70,16 @@ class sqlite extends \phpbb\db\driver\driver
if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('sqlite_version')) === false)
{
$result = @sqlite_query('SELECT sqlite_version() AS version', $this->db_connect_id);
- $row = @sqlite_fetch_array($result, SQLITE_ASSOC);
+ if ($result)
+ {
+ $row = sqlite_fetch_array($result, SQLITE_ASSOC);
- $this->sql_server_version = (!empty($row['version'])) ? $row['version'] : 0;
+ $this->sql_server_version = (!empty($row['version'])) ? $row['version'] : 0;
- if (!empty($cache) && $use_cache)
- {
- $cache->put('sqlite_version', $this->sql_server_version);
+ if (!empty($cache) && $use_cache)
+ {
+ $cache->put('sqlite_version', $this->sql_server_version);
+ }
}
}
@@ -137,14 +140,14 @@ class sqlite extends \phpbb\db\driver\driver
$this->sql_report('stop', $query);
}
- if ($cache && $cache_ttl)
+ if (!$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);
+ return false;
}
- else if (strpos($query, 'SELECT') === 0 && $this->query_result)
+
+ 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 (defined('DEBUG'))
@@ -203,7 +206,7 @@ class sqlite extends \phpbb\db\driver\driver
return $cache->sql_fetchrow($query_id);
}
- return ($query_id !== false) ? @sqlite_fetch_array($query_id, SQLITE_ASSOC) : false;
+ return ($query_id) ? sqlite_fetch_array($query_id, SQLITE_ASSOC) : false;
}
/**
@@ -223,7 +226,7 @@ class sqlite extends \phpbb\db\driver\driver
return $cache->sql_rowseek($rownum, $query_id);
}
- return ($query_id !== false) ? @sqlite_seek($query_id, $rownum) : false;
+ return ($query_id) ? @sqlite_seek($query_id, $rownum) : false;
}
/**
@@ -337,9 +340,12 @@ class sqlite extends \phpbb\db\driver\driver
$endtime = $endtime[0] + $endtime[1];
$result = @sqlite_query($query, $this->db_connect_id);
- while ($void = @sqlite_fetch_array($result, SQLITE_ASSOC))
+ if ($result)
{
- // Take the time spent on parsing rows into account
+ while ($void = sqlite_fetch_array($result, SQLITE_ASSOC))
+ {
+ // Take the time spent on parsing rows into account
+ }
}
$splittime = explode(' ', microtime());