DB::getMDB PHP Method

getMDB() public static method

public static getMDB ( )
    public static function getMDB()
    {
        $mdb = DB::$mdb;
        if ($mdb === null) {
            $mdb = DB::$mdb = new MeekroDB();
        }
        if ($mdb->param_char !== DB::$param_char) {
            $mdb->param_char = DB::$param_char;
        }
        if ($mdb->named_param_seperator !== DB::$named_param_seperator) {
            $mdb->named_param_seperator = DB::$named_param_seperator;
        }
        if ($mdb->success_handler !== DB::$success_handler) {
            $mdb->success_handler = DB::$success_handler;
        }
        if ($mdb->error_handler !== DB::$error_handler) {
            $mdb->error_handler = DB::$error_handler;
        }
        if ($mdb->throw_exception_on_error !== DB::$throw_exception_on_error) {
            $mdb->throw_exception_on_error = DB::$throw_exception_on_error;
        }
        if ($mdb->nonsql_error_handler !== DB::$nonsql_error_handler) {
            $mdb->nonsql_error_handler = DB::$nonsql_error_handler;
        }
        if ($mdb->throw_exception_on_nonsql_error !== DB::$throw_exception_on_nonsql_error) {
            $mdb->throw_exception_on_nonsql_error = DB::$throw_exception_on_nonsql_error;
        }
        if ($mdb->nested_transactions !== DB::$nested_transactions) {
            $mdb->nested_transactions = DB::$nested_transactions;
        }
        if ($mdb->usenull !== DB::$usenull) {
            $mdb->usenull = DB::$usenull;
        }
        return $mdb;
    }

Usage Example

 /**
  * @param $name
  * @param $args
  * @return mixed
  * @throws \Exception
  */
 public function __call($name, $args)
 {
     if (!in_array($name, self::$ALLOWED_METHODS)) {
         throw new \Exception(sprintf('The method "%s" is not allowed.', $name));
     }
     $this->connect();
     $result = call_user_func_array(array(\DB::getMDB(), $name), $args);
     $this->disconnect();
     return $result;
 }
All Usage Examples Of DB::getMDB