|
From: Ian B. <ia...@co...> - 2003-07-04 18:53:29
|
On Fri, 2003-07-04 at 05:26, Fran=E7ois Girault wrote: > Hi all, >=20 > I've a new need (arg ;) ) : >=20 > I've to minimize network traffic : I want to update an SQLObject (or > better a collection) once I've modified all the attributes. >=20 > I know a design pattern from j2ee/ejb : Data Transfert Object > (www.theserverside.com provides a free book : "ejb design patterns", > which describes DTO on page 47).=20 >=20 > This pattern says : a SQLObj produces a light object that doesn't updat= e > the db each an attribute is set. Once the work with this DTO is done, i= t > would be passed to the SQLObj so the attribute will be updated in the > db. Luke Opperman wrote a temporary memory transaction for SQLObject, though I think he's been too busy since then to continue with it. I believe he called it MemoryTransaction -- anyway, it saved your changes in memory until you explicitly saved them back to the database. I believe this would do what you want. It would be possible to change SQLObject fairly easily to do this as well. There's an attribute _SO_creating, which delays database operations during creation (so that all the values can be inserted at once). Using that, or something analogous, you could probably implement something like delay and save methods. But I think Luke's idea would be more generally useful. Ian |