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

Add API function sqlite3_preupdate_depth(), for determining the depth of the trigger stack from within a pre-update callback.

FossilOrigin-Name: bdea70895c2c686a4dd3f4bf0a475fd1501d9551
This commit is contained in:
dan
2011-03-22 18:45:29 +00:00
parent 245b49b203
commit 1e7a2d4315
6 changed files with 152 additions and 12 deletions

View File

@@ -2851,9 +2851,9 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
** $db preupdate_hook old INDEX
*/
case DB_PREUPDATE: {
static const char *azSub[] = {"count", "hook", "new", "old", 0};
static const char *azSub[] = {"count", "depth", "hook", "new", "old", 0};
enum DbPreupdateSubCmd {
PRE_COUNT, PRE_HOOK, PRE_NEW, PRE_OLD
PRE_COUNT, PRE_DEPTH, PRE_HOOK, PRE_NEW, PRE_OLD
};
int iSub;
@@ -2880,6 +2880,17 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
break;
}
case PRE_DEPTH: {
Tcl_Obj *pRet;
if( objc!=3 ){
Tcl_WrongNumArgs(interp, 3, objv, "");
return TCL_ERROR;
}
pRet = Tcl_NewIntObj(sqlite3_preupdate_depth(pDb->db));
Tcl_SetObjResult(interp, pRet);
break;
}
case PRE_NEW:
case PRE_OLD: {
int iIdx;