Hi Jay, Thanks for the reply. By looking at the code in demovfs:
http://www.sqlite.org/src/doc/trunk/src/test_demovfs.c It seems that by adapting "demovfs" to use a growing buffer (the *aBuffer field), I do not even need to use the backup stuff: I can just use this adapted "memory" database and pass the pointer to *aBuffer to save db content. The use case is a VST audio plugin that should provide a data blob for plugin parameters save/restore operations. I am guaranteed by the VST specs that there is no code executed in the plugin until the host has finished copying the buffer data. Gaspard Bucher ------------ founder, coder teti sàrl (http://teti.ch) On Tuesday, 13 November 2012 at 18:16, Jay A. Kreibich wrote: > On Tue, Nov 13, 2012 at 06:08:17PM +0100, Gaspard Bucher scratched on the > wall: > > Hi there ! > > > > I am trying to figure out how to dump an in-memory database to some data > > pointer and back (from a void*data chunk to in-memory). The simplest > > solution I can figure out right now is: > > > > A. save to void*data > > 1. backup to file > > 2. read file ==> void*data > > 3. remove file > > > > B. load from void*data > > 1. write to file > > 2. open from file > > 3. backup to memory > > 4. remove file > > > > Is there anything simpler that avoids the temp files ? > > Not simpler, but cleaner... write a VFS plugin that reads/writes to a > memory block. Use the backup API to go straight in and out of that, > rather then a file. > > -j > > -- > Jay A. Kreibich < J A Y @ K R E I B I.C H > > > "Intelligence is like underwear: it is important that you have it, > but showing it to the wrong people has the tendency to make them > feel uncomfortable." -- Angela Johnson > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org (mailto:sqlite-users@sqlite.org) > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users