diff options
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; } /** |