public static function init($dbConf = false) { include __DIR__ . '/../config.php'; try { $current = preg_split('/\\:/', $current); if (count($current) < 2 || !isset($db[$current[0]][$current[1]])) { self::$dbErrMsg = ErrorCatcher::errorMsg('config_error'); throw new ErrorCatcher(self::$dbErrMsg); } } catch (ErrorCatcher $e) { $excParm['e'] = $e; echo ErrorCatcher::fire($excParm); } self::$driver = $current[0]; $currentConf = $db[$current[0]][$current[1]]; if (!$dbConf) { if (is_null(self::$dbconf)) { self::$dbconf = $currentConf; self::$driver = ucfirst(self::$driver); $_driver = 'Db\\drivers\\My\\' . self::$driver; $_driver::init($currentConf); } } else { self::$dbconf = $config; } }
/** * Will run delete query * * @param string $table * @return void */ public static function delete($table = false) { try { if (!$table) { self::$dbErr = ErrorCatcher::errorMsg('table_name'); throw new ErrorCatcher(self::$dbErr); } elseif (!is_array($table)) { $table = array($table); } foreach ($table as $tbl) { self::$table = self::dbprefix($tbl); //--------------------------------- // compiling of the query parameter //--------------------------------- $criterion = self::getCriterion(array('table', 'where', 'or_where', 'where_in', 'or_where_in', 'where_not_in', 'or_where_not_in', 'like', 'or_like', 'not_like', 'or_not_like', 'limit')); // query building self::$query = QR::delete($criterion); // and execute self::execute(); } } catch (ErrorCatcher $e) { $excParm['e'] = $e; echo ErrorCatcher::fire($excParm); } }