1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Expose sqlite3_stmt_status() to JNI.

FossilOrigin-Name: d266acc23ecb7e76c8c68c6e89a76e6f3054f33f0262e60e06b258db5a5e2ccd
This commit is contained in:
stephan
2023-09-03 12:32:09 +00:00
parent 1943356268
commit 286f30f85c
6 changed files with 33 additions and 11 deletions

View File

@ -4314,6 +4314,14 @@ S3JniApi(sqlite3_status64(),jint,1status64)(
return (jint)rc;
}
S3JniApi(sqlite3_stmt_status(),jint,1stmt_1status)(
JniArgsEnvClass, jobject jStmt, jint op, jboolean reset
){
return sqlite3_stmt_status(PtrGet_sqlite3_stmt(jStmt),
(int)op, reset ? 1 : 0);
}
static int s3jni_strlike_glob(int isLike, JNIEnv *const env,
jbyteArray baG, jbyteArray baT, jint escLike){
int rc = 0;

View File

@ -1803,6 +1803,14 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1stmt_1isexplain
JNIEXPORT jboolean JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1stmt_1readonly
(JNIEnv *, jclass, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_stmt_status
* Signature: (Lorg/sqlite/jni/sqlite3_stmt;IZ)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1stmt_1status
(JNIEnv *, jclass, jobject, jint, jboolean);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_strglob

View File

@ -1431,6 +1431,11 @@ public final class SQLite3Jni {
@Canonical
public static native boolean sqlite3_stmt_readonly(@NotNull sqlite3_stmt stmt);
@Canonical
public static native int sqlite3_stmt_status(
@NotNull sqlite3_stmt stmt, int op, boolean reset
);
/**
Internal impl of the public sqlite3_strglob() method. Neither
argument may be null and both must be NUL-terminated UTF-8.

View File

@ -800,7 +800,7 @@ public class Tester1 implements Runnable {
int rc = sqlite3_create_function(db, "myfunc", 1, SQLITE_UTF8, func);
affirm(0 == rc);
sqlite3_stmt stmt = prepare(db, "select myfunc(a), myfunc(a+10) from t");
affirm( null != stmt );
affirm( 0==sqlite3_stmt_status(stmt, SQLITE_STMTSTATUS_RUN, false) );
int n = 0;
if( SQLITE_ROW == sqlite3_step(stmt) ){
int v = sqlite3_column_int(stmt, 0);
@ -812,6 +812,7 @@ public class Tester1 implements Runnable {
affirm( 1==n );
affirm(!xFinalNull.value);
sqlite3_reset(stmt);
affirm( 1==sqlite3_stmt_status(stmt, SQLITE_STMTSTATUS_RUN, false) );
// Ensure that the accumulator is reset on subsequent calls...
n = 0;
if( SQLITE_ROW == sqlite3_step(stmt) ){