public static function add_connection($name) { $config = config::get('db'); // Check for configuration if (empty($config[$name])) { dingo_error(E_USER_ERROR, "DB Connection Settings For '{$name}' Not Found."); return FALSE; } $config = $config[$name]; // PDO Driver if (in_array($config['driver'], self::$pdo)) { load::driver('db', 'pdo'); $driver_class = 'pdo_db_connection'; } else { load::driver('db', $config['driver']); $driver_class = "{$config['driver']}_db_connection"; } // Connect self::$connections[$name] = new $driver_class($config['driver'], $config['host'], $config['username'], $config['password'], $config['database']); // Return connection return self::$connections[$name]; }