Hi, Could you tell me what problem you want to solve on a higher level? Why do you need to have access to the parse tree? I think you depend too much about implementation details of H2.
Regards, Thomas On Monday, July 30, 2012, Atul wrote: > Also, what I'm really saying is: > > Is there a way to access *org.h2.command.dml.Select* from my > TableEngine implementation through some field/superclass method/ > property of the RegularTable that I extend? Perhaps through "session" > or something else? > > On Jul 29, 10:07 pm, Atul <[email protected] <javascript:;>> wrote: > > Hi - > > > > In order to pre-filter my custom Table ( using "MyTableEngine" and > > "MyTable <extends RegularTable> " ), I need to: > > > > a) determine what the components of the SQL select being fired by the > > client are (including select expressions, condition expressions) > > b) parse this SQL > > c) pre-filter my list of java objects > > d) add the now-filtered object rows to my custom table's ScanIndex > > > > Currently I can do this without any problem by hooking into: > > > > protected LocalResult queryWithoutCache(int maxRows, ResultTarget > > target) > > > > Inside this, I perform a call to getTables() and retrieve any > > TableFilter that's an instanceof MyTable. When it is, I call to a > > utility class method "MyTablePreparer(Expression[] conditions, > > Expression[] selectExpressions, Set<Column> columns, TableFilter > > tableFilter)" > > > > ...where I read through the select columns and ultimately build by own > > Rows (i.e. Value [] data ) using something like: > > MyTable.getScanIndex(session).add(session, row); > > > > However, I'd like to understand if, within the query lifecycle, I can > > utilize any overridable/implementable methods in MyTable (which > > extends RegularTable) which allow me to NOT have to use > > Select.queryWithoutCache(int maxRows, ResultTarget target) to perform > > these same activities. > > > > The closest thing I've found is a fire-before-select but even here I'm > > unable to get a handle on the running query (I tried > > session.getCurrentCommand() but it's mostly empty at the times where > > it's of any use to me inside my RegularTable). > > > > It's really only three lines of code to the H2 codebase that I've > > added for the time being that I'd like to get rid of completely in > > order to not have to modify any part of H2. > > > > Thanks for any help in advance ! > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To post to this group, send email to > [email protected]<javascript:;> > . > To unsubscribe from this group, send email to > [email protected] <javascript:;>. > For more options, visit this group at > http://groups.google.com/group/h2-database?hl=en. > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
