classes/database.php
/**
	 * Get a singleton instance of the Database object loading one if
	 * not already created.
	 *
	 * @param string the instance name
	 * @param array the configuration parameters
	 * @return object
	 */
Get a singleton instance of the Database object loading one if
not already created.

@param string the instance name
@param array the configuration parameters
@return object
Get a singleton instance of the Database object loading one if not already created . @param string the instance name @param array the configuration parameters @return object
public static function instance($name = 'default', array $config = NULL)
	{
		if (isset(self::$instances[$name]))
		{
			return self::$instances[$name];
		}
		if ( ! $config)
		{
			throw new Exception('Database configuration not found for '. $name);
		}
		$driver = 'Database_'. current(explode(':', $config['dsn'], 2));
		return self::$instances[$name] = new $driver($name, $config);
	}
public static function instance ( $ name = 'default' , array $ config = NULL ) { if ( isset ( self :: $ instances [ $ name ] ) ) { return self :: $ instances [ $ name ] ; } if ( ! $ config ) { throw new Exception ( 'Database configuration not found for ' . $ name ) ; } $ driver = 'Database_' . current ( explode ( ':' , $ config [ 'dsn' ] , 2 ) ) ; return self :: $ instances [ $ name ] = new $ driver ( $ name , $ config ) ; }
Get a singleton instance of the Database object loading one if
 not already created.
Get a singleton instance of the Database object loading one if not already created .
// Get the database type // Create the database connection instance