[phpMyAdmin Developers] SQL parser debugging

Michal Čihař michal at cihar.com
Fri Mar 18 11:39:19 CET 2016


Hi all

to make easier working and debugging the SQL parser, I've added two
simple command line utilities to syntax highlight and lint the query. I
hope you will find them useful :-).

For example the lint:

$ ./bin/lint-query --query 'select (SELECT name FROM mysql.help_category
WHERE help_category_id = 1) as name, case when country = "India" then 1
else 0 end as country_flag FROM ( select "India" as country ) a;'
#1: An alias was expected. (near " " at position 75)
#2: Unrecognized keyword. (near "name" at position 76)
#3: Unexpected token. (near "," at position 80)
#4: Unrecognized keyword. (near "case" at position 82)
#5: Unrecognized keyword. (near "when" at position 87)
#6: Unexpected token. (near "country" at position 92)
#7: Unexpected token. (near "=" at position 100)
#8: Unexpected token. (near ""India"" at position 102)
#9: Unrecognized keyword. (near "then" at position 110)
#10: Unexpected token. (near "1" at position 115)
#11: Unrecognized keyword. (near "else" at position 117)
#12: Unexpected token. (near "0" at position 122)
#13: Unrecognized keyword. (near "end" at position 124)
#14: Unrecognized keyword. (near "as" at position 128)
#15: Unexpected token. (near "country_flag" at position 131)
#16: An expression was expected. (near "(" at position 149)
#17: Unexpected token. (near "(" at position 149)
#18: This type of clause was previously parsed. (near "select" at
position 151)
#19: Unexpected token. (near ")" at position 177)
#20: Unexpected token. (near "a" at position 179)

-- 
	Michal Čihař | http://cihar.com/ | https://weblate.org/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.phpmyadmin.net/pipermail/developers/attachments/20160318/871db531/attachment.sig>


More information about the Developers mailing list