Hi,
Is there an opensource library that checks/validates the syntax of an .sql file at runtime?
Thanks in advance!
Connie
Hi,
Is there an opensource library that checks/validates the syntax of an .sql file at runtime?
Thanks in advance!
Connie
As a simple solution you could execute the statement inside of a transaction, and roll it back whether successful or not.
Catch any sql exceptions that arise and pass those on to the user as syntax errors.
As per this question, Mimer SQL Validator can validate your SQL syntax. Note that it only checks your syntax, though - it'll tell you if you've forgotten to quote the data you're inserting, but it can't check if the table you're inserting into exists.