bug #1638267, wrong reserved word recognition
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - ChangeLog
|
|||||||
$Id$
|
$Id$
|
||||||
$HeadURL$
|
$HeadURL$
|
||||||
|
|
||||||
|
2007-01-20 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
|
* libraries/sqlparser.lib.php: bug #1638267, wrong reserved word
|
||||||
|
recognition
|
||||||
|
|
||||||
2007-01-19 Marc Delisle <lem9@users.sourceforge.net>
|
2007-01-19 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* pmd*, lang/*: Designer now supports set/unset of the display field,
|
* pmd*, lang/*: Designer now supports set/unset of the display field,
|
||||||
thanks to Ivan Kirillov
|
thanks to Ivan Kirillov
|
||||||
|
@@ -680,6 +680,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
// operation.
|
// operation.
|
||||||
$sql_array['len'] = $arraysize;
|
$sql_array['len'] = $arraysize;
|
||||||
|
|
||||||
|
// DEBUG echo 'After parsing<pre>'; print_r($sql_array); echo '</pre>';
|
||||||
// Sends the data back
|
// Sends the data back
|
||||||
return $sql_array;
|
return $sql_array;
|
||||||
} // end of the "PMA_SQP_parse()" function
|
} // end of the "PMA_SQP_parse()" function
|
||||||
@@ -917,7 +918,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
// loop #1 for each token: select_expr, table_ref for SELECT
|
// loop #1 for each token: select_expr, table_ref for SELECT
|
||||||
|
|
||||||
for ($i = 0; $i < $size; $i++) {
|
for ($i = 0; $i < $size; $i++) {
|
||||||
//DEBUG echo "trace loop1 <b>" . $arr[$i]['data'] . "</b> (" . $arr[$i]['type'] . ")<br />";
|
//DEBUG echo "Loop1 <b>" . $arr[$i]['data'] . "</b> (" . $arr[$i]['type'] . ")<br />";
|
||||||
|
|
||||||
// High speed seek for locating the end of the current query
|
// High speed seek for locating the end of the current query
|
||||||
if ($seek_queryend == TRUE) {
|
if ($seek_queryend == TRUE) {
|
||||||
@@ -1341,7 +1342,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
$current_identifier = '';
|
$current_identifier = '';
|
||||||
|
|
||||||
for ($i = 0; $i < $size; $i++) {
|
for ($i = 0; $i < $size; $i++) {
|
||||||
//DEBUG echo "trace loop2 <b>" . $arr[$i]['data'] . "</b> (" . $arr[$i]['type'] . ")<br />";
|
//DEBUG echo "Loop2 <b>" . $arr[$i]['data'] . "</b> (" . $arr[$i]['type'] . ")<br />";
|
||||||
|
|
||||||
// need_confirm
|
// need_confirm
|
||||||
//
|
//
|
||||||
@@ -1496,7 +1497,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
} // endif (reservedWord)
|
} // endif (reservedWord)
|
||||||
|
|
||||||
|
|
||||||
// do not add a blank after a function name
|
// do not add a space after a function name
|
||||||
/**
|
/**
|
||||||
* @todo can we combine loop 2 and loop 1? some code is repeated here...
|
* @todo can we combine loop 2 and loop 1? some code is repeated here...
|
||||||
*/
|
*/
|
||||||
@@ -1525,6 +1526,16 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// do not add a space after an identifier if followed by a dot
|
||||||
|
if ($arr[$i]['type'] == 'alpha_identifier' && $i < $size - 1 && $arr[$i + 1]['data'] == '.') {
|
||||||
|
$sep = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// do not add a space after a dot if followed by an identifier
|
||||||
|
if ($arr[$i]['data'] == '.' && $i < $size - 1 && $arr[$i + 1]['type'] == 'alpha_identifier') {
|
||||||
|
$sep = '';
|
||||||
|
}
|
||||||
|
|
||||||
if ($in_select_expr && $upper_data != 'SELECT' && $upper_data != 'DISTINCT') {
|
if ($in_select_expr && $upper_data != 'SELECT' && $upper_data != 'DISTINCT') {
|
||||||
$select_expr_clause .= $arr[$i]['data'] . $sep;
|
$select_expr_clause .= $arr[$i]['data'] . $sep;
|
||||||
}
|
}
|
||||||
@@ -1604,7 +1615,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
$seen_default = FALSE;
|
$seen_default = FALSE;
|
||||||
|
|
||||||
for ($i = 0; $i < $size; $i++) {
|
for ($i = 0; $i < $size; $i++) {
|
||||||
// DEBUG echo "<b>" . $arr[$i]['data'] . "</b> " . $arr[$i]['type'] . "<br />";
|
// DEBUG echo "Loop 3 <b>" . $arr[$i]['data'] . "</b> " . $arr[$i]['type'] . "<br />";
|
||||||
|
|
||||||
if ($arr[$i]['type'] == 'alpha_reservedWord') {
|
if ($arr[$i]['type'] == 'alpha_reservedWord') {
|
||||||
$upper_data = strtoupper($arr[$i]['data']);
|
$upper_data = strtoupper($arr[$i]['data']);
|
||||||
@@ -1900,6 +1911,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
function PMA_SQP_formatHtml($arr, $mode='color', $start_token=0,
|
function PMA_SQP_formatHtml($arr, $mode='color', $start_token=0,
|
||||||
$number_of_tokens=-1)
|
$number_of_tokens=-1)
|
||||||
{
|
{
|
||||||
|
//DEBUG echo 'in Format<pre>'; print_r($arr); echo '</pre>';
|
||||||
// then check for an array
|
// then check for an array
|
||||||
if (!is_array($arr)) {
|
if (!is_array($arr)) {
|
||||||
return htmlspecialchars($arr);
|
return htmlspecialchars($arr);
|
||||||
@@ -1995,7 +2007,7 @@ if ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {
|
|||||||
|
|
||||||
$in_priv_list = FALSE;
|
$in_priv_list = FALSE;
|
||||||
for ($i = $start_token; $i < $arraysize; $i++) {
|
for ($i = $start_token; $i < $arraysize; $i++) {
|
||||||
// DEBUG echo "<b>" . $arr[$i]['data'] . "</b> " . $arr[$i]['type'] . "<br />";
|
// DEBUG echo "Loop format <b>" . $arr[$i]['data'] . "</b> " . $arr[$i]['type'] . "<br />";
|
||||||
$before = '';
|
$before = '';
|
||||||
$after = '';
|
$after = '';
|
||||||
$indent = 0;
|
$indent = 0;
|
||||||
|
Reference in New Issue
Block a user