On Thu, 6 Oct 2005, Jens Miltner wrote:

>
>Am 05.10.2005 um 13:17 schrieb Christian Smith:
>
>> On Tue, 4 Oct 2005, Martin Engelschalk wrote:
>>
>>
>>> Hello Christian,
>>>
>>> thank you, but synchronous is already off. What i aim to avoid is
>>> writing the rollback - journal. In order to rollback, some additional
>>> writing to disk is surely unaviodable.
>>>
>>
>>
>> You'll have to write your own pager layer, as there is currently no
>> way to
>> disable the rollback journal.
>>
>
>Hmmh, other issues with not having a journal file aside - pager.c has
>the following code in sqlite3pager_open():
>
>       int useJournal = (flags & PAGER_OMIT_JOURNAL)==0;
>
>Looks like you might be able to switch off the rollback journal by
>passing the proper flags to sqlite3pager_open().
>Does anybody have more details/insight about this?


This is only invoked when opening a transient or virtual table, using the
OpenVirtual VDBE opcode. These are used for sorting and unions in selects
or IN expressions. Such transient data is not required to live across
crashes, transactions or even statements, so no journalling is done.

However, it does offer the ability to simply modify the existing pager.c
to turn off journals unconditionally. The attached (untested) patch should
do that.  Just recompile pager.c with -DSQLITE3_DISABLE_JOURNALLING.


>
></jum>
>

Christian

PS. No, I don't recommend anyone does this, BTW:)

-- 
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \
? patch
Index: src/pager.c
===================================================================
RCS file: /sqlite/sqlite/src/pager.c,v
retrieving revision 1.215
diff -u -r1.215 pager.c
--- src/pager.c 17 Sep 2005 15:20:27 -0000      1.215
+++ src/pager.c 6 Oct 2005 14:48:13 -0000
@@ -1585,7 +1585,19 @@
 ** If zFilename is ":memory:" then all information is held in cache.
 ** It is never written to disk.  This can be used to implement an
 ** in-memory database.
+**
+** <hack type="filthy dirty">
+** Defining the CPP variable SQLITE3_DISABLE_JOURNALLING
+** disables all journalling. This is not part of the original SQLite release.
+** </hack>
 */
+
+#ifdef SQLITE3_DISABLE_JOURNALLING
+static int sqlite3pager_journalling_enabled = 0;
+#else
+static int sqlite3pager_journalling_enabled = 1;
+#endif
+
 int sqlite3pager_open(
   Pager **ppPager,         /* Return the Pager structure here */
   const char *zFilename,   /* Name of the database file to open */
@@ -1601,7 +1613,7 @@
   int tempFile = 0;
   int memDb = 0;
   int readOnly = 0;
-  int useJournal = (flags & PAGER_OMIT_JOURNAL)==0;
+  int useJournal = sqlite3pager_journalling_enabled && (flags & 
PAGER_OMIT_JOURNAL)==0;
   int noReadlock = (flags & PAGER_NO_READLOCK)!=0;
   char zTemp[SQLITE_TEMPNAME_SIZE];
 

Reply via email to