#define JBA_TOC(ARG) (*env)->GetByteArrayElements(env,ARG, NULL)
#define JBA_RELEASE(ARG,VAR) if(VAR) (*env)->ReleaseByteArrayElements(env, ARG, VAR, JNI_ABORT)
-/* Marker for code which needs(?) to be made thread-safe. */
+/* Marker for code which needs(?) to be made thread-safe. REASON is a
+ terse reminder about why that function requires a mutex.
+*/
#define FIXME_THREADING(REASON)
enum {
EXCEPTION_IS_FATAL("Cannot set OutputPointer.Int32.value");
}
+/* Sets the value property of the OutputPointer.Int64 jOut object
+ to v. */
+static void OutputPointer_set_Int64(JNIEnv * const env, jobject const jOut, jlong v){
+ jfieldID setter = 0;
+ setupOutputPointer(env, S3JniClassNames.OutputPointer_Int64, "J", jOut, &setter);
+ (*env)->SetLongField(env, jOut, setter, v);
+ EXCEPTION_IS_FATAL("Cannot set OutputPointer.Int64.value");
+}
+
static void OutputPointer_set_sqlite3(JNIEnv * const env, jobject const jOut,
jobject jDb){
jfieldID setter = 0;
}
#ifdef SQLITE_ENABLE_FTS5
-/* Sets the value property of the OutputPointer.Int64 jOut object
- to v. */
-static void OutputPointer_set_Int64(JNIEnv * const env, jobject const jOut, jlong v){
- jfieldID setter = 0;
- setupOutputPointer(env, S3JniClassNames.OutputPointer_Int64, "J", jOut, &setter);
- (*env)->SetLongField(env, jOut, setter, v);
- EXCEPTION_IS_FATAL("Cannot set OutputPointer.Int64.value");
-}
#if 0
/* Sets the value property of the OutputPointer.ByteArray jOut object
to v. */
(sqlite3_int64)rowId);
}
+FIXME_THREADING(nphCache)
+JDECL(jint,1status)(JENV_CSELF, jint op, jobject jOutCurrent, jobject jOutHigh,
+ jboolean reset ){
+ int iCur = 0, iHigh = 0;
+ int rc = sqlite3_status( op, &iCur, &iHigh, reset );
+ if( 0==rc ){
+ OutputPointer_set_Int32(env, jOutCurrent, iCur);
+ OutputPointer_set_Int32(env, jOutHigh, iHigh);
+ }
+ return (jint)rc;
+}
+
+FIXME_THREADING(nphCache)
+JDECL(jint,1status64)(JENV_CSELF, jint op, jobject jOutCurrent, jobject jOutHigh,
+ jboolean reset ){
+ sqlite3_int64 iCur = 0, iHigh = 0;
+ int rc = sqlite3_status64( op, &iCur, &iHigh, reset );
+ if( 0==rc ){
+ OutputPointer_set_Int64(env, jOutCurrent, iCur);
+ OutputPointer_set_Int64(env, jOutHigh, iHigh);
+ }
+ return (jint)rc;
+}
+
static int s3jni_strlike_glob(int isLike, JNIEnv *const env,
jbyteArray baG, jbyteArray baT, jint escLike){
int rc = 0;
JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1text64
(JNIEnv *, jclass, jobject, jbyteArray, jlong, jint);
+/*
+ * Class: org_sqlite_jni_SQLite3Jni
+ * Method: sqlite3_status
+ * Signature: (ILorg/sqlite/jni/OutputPointer/Int32;Lorg/sqlite/jni/OutputPointer/Int32;Z)I
+ */
+JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1status
+ (JNIEnv *, jclass, jint, jobject, jobject, jboolean);
+
+/*
+ * Class: org_sqlite_jni_SQLite3Jni
+ * Method: sqlite3_status64
+ * Signature: (ILorg/sqlite/jni/OutputPointer/Int64;Lorg/sqlite/jni/OutputPointer/Int64;Z)I
+ */
+JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1status64
+ (JNIEnv *, jclass, jint, jobject, jobject, jboolean);
+
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_rollback_hook
);
- // public static synchronized native int sqlite3_status(
- // int op, OutputPointer.Int32 pCurrent, OutputPointer.Int32 pHighwater,
- // boolean reset
- // );
- // public static synchronized native int sqlite3_status64(
- // int op, OutputPointer.Int64 pCurrent, OutputPointer.Int64 pHighwater,
- // boolean reset
- // );
+ public static synchronized native int sqlite3_status(
+ int op, @NotNull OutputPointer.Int32 pCurrent,
+ @NotNull OutputPointer.Int32 pHighwater, boolean reset
+ );
+
+ public static synchronized native int sqlite3_status64(
+ int op, @NotNull OutputPointer.Int64 pCurrent,
+ @NotNull OutputPointer.Int64 pHighwater, boolean reset
+ );
/**
Sets the current UDF result to the given bytes, which are assumed
return rv;
}
+ private static void testCompileOption(){
+ int i = 0;
+ String optName;
+ outln("compile options:");
+ for( ; null != (optName = sqlite3_compileoption_get(i)); ++i){
+ outln("\t"+optName+"\t (used="+
+ sqlite3_compileoption_used(optName)+")");
+ }
+
+ }
+
private static void testOpenDb1(){
final OutputPointer.sqlite3 out = new OutputPointer.sqlite3();
int rc = sqlite3_open(":memory:", out);
affirm(0 == db.getNativePointer());
}
- private static void testCompileOption(){
- int i = 0;
- String optName;
- outln("compile options:");
- for( ; null != (optName = sqlite3_compileoption_get(i)); ++i){
- outln("\t"+optName+"\t (used="+
- sqlite3_compileoption_used(optName)+")");
- }
-
- }
-
private static void testOpenDb2(){
final OutputPointer.sqlite3 out = new OutputPointer.sqlite3();
int rc = sqlite3_open_v2(":memory:", out,
affirm( 5 == ba.length /* as opposed to 6 in modified utf-8 */);
}
+ private static void testStatus(){
+ final OutputPointer.Int64 cur64 = new OutputPointer.Int64();
+ final OutputPointer.Int64 high64 = new OutputPointer.Int64();
+ final OutputPointer.Int32 cur32 = new OutputPointer.Int32();
+ final OutputPointer.Int32 high32 = new OutputPointer.Int32();
+ final sqlite3 db = createNewDb();
+ execSql(db, "create table t(a)");
+ sqlite3_close_v2(db);
+
+ int rc = sqlite3_status(SQLITE_STATUS_MEMORY_USED, cur32, high32, false);
+ affirm( 0 == rc );
+ affirm( cur32.getValue() > 0 );
+ affirm( high32.getValue() >= cur32.getValue() );
+
+ rc = sqlite3_status64(SQLITE_STATUS_MEMORY_USED, cur64, high64, false);
+ affirm( 0 == rc );
+ affirm( cur64.getValue() > 0 );
+ affirm( high64.getValue() >= cur64.getValue() );
+
+ }
+
private static void testUdf1(){
final sqlite3 db = createNewDb();
// These ValueHolders are just to confirm that the func did what we want...
testSql();
testCollation();
testToUtf8();
+ testStatus();
testUdf1();
testUdfJavaObject();
testUdfAggregate();
-C Add\stiming\sinfo\sto\sSQLTester.
-D 2023-08-11T21:25:33.877
+C Bind\ssqlite3_status(64)()\sto\sJNI.
+D 2023-08-12T10:06:59.356
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
F ext/jni/GNUmakefile 6a6633f768431bc1195c1b64bcec162069e3ed02442808eef9bd173c59ed0ddd
F ext/jni/README.md 7a614a2fa6c561205f7a53fd8626cf93a7b5711ff454fc1814517f796df398eb
F ext/jni/jar-dist.make f90a553203a57934bf275bed86479485135a52f48ac5c1cfe6499ae07b0b35a4
-F ext/jni/src/c/sqlite3-jni.c 1b9fd402d507012b9c6f7f84f2a5998c77189048a893753790569b0329f76495
-F ext/jni/src/c/sqlite3-jni.h 8f9e03016fea584627219eb4a14c6b1a6ba9fffbd7bc0df9e14220a6af8cfe18
+F ext/jni/src/c/sqlite3-jni.c 5bb53c3f38486a79358737400d4e8a3ef66ae4ea58e7a5bd6e24a5816c2ad653
+F ext/jni/src/c/sqlite3-jni.h 7a51d1045ef78c2cb6929f6de5bd8242e9ebafe8abfe4a4255b67b62cfb4d2d5
F ext/jni/src/org/sqlite/jni/Authorizer.java 1308988f7f40579ea0e4deeaec3c6be971630566bd021c31367fe3f5140db892
F ext/jni/src/org/sqlite/jni/AutoExtension.java 18e83f6f463e306df60b2dceb65247d32af1f78af4bbbae9155411a8c6cdb093
F ext/jni/src/org/sqlite/jni/BusyHandler.java 1b1d3e5c86cd796a0580c81b6af6550ad943baa25e47ada0dcca3aff3ebe978c
F ext/jni/src/org/sqlite/jni/ResultCode.java 7cdf993f2037ab7bd244c9a34dbaef2ace3beb5da5d7e7fda5c6f67634ceb647
F ext/jni/src/org/sqlite/jni/RollbackHook.java b04c8abcc6ade44a8a57129e33765793f69df0ba909e49ba18d73f4268d92564
F ext/jni/src/org/sqlite/jni/SQLFunction.java 09ce81c1c637e31c3a830d4c859cce95d65f5e02ff45f8bd1985b3479381bc46
-F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 23dec2c267ef1882bb0bfc12a2c771e13e091885942344abbde90861f7b795fa
-F ext/jni/src/org/sqlite/jni/Tester1.java 62ba3f547800d6e35263f9e6caca9d82f6a087e6d02e1983d7acf5aab81115b6
+F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 21af88949fd4c909d43a511f51e352f51dab34bbd5c42eba885709b7001dad03
+F ext/jni/src/org/sqlite/jni/Tester1.java c7bb4747c2df2aa52cd00bcaf15ed8609df121d80f2af75b05cbf0f673a8be42
F ext/jni/src/org/sqlite/jni/TesterFts5.java cf2d687baafffdeba219b77cf611fd47a0556248820ea794ae3e8259bfbdc5ee
F ext/jni/src/org/sqlite/jni/Tracer.java a5cece9f947b0af27669b8baec300b6dd7ff859c3e6a6e4a1bd8b50f9714775d
F ext/jni/src/org/sqlite/jni/UpdateHook.java e58645a1727f8a9bbe72dc072ec5b40d9f9362cb0aa24acfe93f49ff56a9016d
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 4f0aeeba0287e846908180eab6f7080ebe1323ebe49340771864d110e1ca5b2b
-R 83650742b7c53ba16249ac5a897c9107
+P b69b5facbf94e03e74d4a739ab85c5baac1c9ecbea8c330b2135d77e525b5d8a
+R b76030b5e4eb661dcf175e25776950a3
U stephan
-Z e72133113955550d8ba2a524328196a9
+Z 02ed26d64128e71e5e4367d3108664ea
# Remove this line to create a well-formed Fossil manifest.
-b69b5facbf94e03e74d4a739ab85c5baac1c9ecbea8c330b2135d77e525b5d8a
\ No newline at end of file
+cefb6614e65ca1764ec72702f92f801382e63aa9b221fc9c68719d497e7499fd
\ No newline at end of file