1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Add the sqlite3_rollback_hook() API. Still requires further testing. (CVS 2823)

FossilOrigin-Name: 3baa3ff32435b64e7ae7646b17a98fef9296aaa0
This commit is contained in:
danielk1977
2005-12-16 06:54:01 +00:00
parent fdd6e85a34
commit 71fd80bf5c
11 changed files with 206 additions and 74 deletions

View File

@@ -1233,17 +1233,27 @@ int sqlite3VdbeHalt(Vdbe *p){
}
}
/* If xFunc is not NULL, then it is one of sqlite3BtreeRollback,
/* If xFunc is not NULL, then it is one of
** sqlite3BtreeRollbackStmt or sqlite3BtreeCommitStmt. Call it once on
** each backend. If an error occurs and the return code is still
** SQLITE_OK, set the return code to the new error value.
*/
for(i=0; xFunc && i<db->nDb; i++){
int rc;
Btree *pBt = db->aDb[i].pBt;
if( pBt ){
rc = xFunc(pBt);
if( p->rc==SQLITE_OK ) p->rc = rc;
assert(!xFunc ||
xFunc==sqlite3BtreeCommitStmt ||
xFunc==sqlite3BtreeRollbackStmt ||
xFunc==sqlite3BtreeRollback
);
if( xFunc==sqlite3BtreeRollback ){
assert( p->rc!=SQLITE_OK );
sqlite3RollbackAll(db);
}else{
for(i=0; xFunc && i<db->nDb; i++){
int rc;
Btree *pBt = db->aDb[i].pBt;
if( pBt ){
rc = xFunc(pBt);
if( p->rc==SQLITE_OK ) p->rc = rc;
}
}
}