1125 Commits

Author SHA1 Message Date
Pekka Enberg
687d9faf37 Turso 0.4.0-pre.2 2025-11-19 09:40:08 +02: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
gigagrug
b7bdbefe8b Create README.md for Turso Database Python bindings
Added README.md for Turso Database Python bindings with installation instructions, features, and usage examples.
2025-11-13 20:19:50 -05:00
Pekka Enberg
1f79fbc22c Merge 'Partial sync basic' from Nikita Sivukhin
This PR implements basic support for partial sync. Right now the scope
is limited to only `:memory:` IO and later will be properly expanded to
the file based IO later.
The main addition is `PartialDatabaseStorage` which make request to the
remote server for missing local pages on demand.
The main change is that now tursodatabase JS bindings accept optional
"external" IO event loop which in case of sync will drive `ProtocolIo`
internal work associated with remote page fetching tasks.

Closes #3931
2025-11-13 16:38:04 +02:00
Nikita Sivukhin
72089d2682 adjust compilation 2025-11-12 16:30:50 +04:00
Nikita Sivukhin
41d7d5af49 adjust tests 2025-11-12 16:15:54 +04:00
Nikita Sivukhin
2d517f9fd7 use sparse io fir partial sync in case when file is used 2025-11-12 14:20:26 +04:00
Nikita Sivukhin
d519945098 make ArenaBuffer unsafe Send + Sync 2025-11-12 10:54:40 +04:00
Nikita Sivukhin
02275a6fa1 fix js bindings 2025-11-12 10:53:25 +04:00
Nikita Sivukhin
98db727a99 integrate extra io stepping logic to the JS bindings 2025-11-12 10:53:25 +04:00
Nikita Sivukhin
d42b5c7bcc wip 2025-11-12 10:53:25 +04: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
Nikita Sivukhin
b547f3a25a fix JS tests 2025-11-06 18:02:09 +04:00
Nikita Sivukhin
da61fa32b4 use dyn DatabaseStorage instead of DatabaseFile 2025-11-06 17:42:03 +04:00
Pekka Enberg
c3d2ea8429 Turso 0.4.0-pre.1 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
RS2007
60cbc6d8ea migrating from_uri to database opts 2025-11-02 16:28:22 +05:30
Pekka Enberg
913b7ac600 core: Disable autovacuum by default
People have discovered various bugs in autovacuum so let's disable it by
default for now.
2025-11-02 12:09:21 +02:00
Pekka Enberg
0217588d13 Make mimalloc dependency optional 2025-11-01 11:43:32 +02: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
Pekka Enberg
331ba14e7c Turso 0.3.0 2025-10-30 18:16:12 +02:00
Pekka Enberg
c91b66ba38 Turso 0.3.0-pre.7 2025-10-30 18:15:14 +02: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
Pekka Enberg
84a367b00e Merge 'Implement wasNull tracking in ResultSet getter methods' from 김민석
## Summary
Implemented comprehensive wasNull tracking and refactored getter methods
in JDBC4ResultSet to ensure JDBC specification compliance and improve
code maintainability.
### Changes
Added wasNull tracking to all getter methods: Covers primitive types,
objects, dates/times, streams, and BigDecimal
Refactored columnLabel getters to use delegation pattern: Eliminates
code duplication and ensures consistent wasNull behavior
### Bug Fixes & Code Quality
- Fixed getString(String) to return null instead of empty string for
null values
- Added @Nullable annotation to getBytes(String) to fix NullAway error
- Preserved String parsing in getDate(String) for TEXT-formatted dates
- Extracted timezone offset calculation to helper method
### Testing
Added comprehensive tests for wasNull tracking, columnLabel getters,
stream methods, and null handling

Closes #3838
2025-10-29 18:10:42 +02:00
Pekka Enberg
50ad2f801a Turso 0.3.0-pre.6 2025-10-29 17:54:10 +02:00
Nikita Sivukhin
9e04687108 add one more test 2025-10-29 16:24:05 +04:00
Nikita Sivukhin
e5b11a3278 uncomment tests 2025-10-29 16:24:05 +04:00
Nikita Sivukhin
e27b0d5d6b add more tests 2025-10-29 16:24:05 +04:00
Nikita Sivukhin
b01cec2ba4 wip 2025-10-29 16:24:05 +04:00
Nikita Sivukhin
7e63135abb reset statement after execution 2025-10-29 16:24:05 +04:00
Pekka Enberg
067c4f624b Turso 0.3.0-pre.5 2025-10-28 14:49:34 +02:00
Pekka Enberg
76da008bc2 Merge 'bindings/rust: Enable mimalloc as global allocator' from Pekka Enberg
This improves performance by using mimalloc for memory allocation in the
Rust bindings.

Closes #3839
2025-10-28 14:49:02 +02:00
Nikita Sivukhin
299533b7b6 hide custom modules syntax behind --experimental-custom-modules flag 2025-10-27 12:29:05 +04:00