diff options
author | Maat <maat-pub@mageia.biz> | 2013-11-30 14:43:45 +0100 |
---|---|---|
committer | Maat <maat-pub@mageia.biz> | 2013-11-30 14:47:18 +0100 |
commit | 33193de3c84f52917ba5c340591cc2d97dc42ebb (patch) | |
tree | 4b6635e7e8e8b9e69a3e58689a6f9c1241dee8f3 /phpBB/includes/db/sqlite.php | |
parent | 41b19431251f19f607d192a555fdf1e57fb36643 (diff) | |
parent | 446ea9928d8373cf7695d3adda6d5ee30d5f94b4 (diff) | |
download | forums-33193de3c84f52917ba5c340591cc2d97dc42ebb.tar forums-33193de3c84f52917ba5c340591cc2d97dc42ebb.tar.gz forums-33193de3c84f52917ba5c340591cc2d97dc42ebb.tar.bz2 forums-33193de3c84f52917ba5c340591cc2d97dc42ebb.tar.xz forums-33193de3c84f52917ba5c340591cc2d97dc42ebb.zip |
Merge remote-tracking branch 'upstream/prep-release-3.0.12'
Diffstat (limited to 'phpBB/includes/db/sqlite.php')
-rw-r--r-- | phpBB/includes/db/sqlite.php | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php index 8de72fd394..557b057cce 100644 --- a/phpBB/includes/db/sqlite.php +++ b/phpBB/includes/db/sqlite.php @@ -25,6 +25,8 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); */ class dbal_sqlite extends dbal { + var $connect_error = ''; + /** * Connect to server */ @@ -36,7 +38,24 @@ class dbal_sqlite extends dbal $this->dbname = $database; $error = ''; - $this->db_connect_id = ($this->persistency) ? @sqlite_popen($this->server, 0666, $error) : @sqlite_open($this->server, 0666, $error); + if ($this->persistency) + { + if (!function_exists('sqlite_popen')) + { + $this->connect_error = 'sqlite_popen function does not exist, is sqlite extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @sqlite_popen($this->server, 0666, $error); + } + else + { + if (!function_exists('sqlite_open')) + { + $this->connect_error = 'sqlite_open function does not exist, is sqlite extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @sqlite_open($this->server, 0666, $error); + } if ($this->db_connect_id) { @@ -281,10 +300,22 @@ class dbal_sqlite extends dbal */ function _sql_error() { - return array( - 'message' => @sqlite_error_string(@sqlite_last_error($this->db_connect_id)), - 'code' => @sqlite_last_error($this->db_connect_id) - ); + if (function_exists('sqlite_error_string')) + { + $error = array( + 'message' => @sqlite_error_string(@sqlite_last_error($this->db_connect_id)), + 'code' => @sqlite_last_error($this->db_connect_id), + ); + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; } /** |