Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Export SQL option for a raw query #15064

Closed
williamdes opened this issue Mar 23, 2019 · 6 comments · Fixed by #15121
Closed

Add Export SQL option for a raw query #15064

williamdes opened this issue Mar 23, 2019 · 6 comments · Fixed by #15121
Assignees
Labels
enhancement A feature request for improving phpMyAdmin has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete help wanted ui Issues relating to the user interface
Projects
Milestone

Comments

@williamdes
Copy link
Member

Describe the bug

Execute

select 1 a union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 union all 
select 1 

Go to export below results
No sql option on export page ..

Similar to #14775

@williamdes williamdes added Bug A problem or regression with an existing feature help wanted ui Issues relating to the user interface labels Mar 23, 2019
@adityasanil
Copy link

adityasanil commented Mar 23, 2019

I face this issue literally everyday and would like to fix this.

@williamdes
Copy link
Member Author

@adityasanil Yes, go ahead, you can open a pull-request if you find how to solve the issue!
I will help you if you need :)

@josemmo
Copy link

josemmo commented Mar 24, 2019

For anyone trying to fix this, the bug seems to be related to the "single_table" parameter.

ExportSql.php will only initialize itself if the following conditions are met:

$hide_sql = false;
$hide_structure = false;
if ($plugin_param['export_type'] == 'table'
&& ! $plugin_param['single_table']
) {
$hide_structure = true;
$hide_sql = true;
}
if (! $hide_sql) {

But "single_table" is never set to true when executing the given query as Query::getAll can't find any tables (see line 4940):

if (($analyzed_sql_results['querytype'] == self::QUERY_TYPE_SELECT)
&& ! isset($printview)
&& empty($analyzed_sql_results['procedure'])
) {
if (count($analyzed_sql_results['select_tables']) == 1) {
$_url_params['single_table'] = 'true';
}


Anyway, the export neither works as expected when choosing other options (e.g. XML) as it incorrectly assumes we're working on the first table of the current database instead of the one from the query.

@amarjitsingh52922
Copy link
Contributor

@williamdes is anyone working on this issue? if not i would like to work on it

@williamdes
Copy link
Member Author

@amarjitsingh52922 You can work on this issue, would be great if you find a fix !

saurass added a commit to saurass/phpmyadmin that referenced this issue Mar 28, 2019
…able is involved in the SQL query

Signed-off-by: Saurabh Srivastava <saurabhsrivastava312@gmail.com>
saurass added a commit to saurass/phpmyadmin that referenced this issue Mar 28, 2019
… for 'free_query' in /Plugins/Export/ExportSql.php

Signed-off-by: Saurabh Srivastava <saurabhsrivastava312@gmail.com>
saurass added a commit to saurass/phpmyadmin that referenced this issue Mar 28, 2019
Signed-off-by: Saurabh Srivastava <saurabhsrivastava312@gmail.com>
saurass added a commit to saurass/phpmyadmin that referenced this issue Mar 28, 2019
… queries using free_query parameter

Signed-off-by: Saurabh Srivastava <saurabhsrivastava312@gmail.com>
saurass added a commit to saurass/phpmyadmin that referenced this issue Mar 28, 2019
…aw query now dumping properly

Signed-off-by: Saurabh Srivastava <saurabhsrivastava312@gmail.com>
@saurass
Copy link
Contributor

saurass commented Mar 28, 2019

@williamdes @ibennetch I have done some work related to this, I am opening a PR here for further help and improvements : )

@MauricioFauth MauricioFauth added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Apr 15, 2019
saurass added a commit to saurass/phpmyadmin that referenced this issue Apr 17, 2019
Signed-off-by: Saurabh Srivastava <saurabhsrivastava312@gmail.com>
@williamdes williamdes added this to ready to merge in issues Apr 29, 2019
@williamdes williamdes self-assigned this Jan 23, 2020
@williamdes williamdes added enhancement A feature request for improving phpMyAdmin and removed Bug A problem or regression with an existing feature labels Jan 27, 2020
@williamdes williamdes changed the title Export SQL option hidden on sql query export results Add Export SQL option for a raw query Jan 27, 2020
williamdes added a commit that referenced this issue Jan 27, 2020
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from ready to merge to Closed Jan 27, 2020
@williamdes williamdes added this to the 5.1.0 milestone Jan 27, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 27, 2021
williamdes added a commit that referenced this issue Dec 13, 2022
… SQL, execute it !

Ref: #15121

all other plugins execute it

Signed-off-by: William Desportes <williamdes@wdes.fr>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement A feature request for improving phpMyAdmin has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete help wanted ui Issues relating to the user interface
Projects
issues
  
Closed
Development

Successfully merging a pull request may close this issue.

6 participants