mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Add the "truncate" journal mode which commits transactions by truncating the
rollback journal file to zero length and not calling fsync(). (CVS 5745) FossilOrigin-Name: 7c561f2e9264de676c1028943f6c3d06542fd802
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*************************************************************************
|
||||
** This file contains code used to implement the PRAGMA command.
|
||||
**
|
||||
** $Id: pragma.c,v 1.187 2008/09/16 14:38:03 danielk1977 Exp $
|
||||
** $Id: pragma.c,v 1.188 2008/09/26 21:08:08 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -449,13 +449,13 @@ void sqlite3Pragma(
|
||||
*/
|
||||
if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){
|
||||
int eMode;
|
||||
static char * const azModeName[] = {"delete", "persist", "off"};
|
||||
static char * const azModeName[] = {"delete", "persist", "off", "truncate"};
|
||||
|
||||
if( zRight==0 ){
|
||||
eMode = PAGER_JOURNALMODE_QUERY;
|
||||
}else{
|
||||
int n = strlen(zRight);
|
||||
eMode = 2;
|
||||
eMode = sizeof(azModeName)/sizeof(azModeName[0]) - 1;
|
||||
while( eMode>=0 && sqlite3StrNICmp(zRight, azModeName[eMode], n)!=0 ){
|
||||
eMode--;
|
||||
}
|
||||
@@ -491,6 +491,7 @@ void sqlite3Pragma(
|
||||
eMode = sqlite3PagerJournalMode(pPager, eMode);
|
||||
}
|
||||
assert( eMode==PAGER_JOURNALMODE_DELETE
|
||||
|| eMode==PAGER_JOURNALMODE_TRUNCATE
|
||||
|| eMode==PAGER_JOURNALMODE_PERSIST
|
||||
|| eMode==PAGER_JOURNALMODE_OFF );
|
||||
sqlite3VdbeSetNumCols(v, 1);
|
||||
|
||||
Reference in New Issue
Block a user