Wed, 11 Jun 2003 18:47:21 +0200
Peter Bengtsson wrote:
> You're right.
> So, if I don't wrap them like that but do define them as attributes,
> they don't have to reparse them?
> Then I can do this:
> class Mysqlstuff(Aq...):
> _login = SQL('null','dummy title', dbconnection,
> 'name:string pass:string', sqlfile.read())
> def login(self, name, pass):
> ...do other things such as debug...
> return _login(name=name, pass=pass)
> What do you think about that?
I'd guess that this has trouble finding the db connection.
I have had your problem, too, and after a lot of looking around, I found
this (maybe it's the right thing for you).
Since I didn't have a lot of SQL-connections, I didn't do it that way.
My product looks like this:
from Products.ZSQLMethods.SQL import SQLConnectionIDs
wrapped_self = self.__of__(container)
SQLFolder = getattr(self,'SQLFolder')
SQLConnectionID = SQLConnectionIDs(SQLFolder)
insertSQL = """INSERT INTO bla VALUES (<dtml-sqlvar ... ) """
inserSQLArguments = """name:string ..."""
""" refresh all instance SQL_methods"""
This is surely not the most elegant way to do it, but it works. And it
helps in development to be able to edit/test the sql methods directly.