All you need to do is pass the string ":memory:" to sqlite3_openxxx
and it will open a memory-backed database.  That said I think your
first order of business should be to try and define a good abstraction
around the whole thing. While my C++ is a little rusty heres some C#
pseudo code to get you started:
public abstract class DbObject
        // gets /sets the current versionid of this object. set = undo
        protected virtual long VersionID
                set     {...}
        // the 'instanceid' of this object
        protected long ObjectID{get;set;}
        protected object getValue(string propertyName);
        protected void setValue(string propertyName, object value);

On Mon, Aug 18, 2008 at 7:39 PM, Darren Landrum
> Jeffrey Becker wrote:
>> As a solution I suggest you come up
>> with two slightly different schemas one with change-tracking and one
>> without.  The disk file will be saved without change-tracking.  When
>> you load a file, first create a connection to a :memory: database, set
>> up your schema with change tracking, attach your file and pull the
>> data from the file into your main database.  When you save, attach the
>> file again and write the data out to it from main. While it may sound
>> complex, a healthy dose of good object orientation can really help.
> That's what I wanted to do to begin with, but I got challenged on it.
> I saw an article on how to do this in tcl, but I'll have to see if I can
> figure out how to adapt that to C++. I'm assuming that I end up with a
> pointer to the in-memory database when I'm done?
> As for the change tracking, I still haven't decided exactly what I want
> to do concerning that. I think you're probably right, that storing it in
> the file in disk will just bloat the files in the long run. Most of the
> time, we just use undo two or three times to backtrack from a mistake.
> -- Darren
> _______________________________________________
> sqlite-users mailing list
sqlite-users mailing list

Reply via email to