mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Expose sqlite3_get/set_auxdata() to JNI.
FossilOrigin-Name: 0de3271717e0298070097d7ea0ecb996d2e95cf65384e494515a554d0a1dffed
This commit is contained in:
@ -1654,9 +1654,9 @@ static const char * const ResultJavaValuePtrStr = "org.sqlite.jni.ResultJavaVal"
|
||||
|
||||
/*
|
||||
** If v is not NULL, it must be a jobject global reference. Its
|
||||
** reference is relinquished and v is freed.
|
||||
** reference is relinquished.
|
||||
*/
|
||||
static void ResultJavaValue_finalizer(void *v){
|
||||
static void S3Jni_jobject_finalizer(void *v){
|
||||
if( v ){
|
||||
S3JniDeclLocal_env;
|
||||
S3JniUnrefGlobal((jobject)v);
|
||||
@ -2351,7 +2351,7 @@ S3JniApi(sqlite3_bind_java_object(),jint,1bind_1java_1object)(
|
||||
jobject const rv = val ? S3JniRefGlobal(val) : 0;
|
||||
if( rv ){
|
||||
rc = sqlite3_bind_pointer(pStmt, ndx, rv, ResultJavaValuePtrStr,
|
||||
ResultJavaValue_finalizer);
|
||||
S3Jni_jobject_finalizer);
|
||||
}else if(val){
|
||||
rc = SQLITE_NOMEM;
|
||||
}
|
||||
@ -3333,6 +3333,12 @@ S3JniApi(sqlite3_finalize(),jint,1finalize)(
|
||||
return rc;
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_get_auxdata(),jobject,1get_1auxdata)(
|
||||
JniArgsEnvClass, jobject jCx, jint n
|
||||
){
|
||||
return sqlite3_get_auxdata(PtrGet_sqlite3_context(jCx), (int)n);
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_initialize(),jint,1initialize)(
|
||||
JniArgsEnvClass
|
||||
){
|
||||
@ -4063,7 +4069,7 @@ S3JniApi(sqlite3_result_java_object(),void,1result_1java_1object)(
|
||||
jobject const rjv = S3JniRefGlobal(v);
|
||||
if( rjv ){
|
||||
sqlite3_result_pointer(PtrGet_sqlite3_context(jpCx), rjv,
|
||||
ResultJavaValuePtrStr, ResultJavaValue_finalizer);
|
||||
ResultJavaValuePtrStr, S3Jni_jobject_finalizer);
|
||||
}else{
|
||||
sqlite3_result_error_nomem(PtrGet_sqlite3_context(jpCx));
|
||||
}
|
||||
@ -4193,6 +4199,12 @@ S3JniApi(sqlite3_set_authorizer(),jint,1set_1authorizer)(
|
||||
return rc;
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_set_auxdata(),void,1set_1auxdata)(
|
||||
JniArgsEnvClass, jobject jCx, jint n, jobject jAux
|
||||
){
|
||||
sqlite3_set_auxdata(PtrGet_sqlite3_context(jCx), (int)n,
|
||||
S3JniRefGlobal(jAux), S3Jni_jobject_finalizer);
|
||||
}
|
||||
|
||||
S3JniApi(sqlite3_set_last_insert_rowid(),void,1set_1last_1insert_1rowid)(
|
||||
JniArgsEnvClass, jobject jpDb, jlong rowId
|
||||
|
@ -1283,6 +1283,22 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1db_1status
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errcode
|
||||
(JNIEnv *, jclass, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_errmsg
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3;)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errmsg
|
||||
(JNIEnv *, jclass, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_errstr
|
||||
* Signature: (I)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errstr
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_expanded_sql
|
||||
@ -1307,22 +1323,6 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1extended_1errcode
|
||||
JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1extended_1result_1codes
|
||||
(JNIEnv *, jclass, jobject, jboolean);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_errmsg
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3;)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errmsg
|
||||
(JNIEnv *, jclass, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_errstr
|
||||
* Signature: (I)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errstr
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_get_autocommit
|
||||
@ -1331,6 +1331,14 @@ JNIEXPORT jstring JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1errstr
|
||||
JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1get_1autocommit
|
||||
(JNIEnv *, jclass, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_get_auxdata
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_context;I)Ljava/lang/Object;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1get_1auxdata
|
||||
(JNIEnv *, jclass, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_error_offset
|
||||
@ -1691,6 +1699,14 @@ JNIEXPORT jobject JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1rollback_1hook
|
||||
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1set_1authorizer
|
||||
(JNIEnv *, jclass, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_set_auxdata
|
||||
* Signature: (Lorg/sqlite/jni/sqlite3_context;ILjava/lang/Object;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1set_1auxdata
|
||||
(JNIEnv *, jclass, jobject, jint, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_sqlite_jni_SQLite3Jni
|
||||
* Method: sqlite3_set_last_insert_rowid
|
||||
|
@ -665,6 +665,12 @@ public final class SQLite3Jni {
|
||||
@Canonical
|
||||
public static native int sqlite3_errcode(@NotNull sqlite3 db);
|
||||
|
||||
@Canonical
|
||||
public static native String sqlite3_errmsg(@NotNull sqlite3 db);
|
||||
|
||||
@Canonical
|
||||
public static native String sqlite3_errstr(int resultCode);
|
||||
|
||||
@Canonical
|
||||
public static native String sqlite3_expanded_sql(@NotNull sqlite3_stmt stmt);
|
||||
|
||||
@ -676,15 +682,14 @@ public final class SQLite3Jni {
|
||||
@NotNull sqlite3 db, boolean onoff
|
||||
);
|
||||
|
||||
@Canonical
|
||||
public static native String sqlite3_errmsg(@NotNull sqlite3 db);
|
||||
|
||||
@Canonical
|
||||
public static native String sqlite3_errstr(int resultCode);
|
||||
|
||||
@Canonical
|
||||
public static native boolean sqlite3_get_autocommit(@NotNull sqlite3 db);
|
||||
|
||||
@Canonical
|
||||
public static native Object sqlite3_get_auxdata(
|
||||
@NotNull sqlite3_context cx, int n
|
||||
);
|
||||
|
||||
/**
|
||||
Note that the returned byte offset values assume UTF-8-encoded
|
||||
inputs, so won't always match character offsets in Java Strings.
|
||||
@ -1365,6 +1370,11 @@ public final class SQLite3Jni {
|
||||
@NotNull sqlite3 db, @Nullable AuthorizerCallback auth
|
||||
);
|
||||
|
||||
@Canonical
|
||||
public static native void sqlite3_set_auxdata(
|
||||
@NotNull sqlite3_context cx, int n, @Nullable Object data
|
||||
);
|
||||
|
||||
@Canonical
|
||||
public static native void sqlite3_set_last_insert_rowid(
|
||||
@NotNull sqlite3 db, long rowid
|
||||
|
Reference in New Issue
Block a user