diff options
Diffstat (limited to 'include/dba/dba_pdo.php')
-rwxr-xr-x | include/dba/dba_pdo.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php index bb89df6be..c2f9c5b09 100755 --- a/include/dba/dba_pdo.php +++ b/include/dba/dba_pdo.php @@ -10,14 +10,18 @@ class dba_pdo extends dba_driver { function connect($server,$scheme,$port,$user,$pass,$db) { $this->driver_dbtype = $scheme; - $dns = $this->driver_dbtype - . ':host=' . $server . (is_null($port) ? '' : ';port=' . $port) - . ';dbname=' . $db; - // db_logger('dns: ' . $dns); + if(strpbrk($server,':;')) { + $dsn = $server; + } + else { + $dsn = $this->driver_dbtype . ':host=' . $server . (is_null($port) ? '' : ';port=' . $port); + } + + $dsn .= ';dbname=' . $db; try { - $this->db = new PDO($dns,$user,$pass); + $this->db = new PDO($dsn,$user,$pass); $this->db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); } catch(PDOException $e) { |