On 05/24/2012 08:15 AM, Adrian Crum wrote: > On 5/20/2012 10:01 AM, Jacques Le Roux wrote: >> Quick questions (seems that there is a lack of internal >> documentation to say the least), there are not only addressed to >> Adam... >> >> About javacc dependency do we really need it *OOTB*? >> Can't we use rather externally maintained ant targets like in >> ant-contrib? For instance pleaser read >> http://markmail.org/message/lidw73cuzyfr6cic >> >> What is framework\sql used for *OOTB*? > > From what I understand, the sql component parses SQL statements into > OFBiz entity conditions, and then executes the statement using the > entity engine. I don't think it is used OOTB for anything, but it > could be useful for integration with third-party libraries that take > SQL statements - like Jasper Reports.
You can also parse *raw* where clauses. == import org.ofbiz.sql.Parser; import org.ofbiz.entity.sql.EntityPlanner; String sqlConditionString = "contactMechId = ?contactMechId"; def sqlPlanner = new EntityPlanner(); def reader = new StringReader(sqlCondition); def sqlCondition = new Parser(reader).EntityCondition(); while (true) { def condition = sqlPlanner.getConditionPlanner().parse(sqlCondition, [contactMechId: '1']); delegator.findList(entityName, condition, ....) } == I suppose I should place some of that in a util class(SQLUtil comes to mind, it was never finished). I support (), and, or, in, between, it's rather complete.