On 2013-08-02 16:59, Nicolas Fortin (OrbisGIS) wrote:
Hi,

I'm currently writing a add-on on RSyntaxText Area in order to underline in red syntax error in sql window, and also to autocomplete sql. In order to do that I was thinking about using H2 explain statements, catch exception and parse it. Parse String message is really crap, then I think about patch h2 in order to store additional information about the syntax error, like the exception class done by Akiban Parser:
http://akiban.github.io/sql-parser/javadoc/com/akiban/sql/parser/ParseException.html

I work on this patch in a separate branch from trunk of H2. More information the August 19.

That sounds like a good idea.

If you declare a sub-class of DbException, you can add the extra info you need.

something like:
   public class DbParseException extends DbException {
       private final int parseIndex;
       private final ArrayList<String> expectedList;
       ....
   }

And then the place to modify is the Parser#getSyntaxError and DbException.getSyntaxError methods to generate and throw this subclass.

Regards, Noel.

--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to