Better appending of LIMIT (bug #978930).
This commit is contained in:
@@ -17,6 +17,8 @@ $Source$
|
||||
* read_dump.php: Fix handling of comments -- and # (bug #1009494).
|
||||
* libraries/relation.lib.php: Fix typo, CONVERT is for MySQL >= 4.1 and
|
||||
not for MySQL >= 4.0.
|
||||
* sql.php, libraries/common.lib.php: Better appending of LIMIT (bug
|
||||
#978930).
|
||||
|
||||
2004-08-15 Marc Delisle <lem9@users.sourceforge.net>
|
||||
(Patches from Michael Keck)
|
||||
|
@@ -1706,17 +1706,6 @@ if (typeof(document.getElementById) != 'undefined'
|
||||
echo ' <b>' . $GLOBALS['strSQLQuery'] . ':</b> ';
|
||||
echo '<br />' . "\n";
|
||||
echo ' ' . $query_base;
|
||||
// If a 'LIMIT' clause has been programatically added to the query
|
||||
// displays it
|
||||
if (!empty($GLOBALS['sql_limit_to_append'])) {
|
||||
if (!empty($GLOBALS['show_as_php'])) {
|
||||
echo $GLOBALS['sql_limit_to_append'];
|
||||
} else if (!empty($GLOBALS['validatequery'])) {
|
||||
// skip the extra bit here
|
||||
} else {
|
||||
echo ' ' . PMA_formatSql(PMA_SQP_parse($GLOBALS['sql_limit_to_append'], $GLOBALS['sql_limit_to_append']));
|
||||
}
|
||||
}
|
||||
|
||||
unset($local_query);
|
||||
//Clean up the end of the PHP
|
||||
|
9
sql.php
9
sql.php
@@ -319,6 +319,12 @@ else {
|
||||
} else {
|
||||
$full_sql_query = $sql_query . $sql_limit_to_append;
|
||||
}
|
||||
if (preg_match('@((.|\n)*)(([[:space:]](PROCEDURE[[:space:]](.*)|FOR[[:space:]]+UPDATE|LOCK[[:space:]]+IN[[:space:]]+SHARE[[:space:]]+MODE))|;)[[:space:]]*$@i', $display_query, $regs)) {
|
||||
$display_query = $regs[1] . $sql_limit_to_append . $regs[3];
|
||||
} else {
|
||||
$display_query = $display_query . $sql_limit_to_append;
|
||||
}
|
||||
unset($sql_limit_to_append);
|
||||
} else {
|
||||
$full_sql_query = $sql_query;
|
||||
} // end if...else
|
||||
@@ -666,12 +672,9 @@ else {
|
||||
// Display previous update query (from tbl_replace)
|
||||
if (isset($disp_query) && $cfg['ShowSQL'] == TRUE) {
|
||||
$tmp_sql_query = $GLOBALS['sql_query'];
|
||||
$tmp_sql_limit_to_append = (isset($GLOBALS['sql_limit_to_append'])?$GLOBALS['sql_limit_to_append']:'');
|
||||
$GLOBALS['sql_query'] = $disp_query;
|
||||
$GLOBALS['sql_limit_to_append'] = '';
|
||||
PMA_showMessage($disp_message);
|
||||
$GLOBALS['sql_query'] = $tmp_sql_query;
|
||||
$GLOBALS['sql_limit_to_append'] = $tmp_sql_limit_to_append;
|
||||
}
|
||||
|
||||
// Displays the results in a table
|
||||
|
Reference in New Issue
Block a user