Dave Gierok uttered:

Yes, that's exactly what we do: use the in-memory db until it comes time to save, and then we open a file db, attach, and copy it to disk. At that time, the journal files are created.

If there is a nice way to serialize an in-memory db to disk without having to open/attach to a file db, I'm all ears. Anyone know if this is possible?


Look at the source of shell.c. This implements the sqlite3.exe shell, and contains the ".dump" command to serialise a database into SQL CREATE and INSERT commands. Just use similar logic when saving state, then replay the saved file to recreate your memory database. You might also want to compress the resulting file.



Thanks,
Dave

-----Original Message-----
From: Will Leshner [mailto:[EMAIL PROTECTED]
Sent: Monday, January 15, 2007 12:42 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Is there a way to turn off -journal files?

On 1/15/07, Dave Gierok <[EMAIL PROTECTED]> wrote:
I'm building the Sqlite lib using the preprocessor definition TEMP_STORE=3, but 
I still notice that temporary '-journal' files are being created/deleted when 
running queries that will modify the DB.  I thought that the TEMP_STORE=3 was 
supposed to disable these temporary files that get created.

-journal files are an integral part of SQLite's ACID-ity, and as such,
they can't be turned off or otherwise avoided.

How can I build/use Sqlite such that these temporary files do not get created?  
I am running on Xbox360 and perf/storage are critical because the DB can be 
stored to a memory card (not much storage).

I wonder if this might work: keep the database on disk, but when using
it, always use it from an in-memory version. You could open an
in-memory database, attach the on-disk version, and then copy all the
data from the on-disk version to the in-memory version. Hmm.
Unfortunately, I'm not sure how to copy the data back out to the
on-disk version without the -journal file getting created, so maybe
this isn't such a great idea after all. If it were possible to
serialize the in-memory database as save it as a raw binary stream,
then it might work. But I don't think there is a way to do that.

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


--
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to