bug 760648 export SELECT DISTINCT results

This commit is contained in:
Marc Delisle
2003-06-26 01:05:03 +00:00
parent fdbe23351c
commit cd8b6fcc7c
3 changed files with 13 additions and 1 deletions

View File

@@ -7,6 +7,8 @@ $Source$
2003-06-25 Marc Delisle <lem9@users.sourceforge.net>
* scripts/create-release.sh: typo, bzip should be bzip2
* libraries/sqlparser.lib.php3, tbl_properties_export.php3:
bug 760648 export SELECT DISTINCT results
2003-06-25 Michal Cihar <nijel@users.sourceforge.net>
* libraries/sqlparser.lib.php3: Fixed XSS problem.

View File

@@ -711,6 +711,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
*
* ['queryflags']['need_confirm'] = 1; if the query needs confirmation
* ['queryflags']['select_from'] = 1; if this is a real SELECT...FROM
* ['queryflags']['distinct'] = 1; for a DISTINCT
*
* lem9: query clauses
* -------------
@@ -1213,6 +1214,9 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
$in_select_expr = TRUE;
$select_expr_clause = '';
}
if ($upper_data == 'DISTINCT') {
$subresult['queryflags']['distinct'] = 1;
}
// if this is a real SELECT...FROM
if ($upper_data == 'FROM' && isset($subresult['queryflags']['select_from']) && $subresult['queryflags']['select_from'] == 1) {

View File

@@ -27,7 +27,13 @@ if (isset($sql_query)) {
$parsed_sql = PMA_SQP_parse($sql_query);
$analyzed_sql = PMA_SQP_analyze($parsed_sql);
$sql_query = 'SELECT ' . $analyzed_sql[0]['select_expr_clause'];
$sql_query = 'SELECT ';
if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
$sql_query .= ' DISTINCT ';
}
$sql_query .= $analyzed_sql[0]['select_expr_clause'];
if (!empty($analyzed_sql[0]['from_clause'])) {
$sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];