bug #1239401 table dot numeric field name
This commit is contained in:
@@ -14,6 +14,7 @@ $HeadURL$
|
|||||||
- bug #1667887 HTML maxlength
|
- bug #1667887 HTML maxlength
|
||||||
- bug #1666657 Cookie password delete on timeout / inactivity
|
- bug #1666657 Cookie password delete on timeout / inactivity
|
||||||
- bug #1648802 different mysql library and server version
|
- bug #1648802 different mysql library and server version
|
||||||
|
- bug #1239401 table dot numeric field name
|
||||||
- [gui] avoid displaying a wide selector in server selection
|
- [gui] avoid displaying a wide selector in server selection
|
||||||
+ [core] added PMA_fatalError() and made use of it
|
+ [core] added PMA_fatalError() and made use of it
|
||||||
. [i18n] use generic $strOptions
|
. [i18n] use generic $strOptions
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* $Id$ */
|
/* vim: expandtab sw=4 ts=4 sts=4: */
|
||||||
// vim: expandtab sw=4 ts=4 sts=4:
|
|
||||||
|
|
||||||
/** SQL Parser Functions for phpMyAdmin
|
/** SQL Parser Functions for phpMyAdmin
|
||||||
*
|
*
|
||||||
* Copyright 2002 Robin Johnson <robbat2@users.sourceforge.net>
|
* Copyright 2002 Robin Johnson <robbat2@users.sourceforge.net>
|
||||||
@@ -28,6 +26,8 @@
|
|||||||
* (note that that you need to have syntax.css.php included somehow in your
|
* (note that that you need to have syntax.css.php included somehow in your
|
||||||
* page for it to work, I recommend '<link rel="stylesheet" type="text/css"
|
* page for it to work, I recommend '<link rel="stylesheet" type="text/css"
|
||||||
* href="syntax.css.php" />' at the moment.)
|
* href="syntax.css.php" />' at the moment.)
|
||||||
|
*
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -244,11 +244,30 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
$quote_list = '\'"`';
|
$quote_list = '\'"`';
|
||||||
$arraysize = 0;
|
$arraysize = 0;
|
||||||
|
|
||||||
|
$previous_was_space = false;
|
||||||
|
$this_was_space = false;
|
||||||
|
$previous_was_bracket = false;
|
||||||
|
$this_was_bracket = false;
|
||||||
|
$previous_was_punct = false;
|
||||||
|
$this_was_punct = false;
|
||||||
|
$previous_was_listsep = false;
|
||||||
|
$this_was_listsep = false;
|
||||||
|
|
||||||
while ($count2 < $len) {
|
while ($count2 < $len) {
|
||||||
$c = PMA_substr($sql, $count2, 1);
|
$c = PMA_substr($sql, $count2, 1);
|
||||||
$count1 = $count2;
|
$count1 = $count2;
|
||||||
|
|
||||||
|
$previous_was_space = $this_was_space;
|
||||||
|
$this_was_space = false;
|
||||||
|
$previous_was_bracket = $this_was_bracket;
|
||||||
|
$this_was_bracket = false;
|
||||||
|
$previous_was_punct = $this_was_punct;
|
||||||
|
$this_was_punct = false;
|
||||||
|
$previous_was_listsep = $this_was_listsep;
|
||||||
|
$this_was_listsep = false;
|
||||||
|
|
||||||
if (($c == "\n")) {
|
if (($c == "\n")) {
|
||||||
|
$this_was_space = true;
|
||||||
$count2++;
|
$count2++;
|
||||||
PMA_SQP_arrayAdd($sql_array, 'white_newline', '', $arraysize);
|
PMA_SQP_arrayAdd($sql_array, 'white_newline', '', $arraysize);
|
||||||
continue;
|
continue;
|
||||||
@@ -256,6 +275,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
|
|
||||||
// Checks for white space
|
// Checks for white space
|
||||||
if (PMA_STR_isSpace($c)) {
|
if (PMA_STR_isSpace($c)) {
|
||||||
|
$this_was_space = true;
|
||||||
$count2++;
|
$count2++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -355,6 +375,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
// Checks for brackets
|
// Checks for brackets
|
||||||
if (PMA_STR_strInStr($c, $bracket_list)) {
|
if (PMA_STR_strInStr($c, $bracket_list)) {
|
||||||
// All bracket tokens are only one item long
|
// All bracket tokens are only one item long
|
||||||
|
$this_was_bracket = true;
|
||||||
$count2++;
|
$count2++;
|
||||||
$type_type = '';
|
$type_type = '';
|
||||||
if (PMA_STR_strInStr($c, '([{')) {
|
if (PMA_STR_strInStr($c, '([{')) {
|
||||||
@@ -377,22 +398,53 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
continue;
|
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)
|
// Checks for identifier (alpha or numeric)
|
||||||
if (PMA_STR_isSqlIdentifier($c, FALSE) || ($c == '@') || ($c == '.' && PMA_STR_isDigit(PMA_substr($sql, $count2 + 1, 1)))) {
|
if (PMA_STR_isSqlIdentifier($c, false)
|
||||||
$count2 ++;
|
|| $c == '@'
|
||||||
|
|| ($c == '.'
|
||||||
|
&& PMA_STR_isDigit(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
|
* @todo a @ can also be present in expressions like
|
||||||
* FROM 'user'@'%' or TO 'user'@'%'
|
* FROM 'user'@'%' or TO 'user'@'%'
|
||||||
* in this case, the @ is wrongly marked as alpha_variable
|
* in this case, the @ is wrongly marked as alpha_variable
|
||||||
*/
|
*/
|
||||||
|
$is_identifier = $previous_was_punct;
|
||||||
$is_sql_variable = ($c == '@');
|
$is_sql_variable = $c == '@';
|
||||||
$is_digit = (!$is_sql_variable) && PMA_STR_isDigit($c);
|
$is_digit = !$is_identifier && !$is_sql_variable && PMA_STR_isDigit($c);
|
||||||
$is_hex_digit = ($is_digit) && ($c == '.') && ($c == '0') && ($count2 < $len) && (PMA_substr($sql, $count2, 1) == 'x');
|
$is_hex_digit = $is_digit && $c == '0' && $count2 < $len && PMA_substr($sql, $count2, 1) == 'x';
|
||||||
$is_float_digit = $c == '.';
|
$is_float_digit = $c == '.';
|
||||||
$is_float_digit_exponent = FALSE;
|
$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:
|
// Nijel: Fast skip is especially needed for huge BLOB data, requires PHP at least 4.3.0:
|
||||||
if (PMA_PHP_INT_VERSION >= 40300) {
|
if (PMA_PHP_INT_VERSION >= 40300) {
|
||||||
if ($is_hex_digit) {
|
if ($is_hex_digit) {
|
||||||
@@ -455,7 +507,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
$str = PMA_substr($sql, $count1, $l);
|
$str = PMA_substr($sql, $count1, $l);
|
||||||
|
|
||||||
$type = '';
|
$type = '';
|
||||||
if ($is_digit) {
|
if ($is_digit || $is_float_digit || $is_hex_digit) {
|
||||||
$type = 'digit';
|
$type = 'digit';
|
||||||
if ($is_float_digit) {
|
if ($is_float_digit) {
|
||||||
$type .= '_float';
|
$type .= '_float';
|
||||||
@@ -478,9 +530,9 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
|
|
||||||
// Checks for punct
|
// Checks for punct
|
||||||
if (PMA_STR_strInStr($c, $allpunct_list)) {
|
if (PMA_STR_strInStr($c, $allpunct_list)) {
|
||||||
while (($count2 < $len) && PMA_STR_strInStr(PMA_substr($sql, $count2, 1), $allpunct_list)) {
|
//while (($count2 < $len) && PMA_STR_strInStr(PMA_substr($sql, $count2, 1), $allpunct_list)) {
|
||||||
$count2++;
|
$count2++;
|
||||||
}
|
//}
|
||||||
$l = $count2 - $count1;
|
$l = $count2 - $count1;
|
||||||
if ($l == 1) {
|
if ($l == 1) {
|
||||||
$punct_data = $c;
|
$punct_data = $c;
|
||||||
@@ -490,6 +542,13 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
|
|
||||||
// Special case, sometimes, althought two characters are
|
// Special case, sometimes, althought two characters are
|
||||||
// adjectent directly, they ACTUALLY need to be seperate
|
// adjectent directly, they ACTUALLY need to be seperate
|
||||||
|
/* DEBUG
|
||||||
|
echo '<pre>';
|
||||||
|
var_dump($l);
|
||||||
|
var_dump($punct_data);
|
||||||
|
echo '</pre>';
|
||||||
|
*/
|
||||||
|
|
||||||
if ($l == 1) {
|
if ($l == 1) {
|
||||||
$t_suffix = '';
|
$t_suffix = '';
|
||||||
switch ($punct_data) {
|
switch ($punct_data) {
|
||||||
@@ -498,8 +557,10 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
break;
|
break;
|
||||||
case $punct_qualifier:
|
case $punct_qualifier:
|
||||||
$t_suffix = '_qualifier';
|
$t_suffix = '_qualifier';
|
||||||
|
$this_was_punct = true;
|
||||||
break;
|
break;
|
||||||
case $punct_listsep:
|
case $punct_listsep:
|
||||||
|
$this_was_listsep = true;
|
||||||
$t_suffix = '_listsep';
|
$t_suffix = '_listsep';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user