aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/firebird.php
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-05-08 03:21:19 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2011-05-08 03:21:19 -0400
commitab44fe5e394fe7b69c57266e2934200a3ee9bbc5 (patch)
treee6021c19fa15800787b1a7459fb8ad40cf2d8391 /phpBB/includes/db/firebird.php
parent9c6660a2253149baff0094b943823de6758b35a6 (diff)
parentc0336988155736583c6fc4398980bd2a4e4036b6 (diff)
downloadforums-ab44fe5e394fe7b69c57266e2934200a3ee9bbc5.tar
forums-ab44fe5e394fe7b69c57266e2934200a3ee9bbc5.tar.gz
forums-ab44fe5e394fe7b69c57266e2934200a3ee9bbc5.tar.bz2
forums-ab44fe5e394fe7b69c57266e2934200a3ee9bbc5.tar.xz
forums-ab44fe5e394fe7b69c57266e2934200a3ee9bbc5.zip
Merge branch 'develop' into feature/prune-users
* develop: (170 commits) [ticket/10145] Always recompile all templates when DEBUG_EXTRA is defined. [feature/attachment-management-no-reassignment] Handle privacy and some more. [ticket/10148] Turn TEMPLATE_BITFIELD into an instance variable. [ticket/10147] Corrected a typo in includes/functions_template.php. [ticket/10141] Save a hash lookup when value is not in cache. [ticket/10143] Added tests for storing a previously deleted value in db cache. [ticket/10105] Update AIM express link. [ticket/10105] Update AIM application download link. [ticket/10137] Remove unintended space at end of PHP_URL_FOPEN_SUPPORT_EXPLAIN. [ticket/10141] Split double-assignment into conditional and unconditional part. [ticket/10141] Use a cache in $auth->_fill_acl() for better performance. [ticket/9961] Create log entries when users are activated. [ticket/10139] Make signatures of set_atomic() consistent by using $new_value. [ticket/10139] Rename $cache to $use_cache to avoid confusion with cache object [ticket/10006] Remove unneeded if statements [ticket/10006] Remove return values [ticket/10006] More testing [ticket/10006] Tweak the tests a bit [ticket/10006] Add phpbb_config::delete [ticket/7941] Added @return to generate_board_url docstring. ...
Diffstat (limited to 'phpBB/includes/db/firebird.php')
-rw-r--r--phpBB/includes/db/firebird.php49
1 files changed, 46 insertions, 3 deletions
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index 69476f79f8..8868d4e317 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -28,6 +28,7 @@ class dbal_firebird extends dbal
var $last_query_text = '';
var $service_handle = false;
var $affected_rows = 0;
+ var $connect_error = '';
/**
* Connect to server
@@ -53,9 +54,35 @@ class dbal_firebird extends dbal
$use_database = $this->server . ':' . $this->dbname;
}
- $this->db_connect_id = ($this->persistency) ? @ibase_pconnect($use_database, $this->user, $sqlpassword, false, false, 3) : @ibase_connect($use_database, $this->user, $sqlpassword, false, false, 3);
+ if ($this->persistency)
+ {
+ if (!function_exists('ibase_pconnect'))
+ {
+ $this->connect_error = 'ibase_pconnect function does not exist, is interbase extension installed?';
+ return $this->sql_error('');
+ }
+ $this->db_connect_id = @ibase_pconnect($use_database, $this->user, $sqlpassword, false, false, 3);
+ }
+ else
+ {
+ if (!function_exists('ibase_connect'))
+ {
+ $this->connect_error = 'ibase_connect function does not exist, is interbase extension installed?';
+ return $this->sql_error('');
+ }
+ $this->db_connect_id = @ibase_connect($use_database, $this->user, $sqlpassword, false, false, 3);
+ }
- $this->service_handle = (function_exists('ibase_service_attach') && $this->server) ? @ibase_service_attach($this->server, $this->user, $sqlpassword) : false;
+ // Do not call ibase_service_attach if connection failed,
+ // otherwise error message from ibase_(p)connect call will be clobbered.
+ if ($this->db_connect_id && function_exists('ibase_service_attach') && $this->server)
+ {
+ $this->service_handle = @ibase_service_attach($this->server, $this->user, $sqlpassword);
+ }
+ else
+ {
+ $this->service_handle = false;
+ }
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
}
@@ -487,8 +514,24 @@ class dbal_firebird extends dbal
*/
function _sql_error()
{
+ // Need special handling here because ibase_errmsg returns
+ // connection errors, however if the interbase extension
+ // is not installed then ibase_errmsg does not exist and
+ // we cannot call it.
+ if (function_exists('ibase_errmsg'))
+ {
+ $msg = @ibase_errmsg();
+ if (!$msg)
+ {
+ $msg = $this->connect_error;
+ }
+ }
+ else
+ {
+ $msg = $this->connect_error;
+ }
return array(
- 'message' => @ibase_errmsg(),
+ 'message' => $msg,
'code' => (@function_exists('ibase_errcode') ? @ibase_errcode() : '')
);
}