2 ms·
This is a disaster waiting to happen. Regular expressions should never be used to parse non-regular languages, of which SQL is one. There are a variety of matu
by woodruffw 5y ago
This is a disaster waiting to happen. Regular expressions should never be used to parse non-regular languages, of which SQL is one.
There are a variety of mature MySQL dialect parsers available[1][2], and MySQL should have its own public APIs for transforming a query into an AST. Any of those would be a safer and more correct alternative.
[1]: https://github.com/pingcap/parser https://github.com/pingcap/parser
[2]: https://github.com/square/mysql-parser https://github.com/square/mysql-parser
- anonymousDan 5y agoOut of interest, do you know if there is any similar tool/library for getting a MySQL query plan (either logical or physical) in a serialiable format?
- woodruffw 5y agoNot that I know of, sorry. There’s probably something in the MySQL APIs, but it’ll probably need additional work to get it into a serializable format.
- sk5t 5y agohttps://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags https://stackoverflow.com/questions/1732348/regex-match-open...