From ad759126db7c509c33d36c5de254d6a4e52afd34 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 30 Aug 2009 11:55:58 +0000 Subject: [PATCH] bug #2837722 [export] Run complex SQL then export does not work --- ChangeLog | 1 + libraries/display_tbl.lib.php | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index a4f0b9e251..f0f736bcde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - bug #2823996 [data] Cannot edit row with no PK and a BIT field - bug [export] Exporting results of a query which contains a LIMIT clause inside a subquery +- bug #2837722 [export] Run complex SQL then export does not work 3.2.1.0 (2009-08-09) - bug #2799009 Login with ipv6 IP address breaks redirect diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 136e2cc9c8..8050ffe7dd 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -2125,6 +2125,19 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) { $header_shown = TRUE; } $_url_params['unlim_num_rows'] = $unlim_num_rows; + + /** + * At this point we don't know the table name; this can happen + * for example with a query like + * SELECT bike_code FROM (SELECT bike_code FROM bikes) tmp + * As a workaround we set in the table parameter the name of the + * first table of this database, so that tbl_export.php and + * the script it calls do not fail + */ + if (empty($_url_params['table'])) { + $_url_params['table'] = PMA_DBI_fetch_value("SHOW TABLES"); + } + echo PMA_linkOrButton( 'tbl_export.php' . PMA_generate_common_url($_url_params), PMA_getIcon('b_tblexport.png', $GLOBALS['strExport'], false, true), -- 2.11.4.GIT