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:
28
src/main.c
28
src/main.c
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user