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

Added experimental APIs: sqlite_begin_hook() and sqlite_commit_hook(). (CVS 896)

FossilOrigin-Name: 5efbf62313519d0a6e8b8f5dbb29d3ef428d73e8
This commit is contained in:
drh
2003-04-03 15:46:04 +00:00
parent 048c530c01
commit 0d1a643aea
9 changed files with 351 additions and 26 deletions

View File

@@ -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.210 2003/04/03 01:50:45 drh Exp $
** $Id: vdbe.c,v 1.211 2003/04/03 15:46:04 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -3233,6 +3233,13 @@ case OP_Transaction: {
}
db->aDb[i].inTrans = 1;
p->undoTransOnError = 1;
if( db->xBeginCallback!=0 && i==1 && rc==SQLITE_OK ){
if( sqliteSafetyOff(db) ) goto abort_due_to_misuse;
if( db->xBeginCallback(db->pBeginArg)!=0 ){
rc = SQLITE_CONSTRAINT;
}
if( sqliteSafetyOn(db) ) goto abort_due_to_misuse;
}
break;
}
@@ -3246,6 +3253,14 @@ case OP_Transaction: {
*/
case OP_Commit: {
int i;
if( db->xCommitCallback!=0 ){
if( sqliteSafetyOff(db) ) goto abort_due_to_misuse;
if( db->xCommitCallback(db->pCommitArg)!=0 ){
rc = SQLITE_CONSTRAINT;
}
if( sqliteSafetyOn(db) ) goto abort_due_to_misuse;
if( rc ) break;
}
assert( rc==SQLITE_OK );
for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
if( db->aDb[i].inTrans ){