Files
turso/bindings
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
..