Add another test for JNI-bound scalar UDFs.

FossilOrigin-Name: 8b322d92e247be606f83977767dc361ee4f7bc819122a630bdaa1110177db9b8
This commit is contained in:
stephan 2023-07-31 10:42:05 +00:00
parent e2e696d11f
commit ede8900912
4 changed files with 21 additions and 10 deletions

View File

@ -453,6 +453,7 @@ static void s3jni_call_xDestroy(JNIEnv *env, jobject jObj, jclass klazz){
assert(klazz);
}
method = (*env)->GetMethodID(env, klazz, "xDestroy", "()V");
//MARKER(("jObj=%p, klazz=%p, method=%p\n", jObj, klazz, method));
if(method){
(*env)->CallVoidMethod(env, jObj, method);
IFTHREW{
@ -1090,7 +1091,7 @@ static UDFState * UDFState_alloc(JNIEnv *env, jobject jObj){
static void UDFState_free(UDFState * s){
JNIEnv * const env = s->env;
if(env){
//MARKER(("UDF cleanup...\n"));
//MARKER(("UDF cleanup: %s\n", s->zFuncName));
s3jni_call_xDestroy(env, s->jObj, s->klazz);
UNREF_G(s->jObj);
UNREF_G(s->klazz);
@ -1100,6 +1101,7 @@ static void UDFState_free(UDFState * s){
}
static void UDFState_finalizer(void * s){
//MARKER(("UDF finalizer @ %p\n", s));
if(s) UDFState_free((UDFState*)s);
}

View File

@ -474,7 +474,16 @@ public class Tester1 {
int rc = sqlite3_create_function(db, "myfunc", -1, SQLITE_UTF8, func);
affirm(0 == rc);
affirm(0 == xFuncAccum.value);
execSql(db, "SELECT myfunc(1,2,3)");
final sqlite3_stmt stmt = new sqlite3_stmt();
rc = sqlite3_prepare(db, "SELECT myfunc(1,2,3)", stmt);
affirm( 0==rc );
int n = 0;
while( SQLITE_ROW == sqlite3_step(stmt) ){
affirm( 6 == sqlite3_column_int(stmt, 0) );
++n;
}
sqlite3_finalize(stmt);
affirm(1 == n);
affirm(6 == xFuncAccum.value);
affirm( !xDestroyCalled.value );
sqlite3_close_v2(db);

View File

@ -1,5 +1,5 @@
C Update\ssome\sinternal\sdocs\sfor\sthe\spast\stwo\scheckins.\sAdd\sa\sway\sto\sdump\sout\ssome\sdebug\sinfo\sabout\sthe\scurrent\sJNI\senvironment.
D 2023-07-31T10:22:34.406
C Add\sanother\stest\sfor\sJNI-bound\sscalar\sUDFs.
D 2023-07-31T10:42:05.281
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -232,7 +232,7 @@ F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282
F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8
F ext/jni/GNUmakefile 72a1549aa5ef6fd21b7af58baccd512147d0912ec85963da46c3aa011b6f3450
F ext/jni/README.md c0e6e80935e7761acead89b69c87765b23a6bcb2858c321c3d05681fd338292a
F ext/jni/src/c/sqlite3-jni.c 2dd0c3c6d194f0283233da76ac4b62d877d5bc2bdbbd428d26ff3d481ef93bd7
F ext/jni/src/c/sqlite3-jni.c c06cab707e15221f928b5a791f7b19297cc10bfa20a203d8e8b176ea57705d99
F ext/jni/src/c/sqlite3-jni.h 74aaf87e77f99857aa3afc013517c934cbc2c16618c83d8f5d6294351bc8e7b1
F ext/jni/src/org/sqlite/jni/BusyHandler.java 1b1d3e5c86cd796a0580c81b6af6550ad943baa25e47ada0dcca3aff3ebe978c
F ext/jni/src/org/sqlite/jni/Collation.java 8dffbb00938007ad0967b2ab424d3c908413af1bbd3d212b9c9899910f1218d1
@ -244,7 +244,7 @@ F ext/jni/src/org/sqlite/jni/ProgressHandler.java 5979450e996416d28543f1d42634d3
F ext/jni/src/org/sqlite/jni/RollbackHook.java b04c8abcc6ade44a8a57129e33765793f69df0ba909e49ba18d73f4268d92564
F ext/jni/src/org/sqlite/jni/SQLFunction.java 663a4e479ec65bfbf893586439e12d30b8237898064a22ab64f5658b57315f37
F ext/jni/src/org/sqlite/jni/SQLite3Jni.java dfc1cf977c3c56e2826a7c0f3050b2a9af12a05c2b6cad0a968c7f8d2efa4ced
F ext/jni/src/org/sqlite/jni/Tester1.java 0ef7c15ff5f9bbed4069c46c4f555023f6b280ac57ba71fb463caeaa473a8611
F ext/jni/src/org/sqlite/jni/Tester1.java 2c74f1e2411c717a53c2fde601fe4e4ac199e7a54cd5f3eabe968e13e4944abe
F ext/jni/src/org/sqlite/jni/Tracer.java c2fe1eba4a76581b93b375a7b95ab1919e5ae60accfb06d6beb067b033e9bae1
F ext/jni/src/org/sqlite/jni/UpdateHook.java e58645a1727f8a9bbe72dc072ec5b40d9f9362cb0aa24acfe93f49ff56a9016d
F ext/jni/src/org/sqlite/jni/ValueHolder.java f022873abaabf64f3dd71ab0d6037c6e71cece3b8819fa10bf26a5461dc973ee
@ -2071,8 +2071,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P d9efdc6dd20a34bfdaad5d4bf8e67cce7e35238299eb91e4459d59fda11978a6
R 34310ff83ce4e2977491819bd2bf34a0
P ac9b8bb1e64450d980e2986084996549ae5c59e68c9f0c4c69539c239b64468b
R 952a9335987fe05102caea2cebc40171
U stephan
Z 868da2f09fceab4d77e542bbc096ca63
Z 0e30098b30d6010b9c0a3cea36325cf2
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
ac9b8bb1e64450d980e2986084996549ae5c59e68c9f0c4c69539c239b64468b
8b322d92e247be606f83977767dc361ee4f7bc819122a630bdaa1110177db9b8