is it possible to do SQL Syntax checks with JSqlParser?
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-10-03
I guess yes :-)
I do it like shown in the example.
CCJSqlParserManagerpm=newCCJSqlParserManager();Stringsql="SELECT * FROM cool";try{pm.parse(newStringReader(sql));}catch(JSQLParserExceptione){System.out.println("NOTVALIDSQL:"+e.getMessage());}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
is it possible to do SQL Syntax checks with JSqlParser?
Thanks.
I guess yes :-)
I do it like shown in the example.
I am reading files that have multiple statements in them with comments. I want to verify the SQL syntax in each file.
Example of one file:
Do I have to tokenize/read each statement individually passing them to the CCJSqlParserManager to verify syntax?
Or is there a method to allow a return of Statement[] or List<statement> from a file.</statement>
Having to pre-parse the file before hand looks like what I need to do, but I figured I would ask.
Thanks ahead of time. :-)
Last edit: highnoon 2014-06-24
Okay figured out how to read in file with multiple statements.
then you can iterate over the list.
I ran into a different problem that I will post in separate thread.
Last edit: highnoon 2014-06-24