A
A
Anton Shamanov2020-03-09 19:54:47
PHP
Anton Shamanov, 2020-03-09 19:54:47

Is there any simple sql validator/linter?

Task: to determine with minimal checks that the string is a sql query (then the class that replaces variables with placeholders comes into play, after deleting comments and formatting - https://github.com/jdorn/sql-formatter/blob/master... , but that's another song. So far, https://github.com/marcocesarato/PHP-Light-SQL-Par... has the championship , but maybe someone saw a simpler option.
Preferably in php, but if inside the regular expression, then at least on the brainfuck.
Ps but not so much easier to check by the first word in a line))
I got a project with a bunch of shit code where everything needs to be changed. but you can’t change anything - 300 files and I’m too lazy to edit manually, I added the rest of the fixers, it’s up to requests) I also practice with PHP tokenizer ..

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AUser0, 2020-03-09
@AUser0

I immediately remembered PhpMyAdmin with its parser right in the browser JS,
and now it’s necessary, there is a library on GitHub ...

M
mayton2019, 2020-03-09
@mayton2019

In fact, you need to decompose 300 files into 2 piles. SQL and non-SQL right?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question