Return raw query in case of error (bug #1048826).

This commit is contained in:
Michal Čihař
2004-10-19 12:59:45 +00:00
parent f09d9c1aef
commit 330e83d6df
2 changed files with 16 additions and 14 deletions

View File

@@ -9,6 +9,8 @@ $Source$
* export.php: Use just \n for SQL exports (bug #1042521). * export.php: Use just \n for SQL exports (bug #1042521).
* libraries/read_dump.lib.php: Set correct return value (bug #1048861). * libraries/read_dump.lib.php: Set correct return value (bug #1048861).
* sql.php: Fix undefined index. * sql.php: Fix undefined index.
* libraries/sqlparser.lib.php: Return raw query in case of error (bug
#1048826).
2004-10-17 Marc Delisle <lem9@users.sourceforge.net> 2004-10-17 Marc Delisle <lem9@users.sourceforge.net>
* lang/turkish update, thanks to boralioglu. * lang/turkish update, thanks to boralioglu.

View File

@@ -1206,7 +1206,7 @@ if ($is_minimum_common == FALSE) {
// ------------------------------------------------------- // -------------------------------------------------------
// This is a big hunk of debugging code by Marc for this. // This is a big hunk of debugging code by Marc for this.
// ------------------------------------------------------- // -------------------------------------------------------
/* /*
if (isset($current_select_expr)) { if (isset($current_select_expr)) {
for ($trace=0; $trace<=$current_select_expr; $trace++) { for ($trace=0; $trace<=$current_select_expr; $trace++) {
echo "<br />"; echo "<br />";
@@ -1226,7 +1226,7 @@ if ($is_minimum_common == FALSE) {
echo "table ref $trace $key => $val<br />\n"; echo "table ref $trace $key => $val<br />\n";
} }
} }
*/ */
// ------------------------------------------------------- // -------------------------------------------------------
@@ -1392,7 +1392,7 @@ if ($is_minimum_common == FALSE) {
// do not add a blank after a function name // do not add a blank after a function name
// TODO: can we combine loop 2 and loop 1? // TODO: can we combine loop 2 and loop 1?
// some code is repeated here... // some code is repeated here...
$sep=' '; $sep=' ';
@@ -1445,7 +1445,7 @@ if ($is_minimum_common == FALSE) {
// FIXME: is it correct to always add $sep ? // FIXME: is it correct to always add $sep ?
if (isset($subresult['queryflags']['select_from']) if (isset($subresult['queryflags']['select_from'])
&& $subresult['queryflags']['select_from'] == 1 && $subresult['queryflags']['select_from'] == 1
&& !$seen_order) { && !$seen_order) {
$unsorted_query .= $arr[$i]['data'] . $sep; $unsorted_query .= $arr[$i]['data'] . $sep;
} }
@@ -1568,14 +1568,14 @@ if ($is_minimum_common == FALSE) {
$foreign[$foreign_key_number]['ref_index_list'][] = $identifier; $foreign[$foreign_key_number]['ref_index_list'][] = $identifier;
} else { } else {
// for MySQL 4.0.18, identifier is // for MySQL 4.0.18, identifier is
// `table` or `db`.`table` // `table` or `db`.`table`
// first pass will pick the db name // first pass will pick the db name
// next pass will execute the else and pick the // next pass will execute the else and pick the
// db name in $db_table[0] // db name in $db_table[0]
if ($arr[$i+1]['type'] == 'punct_qualifier') { if ($arr[$i+1]['type'] == 'punct_qualifier') {
$foreign[$foreign_key_number]['ref_db_name'] = $identifier; $foreign[$foreign_key_number]['ref_db_name'] = $identifier;
} else { } else {
// for MySQL 4.0.16, identifier is // for MySQL 4.0.16, identifier is
// `table` or `db.table` // `table` or `db.table`
$db_table = explode('.',$identifier); $db_table = explode('.',$identifier);
if (isset($db_table[1])) { if (isset($db_table[1])) {
@@ -1584,7 +1584,7 @@ if ($is_minimum_common == FALSE) {
} else { } else {
$foreign[$foreign_key_number]['ref_table_name'] = $db_table[0]; $foreign[$foreign_key_number]['ref_table_name'] = $db_table[0];
} }
} }
} }
} }
} }
@@ -1675,13 +1675,13 @@ if ($is_minimum_common == FALSE) {
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)
{ {
// first check for the SQL parser having hit an error
if (PMA_SQP_isError()) {
return $arr;
}
// then check for an array // then check for an array
if (!is_array($arr)) { if (!is_array($arr)) {
return $arr; return htmlspecialchars($arr);
}
// first check for the SQL parser having hit an error
if (PMA_SQP_isError()) {
return htmlspecialchars($arr['raw']);
} }
// else do it properly // else do it properly
switch ($mode) { switch ($mode) {
@@ -1920,12 +1920,12 @@ if ($is_minimum_common == FALSE) {
// GRANT SELECT ON mydb.mytable TO myuser@localhost // GRANT SELECT ON mydb.mytable TO myuser@localhost
// (else, we get mydb.mytableTO ) // (else, we get mydb.mytableTO )
// //
// the quote_single exception is there to // the quote_single exception is there to
// catch cases like // catch cases like
// GRANT ... TO 'marc'@'domain.com' IDENTIFIED... // GRANT ... TO 'marc'@'domain.com' IDENTIFIED...
// //
// TODO: fix all cases and find why this happens // TODO: fix all cases and find why this happens
if (!$in_priv_list || $typearr[1] == 'alpha_identifier' || $typearr[1] == 'quote_single' || $typearr[1] == 'white_newline') { if (!$in_priv_list || $typearr[1] == 'alpha_identifier' || $typearr[1] == 'quote_single' || $typearr[1] == 'white_newline') {
$before .= $space_alpha_reserved_word; $before .= $space_alpha_reserved_word;
} }