mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 15:45:34 +02:00
[ticket/10205] Account for potentially missing extensions in dbal.
PHPBB3-10205
This commit is contained in:
parent
e64c5117b9
commit
025a95ea90
@ -32,6 +32,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
|
||||
@ -68,7 +69,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('');
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
class dbal_mysql extends dbal
|
||||
{
|
||||
var $multi_insert = true;
|
||||
var $connect_error = '';
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
@ -44,7 +45,24 @@ class dbal_mysql extends dbal
|
||||
|
||||
$this->sql_layer = 'mysql4';
|
||||
|
||||
$this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
|
||||
if ($this->persistency)
|
||||
{
|
||||
if (!function_exists('mysql_pconnect'))
|
||||
{
|
||||
$this->connect_error = 'mysql_pconnect function does not exist, is mysql extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @mysql_pconnect($this->server, $this->user, $sqlpassword);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!function_exists('mysql_connect'))
|
||||
{
|
||||
$this->connect_error = 'mysql_connect function does not exist, is mysql extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
|
||||
}
|
||||
|
||||
if ($this->db_connect_id && $this->dbname != '')
|
||||
{
|
||||
|
@ -27,12 +27,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;
|
||||
|
@ -25,6 +25,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
class dbal_oracle extends dbal
|
||||
{
|
||||
var $last_query_text = '';
|
||||
var $connect_error = '';
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
@ -48,7 +49,33 @@ class dbal_oracle extends dbal
|
||||
$connect = $sqlserver . (($port) ? ':' . $port : '') . '/' . $database;
|
||||
}
|
||||
|
||||
$this->db_connect_id = ($new_link) ? @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8') : (($this->persistency) ? @ociplogon($this->user, $sqlpassword, $connect, 'UTF8') : @ocilogon($this->user, $sqlpassword, $connect, 'UTF8'));
|
||||
if ($new_link)
|
||||
{
|
||||
if (!function_exists('ocinlogon'))
|
||||
{
|
||||
$this->connect_error = 'ocinlogon function does not exist, is oci extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8');
|
||||
}
|
||||
else if ($this->persistency)
|
||||
{
|
||||
if (!function_exists('ociplogon'))
|
||||
{
|
||||
$this->connect_error = 'ociplogon function does not exist, is oci extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @ociplogon($this->user, $sqlpassword, $connect, 'UTF8');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!function_exists('ocilogon'))
|
||||
{
|
||||
$this->connect_error = 'ocilogon function does not exist, is oci extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @ocilogon($this->user, $sqlpassword, $connect, 'UTF8'));
|
||||
}
|
||||
|
||||
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
|
||||
*/
|
||||
class dbal_sqlite extends dbal
|
||||
{
|
||||
var $connect_error = '';
|
||||
|
||||
/**
|
||||
* Connect to server
|
||||
*/
|
||||
@ -36,7 +38,24 @@ class dbal_sqlite extends dbal
|
||||
$this->dbname = $database;
|
||||
|
||||
$error = '';
|
||||
$this->db_connect_id = ($this->persistency) ? @sqlite_popen($this->server, 0666, $error) : @sqlite_open($this->server, 0666, $error);
|
||||
if ($this->persistency)
|
||||
{
|
||||
if (!function_exists('sqlite_popen'))
|
||||
{
|
||||
$this->connect_error = 'sqlite_popen function does not exist, is sqlite extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @sqlite_popen($this->server, 0666, $error);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!function_exists('sqlite_open'))
|
||||
{
|
||||
$this->connect_error = 'sqlite_open function does not exist, is sqlite extension installed?';
|
||||
return $this->sql_error('');
|
||||
}
|
||||
$this->db_connect_id = @sqlite_open($this->server, 0666, $error);
|
||||
}
|
||||
|
||||
if ($this->db_connect_id)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user