mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-03 15:27:42 +02:00
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/10205] Reduce nesting in mysql drivers. [ticket/10205] Rewrite _sql_error implementations to have a single return. [ticket/10205] Cosmetic changes. [ticket/10205] Add some columns to the empty fixture file for mssqlnative. [ticket/10205] Delete stray return. [ticket/10205] Test failed connection attempts. [ticket/10205] Check for function existence in mssql connect method. [ticket/10205] Convert mssqlnative driver to the same logic. [ticket/10205] Fix a parse error in oracle driver. [ticket/10205] Fix remaining db drivers. [ticket/10205] Avoid calling mysqli functions when mysqli is missing. [ticket/10205] Account for potentially missing extensions in dbal. Conflicts: tests/fixtures/empty.xml
This commit is contained in:
@@ -26,12 +26,19 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
class dbal_mysqli extends dbal
|
||||
{
|
||||
var $multi_insert = true;
|
||||
var $connect_error = '';
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
*/
|
||||
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false , $new_link = false)
|
||||
{
|
||||
if (!function_exists('mysqli_connect'))
|
||||
{
|
||||
$this->connect_error = 'mysqli_connect function does not exist, is mysqli extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
|
||||
// Mysqli extension supports persistent connection since PHP 5.3.0
|
||||
$this->persistency = (version_compare(PHP_VERSION, '5.3.0', '>=')) ? $persistency : false;
|
||||
$this->user = $sqluser;
|
||||
@@ -423,18 +430,29 @@ class dbal_mysqli extends dbal
|
||||
*/
|
||||
function _sql_error()
|
||||
{
|
||||
if (!$this->db_connect_id)
|
||||
if ($this->db_connect_id)
|
||||
{
|
||||
return array(
|
||||
$error = array(
|
||||
'message' => @mysqli_error($this->db_connect_id),
|
||||
'code' => @mysqli_errno($this->db_connect_id)
|
||||
);
|
||||
}
|
||||
else if (function_exists('mysqli_connect_error'))
|
||||
{
|
||||
$error = array(
|
||||
'message' => @mysqli_connect_error(),
|
||||
'code' => @mysqli_connect_errno()
|
||||
'code' => @mysqli_connect_errno(),
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = array(
|
||||
'message' => $this->connect_error,
|
||||
'code' => '',
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'message' => @mysqli_error($this->db_connect_id),
|
||||
'code' => @mysqli_errno($this->db_connect_id)
|
||||
);
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user