diff --git a/ext/jni/README.md b/ext/jni/README.md index b668d61386..a1a1dadc8b 100644 --- a/ext/jni/README.md +++ b/ext/jni/README.md @@ -202,6 +202,8 @@ int sqlite3_create_function(sqlite3 db, String funcName, int nArgs, int encoding, SQLFunction func); ``` +> Design question: does the encoding argument serve any purpose in JS? + `SQLFunction` is not used directly, but is instead instantiated via one of its three subclasses: diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 52983afb64..cbd0234515 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -1869,8 +1869,13 @@ JDECL(jint,1initialize)(JENV_JSELF){ } /** - Sets jc->currentStmt to the 2nd arugment and returns the previous value - of jc->currentStmt. + Sets jc->currentStmt to the 2nd arugment and returns the previous + value of jc->currentStmt. This must always be called in pairs: once + to replace the current statement with the call-local one, and once + to restore it. It must be used in any stmt-handling routines which + may lead to the tracing callback being called, as the current stmt + is needed for certain tracing flags. At a minumum those ops are: + step, reset, finalize, prepare. */ static jobject stmt_set_current(JNIEnvCacheLine * const jc, jobject jStmt){ jobject const old = jc->currentStmt; @@ -2243,14 +2248,14 @@ JDECL(jint,1shutdown)(JENV_JSELF){ } JDECL(jint,1step)(JENV_JSELF,jobject jStmt){ - jobject jPrevStmt = 0; - JNIEnvCacheLine * const jc = S3Global_env_cache(env); - int rc; + int rc = SQLITE_MISUSE; sqlite3_stmt * const pStmt = PtrGet_sqlite3_stmt(jStmt); - if(!pStmt) return SQLITE_MISUSE; - jPrevStmt = stmt_set_current(jc, jStmt); - rc = sqlite3_step(pStmt); - (void)stmt_set_current(jc, jPrevStmt); + if(pStmt){ + JNIEnvCacheLine * const jc = S3Global_env_cache(env); + jobject const jPrevStmt = stmt_set_current(jc, jStmt); + rc = sqlite3_step(pStmt); + (void)stmt_set_current(jc, jPrevStmt); + } return rc; } diff --git a/manifest b/manifest index 6f789b067f..5d231852be 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\sdocs\sfor\sthe\sJava\sside\sof\sthe\sJNI\sbindings. -D 2023-08-01T10:19:05.727 +C Internal\sdoc\sadditions\sin\sthe\sJNI\sbits. +D 2023-08-02T17:20:52.666 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -231,8 +231,8 @@ F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f4 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 F ext/jni/GNUmakefile 3d1f106e7a08bb54279c12979b31492b3dea702a732eab445dbc765120995182 -F ext/jni/README.md d5cfc3037236dee3efa1c5ce62ddee8ad9d6d43c329a10a491888f272e90edc8 -F ext/jni/src/c/sqlite3-jni.c dc0a2de7249f8e76ba729cd0d6248d373fce63e565611fa0d868837f6fe58a0e +F ext/jni/README.md 6ff7e1f4100dee980434a6ee37a199b653bceec62e233a6e2ccde6e7ae0c58bf +F ext/jni/src/c/sqlite3-jni.c 18be9aa295f90d166499c72a13190878aec260a95be6d5f47981975b3a371ec3 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 @@ -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 057b1d4f6ffff73c120566895f61ea3fd8118968464d67ec9262096a7aa03f39 -R f7f15dd74dc41170d62a8df321c4d11e +P d8e9bcee96b90d56701f7907a8bd48853211caf757e1aa8decc7ed25eece6770 +R 93d701bbf85c406f122f21e563c584fb U stephan -Z e680719e67af1a30c3a9b7bfb130a5b0 +Z 293b70ee8959f9ac1b9bd9db9ccedd82 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 146bf34689..b3978d9f93 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d8e9bcee96b90d56701f7907a8bd48853211caf757e1aa8decc7ed25eece6770 \ No newline at end of file +b56643644e065b03fe2c3545e02ed3b2f6fd9f77c39aa84a02a00d695e9a12dc \ No newline at end of file