From: Eduardo E. <eel...@na...> - 2004-05-11 20:56:38
|
Oleg and anyone else, I tried Daniel Savard's patch and I can see I could use it to achieve what I want, but creating an unnatural hierarchy. What I would like to have is something like this: def MyOnUpdate (sqlObj): sqlObj.addColumn(StringCol("updateBy", "me"); sqlObj.addColumn(DateTimeCol("updateOn", now()); def MyOnInsert (sqlObj): sqlObj.addColumn(StringCol("createdBy", "me"); sqlObj.addColumn(DateTimeCol("createdOn", now()); MyOnUpdate(sqlObj) def MySQLObject1 (SQLObject): myField = StringCol() onInsert = MyOnInsert(self) onUpdate = MyOnUpdate(self) def MySQLObject2 (SQLObject): myField = IntCol() onInsert = MyOnInsert(self) onUpdate = MyOnUpdate(self) What I need is to find the place to insert the self.onUpdate(self) call. Any suggestion? TIA, Ed. PS: In other words, I need triggers which MySQL (my database backend) does not provide. Eduardo Elgueta wrote: > Oleg, > > Thank you for your answer. > > I'm not sure inheritance is what I need, but I'll certainly give it a > try. Where can I get that patch? > > Ed. > > Oleg Broytmann wrote: > >> On Mon, May 10, 2004 at 05:37:21PM -0400, Eduardo Elgueta wrote: >> >>> I have some basic audit fields in my tables, that I used to update in >>> my rudimentary ORM superclass. >>> >>> I've seen in the FAQ/docs that SQLObject classes are not meant to be >>> subclassed >> >> >> >> There was a Daniel Savard's inheritance patch. I cannot find it on >> the web, but I have patches for SQLObject 0.5.1 and 0.5.2. >> >> Oleg. > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Sleepycat Software > Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to > deliver higher performing products faster, at low TCO. > http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 |