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

Parser error shown with multiple statements in query box #18511

Closed
M393 opened this issue Jun 23, 2023 · 5 comments
Closed

Parser error shown with multiple statements in query box #18511

M393 opened this issue Jun 23, 2023 · 5 comments
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete parser
Milestone

Comments

@M393
Copy link
Contributor

M393 commented Jun 23, 2023

Describe the bug

An error is shown when multiple SQL statements are entered in the query box.

To Reproduce

Steps to reproduce the behavior:

  1. Go to the query box
  2. Input
SELECT 1; SELECT 1; 
  1. See error

Expected behavior

No error shown.

Screenshots

image

Server configuration

  • phpMyAdmin version: 5.2 and 6.0
@williamdes williamdes added Bug A problem or regression with an existing feature affects/5.2 This issue or pull-request affects 5.2.x releases (and maybe further versions) affects/6.0 This issue or pull-request affects 6.0.x releases (and maybe further versions) labels Jun 23, 2023
@williamdes
Copy link
Member

Thanks, I can confirm this on the current 5.2-dev version

@williamdes williamdes added parser confirmed/5.2 This issue is confirmed to be reproduced on 5.2 at the time this label was set confirmed/6.0 This issue is confirmed to be reproduced on 6.0 at the time this label was set labels Jun 23, 2023
@Ekott2006
Copy link

Can I work on this issue?

@williamdes
Copy link
Member

Can I work on this issue?

For sure, please use QA_5_2 as a base branch for yours. And feel free to ask stupid questions, this can be a complicated subject involving changes on the sql-parser repository

@MoonE
Copy link
Contributor

MoonE commented Apr 21, 2024

The problem is here in line 59:

if (! empty($params['options'])) {
$options = $params['options'];
if (! empty($options['routineEditor'])) {
$sqlQuery = 'CREATE PROCEDURE `a`() ' . $sqlQuery;
} elseif (! empty($options['triggerEditor'])) {
$sqlQuery = 'CREATE TRIGGER `a` AFTER INSERT ON `b` FOR EACH ROW ' . $sqlQuery;
} elseif (! empty($options['eventEditor'])) {
$sqlQuery = 'CREATE EVENT `a` ON SCHEDULE EVERY MINUTE DO ' . $sqlQuery;
}
}
echo json_encode(Linter::lint("DELIMITER $$\n" . $sqlQuery . "$$\nDELIMITER ;\n"));

Always setting the delimiter here doesn't seem right. I guess this should only be done if editing routines/triggers/events.

@williamdes
Copy link
Member

Again that delimiter 🙄
This last line seems like my fix..
Could you try to fix it?

@williamdes williamdes self-assigned this Apr 28, 2024
@williamdes williamdes added has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete and removed affects/5.2 This issue or pull-request affects 5.2.x releases (and maybe further versions) affects/6.0 This issue or pull-request affects 6.0.x releases (and maybe further versions) confirmed/5.2 This issue is confirmed to be reproduced on 5.2 at the time this label was set confirmed/6.0 This issue is confirmed to be reproduced on 6.0 at the time this label was set labels Apr 28, 2024
@williamdes williamdes added this to the 5.2.2 milestone Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete parser
Projects
None yet
Development

No branches or pull requests

4 participants