Export sqlite3_txn_state() to JNI.

FossilOrigin-Name: d732f71d0a292dbb493f79f7c6ecd8a4effbfbc91453b1c54bdd9becf2d75bdb
This commit is contained in:
stephan 2023-08-31 19:35:59 +00:00
parent 63e7ed3b44
commit 0d3f0a9c11
6 changed files with 56 additions and 10 deletions

View File

@ -4279,6 +4279,25 @@ S3JniApi(sqlite3_trace_v2(),jint,1trace_1v2)(
return rc;
}
S3JniApi(sqlite3_txn_state(),jint,1txn_1state)(
JniArgsEnvClass,jobject jDb, jstring jSchema
){
sqlite3 * const pDb = PtrGet_sqlite3(jDb);
int rc = SQLITE_MISUSE;
if( pDb ){
char * zSchema = jSchema
? s3jni_jstring_to_utf8(jSchema, 0)
: 0;
if( !jSchema || (zSchema && jSchema) ){
rc = sqlite3_txn_state(pDb, zSchema);
sqlite3_free(zSchema);
}else{
rc = SQLITE_NOMEM;
}
}
return rc;
}
S3JniApi(sqlite3_update_hook(),jobject,1update_1hook)(
JniArgsEnvClass, jobject jDb, jobject jHook
){

View File

@ -1699,6 +1699,14 @@ JNIEXPORT jlong JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1total_1changes64
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1trace_1v2
(JNIEnv *, jclass, jobject, jint, jobject);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_txn_state
* Signature: (Lorg/sqlite/jni/sqlite3;Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1txn_1state
(JNIEnv *, jclass, jobject, jstring);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_update_hook

View File

@ -1424,6 +1424,11 @@ public final class SQLite3Jni {
@NotNull sqlite3 db, int traceMask, @Nullable TraceV2Callback tracer
);
@Canonical
public static native int sqlite3_txn_state(
@NotNull sqlite3 db, @Nullable String zSchema
);
@Canonical
public static native UpdateHookCallback sqlite3_update_hook(
@NotNull sqlite3 db, @Nullable UpdateHookCallback hook

View File

@ -1396,6 +1396,20 @@ public class Tester1 implements Runnable {
sqlite3_close_v2(db);
}
private void testTxnState(){
sqlite3 db = createNewDb();
affirm( SQLITE_TXN_NONE == sqlite3_txn_state(db, null) );
execSql(db, "BEGIN;");
affirm( SQLITE_TXN_NONE == sqlite3_txn_state(db, null) );
execSql(db, "SELECT * FROM sqlite_schema;");
affirm( SQLITE_TXN_READ == sqlite3_txn_state(db, "main") );
execSql(db, "CREATE TABLE t(a);");
affirm( SQLITE_TXN_WRITE == sqlite3_txn_state(db, null) );
execSql(db, "ROLLBACK;");
affirm( SQLITE_TXN_NONE == sqlite3_txn_state(db, null) );
sqlite3_close_v2(db);
}
@ManualTest /* we really only want to run this test manually. */
private void testSleep(){
out("Sleeping briefly... ");

View File

@ -1,5 +1,5 @@
C Minor\sJNI\scleanups.
D 2023-08-31T18:34:43.613
C Export\ssqlite3_txn_state()\sto\sJNI.
D 2023-08-31T19:35:59.499
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -237,8 +237,8 @@ F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a3
F ext/jni/GNUmakefile b6ae6d04cc33f2300ab7177bd5db1ecfbc8627f76fee6aec441f980e57594291
F ext/jni/README.md 1332b1fa27918bd5d9ca2d0d4f3ac3a6ab86b9e3699dc5bfe32904a027f3d2a9
F ext/jni/jar-dist.make 030aaa4ae71dd86e4ec5e7c1e6cd86f9dfa47c4592c070d2e35157e42498e1fa
F ext/jni/src/c/sqlite3-jni.c 07b1b48cbc192b4316adf9581412fb280634e87eaf55302f529611b3f49e1c6c
F ext/jni/src/c/sqlite3-jni.h d9ea1662cefe7d8a2737cdbc55799a7e407cbc2239769f486d8eb33b68b9f133
F ext/jni/src/c/sqlite3-jni.c 6f66f0855f4adc908151d1d4072dd51423f70311b308e7040ca30ecd6d26224b
F ext/jni/src/c/sqlite3-jni.h d82c8b503d19a539bdc5ad6d495e8aaf0d04d3e330ab75a7a402734194908590
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 d00a2409ab76cae168927e2ca6a7ffbd0621a42547cce88768b4eeebc13827e0
@ -262,10 +262,10 @@ F ext/jni/src/org/sqlite/jni/ResultCode.java ba701f20213a5f259e94cfbfdd36eb7ac7c
F ext/jni/src/org/sqlite/jni/RollbackHookCallback.java 16042be9d072a26dbb2f1b1b63e7639989b747bb80d2bd667ba4f7555f56a825
F ext/jni/src/org/sqlite/jni/SQLFunction.java 544a875d33fd160467d82e2397ac33157b29971d715a821a4fad3c899113ee8c
F ext/jni/src/org/sqlite/jni/SQLite3CallbackProxy.java c2748ab52856075b053a55b317988d95dc7fb4d3d42520f8c33573effe1cd185
F ext/jni/src/org/sqlite/jni/SQLite3Jni.java ffabb0a0ed7f35cfdea41502888b1c616b7e9b262afd9f2cace527b7a7ec0631
F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 04163ebc06213bef77ac9c1cdb66d10e6f1fdcc1fc7a8628629529e1ee2c5940
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 96fefa219302e3e82f720baf082533fed98e6d31fe8887db5e14c150f1d2b3c1
F ext/jni/src/org/sqlite/jni/Tester1.java ca145b97e0cd5c39d5745dfa5ab7cf595a89b4b1f40dfb1928f4f6e79d3c0851
F ext/jni/src/org/sqlite/jni/TesterFts5.java 6f135c60e24c89e8eecb9fe61dde0f3bb2906de668ca6c9186bcf34bdaf94629
F ext/jni/src/org/sqlite/jni/TraceV2Callback.java 641926b05a772c2c05c842a81aa839053ba4a13b78ef04b402f5705d060c6246
F ext/jni/src/org/sqlite/jni/UpdateHookCallback.java be2bc96ff4f56b3c1fd18ae7dba9b207b25b6c123b8a5fd2f7aaf3cc208d8b7d
@ -2116,8 +2116,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 faf4e6d398f444d970be8b1364c984c67ccbc5f8a27f3aa93f05b8a8de7bec9b
R 67c1ebfb718bb21974f4c19c81901b59
P 2e2bb841ef8b53266ec48d8c3408d6396f29f17922e858eac1b4f12f4adeb05e
R 46c546f77881736213c45575c57e77e9
U stephan
Z 4fedefd0e23421552f6c24692e21e3ca
Z f333ee5f1318a9468223872999f97afe
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
2e2bb841ef8b53266ec48d8c3408d6396f29f17922e858eac1b4f12f4adeb05e
d732f71d0a292dbb493f79f7c6ecd8a4effbfbc91453b1c54bdd9becf2d75bdb