Re: Extending the foreach directive

2008-03-11 Thread Jonathan Revusky
Gary Bentley wrote: Hi, I'm the developer of JoSQL (http://josql.sf.net) and I've had a request from a user to extend the foreach directive to include JoSQL processing facilities. Along the lines of: #foreach( $mud in $mudsOnSpecial where $customer.hasPurchased($mud) order by $mud.price)

Re: Extending the foreach directive

2008-03-11 Thread Gary Bentley
Hi Jonathan, The original aim of the request was to allow a JoSQL statement to be used directly within Velocity. More specifically it would be that the WHERE clause, ORDER BY clause and potentially the GROUP BY clause (and as a further extension the LIMIT and GROUP BY ORDER clauses) could be

Re: Extending the foreach directive

2008-03-11 Thread Jonathan Revusky
Gary Bentley wrote: Hi Jonathan, The original aim of the request was to allow a JoSQL statement to be used directly within Velocity. More specifically it would be that the WHERE clause, ORDER BY clause and potentially the GROUP BY clause (and as a further extension the LIMIT and GROUP BY

Re: Extending the foreach directive

2008-01-17 Thread Christopher Schultz
Gary, Gary Bentley wrote: For the bind variables is it possible to use ? as the placeholder like you can for JDBC. Is that what you meant? Yeah, that's what I meant. -chris signature.asc Description: OpenPGP digital signature

Re: Extending the foreach directive

2008-01-17 Thread Nathan Bubna
On Jan 17, 2008 7:34 AM, Christopher Schultz [EMAIL PROTECTED] wrote: Gary, Gary Bentley wrote: Actually, just so I know could you let me know what the life-cycle is for tool objects? Is a new tool object created per request and hence discarded after the request has been made. Or is a

Re: Extending the foreach directive

2008-01-17 Thread Nathan Bubna
Cool. If it doesn't do what you need (like access the velocity context or velocity engine), you can bet one of the other tools probably does. On Jan 16, 2008 10:03 PM, Gary Bentley [EMAIL PROTECTED] wrote: Thanks for that Nathan, I'll probably use the LoopTool as a template, it appears to have

Re: Extending the foreach directive

2008-01-16 Thread Gary Bentley
Hi Chris, For the class name, it's needed because during the parse it uses the class name to resolve method/field accesses. Without it resolution would be needed at execution time. In theory it's not needed but it also allows the query to be parsed into the relevant tree of objects so that

Re: Extending the foreach directive

2008-01-16 Thread Christopher Schultz
Gary, Gary Bentley wrote: For the class name, it's needed because during the parse it uses the class name to resolve method/field accesses. Without it resolution would be needed at execution time. In theory it's not needed but it also allows the query to be parsed into the relevant tree of

Re: Extending the foreach directive

2008-01-16 Thread Nathan Bubna
On Jan 16, 2008 2:27 PM, Christopher Schultz [EMAIL PROTECTED] wrote: Gary, Gary Bentley wrote: For the class name, it's needed because during the parse it uses the class name to resolve method/field accesses. Without it resolution would be needed at execution time. In theory it's not

Re: Extending the foreach directive

2008-01-16 Thread Gary Bentley
Hi Chris, Thanks for the info. For the bind variables is it possible to use ? as the placeholder like you can for JDBC. Is that what you meant? Gary Christopher Schultz wrote: Gary, Gary Bentley wrote: For the class name, it's needed because during the parse it uses the class name to

Re: Extending the foreach directive

2008-01-16 Thread Gary Bentley
Thanks for that Nathan, I'll probably use the LoopTool as a template, it appears to have the items you are talking about. Gary Nathan Bubna wrote: On Jan 16, 2008 2:27 PM, Christopher Schultz [EMAIL PROTECTED] wrote: Gary, Gary Bentley wrote: For the class name, it's needed

Re: Extending the foreach directive

2008-01-16 Thread Gary Bentley
Hi Nathan, Just on the annotation, if I set it as request will that mean that there is 1 JoSQL object per request? For example if a template is processed in a single request that has 2 josql.execute calls (say) will it be the same JoSQL object that is used for both? I just need to know

Re: Extending the foreach directive

2008-01-16 Thread Claude Brisson
Le jeudi 17 janvier 2008 à 17:01 +1000, Gary Bentley a écrit : Hi Nathan, Just on the annotation, if I set it as request will that mean that there is 1 JoSQL object per request? Yes. For example if a template is processed in a single request that has 2 josql.execute calls (say) will it

Re: Extending the foreach directive

2008-01-16 Thread Gary Bentley
Actually, just so I know could you let me know what the life-cycle is for tool objects? Is a new tool object created per request and hence discarded after the request has been made. Or is a pool of objects created and then an object assigned from the pool to each request? I am trying to

Extending the foreach directive

2008-01-15 Thread Gary Bentley
Hi, I'm the developer of JoSQL (http://josql.sf.net) and I've had a request from a user to extend the foreach directive to include JoSQL processing facilities. Along the lines of: #foreach( $mud in $mudsOnSpecial where $customer.hasPurchased($mud) order by $mud.price) tr td

Re: Extending the foreach directive

2008-01-15 Thread Christopher Schultz
Gary, Gary Bentley wrote: Along the lines of: #foreach( $mud in $mudsOnSpecial where $customer.hasPurchased($mud) order by $mud.price) This looks like mixing SQL-ish syntax with Java collections, which is precisely what JoSQL was designed to do. Why extend Velocity when you can simply use

Re: Extending the foreach directive

2008-01-15 Thread Gary Bentley
Nathan/Chris, Many thanks for the responses. They are both very helpful. I think at this point I'll go for Chris's suggestion since that will be easier to implement. There are some differences between the way that JoSQL and Velocity works so there will be limitations but overall I think it