RE: [sqlite] Is there a way to turn off -journal files?

2007-01-16 Thread Christian Smith

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]
-



RE: [sqlite] Is there a way to turn off -journal files?

2007-01-16 Thread Dave Gierok
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?

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]
-



Re: [sqlite] Is there a way to turn off -journal files?

2007-01-15 Thread Will Leshner

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]
-



RE: [sqlite] Is there a way to turn off -journal files?

2007-01-15 Thread Tom Briggs

   The short answer is that you can not (as far as I'm aware, anyway)
turn of journal files, though it's a common question and I'm sure you
can find a lot of information about it by searching the archives.

   TEMP_STORE controls where "truly" temp files (e.g. those needed for
sorting, and I believe for tables declared as temporary) are stored.
Journal files are not really temporary - they need to persist if the
process should die in order for recovery to be performed.  They also
need to be stored in a predictable location, again so that changes can
be consistently recovered in the case of a crash, so they are always
stored in the same directory as the database itself.  Thus TEMP_STORE
has no impact on their creation or location.

   -Tom

> -Original Message-
> From: Dave Gierok [mailto:[EMAIL PROTECTED] 
> Sent: Monday, January 15, 2007 11:23 AM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] Is there a way to turn off -journal files?
> 
> 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.
> 
> 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).
> 
> Thanks,
> Dave Gierok
> 

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