protected static function _wrapRow($str)
    {
        // match pattern
        $alias_pattern = '/([a-zA-Z0-9_\.]+)\s+(AS|as|As)\s+([a-zA-Z0-9_]+)/';
        $alias_replace = self::_quote('$1').' $2 '.self::_quote('$3');
        $prefix_pattern = '/([a-zA-Z0-9_]+\s*)(\.)(\s*[a-zA-Z0-9_]+)/';
        $prefix_replace = self::_quote('$1').'$2'.self::_quote('$3');
        $func_pattern = '/[a-zA-Z0-9_]+\([a-zA-Z0-9_\,\s\`\'\"\*]*\)/';
        // alias mode
        if (preg_match($alias_pattern, $str, $alias_match)) {
            // if field is aa.bb as cc mode
            if (preg_match($prefix_pattern, $alias_match[1])) {
                $pre_rst = preg_replace($prefix_pattern, $prefix_replace, $alias_match[1]);
                $alias_replace = $pre_rst.' $2 '.self::_quote('$3');
            }
            return preg_replace($alias_pattern, $alias_replace, $str);
        }
        // prefix mode
        if (preg_match($prefix_pattern, $str)) {
            return preg_replace($prefix_pattern, $prefix_replace, $str);
        }
        // func mode (do nothing)
        if (preg_match($func_pattern, $str)) {
            return $str;
        }
        // field mode
        return self::_quote($str);
    }
protected static function _wrapRow($str)
    {
        // match pattern
        $alias_pattern = '/([a-zA-Z0-9_\.]+)\s+(AS|as|As)\s+([a-zA-Z0-9_]+)/';
        $alias_replace = self::_quote('$1').' $2 '.self::_quote('$3');
        $prefix_pattern = '/([a-zA-Z0-9_]+\s*)(\.)(\s*[a-zA-Z0-9_]+)/';
        $prefix_replace = self::_quote('$1').'$2'.self::_quote('$3');
        $func_pattern = '/[a-zA-Z0-9_]+\([a-zA-Z0-9_\,\s\`\'\"\*]*\)/';
        // alias mode
        if (preg_match($alias_pattern, $str, $alias_match)) {
            // if field is aa.bb as cc mode
            if (preg_match($prefix_pattern, $alias_match[1])) {
                $pre_rst = preg_replace($prefix_pattern, $prefix_replace, $alias_match[1]);
                $alias_replace = $pre_rst.' $2 '.self::_quote('$3');
            }
            return preg_replace($alias_pattern, $alias_replace, $str);
        }
        // prefix mode
        if (preg_match($prefix_pattern, $str)) {
            return preg_replace($prefix_pattern, $prefix_replace, $str);
        }
        // func mode (do nothing)
        if (preg_match($func_pattern, $str)) {
            return $str;
        }
        // field mode
        return self::_quote($str);
    }
protected static function _wrapRow ( $ str ) { // match pattern $ alias_pattern = '/([a-zA-Z0-9_\.]+)\s+(AS|as|As)\s+([a-zA-Z0-9_]+)/' ; $ alias_replace = self :: _quote ( '$1' ) . ' $2 ' . self :: _quote ( '$3' ) ; $ prefix_pattern = '/([a-zA-Z0-9_]+\s*)(\.)(\s*[a-zA-Z0-9_]+)/' ; $ prefix_replace = self :: _quote ( '$1' ) . '$2' . self :: _quote ( '$3' ) ; $ func_pattern = '/[a-zA-Z0-9_]+\([a-zA-Z0-9_\,\s\`\'\"\*]*\)/' ; // alias mode if ( preg_match ( $ alias_pattern , $ str , $ alias_match ) ) { // if field is aa.bb as cc mode if ( preg_match ( $ prefix_pattern , $ alias_match [ 1 ] ) ) { $ pre_rst = preg_replace ( $ prefix_pattern , $ prefix_replace , $ alias_match [ 1 ] ) ; $ alias_replace = $ pre_rst . ' $2 ' . self :: _quote ( '$3' ) ; } return preg_replace ( $ alias_pattern , $ alias_replace , $ str ) ; } // prefix mode if ( preg_match ( $ prefix_pattern , $ str ) ) { return preg_replace ( $ prefix_pattern , $ prefix_replace , $ str ) ; } // func mode (do nothing) if ( preg_match ( $ func_pattern , $ str ) ) { return $ str ; } // field mode return self :: _quote ( $ str ) ; }
add backquote sto field, support alias mode, prefix mode, func mode

@param  string $str
@return  string
add backquote sto field support alias mode prefix mode func mode