1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +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

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.119 2003/03/31 00:30:48 drh Exp $
** $Id: main.c,v 1.120 2003/04/03 15:46:04 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -1023,3 +1023,29 @@ void *sqlite_trace(sqlite *db, void (*xTrace)(void*,const char*), void *pArg){
return 0;
#endif
}
/*
** Register functions to be invoked when a transaction is started or when
** a transaction commits. If either function returns non-zero, then the
** corresponding operation aborts with a constraint error.
*/
void *sqlite_begin_hook(
sqlite *db,
int (*xCallback)(void*),
void *pArg
){
void *pOld = db->pBeginArg;
db->xBeginCallback = xCallback;
db->pBeginArg = pArg;
return pOld;
}
void *sqlite_commit_hook(
sqlite *db,
int (*xCallback)(void*),
void *pArg
){
void *pOld = db->pCommitArg;
db->xCommitCallback = xCallback;
db->pCommitArg = pArg;
return pOld;
}