]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Convert the macro-generated JNI bindings which take a db pointer to the new pointer...
authorstephan <stephan@noemail.net>
Thu, 28 Sep 2023 10:27:01 +0000 (10:27 +0000)
committerstephan <stephan@noemail.net>
Thu, 28 Sep 2023 10:27:01 +0000 (10:27 +0000)
FossilOrigin-Name: 5f47fb77db4ee77afc541e680559ad88e66ba7fd04b830e70f8be92cf8d0a60c

ext/jni/src/c/sqlite3-jni.c
ext/jni/src/c/sqlite3-jni.h
ext/jni/src/org/sqlite/jni/SQLite3Jni.java
manifest
manifest.uuid

index da457174a4930db1e938a3f7ca33d5157f056e50..b631baa182fafb71380d4c8b559e19224ba52bd2 100644 (file)
@@ -2012,23 +2012,23 @@ static void udf_xInverse(sqlite3_context* cx, int argc,
 #define WRAP_STR_STMT_INT(JniNameSuffix,CName)                              \
   JniDecl(jstring,JniNameSuffix)(JniArgsEnvClass, jobject pStmt, jint ndx){ \
     return s3jni_utf8_to_jstring(                                       \
-                                 CName(PtrGet_sqlite3_stmt(pStmt), (int)ndx), \
-                                 -1);                                       \
-  }
-/** Create a trivial JNI wrapper for (int CName(sqlite3*)). */
-#define WRAP_INT_DB(JniNameSuffix,CName)                     \
-  JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jobject pDb){ \
-    return (jint)CName(PtrGet_sqlite3(pDb));                 \
+      CName(PtrGet_sqlite3_stmt(pStmt), (int)ndx),                      \
+      -1);                                                              \
   }
 /** Create a trivial JNI wrapper for (boolean CName(sqlite3*)). */
-#define WRAP_BOOL_DB(JniNameSuffix,CName)                     \
-  JniDecl(jboolean,JniNameSuffix)(JniArgsEnvClass, jobject pDb){ \
-    return CName(PtrGet_sqlite3(pDb)) ? JNI_TRUE : JNI_FALSE; \
+#define WRAP_BOOL_DB(JniNameSuffix,CName)                           \
+  JniDecl(jboolean,JniNameSuffix)(JniArgsEnvClass, jlong jpDb){     \
+    return CName(S3JniLongPtr_sqlite3(jpDb)) ? JNI_TRUE : JNI_FALSE; \
+  }
+/** Create a trivial JNI wrapper for (int CName(sqlite3*)). */
+#define WRAP_INT_DB(JniNameSuffix,CName)                    \
+  JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jlong jpDb){ \
+  return (jint)CName(S3JniLongPtr_sqlite3(jpDb)); \
   }
 /** Create a trivial JNI wrapper for (int64 CName(sqlite3*)). */
