mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
More work towards the new pointer-passing mechanism in JNI, and code-adjacent cleanups.
FossilOrigin-Name: 6c63987e893357dc8b10decaa96c30fb37b75481640a303e77a0d8224354491e
This commit is contained in:
@ -811,13 +811,13 @@ static void s3jni_incr( volatile unsigned int * const p ){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Helpers for jstring and jbyteArray. */
|
/* Helpers for jstring and jbyteArray. */
|
||||||
static const char * s3jni__jstring_to_mutf8_bytes(JNIEnv * const env, jstring v ){
|
static const char * s3jni__jstring_to_mutf8(JNIEnv * const env, jstring v ){
|
||||||
const char *z = v ? (*env)->GetStringUTFChars(env, v, NULL) : 0;
|
const char *z = v ? (*env)->GetStringUTFChars(env, v, NULL) : 0;
|
||||||
s3jni_oom_check( v ? !!z : !z );
|
s3jni_oom_check( v ? !!z : !z );
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define s3jni_jstring_to_mutf8(ARG) s3jni__jstring_to_mutf8_bytes(env, (ARG))
|
#define s3jni_jstring_to_mutf8(ARG) s3jni__jstring_to_mutf8(env, (ARG))
|
||||||
#define s3jni_mutf8_release(ARG,VAR) if( VAR ) (*env)->ReleaseStringUTFChars(env, ARG, VAR)
|
#define s3jni_mutf8_release(ARG,VAR) if( VAR ) (*env)->ReleaseStringUTFChars(env, ARG, VAR)
|
||||||
|
|
||||||
static jbyte * s3jni__jbyteArray_bytes(JNIEnv * const env, jbyteArray jBA ){
|
static jbyte * s3jni__jbyteArray_bytes(JNIEnv * const env, jbyteArray jBA ){
|
||||||
@ -1515,6 +1515,8 @@ static void S3JniDb_xDestroy(void *p){
|
|||||||
*/
|
*/
|
||||||
#define S3JniDb_from_c(sqlite3Ptr) \
|
#define S3JniDb_from_c(sqlite3Ptr) \
|
||||||
((sqlite3Ptr) ? S3JniDb_from_clientdata(sqlite3Ptr) : 0)
|
((sqlite3Ptr) ? S3JniDb_from_clientdata(sqlite3Ptr) : 0)
|
||||||
|
#define S3JniDb_from_jlong(sqlite3PtrAsLong) \
|
||||||
|
S3JniDb_from_c(S3JniLongPtr_T(sqlite3,sqlite3PtrAsLong))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Unref any Java-side state in (S3JniAutoExtension*) AX and zero out
|
** Unref any Java-side state in (S3JniAutoExtension*) AX and zero out
|
||||||
@ -2520,7 +2522,7 @@ static int s3jni_busy_handler(void* pState, int n){
|
|||||||
S3JniApi(sqlite3_busy_handler(),jint,1busy_1handler)(
|
S3JniApi(sqlite3_busy_handler(),jint,1busy_1handler)(
|
||||||
JniArgsEnvClass, jlong jpDb, jobject jBusy
|
JniArgsEnvClass, jlong jpDb, jobject jBusy
|
||||||
){
|
){
|
||||||
S3JniDb * const ps = S3JniDb_from_c(S3JniLongPtr_sqlite3(jpDb));
|
S3JniDb * const ps = S3JniDb_from_jlong(jpDb);
|
||||||
S3JniHook * const pHook = ps ? &ps->hooks.busyHandler : 0;
|
S3JniHook * const pHook = ps ? &ps->hooks.busyHandler : 0;
|
||||||
S3JniHook hook = S3JniHook_empty;
|
S3JniHook hook = S3JniHook_empty;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@ -2565,7 +2567,7 @@ S3JniApi(sqlite3_busy_handler(),jint,1busy_1handler)(
|
|||||||
S3JniApi(sqlite3_busy_timeout(),jint,1busy_1timeout)(
|
S3JniApi(sqlite3_busy_timeout(),jint,1busy_1timeout)(
|
||||||
JniArgsEnvClass, jlong jpDb, jint ms
|
JniArgsEnvClass, jlong jpDb, jint ms
|
||||||
){
|
){
|
||||||
S3JniDb * const ps = S3JniDb_from_c(S3JniLongPtr_sqlite3(jpDb));
|
S3JniDb * const ps = S3JniDb_from_jlong(jpDb);
|
||||||
int rc = SQLITE_MISUSE;
|
int rc = SQLITE_MISUSE;
|
||||||
if( ps ){
|
if( ps ){
|
||||||
S3JniDb_mutex_enter;
|
S3JniDb_mutex_enter;
|
||||||
@ -2604,7 +2606,7 @@ S3JniApi(sqlite3_cancel_auto_extension(),jboolean,1cancel_1auto_1extension)(
|
|||||||
/* Wrapper for sqlite3_close(_v2)(). */
|
/* Wrapper for sqlite3_close(_v2)(). */
|
||||||
static jint s3jni_close_db(JNIEnv * const env, jlong jpDb, int version){
|
static jint s3jni_close_db(JNIEnv * const env, jlong jpDb, int version){
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
S3JniDb * const ps = S3JniDb_from_c(S3JniLongPtr_sqlite3(jpDb));
|
S3JniDb * const ps = S3JniDb_from_jlong(jpDb);
|
||||||
|
|
||||||
assert(version == 1 || version == 2);
|
assert(version == 1 || version == 2);
|
||||||
if( ps ){
|
if( ps ){
|
||||||
@ -2666,14 +2668,14 @@ static void s3jni_collation_needed_impl16(void *pState, sqlite3 *pDb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
S3JniApi(sqlite3_collation_needed(),jint,1collation_1needed)(
|
S3JniApi(sqlite3_collation_needed(),jint,1collation_1needed)(
|
||||||
JniArgsEnvClass, jobject jDb, jobject jHook
|
JniArgsEnvClass, jlong jpDb, jobject jHook
|
||||||
){
|
){
|
||||||
S3JniDb * ps;
|
S3JniDb * ps;
|
||||||
S3JniCollationNeeded * pHook;
|
S3JniCollationNeeded * pHook;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
S3JniDb_mutex_enter;
|
S3JniDb_mutex_enter;
|
||||||
ps = S3JniDb_from_java(jDb);
|
ps = S3JniDb_from_jlong(jpDb);
|
||||||
if( !ps ){
|
if( !ps ){
|
||||||
S3JniDb_mutex_leave;
|
S3JniDb_mutex_leave;
|
||||||
return SQLITE_MISUSE;
|
return SQLITE_MISUSE;
|
||||||
@ -2816,13 +2818,13 @@ static void s3jni_rollback_hook_impl(void *pP){
|
|||||||
** sqlite3_rollback_hook().
|
** sqlite3_rollback_hook().
|
||||||
*/
|
*/
|
||||||
static jobject s3jni_commit_rollback_hook(int isCommit, JNIEnv * const env,
|
static jobject s3jni_commit_rollback_hook(int isCommit, JNIEnv * const env,
|
||||||
jobject jDb, jobject jHook){
|
jlong jpDb, jobject jHook){
|
||||||
S3JniDb * ps;
|
S3JniDb * ps;
|
||||||
jobject pOld = 0; /* previous hoook */
|
jobject pOld = 0; /* previous hoook */
|
||||||
S3JniHook * pHook; /* ps->hooks.commit|rollback */
|
S3JniHook * pHook; /* ps->hooks.commit|rollback */
|
||||||
|
|
||||||
S3JniDb_mutex_enter;
|
S3JniDb_mutex_enter;
|
||||||
ps = S3JniDb_from_java(jDb);
|
ps = S3JniDb_from_jlong(jpDb);
|
||||||
if( !ps ){
|
if( !ps ){
|
||||||
s3jni_db_error(ps->pDb, SQLITE_NOMEM, 0);
|
s3jni_db_error(ps->pDb, SQLITE_NOMEM, 0);
|
||||||
S3JniDb_mutex_leave;
|
S3JniDb_mutex_leave;
|
||||||
@ -2870,9 +2872,9 @@ static jobject s3jni_commit_rollback_hook(int isCommit, JNIEnv * const env,
|
|||||||
}
|
}
|
||||||
|
|
||||||
S3JniApi(sqlite3_commit_hook(),jobject,1commit_1hook)(
|
S3JniApi(sqlite3_commit_hook(),jobject,1commit_1hook)(
|
||||||
JniArgsEnvClass,jobject jDb, jobject jHook
|
JniArgsEnvClass, jlong jpDb, jobject jHook
|
||||||
){
|
){
|
||||||
return s3jni_commit_rollback_hook(1, env, jDb, jHook);
|
return s3jni_commit_rollback_hook(1, env, jpDb, jHook);
|
||||||
}
|
}
|
||||||
|
|
||||||
S3JniApi(sqlite3_compileoption_get(),jstring,1compileoption_1get)(
|
S3JniApi(sqlite3_compileoption_get(),jstring,1compileoption_1get)(
|
||||||
@ -2904,12 +2906,17 @@ S3JniApi(sqlite3_complete(),int,1complete)(
|
|||||||
S3JniApi(sqlite3_compileoption_used(),jboolean,1compileoption_1used)(
|
S3JniApi(sqlite3_compileoption_used(),jboolean,1compileoption_1used)(
|
||||||
JniArgsEnvClass, jstring name
|
JniArgsEnvClass, jstring name
|
||||||
){
|
){
|
||||||
const char *zUtf8 = s3jni_jstring_to_mutf8(name)
|
if( name ){
|
||||||
/* We know these to be ASCII, so MUTF-8 is fine. */;
|
const char *zUtf8 = s3jni_jstring_to_mutf8(name)
|
||||||
const jboolean rc =
|
/* We know these to be ASCII, so MUTF-8 is fine (and
|
||||||
0==sqlite3_compileoption_used(zUtf8) ? JNI_FALSE : JNI_TRUE;
|
hypothetically faster to convert). */;
|
||||||
s3jni_mutf8_release(name, zUtf8);
|
const jboolean rc =
|
||||||
return rc;
|
0==sqlite3_compileoption_used(zUtf8) ? JNI_FALSE : JNI_TRUE;
|
||||||
|
s3jni_mutf8_release(name, zUtf8);
|
||||||
|
return rc;
|
||||||
|
}else{
|
||||||
|
return JNI_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
S3JniApi(sqlite3_config() /*for a small subset of options.*/,
|
S3JniApi(sqlite3_config() /*for a small subset of options.*/,
|
||||||
@ -3118,7 +3125,7 @@ S3JniApi(sqlite3_create_collation() sqlite3_create_collation_v2(),
|
|||||||
|
|
||||||
S3JniDb_mutex_enter;
|
S3JniDb_mutex_enter;
|
||||||
ps = S3JniDb_from_java(jDb);
|
ps = S3JniDb_from_java(jDb);
|
||||||
if( !ps ){
|
if( !ps || !name ){
|
||||||
rc = SQLITE_MISUSE;
|
rc = SQLITE_MISUSE;
|
||||||
}else{
|
}else{
|
||||||
jclass const klazz = (*env)->GetObjectClass(env, oCollation);
|
jclass const klazz = (*env)->GetObjectClass(env, oCollation);
|
||||||
@ -3164,7 +3171,9 @@ S3JniApi(sqlite3_create_function() sqlite3_create_function_v2()
|
|||||||
sqlite3 * const pDb = PtrGet_sqlite3(jDb);
|
sqlite3 * const pDb = PtrGet_sqlite3(jDb);
|
||||||
char * zFuncName = 0;
|
char * zFuncName = 0;
|
||||||
|
|
||||||
if( !encodingTypeIsValid(eTextRep) ){
|
if( !pDb || !jFuncName ){
|
||||||
|
return SQLITE_MISUSE;
|
||||||
|
}else if( !encodingTypeIsValid(eTextRep) ){
|
||||||
return s3jni_db_error(pDb, SQLITE_FORMAT,
|
return s3jni_db_error(pDb, SQLITE_FORMAT,
|
||||||
"Invalid function encoding option.");
|
"Invalid function encoding option.");
|
||||||
}
|
}
|
||||||
@ -3793,7 +3802,7 @@ S3JniApi(sqlite3_preupdate_depth(),int,1preupdate_1depth)(
|
|||||||
** sqlite3_preupdate_hook() (if isPre is true).
|
** sqlite3_preupdate_hook() (if isPre is true).
|
||||||
*/
|
*/
|
||||||
static jobject s3jni_updatepre_hook(JNIEnv * env, int isPre, jlong jpDb, jobject jHook){
|
static jobject s3jni_updatepre_hook(JNIEnv * env, int isPre, jlong jpDb, jobject jHook){
|
||||||
S3JniDb * const ps = S3JniDb_from_c(S3JniLongPtr_sqlite3(jpDb));
|
S3JniDb * const ps = S3JniDb_from_jlong(jpDb);
|
||||||
jclass klazz;
|
jclass klazz;
|
||||||
jobject pOld = 0;
|
jobject pOld = 0;
|
||||||
jmethodID xCallback;
|
jmethodID xCallback;
|
||||||
@ -4211,9 +4220,9 @@ S3JniApi(sqlite3_result_zeroblob64(),jint,1result_1zeroblob64)(
|
|||||||
}
|
}
|
||||||
|
|
||||||
S3JniApi(sqlite3_rollback_hook(),jobject,1rollback_1hook)(
|
S3JniApi(sqlite3_rollback_hook(),jobject,1rollback_1hook)(
|
||||||
JniArgsEnvClass, jobject jDb, jobject jHook
|
JniArgsEnvClass, jlong jpDb, jobject jHook
|
||||||
){
|
){
|
||||||
return s3jni_commit_rollback_hook(0, env, jDb, jHook);
|
return s3jni_commit_rollback_hook(0, env, jpDb, jHook);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback for sqlite3_set_authorizer(). */
|
/* Callback for sqlite3_set_authorizer(). */
|
||||||
|
@ -1198,18 +1198,18 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1column_1value
|
|||||||
/*
|
/*
|
||||||
* Class: org_sqlite_jni_SQLite3Jni
|
* Class: org_sqlite_jni_SQLite3Jni
|
||||||
* Method: sqlite3_collation_needed
|
* Method: sqlite3_collation_needed
|
||||||
* Signature: (Lorg/sqlite/jni/sqlite3;Lorg/sqlite/jni/CollationNeededCallback;)I
|
* Signature: (JLorg/sqlite/jni/CollationNeededCallback;)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1collation_1needed
|
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1collation_1needed
|
||||||
(JNIEnv *, jclass, jobject, jobject);
|
(JNIEnv *, jclass, jlong, jobject);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_sqlite_jni_SQLite3Jni
|
* Class: org_sqlite_jni_SQLite3Jni
|
||||||
* Method: sqlite3_commit_hook
|
* Method: sqlite3_commit_hook
|
||||||
* Signature: (Lorg/sqlite/jni/sqlite3;Lorg/sqlite/jni/CommitHookCallback;)Lorg/sqlite/jni/CommitHookCallback;
|
* Signature: (JLorg/sqlite/jni/CommitHookCallback;)Lorg/sqlite/jni/CommitHookCallback;
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1commit_1hook
|
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1commit_1hook
|
||||||
(JNIEnv *, jclass, jobject, jobject);
|
(JNIEnv *, jclass, jlong, jobject);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_sqlite_jni_SQLite3Jni
|
* Class: org_sqlite_jni_SQLite3Jni
|
||||||
@ -1758,10 +1758,10 @@ JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1result_1text64
|
|||||||
/*
|
/*
|
||||||
* Class: org_sqlite_jni_SQLite3Jni
|
* Class: org_sqlite_jni_SQLite3Jni
|
||||||
* Method: sqlite3_rollback_hook
|
* Method: sqlite3_rollback_hook
|
||||||
* Signature: (Lorg/sqlite/jni/sqlite3;Lorg/sqlite/jni/RollbackHookCallback;)Lorg/sqlite/jni/RollbackHookCallback;
|
* Signature: (JLorg/sqlite/jni/RollbackHookCallback;)Lorg/sqlite/jni/RollbackHookCallback;
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1rollback_1hook
|
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1rollback_1hook
|
||||||
(JNIEnv *, jclass, jobject, jobject);
|
(JNIEnv *, jclass, jlong, jobject);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_sqlite_jni_SQLite3Jni
|
* Class: org_sqlite_jni_SQLite3Jni
|
||||||
|
@ -92,6 +92,14 @@ public final class SQLite3Jni {
|
|||||||
//! Called from static init code.
|
//! Called from static init code.
|
||||||
private static native void init();
|
private static native void init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns a nul-terminated copy of s as a byte array, or null if s
|
||||||
|
is null.
|
||||||
|
*/
|
||||||
|
private static byte[] nulTerminateUtf8(String s){
|
||||||
|
return null==s ? null : (s+"\0").getBytes(StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Each thread which uses the SQLite3 JNI APIs should call
|
Each thread which uses the SQLite3 JNI APIs should call
|
||||||
sqlite3_jni_uncache_thread() when it is done with the library -
|
sqlite3_jni_uncache_thread() when it is done with the library -
|
||||||
@ -315,8 +323,8 @@ public final class SQLite3Jni {
|
|||||||
public static int sqlite3_bind_parameter_index(
|
public static int sqlite3_bind_parameter_index(
|
||||||
@NotNull sqlite3_stmt stmt, @NotNull String paramName
|
@NotNull sqlite3_stmt stmt, @NotNull String paramName
|
||||||
){
|
){
|
||||||
final byte[] utf8 = (paramName+"\0").getBytes(StandardCharsets.UTF_8);
|
final byte[] utf8 = nulTerminateUtf8(paramName);
|
||||||
return sqlite3_bind_parameter_index(stmt.getNativePointer(), utf8);
|
return null==utf8 ? 0 : sqlite3_bind_parameter_index(stmt.getNativePointer(), utf8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Canonical
|
@Canonical
|
||||||
@ -742,29 +750,43 @@ public final class SQLite3Jni {
|
|||||||
@NotNull sqlite3_stmt stmt, int ndx
|
@NotNull sqlite3_stmt stmt, int ndx
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@Canonical
|
||||||
|
static native int sqlite3_collation_needed(
|
||||||
|
@NotNull long ptrToDb, @Nullable CollationNeededCallback callback
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This functions like C's sqlite3_collation_needed16() because
|
This functions like C's sqlite3_collation_needed16() because
|
||||||
Java's string type is inherently compatible with that interface.
|
Java's string type is inherently compatible with that interface.
|
||||||
*/
|
*/
|
||||||
@Canonical
|
@Canonical
|
||||||
public static native int sqlite3_collation_needed(
|
public static int sqlite3_collation_needed(
|
||||||
@NotNull sqlite3 db, @Nullable CollationNeededCallback callback
|
@NotNull sqlite3 db, @Nullable CollationNeededCallback callback
|
||||||
|
){
|
||||||
|
return sqlite3_collation_needed(db.getNativePointer(), callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Canonical
|
||||||
|
static native CommitHookCallback sqlite3_commit_hook(
|
||||||
|
@NotNull long ptrToDb, @Nullable CommitHookCallback hook
|
||||||
);
|
);
|
||||||
|
|
||||||
@Canonical
|
@Canonical
|
||||||
public static native CommitHookCallback sqlite3_commit_hook(
|
public static CommitHookCallback sqlite3_commit_hook(
|
||||||
@NotNull sqlite3 db, @Nullable CommitHookCallback hook
|
@NotNull sqlite3 db, @Nullable CommitHookCallback hook
|
||||||
);
|
){
|
||||||
|
return sqlite3_commit_hook(db.getNativePointer(), hook);
|
||||||
|
}
|
||||||
|
|
||||||
@Canonical
|
@Canonical
|
||||||
public static native String sqlite3_compileoption_get(
|
public static native String sqlite3_compileoption_get(int n);
|
||||||
int n
|
|
||||||
);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Unlike the C API, returns false if its argument is NULL (as
|
||||||
|
opposed to invoking UB).
|
||||||
|
*/
|
||||||
@Canonical
|
@Canonical
|
||||||
public static native boolean sqlite3_compileoption_used(
|
public static native boolean sqlite3_compileoption_used(String optName);
|
||||||
@NotNull String optName
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This implementation is private because it's too easy to pass it
|
This implementation is private because it's too easy to pass it
|
||||||
@ -775,12 +797,13 @@ public final class SQLite3Jni {
|
|||||||
@NotNull byte[] nulTerminatedUtf8Sql
|
@NotNull byte[] nulTerminatedUtf8Sql
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Unlike this C API, this returns SQLITE_MISUSE if its argument is
|
||||||
|
null (as opposed to invoking UB).
|
||||||
|
*/
|
||||||
@Canonical()
|
@Canonical()
|
||||||
public static int sqlite3_complete(@NotNull String sql){
|
public static int sqlite3_complete(String sql){
|
||||||
/* Design note: we don't implement this in native code because we
|
return null==sql ? SQLITE_MISUSE : sqlite3_complete( nulTerminateUtf8(sql) );
|
||||||
won't get a NUL-terminated string there unless we make our own
|
|
||||||
copy to add a terminator. That's much easier to do here. */
|
|
||||||
return sqlite3_complete( (sql+"\0").getBytes(StandardCharsets.UTF_8) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -828,11 +851,19 @@ public final class SQLite3Jni {
|
|||||||
@Canonical(comment="Option subset: SQLITE_CONFIG_LOG")
|
@Canonical(comment="Option subset: SQLITE_CONFIG_LOG")
|
||||||
public static native int sqlite3_config( @Nullable ConfigLogCallback logger );
|
public static native int sqlite3_config( @Nullable ConfigLogCallback logger );
|
||||||
|
|
||||||
|
/**
|
||||||
|
Unlike this C API, this returns null if its argument is
|
||||||
|
null (as opposed to invoking UB).
|
||||||
|
*/
|
||||||
@Canonical
|
@Canonical
|
||||||
public static native sqlite3 sqlite3_context_db_handle(
|
public static native sqlite3 sqlite3_context_db_handle(
|
||||||
@NotNull sqlite3_context cx
|
@NotNull sqlite3_context cx
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Unlike this C API, this returns SQLITE_MISUSE if its db or name
|
||||||
|
arguments are null (as opposed to invoking UB).
|
||||||
|
*/
|
||||||
@Canonical
|
@Canonical
|
||||||
public static native int sqlite3_create_collation(
|
public static native int sqlite3_create_collation(
|
||||||
@NotNull sqlite3 db, @NotNull String name, int eTextRep,
|
@NotNull sqlite3 db, @NotNull String name, int eTextRep,
|
||||||
@ -846,6 +877,9 @@ public final class SQLite3Jni {
|
|||||||
depends on which methods the final argument implements. See
|
depends on which methods the final argument implements. See
|
||||||
SQLFunction's subclasses (ScalarFunction, AggregateFunction<T>,
|
SQLFunction's subclasses (ScalarFunction, AggregateFunction<T>,
|
||||||
and WindowFunction<T>) for details.
|
and WindowFunction<T>) for details.
|
||||||
|
|
||||||
|
Unlike this C API, this returns SQLITE_MISUSE null if its db or
|
||||||
|
functionName arguments are null (as opposed to invoking UB).
|
||||||
*/
|
*/
|
||||||
@Canonical
|
@Canonical
|
||||||
public static native int sqlite3_create_function(
|
public static native int sqlite3_create_function(
|
||||||
@ -865,6 +899,9 @@ public final class SQLite3Jni {
|
|||||||
Overload for sqlite3_db_config() calls which take (int,int*)
|
Overload for sqlite3_db_config() calls which take (int,int*)
|
||||||
variadic arguments. Returns SQLITE_MISUSE if op is not one of the
|
variadic arguments. Returns SQLITE_MISUSE if op is not one of the
|
||||||
SQLITE_DBCONFIG_... options which uses this call form.
|
SQLITE_DBCONFIG_... options which uses this call form.
|
||||||
|
|
||||||
|
Unlike this C API, this returns SQLITE_MISUSE if its db argument
|
||||||
|
are null (as opposed to invoking UB).
|
||||||
*/
|
*/
|
||||||
@Canonical
|
@Canonical
|
||||||
public static native int sqlite3_db_config(
|
public static native int sqlite3_db_config(
|
||||||
@ -1771,10 +1808,17 @@ public final class SQLite3Jni {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Canonical
|
@Canonical
|
||||||
public static native RollbackHookCallback sqlite3_rollback_hook(
|
static native RollbackHookCallback sqlite3_rollback_hook(
|
||||||
@NotNull sqlite3 db, @Nullable RollbackHookCallback hook
|
@NotNull long ptrToDb, @Nullable RollbackHookCallback hook
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@Canonical
|
||||||
|
public static RollbackHookCallback sqlite3_rollback_hook(
|
||||||
|
@NotNull sqlite3 db, @Nullable RollbackHookCallback hook
|
||||||
|
){
|
||||||
|
return sqlite3_rollback_hook(db.getNativePointer(), hook);
|
||||||
|
}
|
||||||
|
|
||||||
@Canonical
|
@Canonical
|
||||||
public static native int sqlite3_set_authorizer(
|
public static native int sqlite3_set_authorizer(
|
||||||
@NotNull sqlite3 db, @Nullable AuthorizerCallback auth
|
@NotNull sqlite3 db, @Nullable AuthorizerCallback auth
|
||||||
@ -1876,10 +1920,8 @@ public final class SQLite3Jni {
|
|||||||
public static int sqlite3_strglob(
|
public static int sqlite3_strglob(
|
||||||
@NotNull String glob, @NotNull String txt
|
@NotNull String glob, @NotNull String txt
|
||||||
){
|
){
|
||||||
return sqlite3_strglob(
|
return sqlite3_strglob(nulTerminateUtf8(glob),
|
||||||
(glob+"\0").getBytes(StandardCharsets.UTF_8),
|
nulTerminateUtf8(txt));
|
||||||
(txt+"\0").getBytes(StandardCharsets.UTF_8)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1895,11 +1937,9 @@ public final class SQLite3Jni {
|
|||||||
public static int sqlite3_strlike(
|
public static int sqlite3_strlike(
|
||||||
@NotNull String glob, @NotNull String txt, char escChar
|
@NotNull String glob, @NotNull String txt, char escChar
|
||||||
){
|
){
|
||||||
return sqlite3_strlike(
|
return sqlite3_strlike(nulTerminateUtf8(glob),
|
||||||
(glob+"\0").getBytes(StandardCharsets.UTF_8),
|
nulTerminateUtf8(txt),
|
||||||
(txt+"\0").getBytes(StandardCharsets.UTF_8),
|
(int)escChar);
|
||||||
(int)escChar
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Canonical
|
@Canonical
|
||||||
|
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
|||||||
C JNI:\scorrect\sa\sNullPointerException\striggered\svia\sSQLTester.
|
C More\swork\stowards\sthe\snew\spointer-passing\smechanism\sin\sJNI,\sand\scode-adjacent\scleanups.
|
||||||
D 2023-09-28T20:34:28.893
|
D 2023-09-30T09:41:58.693
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
@ -238,8 +238,8 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3
|
|||||||
F ext/jni/GNUmakefile 42e00052401b6dd41c0cdd53b31450606ea37486283abdb038dff9be74bff71e
|
F ext/jni/GNUmakefile 42e00052401b6dd41c0cdd53b31450606ea37486283abdb038dff9be74bff71e
|
||||||
F ext/jni/README.md 9fceaeb17cecdc5d699dfc83c0cbc3a03fdb3b86bf676381894166c73375ee75
|
F ext/jni/README.md 9fceaeb17cecdc5d699dfc83c0cbc3a03fdb3b86bf676381894166c73375ee75
|
||||||
F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa
|
F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa
|
||||||
F ext/jni/src/c/sqlite3-jni.c 9d5ea1bf8c7da874fdd6dc3f7cd05632c82e747fb6f4b4b3967f7aadae3ac910
|
F ext/jni/src/c/sqlite3-jni.c caab9e9fdb0b8d8682c730d9bbc166778971e86f443c3f6b57e70aca86236f0c
|
||||||
F ext/jni/src/c/sqlite3-jni.h 0c13ef53143ad6b3ed0e6b15f706f9f03e9c0c6c4f896a5846e4a68e58da83c8
|
F ext/jni/src/c/sqlite3-jni.h e3ec460570ef74f1f3d7725f93a8cf89840e1fee983741a7939c5dc992971df5
|
||||||
F ext/jni/src/org/sqlite/jni/AbstractCollationCallback.java 95e88ba04f4aac51ffec65693e878e234088b2f21b387f4e4285c8b72b33e436
|
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/AggregateFunction.java 7312486bc65fecdb91753c0a4515799194e031f45edbe16a6373cea18f404dc4
|
||||||
F ext/jni/src/org/sqlite/jni/AuthorizerCallback.java e6135be32f12bf140bffa39be7fd1a45ad83b2661ed49c08dbde04c8485feb38
|
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/ResultCode.java ba701f20213a5f259e94cfbfdd36eb7ac7ce7797f2c6c7fca2004ff12ce20f86
|
||||||
F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java d12352c0e22840de484ffa9b11ed5058bb0daca2e9f218055d3c54c947a273c4
|
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/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c
|
||||||
F ext/jni/src/org/sqlite/jni/SQLite3Jni.java bb7436bcac55480ae5c5ba62fb92861ea0e948c03bc1475ef202aa26a819ed61
|
F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 2cce647774f7f8511c3b61cd280c19d871b49c401155e3f17c346db5d05ac824
|
||||||
F ext/jni/src/org/sqlite/jni/ScalarFunction.java 6d387bb499fbe3bc13c53315335233dbf6a0c711e8fa7c521683219b041c614c
|
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/TableColumnMetadata.java 54511b4297fa28dcb3f49b24035e34ced10e3fd44fd0e458e784f4d6b0096dab
|
||||||
F ext/jni/src/org/sqlite/jni/Tester1.java 720e1efddd769d5785e95100ff48aa203f2288eea865326a1a81fd5af43ec3a5
|
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.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 4182f0275d5d65e04a130eeef4d44642a5ffeeb4b84430d240ea2605345f1404
|
P 0a873de76c0cbcd8e2eda3f0508e427f1dcb32b01798687c0545acfe10102179
|
||||||
R a2d8547ef3a0aabe5f166da28f6b427d
|
R 85f58d35114ff163d0c32151ce0233f3
|
||||||
U stephan
|
U stephan
|
||||||
Z 0bc34c11fb15e6b9fa15ab1d2bacfac5
|
Z 80cc94af82e9bdc221a901efb80be260
|
||||||
# Remove this line to create a well-formed Fossil manifest.
|
# Remove this line to create a well-formed Fossil manifest.
|
||||||
|
@ -1 +1 @@
|
|||||||
0a873de76c0cbcd8e2eda3f0508e427f1dcb32b01798687c0545acfe10102179
|
6c63987e893357dc8b10decaa96c30fb37b75481640a303e77a0d8224354491e
|
Reference in New Issue
Block a user