private static $dbdriver_class; private static $builder; private static $Functions = array("CreateConnection", "SelectQuery", "CreateTable", "InsertQuery", "DropTable"); public static function SetDBDriver($driver) { PathDriver::Using(array(PathDriver::DATABASE => array($driver))); self::$dbdriver_class = $driver; } public static function __callStatic($method, $parameters) { if (in_array($method, self::$Functions)) { $driver = self::$dbdriver_class; return call_user_func_array(array($driver, $method), $parameters); } else { return array(false, "Function doesn't exist"); } } public static function GetBuilder() { return self::$builder; } public static function SetBuilder($builder) { PathDriver::Using(array(PathDriver::DATABASE => array($builder))); self::$builder = $builder; } } DBController::SetDBDriver($GLOBALS['configuration']["DBController"]["ControllerClass"]); DBController::SetBuilder($GLOBALS['configuration']["DBController"]["StatementBuilder"]); DBController::CreateConnection($GLOBALS['configuration']["DBController"]["ControllerConfig"]);