Hi,

The current solution doesn't work for the client/server case.

What about removing the JdbcParseSQLException interface, and extending
JdbcSQLException with getSyntaxErrorPosition? It would return -1 if it's
not a syntax exception, and would return the position if it is.

Internally, JdbcSQLException could detect the position by searching for the
first "[*]" in the "sql" field. I know this wouldn't be a 100% correct
solution, because somebody might type "[*]" in the query for some reason.
But it might be good enough for now. The position could be stored as a
separate field as well, but then the client/server protocol would need to
be changed (which would be slightly more work).

Do you really need the method "getExpectedTokens"? If yes, then
JdbcSQLException could parse the error message and search for "expected:".

Regards,
Thomas


On Wed, Aug 28, 2013 at 8:39 AM, Nicolas Fortin (OrbisGIS) <
nico.de...@gmail.com> wrote:

> Hi,
>
> Yes it seems that it is a better solution, it will work on server mode
> also.
>
> Regards,
>
>
> -Nicolas Fortin
> Atelier SIG
> IRSTV FR CNRS 2488
>
> Le samedi 24 août 2013 21:49:01 UTC+2, Noel Grandin a écrit :
>
>> Maybe we're thinking about this the wrong way. The way the JDBC API
>> and SQL works is not to try and pass around and catch specialised
>> exceptions.
>>
>> Maybe we should be exposing a new SQL command.
>>
>> So the client can do
>>    PARSE <command>
>> and we return either an empty result set in the case of a successful
>> parse, or a result set containing
>>   PARSE_INDEX, EXPECTED_TOKENS, MESSAGE
>>
>  --
> 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 h2-database+unsubscr...@googlegroups.com.
> To post to this group, send email to h2-database@googlegroups.com.
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
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