Improve dsn string logic
This commit is contained in:
parent
42273c43aa
commit
b241819799
@ -82,13 +82,11 @@ class Query_Builder {
|
|||||||
switch($dbtype)
|
switch($dbtype)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
$dsn = "host={$params->host};dbname={$params->database}";
|
||||||
|
|
||||||
if ( ! empty($params->port))
|
if ( ! empty($params->port))
|
||||||
{
|
{
|
||||||
$dsn = "host={$params->host};port={$params->port};dbname={$params->database}";
|
$dsn .= ";port={$params->port}";
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$dsn = "host={$params->host};dbname={$params->database}";
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -102,7 +100,7 @@ class Query_Builder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the database connection
|
// Create the database connection
|
||||||
if ( ! empty($params->user) && $db_type !== 'sqlite')
|
if ( ! empty($params->user))
|
||||||
{
|
{
|
||||||
$this->db = new $dbtype($dsn, $params->user, $params->pass);
|
$this->db = new $dbtype($dsn, $params->user, $params->pass);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user