diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sqliteInt.h | 4 | ||||
-rw-r--r-- | src/vdbe.c | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 67d466926..e25145d2a 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.189 2003/05/31 16:21:13 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.190 2003/06/02 23:14:13 drh Exp $ */ #include "config.h" #include "sqlite.h" @@ -241,7 +241,7 @@ struct Db { Hash idxHash; /* All (named) indices indexed by name */ Hash trigHash; /* All triggers indexed by name */ Hash aFKey; /* Foreign keys indexed by to-table */ - u8 inTrans; /* True if a transaction is underway for this backend */ + u8 inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */ u16 flags; /* Flags associated with this database */ }; diff --git a/src/vdbe.c b/src/vdbe.c index 15b66e202..0a66218d8 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -36,7 +36,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.224 2003/06/02 06:15:59 jplyon Exp $ +** $Id: vdbe.c,v 1.225 2003/06/02 23:14:13 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -3168,8 +3168,9 @@ case OP_IncrKey: { */ case OP_Checkpoint: { int i = pOp->p1; - if( i>=0 && i<db->nDb && db->aDb[i].pBt ){ + if( i>=0 && i<db->nDb && db->aDb[i].pBt && db->aDb[i].inTrans==1 ){ rc = sqliteBtreeBeginCkpt(db->aDb[i].pBt); + if( rc==SQLITE_OK ) db->aDb[i].inTrans = 2; } break; } @@ -5826,8 +5827,9 @@ int sqliteVdbeFinalize(Vdbe *p, char **pzErrMsg){ sqliteRollbackInternalChanges(db); } for(i=0; i<db->nDb; i++){ - if( db->aDb[i].pBt ){ + if( db->aDb[i].pBt && db->aDb[i].inTrans==2 ){ sqliteBtreeCommitCkpt(db->aDb[i].pBt); + db->aDb[i].inTrans = 1; } } assert( p->tos<p->pc || sqlite_malloc_failed==1 ); |