*** empty log message ***

git-svn-id: file:///svn/phpbb/trunk@6450 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2006-10-06 22:44:58 +00:00
parent 6c49652a19
commit 3ad6069d01

View file

@ -38,48 +38,45 @@ class dbal_postgres extends dbal
*/ */
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false) function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false)
{ {
$this->connect_string = ''; $connect_string = '';
if ($sqluser) if ($sqluser)
{ {
$this->connect_string .= "user=$sqluser "; $connect_string .= "user=$sqluser ";
} }
if ($sqlpassword) if ($sqlpassword)
{ {
$this->connect_string .= "password=$sqlpassword "; $connect_string .= "password=$sqlpassword ";
} }
if ($sqlserver) if ($sqlserver)
{ {
if (strpos($sqlserver, ':') !== false) if (strpos($sqlserver, ':') !== false)
{ {
list($sqlserver, $sqlport) = explode(':', $sqlserver); list($sqlserver, $port) = explode(':', $sqlserver);
$this->connect_string .= "host=$sqlserver port=$sqlport ";
} }
else
{
if ($sqlserver != "localhost")
{
$this->connect_string .= "host=$sqlserver ";
}
if ($port) if ($sqlserver !== 'localhost')
{ {
$this->connect_string .= "port=$port "; $connect_string .= "host=$sqlserver ";
} }
if ($port)
{
$connect_string .= "port=$port ";
} }
} }
if ($database) if ($database)
{ {
$this->dbname = $database; $this->dbname = $database;
$this->connect_string .= "dbname=$database"; $connect_string .= "dbname=$database";
} }
$this->persistency = $persistency; $this->persistency = $persistency;
$this->db_connect_id = ($this->persistency) ? @pg_pconnect($this->connect_string) : @pg_connect($this->connect_string); $this->db_connect_id = ($this->persistency) ? @pg_pconnect($connect_string) : @pg_connect($connect_string);
return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error('');
} }