bug 692143 limits and export sql statement
This commit is contained in:
@@ -8,6 +8,9 @@ $Source$
|
|||||||
2003-03-01 Marc Delisle <lem9@users.sourceforge.net>
|
2003-03-01 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* lang/english: typo
|
* lang/english: typo
|
||||||
* tbl_dump.php3: undefined variable $use_comments
|
* tbl_dump.php3: undefined variable $use_comments
|
||||||
|
* tbl_properties_export.php3: bug 692143: now we remove the
|
||||||
|
LIMIT clause from the original query to use the limits entered
|
||||||
|
on the export form
|
||||||
|
|
||||||
2003-03-01 Michal Cihar <nijel@users.sourceforge.net>
|
2003-03-01 Michal Cihar <nijel@users.sourceforge.net>
|
||||||
* tbl_indexes.php3: Cleaner solution for showing query after changing
|
* tbl_indexes.php3: Cleaner solution for showing query after changing
|
||||||
|
@@ -19,6 +19,35 @@ require('./tbl_properties_table_info.php3');
|
|||||||
<?php
|
<?php
|
||||||
if (isset($sql_query)) {
|
if (isset($sql_query)) {
|
||||||
$sql_query = stripslashes($sql_query);
|
$sql_query = stripslashes($sql_query);
|
||||||
|
|
||||||
|
// I don't want the LIMIT clause, so I use the analyzer
|
||||||
|
// to reconstruct the query with only some parts
|
||||||
|
// because the LIMIT clause may come from us (sql.php3, sql_limit_to_append
|
||||||
|
// or may come from the user.
|
||||||
|
// Then, the limits set in the form will be added.
|
||||||
|
// TODO: do we need some other parts here, like PROCEDURE or FOR UPDATE?
|
||||||
|
|
||||||
|
$parsed_sql = PMA_SQP_parse($sql_query);
|
||||||
|
$analyzed_sql = PMA_SQP_analyze($parsed_sql);
|
||||||
|
$sql_query = 'SELECT ' . $analyzed_sql[0]['select_expr_clause'];
|
||||||
|
|
||||||
|
if (!empty($analyzed_sql[0]['from_clause'])) {
|
||||||
|
$sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
|
||||||
|
}
|
||||||
|
if (!empty($analyzed_sql[0]['where_clause'])) {
|
||||||
|
$sql_query .= ' WHERE ' . $analyzed_sql[0]['where_clause'];
|
||||||
|
}
|
||||||
|
if (!empty($analyzed_sql[0]['group_by_clause'])) {
|
||||||
|
$sql_query .= ' GROUP BY ' . $analyzed_sql[0]['group_by_clause'];
|
||||||
|
}
|
||||||
|
if (!empty($analyzed_sql[0]['having_clause'])) {
|
||||||
|
$sql_query .= ' HAVING ' . $analyzed_sql[0]['having_clause'];
|
||||||
|
}
|
||||||
|
if (!empty($analyzed_sql[0]['order_by_clause'])) {
|
||||||
|
$sql_query .= ' ORDER BY ' . $analyzed_sql[0]['order_by_clause'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: can we avoid reparsing the query here?
|
||||||
PMA_showMessage($GLOBALS['strSQLQuery']);
|
PMA_showMessage($GLOBALS['strSQLQuery']);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user