Hi,

Here the h2 branch where exception info is added:

https://github.com/nicolas-f/h2database/tree/feature/exception-info

If this is a Parse exception then an implementation of the 
SQLParseException interface is thrown to the caller.

It works only on embedded mode.

This version of H2 is used by RSyntaxArea SQL parser and auto complete 
library (work in progress):
https://github.com/nicolas-f/orbisgis/tree/orbisgis-h2/bundles/sqlconsole-parser

Regards,

-Nicolas Fortin
Atelier SIG
IRSTV FR CNRS 2488

Le vendredi 2 août 2013 17:08:44 UTC+2, Noel Grandin a écrit :
>
>
> 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