function matchOperateAndTableName($sql) { preg_match('/^(DELETE|INSERT|REPLACE)\\s+(.+?\\s)?`?(pw_\\w+)`?\\s+/i', $sql, $match); if (!$match) { return array(false, false, false); } list(, $operate, , $tableName) = $match; list($operate, $tableName) = array(strtolower($operate), strtolower($tableName)); if (!ACloud_Sys_Core_S::inArray($tableName, $this->getTables())) { return array(false, false, false); } return array(true, $operate, $tableName); }
function sqlMetadata($data, $tlists = array()) { if (empty($tlists) || !ACloud_Sys_Core_S::inArray($data, $tlists)) { $data = str_replace(array('`', ' '), '', $data); } return ' `' . $data . '` '; }
function format($data, $format, $charset) { $format = ACloud_Sys_Core_S::inArray(strtolower($format), $this->formats) ? strtolower($format) : 'json'; $action = $format . 'Format'; return $this->{$action}($data, $charset); }