Commit Graph

1109 Commits

Author SHA1 Message Date
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
kimminseok
2b456ec7e4 chore: apply spotless formatting 2025-10-27 00:31:49 +09:00
Pekka Enberg
2429159e5d bindings/rust: Enable mimalloc as global allocator
This improves performance by using mimalloc for memory allocation in the
Rust bindings.
2025-10-26 16:55:33 +02: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
30d183c58f bindings/javascript: Improve open error messages
Include database path name for debuggability.
2025-10-23 19:42:01 +03:00
Pekka Enberg
b984ddf98f Turso 0.3.0-pre.4 2025-10-22 13:42:52 +03:00
Nikita Sivukhin
948bd557cd use simsimd for dense operations 2025-10-21 14:59:01 +04:00
Bob Peterson
5d7b057b8a Enable turso_stress to run in Miri
antithesis_sdk needs to have default features disabled in the workspace
so turso_stress is free to select the noop implementation for Miri
2025-10-20 22:50:44 -05:00
Pekka Enberg
3020966fbd Turso 0.3.0-pre.3 2025-10-17 11:08:36 +03:00
Jussi Saurio
44fa0a4f6e Merge 'bindings/rust: propagate the DropBehavior of a dropped tx to next access of DB, instead of panicing' from Jussi Saurio
Closes #3748
Right now if any error happens during an interactive tx that causes the
`Transaction` to drop, the program will panic.
To prevent this, we store the `DropBehavior` of the transaction on the
`Connection` when it drops and issue the corresponding action (ROLLBACK
/ COMMIT / IGNORE / PANIC) the next time `Connection` is used to access
the database. This defaults to `IGNORE`.
I don't know how good this solution is, but we can at least prevent a
panic by storing whether the connection has a dangling transaction and
roll it back automatically the next time the connection tries to do
something.

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3750
2025-10-16 17:18:31 +03:00
Jussi Saurio
a1b6eafd03 Merge 'Fix: rolling back tx on Error should set autocommit to true' from Jussi Saurio
Rolling back a transaction on Error should result in
`connection.auto_commit` being set back to true.
Added a regression test for this where a UNIQUE constraint violation
rolls back the transaction and trying to COMMIT will fail.
Currently, our default conflict resolution strategy is ROLLBACK, which
ends the transaction. In SQLite, the default is ABORT, which rolls back
the current statement but allows the transaction to continue.
We should migrate to default ABORT once we support subtransactions.
Closes #3746

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3747
2025-10-16 16:55:54 +03:00