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/mssql_odbc.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/mssql_odbc.php')
| -rw-r--r-- | phpBB/includes/db/driver/mssql_odbc.php | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/phpBB/includes/db/driver/mssql_odbc.php b/phpBB/includes/db/driver/mssql_odbc.php index d1f31a6554..13e74e66d4 100644 --- a/phpBB/includes/db/driver/mssql_odbc.php +++ b/phpBB/includes/db/driver/mssql_odbc.php @@ -29,6 +29,7 @@ if (!defined('IN_PHPBB')) class phpbb_db_driver_mssql_odbc extends phpbb_db_driver { var $last_query_text = ''; + var $connect_error = ''; /** * Connect to server @@ -65,7 +66,24 @@ class phpbb_db_driver_mssql_odbc extends phpbb_db_driver @ini_set('odbc.defaultlrl', $max_size); } - $this->db_connect_id = ($this->persistency) ? @odbc_pconnect($this->server, $this->user, $sqlpassword) : @odbc_connect($this->server, $this->user, $sqlpassword); + if ($this->persistency) + { + if (!function_exists('odbc_pconnect')) + { + $this->connect_error = 'odbc_pconnect function does not exist, is odbc extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @odbc_pconnect($this->server, $this->user, $sqlpassword); + } + else + { + if (!function_exists('odbc_connect')) + { + $this->connect_error = 'odbc_connect function does not exist, is odbc extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @odbc_connect($this->server, $this->user, $sqlpassword); + } return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); } @@ -347,10 +365,22 @@ class phpbb_db_driver_mssql_odbc extends phpbb_db_driver */ function _sql_error() { - return array( - 'message' => @odbc_errormsg(), - 'code' => @odbc_error() - ); + if (function_exists('odbc_errormsg')) + { + $error = array( + 'message' => @odbc_errormsg(), + 'code' => @odbc_error(), + ); + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; } /** |
