Commit Graph

410 Commits

Author SHA1 Message Date
stephan
4eabec5b18 JNI SQLTester: fix --new command to force-replace db if it already exists. Add no-op impls for --stmt-cache and --jsonglob commands.
FossilOrigin-Name: f1185dc349d076a6b8ea22f9b5cd527bfd60e9afd55eaec754c0e2b4d7edd5d4
2024-07-24 12:12:11 +00:00
stephan
f73912694b Minor typo fixes in test-script-interpreter.md.
FossilOrigin-Name: bf54b26092ded2e6acc779acfb960364f05c665c7626c38ffae61caae5636184
2024-07-18 19:17:29 +00:00
stephan
fe1d8210c7 Back out [99d11e6d0ae6] (enabling of STAT4 in WASM/JNI), per /chat discussion.
FossilOrigin-Name: cd7929ee2e2c305475fa5a4dff2edaccf90067126ef04a1c2714cf464925453f
2024-01-01 23:28:02 +00:00
stephan
307f326ba3 JNI: move the ByteBuffer-using APIs from public to package visibility for the time being because they have UB-inducing possibilities which need to be worked out. Update test code to account for a change in custom FTS5 columntext() impls.
FossilOrigin-Name: dc501275fcfab3ad9b6ebbadf7588b225a9dd07a0abac5be83d96f15bfba99e9
2024-01-01 06:58:32 +00:00
stephan
7a482b3bcd Use SQLITE_ENABLE_STAT4 in both the WASM and JNI builds.
FossilOrigin-Name: 99d11e6d0ae687ff6bac5119027f7b04d5e7185214e79cf8c56289cfa809b0f9
2023-12-31 04:01:36 +00:00
stephan
e982385619 Use SQLITE_STRICT_SUBTYPE=1 by default for the JNI and WASM builds unless they're explicitly built with SQLITE_STRICT_SUBTYPE=0.
FossilOrigin-Name: 990211357badf0ab08bd34cf6d25b58849d0fd8503e289c1839fc837a74e1909
2023-12-14 22:01:55 +00:00
stephan
1b963102b7 JNI: add more wrapper1 Sqlite.Blob tests.
FossilOrigin-Name: d63f6e1ffda9a88a37acc7862cb7ee8b9cd669b0fdba64c1ec9dd221cf807714
2023-11-15 08:59:53 +00:00
stephan
bd06d8672d JNI: clear out the sqlite3_context native pointer after calling UDF callbacks which do not have an argv (as was already done for those which have an argv). Add related tests and code commentary.
FossilOrigin-Name: 138f40543b26b2e02e27d830d92e30b12cfef5a8dc3f0b58b39c68e1b3c91cc6
2023-11-15 08:29:42 +00:00
stephan
4d6b10cdbe JNI doc updates.
FossilOrigin-Name: 1b1f36a206319e99ccaed969893ff95dcf3b8e97ed301544cf3cd3fee2780335
2023-11-15 06:28:51 +00:00
stephan
6b36312e8a JNI: add the @Experimental annotation and mark all java.nio.ByteBuffer-related methods with it.
FossilOrigin-Name: 0f4b223102e5dc9142c9d2cb8892b8d3cc476e579420028b93d4e12f4cf94d3e
2023-11-15 06:10:37 +00:00
stephan
973011432b JNI test code cleanups.
FossilOrigin-Name: 09142ac14347e6f41bbe50bc835920e271713452733a478ede547816cc291ace
2023-11-15 05:08:39 +00:00
stephan
d7ef0e8f87 JNI: add CONFIG_LOG and CONFIG_SQLLOG support to wrapper1. Code-adjacent cleanups.
FossilOrigin-Name: 83c49b9e71e5ae8852bab60a6fa630e22164c8efbf074c85450136781d0fffd3
2023-11-15 04:55:38 +00:00
stephan
253727b33d JNI: apply an internal level of API indirection to avoid having to work with massively-mangled names for the various sqlite3_config() overloads.
FossilOrigin-Name: 24f20663b1c4e13ff7d9a89e1df6af2e6f5730e5042ae6479e0a8c1bb846f313
2023-11-15 03:02:11 +00:00
stephan
5d59669711 JNI: reimplement Tester2.execSql() using the high-level API.
FossilOrigin-Name: 3a69679e41d23a760df349b2471a1ed306c087f9a7a7a2e2cba3723071dee6b2
2023-11-14 14:59:41 +00:00
stephan
cb3a0b1b67 JNI: add Sqlite.Stmt.step(boolean) overload which returns the result code of sqlite3_step() unless passed true, in which case it throws for any result other than ROW or DONE. The intent is to simplify handling of LOCKED and BUSY errors.
FossilOrigin-Name: f4f1cc201a7dc618a66617778ecf58ba60461ae700cb41f5c4abfa26dd0c0ed4
2023-11-14 14:38:11 +00:00
stephan
4ce5bc2836 JNI: use ByteBuffer.limit() instead of ByteBuffer.capacity() when figuring out where the logical end of a ByteBuffer is, for reasons explained at length in new code comments. This is unfortunately slower but is the correct way to do it.
FossilOrigin-Name: 51539419edc08ee6c70d8719d0f4d5ad47dd545a7fd9bf01d03a434aabd41d68
2023-11-14 05:33:44 +00:00
stephan
bdfc51dfef JNI: add sqlite3_blob_read_nio_buffer() and iron out the blob/ByteBuffer interface somewhat.
FossilOrigin-Name: 7df317b448a09ae77e2c68cc901fdb6d56a2246c1313f06bebd1f3e53f02c19b
2023-11-14 04:59:57 +00:00
stephan
adcd13d243 JNI: change sqlite3_prepare_multi()'s exception-handling semantics to be more C-like and, to support that, add the package-private sqlite3_jni_db_error() method to set the db error state from package-level Java code.
FossilOrigin-Name: 46656b354311ec0a36832af1c4ccb3b6a244aa55cfb3681e25c3f42b13b387dd
2023-11-14 02:43:30 +00:00
stephan
b481413d95 JNI: add sqlite3_blob_write() overload which accepts a java.nio.ByteBuffer. Cleanups in adjacent code.
FossilOrigin-Name: ca32af8542aa2725cc87f54541b19897556f610e4674edf9f22a84e3d4097a82
2023-11-14 01:33:15 +00:00
stephan
ce2edab088 JNI: add sqlite3_column_nio_buffer() and sqlite3_value_nio_buffer() using an only-slightly roundabout approach to creating properly-sized ByteBuffer objects.
FossilOrigin-Name: efbc82b218d26b7ca9b881da69d5fd14d22b5211fbd85a835da50e5bfde3d160
2023-11-13 23:11:10 +00:00
stephan
87c407da18 JNI: add sqlite3_result_nio_buffer() and tests. Discover that we cannot create sensible sqlite3_column_nio_buffer() or sqlite3_value_nio_buffer() counterparts because of ByteBuffer interface limitations.
FossilOrigin-Name: 44b4df01ff86841fb85b6295cbada422c6ba8a32a420a2e840e2d607b6c90164
2023-11-13 18:35:37 +00:00
stephan
7f7d7bea01 JNI: add sqlite3_bind_nio_buffer() and initial tests for binding ByteBuffer objects as blobs on JVMs which have JNI support for nio buffers.
FossilOrigin-Name: b10ce1ef82d84726fbf6a8f624d6530f84fefb505f7868b4a0ea910fed7a877f
2023-11-13 14:58:37 +00:00
stephan
56e1610f7a JNI wrapper1: when checking for an out-of-bounds statement column index, perform the is-statement-finalized check before the range check so that the former exception trumps the latter.
FossilOrigin-Name: 0832f9a8e9f574b157c791c5cddc73aff7b2ff403509f5d78f310494d4a7f93d
2023-11-11 14:50:01 +00:00
stephan
307f95c1e4 Do not cache a statement's column count in the JNI wrapper1 API because an ALTER TABLE via another statement may invalidate it, as reported in [forum:6d80efd58d4591c7|forum post 6d80efd58d4591c7].
FossilOrigin-Name: a6ab88e9a67f23ab7885402776282b94033cb48dbe34d4d18356e4dc22aae7cd
2023-11-11 14:43:50 +00:00
stephan
828a00c287 Expose the missing SQLITE_SUBTYPE to JNI.
FossilOrigin-Name: 0f92f4c90eb9397325f1a86836e356862108e2e850c1801e0bec4a7030dea271
2023-11-10 15:00:11 +00:00
stephan
af65e7d21f Expose SQLITE_RESULT_SUBTYPE to JNI.
FossilOrigin-Name: 3bf75875b8be8d2e878681506fb35f2062d59f07fa23f571c58cd92f270bb197
2023-11-10 14:15:07 +00:00
stephan
752722e8d1 A .class file build dependencies fix in the JNI build.
FossilOrigin-Name: 8cc32915165efd7c261f008bb6fa4cc6581ee7bd73ea5da47513742b9e6d34e4
2023-11-09 13:00:33 +00:00
stephan
b9050dcec7 Add some notes about the JNI pointer-passing approach and convert a couple of potential NullPointerExceptions into appropriate C result codes. Clarify that invocation of undefined behaviour from the Java API does not (due to the addition of defensive code) mean the same thing as it does in C (e.g. no NULL pointer dereferences).
FossilOrigin-Name: 19c4778f45261006368b2d9460350fed1e55fed314c8b3e1af34cd8c3c73b7d8
2023-11-09 12:48:54 +00:00
stephan
ec427813ac Two more JNI build fixes for Windows/MinGW, reported in [forum:4f949edc312d2a75|forum post 4f949edc312d2a75].
FossilOrigin-Name: a3f9c39086e582e16ca15647961956b3c28d038655d3b43d4b94bd306fbec1a4
2023-11-09 12:01:02 +00:00
stephan
86b1898cb4 JNI build fixes for platforms where the jint type is not the same as int, as reported in [forum:9089d2049a|forum post 9089d2049a].
FossilOrigin-Name: b32b0873274bfe472114da8a308a04bee76ba26a5830d8d04fc921f9c1544f9d
2023-11-08 12:56:23 +00:00
stephan
344255e5aa An attempt to work around compilation errors on MinGW reported in [forum:9089d2049a|forum post 9089d2049a].
FossilOrigin-Name: d5658a3ee4f585cc1e96d84425aad2e1f56b3ae507c9e17b71e030f83f0b70e8
2023-11-07 19:39:23 +00:00
stephan
637922acac JNI: during static init record whether the current JVM supports JNI-level access to java.nio.ByteBuffer raw memory, and add sqlite3_jni_supports_nio() to query that.
FossilOrigin-Name: fb8dbb77a4d8efafd6772333824b4ab589828cf155a63ca6a26730314d0a4bd9
2023-11-07 17:15:55 +00:00
stephan
488125d4ce Add Sqlite.prepareMulti() to JNI wrapper1, for preparing multiple statements from a single input.
FossilOrigin-Name: e4670d68b52233ab376a1725983e148aaf2a2c3658a41f5768e37a0f1f87428a
2023-11-07 15:56:39 +00:00
stephan
6dc368e632 Diverse minor cleanups in the JNI pieces.
FossilOrigin-Name: 35233dd900632b997b5e532170a3b2af0ca7f1dccb8407555b93f2b395b0f7b4
2023-11-07 13:44:29 +00:00
stephan
6ca0cfd87a Flesh out [7a63b5b65a79] to be able to build JNI with or without SQLITE_ENABLE_COLUMN_METADATA.
FossilOrigin-Name: fcee41b3d4d2558299ead28cc17f290b9ff1957a84c3feaa0a24872feeb22901
2023-11-07 13:22:49 +00:00
stephan
23056b608e Add -DSQLITE_ENABLE_COLUMN_METADATA to the JNI build, as per [forum:9205518c0568fdf0|forum post 9205518c0568fdf0]. Add tests for the functions that flag enables so that the build will fail if that flag is missing.
FossilOrigin-Name: 7a63b5b65a79d15658a160d0878c7371941c67e9b48a7442762c68c60b77288a
2023-11-06 21:57:15 +00:00
stephan
ed99e7493a Add incremental blob I/O support to JNI wrapper1.
FossilOrigin-Name: 7f1c76fe930d69a0274f70fa7b7e68e0db6226b731a065fa57d0936c8400ffb0
2023-11-05 04:20:04 +00:00
stephan
546db3f14a JNI wrapper1 normalizeSql() now throws UnsupportedOperationException, instead of returning null, if built without SQLITE_ENABLE_NORMALIZE. Remove SQLITE_PREPARE_NORMALIZE from the JNI interface because it's a legacy no-op.
FossilOrigin-Name: d081a126697e214082f3b203f23ea63510080e5c2aac1d8badc9e6e4bfea7c95
2023-11-05 03:37:33 +00:00
stephan
88c90a793e Add authorizer support to JNI wrapper1.
FossilOrigin-Name: 773f9873865b5277a6a682c4695f216bfe1ec05ed5e5a2a70aaa451934ba2dc0
2023-11-05 01:55:20 +00:00
stephan
9a26589940 Add progress-handler support to JNI wrapper1. Correct the return type of the extended_result_codes() JNI binding and expose it to wrapper1.
FossilOrigin-Name: 6c0acfdce2160d8db261a59677cec571b6abc333481525b1ec975d98e88bec88
2023-11-05 01:39:29 +00:00
stephan
0ee7ae72a1 Add update-hook support to JNI wrapper1.
FossilOrigin-Name: 6c584cf27179d16deee84e9699493cf29bebef123fa2a7493aad0324bead1618
2023-11-05 01:14:07 +00:00
stephan
2c930e3b86 Add commit/rollback hook support to JNI wrapper1.
FossilOrigin-Name: ff3d44fe42528d96533d22c7807472df89bca18f1def23b018e2f407318143f8
2023-11-05 00:48:43 +00:00
stephan
b02ca781ad Add busy-handler support to JNI wrapper1.
FossilOrigin-Name: dcf579ab2de4a3d3a437cde59b2fd60f1729c0bde31df1865117e6a5ea4bab20
2023-11-05 00:02:47 +00:00
stephan
15d38c0dde Bind collation and collation-needed to JNI wrapper1 and correct the callback return type for collation-needed callbacks in the lower-level JNI binding.
FossilOrigin-Name: 0f673140681685ab390ecd7326a8b80d060b7ab23c31a2cfc28ba76fd5096afe
2023-11-04 23:37:11 +00:00
stephan
dc8a684c11 Wrap the sqlite3_backup API in the JNI wrapper1 API.
FossilOrigin-Name: 3ee6cc29d2111e7ad90860827c0ea808fdf07bc71defdade7e6794ec4a2a3ce2
2023-11-04 22:47:40 +00:00
stephan
ffdb479e7c Reimplement auto-extensions in Java for use with the JNI wrapper1 API.
FossilOrigin-Name: 14ed4c64533622e5faf1aaa59c24885885aad43f1c0d4717773e79440e8e1468
2023-11-04 21:51:34 +00:00
stephan
1b199243cb Expose context_db_handle() to the JNI wrapper1 API and clean up some related tests.
FossilOrigin-Name: c23123af7d40dea24a0848dff987fd58a6703ce04165060533544db85983d566
2023-11-04 16:01:13 +00:00
stephan
348e192ea8 Rework the JNI wrapper1 variants of status() and db_status() to be more Java-esque.
FossilOrigin-Name: 40ad3920673561a06edf0b70a50a40be6cd20817fe22b87b63a9ac80cb2c9df8
2023-11-04 13:37:42 +00:00
stephan
5f3b13d136 Bind the bool-flag sqlite3_db_config() variants to the JNI wrapper1 API.
FossilOrigin-Name: b5cdcb9279d9276f24b67083839f463beecd731f46f2e8bf68fff716df0a3921
2023-11-04 13:16:49 +00:00
stephan
aad6808efc Bind the trace API to the JNI wrapper1 API and add a way to map the native-level db/stmt types to their high-level counterparts (required for translating callbacks such as tracers).
FossilOrigin-Name: 702910e0d1cfc897a269b4fb36b255165958edf529ac9553ebc5155e404d4cd3
2023-11-04 12:53:00 +00:00