Better appending of LIMIT (bug #978930).

This commit is contained in:
Michal Čihař
2004-08-16 15:55:06 +00:00
parent fbd56678f8
commit 8f3c3accec
3 changed files with 8 additions and 14 deletions

View File

@@ -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)

View File

@@ -1706,17 +1706,6 @@ if (typeof(document.getElementById) != 'undefined'
echo ' <b>' . $GLOBALS['strSQLQuery'] . ':</b>&nbsp;';
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 '&nbsp;' . 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

View File

@@ -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