Commit graph

293 commits

Author SHA1 Message Date
Pekka Enberg
94cd61fb69
Merge 'bindings/java: add batching support to JDBC4PreparedStatement' from
# Changes
Support batching multiple DML queries in a single PreparedStatement.
### Java
- the setters of JDBC4PreparedStatement no longer bind to the underlying
native statement directly, but only store the parameter values locally
- On execution the correct set of parameters is bound to the native
statement
### Rust
- Added a helper method to retrieve the parameter count of a statement
# Reference
#615

Reviewed-by: Kim Seon Woo (@seonWKim)

Closes #3971
2025-11-23 09:45:08 +02:00
Pekka Enberg
b5c5666a49 Turso 0.4.0-pre.3 2025-11-22 09:56:18 +02:00
Duckulus
7e89772326 reset statement instead of recreating it when executing preparedstatement batch 2025-11-19 23:47:15 +01:00
Duckulus
66213612b8 add unit tests for batch update,delete and adjust naming 2025-11-19 23:04:47 +01:00
Pekka Enberg
687d9faf37 Turso 0.4.0-pre.2 2025-11-19 09:40:08 +02:00
Duckulus
f7cc402dfc add batching support to JDBC4PreparedStatement 2025-11-16 15:22:17 +01:00
Pekka Enberg
a1e1e41ec2
Merge 'bindings/java: implement JDBC4 InputStream binding methods (ASCII/Binary, no-length and long overloads)' from Orange banana
## Purpose
* Implement JDBC4 stream binding methods in JDBC4PreparedStatement for
the following overloads:
  * `setAsciiStream(int, InputStream, long)`, `setAsciiStream(int,
InputStream)`
  * `setBinaryStream(int, InputStream, long)`, `setBinaryStream(int,
InputStream)`
## Changes
### In `(int, InputStream, long)` methods
* Added a shared helper method `requireLengthIsPositiveInt(long length)`
to validate stream length.
  * Validates `length` to fit SQLite’s 32-bit limit for compatibility
with SQLite/Turso engines.
* After validation passes, delegates to the `(int, InputStream, int)`
overload for actual binding logic.
### In `(int, InputeStream)` methods - no length
* Added a shared helper method `readBytes(InputStream x)`.
  * Reads the first byte before allocating the buffer to avoid
unnecessary memory allocation for empty streams.
* After reading, directly binds the data using` bindText()` (for ASCII)
or `bindBlob()` (for binary).
  * Avoids re-wrapping the stream or reallocation since the byte array
is already available.
## Related Issue
* #615

Reviewed-by: Kim Seon Woo (@seonWKim)

Closes #3937
2025-11-14 12:19:51 +02:00
Orange flavored banana
b701154e3b test(jdbc): test setAsciiStream, setBinaryStream methods (int, InputStream) 2025-11-12 14:54:40 +09:00
Orange flavored banana
28cd56d481 test(jdbc): implements setAsciiStream, setBinaryStream methods (int, InputStream) 2025-11-12 14:42:32 +09:00
Orange flavored banana
8d56c62446 test(jdbc): test setAsciiStream, setBinaryStream methods (int, InputStream, long) 2025-11-12 14:02:15 +09:00
Orange flavored banana
fe16786038 feat(jdbc): implements setAsciiStream, setBinaryStream methods (int, InputStream, long) 2025-11-12 13:51:41 +09:00
pedrocarlo
1db13889e3 Change Value::Text to use a Cow<'static, str> instead of Vec<u8> 2025-11-11 16:11:46 -03:00
Pekka Enberg
e929c252b4
Merge 'bindings/java: implement stream binding methods (int, InputStream, int) in JDBC4PreparedStatement' from Orange banana
## Purpose
* Implement `setAsciiStream(int, InputStream, int)`,
`setUnicodeStream(int, InputStream, int)`, and `setBinaryStream(int,
InputStream, int)` methods in JDBC4PreparedStatemen
## Changes
* `setAsciiStream(int, InputStream, int)`: Reads ASCII bytes, converts
to `String` using `US_ASCII` and binds with `bindText()`.
* `setUnicodeStream(int, InputStream, int)`: Reads bytes as `UTF-8`
encoded text and binds with `bindText()`.
* `setBinaryStream(int, InputStream, int)`: Reads raw bytes and binds
with `bindBlob()`.
* Added consistent error handling and validation
  * null stream - `bindNull()`
  * Negative length - throws `SQLException`
  * Empty stream  - Empty String or Empty Array
  * I/O errors - throw `SQLException`
* Ensures consistency between `setXxxStream` and `getXxxStream` methods,
so data written and read use the same encoding.
## Related Issue
* #615

