Hi, The current solution doesn't work for the client/server case. >
It's true, this is why the Noel's PARSE sql request seems to be a better solution. Do you really need the method "getExpectedTokens"? If yes, then > JdbcSQLException could parse the error message and search for "expected:". > I can't as this message can be translated or changed later. -Nicolas Fortin Atelier SIG IRSTV FR CNRS 2488 Le jeudi 29 août 2013 14:34:02 UTC+2, Thomas Mueller a écrit : > > 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) < > [email protected] <javascript:>> 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 [email protected] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> 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 [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.
