diff options
author | drh <drh@noemail.net> | 2019-08-17 00:53:29 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2019-08-17 00:53:29 +0000 |
commit | 217ca657d82f2324d6c5a97598bf4f77ebbb1fe7 (patch) | |
tree | 2d6db295d13828d0624f70b99e6d476e93569f1b /src/tclsqlite.c | |
parent | cc5979dbd384049c1efef847e5cc22082191024b (diff) | |
parent | 42d2fce7f5b5e5776f3e881b4685deae2e0266ff (diff) | |
download | sqlite-217ca657d82f2324d6c5a97598bf4f77ebbb1fe7.tar.gz sqlite-217ca657d82f2324d6c5a97598bf4f77ebbb1fe7.zip |
The SQLITE_DIRECTONLY flag, when added to sqlite3_create_function() prevents
the function from being used inside a trigger or view.
FossilOrigin-Name: de767376987f7668b0770c4920f1532e341b5a27f797d69c0f5e92b87d036170
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r-- | src/tclsqlite.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 8b32bf82d..80a057262 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -2809,10 +2809,16 @@ deserialize_error: } /* - ** $db function NAME [-argcount N] [-deterministic] SCRIPT + ** $db function NAME [OPTIONS] SCRIPT ** ** Create a new SQL function called NAME. Whenever that function is ** called, invoke SCRIPT to evaluate the function. + ** + ** Options: + ** --argcount N Function has exactly N arguments + ** --deterministic The function is pure + ** --directonly Prohibit use inside triggers and views + ** --returntype TYPE Specify the return type of the function */ case DB_FUNCTION: { int flags = SQLITE_UTF8; @@ -2845,6 +2851,9 @@ deserialize_error: if( n>1 && strncmp(z, "-deterministic",n)==0 ){ flags |= SQLITE_DETERMINISTIC; }else + if( n>1 && strncmp(z, "-directonly",n)==0 ){ + flags |= SQLITE_DIRECTONLY; + }else if( n>1 && strncmp(z, "-returntype", n)==0 ){ const char *azType[] = {"integer", "real", "text", "blob", "any", 0}; assert( SQLITE_INTEGER==1 && SQLITE_FLOAT==2 && SQLITE_TEXT==3 ); @@ -2860,7 +2869,8 @@ deserialize_error: eType++; }else{ Tcl_AppendResult(interp, "bad option \"", z, - "\": must be -argcount, -deterministic or -returntype", (char*)0 + "\": must be -argcount, -deterministic, -directonly," + " or -returntype", (char*)0 ); return TCL_ERROR; } |