On Thursday 08 March 2007 17:27, Tino Wildenhain wrote:
Gaute Amundsen schrieb:
Hi. <snip> 1 ) First I got a ValueError 'query' when using a very simple zsql method. (consisting of only "<dtml-var sql >")
Thats a very bad idea. Better make zsql methods for every query
I know the orthodoxy :-/ I'd rather have a proper DB library, (or model layer, if you will) and build my SQL in python. To build anything complex or generalized in dtml is a PAIN. And a sea of too specific templates is even worse.
instead of rebuilding your own (obviously not working) templating for SQL.
I's not a template, it's a wrapper to get around the whole mess. A hack in fact ;) If a template this simple "<dtml-var sql >" is "obviously not working" then it is ZSQLMethods that have a problem, not me. (it's working fine now.)
Quoting is done automatically when you use <dtml-sqlvar ...>
I can use sql_quote when I need to, thankyou. The only thing that I worry about is transaction support. "insert foo; select last_inserted" works when built inside the template with dtml, but not with the exact same statement passed to this "wrapper". Probably another bug, but I have not taken time to dig properly into it yet. Gaute