Sql query validator

Is there any sql query validator on the outside or in any language to check the syntax of the query before executing in the database ?. In my current project, I need to check the sql query in flex before it goes back to the background, it must pass many layers before it gets to the database, and getting into the database and returning with an exception is too expensive. So they need sql validator validation in front of it to at least say that it is a valid query.

+3
source share
2 answers

You can grab the SQL BNF grammar and use the parser generator to confirm the input.

I am sure that you will have to adjust the standard grammar, and this is not trivial. Also, I'm sure you can find something better, but I hope the above takes you somewhere.

+1
source

for SQL analysis at runtime you can see: SQL4J - SQL parser written in Java. http://www.cs.toronto.edu/~jglu/sql4j/index.htm

http://jsqlparser.sourceforge.net/

Perhaps you can use Antlr, it has several SQL grammars. http://www.antlr.org/grammar/list

, , SQL- , SQuirreL SQL Client. http://squirrel-sql.sourceforge.net/

Java- , SmallSQL. http://www.smallsql.de/

Eclipse IDE SQL IDE.

: http://www.eclipse.org/datatools/

+1

Source: https://habr.com/ru/post/1757783/


All Articles