/ Check-in [11c77f4c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Allow the journal_mode for in-memory databases to be either OFF or MEMORY, not just MEMORY. (CVS 6448)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 11c77f4c2c2beee5267ea6e2f1a4bb845531b42c
User & Date: drh 2009-04-04 15:53:48
Context
2009-04-04
16:02
Allow the journal_size_limit to be larger than 2147483647 bytes. (CVS 6449) check-in: 81931259 user: drh tags: trunk
15:53
Allow the journal_mode for in-memory databases to be either OFF or MEMORY, not just MEMORY. (CVS 6448) check-in: 11c77f4c user: drh tags: trunk
14:04
Clarify the meanings of the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags passed into the xSync method of the VFS. Comment changes only - no changes to code. (CVS 6447) check-in: c47aeb37 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

    14     14   ** The pager is used to access a database disk file.  It implements
    15     15   ** atomic commit and rollback through the use of a journal file that
    16     16   ** is separate from the database file.  The pager also implements file
    17     17   ** locking to prevent two processes from writing the same database
    18     18   ** file simultaneously, or one process from reading the database while
    19     19   ** another is writing.
    20     20   **
    21         -** @(#) $Id: pager.c,v 1.576 2009/03/31 02:54:40 drh Exp $
           21  +** @(#) $Id: pager.c,v 1.577 2009/04/04 15:53:48 drh Exp $
    22     22   */
    23     23   #ifndef SQLITE_OMIT_DISKIO
    24     24   #include "sqliteInt.h"
    25     25   
    26     26   /*
    27     27   ** Macros for troubleshooting.  Normally turned off
    28     28   */
................................................................................
  5182   5182   **    PAGER_JOURNALMODE_DELETE
  5183   5183   **    PAGER_JOURNALMODE_TRUNCATE
  5184   5184   **    PAGER_JOURNALMODE_PERSIST
  5185   5185   **    PAGER_JOURNALMODE_OFF
  5186   5186   **    PAGER_JOURNALMODE_MEMORY
  5187   5187   **
  5188   5188   ** If the parameter is not _QUERY, then the journal-mode is set to the
  5189         -** value specified.
         5189  +** value specified.  Except, an in-memory database can only have its
         5190  +** journal mode set to _OFF or _MEMORY.  Attempts to change the journal
         5191  +** mode of an in-memory database to something other than _OFF or _MEMORY
         5192  +** are silently ignored.
  5190   5193   **
  5191   5194   ** The returned indicate the current (possibly updated) journal-mode.
  5192   5195   */
  5193   5196   int sqlite3PagerJournalMode(Pager *pPager, int eMode){
  5194         -  if( !MEMDB ){
  5195         -    assert( eMode==PAGER_JOURNALMODE_QUERY
  5196         -              || eMode==PAGER_JOURNALMODE_DELETE
  5197         -              || eMode==PAGER_JOURNALMODE_TRUNCATE
  5198         -              || eMode==PAGER_JOURNALMODE_PERSIST
  5199         -              || eMode==PAGER_JOURNALMODE_OFF 
  5200         -              || eMode==PAGER_JOURNALMODE_MEMORY );
  5201         -    assert( PAGER_JOURNALMODE_QUERY<0 );
  5202         -    if( eMode>=0 ){
  5203         -      pPager->journalMode = (u8)eMode;
  5204         -    }else{
  5205         -      assert( eMode==PAGER_JOURNALMODE_QUERY );
  5206         -    }
         5197  +  assert( eMode==PAGER_JOURNALMODE_QUERY
         5198  +            || eMode==PAGER_JOURNALMODE_DELETE
         5199  +            || eMode==PAGER_JOURNALMODE_TRUNCATE
         5200  +            || eMode==PAGER_JOURNALMODE_PERSIST
         5201  +            || eMode==PAGER_JOURNALMODE_OFF 
         5202  +            || eMode==PAGER_JOURNALMODE_MEMORY );
         5203  +  assert( PAGER_JOURNALMODE_QUERY<0 );
         5204  +  if( eMode>=0 && (!MEMDB || eMode==PAGER_JOURNALMODE_MEMORY 
         5205  +                          || eMode==PAGER_JOURNALMODE_OFF) ){
         5206  +    pPager->journalMode = (u8)eMode;
  5207   5207     }
  5208   5208     return (int)pPager->journalMode;
  5209   5209   }
  5210   5210   
  5211   5211   /*
  5212   5212   ** Get/set the size-limit used for persistent journal files.
         5213  +**
         5214  +** Setting the size limit to -1 means no limit is enforced.
         5215  +** An attempt to set a limit smaller than -1 is a no-op.
  5213   5216   */
  5214   5217   i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){
  5215   5218     if( iLimit>=-1 ){
  5216   5219       pPager->journalSizeLimit = iLimit;
  5217   5220     }
  5218   5221     return pPager->journalSizeLimit;
  5219   5222   }