mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Adapt JNI sqlite3_bind_...() bindings to the new pointer-passing method and correct the mapping of sqlite3_bind_zeroblob64() to use zeroblob64() instead of zeroblob(). Related internal API renaming.
FossilOrigin-Name: 980d559fff6e55d1e2ef39f242a8a09313a936cfb141807db475bcceff924869
This commit is contained in:
@ -1435,13 +1435,6 @@ static void * NativePointerHolder__get(JNIEnv * env, jobject jNph,
|
||||
** will work, despite the incorrect macro name, so long as the
|
||||
** argument is a Java sqlite3 object, as this operation only has void
|
||||
** pointers to work with.
|
||||
**
|
||||
** PtrCast_T(X,Y) variant 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
|
||||
** now do the native pointer extraction in the Java side, rather than
|
||||
** the C side, because it's reportedly significantly faster.
|
||||
*/
|
||||
#define PtrGet_T(T,OBJ) (T*)NativePointerHolder_get(OBJ, S3JniNph(T))
|
||||
#define PtrGet_sqlite3(OBJ) PtrGet_T(sqlite3, OBJ)
|
||||
@ -1450,7 +1443,18 @@ static void * NativePointerHolder__get(JNIEnv * env, jobject jNph,
|
||||
#define PtrGet_sqlite3_context(OBJ) PtrGet_T(sqlite3_context, OBJ)
|
||||
#define PtrGet_sqlite3_stmt(OBJ) PtrGet_T(sqlite3_stmt, OBJ)
|
||||
#define PtrGet_sqlite3_value(OBJ) PtrGet_T(sqlite3_value, OBJ)
|
||||
#define PtrCast_T(T,JLongPtr) (T*)(JLongPtr)
|
||||
/*
|
||||
** S3JniLongPtr_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
|
||||
** now do the native pointer extraction in the Java side, rather than
|
||||
** the C side, because it's reportedly significantly faster.
|
||||
*/
|
||||
#define S3JniLongPtr_T(T,JLongPtr) (T*)(JLongPtr)
|
||||
#define S3JniLongPtr_sqlite3(JLongPtr) S3JniLongPtr_T(sqlite3,JLongPtr)
|
||||
#define S3JniLongPtr_sqlite3_backup(JLongPtr) S3JniLongPtr_T(sqlite3_backup,JLongPtr)
|
||||
#define S3JniLongPtr_sqlite3_stmt(JLongPtr) S3JniLongPtr_T(sqlite3_stmt,JLongPtr)
|
||||
|
||||
/*
|
||||
** Extracts the new S3JniDb instance from the free-list, or allocates
|
||||
@ -2031,7 +2035,6 @@ static void udf_xInverse(sqlite3_context* cx, int argc,
|
||||
return (jint)CName(PtrGet_sqlite3_value(jpSValue)); \
|
||||
}
|
||||
|
||||
WRAP_INT_STMT(1bind_1parameter_1count, sqlite3_bind_parameter_count)
|
||||
WRAP_INT_DB(1changes, sqlite3_changes)
|
||||
WRAP_INT64_DB(1changes64, sqlite3_changes64)
|
||||
WRAP_INT_STMT(1clear_1bindings, sqlite3_clear_bindings)
|
||||
@ -2235,7 +2238,7 @@ S3JniApi(sqlite3_backup_finish(),jint,1backup_1finish)(
|
||||
){
|
||||
int rc = 0;
|
||||
if( jpBack!=0 ){
|
||||
rc = sqlite3_backup_finish( PtrCast_T(sqlite3_backup,jpBack) );
|
||||
rc = sqlite3_backup_finish( S3JniLongPtr_sqlite3_backup(jpBack) );
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@ -2244,8 +2247,8 @@ S3JniApi(sqlite3_backup_init(),jobject,1backup_1init)(
|
||||
JniArgsEnvClass, jlong jpDbDest, jstring jTDest,
|
||||
jlong jpDbSrc, jstring jTSrc
|
||||
){
|
||||
sqlite3 * const pDest = PtrCast_T(sqlite3,jpDbDest);
|
||||
sqlite3 * const pSrc = PtrCast_T(sqlite3,jpDbSrc);
|
||||
sqlite3 * const pDest = S3JniLongPtr_sqlite3(jpDbDest);
|
||||
sqlite3 * const pSrc = S3JniLongPtr_sqlite3(jpDbSrc);
|
||||
char * const zDest = s3jni_jstring_to_utf8(jTDest, 0);
|
||||
char * const zSrc = s3jni_jstring_to_utf8(jTSrc, 0);
|
||||
jobject rv = 0;
|
||||
@ -2268,64 +2271,65 @@ S3JniApi(sqlite3_backup_init(),jobject,1backup_1init)(
|
||||
S3JniApi(sqlite3_backup_pagecount(),jint,1backup_1pagecount)(
|
||||
JniArgsEnvClass, jlong jpBack
|
||||
){
|
||||
return sqlite3_backup_pagecount(PtrCast_T(sqlite3_backup,jpBack));
|
||||
return sqlite3_backup_pagecount(S3JniLongPtr_sqlite3_backup(jpBack));
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_backup_remaining(),jint,1backup_1remaining)(
|
||||
JniArgsEnvClass, jlong jpBack
|
||||
){
|
||||
return sqlite3_backup_remaining(PtrCast_T(sqlite3_backup,jpBack));
|
||||
return sqlite3_backup_remaining(S3JniLongPtr_sqlite3_backup(jpBack));
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_backup_step(),jint,1backup_1step)(
|
||||
JniArgsEnvClass, jlong jpBack, jint nPage
|
||||
){
|
||||
return sqlite3_backup_step(PtrCast_T(sqlite3_backup,jpBack), (int)nPage);
|
||||
return sqlite3_backup_step(S3JniLongPtr_sqlite3_backup(jpBack), (int)nPage);
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_bind_blob(),jint,1bind_1blob)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx, jbyteArray baData, jint nMax
|
||||
JniArgsEnvClass, jlong jpStmt, jint ndx, jbyteArray baData, jint nMax
|
||||
){
|
||||
jbyte * const pBuf = baData ? s3jni_jbyteArray_bytes(baData) : 0;
|
||||
int rc;
|
||||
if( pBuf ){
|
||||
rc = sqlite3_bind_blob(PtrGet_sqlite3_stmt(jpStmt), (int)ndx,
|
||||
rc = sqlite3_bind_blob(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx,
|
||||
pBuf, (int)nMax, SQLITE_TRANSIENT);
|
||||
s3jni_jbyteArray_release(baData, pBuf);
|
||||
}else{
|
||||
rc = baData
|
||||
? SQLITE_NOMEM
|
||||
: sqlite3_bind_null( PtrGet_sqlite3_stmt(jpStmt), ndx );
|
||||
: sqlite3_bind_null( S3JniLongPtr_sqlite3_stmt(jpStmt), ndx );
|
||||
}
|
||||
return (jint)rc;
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_bind_double(),jint,1bind_1double)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx, jdouble val
|
||||
JniArgsEnvClass, jlong jpStmt, jint ndx, jdouble val
|
||||
){
|
||||
return (jint)sqlite3_bind_double(PtrGet_sqlite3_stmt(jpStmt), (int)ndx, (double)val);
|
||||
return (jint)sqlite3_bind_double(S3JniLongPtr_sqlite3_stmt(jpStmt),
|
||||
(int)ndx, (double)val);
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_bind_int(),jint,1bind_1int)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx, jint val
|
||||
JniArgsEnvClass, jlong jpStmt, jint ndx, jint val
|
||||
){
|
||||
return (jint)sqlite3_bind_int(PtrGet_sqlite3_stmt(jpStmt), (int)ndx, (int)val);
|
||||
return (jint)sqlite3_bind_int(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx, (int)val);
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_bind_int64(),jint,1bind_1int64)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx, jlong val
|
||||
JniArgsEnvClass, jlong jpStmt, jint ndx, jlong val
|
||||
){
|
||||
return (jint)sqlite3_bind_int64(PtrGet_sqlite3_stmt(jpStmt), (int)ndx, (sqlite3_int64)val);
|
||||
return (jint)sqlite3_bind_int64(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx, (sqlite3_int64)val);
|
||||
}
|
||||
|
||||
/*
|
||||
** Bind a new global ref to Object `val` using sqlite3_bind_pointer().
|
||||
*/
|
||||
S3JniApi(sqlite3_bind_java_object(),jint,1bind_1java_1object)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx, jobject val
|
||||
JniArgsEnvClass, jlong jpStmt, jint ndx, jobject val
|
||||
){
|
||||
sqlite3_stmt * const pStmt = PtrGet_sqlite3_stmt(jpStmt);
|
||||
int rc = 0;
|
||||
sqlite3_stmt * const pStmt = S3JniLongPtr_sqlite3_stmt(jpStmt);
|
||||
int rc = SQLITE_MISUSE;
|
||||
|
||||
if(pStmt){
|
||||
jobject const rv = val ? S3JniRefGlobal(val) : 0;
|
||||
@ -2334,26 +2338,32 @@ S3JniApi(sqlite3_bind_java_object(),jint,1bind_1java_1object)(
|
||||
S3Jni_jobject_finalizer);
|
||||
}else if(val){
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
}else{
|
||||
rc = SQLITE_MISUSE;
|
||||
rc = sqlite3_bind_null(pStmt, ndx);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_bind_null(),jint,1bind_1null)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx
|
||||
JniArgsEnvClass, jlong jpStmt, jint ndx
|
||||
){
|
||||
return (jint)sqlite3_bind_null(PtrGet_sqlite3_stmt(jpStmt), (int)ndx);
|
||||
return (jint)sqlite3_bind_null(S3JniLongPtr_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));
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_bind_parameter_index(),jint,1bind_1parameter_1index)(
|
||||
JniArgsEnvClass, jobject jpStmt, jbyteArray jName
|
||||
JniArgsEnvClass, jlong jpStmt, jbyteArray jName
|
||||
){
|
||||
int rc = 0;
|
||||
jbyte * const pBuf = s3jni_jbyteArray_bytes(jName);
|
||||
if( pBuf ){
|
||||
rc = sqlite3_bind_parameter_index(PtrGet_sqlite3_stmt(jpStmt),
|
||||
rc = sqlite3_bind_parameter_index(S3JniLongPtr_sqlite3_stmt(jpStmt),
|
||||
(const char *)pBuf);
|
||||
s3jni_jbyteArray_release(jName, pBuf);
|
||||
}
|
||||
@ -2361,23 +2371,18 @@ S3JniApi(sqlite3_bind_parameter_index(),jint,1bind_1parameter_1index)(
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_bind_parameter_name(),jstring,1bind_1parameter_1name)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx
|
||||
JniArgsEnvClass, jlong jpStmt, jint ndx
|
||||
){
|
||||
jstring rv = 0;
|
||||
const char *z =
|
||||
sqlite3_bind_parameter_name(PtrGet_sqlite3_stmt(jpStmt), (int)ndx);
|
||||
|
||||
if( z ){
|
||||
rv = s3jni_utf8_to_jstring(z, -1);
|
||||
}
|
||||
return rv;
|
||||
sqlite3_bind_parameter_name(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx);
|
||||
return z ? s3jni_utf8_to_jstring(z, -1) : 0;
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_bind_text(),jint,1bind_1text)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx, jbyteArray baData, jint nMax
|
||||
JniArgsEnvClass, jlong jpStmt, jint ndx, jbyteArray baData, jint nMax
|
||||
){
|
||||
jbyte * const pBuf = baData ? s3jni_jbyteArray_bytes(baData) : 0;
|
||||
int const rc = sqlite3_bind_text(PtrGet_sqlite3_stmt(jpStmt), (int)ndx,
|
||||
int const rc = sqlite3_bind_text(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx,
|
||||
(const char *)pBuf,
|
||||
(int)nMax, SQLITE_TRANSIENT);
|
||||
s3jni_jbyteArray_release(baData, pBuf);
|
||||
@ -2385,25 +2390,27 @@ S3JniApi(sqlite3_bind_text(),jint,1bind_1text)(
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_bind_text16(),jint,1bind_1text16)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx, jbyteArray baData, jint nMax
|
||||
JniArgsEnvClass, jlong jpStmt, jint ndx, jbyteArray baData, jint nMax
|
||||
){
|
||||
jbyte * const pBuf = baData ? s3jni_jbyteArray_bytes(baData) : 0;
|
||||
int const rc = sqlite3_bind_text16(PtrGet_sqlite3_stmt(jpStmt), (int)ndx,
|
||||
int const rc = sqlite3_bind_text16(S3JniLongPtr_sqlite3_stmt(jpStmt), (int)ndx,
|
||||
pBuf, (int)nMax, SQLITE_TRANSIENT);
|
||||
s3jni_jbyteArray_release(baData, pBuf);
|
||||
return (jint)rc;
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_bind_zeroblob(),jint,1bind_1zeroblob)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx, jint n
|
||||
JniArgsEnvClass, jlong jpStmt, jint ndx, jint n
|
||||
){
|
||||
return (jint)sqlite3_bind_zeroblob(PtrGet_sqlite3_stmt(jpStmt), (int)ndx, (int)n);
|
||||
return (jint)sqlite3_bind_zeroblob(S3JniLongPtr_sqlite3_stmt(jpStmt),
|
||||
(int)ndx, (int)n);
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_bind_zeroblob(),jint,1bind_1zeroblob64)(
|
||||
JniArgsEnvClass, jobject jpStmt, jint ndx, jlong n
|
||||
S3JniApi(sqlite3_bind_zeroblob64(),jint,1bind_1zeroblob64)(
|
||||
JniArgsEnvClass, jlong jpStmt, jint ndx, jlong n
|
||||
){
|
||||
return (jint)sqlite3_bind_zeroblob(PtrGet_sqlite3_stmt(jpStmt), (int)ndx, (sqlite3_uint64)n);
|
||||
return (jint)sqlite3_bind_zeroblob64(S3JniLongPtr_sqlite3_stmt(jpStmt),
|
||||
(int)ndx, (sqlite3_uint64)n);
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_blob_bytes(),jint,1blob_1bytes)(
|
||||
@ -3408,7 +3415,7 @@ S3JniApi(sqlite3_finalize(),jint,1finalize)(
|
||||
JniArgsEnvClass, jlong jpStmt
|
||||
){
|
||||
return jpStmt
|
||||
? sqlite3_finalize(PtrCast_T(sqlite3_stmt,jpStmt))
|
||||
? sqlite3_finalize(S3JniLongPtr_sqlite3_stmt(jpStmt))
|
||||
: 0;
|
||||
}
|
||||
|
||||
@ -3649,13 +3656,13 @@ jint sqlite3_jni_prepare_v123( int prepVersion, JNIEnv * const env, jclass self,
|
||||
goto end;
|
||||
}
|
||||
switch( prepVersion ){
|
||||
case 1: rc = sqlite3_prepare(PtrCast_T(sqlite3,jpDb), (const char *)pBuf,
|
||||
case 1: rc = sqlite3_prepare(S3JniLongPtr_sqlite3(jpDb), (const char *)pBuf,
|
||||
(int)nMax, &pStmt, &zTail);
|
||||
break;
|
||||
case 2: rc = sqlite3_prepare_v2(PtrCast_T(sqlite3,jpDb), (const char *)pBuf,
|
||||
case 2: rc = sqlite3_prepare_v2(S3JniLongPtr_sqlite3(jpDb), (const char *)pBuf,
|
||||
(int)nMax, &pStmt, &zTail);
|
||||
break;
|
||||
case 3: rc = sqlite3_prepare_v3(PtrCast_T(sqlite3,jpDb), (const char *)pBuf,
|
||||
case 3: rc = sqlite3_prepare_v3(S3JniLongPtr_sqlite3(jpDb), (const char *)pBuf,
|
||||
(int)nMax, (unsigned int)prepFlags,
|
||||
&pStmt, &zTail);
|
||||
break;
|
||||
|
@ -854,106 +854,106 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1backup_1step
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_blob
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I[BI)I
|
||||
* Signature: (JI[BI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1blob
|
||||
(JNIEnv *, jclass, jobject, jint, jbyteArray, jint);
|
||||
(JNIEnv *, jclass, jlong, jint, jbyteArray, jint);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_double
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;ID)I
|
||||
* Signature: (JID)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1double
|
||||
(JNIEnv *, jclass, jobject, jint, jdouble);
|
||||
(JNIEnv *, jclass, jlong, jint, jdouble);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_int
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;II)I
|
||||
* Signature: (JII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1int
|
||||
(JNIEnv *, jclass, jobject, jint, jint);
|
||||
(JNIEnv *, jclass, jlong, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_int64
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;IJ)I
|
||||
* Signature: (JIJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1int64
|
||||
(JNIEnv *, jclass, jobject, jint, jlong);
|
||||
(JNIEnv *, jclass, jlong, jint, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_java_object
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;ILjava/lang/Object;)I
|
||||
* Signature: (JILjava/lang/Object;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1java_1object
|
||||
(JNIEnv *, jclass, jobject, jint, jobject);
|
||||
(JNIEnv *, jclass, jlong, jint, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_null
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)I
|
||||
* Signature: (JI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1null
|
||||
(JNIEnv *, jclass, jobject, jint);
|
||||
(JNIEnv *, jclass, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_parameter_count
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;)I
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1parameter_1count
|
||||
(JNIEnv *, jclass, jobject);
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_parameter_index
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;[B)I
|
||||
* Signature: (J[B)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1parameter_1index
|
||||
(JNIEnv *, jclass, jobject, jbyteArray);
|
||||
(JNIEnv *, jclass, jlong, jbyteArray);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_parameter_name
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I)Ljava/lang/String;
|
||||
* Signature: (JI)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1parameter_1name
|
||||
(JNIEnv *, jclass, jobject, jint);
|
||||
(JNIEnv *, jclass, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_text
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I[BI)I
|
||||
* Signature: (JI[BI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1text
|
||||
(JNIEnv *, jclass, jobject, jint, jbyteArray, jint);
|
||||
(JNIEnv *, jclass, jlong, jint, jbyteArray, jint);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_text16
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;I[BI)I
|
||||
* Signature: (JI[BI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1text16
|
||||
(JNIEnv *, jclass, jobject, jint, jbyteArray, jint);
|
||||
(JNIEnv *, jclass, jlong, jint, jbyteArray, jint);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_zeroblob
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;II)I
|
||||
* Signature: (JII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1zeroblob
|
||||
(JNIEnv *, jclass, jobject, jint, jint);
|
||||
(JNIEnv *, jclass, jlong, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_bind_zeroblob64
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;IJ)I
|
||||
* Signature: (JIJ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1bind_1zeroblob64
|
||||
(JNIEnv *, jclass, jobject, jint, jlong);
|
||||
(JNIEnv *, jclass, jlong, jint, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
|
@ -207,55 +207,94 @@ public final class SQLite3Jni {
|
||||
return sqlite3_backup_step(b.getNativePointer(), nPage);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
private static native int sqlite3_bind_blob(
|
||||
@NotNull long ptrToStmt, int ndx, @Nullable byte[] data, int n
|
||||
);
|
||||
|
||||
/**
|
||||
Results are undefined if data is not null and n<0 || n>=data.length.
|
||||
*/
|
||||
@Canonical
|
||||
public static native int sqlite3_bind_blob(
|
||||
public static int sqlite3_bind_blob(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] data, int n
|
||||
);
|
||||
){
|
||||
return sqlite3_bind_blob(stmt.getNativePointer(), ndx, data, n);
|
||||
}
|
||||
|
||||
public static int sqlite3_bind_blob(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] data
|
||||
){
|
||||
return (null==data)
|
||||
? sqlite3_bind_null(stmt, ndx)
|
||||
: sqlite3_bind_blob(stmt, ndx, data, data.length);
|
||||
? sqlite3_bind_null(stmt.getNativePointer(), ndx)
|
||||
: sqlite3_bind_blob(stmt.getNativePointer(), ndx, data, data.length);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
public static native int sqlite3_bind_double(
|
||||
private static native int sqlite3_bind_double(
|
||||
@NotNull long ptrToStmt, int ndx, double v
|
||||
);
|
||||
|
||||
@Canonical
|
||||
public static int sqlite3_bind_double(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, double v
|
||||
){
|
||||
return sqlite3_bind_double(stmt.getNativePointer(), ndx, v);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
private static native int sqlite3_bind_int(
|
||||
@NotNull long ptrToStmt, int ndx, int v
|
||||
);
|
||||
|
||||
@Canonical
|
||||
public static native int sqlite3_bind_int(
|
||||
public static int sqlite3_bind_int(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, int v
|
||||
){
|
||||
return sqlite3_bind_int(stmt.getNativePointer(), ndx, v);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
private static native int sqlite3_bind_int64(
|
||||
@NotNull long ptrToStmt, int ndx, long v
|
||||
);
|
||||
|
||||
@Canonical
|
||||
public static native int sqlite3_bind_int64(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, long v
|
||||
public static int sqlite3_bind_int64(@NotNull sqlite3_stmt stmt, int ndx, long v){
|
||||
return sqlite3_bind_int64( stmt.getNativePointer(), ndx, v );
|
||||
}
|
||||
|
||||
private static native int sqlite3_bind_java_object(
|
||||
@NotNull long ptrToStmt, int ndx, @Nullable Object o
|
||||
);
|
||||
|
||||
/**
|
||||
Binds the given object at the given index.
|
||||
Binds the given object at the given index. If o is null then this behaves like
|
||||
sqlite3_bind_null().
|
||||
|
||||
@see #sqlite3_result_java_object
|
||||
*/
|
||||
public static native int sqlite3_bind_java_object(
|
||||
@NotNull sqlite3_stmt cx, int ndx, @Nullable Object o
|
||||
);
|
||||
public static int sqlite3_bind_java_object(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable Object o
|
||||
){
|
||||
return sqlite3_bind_java_object(stmt.getNativePointer(), ndx, o);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
public static native int sqlite3_bind_null(
|
||||
@NotNull sqlite3_stmt stmt, int ndx
|
||||
);
|
||||
private static native int sqlite3_bind_null(@NotNull long ptrToStmt, int ndx);
|
||||
|
||||
@Canonical
|
||||
public static native int sqlite3_bind_parameter_count(
|
||||
@NotNull sqlite3_stmt stmt
|
||||
);
|
||||
public static int sqlite3_bind_null(@NotNull sqlite3_stmt stmt, int ndx){
|
||||
return sqlite3_bind_null(stmt.getNativePointer(), ndx);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
private static native int sqlite3_bind_parameter_count(@NotNull long ptrToStmt);
|
||||
|
||||
@Canonical
|
||||
public static int sqlite3_bind_parameter_count(@NotNull sqlite3_stmt stmt){
|
||||
return sqlite3_bind_parameter_count(stmt.getNativePointer());
|
||||
}
|
||||
|
||||
/**
|
||||
Requires that paramName be a NUL-terminated UTF-8 string.
|
||||
@ -269,7 +308,7 @@ public final class SQLite3Jni {
|
||||
*/
|
||||
@Canonical
|
||||
private static native int sqlite3_bind_parameter_index(
|
||||
@NotNull sqlite3_stmt stmt, @NotNull byte[] paramName
|
||||
@NotNull long ptrToStmt, @NotNull byte[] paramName
|
||||
);
|
||||
|
||||
@Canonical
|
||||
@ -277,12 +316,22 @@ public final class SQLite3Jni {
|
||||
@NotNull sqlite3_stmt stmt, @NotNull String paramName
|
||||
){
|
||||
final byte[] utf8 = (paramName+"\0").getBytes(StandardCharsets.UTF_8);
|
||||
return sqlite3_bind_parameter_index(stmt, utf8);
|
||||
return sqlite3_bind_parameter_index(stmt.getNativePointer(), utf8);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
public static native String sqlite3_bind_parameter_name(
|
||||
@NotNull sqlite3_stmt stmt, int index
|
||||
private static native String sqlite3_bind_parameter_name(
|
||||
@NotNull long ptrToStmt, int index
|
||||
);
|
||||
|
||||
@Canonical
|
||||
public static String sqlite3_bind_parameter_name(@NotNull sqlite3_stmt stmt, int index){
|
||||
return sqlite3_bind_parameter_name(stmt.getNativePointer(), index);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
private static native int sqlite3_bind_text(
|
||||
@NotNull long ptrToStmt, int ndx, @Nullable byte[] utf8, int maxBytes
|
||||
);
|
||||
|
||||
/**
|
||||
@ -295,9 +344,11 @@ public final class SQLite3Jni {
|
||||
undefined if data is not null and does not contain a NUL byte.
|
||||
*/
|
||||
@Canonical
|
||||
public static native int sqlite3_bind_text(
|
||||
public static int sqlite3_bind_text(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] utf8, int maxBytes
|
||||
);
|
||||
){
|
||||
return sqlite3_bind_text(stmt.getNativePointer(), ndx, utf8, maxBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
Converts data, if not null, to a UTF-8-encoded byte array and
|
||||
@ -307,9 +358,9 @@ public final class SQLite3Jni {
|
||||
public static int sqlite3_bind_text(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable String data
|
||||
){
|
||||
if(null == data) return sqlite3_bind_null(stmt, ndx);
|
||||
if( null==data ) return sqlite3_bind_null(stmt.getNativePointer(), ndx);
|
||||
final byte[] utf8 = data.getBytes(StandardCharsets.UTF_8);
|
||||
return sqlite3_bind_text(stmt, ndx, utf8, utf8.length);
|
||||
return sqlite3_bind_text(stmt.getNativePointer(), ndx, utf8, utf8.length);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -319,19 +370,26 @@ public final class SQLite3Jni {
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] utf8
|
||||
){
|
||||
return (null == utf8)
|
||||
? sqlite3_bind_null(stmt, ndx)
|
||||
: sqlite3_bind_text(stmt, ndx, utf8, utf8.length);
|
||||
? sqlite3_bind_null(stmt.getNativePointer(), ndx)
|
||||
: sqlite3_bind_text(stmt.getNativePointer(), ndx, utf8, utf8.length);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
private static native int sqlite3_bind_text16(
|
||||
@NotNull long ptrToStmt, int ndx, @Nullable byte[] data, int maxBytes
|
||||
);
|
||||
|
||||
/**
|
||||
Identical to the sqlite3_bind_text() overload with the same
|
||||
signature but requires that its input be encoded in UTF-16 in
|
||||
platform byte order.
|
||||
*/
|
||||
@Canonical
|
||||
public static native int sqlite3_bind_text16(
|
||||
public static int sqlite3_bind_text16(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] data, int maxBytes
|
||||
);
|
||||
){
|
||||
return sqlite3_bind_text16(stmt.getNativePointer(), ndx, data, maxBytes);
|
||||
}
|
||||
|
||||
/**
|
||||
Converts its string argument to UTF-16 and binds it as such, returning
|
||||
@ -343,7 +401,7 @@ public final class SQLite3Jni {
|
||||
){
|
||||
if(null == data) return sqlite3_bind_null(stmt, ndx);
|
||||
final byte[] bytes = data.getBytes(StandardCharsets.UTF_16);
|
||||
return sqlite3_bind_text16(stmt, ndx, bytes, bytes.length);
|
||||
return sqlite3_bind_text16(stmt.getNativePointer(), ndx, bytes, bytes.length);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -355,19 +413,27 @@ public final class SQLite3Jni {
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable byte[] data
|
||||
){
|
||||
return (null == data)
|
||||
? sqlite3_bind_null(stmt, ndx)
|
||||
: sqlite3_bind_text16(stmt, ndx, data, data.length);
|
||||
? sqlite3_bind_null(stmt.getNativePointer(), ndx)
|
||||
: sqlite3_bind_text16(stmt.getNativePointer(), ndx, data, data.length);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
public static native int sqlite3_bind_zeroblob(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, int n
|
||||
private static native int sqlite3_bind_zeroblob(@NotNull long ptrToStmt, int ndx, int n);
|
||||
|
||||
@Canonical
|
||||
public static int sqlite3_bind_zeroblob(@NotNull sqlite3_stmt stmt, int ndx, int n){
|
||||
return sqlite3_bind_zeroblob(stmt.getNativePointer(), ndx, n);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
private static native int sqlite3_bind_zeroblob64(
|
||||
@NotNull long ptrToStmt, int ndx, long n
|
||||
);
|
||||
|
||||
@Canonical
|
||||
public static native int sqlite3_bind_zeroblob64(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, long n
|
||||
);
|
||||
public static int sqlite3_bind_zeroblob64(@NotNull sqlite3_stmt stmt, int ndx, long n){
|
||||
return sqlite3_bind_zeroblob64(stmt.getNativePointer(), ndx, n);
|
||||
}
|
||||
|
||||
@Canonical
|
||||
public static native int sqlite3_blob_bytes(@NotNull sqlite3_blob blob);
|
||||
|
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Add\smissing\slicense\sheaders\sto\sJNI\sannotation\sclasses\sand\sextend\sthe\sdefinition\sof\s@NotNull\sto\sinclude\s0L\sas\sthe\sequivalent\sof\snull\sto\saccount\sfor\sthe\scurrent\srework\sof\show\spointers\sare\spassed\sfrom\sJava\sto\sC.
|
||||
D 2023-09-27T10:29:07.535
|
||||
C Adapt\sJNI\ssqlite3_bind_...()\sbindings\sto\sthe\snew\spointer-passing\smethod\sand\scorrect\sthe\smapping\sof\ssqlite3_bind_zeroblob64()\sto\suse\szeroblob64()\sinstead\sof\szeroblob().\sRelated\sinternal\sAPI\srenaming.
|
||||
D 2023-09-27T11:01:32.787
|
||||
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 75006d6766e33f7a747db7339609f979732b2eb89586ca6ff6486c4cfed740fa
|
||||
F ext/jni/src/c/sqlite3-jni.h c5ae22c939f122fe8009fb69855951abe715058fe5575f78085608a587201c53
|
||||
F ext/jni/src/c/sqlite3-jni.c 7e1e0cf2f06a1d6c813fd3b684b5712dc8cccc6927d5f5d2b89d796f75799fb1
|
||||
F ext/jni/src/c/sqlite3-jni.h d503e60cdb9ce98f19d7bdd17a8f1b911931b6dddcc80ebef10c8160a6daab0b
|
||||
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 7d185104c1395587bf36f10492beda7d78d6686c3e43200e81f0c38b5fabdc2f
|
||||
F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 24ca37368946b4fceabac1913c7a21dbe2a4a9f5db55350b4df2b45d169b4e5f
|
||||
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 48aeb1e2cdeb4aec85c4f63a1f809215cd4b473791169e72b5ddf6d6bdc2f7b7
|
||||
R a34c0eaabd3c3fa31bb3e5e381a8b931
|
||||
P bccdfeb9efde20410bde545893fb98ce5c0c4d04a8e7797b868ba8994120e1db
|
||||
R 07ea1023a2462cb72e478a493540d516
|
||||
U stephan
|
||||
Z 1792595153ca7945031ea25d28fafae5
|
||||
Z 250cebc4fc9c64e8ca5d6b6a65662ef8
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
bccdfeb9efde20410bde545893fb98ce5c0c4d04a8e7797b868ba8994120e1db
|
||||
980d559fff6e55d1e2ef39f242a8a09313a936cfb141807db475bcceff924869
|
Reference in New Issue
Block a user