Hi, Do you want to do something like the H2 Console autocomplete feature? If yes, then it would be better to use the BNF tool, like the H2 Console does. That way, you can add table names / column names and so on.
Regards, Thomas On Thu, Aug 29, 2013 at 4:44 PM, Nicolas Fortin (OrbisGIS) < nico.de...@gmail.com> wrote: > Hi, > > Yes I need this, as it will feed the console auto-completion. > > > -Nicolas Fortin > Atelier SIG > IRSTV FR CNRS 2488 > > Le jeudi 29 août 2013 16:31:28 UTC+2, Thomas Mueller a écrit : >> >> Hi, >> >> > this is why the Noel's PARSE sql request seems to be a better solution. >> >> I'm not yet convinced this is the best 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. >> >> My question was: do you need it? >> >> You don't need to implement it yourself. This can be implemented in H2 >> itself (I can implement it). Translation is not a problem. >> >> Regards, >> Thomas >> >> >> >> >> On Thu, Aug 29, 2013 at 4:01 PM, Nicolas Fortin (OrbisGIS) < >> nico....@gmail.com> wrote: >> >>> 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) < >>>> nico....@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...@**googlegroups.**com. >>>>> To post to this group, send email to h2-da...@googlegroups.com. >>>>> >>>>> Visit this group at >>>>> http://groups.google.com/**group**/h2-database<http://groups.google.com/group/h2-database> >>>>> . >>>>> For more options, visit >>>>> https://groups.google.com/**grou**ps/opt_out<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...@**googlegroups.com. >>> To post to this group, send email to h2-da...@googlegroups.com. >>> Visit this group at >>> http://groups.google.com/**group/h2-database<http://groups.google.com/group/h2-database> >>> . >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<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. > -- 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.