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

ANSI mode not working, PHP 7 #284

Open
smarek opened this issue Jan 27, 2020 · 7 comments
Open

ANSI mode not working, PHP 7 #284

smarek opened this issue Jan 27, 2020 · 7 comments
Assignees
Labels

Comments

@smarek
Copy link
Contributor

smarek commented Jan 27, 2020

Hi,
while investigating issue phpmyadmin/phpmyadmin#15821 i came to conclusion, that sql-parser does not work correctly in my environment.

I'm using php from sury.org, currently 2:7.4+72+0~20200122.20+debian10~1.gbpcd96c7

Using MySQL server version 8.0.18 with ANSI_QUOTES mode (full list of modes at the end of this comment phpmyadmin/phpmyadmin#15821 (comment) ), yours lint-query fails to parse double-quotes correctly and complains (both table name and field names are escaped by double-quotes in ANSI mode)

#1: A symbol name was expected! (near ""id"" at position 29)
#2: At least one column definition was expected. (near ""id"" at position 29)
#3: Unexpected beginning of statement. (near "11" at position 38)
#4: Unrecognized statement type. (near "NOT NULL" at position 42)

I tried to tweak using ContextMySql80000 and/or ANSI or ANSI_QUOTES modes, but the behavior did not change, with any of my tries.

Test data are also in mentioned comment, the string is taken directly from phpmyadmin result of SHOW CREATE TABLE query executed from configured datasource.
Once I change manually double-quotes to backticks, everything works correctly.

However I've tried tokenzier CLI utility, and the output is the same, for sql query with double-quotes and with backticks (except for Token containing raw value with backticks/doublequotes), Token values, types and flags are correctly the same.

Please let me know, if I can provide you with more debug info for you to test/fix this

@williamdes williamdes added the bug label Jan 27, 2020
@smarek
Copy link
Contributor Author

smarek commented Jan 29, 2020

Also please correct me if I'm wrong, but looking through your tests data, there is no input data in ANSI_QUOTES format, which means you so far supported only serialization but not deserialization ?

@williamdes
Copy link
Member

which means you so far supported only serialization but not deserialization ?

@devenbansod do you know ?

@smarek
Copy link
Contributor Author

smarek commented Mar 5, 2020

@williamdes @devenbansod
I've created solution proposal in #294 , so you might close this issue, if we should continue discussing the problem in mentioned PR

@smarek
Copy link
Contributor Author

smarek commented Mar 6, 2020

I'm closing this ticket in favor of #294 so we don't fragment the discussion

@smarek smarek closed this as completed Mar 6, 2020
@williamdes williamdes self-assigned this Mar 6, 2020
@williamdes williamdes added this to the 4.5.1 milestone Mar 6, 2020
@williamdes williamdes reopened this Mar 20, 2020
@williamdes williamdes changed the title [5.2.0] ANSI mode not working, PHP 7.4.2 ANSI mode not working, PHP 7.4.2 Mar 20, 2020
williamdes added a commit that referenced this issue Mar 20, 2020
Signed-off-by: William Desportes <[email protected]>
@smarek smarek changed the title ANSI mode not working, PHP 7.4.2 ANSI mode not working, PHP 7 Mar 20, 2020
@williamdes
Copy link
Member

@smarek did you see #124 and f06862f

@smarek
Copy link
Contributor Author

smarek commented Mar 20, 2020

@williamdes I did and as I said in #284 (comment) I tried, and tested, and yes, replacing escape character in ANSI mode when building query worked since 2017, but parsing query in ANSI mode apparently not

@williamdes
Copy link
Member

I missed that 👍

@williamdes williamdes reopened this Mar 20, 2020
@williamdes williamdes modified the milestones: 4.7.0, 4.7.1, 4.7.2 Oct 10, 2020
@williamdes williamdes modified the milestones: 4.7.2, 4.7.3 Feb 5, 2021
@williamdes williamdes modified the milestones: 4.7.3, 4.7.4 Dec 11, 2021
@williamdes williamdes removed this from the 4.7.4 milestone Nov 21, 2022
@williamdes williamdes added this to the 5.7.0 milestone Nov 21, 2022
@williamdes williamdes modified the milestones: 5.7.0, 5.8.0 Jan 25, 2023
@williamdes williamdes modified the milestones: 5.8.0, 5.9.0 Jun 5, 2023
@MauricioFauth MauricioFauth removed this from the 5.8.1 milestone Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants