Hi Jason, The CmisSqlSimpleWalker has only been lightly tested, I can't say I'm certain it works in all cases. From doing ANTLR work (based on the same tree parser) in Nuxeo I remember that list management was a bit tricky at first. You haven't given an example of query that fails by the way. The simplest way to help fixing this would be for you to provide me with an updated unit test in Chemistry, for instance new query calls in TestSimpleRepository.testBasicQuery. Could you open a JIRA issue with that?
I would like to stress also that the goal of CmisSqlSimpleWalker is not to be efficient, so you shouldn't use it in any production project. Its goal is to be simple to understand so that unit tests can be run with it on small in-memory databases. In particular, it will probably get even slower when I get around to implementing JOIN support in it, as the simplest way to code it will probably be to just do the cross join and walk all possible solutions -- which is expensive but correct. I can't guarantee efficiency without reimplementing a SQL query engine, or bridging to a real one, and that's not the goal of the "simple" implementation. Cheers, Florent On Wed, Dec 2, 2009 at 9:51 PM, Jason Tesser <[email protected]> wrote: > I am trying to use the CmisSimpleWalker in Chemistry to parse my SQL. > It works until I pass 2 conditions within the where clause. > > Here is my code > http://pastebin.com/f6ea1b90e > > It fails in the generated CmisSimpleWalker here on line 1596. > for (boolean_factor_return t : > (List<boolean_factor_return>) list_list) { > > > The reason it is faling is list_list is a CommonTree. This makes no > sense to me as the only things that get added to the list are from > > public static class boolean_factor_return extends TreeRuleReturnScope { > public boolean matches; > CommonTree tree; > public Object getTree() { return tree; } > }; > > And here you can see where the generated code fills the list. Notice > that getTree will always be a CommonTree. > > list=boolean_factor(); > > state._fsp--; > adaptor.addChild(root_1, list.getTree()); > if (list_list==null) list_list=new ArrayList(); > list_list.add(list.getTree()); > > > My question is is the grammer file in Chemistry wrong that generates > this? I wouldn't think this is a bug with ANTLR. I was looking here > at the grammer > http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/antlr3/org/apache/chemistry/impl/simple/CmisSqlSimpleWalker.g?revision=825570&view=markup > > Thanks, > Jason Tesser > dotCMS Lead Development Manager > 1-305-858-1422 > -- Florent Guillaume, Director of R&D, Nuxeo Open Source, Java EE based, Enterprise Content Management (ECM) http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87
