Fix dsn issue in tests

This commit is contained in:
Timothy Warren 2014-02-11 14:38:08 -05:00
parent bed0d1bb04
commit 8e16cc0c19
2 changed files with 5 additions and 1 deletions

View File

@ -38,7 +38,7 @@ class MySQL extends DB_PDO {
*/ */
public function __construct($dsn, $username=null, $password=null, $options=array()) public function __construct($dsn, $username=null, $password=null, $options=array())
{ {
// Automatically set the charset to UTF-8 // Set the charset to UTF-8
if (defined('PDO::MYSQL_ATTR_INIT_COMMAND')) if (defined('PDO::MYSQL_ATTR_INIT_COMMAND'))
{ {
$options = array_merge($options, array( $options = array_merge($options, array(
@ -46,6 +46,8 @@ class MySQL extends DB_PDO {
)); ));
} }
if (strpos($dsn, 'mysql') === FALSE) $dsn = 'mysql:'.$dsn;
parent::__construct($dsn, $username, $password, $options); parent::__construct($dsn, $username, $password, $options);
} }

View File

@ -31,6 +31,8 @@ class PgSQL extends DB_PDO {
*/ */
public function __construct($dsn, $username=null, $password=null, $options=array()) public function __construct($dsn, $username=null, $password=null, $options=array())
{ {
if (strpos($dsn, 'pgsql') === FALSE) $dsn = 'pgsql:'.$dsn;
parent::__construct($dsn, $username, $password, $options); parent::__construct($dsn, $username, $password, $options);
} }