]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Diverse minor cleanups in the JNI pieces.
authorstephan <stephan@noemail.net>
Tue, 7 Nov 2023 13:44:29 +0000 (13:44 +0000)
committerstephan <stephan@noemail.net>
Tue, 7 Nov 2023 13:44:29 +0000 (13:44 +0000)
FossilOrigin-Name: 35233dd900632b997b5e532170a3b2af0ca7f1dccb8407555b93f2b395b0f7b4

ext/jni/src/c/sqlite3-jni.c
ext/jni/src/org/sqlite/jni/capi/CApi.java
ext/jni/src/org/sqlite/jni/capi/sqlite3.java
ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java
manifest
manifest.uuid

index a5cc7e38d5a6c8aeb9e4bdb57c91091d7fada346..852b0ccceb4df5593a0b5567347691661b7fb10a 100644 (file)
@@ -1474,7 +1474,7 @@ static void * NativePointerHolder__get(JNIEnv * env, jobject jNph,
 #define PtrGet_sqlite3_stmt(OBJ) PtrGet_T(sqlite3_stmt, OBJ)
 #define PtrGet_sqlite3_value(OBJ) PtrGet_T(sqlite3_value, OBJ)
 /*
-** S3JniLongPtr_T(X,Y) expects X to be an unqualified sqlite3 struct
+** LongPtrGet_T(X,Y) expects X to be an unqualified sqlite3 struct
 ** type name and Y to be a native pointer to such an object in the
 ** form of a jlong value. The jlong is simply cast to (X*). This
 ** approach is, as of 2023-09-27, supplanting the former approach. We
@@ -1483,12 +1483,12 @@ static void * NativePointerHolder__get(JNIEnv * env, jobject jNph,
 ** intptr_t part here is necessary for compatibility with (at least)
 ** ARM32.
 */
-#define S3JniLongPtr_T(T,JLongAsPtr) (T*)((intptr_t)(JLongAsPtr))
-#define S3JniLongPtr_sqlite3(JLongAsPtr) S3JniLongPtr_T(sqlite3,JLongAsPtr)
-#define S3JniLongPtr_sqlite3_backup(JLongAsPtr) S3JniLongPtr_T(sqlite3_backup,JLongAsPtr)
-#define S3JniLongPtr_sqlite3_blob(JLongAsPtr) S3JniLongPtr_T(sqlite3_blob,JLongAsPtr)
-#define S3JniLongPtr_sqlite3_stmt(JLongAsPtr) S3JniLongPtr_T(sqlite3_stmt,JLongAsPtr)
-#define S3JniLongPtr_sqlite3_value(JLongAsPtr) S3JniLongPtr_T(sqlite3_value,JLongAsPtr)
+#define LongPtrGet_T(T,JLongAsPtr) (T*)((intptr_t)(JLongAsPtr))
+#define LongPtrGet_sqlite3(JLongAsPtr) LongPtrGet_T(sqlite3,JLongAsPtr)
+#define LongPtrGet_sqlite3_backup(JLongAsPtr) LongPtrGet_T(sqlite3_backup,JLongAsPtr)
+#define LongPtrGet_sqlite3_blob(JLongAsPtr) LongPtrGet_T(sqlite3_blob,JLongAsPtr)
+#define LongPtrGet_sqlite3_stmt(JLongAsPtr) LongPtrGet_T(sqlite3_stmt,JLongAsPtr)
+#define LongPtrGet_sqlite3_value(JLongAsPtr) LongPtrGet_T(sqlite3_value,JLongAsPtr)
 /*
 ** Extracts the new S3JniDb instance from the free-list, or allocates
 ** one if needed, associates it with pDb, and returns.  Returns NULL
@@ -1547,7 +1547,7 @@ static void S3JniDb_xDestroy(void *p){
 #define S3JniDb_from_c(sqlite3Ptr) \
   ((sqlite3Ptr) ? S3JniDb_from_clientdata(sqlite3Ptr) : 0)
 #define S3JniDb_from_jlong(sqlite3PtrAsLong) \
-  S3JniDb_from_c(S3JniLongPtr_T(sqlite3,sqlite3PtrAsLong))
+  S3JniDb_from_c(LongPtrGet_T(sqlite3,sqlite3PtrAsLong))
 
 /*
 ** Unref any Java-side state in (S3JniAutoExtension*) AX and zero out
@@ -2052,12 +2052,12 @@ static void udf_xInverse(sqlite3_context* cx, int argc,
 /** Create a trivial JNI wrapper for (int CName(sqlite3_stmt*)). */
 #define WRAP_INT_STMT(JniNameSuffix,CName)                    \
   JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jlong jpStmt){ \
-    return (jint)CName(S3JniLongPtr_sqlite3_stmt(jpStmt));    \
+    return (jint)CName(LongPtrGet_sqlite3_stmt(jpStmt));    \
   }
 /** Create a trivial JNI wrapper for (int CName(sqlite3_stmt*,int)). */
 #define WRAP_INT_STMT_INT(JniNameSuffix,CName)                         \
   JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jlong jpStmt, jint n){ \
-    return (jint)CName(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)n);            \
+    return (jint)CName(LongPtrGet_sqlite3_stmt(jpStmt), (int)n);            \
   }
 /** Create a trivial JNI wrapper for (boolean CName(sqlite3_stmt*)). */
 #define WRAP_BOOL_STMT(JniNameSuffix,CName)                           \
@@ -2068,41 +2068,41 @@ static void udf_xInverse(sqlite3_context* cx, int argc,
 #define WRAP_STR_STMT_INT(JniNameSuffix,CName)                             \
   JniDecl(jstring,JniNameSuffix)(JniArgsEnvClass, jlong jpStmt, jint ndx){ \
     return s3jni_utf8_to_jstring(                                       \
-      CName(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx),               \
+      CName(LongPtrGet_sqlite3_stmt(jpStmt), (int)ndx),               \
       -1);                                                              \
   }
 /** Create a trivial JNI wrapper for (boolean CName(sqlite3*)). */
 #define WRAP_BOOL_DB(JniNameSuffix,CName)                           \
   JniDecl(jboolean,JniNameSuffix)(JniArgsEnvClass, jlong jpDb){     \
-    return CName(S3JniLongPtr_sqlite3(jpDb)) ? JNI_TRUE : JNI_FALSE; \
+    return CName(LongPtrGet_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)); \
+  return (jint)CName(LongPtrGet_sqlite3(jpDb)); \
   }
 /** Create a trivial JNI wrapper for (int64 CName(sqlite3*)). */
 #define WRAP_INT64_DB(JniNameSuffix,CName)                   \
   JniDecl(jlong,JniNameSuffix)(JniArgsEnvClass, jlong jpDb){ \
-  return (jlong)CName(S3JniLongPtr_sqlite3(jpDb));  \
+  return (jlong)CName(LongPtrGet_sqlite3(jpDb));  \
   }
 /** Create a trivial JNI wrapper for (jstring CName(sqlite3*,int)). */
 #define WRAP_STR_DB_INT(JniNameSuffix,CName)                             \
   JniDecl(jstring,JniNameSuffix)(JniArgsEnvClass, jlong jpDb, jint ndx){ \
     return s3jni_utf8_to_jstring(                                       \
-      CName(S3JniLongPtr_sqlite3(jpDb), (int)ndx),               \
+      CName(LongPtrGet_sqlite3(jpDb), (int)ndx),               \
       -1);                                                              \
   }
 /** Create a trivial JNI wrapper for (int CName(sqlite3_value*)). */
 #define WRAP_INT_SVALUE(JniNameSuffix,CName,DfltOnNull)         \
   JniDecl(jint,JniNameSuffix)(JniArgsEnvClass, jlong jpSValue){ \
-    sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSValue); \
+    sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSValue); \
     return (jint)(sv ? CName(sv): DfltOnNull);                      \
   }
 /** Create a trivial JNI wrapper for (boolean CName(sqlite3_value*)). */
 #define WRAP_BOOL_SVALUE(JniNameSuffix,CName,DfltOnNull)            \
   JniDecl(jboolean,JniNameSuffix)(JniArgsEnvClass, jlong jpSValue){ \
-    sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSValue); \
+    sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSValue); \
     return (jint)(sv ? CName(sv) : DfltOnNull)                       \
       ? JNI_TRUE : JNI_FALSE;                                       \
   }
