Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Delisle <marc@infomarc.info>2015-10-01 16:49:52 +0300
committerMarc Delisle <marc@infomarc.info>2015-10-01 16:49:52 +0300
commitd951b9d1338a98f8df745aa480f39df6f620151c (patch)
tree715453a9708833d334b09bb1ef6ea7aeac115ed8 /tbl_export.php
parent5890137614fe00a3c3df97264250da72095179e5 (diff)
parent67eb366ce3d6240576c83fb358773f178276de0d (diff)
Merge branch 'QA_4_5'
Diffstat (limited to 'tbl_export.php')
-rw-r--r--tbl_export.php36
1 files changed, 19 insertions, 17 deletions
diff --git a/tbl_export.php b/tbl_export.php
index 6a77bef4e7..bc5b9060c3 100644
--- a/tbl_export.php
+++ b/tbl_export.php
@@ -126,26 +126,9 @@ if (! empty($sql_query)) {
}
}
- // Replacing the aliases in select expressions.
- foreach ($parser->statements[0]->expr as $expr) {
- if ((!empty($expr->table)) && (!empty($aliases[$expr->table]))) {
- // Changing the table to null (leave the MySQL to find the
- // right table).
- // This is possible because exporting selected rows is only
- // allowed for queries involing a single table.
- $expr->table = null;
- $expr->expr = null; // Force rebuild.
- }
- }
-
// Rebuilding the SELECT and FROM clauses.
$replaces = array(
array(
- 'SELECT', 'SELECT ' . SqlParser\Components\ExpressionArray::build(
- $parser->statements[0]->expr
- ),
- ),
- array(
'FROM', 'FROM ' . SqlParser\Components\ExpressionArray::build(
$parser->statements[0]->from
),
@@ -168,6 +151,25 @@ if (! empty($sql_query)) {
$parser->list,
$replaces
);
+
+ // Removing the aliases by finding the alias followed by a dot.
+ $tokens = SqlParser\Lexer::getTokens($sql_query);
+ foreach ($aliases as $alias => $table) {
+ $tokens = SqlParser\Utils\Tokens::replaceTokens(
+ $tokens,
+ array(
+ array(
+ 'value_str' => $alias,
+ ),
+ array(
+ 'type' => SqlParser\Token::TYPE_OPERATOR,
+ 'value_str' => '.',
+ )
+ ),
+ array()
+ );
+ }
+ $sql_query = SqlParser\TokensList::build($tokens);
}
echo PMA_Util::getMessage(PMA_Message::success());