1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Add the experimental sqlite3_transaction_hook() API.

FossilOrigin-Name: 093d8cd8e2f3a6af5d40cf810e396f4919eb5cef
This commit is contained in:
dan
2011-03-03 20:05:59 +00:00
parent 46c47d4677
commit 21e8d0126d
11 changed files with 282 additions and 32 deletions

View File

@@ -2568,6 +2568,8 @@ case OP_Savepoint: {
}else{
db->nSavepoint++;
}
sqlite3TransactionHook(db, SQLITE_BEGIN, db->nSavepoint);
/* Link the new savepoint into the database handle's list. */
pNew->pNext = db->pSavepoint;
@@ -2635,6 +2637,13 @@ case OP_Savepoint: {
sqlite3ResetInternalSchema(db, 0);
db->flags = (db->flags | SQLITE_InternChanges);
}
assert( SAVEPOINT_ROLLBACK+1==SQLITE_ROLLBACK );
assert( SAVEPOINT_RELEASE+1==SQLITE_COMMIT );
sqlite3TransactionHook(db, p1+1, iSavepoint+1);
if( p1==SAVEPOINT_ROLLBACK ){
sqlite3TransactionHook(db, SQLITE_BEGIN, iSavepoint+1);
}
}
/* Regardless of whether this is a RELEASE or ROLLBACK, destroy all
@@ -2710,6 +2719,9 @@ case OP_AutoCommit: {
}else if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){
goto vdbe_return;
}else{
if( desiredAutoCommit==0 ){
sqlite3TransactionHook(db, SQLITE_BEGIN, 0);
}
db->autoCommit = (u8)desiredAutoCommit;
if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){
p->pc = pc;
@@ -2796,6 +2808,7 @@ case OP_Transaction: {
p->iStatement = db->nSavepoint + db->nStatement;
}
rc = sqlite3BtreeBeginStmt(pBt, p->iStatement);
sqlite3TransactionHook(db, SQLITE_BEGIN, p->iStatement);
/* Store the current value of the database handles deferred constraint
** counter. If the statement transaction needs to be rolled back,