phpmyadmin / phpmyadmin/sql-parser

ANSI mode not working, PHP 7

Offen
#284 7 Kommentare 1 Reaktion 1 zugewiesene Person Auf GitHub ansehen

@williamdes arbeitet bereits daran.

Seit 06.3.2020.

bug
Vorherrschende Sprache
PHP
Sterne
485
Forks
119
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi,
while investigating issue https://github.com/phpmyadmin/phpmyadmin/issues/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 https://github.com/phpmyadmin/phpmyadmin/issues/15821#issuecomment-578572914 ), 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.