mirror of
https://github.com/dg/dibi.git
synced 2025-08-29 16:59:49 +02:00
* added configuration aliases (user -> username, pass -> password)
* dibi::$defaultDriver
This commit is contained in:
@@ -140,6 +140,12 @@ class dibi
|
||||
*/
|
||||
public static $numOfQueries = 0;
|
||||
|
||||
/**
|
||||
* Default dibi driver
|
||||
* @var string
|
||||
*/
|
||||
public static $defaultDriver = 'mysql';
|
||||
|
||||
/**
|
||||
* Start time
|
||||
* @var int
|
||||
@@ -165,15 +171,15 @@ class dibi
|
||||
* @return DibiDriver
|
||||
* @throws DibiException
|
||||
*/
|
||||
public static function connect($config = 'driver=mysql', $name = 0)
|
||||
public static function connect($config = array(), $name = 0)
|
||||
{
|
||||
// DSN string
|
||||
if (is_string($config)) {
|
||||
parse_str($config, $config);
|
||||
}
|
||||
|
||||
if (empty($config['driver'])) {
|
||||
throw new DibiException('Driver is not specified.');
|
||||
if (!isset($config['driver'])) {
|
||||
$config['driver'] = self::$defaultDriver;
|
||||
}
|
||||
|
||||
$class = "Dibi$config[driver]Driver";
|
||||
|
Reference in New Issue
Block a user