diff options
author | Andreas Fischer <bantu@phpbb.com> | 2012-12-08 03:04:05 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2012-12-08 03:04:05 +0100 |
commit | b5f94a14f1a5c77366f824780f1120a1b5e9184a (patch) | |
tree | 22c4c57a1fc7a3d2e0f2946272c3c0725f125446 /phpBB/includes/db/sqlite.php | |
parent | a8deb7f87b359802f9a8a53e44f4f9a9a6d87575 (diff) | |
parent | 5120f36a258ffcbffd5c10e9a1056d64ea794a16 (diff) | |
download | forums-b5f94a14f1a5c77366f824780f1120a1b5e9184a.tar forums-b5f94a14f1a5c77366f824780f1120a1b5e9184a.tar.gz forums-b5f94a14f1a5c77366f824780f1120a1b5e9184a.tar.bz2 forums-b5f94a14f1a5c77366f824780f1120a1b5e9184a.tar.xz forums-b5f94a14f1a5c77366f824780f1120a1b5e9184a.zip |
Merge remote-tracking branch 'p/ticket/10205' into develop-olympus
* p/ticket/10205:
[ticket/10205] Reduce nesting in mysql drivers.
[ticket/10205] Rewrite _sql_error implementations to have a single return.
[ticket/10205] Cosmetic changes.
[ticket/10205] Add some columns to the empty fixture file for mssqlnative.
[ticket/10205] Delete stray return.
[ticket/10205] Test failed connection attempts.
[ticket/10205] Check for function existence in mssql connect method.
[ticket/10205] Convert mssqlnative driver to the same logic.
[ticket/10205] Fix a parse error in oracle driver.
[ticket/10205] Fix remaining db drivers.
[ticket/10205] Avoid calling mysqli functions when mysqli is missing.
[ticket/10205] Account for potentially missing extensions in dbal.
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; } /** |