diff options
author | dan <dan@noemail.net> | 2010-08-03 18:29:04 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-08-03 18:29:04 +0000 |
commit | d5e0101be04d7013650b3b5aa6e6b0d30be654b9 (patch) | |
tree | 430c5f872f553c40057b62c67d605bb77f17e25f /src | |
parent | a42c66bdfb009404579af14a7ded35c03f5dab73 (diff) | |
parent | a3e414cd4827402b7d877a9c368a0afdb9fbe637 (diff) | |
download | sqlite-d5e0101be04d7013650b3b5aa6e6b0d30be654b9.tar.gz sqlite-d5e0101be04d7013650b3b5aa6e6b0d30be654b9.zip |
Merge trunk changes into experimental branch.
FossilOrigin-Name: 15368a9f8523d5fb611cd576080daed2cf2f1500
Diffstat (limited to 'src')
-rw-r--r-- | src/btree.c | 23 | ||||
-rw-r--r-- | src/btree.h | 4 | ||||
-rw-r--r-- | src/func.c | 11 | ||||
-rw-r--r-- | src/insert.c | 1 | ||||
-rw-r--r-- | src/main.c | 11 | ||||
-rw-r--r-- | src/pager.c | 2 | ||||
-rw-r--r-- | src/tclsqlite.c | 2 | ||||
-rw-r--r-- | src/update.c | 2 | ||||
-rw-r--r-- | src/vdbeaux.c | 7 | ||||
-rw-r--r-- | src/vdbemem.c | 2 |
10 files changed, 42 insertions, 23 deletions
diff --git a/src/btree.c b/src/btree.c index d07e4c3d6..c03d3c92b 100644 --- a/src/btree.c +++ b/src/btree.c @@ -7848,6 +7848,29 @@ int sqlite3BtreeIsInTrans(Btree *p){ return (p && (p->inTrans==TRANS_WRITE)); } +#ifndef SQLITE_OMIT_WAL +/* +** Run a checkpoint on the Btree passed as the first argument. +** +** Return SQLITE_LOCKED if this or any other connection has an open +** transaction on the shared-cache the argument Btree is connected to. +*/ +int sqlite3BtreeCheckpoint(Btree *p){ + int rc = SQLITE_OK; + if( p ){ + BtShared *pBt = p->pBt; + sqlite3BtreeEnter(p); + if( pBt->inTransaction!=TRANS_NONE ){ + rc = SQLITE_LOCKED; + }else{ + rc = sqlite3PagerCheckpoint(pBt->pPager); + } + sqlite3BtreeLeave(p); + } + return rc; +} +#endif + /* ** Return non-zero if a read (or write) transaction is active. */ diff --git a/src/btree.h b/src/btree.h index 584b46338..c989307aa 100644 --- a/src/btree.h +++ b/src/btree.h @@ -201,6 +201,10 @@ int sqlite3BtreeCursorInfo(BtCursor*, int*, int); void sqlite3BtreeCursorList(Btree*); #endif +#ifndef SQLITE_OMIT_WAL + int sqlite3BtreeCheckpoint(Btree*); +#endif + /* ** If we are not using shared cache, then there is no need to ** use mutexes to access the BtShared structures. So make the diff --git a/src/func.c b/src/func.c index 15d7a5bd6..d46141272 100644 --- a/src/func.c +++ b/src/func.c @@ -788,8 +788,10 @@ static void compileoptionusedFunc( const char *zOptName; assert( argc==1 ); UNUSED_PARAMETER(argc); - /* IMP: R-xxxx This function is an SQL wrapper around the - ** sqlite3_compileoption_used() C interface. */ + /* IMP: R-39564-36305 The sqlite_compileoption_used() SQL + ** function is a wrapper around the sqlite3_compileoption_used() C/C++ + ** function. + */ if( (zOptName = (const char*)sqlite3_value_text(argv[0]))!=0 ){ sqlite3_result_int(context, sqlite3_compileoption_used(zOptName)); } @@ -810,8 +812,9 @@ static void compileoptiongetFunc( int n; assert( argc==1 ); UNUSED_PARAMETER(argc); - /* IMP: R-xxxx This function is an SQL wrapper around the - ** sqlite3_compileoption_get() C interface. */ + /* IMP: R-04922-24076 The sqlite_compileoption_get() SQL function + ** is a wrapper around the sqlite3_compileoption_get() C/C++ function. + */ n = sqlite3_value_int(argv[0]); sqlite3_result_text(context, sqlite3_compileoption_get(n), -1, SQLITE_STATIC); } diff --git a/src/insert.c b/src/insert.c index b8aa91b87..adf6ef2ed 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1220,6 +1220,7 @@ void sqlite3GenerateConstraintChecks( if( onError==OE_Ignore ){ sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest); }else{ + if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */ sqlite3HaltConstraint(pParse, onError, 0, 0); } sqlite3VdbeResolveLabel(v, allOk); diff --git a/src/main.c b/src/main.c index c3828d5d9..b233c8473 100644 --- a/src/main.c +++ b/src/main.c @@ -1308,16 +1308,7 @@ int sqlite3Checkpoint(sqlite3 *db, int iDb){ for(i=0; i<db->nDb && rc==SQLITE_OK; i++){ if( i==iDb || iDb==SQLITE_MAX_ATTACHED ){ - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - if( sqlite3BtreeIsInReadTrans(pBt) ){ - rc = SQLITE_LOCKED; - }else{ - sqlite3BtreeEnter(pBt); - rc = sqlite3PagerCheckpoint(sqlite3BtreePager(pBt)); - sqlite3BtreeLeave(pBt); - } - } + rc = sqlite3BtreeCheckpoint(db->aDb[i].pBt); } } diff --git a/src/pager.c b/src/pager.c index e3f73d953..52065f1f3 100644 --- a/src/pager.c +++ b/src/pager.c @@ -5561,7 +5561,7 @@ int sqlite3PagerCommitPhaseOne( */ rc = syncJournal(pPager, 0); if( rc!=SQLITE_OK ) goto commit_phase_one_exit; - + rc = pager_write_pagelist(pPager,sqlite3PcacheDirtyList(pPager->pPCache)); if( rc!=SQLITE_OK ){ assert( rc!=SQLITE_IOERR_BLOCKED ); diff --git a/src/tclsqlite.c b/src/tclsqlite.c index a2d352c3b..68a44c510 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -2571,7 +2571,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ int v; const char *zOp; if( objc!=3 ){ - Tcl_WrongNumArgs(interp, 2, objv, "(step|sort)"); + Tcl_WrongNumArgs(interp, 2, objv, "(step|sort|autoindex)"); return TCL_ERROR; } zOp = Tcl_GetString(objv[2]); diff --git a/src/update.c b/src/update.c index fe8344ca2..44f047b48 100644 --- a/src/update.c +++ b/src/update.c @@ -8,7 +8,7 @@ ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** -sqlite************************************************************************* +************************************************************************* ** This file contains C code routines that are called by the parser ** to handle UPDATE statements. */ diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 295a8c3a8..7729a85d4 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -2400,11 +2400,8 @@ int sqlite3VdbeCursorMoveto(VdbeCursor *p){ rc = sqlite3BtreeMovetoUnpacked(p->pCursor, 0, p->movetoTarget, 0, &res); if( rc ) return rc; p->lastRowid = p->movetoTarget; - p->rowidIsValid = ALWAYS(res==0) ?1:0; - if( NEVER(res<0) ){ - rc = sqlite3BtreeNext(p->pCursor, &res); - if( rc ) return rc; - } + if( res!=0 ) return SQLITE_CORRUPT_BKPT; + p->rowidIsValid = 1; #ifdef SQLITE_TEST sqlite3_search_count++; #endif diff --git a/src/vdbemem.c b/src/vdbemem.c index 622b617ac..e376a6562 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1016,7 +1016,7 @@ int sqlite3ValueFromExpr( } op = pExpr->op; - /* op can only be TK_REGISTER is we have compiled with SQLITE_ENABLE_STAT2. + /* op can only be TK_REGISTER if we have compiled with SQLITE_ENABLE_STAT2. ** The ifdef here is to enable us to achieve 100% branch test coverage even ** when SQLITE_ENABLE_STAT2 is omitted. */ |