aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/mssql_odbc.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/db/mssql_odbc.php')
-rw-r--r--phpBB/includes/db/mssql_odbc.php40
1 files changed, 35 insertions, 5 deletions
diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php
index 7c1ffbc808..2194de4a5e 100644
--- a/phpBB/includes/db/mssql_odbc.php
+++ b/phpBB/includes/db/mssql_odbc.php
@@ -31,6 +31,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
class dbal_mssql_odbc extends dbal
{
var $last_query_text = '';
+ var $connect_error = '';
/**
* Connect to server
@@ -67,7 +68,24 @@ class dbal_mssql_odbc extends dbal
@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('');
}
@@ -349,10 +367,22 @@ class dbal_mssql_odbc extends dbal
*/
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;
}
/**