-#define WRAP_INT64_DB(JniNameSuffix,CName)                    \
-  JniDecl(jlong,JniNameSuffix)(JniArgsEnvClass, jobject pDb){ \
-    return (jlong)CName(PtrGet_sqlite3(pDb));                 \
+#define WRAP_INT64_DB(JniNameSuffix,CName)                   \
+  JniDecl(jlong,JniNameSuffix)(JniArgsEnvClass, jlong jpDb){ \
+  return (jlong)CName(S3JniLongPtr_sqlite3(jpDb));  \
   }
 /** Create a trivial JNI wrapper for (int CName(sqlite3_value*)). */
 #define WRAP_INT_SVALUE(JniNameSuffix,CName)                      \
index 9a016c2e3fdd2dd69ec9488a5b46f39c25c8fa26..6ead741d463cf5adeaed8f949de80acd805c493d 100644 (file)
@@ -1030,18 +1030,18 @@ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1cancel_1auto_
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_changes
- * Signature: (Lorg/sqlite/jni/sqlite3;)I
+ * Signature: (J)I
  */
 JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1changes
-  (JNIEnv *, jclass, jobject);
+  (JNIEnv *, jclass, jlong);
 
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_changes64
- * Signature: (Lorg/sqlite/jni/sqlite3;)J
+ * Signature: (J)J
  */
 JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1changes64
-  (JNIEnv *, jclass, jobject);
+  (JNIEnv *, jclass, jlong);
 
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
@@ -1347,6 +1347,14 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errcode
 JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errmsg16
   (JNIEnv *, jclass, jobject);
 
+/*
+ * Class:     org_sqlite_jni_SQLite3Jni
+ * Method:    sqlite3_error_offset
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1error_1offset
+  (JNIEnv *, jclass, jlong);
+
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_errstr
@@ -1366,10 +1374,10 @@ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1expanded_1sql
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_extended_errcode
- * Signature: (Lorg/sqlite/jni/sqlite3;)I
+ * Signature: (J)I
  */
 JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1extended_1errcode
-  (JNIEnv *, jclass, jobject);
+  (JNIEnv *, jclass, jlong);
 
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
@@ -1382,10 +1390,10 @@ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1extended_1res
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_get_autocommit
- * Signature: (Lorg/sqlite/jni/sqlite3;)Z
+ * Signature: (J)Z
  */
 JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1get_1autocommit
-  (JNIEnv *, jclass, jobject);
+  (JNIEnv *, jclass, jlong);
 
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
@@ -1395,14 +1403,6 @@ JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1get_1autocomm
 JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1get_1auxdata
   (JNIEnv *, jclass, jobject, jint);
 
-/*
- * Class:     org_sqlite_jni_SQLite3Jni
- * Method:    sqlite3_error_offset
- * Signature: (Lorg/sqlite/jni/sqlite3;)I
- */
-JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1error_1offset
-  (JNIEnv *, jclass, jobject);
-
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_finalize
@@ -1534,26 +1534,26 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1prepare_1v3
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_preupdate_blobwrite
- * Signature: (Lorg/sqlite/jni/sqlite3;)I
+ * Signature: (J)I
  */
 JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1blobwrite
-  (JNIEnv *, jclass, jobject);
+  (JNIEnv *, jclass, jlong);
 
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_preupdate_count
- * Signature: (Lorg/sqlite/jni/sqlite3;)I
+ * Signature: (J)I
  */
 JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1count
-  (JNIEnv *, jclass, jobject);
+  (JNIEnv *, jclass, jlong);
 
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_preupdate_depth
- * Signature: (Lorg/sqlite/jni/sqlite3;)I
+ * Signature: (J)I
  */
 JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1preupdate_1depth
-  (JNIEnv *, jclass, jobject);
+  (JNIEnv *, jclass, jlong);
 
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
@@ -1886,10 +1886,10 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1strlike
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_system_errno
- * Signature: (Lorg/sqlite/jni/sqlite3;)I
+ * Signature: (J)I
  */
 JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1system_1errno
-  (JNIEnv *, jclass, jobject);
+  (JNIEnv *, jclass, jlong);
 
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
@@ -1910,18 +1910,18 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1threadsafe
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_total_changes
- * Signature: (Lorg/sqlite/jni/sqlite3;)I
+ * Signature: (J)I
  */
 JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1total_1changes
-  (JNIEnv *, jclass, jobject);
+  (JNIEnv *, jclass, jlong);
 
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
  * Method:    sqlite3_total_changes64
- * Signature: (Lorg/sqlite/jni/sqlite3;)J
+ * Signature: (J)J
  */
 JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1total_1changes64
-  (JNIEnv *, jclass, jobject);
+  (JNIEnv *, jclass, jlong);
 
 /*
  * Class:     org_sqlite_jni_SQLite3Jni
index d619bfefed5f467c935953e05a4600792f7d2930..516e86f39d0e8548d16bbdbc272b31c881c4f78b 100644 (file)
@@ -546,14 +546,20 @@ public final class SQLite3Jni {
   );
 
   @Canonical
-  public static native int sqlite3_changes(
-    @NotNull sqlite3 db
-  );
+  private static native int sqlite3_changes(@NotNull long ptrToDb);
 
   @Canonical
-  public static native long sqlite3_changes64(
-    @NotNull sqlite3 db
-  );
+  public static int sqlite3_changes(@NotNull sqlite3 db){
+    return sqlite3_changes(db.getNativePointer());
+  }
+
+  @Canonical
+  private static native long sqlite3_changes64(@NotNull long ptrToDb);
+
+  @Canonical
+  public static long sqlite3_changes64(@NotNull sqlite3 db){
+    return sqlite3_changes64(db.getNativePointer());
+  }
 
   @Canonical
   public static native int sqlite3_clear_bindings(
@@ -859,6 +865,18 @@ public final class SQLite3Jni {
   @Canonical
   public static native String sqlite3_errmsg16(@NotNull sqlite3 db);
 
+  @Canonical
+  private static native int sqlite3_error_offset(@NotNull long ptrToDb);
+
+  /**
+     Note that the returned byte offset values assume UTF-8-encoded
+     inputs, so won't always match character offsets in Java Strings.
+  */
+  @Canonical
+  public static int sqlite3_error_offset(@NotNull sqlite3 db){
+    return sqlite3_error_offset(db.getNativePointer());
+  }
+
   @Canonical
   public static native String sqlite3_errstr(int resultCode);
 
@@ -866,7 +884,12 @@ public final class SQLite3Jni {
   public static native String sqlite3_expanded_sql(@NotNull sqlite3_stmt stmt);
 
   @Canonical
-  public static native int sqlite3_extended_errcode(@NotNull sqlite3 db);
+  private static native int sqlite3_extended_errcode(@NotNull long ptrToDb);
+
+  @Canonical
+  public static int sqlite3_extended_errcode(@NotNull sqlite3 db){
+    return sqlite3_extended_errcode(db.getNativePointer());
+  }
 
   @Canonical
   public static native boolean sqlite3_extended_result_codes(
@@ -874,20 +897,18 @@ public final class SQLite3Jni {
   );
 
   @Canonical
-  public static native boolean sqlite3_get_autocommit(@NotNull sqlite3 db);
+  private static native boolean sqlite3_get_autocommit(@NotNull long ptrToDb);
+
+  @Canonical
+  public static boolean sqlite3_get_autocommit(@NotNull sqlite3 db){
+    return sqlite3_get_autocommit(db.getNativePointer());
+  }
 
   @Canonical
   public static native Object sqlite3_get_auxdata(
     @NotNull sqlite3_context cx, int n
   );
 
-  /**
-     Note that the returned byte offset values assume UTF-8-encoded
-     inputs, so won't always match character offsets in Java Strings.
-  */
-  @Canonical
-  public static native int sqlite3_error_offset(@NotNull sqlite3 db);
-
   @Canonical
   static native int sqlite3_finalize(long ptrToStmt);
 
@@ -1274,6 +1295,8 @@ public final class SQLite3Jni {
     return sqlite3_prepare_multi(db, sql, 0, p);
   }
 
+  @Canonical
+  private static native int sqlite3_preupdate_blobwrite(@NotNull long ptrToDb);
 
   /**
      If the C API was built with SQLITE_ENABLE_PREUPDATE_HOOK defined, this
@@ -1281,21 +1304,35 @@ public final class SQLite3Jni {
      SQLITE_MISUSE with no side effects.
   */
   @Canonical
-  public static native int sqlite3_preupdate_blobwrite(@NotNull sqlite3 db);
+  public static int sqlite3_preupdate_blobwrite(@NotNull sqlite3 db){
+    return sqlite3_preupdate_blobwrite(db.getNativePointer());
+  }
+
+  @Canonical
+  private static native int sqlite3_preupdate_count(@NotNull long ptrToDb);
+
   /**
      If the C API was built with SQLITE_ENABLE_PREUPDATE_HOOK defined, this
      acts as a proxy for C's sqlite3_preupdate_count(), else it returns
      SQLITE_MISUSE with no side effects.
   */
   @Canonical
-  public static native int sqlite3_preupdate_count(@NotNull sqlite3 db);
+  public static int sqlite3_preupdate_count(@NotNull sqlite3 db){
+    return sqlite3_preupdate_count(db.getNativePointer());
+  }
+
+  @Canonical
+  private static native int sqlite3_preupdate_depth(@NotNull long ptrToDb);
+
   /**
      If the C API was built with SQLITE_ENABLE_PREUPDATE_HOOK defined, this
      acts as a proxy for C's sqlite3_preupdate_depth(), else it returns
      SQLITE_MISUSE with no side effects.
   */
   @Canonical
-  public static native int sqlite3_preupdate_depth(@NotNull sqlite3 db);
+  public static int sqlite3_preupdate_depth(@NotNull sqlite3 db){
+    return sqlite3_preupdate_depth(db.getNativePointer());
+  }
 
   /**
      If the C API was built with SQLITE_ENABLE_PREUPDATE_HOOK defined, this
@@ -1793,7 +1830,12 @@ public final class SQLite3Jni {
   }
 
   @Canonical
-  public static native int sqlite3_system_errno(@NotNull sqlite3 db);
+  private static native int sqlite3_system_errno(@NotNull long ptrToDb);
+
+  @Canonical
+  public static int sqlite3_system_errno(@NotNull sqlite3 db){
+    return sqlite3_system_errno(db.getNativePointer());
+  }
 
   @Canonical
   public static native int sqlite3_table_column_metadata(
@@ -1838,10 +1880,20 @@ public final class SQLite3Jni {
   public static native int sqlite3_threadsafe();
 
   @Canonical
-  public static native int sqlite3_total_changes(@NotNull sqlite3 db);
+  private static native int sqlite3_total_changes(@NotNull long ptrToDb);
 
   @Canonical
-  public static native long sqlite3_total_changes64(@NotNull sqlite3 db);
+  public static int sqlite3_total_changes(@NotNull sqlite3 db){
+    return sqlite3_total_changes(db.getNativePointer());
+  }
+
+  @Canonical
+  private static native long sqlite3_total_changes64(@NotNull long ptrToDb);
+
+  @Canonical
+  public static long sqlite3_total_changes64(@NotNull sqlite3 db){
+    return sqlite3_total_changes64(db.getNativePointer());
+  }
 
   /**
      Works like C's sqlite3_trace_v2() except that the 3rd argument to that
index 7cde18ac5386480cd7f59408f1a513adf9c2c95d..0439e98ef5623f5dacef13484fde554393c2faa8 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Adapted\sJNI\ssqlite3_blob_...()\sand\ssqlite3_close...()\sto\sthe\snew\spointer-passing\smechanism.
-D 2023-09-27T14:41:49.881
+C Convert\sthe\smacro-generated\sJNI\sbindings\swhich\stake\sa\sdb\spointer\sto\sthe\snew\spointer-passing\smechanism.
+D 2023-09-28T10:27:01.146
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -238,8 +238,8 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3
 F ext/jni/GNUmakefile 42e00052401b6dd41c0cdd53b31450606ea37486283abdb038dff9be74bff71e
 F ext/jni/README.md 9fceaeb17cecdc5d699dfc83c0cbc3a03fdb3b86bf676381894166c73375ee75
 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa
-F ext/jni/src/c/sqlite3-jni.c 2c36a16445e2e39e899b2b51f1d1b5d0f42e3008bfcd5c996fdf606d4429af72
-F ext/jni/src/c/sqlite3-jni.h 8d66d189ac58f000b1143da7631fb30abd4554461369fedaa8a7c1ac5462a530
+F ext/jni/src/c/sqlite3-jni.c 14406b8857fb1ea3ec57bf90fdd17e1dbb68937f21868b50de6a5e64555a1053
+F ext/jni/src/c/sqlite3-jni.h d1ac1b6610437291077b263cfc2ecb2dd1ccc5154e83dd45083b86aa20b34be6
 F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436
 F ext/jni/src/org/sqlite/jni/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4
 F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java e6135be32f12bf140bffa39be7fd1a45ad83b2661ed49c08dbde04c8485feb38
@@ -259,7 +259,7 @@ F ext/jni/src/org/sqlite/jni/ProgressHandlerCallback.java 7b9ff2218129ece98ba60c
 F ext/jni/src/org/sqlite/jni/ResultCode.java ba701f20213a5f259e94cfbfdd36eb7ac7ce7797f2c6c7fca2004ff12ce20f86
 F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java d12352c0e22840de484ffa9b11ed5058bb0daca2e9f218055d3c54c947a273c4
 F ext/jni/src/org/sqlite/jni/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c
-F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 51a70421655f8663439037606d1cd5feb5102e032d3e851d860a3dac2dc4e6c0
+F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 7075a5c5de4d5b41b47587abd0fd0d82e325e1a4fc24d4422d029b9b7f0cac1e
 F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c
 F ext/jni/src/org/sqlite/jni/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab
 F ext/jni/src/org/sqlite/jni/Tester1.java 720e1efddd769d5785e95100ff48aa203f2288eea865326a1a81fd5af43ec3a5
@@ -2122,8 +2122,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 980d559fff6e55d1e2ef39f242a8a09313a936cfb141807db475bcceff924869
-R d927af0037b6061c9d963a62e64650b9
+P 0b22c8ef93e5ccd45316099fb8575e27620158b1992c0c70fe0348cfc10147f8
+R 39e7f9b7ed1c60cf4f2907887eef0ed7
 U stephan
-Z 1d6d1018657afbb7fe95c6220da9d8bf
+Z e97bf1ee3ba4dec99a48b628a72060e8
 # Remove this line to create a well-formed Fossil manifest.
index ef260973fe2d85196e15f11efb4450e3af3dd07c..90ab0b17f4d77b57dc933a25c4556a0dca7f8c0d 100644 (file)
@@ -1 +1 @@
-0b22c8ef93e5ccd45316099fb8575e27620158b1992c0c70fe0348cfc10147f8
\ No newline at end of file
+5f47fb77db4ee77afc541e680559ad88e66ba7fd04b830e70f8be92cf8d0a60c
\ No newline at end of file