mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/10205] Convert mssqlnative driver to the same logic.
PHPBB3-10205
This commit is contained in:
parent
40db60e45f
commit
de2fe1a308
1 changed files with 32 additions and 20 deletions
|
@ -199,16 +199,18 @@ class dbal_mssqlnative extends dbal
|
||||||
var $m_insert_id = NULL;
|
var $m_insert_id = NULL;
|
||||||
var $last_query_text = '';
|
var $last_query_text = '';
|
||||||
var $query_options = array();
|
var $query_options = array();
|
||||||
|
var $connect_error = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to server
|
* Connect to server
|
||||||
*/
|
*/
|
||||||
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
|
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
|
||||||
{
|
{
|
||||||
# Test for driver support, to avoid suppressed fatal error
|
// Test for driver support, to avoid suppressed fatal error
|
||||||
if (!function_exists('sqlsrv_connect'))
|
if (!function_exists('sqlsrv_connect'))
|
||||||
{
|
{
|
||||||
trigger_error('Native MS SQL Server driver for PHP is missing or needs to be updated. Version 1.1 or later is required to install phpBB3. You can download the driver from: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx\n', E_USER_ERROR);
|
$this->connect_error = 'Native MS SQL Server driver for PHP is missing or needs to be updated. Version 1.1 or later is required to install phpBB3. You can download the driver from: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx';
|
||||||
|
return $this->sql_error('');
|
||||||
}
|
}
|
||||||
|
|
||||||
//set up connection variables
|
//set up connection variables
|
||||||
|
@ -513,6 +515,8 @@ class dbal_mssqlnative extends dbal
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _sql_error()
|
function _sql_error()
|
||||||
|
{
|
||||||
|
if (function_exists('sqlsrv_errors'))
|
||||||
{
|
{
|
||||||
$errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
$errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||||
$error_message = '';
|
$error_message = '';
|
||||||
|
@ -540,6 +544,14 @@ class dbal_mssqlnative extends dbal
|
||||||
'code' => $code,
|
'code' => $code,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'message' => $this->connect_error,
|
||||||
|
'code' => '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build db-specific query data
|
* Build db-specific query data
|
||||||
|
|
Loading…
Add table
Reference in a new issue