diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-12-13 08:52:53 -0800 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-12-13 08:52:53 -0800 |
commit | 155937807a99e4a5789ad9c0991bfa6e1fe010ff (patch) | |
tree | 6ba6cff4ae53355f6234494f6c2599ec5ec2f9f2 /phpBB/includes/db/driver/sqlite.php | |
parent | b0b5a13131b90b8320de6f49db6c505d38b42c96 (diff) | |
parent | 83345d986d172ee8b655ec4600c1f1575ba306d0 (diff) | |
download | forums-155937807a99e4a5789ad9c0991bfa6e1fe010ff.tar forums-155937807a99e4a5789ad9c0991bfa6e1fe010ff.tar.gz forums-155937807a99e4a5789ad9c0991bfa6e1fe010ff.tar.bz2 forums-155937807a99e4a5789ad9c0991bfa6e1fe010ff.tar.xz forums-155937807a99e4a5789ad9c0991bfa6e1fe010ff.zip |
Merge pull request #19 from p/ticket/11015
Ticket/11015
Diffstat (limited to 'phpBB/includes/db/driver/sqlite.php')
-rw-r--r-- | phpBB/includes/db/driver/sqlite.php | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/phpBB/includes/db/driver/sqlite.php b/phpBB/includes/db/driver/sqlite.php index 0b09fa758d..6b9cc64d89 100644 --- a/phpBB/includes/db/driver/sqlite.php +++ b/phpBB/includes/db/driver/sqlite.php @@ -22,6 +22,8 @@ if (!defined('IN_PHPBB')) */ class phpbb_db_driver_sqlite extends phpbb_db_driver { + var $connect_error = ''; + /** * Connect to server */ @@ -33,7 +35,24 @@ class phpbb_db_driver_sqlite extends phpbb_db_driver $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) { @@ -278,10 +297,22 @@ class phpbb_db_driver_sqlite extends phpbb_db_driver */ 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; } /** |