Gang, I have lifted some technology from SQLSession. Although it is quite nifty, it has a few disadvantages I'd like to have fixed. SQLSession uses ZSQL-Methods in the following way. Each ZSQL-Method (i.e. SQL-expression) is assigned to a string: _sql_ichi=""" SELECT * FROM ni WHERE ichi = <dtml-sqlvar ichi> """ Each string is used for the instantiation of a ZSQL-Method: self.sqlIchi=SQL('sqlIchi', 'fetch ichis', '' 'ichi:int', _sql_ichi) This code is placed in the __init__ of the instance that will use the ZSQL-methods as methods. There is room for a few improvements. 0.) I don't like the typing overhead. 1.) The ZSQL-methods are not updated automatically 2.) SQLSession provides an UI for editing the ZSQL-methods at runtime, but this makes a mess, since all changes from a debugging-session have to be duplicated in the code after debugging. So: what about a file that declares and names each sql-statement and gets loaded like a DTMLFile? The object instance that is supposed to use the ZSQL-Methods as methods is passed as a parameter. The filename could be pickled and reloaded every time there is a change: SQLFile.SQLFile(myFineInstance, 'dbConn', 'mySQLFile.sqf', reload=1) Anything wrong with this approach? I have not found anything even close to it. I would volunteer for writing it, but maybe I have missed something that makes it problematic or useless. Regards PAGE ______________________________________________________________________ Do you want a free e-mail for life ? Get it at http://www.hotmail.ro/
participants (1)
-
Page Page