libraries/sqlparser.lib.php3:
- Fixed ANSI type string escaping - Fixed formatting wrt. whitespace in FormatHTML
This commit is contained in:
@@ -5,6 +5,11 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2002-07-26 Robin Johnson <robbat2@users.sourceforge.net>
|
||||||
|
* libraries/sqlparser.lib.php3:
|
||||||
|
- Fixed ANSI type string escaping
|
||||||
|
- Fixed formatting wrt. whitespace in FormatHTML
|
||||||
|
|
||||||
2002-07-26 Marc Delisle <lem9@users.sourceforge.net>
|
2002-07-26 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* Documentation.html: numbers for faq entries
|
* Documentation.html: numbers for faq entries
|
||||||
|
|
||||||
@@ -16,7 +21,7 @@ $Source$
|
|||||||
* header.inc.php3, lines 155-156: better "fix" against bug
|
* header.inc.php3, lines 155-156: better "fix" against bug
|
||||||
#585094 (Runtime Error on Line 62).
|
#585094 (Runtime Error on Line 62).
|
||||||
|
|
||||||
2002-07-24 Robin Johnson <robbat2@users.sourceforge.net>
|
2002-07-25 Robin Johnson <robbat2@users.sourceforge.net>
|
||||||
* config.inc.php3:
|
* config.inc.php3:
|
||||||
- Fix code to work around CSS bug in Mozilla/Konqueror with 'inherit'
|
- Fix code to work around CSS bug in Mozilla/Konqueror with 'inherit'
|
||||||
value.
|
value.
|
||||||
|
@@ -178,9 +178,14 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for MySQL escaping using a \
|
||||||
|
// And check for ANSI escaping using the $quotetype character
|
||||||
if (PMA_STR_charIsEscaped($sql, $pos) ) {
|
if (PMA_STR_charIsEscaped($sql, $pos) ) {
|
||||||
$pos ++;
|
$pos ++;
|
||||||
continue;
|
continue;
|
||||||
|
} else if (($sql[$pos] == $quotetype) && ($sql[$pos+1] == $quotetype)) {
|
||||||
|
$pos = $pos + 2;
|
||||||
|
continue;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -542,24 +547,41 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
|||||||
$space_punct_listsep_function_name = ' ';
|
$space_punct_listsep_function_name = ' ';
|
||||||
// $space_alpha_reserved_word = '<br />'."\n";
|
// $space_alpha_reserved_word = '<br />'."\n";
|
||||||
$space_alpha_reserved_word = ' ';
|
$space_alpha_reserved_word = ' ';
|
||||||
$keywords_with_brackets = array(
|
|
||||||
|
$keywords_with_brackets_1before = array(
|
||||||
|
'INDEX',
|
||||||
|
'ON',
|
||||||
|
'USING'
|
||||||
|
);
|
||||||
|
$keywords_with_brackets_1before_cnt = 3;
|
||||||
|
|
||||||
|
$keywords_with_brackets_2before = array(
|
||||||
|
'IGNORE',
|
||||||
'INDEX',
|
'INDEX',
|
||||||
'INTO',
|
'INTO',
|
||||||
'KEY',
|
'KEY',
|
||||||
'PRIMARY',
|
'PRIMARY',
|
||||||
'PROCEDURE',
|
'PROCEDURE',
|
||||||
'REFERENCES',
|
'REFERENCES',
|
||||||
'UNIQUE'
|
'UNIQUE',
|
||||||
|
'USE',
|
||||||
);
|
);
|
||||||
// $keywords_with_brackets_cnt = count($keywords_with_brackets);
|
// $keywords_with_brackets_2before_cnt = count($keywords_with_brackets_2before);
|
||||||
$keywords_with_brackets_cnt = 6;
|
$keywords_with_brackets_2before_cnt = 9;
|
||||||
$keywords_for_math = array(
|
|
||||||
|
// These reserved words do NOT get a newline placed near them.
|
||||||
|
$keywords_no_newline = array(
|
||||||
'AND',
|
'AND',
|
||||||
|
'AS',
|
||||||
|
'ASC',
|
||||||
|
'DESC',
|
||||||
|
'IS',
|
||||||
'NOT',
|
'NOT',
|
||||||
'NULL',
|
'NULL',
|
||||||
|
'ON',
|
||||||
'OR'
|
'OR'
|
||||||
);
|
);
|
||||||
$keywords_for_math_cnt = 4;
|
$keywords_no_newline_cnt = 9;
|
||||||
|
|
||||||
$arraysize = $arr['len'];
|
$arraysize = $arr['len'];
|
||||||
$typearr = array();
|
$typearr = array();
|
||||||
@@ -604,7 +626,11 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
|||||||
// Make sure this array is sorted!
|
// Make sure this array is sorted!
|
||||||
if (($typearr[1] == 'alpha_functionName') || ($typearr[1] == 'alpha_columnType') || ($typearr[1] == 'punct')
|
if (($typearr[1] == 'alpha_functionName') || ($typearr[1] == 'alpha_columnType') || ($typearr[1] == 'punct')
|
||||||
|| ($typearr[3] == 'digit_integer') || ($typearr[3] == 'digit_hex') || ($typearr[3] == 'digit_float')
|
|| ($typearr[3] == 'digit_integer') || ($typearr[3] == 'digit_hex') || ($typearr[3] == 'digit_float')
|
||||||
|| (($typearr[0] == 'alpha_reservedWord') && ( PMA_STR_binarySearchInArr(strtoupper($arr[$i - 2]['data']), $keywords_with_brackets, $keywords_with_brackets_cnt)))) {
|
|| (($typearr[0] == 'alpha_reservedWord')
|
||||||
|
&& PMA_STR_binarySearchInArr(strtoupper($arr[$i - 2]['data']), $keywords_with_brackets_2before, $keywords_with_brackets_2before_cnt))
|
||||||
|
|| (($typearr[1] == 'alpha_reservedWord')
|
||||||
|
&& PMA_STR_binarySearchInArr(strtoupper($arr[$i - 1]['data']), $keywords_with_brackets_1before, $keywords_with_brackets_1before_cnt))
|
||||||
|
) {
|
||||||
$functionlevel++;
|
$functionlevel++;
|
||||||
$infunction = TRUE;
|
$infunction = TRUE;
|
||||||
$after .= ' ';
|
$after .= ' ';
|
||||||
@@ -655,6 +681,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
|||||||
if ($infunction == TRUE) {
|
if ($infunction == TRUE) {
|
||||||
$functionlevel--;
|
$functionlevel--;
|
||||||
$after .= ' ';
|
$after .= ' ';
|
||||||
|
$before .= ' ';
|
||||||
} else {
|
} else {
|
||||||
$indent--;
|
$indent--;
|
||||||
$before .= '</div>';
|
$before .= '</div>';
|
||||||
@@ -665,10 +692,17 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
|||||||
if ($typearr[3] == 'alpha_columnAttrib') {
|
if ($typearr[3] == 'alpha_columnAttrib') {
|
||||||
$after .= ' ';
|
$after .= ' ';
|
||||||
}
|
}
|
||||||
|
if ($typearr[1] == 'alpha_columnType') {
|
||||||
|
$before .= ' ';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'alpha_reservedWord':
|
case 'alpha_reservedWord':
|
||||||
$upper = $arr[$i]['data'];
|
$upper = $arr[$i]['data'];
|
||||||
if (($typearr[1] != 'alpha_reservedWord') && ($typearr[1] != 'punct_level_plus') && (!PMA_STR_binarySearchInArr($upper, $keywords_for_math, $keywords_for_math_cnt))) {
|
if ((($typearr[1] != 'alpha_reservedWord')
|
||||||
|
|| (($typearr[1] == 'alpha_reservedWord')
|
||||||
|
&& PMA_STR_binarySearchInArr(strtoupper($arr[$i-1]['data']), $keywords_no_newline, $keywords_no_newline_cnt)))
|
||||||
|
&& ($typearr[1] != 'punct_level_plus')
|
||||||
|
&& (!PMA_STR_binarySearchInArr($upper, $keywords_no_newline, $keywords_no_newline_cnt))) {
|
||||||
$before .= $space_alpha_reserved_word;
|
$before .= $space_alpha_reserved_word;
|
||||||
} else {
|
} else {
|
||||||
$before .= ' ';
|
$before .= ' ';
|
||||||
|
Reference in New Issue
Block a user