- fix for a php bug (not able to connect on custom ports if the server is localhost - though 127.0.0.1 works) -> #1444

git-svn-id: file:///svn/phpbb/trunk@5774 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2006-04-08 17:34:04 +00:00
parent 1e0ee65aed
commit a2ac7a6cc6

View file

@ -39,10 +39,12 @@ class dbal_mysqli extends dbal
{
$this->persistency = $persistency;
$this->user = $sqluser;
$this->server = $sqlserver . (($port) ? ':' . $port : '');
$this->server = $sqlserver;
$this->dbname = $database;
$port = (!$port) ? NULL : $port;
$this->db_connect_id = ($this->persistency) ? @mysqli_pconnect($this->server, $this->user, $sqlpassword) : @mysqli_connect($this->server, $this->user, $sqlpassword);
// Persistant connections not supported by the mysqli extension?
$this->db_connect_id = @mysqli_connect($this->server, $this->user, $sqlpassword, $this->dbname, $port);
if ($this->db_connect_id && $this->dbname != '')
{
@ -289,6 +291,14 @@ class dbal_mysqli extends dbal
*/
function _sql_error()
{
if (!$this->db_connect_id)
{
return array(
'message' => @mysqli_connect_error(),
'code' => @mysqli_connect_errno()
);
}
return array(
'message' => @mysqli_error($this->db_connect_id),
'code' => @mysqli_errno($this->db_connect_id)