I need to parse out the table names and column names from SQL statements that are entered by my users, as I need to check that the SQL conforms to certain conventions.
One specific use case is in some circumstances they must select a column with an alias of ID and they must select a column with an alias of VALUE. So I expect: SELECT somecol AS ID, someothercol AS VALUE FROM atable WHERE something = somethingelse or alternatively SELECT ID, VALUE FROM atable WHERE something = somethingelse if atable already has ID and VALUE columns. I can do it with regular expressions. I thought it might be more interesting(!) to do it with the H2 parser. That should also have a nice side-effect of proving that the entire statement is sytactically correct too, which would be better than finding out at runtime :-) Is it possible and easy to do that with the H2 parser without having a database connection? If so, can anyone give me any hints or tips about how to proceed? Or am I barking up the wrong tree and should stick with Regex? Cheers, Ian. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.