@@ -2317,7 +2317,7 @@ S3JniApi(sqlite3_backup_finish(),jint,1backup_1finish)(
 ){
   int rc = 0;
   if( jpBack!=0 ){
-    rc = sqlite3_backup_finish( S3JniLongPtr_sqlite3_backup(jpBack) );
+    rc = sqlite3_backup_finish( LongPtrGet_sqlite3_backup(jpBack) );
   }
   return rc;
 }
@@ -2326,8 +2326,8 @@ S3JniApi(sqlite3_backup_init(),jobject,1backup_1init)(
   JniArgsEnvClass, jlong jpDbDest, jstring jTDest,
   jlong jpDbSrc, jstring jTSrc
 ){
-  sqlite3 * const pDest = S3JniLongPtr_sqlite3(jpDbDest);
-  sqlite3 * const pSrc = S3JniLongPtr_sqlite3(jpDbSrc);
+  sqlite3 * const pDest = LongPtrGet_sqlite3(jpDbDest);
+  sqlite3 * const pSrc = LongPtrGet_sqlite3(jpDbSrc);
   char * const zDest = s3jni_jstring_to_utf8(jTDest, 0);
   char * const zSrc = s3jni_jstring_to_utf8(jTSrc, 0);
   jobject rv = 0;
@@ -2350,19 +2350,19 @@ S3JniApi(sqlite3_backup_init(),jobject,1backup_1init)(
 S3JniApi(sqlite3_backup_pagecount(),jint,1backup_1pagecount)(
   JniArgsEnvClass, jlong jpBack
 ){
-  return sqlite3_backup_pagecount(S3JniLongPtr_sqlite3_backup(jpBack));
+  return sqlite3_backup_pagecount(LongPtrGet_sqlite3_backup(jpBack));
 }
 
 S3JniApi(sqlite3_backup_remaining(),jint,1backup_1remaining)(
   JniArgsEnvClass, jlong jpBack
 ){
-  return sqlite3_backup_remaining(S3JniLongPtr_sqlite3_backup(jpBack));
+  return sqlite3_backup_remaining(LongPtrGet_sqlite3_backup(jpBack));
 }
 
 S3JniApi(sqlite3_backup_step(),jint,1backup_1step)(
   JniArgsEnvClass, jlong jpBack, jint nPage
 ){
-  return sqlite3_backup_step(S3JniLongPtr_sqlite3_backup(jpBack), (int)nPage);
+  return sqlite3_backup_step(LongPtrGet_sqlite3_backup(jpBack), (int)nPage);
 }
 
 S3JniApi(sqlite3_bind_blob(),jint,1bind_1blob)(
@@ -2375,13 +2375,13 @@ S3JniApi(sqlite3_bind_blob(),jint,1bind_1blob)(
     if( nMax>nBA ){
       nMax = nBA;
     }
-    rc = sqlite3_bind_blob(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx,
+    rc = sqlite3_bind_blob(LongPtrGet_sqlite3_stmt(jpStmt), (int)ndx,
                            pBuf, (int)nMax, SQLITE_TRANSIENT);
     s3jni_jbyteArray_release(baData, pBuf);
   }else{
     rc = baData
       ? SQLITE_NOMEM
-      : sqlite3_bind_null( S3JniLongPtr_sqlite3_stmt(jpStmt), ndx );
+      : sqlite3_bind_null( LongPtrGet_sqlite3_stmt(jpStmt), ndx );
   }
   return (jint)rc;
 }
@@ -2389,20 +2389,20 @@ S3JniApi(sqlite3_bind_blob(),jint,1bind_1blob)(
 S3JniApi(sqlite3_bind_double(),jint,1bind_1double)(
   JniArgsEnvClass, jlong jpStmt, jint ndx, jdouble val
 ){
-  return (jint)sqlite3_bind_double(S3JniLongPtr_sqlite3_stmt(jpStmt),
+  return (jint)sqlite3_bind_double(LongPtrGet_sqlite3_stmt(jpStmt),
                                    (int)ndx, (double)val);
 }
 
 S3JniApi(sqlite3_bind_int(),jint,1bind_1int)(
   JniArgsEnvClass, jlong jpStmt, jint ndx, jint val
 ){
-  return (jint)sqlite3_bind_int(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx, (int)val);
+  return (jint)sqlite3_bind_int(LongPtrGet_sqlite3_stmt(jpStmt), (int)ndx, (int)val);
 }
 
 S3JniApi(sqlite3_bind_int64(),jint,1bind_1int64)(
   JniArgsEnvClass, jlong jpStmt, jint ndx, jlong val
 ){
-  return (jint)sqlite3_bind_int64(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx, (sqlite3_int64)val);
+  return (jint)sqlite3_bind_int64(LongPtrGet_sqlite3_stmt(jpStmt), (int)ndx, (sqlite3_int64)val);
 }
 
 /*
@@ -2411,7 +2411,7 @@ S3JniApi(sqlite3_bind_int64(),jint,1bind_1int64)(
 S3JniApi(sqlite3_bind_java_object(),jint,1bind_1java_1object)(
   JniArgsEnvClass, jlong jpStmt, jint ndx, jobject val
 ){
-  sqlite3_stmt * const pStmt = S3JniLongPtr_sqlite3_stmt(jpStmt);
+  sqlite3_stmt * const pStmt = LongPtrGet_sqlite3_stmt(jpStmt);
   int rc = SQLITE_MISUSE;
 
   if(pStmt){
@@ -2431,13 +2431,13 @@ S3JniApi(sqlite3_bind_java_object(),jint,1bind_1java_1object)(
 S3JniApi(sqlite3_bind_null(),jint,1bind_1null)(
   JniArgsEnvClass, jlong jpStmt, jint ndx
 ){
-  return (jint)sqlite3_bind_null(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx);
+  return (jint)sqlite3_bind_null(LongPtrGet_sqlite3_stmt(jpStmt), (int)ndx);
 }
 
 S3JniApi(sqlite3_bind_parameter_count(),jint,1bind_1parameter_1count)(
   JniArgsEnvClass, jlong jpStmt
 ){
-  return (jint)sqlite3_bind_parameter_count(S3JniLongPtr_sqlite3_stmt(jpStmt));
+  return (jint)sqlite3_bind_parameter_count(LongPtrGet_sqlite3_stmt(jpStmt));
 }
 
 S3JniApi(sqlite3_bind_parameter_index(),jint,1bind_1parameter_1index)(
@@ -2446,7 +2446,7 @@ S3JniApi(sqlite3_bind_parameter_index(),jint,1bind_1parameter_1index)(
   int rc = 0;
   jbyte * const pBuf = s3jni_jbyteArray_bytes(jName);
   if( pBuf ){
-    rc = sqlite3_bind_parameter_index(S3JniLongPtr_sqlite3_stmt(jpStmt),
+    rc = sqlite3_bind_parameter_index(LongPtrGet_sqlite3_stmt(jpStmt),
                                       (const char *)pBuf);
     s3jni_jbyteArray_release(jName, pBuf);
   }
@@ -2457,7 +2457,7 @@ S3JniApi(sqlite3_bind_parameter_name(),jstring,1bind_1parameter_1name)(
   JniArgsEnvClass, jlong jpStmt, jint ndx
 ){
   const char *z =
-    sqlite3_bind_parameter_name(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx);
+    sqlite3_bind_parameter_name(LongPtrGet_sqlite3_stmt(jpStmt), (int)ndx);
   return z ? s3jni_utf8_to_jstring(z, -1) : 0;
 }
 
@@ -2479,14 +2479,14 @@ static int s3jni__bind_text(int is16, JNIEnv *env, jlong jpStmt, jint ndx,
        such cases, we do not expose the byte-limit arguments in the
        public API. */
     rc = is16
-      ? sqlite3_bind_text16(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx,
+      ? sqlite3_bind_text16(LongPtrGet_sqlite3_stmt(jpStmt), (int)ndx,
                             pBuf, (int)nMax, SQLITE_TRANSIENT)
-      : sqlite3_bind_text(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx,
+      : sqlite3_bind_text(LongPtrGet_sqlite3_stmt(jpStmt), (int)ndx,
                           (const char *)pBuf,
                           (int)nMax, SQLITE_TRANSIENT);
   }else{
     rc = baData
-      ? sqlite3_bind_null(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx)
+      ? sqlite3_bind_null(LongPtrGet_sqlite3_stmt(jpStmt), (int)ndx)
       : SQLITE_NOMEM;
   }
   s3jni_jbyteArray_release(baData, pBuf);
@@ -2510,9 +2510,9 @@ S3JniApi(sqlite3_bind_value(),jint,1bind_1value)(
   JniArgsEnvClass, jlong jpStmt, jint ndx, jlong jpValue
 ){
   int rc = 0;
-  sqlite3_stmt * pStmt = S3JniLongPtr_sqlite3_stmt(jpStmt);
+  sqlite3_stmt * pStmt = LongPtrGet_sqlite3_stmt(jpStmt);
   if( pStmt ){
-    sqlite3_value *v = S3JniLongPtr_sqlite3_value(jpValue);
+    sqlite3_value *v = LongPtrGet_sqlite3_value(jpValue);
     if( v ){
       rc = sqlite3_bind_value(pStmt, (int)ndx, v);
     }else{
@@ -2527,27 +2527,27 @@ S3JniApi(sqlite3_bind_value(),jint,1bind_1value)(
 S3JniApi(sqlite3_bind_zeroblob(),jint,1bind_1zeroblob)(
   JniArgsEnvClass, jlong jpStmt, jint ndx, jint n
 ){
-  return (jint)sqlite3_bind_zeroblob(S3JniLongPtr_sqlite3_stmt(jpStmt),
+  return (jint)sqlite3_bind_zeroblob(LongPtrGet_sqlite3_stmt(jpStmt),
                                      (int)ndx, (int)n);
 }
 
 S3JniApi(sqlite3_bind_zeroblob64(),jint,1bind_1zeroblob64)(
   JniArgsEnvClass, jlong jpStmt, jint ndx, jlong n
 ){
-  return (jint)sqlite3_bind_zeroblob64(S3JniLongPtr_sqlite3_stmt(jpStmt),
+  return (jint)sqlite3_bind_zeroblob64(LongPtrGet_sqlite3_stmt(jpStmt),
                                        (int)ndx, (sqlite3_uint64)n);
 }
 
 S3JniApi(sqlite3_blob_bytes(),jint,1blob_1bytes)(
   JniArgsEnvClass, jlong jpBlob
 ){
-  return sqlite3_blob_bytes(S3JniLongPtr_sqlite3_blob(jpBlob));
+  return sqlite3_blob_bytes(LongPtrGet_sqlite3_blob(jpBlob));
 }
 
 S3JniApi(sqlite3_blob_close(),jint,1blob_1close)(
   JniArgsEnvClass, jlong jpBlob
 ){
-  sqlite3_blob * const b = S3JniLongPtr_sqlite3_blob(jpBlob);
+  sqlite3_blob * const b = LongPtrGet_sqlite3_blob(jpBlob);
   return b ? (jint)sqlite3_blob_close(b) : SQLITE_MISUSE;
 }
 
@@ -2555,7 +2555,7 @@ S3JniApi(sqlite3_blob_open(),jint,1blob_1open)(
   JniArgsEnvClass, jlong jpDb, jstring jDbName, jstring jTbl, jstring jCol,
   jlong jRowId, jint flags, jobject jOut
 ){
-  sqlite3 * const db = S3JniLongPtr_sqlite3(jpDb);
+  sqlite3 * const db = LongPtrGet_sqlite3(jpDb);
   sqlite3_blob * pBlob = 0;
   char * zDbName = 0, * zTableName = 0, * zColumnName = 0;
   int rc;
@@ -2589,7 +2589,7 @@ S3JniApi(sqlite3_blob_read(),jint,1blob_1read)(
   int rc = jTgt ? (pBa ? SQLITE_MISUSE : SQLITE_NOMEM) : SQLITE_MISUSE;
   if( pBa ){
     jsize const nTgt = (*env)->GetArrayLength(env, jTgt);
-    rc = sqlite3_blob_read(S3JniLongPtr_sqlite3_blob(jpBlob), pBa,
+    rc = sqlite3_blob_read(LongPtrGet_sqlite3_blob(jpBlob), pBa,
                            (int)nTgt, (int)iOffset);
     if( 0==rc ){
       s3jni_jbyteArray_commit(jTgt, pBa);
@@ -2603,14 +2603,14 @@ S3JniApi(sqlite3_blob_read(),jint,1blob_1read)(
 S3JniApi(sqlite3_blob_reopen(),jint,1blob_1reopen)(
   JniArgsEnvClass, jlong jpBlob, jlong iNewRowId
 ){
-  return (jint)sqlite3_blob_reopen(S3JniLongPtr_sqlite3_blob(jpBlob),
+  return (jint)sqlite3_blob_reopen(LongPtrGet_sqlite3_blob(jpBlob),
                                    (sqlite3_int64)iNewRowId);
 }
 
 S3JniApi(sqlite3_blob_write(),jint,1blob_1write)(
   JniArgsEnvClass, jlong jpBlob, jbyteArray jBa, jint iOffset
 ){
-  sqlite3_blob * const b = S3JniLongPtr_sqlite3_blob(jpBlob);
+  sqlite3_blob * const b = LongPtrGet_sqlite3_blob(jpBlob);
   jbyte * const pBuf = b ? s3jni_jbyteArray_bytes(jBa) : 0;
   const jsize nBA = pBuf ? (*env)->GetArrayLength(env, jBa) : 0;
   int rc = SQLITE_MISUSE;
@@ -2872,7 +2872,7 @@ S3JniApi(sqlite3_column_int64(),jlong,1column_1int64)(
 S3JniApi(sqlite3_column_java_object(),jobject,1column_1java_1object)(
   JniArgsEnvClass, jlong jpStmt, jint ndx
 ){
-  sqlite3_stmt * const stmt = S3JniLongPtr_sqlite3_stmt(jpStmt);
+  sqlite3_stmt * const stmt = LongPtrGet_sqlite3_stmt(jpStmt);
   jobject rv = 0;
   if( stmt ){
     sqlite3 * const db = sqlite3_db_handle(stmt);
@@ -3612,7 +3612,7 @@ S3JniApi(sqlite3_finalize(),jint,1finalize)(
   JniArgsEnvClass, jlong jpStmt
 ){
   return jpStmt
-    ? sqlite3_finalize(S3JniLongPtr_sqlite3_stmt(jpStmt))
+    ? sqlite3_finalize(LongPtrGet_sqlite3_stmt(jpStmt))
     : 0;
 }
 
@@ -3841,7 +3841,7 @@ jint sqlite3_jni_prepare_v123( int prepVersion, JNIEnv * const env, jclass self,
   sqlite3_stmt * pStmt = 0;
   jobject jStmt = 0;
   const char * zTail = 0;
-  sqlite3 * const pDb = S3JniLongPtr_sqlite3(jpDb);
+  sqlite3 * const pDb = LongPtrGet_sqlite3(jpDb);
   jbyte * const pBuf = pDb ? s3jni_jbyteArray_bytes(baSql)  : 0;
   int rc = SQLITE_ERROR;
 
@@ -4095,7 +4095,7 @@ S3JniApi(sqlite3_preupdate_hook(),jobject,1preupdate_1hook)(
 static int s3jni_preupdate_newold(JNIEnv * const env, int isNew, jlong jpDb,
                                   jint iCol, jobject jOut){
 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
-  sqlite3 * const pDb = S3JniLongPtr_sqlite3(jpDb);
+  sqlite3 * const pDb = LongPtrGet_sqlite3(jpDb);
   int rc = SQLITE_MISUSE;
   if( pDb ){
     sqlite3_value * pOut = 0;
@@ -4852,7 +4852,7 @@ S3JniApi(sqlite3_update_hook(),jobject,1update_1hook)(
 S3JniApi(sqlite3_value_blob(),jbyteArray,1value_1blob)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   const jbyte * pBytes = sv ? sqlite3_value_blob(sv) : 0;
   int const nLen = pBytes ? sqlite3_value_bytes(sv) : 0;
 
@@ -4865,14 +4865,14 @@ S3JniApi(sqlite3_value_blob(),jbyteArray,1value_1blob)(
 S3JniApi(sqlite3_value_bytes(),int,1value_1bytes)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   return sv ? sqlite3_value_bytes(sv) : 0;
 }
 
 S3JniApi(sqlite3_value_bytes16(),int,1value_1bytes16)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   return sv ? sqlite3_value_bytes16(sv) : 0;
 }
 
@@ -4880,7 +4880,7 @@ S3JniApi(sqlite3_value_bytes16(),int,1value_1bytes16)(
 S3JniApi(sqlite3_value_double(),jdouble,1value_1double)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   return (jdouble) (sv ? sqlite3_value_double(sv) : 0.0);
 }
 
@@ -4888,7 +4888,7 @@ S3JniApi(sqlite3_value_double(),jdouble,1value_1double)(
 S3JniApi(sqlite3_value_dup(),jobject,1value_1dup)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   sqlite3_value * const sd = sv ? sqlite3_value_dup(sv) : 0;
   jobject rv = sd ? new_java_sqlite3_value(env, sd) : 0;
   if( sd && !rv ) {
@@ -4901,7 +4901,7 @@ S3JniApi(sqlite3_value_dup(),jobject,1value_1dup)(
 S3JniApi(sqlite3_value_free(),void,1value_1free)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   if( sv ){
     sqlite3_value_free(sv);
   }
@@ -4910,21 +4910,21 @@ S3JniApi(sqlite3_value_free(),void,1value_1free)(
 S3JniApi(sqlite3_value_int(),jint,1value_1int)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   return (jint) (sv ? sqlite3_value_int(sv) : 0);
 }
 
 S3JniApi(sqlite3_value_int64(),jlong,1value_1int64)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   return (jlong) (sv ? sqlite3_value_int64(sv) : 0LL);
 }
 
 S3JniApi(sqlite3_value_java_object(),jobject,1value_1java_1object)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   return sv
     ? sqlite3_value_pointer(sv, s3jni__value_jref_key)
     : 0;
@@ -4933,7 +4933,7 @@ S3JniApi(sqlite3_value_java_object(),jobject,1value_1java_1object)(
 S3JniApi(sqlite3_value_text(),jbyteArray,1value_1text)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   const unsigned char * const p = sv ? sqlite3_value_text(sv) : 0;
   int const n = p ? sqlite3_value_bytes(sv) : 0;
   return p ? s3jni_new_jbyteArray(p, n) : 0;
@@ -4944,7 +4944,7 @@ S3JniApi(sqlite3_value_text(),jbyteArray,1value_1text)(
 S3JniApi(sqlite3_value_text(),jstring,1value_1text)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   const unsigned char * const p = sv ? sqlite3_value_text(sv) : 0;
   int const n = p ? sqlite3_value_bytes(sv) : 0;
   return p ? s3jni_utf8_to_jstring( (const char *)p, n) : 0;
@@ -4954,7 +4954,7 @@ S3JniApi(sqlite3_value_text(),jstring,1value_1text)(
 S3JniApi(sqlite3_value_text16(),jstring,1value_1text16)(
   JniArgsEnvClass, jlong jpSVal
 ){
-  sqlite3_value * const sv = S3JniLongPtr_sqlite3_value(jpSVal);
+  sqlite3_value * const sv = LongPtrGet_sqlite3_value(jpSVal);
   const int n = sv ? sqlite3_value_bytes16(sv) : 0;
   const void * const p = sv ? sqlite3_value_text16(sv) : 0;
   return p ? s3jni_text16_to_jstring(env, p, n) : 0;
index 4864b24296e7c33f6fce4c9596442e507ece6684..8bdcb3cf2d3352b811d929d3472b5b65a3ee9adc 100644 (file)
@@ -164,13 +164,13 @@ public final class CApi {
   */
   public static native int sqlite3_auto_extension(@NotNull AutoExtensionCallback callback);
 
-  static native int sqlite3_backup_finish(@NotNull long ptrToBackup);
+  private static native int sqlite3_backup_finish(@NotNull long ptrToBackup);
 
   public static int sqlite3_backup_finish(@NotNull sqlite3_backup b){
-    return sqlite3_backup_finish(b.clearNativePointer());
+    return null==b ? 0 : sqlite3_backup_finish(b.clearNativePointer());
   }
 
-  static native sqlite3_backup sqlite3_backup_init(
+  private static native sqlite3_backup sqlite3_backup_init(
     @NotNull long ptrToDbDest, @NotNull String destTableName,
     @NotNull long ptrToDbSrc, @NotNull String srcTableName
   );
@@ -183,25 +183,25 @@ public final class CApi {
                                 dbSrc.getNativePointer(), srcTableName );
   }
 
-  static native int sqlite3_backup_pagecount(@NotNull long ptrToBackup);
+  private static native int sqlite3_backup_pagecount(@NotNull long ptrToBackup);
 
   public static int sqlite3_backup_pagecount(@NotNull sqlite3_backup b){
     return sqlite3_backup_pagecount(b.getNativePointer());
   }
 
-  static native int sqlite3_backup_remaining(@NotNull long ptrToBackup);
+  private static native int sqlite3_backup_remaining(@NotNull long ptrToBackup);
 
   public static int sqlite3_backup_remaining(@NotNull sqlite3_backup b){
     return sqlite3_backup_remaining(b.getNativePointer());
   }
 
-  static native int sqlite3_backup_step(@NotNull long ptrToBackup, int nPage);
+  private static native int sqlite3_backup_step(@NotNull long ptrToBackup, int nPage);
 
   public static int sqlite3_backup_step(@NotNull sqlite3_backup b, int nPage){
     return sqlite3_backup_step(b.getNativePointer(), nPage);
   }
 
-  static native int sqlite3_bind_blob(
+  private static native int sqlite3_bind_blob(
     @NotNull long ptrToStmt, int ndx, @Nullable byte[] data, int n
   );
 
@@ -223,7 +223,7 @@ public final class CApi {
       : sqlite3_bind_blob(stmt.getNativePointer(), ndx, data, data.length);
   }
 
-  static native int sqlite3_bind_double(
+  private static native int sqlite3_bind_double(
     @NotNull long ptrToStmt, int ndx, double v
   );
 
@@ -233,7 +233,7 @@ public final class CApi {
     return sqlite3_bind_double(stmt.getNativePointer(), ndx, v);
   }
 
-  static native int sqlite3_bind_int(
+  private static native int sqlite3_bind_int(
     @NotNull long ptrToStmt, int ndx, int v
   );
 
@@ -243,7 +243,7 @@ public final class CApi {
     return sqlite3_bind_int(stmt.getNativePointer(), ndx, v);
   }
 
-  static native int sqlite3_bind_int64(
+  private static native int sqlite3_bind_int64(
     @NotNull long ptrToStmt, int ndx, long v
   );
 
@@ -251,7 +251,7 @@ public final class CApi {
     return sqlite3_bind_int64( stmt.getNativePointer(), ndx, v );
   }
 
-  static native int sqlite3_bind_java_object(
+  private static native int sqlite3_bind_java_object(
     @NotNull long ptrToStmt, int ndx, @Nullable Object o
   );
 
@@ -267,13 +267,13 @@ public final class CApi {
     return sqlite3_bind_java_object(stmt.getNativePointer(), ndx, o);
   }
 
-  static native int sqlite3_bind_null(@NotNull long ptrToStmt, int ndx);
+  private static native int sqlite3_bind_null(@NotNull long ptrToStmt, int ndx);
 
   public static int sqlite3_bind_null(@NotNull sqlite3_stmt stmt, int ndx){
     return sqlite3_bind_null(stmt.getNativePointer(), ndx);
   }
 
-  static native int sqlite3_bind_parameter_count(@NotNull long ptrToStmt);
+  private static native int sqlite3_bind_parameter_count(@NotNull long ptrToStmt);
 
   public static int sqlite3_bind_parameter_count(@NotNull sqlite3_stmt stmt){
     return sqlite3_bind_parameter_count(stmt.getNativePointer());
@@ -300,7 +300,7 @@ public final class CApi {
     return null==utf8 ? 0 : sqlite3_bind_parameter_index(stmt.getNativePointer(), utf8);
   }
 
-  static native String sqlite3_bind_parameter_name(
+  private static native String sqlite3_bind_parameter_name(
     @NotNull long ptrToStmt, int index
   );
 
@@ -308,7 +308,7 @@ public final class CApi {
     return sqlite3_bind_parameter_name(stmt.getNativePointer(), index);
   }
 
-  static native int sqlite3_bind_text(
+  private static native int sqlite3_bind_text(
     @NotNull long ptrToStmt, int ndx, @Nullable byte[] utf8, int maxBytes
   );
 
@@ -352,7 +352,7 @@ public final class CApi {
       : sqlite3_bind_text(stmt.getNativePointer(), ndx, utf8, utf8.length);
   }
 
-  static native int sqlite3_bind_text16(
+  private static native int sqlite3_bind_text16(
     @NotNull long ptrToStmt, int ndx, @Nullable byte[] data, int maxBytes
   );
 
@@ -393,7 +393,7 @@ public final class CApi {
       : sqlite3_bind_text16(stmt.getNativePointer(), ndx, data, data.length);
   }
 
-  static native int sqlite3_bind_value(@NotNull long ptrToStmt, int ndx, long ptrToValue);
+  private static native int sqlite3_bind_value(@NotNull long ptrToStmt, int ndx, long ptrToValue);
 
   /**
      Functions like the C-level sqlite3_bind_value(), or
@@ -404,13 +404,13 @@ public final class CApi {
                               null==val ? 0L : val.getNativePointer());
   }
 
-  static native int sqlite3_bind_zeroblob(@NotNull long ptrToStmt, int ndx, int n);
+  private static native int sqlite3_bind_zeroblob(@NotNull long ptrToStmt, int ndx, int n);
 
   public static int sqlite3_bind_zeroblob(@NotNull sqlite3_stmt stmt, int ndx, int n){
     return sqlite3_bind_zeroblob(stmt.getNativePointer(), ndx, n);
   }
 
-  static native int sqlite3_bind_zeroblob64(
+  private static native int sqlite3_bind_zeroblob64(
     @NotNull long ptrToStmt, int ndx, long n
   );
 
@@ -418,19 +418,19 @@ public final class CApi {
     return sqlite3_bind_zeroblob64(stmt.getNativePointer(), ndx, n);
   }
 
-  static native int sqlite3_blob_bytes(@NotNull long ptrToBlob);
+  private static native int sqlite3_blob_bytes(@NotNull long ptrToBlob);
 
   public static int sqlite3_blob_bytes(@NotNull sqlite3_blob blob){
     return sqlite3_blob_bytes(blob.getNativePointer());
   }
 
-  static native int sqlite3_blob_close(@Nullable long ptrToBlob);
+  private static native int sqlite3_blob_close(@Nullable long ptrToBlob);
 
   public static int sqlite3_blob_close(@Nullable sqlite3_blob blob){
-    return sqlite3_blob_close(blob.clearNativePointer());
+    return null==blob ? 0 : sqlite3_blob_close(blob.clearNativePointer());
   }
 
-  static native int sqlite3_blob_open(
+  private static native int sqlite3_blob_open(
     @NotNull long ptrToDb, @NotNull String dbName,
     @NotNull String tableName, @NotNull String columnName,
     long iRow, int flags, @NotNull OutputPointer.sqlite3_blob out
@@ -458,7 +458,7 @@ public final class CApi {
     return out.take();
   };
 
-  static native int sqlite3_blob_read(
+  private static native int sqlite3_blob_read(
     @NotNull long ptrToBlob, @NotNull byte[] target, int iOffset
   );
 
@@ -468,7 +468,7 @@ public final class CApi {
     return sqlite3_blob_read(b.getNativePointer(), target, iOffset);
   }
 
-  static native int sqlite3_blob_reopen(
+  private static native int sqlite3_blob_reopen(
     @NotNull long ptrToBlob, long newRowId
   );
 
@@ -476,7 +476,7 @@ public final class CApi {
     return sqlite3_blob_reopen(b.getNativePointer(), newRowId);
   }
 
-  static native int sqlite3_blob_write(
+  private static native int sqlite3_blob_write(
     @NotNull long ptrToBlob, @NotNull byte[] bytes, int iOffset
   );
 
@@ -486,7 +486,7 @@ public final class CApi {
     return sqlite3_blob_write(b.getNativePointer(), bytes, iOffset);
   }
 
-  static native int sqlite3_busy_handler(
+  private static native int sqlite3_busy_handler(
     @NotNull long ptrToDb, @Nullable BusyHandlerCallback handler
   );
 
@@ -501,7 +501,7 @@ public final class CApi {
     return sqlite3_busy_handler(db.getNativePointer(), handler);
   }
 
-  static native int sqlite3_busy_timeout(@NotNull long ptrToDb, int ms);
+  private static native int sqlite3_busy_timeout(@NotNull long ptrToDb, int ms);
 
   public static int sqlite3_busy_timeout(@NotNull sqlite3 db, int ms){
     return sqlite3_busy_timeout(db.getNativePointer(), ms);
@@ -511,64 +511,59 @@ public final class CApi {
     @NotNull AutoExtensionCallback ax
   );
 
-  static native int sqlite3_changes(@NotNull long ptrToDb);
+  private static native int sqlite3_changes(@NotNull long ptrToDb);
 
   public static int sqlite3_changes(@NotNull sqlite3 db){
     return sqlite3_changes(db.getNativePointer());
   }
 
-  static native long sqlite3_changes64(@NotNull long ptrToDb);
+  private static native long sqlite3_changes64(@NotNull long ptrToDb);
 
   public static long sqlite3_changes64(@NotNull sqlite3 db){
     return sqlite3_changes64(db.getNativePointer());
   }
 
-  static native int sqlite3_clear_bindings(@NotNull long ptrToStmt);
+  private static native int sqlite3_clear_bindings(@NotNull long ptrToStmt);
 
   public static int sqlite3_clear_bindings(@NotNull sqlite3_stmt stmt){
     return sqlite3_clear_bindings(stmt.getNativePointer());
   }
 
-  static native int sqlite3_close(@Nullable long ptrToDb);
+  private static native int sqlite3_close(@Nullable long ptrToDb);
 
   public static int sqlite3_close(@Nullable sqlite3 db){
-    int rc = 0;
-    if( null!=db ){
-      rc = sqlite3_close(db.getNativePointer());
-      if( 0==rc ) db.clearNativePointer();
-    }
-    return rc;
+    return null==db ? 0 : sqlite3_close(db.clearNativePointer());
   }
 
-  static native int sqlite3_close_v2(@Nullable long ptrToDb);
+  private static native int sqlite3_close_v2(@Nullable long ptrToDb);
 
   public static int sqlite3_close_v2(@Nullable sqlite3 db){
-    return db==null ? 0 : sqlite3_close_v2(db.clearNativePointer());
+    return null==db ? 0 : sqlite3_close_v2(db.clearNativePointer());
   }
 
   public static native byte[] sqlite3_column_blob(
     @NotNull sqlite3_stmt stmt, int ndx
   );
 
-  static native int sqlite3_column_bytes(@NotNull long ptrToStmt, int ndx);
+  private static native int sqlite3_column_bytes(@NotNull long ptrToStmt, int ndx);
 
   public static int sqlite3_column_bytes(@NotNull sqlite3_stmt stmt, int ndx){
     return sqlite3_column_bytes(stmt.getNativePointer(), ndx);
   }
 
-  static native int sqlite3_column_bytes16(@NotNull long ptrToStmt, int ndx);
+  private static native int sqlite3_column_bytes16(@NotNull long ptrToStmt, int ndx);
 
   public static int sqlite3_column_bytes16(@NotNull sqlite3_stmt stmt, int ndx){
     return sqlite3_column_bytes16(stmt.getNativePointer(), ndx);
   }
 
-  static native int sqlite3_column_count(@NotNull long ptrToStmt);
+  private static native int sqlite3_column_count(@NotNull long ptrToStmt);
 
   public static int sqlite3_column_count(@NotNull sqlite3_stmt stmt){
     return sqlite3_column_count(stmt.getNativePointer());
   }
 
-  static native String sqlite3_column_decltype(@NotNull long ptrToStmt, int ndx);
+  private static native String sqlite3_column_decltype(@NotNull long ptrToStmt, int ndx);
 
   public static String sqlite3_column_decltype(@NotNull sqlite3_stmt stmt, int ndx){
     return sqlite3_column_decltype(stmt.getNativePointer(), ndx);
@@ -586,7 +581,7 @@ public final class CApi {
     @NotNull sqlite3_stmt stmt, int ndx
   );
 
-  static native Object sqlite3_column_java_object(
+  private static native Object sqlite3_column_java_object(
     @NotNull long ptrToStmt, int ndx
   );
 
@@ -616,7 +611,7 @@ public final class CApi {
     return type.isInstance(o) ? (T)o : null;
   }
 
-  static native String sqlite3_column_name(@NotNull long ptrToStmt, int ndx);
+  private static native String sqlite3_column_name(@NotNull long ptrToStmt, int ndx);
 
   public static String sqlite3_column_name(@NotNull sqlite3_stmt stmt, int ndx){
     return sqlite3_column_name(stmt.getNativePointer(), ndx);
@@ -702,7 +697,7 @@ public final class CApi {
   //   return rv;
   // }
 
-  static native int sqlite3_column_type(@NotNull long ptrToStmt, int ndx);
+  private static native int sqlite3_column_type(@NotNull long ptrToStmt, int ndx);
 
   public static int sqlite3_column_type(@NotNull sqlite3_stmt stmt, int ndx){
     return sqlite3_column_type(stmt.getNativePointer(), ndx);
@@ -712,7 +707,7 @@ public final class CApi {
     @NotNull sqlite3_stmt stmt, int ndx
   );
 
-  static native int sqlite3_collation_needed(
+  private static native int sqlite3_collation_needed(
     @NotNull long ptrToDb, @Nullable CollationNeededCallback callback
   );
 
@@ -726,7 +721,7 @@ public final class CApi {
     return sqlite3_collation_needed(db.getNativePointer(), callback);
   }
 
-  static native CommitHookCallback sqlite3_commit_hook(
+  private static native CommitHookCallback sqlite3_commit_hook(
     @NotNull long ptrToDb, @Nullable CommitHookCallback hook
   );
 
@@ -825,7 +820,7 @@ public final class CApi {
     int nArg, int eTextRep, @NotNull SQLFunction func
   );
 
-  static native int sqlite3_data_count(@NotNull long ptrToStmt);
+  private static native int sqlite3_data_count(@NotNull long ptrToStmt);
 
   public static int sqlite3_data_count(@NotNull sqlite3_stmt stmt){
     return sqlite3_data_count(stmt.getNativePointer());
@@ -879,7 +874,7 @@ public final class CApi {
 
   public static native String sqlite3_errmsg(@NotNull sqlite3 db);
 
-  static native int sqlite3_error_offset(@NotNull long ptrToDb);
+  private static native int sqlite3_error_offset(@NotNull long ptrToDb);
 
   /**
      Note that the returned byte offset values assume UTF-8-encoded
@@ -893,7 +888,7 @@ public final class CApi {
 
   public static native String sqlite3_expanded_sql(@NotNull sqlite3_stmt stmt);
 
-  static native int sqlite3_extended_errcode(@NotNull long ptrToDb);
+  private static native int sqlite3_extended_errcode(@NotNull long ptrToDb);
 
   public static int sqlite3_extended_errcode(@NotNull sqlite3 db){
     return sqlite3_extended_errcode(db.getNativePointer());
@@ -903,7 +898,7 @@ public final class CApi {
     @NotNull sqlite3 db, boolean on
   );
 
-  static native boolean sqlite3_get_autocommit(@NotNull long ptrToDb);
+  private static native boolean sqlite3_get_autocommit(@NotNull long ptrToDb);
 
   public static boolean sqlite3_get_autocommit(@NotNull sqlite3 db){
     return sqlite3_get_autocommit(db.getNativePointer());
@@ -913,7 +908,7 @@ public final class CApi {
     @NotNull sqlite3_context cx, int n
   );
 
-  static native int sqlite3_finalize(long ptrToStmt);
+  private static native int sqlite3_finalize(long ptrToStmt);
 
   public static int sqlite3_finalize(@NotNull sqlite3_stmt stmt){
     return null==stmt ? 0 : sqlite3_finalize(stmt.clearNativePointer());
@@ -1285,7 +1280,7 @@ public final class CApi {
     return sqlite3_prepare_multi(db, sql, 0, p);
   }
 
-  static native int sqlite3_preupdate_blobwrite(@NotNull long ptrToDb);
+  private static native int sqlite3_preupdate_blobwrite(@NotNull long ptrToDb);
 
   /**
      If the C API was built with SQLITE_ENABLE_PREUPDATE_HOOK defined, this
@@ -1296,7 +1291,7 @@ public final class CApi {
     return sqlite3_preupdate_blobwrite(db.getNativePointer());
   }
 
-  static native int sqlite3_preupdate_count(@NotNull long ptrToDb);
+  private static native int sqlite3_preupdate_count(@NotNull long ptrToDb);
 
   /**
      If the C API was built with SQLITE_ENABLE_PREUPDATE_HOOK defined, this
@@ -1307,7 +1302,7 @@ public final class CApi {
     return sqlite3_preupdate_count(db.getNativePointer());
   }
 
-  static native int sqlite3_preupdate_depth(@NotNull long ptrToDb);
+  private static native int sqlite3_preupdate_depth(@NotNull long ptrToDb);
 
   /**
      If the C API was built with SQLITE_ENABLE_PREUPDATE_HOOK defined, this
@@ -1318,7 +1313,7 @@ public final class CApi {
     return sqlite3_preupdate_depth(db.getNativePointer());
   }
 
-  static native PreupdateHookCallback sqlite3_preupdate_hook(
+  private static native PreupdateHookCallback sqlite3_preupdate_hook(
     @NotNull long ptrToDb, @Nullable PreupdateHookCallback hook
   );
 
@@ -1333,7 +1328,7 @@ public final class CApi {
     return sqlite3_preupdate_hook(db.getNativePointer(), hook);
   }
 
-  static native int sqlite3_preupdate_new(@NotNull long ptrToDb, int col,
+  private static native int sqlite3_preupdate_new(@NotNull long ptrToDb, int col,
                                                  @NotNull OutputPointer.sqlite3_value out);
 
   /**
@@ -1356,7 +1351,7 @@ public final class CApi {
     return out.take();
   }
 
-  static native int sqlite3_preupdate_old(@NotNull long ptrToDb, int col,
+  private static native int sqlite3_preupdate_old(@NotNull long ptrToDb, int col,
                                                  @NotNull OutputPointer.sqlite3_value out);
 
   /**
@@ -1407,7 +1402,7 @@ public final class CApi {
      results in the C-level sqlite3_result_error() being called with a
      complaint about the invalid argument.
   */
-  static native void sqlite3_result_error(
+  private static native void sqlite3_result_error(
     @NotNull sqlite3_context cx, @NotNull byte[] msg, int eTextRep
   );
 
@@ -1479,9 +1474,6 @@ public final class CApi {
      cross-language semantic mismatch and (B) Java doesn't need that
      argument for its intended purpose (type safety).
 
-     <p>Note that there is no sqlite3_column_java_object(), as the
-     C-level API has no sqlite3_column_pointer() to proxy.
-
      @see #sqlite3_value_java_object
      @see #sqlite3_bind_java_object
   */
@@ -1684,7 +1676,7 @@ public final class CApi {
     }
   }
 
-  static native RollbackHookCallback sqlite3_rollback_hook(
+  private static native RollbackHookCallback sqlite3_rollback_hook(
     @NotNull long ptrToDb, @Nullable RollbackHookCallback hook
   );
 
@@ -1740,13 +1732,13 @@ public final class CApi {
 
   public static native boolean sqlite3_stmt_busy(@NotNull sqlite3_stmt stmt);
 
-  static native int sqlite3_stmt_explain(@NotNull long ptrToStmt, int op);
+  private static native int sqlite3_stmt_explain(@NotNull long ptrToStmt, int op);
 
   public static int sqlite3_stmt_explain(@NotNull sqlite3_stmt stmt, int op){
     return sqlite3_stmt_explain(stmt.getNativePointer(), op);
   }
 
-  static native int sqlite3_stmt_isexplain(@NotNull long ptrToStmt);
+  private static native int sqlite3_stmt_isexplain(@NotNull long ptrToStmt);
 
   public static int sqlite3_stmt_isexplain(@NotNull sqlite3_stmt stmt){
     return sqlite3_stmt_isexplain(stmt.getNativePointer());
@@ -1796,7 +1788,7 @@ public final class CApi {
                            (int)escChar);
   }
 
-  static native int sqlite3_system_errno(@NotNull long ptrToDb);
+  private static native int sqlite3_system_errno(@NotNull long ptrToDb);
 
   public static int sqlite3_system_errno(@NotNull sqlite3 db){
     return sqlite3_system_errno(db.getNativePointer());
@@ -1842,13 +1834,13 @@ public final class CApi {
 
   public static native int sqlite3_threadsafe();
 
-  static native int sqlite3_total_changes(@NotNull long ptrToDb);
+  private static native int sqlite3_total_changes(@NotNull long ptrToDb);
 
   public static int sqlite3_total_changes(@NotNull sqlite3 db){
     return sqlite3_total_changes(db.getNativePointer());
   }
 
-  static native long sqlite3_total_changes64(@NotNull long ptrToDb);
+  private static native long sqlite3_total_changes64(@NotNull long ptrToDb);
 
   public static long sqlite3_total_changes64(@NotNull sqlite3 db){
     return sqlite3_total_changes64(db.getNativePointer());
@@ -1871,7 +1863,7 @@ public final class CApi {
     @NotNull sqlite3 db, @Nullable String zSchema
   );
 
-  static native UpdateHookCallback sqlite3_update_hook(
+  private static native UpdateHookCallback sqlite3_update_hook(
     @NotNull long ptrToDb, @Nullable UpdateHookCallback hook
   );
 
@@ -1891,67 +1883,67 @@ public final class CApi {
      sqlite3_create_function().
   */
 
-  static native byte[] sqlite3_value_blob(@NotNull long ptrToValue);
+  private static native byte[] sqlite3_value_blob(@NotNull long ptrToValue);
 
   public static byte[] sqlite3_value_blob(@NotNull sqlite3_value v){
     return sqlite3_value_blob(v.getNativePointer());
   }
 
-  static native int sqlite3_value_bytes(@NotNull long ptrToValue);
+  private static native int sqlite3_value_bytes(@NotNull long ptrToValue);
 
   public static int sqlite3_value_bytes(@NotNull sqlite3_value v){
     return sqlite3_value_bytes(v.getNativePointer());
   }
 
-  static native int sqlite3_value_bytes16(@NotNull long ptrToValue);
+  private static native int sqlite3_value_bytes16(@NotNull long ptrToValue);
 
   public static int sqlite3_value_bytes16(@NotNull sqlite3_value v){
     return sqlite3_value_bytes16(v.getNativePointer());
   }
 
-  static native double sqlite3_value_double(@NotNull long ptrToValue);
+  private static native double sqlite3_value_double(@NotNull long ptrToValue);
 
   public static double sqlite3_value_double(@NotNull sqlite3_value v){
     return sqlite3_value_double(v.getNativePointer());
   }
 
-  static native sqlite3_value sqlite3_value_dup(@NotNull long ptrToValue);
+  private static native sqlite3_value sqlite3_value_dup(@NotNull long ptrToValue);
 
   public static sqlite3_value sqlite3_value_dup(@NotNull sqlite3_value v){
     return sqlite3_value_dup(v.getNativePointer());
   }
 
-  static native int sqlite3_value_encoding(@NotNull long ptrToValue);
+  private static native int sqlite3_value_encoding(@NotNull long ptrToValue);
 
   public static int sqlite3_value_encoding(@NotNull sqlite3_value v){
     return sqlite3_value_encoding(v.getNativePointer());
   }
 
-  static native void sqlite3_value_free(@Nullable long ptrToValue);
+  private static native void sqlite3_value_free(@Nullable long ptrToValue);
 
   public static void sqlite3_value_free(@Nullable sqlite3_value v){
-    sqlite3_value_free(v.getNativePointer());
+    if( null!=v ) sqlite3_value_free(v.clearNativePointer());
   }
 
-  static native boolean sqlite3_value_frombind(@NotNull long ptrToValue);
+  private static native boolean sqlite3_value_frombind(@NotNull long ptrToValue);
 
   public static boolean sqlite3_value_frombind(@NotNull sqlite3_value v){
     return sqlite3_value_frombind(v.getNativePointer());
   }
 
-  static native int sqlite3_value_int(@NotNull long ptrToValue);
+  private static native int sqlite3_value_int(@NotNull long ptrToValue);
 
   public static int sqlite3_value_int(@NotNull sqlite3_value v){
     return sqlite3_value_int(v.getNativePointer());
   }
 
-  static native long sqlite3_value_int64(@NotNull long ptrToValue);
+  private static native long sqlite3_value_int64(@NotNull long ptrToValue);
 
   public static long sqlite3_value_int64(@NotNull sqlite3_value v){
     return sqlite3_value_int64(v.getNativePointer());
   }
 
-  static native Object sqlite3_value_java_object(@NotNull long ptrToValue);
+  private static native Object sqlite3_value_java_object(@NotNull long ptrToValue);
 
   /**
      If the given value was set using {@link
@@ -1977,25 +1969,25 @@ public final class CApi {
     return type.isInstance(o) ? (T)o : null;
   }
 
-  static native int sqlite3_value_nochange(@NotNull long ptrToValue);
+  private static native int sqlite3_value_nochange(@NotNull long ptrToValue);
 
   public static int sqlite3_value_nochange(@NotNull sqlite3_value v){
     return sqlite3_value_nochange(v.getNativePointer());
   }
 
-  static native int sqlite3_value_numeric_type(@NotNull long ptrToValue);
+  private static native int sqlite3_value_numeric_type(@NotNull long ptrToValue);
 
   public static int sqlite3_value_numeric_type(@NotNull sqlite3_value v){
     return sqlite3_value_numeric_type(v.getNativePointer());
   }
 
-  static native int sqlite3_value_subtype(@NotNull long ptrToValue);
+  private static native int sqlite3_value_subtype(@NotNull long ptrToValue);
 
   public static int sqlite3_value_subtype(@NotNull sqlite3_value v){
     return sqlite3_value_subtype(v.getNativePointer());
   }
 
-  static native byte[] sqlite3_value_text(@NotNull long ptrToValue);
+  private static native byte[] sqlite3_value_text(@NotNull long ptrToValue);
 
   /**
      Functions identially to the C API, and this note is just to
@@ -2007,13 +1999,13 @@ public final class CApi {
     return sqlite3_value_text(v.getNativePointer());
   }
 
-  static native String sqlite3_value_text16(@NotNull long ptrToValue);
+  private static native String sqlite3_value_text16(@NotNull long ptrToValue);
 
   public static String sqlite3_value_text16(@NotNull sqlite3_value v){
     return sqlite3_value_text16(v.getNativePointer());
   }
 
-  static native int sqlite3_value_type(@NotNull long ptrToValue);
+  private static native int sqlite3_value_type(@NotNull long ptrToValue);
 
   public static int sqlite3_value_type(@NotNull sqlite3_value v){
     return sqlite3_value_type(v.getNativePointer());
index 901317f0ef35533983acaf9a3544c47b8d803d84..cc6f2e6e8d88c8278cef2699041e906e37eb3ce9 100644 (file)
@@ -38,6 +38,6 @@ public final class sqlite3 extends NativePointerHolder<sqlite3>
   }
 
   @Override public void close(){
-    CApi.sqlite3_close_v2(this.clearNativePointer());
+    CApi.sqlite3_close_v2(this);
   }
 }
index 3b8b71f8a5bf4c8aa795ee484348b01c7e6ee5cd..564891c72799f5b6cb2ae09d1169ef4dda5351bc 100644 (file)
@@ -25,6 +25,6 @@ public final class sqlite3_stmt extends NativePointerHolder<sqlite3_stmt>
   private sqlite3_stmt(){}
 
   @Override public void close(){
-    CApi.sqlite3_finalize(this.clearNativePointer());
+    CApi.sqlite3_finalize(this);
   }
 }
index e1f54ab601426ab7decbfc29fcde24539994d54a..242ef22173286ab82eb46132af58e130788fddbe 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Flesh\sout\s[7a63b5b65a79]\sto\sbe\sable\sto\sbuild\sJNI\swith\sor\swithout\sSQLITE_ENABLE_COLUMN_METADATA.
-D 2023-11-07T13:22:49.498
+C Diverse\sminor\scleanups\sin\sthe\sJNI\spieces.
+D 2023-11-07T13:44:29.266
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -241,7 +241,7 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3
 F ext/jni/GNUmakefile df91212d772011e3d39712a0e38586856c42528b6ee3d507a5bb3b3248c0ecbc
 F ext/jni/README.md ef9ac115e97704ea995d743b4a8334e23c659e5534c3b64065a5405256d5f2f4
 F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa
-F ext/jni/src/c/sqlite3-jni.c ac7aa8ef250be4bebf99aa5b610d4a1b5f26578328a458a53db3b075271417ed
+F ext/jni/src/c/sqlite3-jni.c 62455cadfc32d52c525b56c521467586a1704865556426cd648af642a770b6b6
 F ext/jni/src/c/sqlite3-jni.h 9300900f7ec91fffa01445e1ad5815e35a7bece4c9ca07de464641f77195404a
 F ext/jni/src/org/sqlite/jni/annotation/NotNull.java a99341e88154e70447596b1af6a27c586317df41a7e0f246fd41370cd7b723b2
 F ext/jni/src/org/sqlite/jni/annotation/Nullable.java 0b1879852707f752512d4db9d7edd0d8db2f0c2612316ce1c832715e012ff6ba
@@ -251,7 +251,7 @@ F ext/jni/src/org/sqlite/jni/capi/AggregateFunction.java 0b72cdff61533b564d65b63
 F ext/jni/src/org/sqlite/jni/capi/AuthorizerCallback.java c045a5b47e02bb5f1af91973814a905f12048c428a3504fbc5266d1c1be3de5a
 F ext/jni/src/org/sqlite/jni/capi/AutoExtensionCallback.java 74cc4998a73d6563542ecb90804a3c4f4e828cb4bd69e61226d1a51f4646e759
 F ext/jni/src/org/sqlite/jni/capi/BusyHandlerCallback.java 7b8e19810c42b0ad21a04b5d8c804b32ee5905d137148703f16a75b612c380ca
-F ext/jni/src/org/sqlite/jni/capi/CApi.java 75b92b98ee1e621e71466e4bdb3bdff580da688e9873524adffd97db12675eb1
+F ext/jni/src/org/sqlite/jni/capi/CApi.java 27e3c73685e1068e51331cd083152e0a6357b02278cb67b7c103240dbc262a5d
 F ext/jni/src/org/sqlite/jni/capi/CallbackProxy.java 57e2d275dcebe690b1fc1f3d34eb96879b2d7039bce30b563aee547bf45d8a8b
 F ext/jni/src/org/sqlite/jni/capi/CollationCallback.java e29bcfc540fdd343e2f5cca4d27235113f2886acb13380686756d5cabdfd065a
 F ext/jni/src/org/sqlite/jni/capi/CollationNeededCallback.java 5bfa226a8e7a92e804fd52d6e42b4c7b875fa7a94f8e2c330af8cc244a8920ab
@@ -276,11 +276,11 @@ F ext/jni/src/org/sqlite/jni/capi/ValueHolder.java 22d365746a78c5cd7ae10c39444eb
 F ext/jni/src/org/sqlite/jni/capi/WindowFunction.java caf4396f91b2567904cf94bc538a069fd62260d975bd037d15a02a890ed1ef9e
 F ext/jni/src/org/sqlite/jni/capi/XDestroyCallback.java f3abb8dd7381f53ebba909437090caf68200f06717b8a7d6aa96fa3e8133117d
 F ext/jni/src/org/sqlite/jni/capi/package-info.java 08ff986a65d2be9162442c82d28a65ce431d826f188520717c2ecb1484d0a50e
-F ext/jni/src/org/sqlite/jni/capi/sqlite3.java 4010bbebc5bf44e2044e610786088cdee7dc155da2b333c0551492ff1cedf33b
+F ext/jni/src/org/sqlite/jni/capi/sqlite3.java c6a5c555d163d76663534f2b2cce7cab15325b9852d0f58c6688a85e73ae52f0
 F ext/jni/src/org/sqlite/jni/capi/sqlite3_backup.java 6742b431cd4d77e8000c1f92ec66265a58414c86bf3b0b5fbcb1164e08477227
 F ext/jni/src/org/sqlite/jni/capi/sqlite3_blob.java f204ab6ab1263e119fe43730141a00662d80972129a5351dfb11aae5d282df36
 F ext/jni/src/org/sqlite/jni/capi/sqlite3_context.java f0ef982009c335c4393ffcb68051809ca1711e4f47bcb8d1d46952f22c01bc22
-F ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java ff579621e9bd5ffbc6b2ef9f996c12db4df6e0c8cc5697c91273e5fca279fcf8
+F ext/jni/src/org/sqlite/jni/capi/sqlite3_stmt.java 293b5fa7d5b5724c87de544654aca1103d76f3092bc2c8f4360102a65ba25dff
 F ext/jni/src/org/sqlite/jni/capi/sqlite3_value.java e1d62a257c13504b46d39d5c21c49cf157ad73fda00cc5f34c931aa008c37049
 F ext/jni/src/org/sqlite/jni/fts5/Fts5.java e94681023785f1eff5399f0ddc82f46b035977d350f14838db659236ebdf6b41
 F ext/jni/src/org/sqlite/jni/fts5/Fts5Context.java 338637e6e5a2cc385d962b220f3c1f475cc371d12ae43d18ef27327b6e6225f7
@@ -2142,8 +2142,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 7a63b5b65a79d15658a160d0878c7371941c67e9b48a7442762c68c60b77288a
-R efbde6eb422be28e0f5c5e7a6eec616d
+P fcee41b3d4d2558299ead28cc17f290b9ff1957a84c3feaa0a24872feeb22901
+R 2e556ea528a12ae342b294a8936cf3da
 U stephan
-Z adceda1b2796226e98fdf1b3f6f9cd13
+Z 63d82a638a6f714cab2831b5cda37824
 # Remove this line to create a well-formed Fossil manifest.
index 26896fc11aa2d904df89b13c94f0b69f1802f1a3..8908c89a682365fa43b636bc5b4412c394c2ecc8 100644 (file)
@@ -1 +1 @@
-fcee41b3d4d2558299ead28cc17f290b9ff1957a84c3feaa0a24872feeb22901
\ No newline at end of file
+35233dd900632b997b5e532170a3b2af0ca7f1dccb8407555b93f2b395b0f7b4
\ No newline at end of file