⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqlparser.lib.php

📁 phpMyAdmin图形界面化操作,我已经配置好了,只要把解要压缩后的文件放到站点下就可以用了
💻 PHP
📖 第 1 页 / 共 5 页
字号:
            // Checks for something inside quotation marks            if ($GLOBALS['PMA_strpos']($quote_list, $c) !== false) {                $startquotepos   = $count2;                $quotetype       = $c;                $count2++;                $escaped         = FALSE;                $escaped_escaped = FALSE;                $pos             = $count2;                $oldpos          = 0;                do {                    $oldpos = $pos;                    $pos    = $GLOBALS['PMA_strpos'](' ' . $sql, $quotetype, $oldpos + 1) - 1;                    // ($pos === FALSE)                    if ($pos < 0) {                        $debugstr = $GLOBALS['strSQPBugUnclosedQuote'] . ' @ ' . $startquotepos. "\n"                                  . 'STR: ' . htmlspecialchars($quotetype);                        PMA_SQP_throwError($debugstr, $sql);                        return $sql;                    }                    // If the quote is the first character, it can't be                    // escaped, so don't do the rest of the code                    if ($pos == 0) {                        break;                    }                    // Checks for MySQL escaping using a \                    // And checks for ANSI escaping using the $quotetype character                    if (($pos < $len) && PMA_STR_charIsEscaped($sql, $pos)) {                        $pos ++;                        continue;                    } elseif (($pos + 1 < $len) && ($GLOBALS['PMA_substr']($sql, $pos, 1) == $quotetype) && ($GLOBALS['PMA_substr']($sql, $pos + 1, 1) == $quotetype)) {                        $pos = $pos + 2;                        continue;                    } else {                        break;                    }                } while ($len > $pos); // end do                $count2       = $pos;                $count2++;                $type         = 'quote_';                switch ($quotetype) {                    case '\'':                        $type .= 'single';                        $this_was_quote = true;                        break;                    case '"':                        $type .= 'double';                        $this_was_quote = true;                        break;                    case '`':                        $type .= 'backtick';                        $this_was_quote = true;                        break;                    default:                        break;                } // end switch                $data = $GLOBALS['PMA_substr']($sql, $count1, $count2 - $count1);                PMA_SQP_arrayAdd($sql_array, $type, $data, $arraysize);                continue;            }            // Checks for brackets            if ($GLOBALS['PMA_strpos']($bracket_list, $c) !== false) {                // All bracket tokens are only one item long                $this_was_bracket = true;                $count2++;                $type_type     = '';                if ($GLOBALS['PMA_strpos']('([{', $c) !== false) {                    $type_type = 'open';                } else {                    $type_type = 'close';                }                $type_style     = '';                if ($GLOBALS['PMA_strpos']('()', $c) !== false) {                    $type_style = 'round';                } elseif ($GLOBALS['PMA_strpos']('[]', $c) !== false) {                    $type_style = 'square';                } else {                    $type_style = 'curly';                }                $type = 'punct_bracket_' . $type_type . '_' . $type_style;                PMA_SQP_arrayAdd($sql_array, $type, $c, $arraysize);                continue;            }            /* DEBUG            echo '<pre>1';            var_dump(PMA_STR_isSqlIdentifier($c, false));            var_dump($c == '@');            var_dump($c == '.');            var_dump(PMA_STR_isDigit(PMA_substr($sql, $count2 + 1, 1)));            var_dump($previous_was_space);            var_dump($previous_was_bracket);            var_dump($previous_was_listsep);            echo '</pre>';            */            // Checks for identifier (alpha or numeric)            if (PMA_STR_isSqlIdentifier($c, false)             || $c == '@'             || ($c == '.'              && $GLOBALS['PMA_STR_isDigit']($GLOBALS['PMA_substr']($sql, $count2 + 1, 1))              && ($previous_was_space || $previous_was_bracket || $previous_was_listsep))) {                /* DEBUG                echo PMA_substr($sql, $count2);                echo '<hr />';                */                $count2++;                /**                 * @todo a @ can also be present in expressions like                 * FROM 'user'@'%' or  TO 'user'@'%'                 * in this case, the @ is wrongly marked as alpha_variable                 */                $is_identifier           = $previous_was_punct;                $is_sql_variable         = $c == '@' && ! $previous_was_quote;                $is_user                 = $c == '@' && $previous_was_quote;                $is_digit                = !$is_identifier && !$is_sql_variable && $GLOBALS['PMA_STR_isDigit']($c);                $is_hex_digit            = $is_digit && $c == '0' && $count2 < $len && $GLOBALS['PMA_substr']($sql, $count2, 1) == 'x';                $is_float_digit          = $c == '.';                $is_float_digit_exponent = FALSE;                /* DEBUG                echo '<pre>2';                var_dump($is_identifier);                var_dump($is_sql_variable);                var_dump($is_digit);                var_dump($is_float_digit);                echo '</pre>';                 */                // Nijel: Fast skip is especially needed for huge BLOB data, requires PHP at least 4.3.0:                if ($is_hex_digit) {                    $count2++;                    $pos = strspn($sql, '0123456789abcdefABCDEF', $count2);                    if ($pos > $count2) {                        $count2 = $pos;                    }                    unset($pos);                } elseif ($is_digit) {                    $pos = strspn($sql, '0123456789', $count2);                    if ($pos > $count2) {                        $count2 = $pos;                    }                    unset($pos);                }                while (($count2 < $len) && PMA_STR_isSqlIdentifier($GLOBALS['PMA_substr']($sql, $count2, 1), ($is_sql_variable || $is_digit))) {                    $c2 = $GLOBALS['PMA_substr']($sql, $count2, 1);                    if ($is_sql_variable && ($c2 == '.')) {                        $count2++;                        continue;                    }                    if ($is_digit && (!$is_hex_digit) && ($c2 == '.')) {                        $count2++;                        if (!$is_float_digit) {                            $is_float_digit = TRUE;                            continue;                        } else {                            $debugstr = $GLOBALS['strSQPBugInvalidIdentifer'] . ' @ ' . ($count1+1) . "\n"                                      . 'STR: ' . htmlspecialchars(PMA_substr($sql, $count1, $count2 - $count1));                            PMA_SQP_throwError($debugstr, $sql);                            return $sql;                        }                    }                    if ($is_digit && (!$is_hex_digit) && (($c2 == 'e') || ($c2 == 'E'))) {                        if (!$is_float_digit_exponent) {                            $is_float_digit_exponent = TRUE;                            $is_float_digit          = TRUE;                            $count2++;                            continue;                        } else {                            $is_digit                = FALSE;                            $is_float_digit          = FALSE;                        }                    }                    if (($is_hex_digit && PMA_STR_isHexDigit($c2)) || ($is_digit && $GLOBALS['PMA_STR_isDigit']($c2))) {                        $count2++;                        continue;                    } else {                        $is_digit     = FALSE;                        $is_hex_digit = FALSE;                    }                    $count2++;                } // end while                $l    = $count2 - $count1;                $str  = $GLOBALS['PMA_substr']($sql, $count1, $l);                $type = '';                if ($is_digit || $is_float_digit || $is_hex_digit) {                    $type     = 'digit';                    if ($is_float_digit) {                        $type .= '_float';                    } elseif ($is_hex_digit) {                        $type .= '_hex';                    } else {                        $type .= '_integer';                    }                } elseif ($is_user) {                    $type = 'punct_user';                } elseif ($is_sql_variable != FALSE) {                    $type = 'alpha_variable';                } else {                    $type = 'alpha';                } // end if... else....                PMA_SQP_arrayAdd($sql_array, $type, $str, $arraysize, $count2);                continue;            }            // Checks for punct            if ($GLOBALS['PMA_strpos']($allpunct_list, $c) !== false) {                while (($count2 < $len) && $GLOBALS['PMA_strpos']($allpunct_list, $GLOBALS['PMA_substr']($sql, $count2, 1)) !== false) {                    $count2++;                }                $l = $count2 - $count1;                if ($l == 1) {                    $punct_data = $c;                } else {                    $punct_data = $GLOBALS['PMA_substr']($sql, $count1, $l);                }                // Special case, sometimes, althought two characters are                // adjectent directly, they ACTUALLY need to be seperate                /* DEBUG                echo '<pre>';                var_dump($l);                var_dump($punct_data);                echo '</pre>';                */                if ($l == 1) {                    $t_suffix         = '';                    switch ($punct_data) {                        case $punct_queryend:                            $t_suffix = '_queryend';                            break;                        case $punct_qualifier:                            $t_suffix = '_qualifier';                            $this_was_punct = true;                            break;                        case $punct_listsep:                            $this_was_listsep = true;                            $t_suffix = '_listsep';                            break;                        default:                            break;                    }                    PMA_SQP_arrayAdd($sql_array, 'punct' . $t_suffix, $punct_data, $arraysize);                } elseif (PMA_STR_binarySearchInArr($punct_data, $allpunct_list_pair, $allpunct_list_pair_size)) {                    // Ok, we have one of the valid combined punct expressions                    PMA_SQP_arrayAdd($sql_array, 'punct', $punct_data, $arraysize);                } else {                    // Bad luck, lets split it up more                    $first  = $punct_data[0];                    $first2 = $punct_data[0] . $punct_data[1];                    $last2  = $punct_data[$l - 2] . $punct_data[$l - 1];                    $last   = $punct_data[$l - 1];                    if (($first == ',') || ($first == ';') || ($first == '.') || ($first == '*')) {                        $count2     = $count1 + 1;                        $punct_data = $first;                    } elseif (($last2 == '/*') || (($last2 == '--') && ($count2 == $len || $GLOBALS['PMA_substr']($sql, $count2, 1) <= ' '))) {                        $count2     -= 2;                        $punct_data = $GLOBALS['PMA_substr']($sql, $count1, $count2 - $count1);                    } elseif (($last == '-') || ($last == '+') || ($last == '!')) {                        $count2--;                        $punct_data = $GLOBALS['PMA_substr']($sql, $count1, $count2 - $count1);                    /**                     * @todo for negation operator, split in 2 tokens ?                     * "select x&~1 from t"                     * becomes "select x & ~ 1 from t" ?                     */                    } elseif ($last != '~') {                        $debugstr =  $GLOBALS['strSQPBugUnknownPunctuation'] . ' @ ' . ($count1+1) . "\n"                                  . 'STR: ' . htmlspecialchars($punct_data);                        PMA_SQP_throwError($debugstr, $sql);                        return $sql;                    }                    PMA_SQP_arrayAdd($sql_array, 'punct', $punct_data, $arraysize);                    continue;                } // end if... elseif... else                continue;            }            // DEBUG            $count2++;            $debugstr = 'C1 C2 LEN: ' . $count1 . ' ' . $count2 . ' ' . $len .  "\n"                      . 'STR: ' . $GLOBALS['PMA_substr']($sql, $count1, $count2 - $count1) . "\n";            PMA_SQP_bug($debugstr, $sql);            return $sql;        } // end while ($count2 < $len)        /*        echo '<pre>';        print_r($sql_array);        echo '</pre>';        */        if ($arraysize > 0) {            $t_next           = $sql_array[0]['type'];            $t_prev           = '';            $t_bef_prev       = '';            $t_cur            = '';            $d_next           = $sql_array[0]['data'];            $d_prev           = '';            $d_bef_prev       = '';            $d_cur            = '';            $d_next_upper     = $t_next == 'alpha' ? strtoupper($d_next) : $d_next;            $d_prev_upper     = '';            $d_bef_prev_upper = '';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -