/ 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 Unified Diffs Ignore Whitespace Patch

Changes to src/pager.c.

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
....
5182
5183
5184
5185
5186
5187
5188
5189



5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202

5203
5204
5205
5206
5207
5208
5209
5210
5211
5212



5213
5214
5215
5216
5217
5218
5219
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.576 2009/03/31 02:54:40 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"

/*
** Macros for troubleshooting.  Normally turned off
*/
................................................................................
**    PAGER_JOURNALMODE_DELETE
**    PAGER_JOURNALMODE_TRUNCATE
**    PAGER_JOURNALMODE_PERSIST
**    PAGER_JOURNALMODE_OFF
**    PAGER_JOURNALMODE_MEMORY
**
** If the parameter is not _QUERY, then the journal-mode is set to the
** value specified.



**
** The returned indicate the current (possibly updated) journal-mode.
*/
int sqlite3PagerJournalMode(Pager *pPager, int eMode){
  if( !MEMDB ){
    assert( eMode==PAGER_JOURNALMODE_QUERY
              || eMode==PAGER_JOURNALMODE_DELETE
              || eMode==PAGER_JOURNALMODE_TRUNCATE
              || eMode==PAGER_JOURNALMODE_PERSIST
              || eMode==PAGER_JOURNALMODE_OFF 
              || eMode==PAGER_JOURNALMODE_MEMORY );
    assert( PAGER_JOURNALMODE_QUERY<0 );
    if( eMode>=0 ){

      pPager->journalMode = (u8)eMode;
    }else{
      assert( eMode==PAGER_JOURNALMODE_QUERY );
    }
  }
  return (int)pPager->journalMode;
}

/*
** Get/set the size-limit used for persistent journal files.



*/
i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){
  if( iLimit>=-1 ){
    pPager->journalSizeLimit = iLimit;
  }
  return pPager->journalSizeLimit;
}







|







 







|
>
>
>




<
|
|
|
|
|
|
|
|
>
|
<
<
<






>
>
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
....
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196

5197
5198
5199
5200
5201
5202
5203
5204
5205
5206



5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.577 2009/04/04 15:53:48 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"

/*
** Macros for troubleshooting.  Normally turned off
*/
................................................................................
**    PAGER_JOURNALMODE_DELETE
**    PAGER_JOURNALMODE_TRUNCATE
**    PAGER_JOURNALMODE_PERSIST
**    PAGER_JOURNALMODE_OFF
**    PAGER_JOURNALMODE_MEMORY
**
** If the parameter is not _QUERY, then the journal-mode is set to the
** value specified.  Except, an in-memory database can only have its
** journal mode set to _OFF or _MEMORY.  Attempts to change the journal
** mode of an in-memory database to something other than _OFF or _MEMORY
** are silently ignored.
**
** The returned indicate the current (possibly updated) journal-mode.
*/
int sqlite3PagerJournalMode(Pager *pPager, int eMode){

  assert( eMode==PAGER_JOURNALMODE_QUERY
            || eMode==PAGER_JOURNALMODE_DELETE
            || eMode==PAGER_JOURNALMODE_TRUNCATE
            || eMode==PAGER_JOURNALMODE_PERSIST
            || eMode==PAGER_JOURNALMODE_OFF 
            || eMode==PAGER_JOURNALMODE_MEMORY );
  assert( PAGER_JOURNALMODE_QUERY<0 );
  if( eMode>=0 && (!MEMDB || eMode==PAGER_JOURNALMODE_MEMORY 
                          || eMode==PAGER_JOURNALMODE_OFF) ){
    pPager->journalMode = (u8)eMode;



  }
  return (int)pPager->journalMode;
}

/*
** Get/set the size-limit used for persistent journal files.
**
** Setting the size limit to -1 means no limit is enforced.
** An attempt to set a limit smaller than -1 is a no-op.
*/
i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){
  if( iLimit>=-1 ){
    pPager->journalSizeLimit = iLimit;
  }
  return pPager->journalSizeLimit;
}