Reviewed-by: Kim Seon Woo (@seonWKim)

Closes #3917
2025-11-10 11:07:08 +02:00
Pekka Enberg
c3d2ea8429 Turso 0.4.0-pre.1
Some checks are pending
Build & publish @tursodatabase/database / db-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / Test DB bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Test DB bindings on browser@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Publish (push) Blocked by required conditions
Python / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / linux (x86_64) (push) Waiting to run
Python / macos-arm64 (aarch64) (push) Waiting to run
Python / sdist (push) Waiting to run
Python / Release (push) Blocked by required conditions
Rust / cargo-fmt-check (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust / clippy (push) Waiting to run
Rust / simulator (push) Waiting to run
Rust / test-limbo (push) Waiting to run
Rust / test-sqlite (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Rust Benchmarks+Nyrkiö / vfs-bench-compile (push) Waiting to run
2025-11-06 08:33:13 +02:00
Orange flavored banana
510b8ef59f refactor(jdbc): Added early return for length == 0 and improved read loop condition in setUnicodeStream and setAsciiStream 2025-11-06 10:13:23 +09:00
Orange flavored banana
b75e4b5a19 refactor(jdbc): prevent over-read and infinite loop in setBinaryStream 2025-11-06 09:55:36 +09:00
Orange flavored banana
0323d23b0c refactor(jdbc): Added an early return when length == 0 2025-11-06 09:33:31 +09:00
Orange flavored banana
0ef416704c refactor(jdbc): use ByteArrayOutputStream and handle empty streams as empty values instead of null 2025-11-05 14:47:47 +09:00
Orange flavored banana
efe189c21d refactor(jdbc): adjust empty stream handling and memory usage in setBinaryStream and setUnicodeStream 2025-11-05 11:39:48 +09:00
Orange flavored banana
52f8c1a33e feat(jdbc): test setUnicodeStream method in JDBC4PreparedStatementTest 2025-11-04 17:48:31 +09:00
Orange flavored banana
100662d134 feat(jdbc): implement setUnicodeStream method in JDBC4PreparedStatement 2025-11-04 17:45:36 +09:00
Orange flavored banana
8dd666e131 feat(jdbc): test setBinaryStream method in JDBC4PreparedStatementTest 2025-11-04 17:32:33 +09:00
Orange flavored banana
679841fc9d feat(jdbc): implement setBinaryStream method in JDBC4PreparedStatement 2025-11-04 17:27:34 +09:00
Orange flavored banana
11186312bd feat(jdbc): test setAsciiStream method in JDBC4PreparedStatementTest 2025-11-04 17:14:52 +09:00
Orange flavored banana
8f35a0c4c1 feat(jdbc): implement setAsciiStream method in JDBC4PreparedStatement 2025-11-04 16:48:28 +09:00
Pekka Enberg
cdd9ec3438
Merge 'bindings/java: Implement setObject(int, Object) in JDBC4PreparedStatement' from Orange banana
## Purpose
* Implement `setObject(int, Object)` to support binding of common Java
types to SQL parameters in JDBC4.
* This implementation currently covers only standard JDBC4 supported
types. LOB and stream bindings are not yet implemented.
## Changes
* Implemented JDBC4PreparedStatement#setObject(int, Object) handling for
  * `String`, `Integer`, `Long`, `Boolean`, `Double`, `Float`, `Byte`,
`Short`
  * `byte[]`, `Date`, `Time`, `Timestamp`, `BigDecimal`
* Added validation for unsupported types (`Blob`, `Clob`, `InputStream`,
`Reader`)
* Added corresponding unit test `testSetObjectCoversAllSupportedTypes`
to verify correctness
## Note
* Additional work (e.g., LOB/Stream handling) will be addressed
separately once driver support is available.
## Related Issue
#615

Reviewed-by: Kim Seon Woo (@seonWKim)

Closes #3864
2025-10-31 17:00:31 +02:00
Orange flavored banana
5fef79d9f6 feat(jdbc): remove unnecessary java.sql prefixes in setObject 2025-10-31 10:38:30 +09:00
Orange flavored banana
4cd007f2eb Test(jdbc): Add coverage for setObject(int, Object) 2025-10-30 15:35:31 +09:00
Orange flavored banana
53ab453015 Feat(jdbc): Implement setObject(int, Object) in JDBC4PreparedStatement 2025-10-30 09:54:42 +09:00
kimminseok
2b456ec7e4 chore: apply spotless formatting 2025-10-27 00:31:49 +09:00
김민석
24181ad307
Merge branch 'main' into feature/result-set-was-null 2025-10-26 23:02:36 +09:00
kimminseok
17f1a070ed Add comprehensive tests for ResultSet getter methods 2025-10-26 22:37:47 +09:00
kimminseok
71f53b5850 Add wasNull tracking to getObject methods 2025-10-26 22:36:38 +09:00
kimminseok
27233a947f Add consistent wasNull handling for stream getter methods 2025-10-26 22:34:43 +09:00
kimminseok
7ee339a754 Extract timezone offset calculation to helper method 2025-10-26 22:09:47 +09:00
kimminseok
791e19892d Refactor columnLabel getters to use delegation pattern 2025-10-26 21:45:54 +09:00
kimminseok
5f10e647e3 Fix wasNull not being set in getter methods 2025-10-26 21:31:11 +09:00
Pekka Enberg
12783ef01e
Merge 'bindings/java: Add support for publishing to Maven Central' from Kim Seon Woo
Some checks are pending
Build & publish @tursodatabase/database / db-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / Test DB bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Test DB bindings on browser@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Publish (push) Blocked by required conditions
Python / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / linux (x86_64) (push) Waiting to run
Python / macos-arm64 (aarch64) (push) Waiting to run
Python / sdist (push) Waiting to run
Python / Release (push) Blocked by required conditions
Rust / cargo-fmt-check (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust / clippy (push) Waiting to run
Rust / simulator (push) Waiting to run
Rust / test-limbo (push) Waiting to run
Rust / test-sqlite (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Rust Benchmarks+Nyrkiö / vfs-bench-compile (push) Waiting to run
## Purpose
- Deploy `tech.turso:turso:<version>` to maven central so that users can
easily use java bindings
  - For example :
https://repo1.maven.org/maven2/io/github/seonwkim/turso/0.0.1/
## Requirements
- [x] Add the following github secrets.
  - [x] MAVEN_CENTRAL_USERNAME
  - [x] MAVEN_CENTRAL_PASSWORD
  - [x] GPG_PRIVATE_KEY
  - [x] GPG_PASSPHRASE
- [ ] Namespace `tech.turso` must be registered at maven central
- [ ] GPG key registration to key servers
- Notes
  - Retrieve MAVEN_CENTRAL_USERNAME and MAVEN_CENTRAL_PASSWORD from
[maven central](https://central.sonatype.com/usertoken)
  - GPG keys should be registered. You should distribute your keys to
designated(maven central supported) servers
    -  Refer to [GPG key related docs](https://central.sonatype.org/publ
ish/requirements/gpg/#distributing-your-public-key)
    - Btw, I used `keyserver.ubuntu.com` key server while testing
### [Maven Central Username &
Password](https://central.sonatype.com/usertoken)
<img width="2878" height="1338" alt="image"
src="https://github.com/user-
attachments/assets/03e6f967-a7f6-46b8-aef5-d15772bd9eea" />
### [Maven Central
Namespace](https://central.sonatype.com/publishing/namespaces)
<img width="1424" height="456" alt="image" src="https://github.com/user-
attachments/assets/8c0f4f17-bf5a-4c6a-bc47-748d86cd1f1a" />
## Future Works
- Currently, we depend on gradle.properties to determine the version of
our dependency and it's cumbersome to always change the version
manually. Let's find a better solution.

Closes #3624
2025-10-10 13:12:01 +03:00
kimminseok
76320e82db lint issues with spotless 2025-10-09 11:19:29 +09:00
kimminseok
f9e95697c8 handle empty string in findColumn() method 2025-10-09 10:46:27 +09:00
kimminseok
76b57e5d0c correctly detect empty ResultSet in next() 2025-10-09 10:29:46 +09:00
Kim Seon Woo
722c906ca6 Change variable names 2025-10-08 15:43:27 +09:00
kimminseok
104c2ffc5e Fix isBeforeFirst to return false for empty ResultSet 2025-10-08 00:40:15 +09:00
kimminseok
043a9fc7b8 Change to verify full exception messages in findColumn tests 2025-10-08 00:25:28 +09:00
Kim Seon Woo
d90d0f3f9f Separate publish.gradle.kts from build.gradle.kts 2025-10-07 23:52:12 +09:00
Kim Seon Woo
e9ccdf15d8 Apply lint 2025-10-07 23:52:03 +09:00
kimminseok
64fd282eb0 Fix NullAway warnings in JDBC4ResultSet 2025-10-07 23:50:48 +09:00
Kim Seon Woo
8af9a53818 Update build.gradle.kts for publishing 2025-10-07 23:37:53 +09:00
Kim Seon Woo
fe7027e8ee Fix Makefile libs command 2025-10-07 23:33:13 +09:00
Kim Seon Woo
76af79c4fa Add javadoc on classes and public methods for publishing to maven central 2025-10-07 23:33:02 +09:00