1
0
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:
David Grudl
2007-10-26 17:44:24 +00:00
parent 879bbeba1f
commit 39c62c1cd5
11 changed files with 79 additions and 73 deletions

View File

@@ -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";