On Mar 7, 2004, at 10:37 AM, Peter Gebauer wrote:
> Many times I want to use SQLObjects as regular data structures, fill
> them
> with data and manipulate that data, but without having to save the
> data to
> the backend. The best thing would be to have a switch in the SQLObject
> telling it when and when not to be database consious.
>
> Or, maybe a small add-on that will make a non-database conscious
> object of
> an SQLObject and populate an SQLObject from a non-database concsious
> object.
>
> Has anybody written anything like this already?
Luke Opperman was talking about this a while ago, and had experimented
some with a MemoryConnection, which was like a fake database connection
that just kept the values in memory. Then if you add a
copyToConnection method, you could copy from memory to the database
when you were ready.
The complicated part, though, was IDs. It's possible you'd want to
associate other SQLObject instances with these memory objects, but you
wouldn't know what their ultimate ID was going to be.
This is where the transaction stuff and lazy/batch updates in the 0.6
plan come into play (though it might happen after 0.6) -- in that
design, the transaction would keep track of dirty objects and update
them all at once -- or not at all. You'd preallocate IDs, because
you'd already know what your target database was going to be.
--
Ian Bicking | ia...@co... | http://blog.ianbicking.org
|