Pekka Enberg
17e07e620a
Merge 'fix/vdbe: reset op_transaction state properly' from Jussi Saurio
...
essentially after the first runthrough of `op_transaction` per a given
`ProgramState`, we weren't resetting the instruction state to `Start´ at
all, which means we didn't do any transaction state checking/updating
after that.
PR includes a rust bindings regression test that used to panic before
this change, and I bet it also fixes this issue in turso-go:
https://github.com/tursodatabase/turso-go/issues/28
Closes #3516
2025-10-02 09:25:23 +03:00
Jussi Saurio
f48165eb72
fix/vdbe: reset op_transaction state properly
...
essentially after the first runthrough of `op_transaction` per a
given `ProgramState`, we weren't resetting the instruction state
to `Start´ at all, which means we didn't do any transaction state
checking/updating.
PR includes a rust bindings regression test that used to panic before
this change, and I bet it also fixes this issue in turso-go:
https://github.com/tursodatabase/turso-go/issues/28
2025-10-02 08:40:41 +03:00
Jussi Saurio
f06aac6192
bindings/rust: don't panic if user provides invalid parameter
...
Now returns e.g.:
```rust
SqlExecutionFailure(
"Invalid argument supplied: Unknown parameter ':email' for query 'INSERT INTO users (email, created_at) VALUES (?, ?)'.
Make sure you're using the correct parameter syntax - named: (:foo), positional: (?, ?)"
)
```
instead of unwrapping a None value and panicing
2025-10-02 07:42:52 +03:00
Pekka Enberg
4666544ea6
Turso 0.2.0-pre.13
2025-10-01 16:40:53 +03:00
Pekka Enberg
4d77786b53
Merge 'Beta' from Pekka Enberg
...
Reviewed-by: Glauber Costa <glommer@gmail.com >
Closes #3484
2025-10-01 15:23:28 +03:00
Jussi Saurio
8166680ad8
Merge 'make connect() method optional and call it implicitly on first query execution' from Nikita Sivukhin
...
- mostly needed for Drizzle - because other clients with ESM can just
use await connect(...) wrapper
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com >
Closes #3462
2025-10-01 15:19:07 +03:00
Nikita Sivukhin
109b3c0609
fix sync package
2025-10-01 11:08:42 +04:00
Pekka Enberg
16540724aa
Beta
2025-10-01 07:18:25 +03:00
Nikita Sivukhin
7869ac348e
rewrite MaybeLazy and add some test
2025-10-01 02:24:29 +04:00
Nikita Sivukhin
33c46f77ce
add js test
2025-09-30 22:46:21 +04:00
Nikita Sivukhin
18e8c037e9
fix tests
2025-09-30 20:45:00 +04:00
Nikita Sivukhin
4772c0406e
make connect() method optional and call it implicitly on first query execution
...
- mostly needed for Drizzle - because other clients with ESM can just use await connect(...) wrapper
2025-09-30 18:40:01 +04:00
Avinash Sajjanshetty
a360efa6e0
enable encryption feature flag by default
2025-09-30 19:04:25 +05:30
Avinash Sajjanshetty
c8111f9555
Put encryption behind an opt in (runtime) flag
2025-09-30 18:29:18 +05:30
Pekka Enberg
b0d27c90aa
Turso 0.2.0-pre.11
2025-09-29 18:11:59 +03:00
Pekka Enberg
f4bf635129
Merge 'javascript: Rename "browser" packages to "wasm"' from Pekka Enberg
...
Closes #3417
2025-09-29 18:11:30 +03:00
Pekka Enberg
57c279e2b0
javascript: Rename "browser" packages to "wasm"
2025-09-29 17:02:34 +03:00
Nikita Sivukhin
70e18ce3f7
validate zero limit at the beginning in the VDBE program
...
- before, we validated that condition during program emit - which works for fixed values of parameters but doesn't work with variables provided externally to the prepared statement
2025-09-29 15:32:36 +04:00
Pekka Enberg
2f38d2ef04
Turso 0.2.0-pre.10
2025-09-27 16:52:35 +03:00
Pekka Enberg
92291ed736
Merge 'Fix offset variable handling' from Nikita Sivukhin
...
Before, db generated incorrect plan in case when offset parameter were
introduced as variable:
```
turso> EXPLAIN SELECT * FROM users LIMIT ? OFFSET ?;
addr opcode p1 p2 p3 p4 p5 comment
---- ----------------- ---- ---- ---- ------------- -- -------
0 Init 0 16 0 0 Start at 16
1 Variable 1 1 0 0 r[1]=parameter(1); OFFSET expr
2 MustBeInt 1 0 0 0
3 Variable 2 2 0 0 r[2]=parameter(2); OFFSET expr
4 MustBeInt 2 0 0 0
5 OffsetLimit 1 3 2 0 if r[1]>0 then r[3]=r[1]+max(0,r[2]) else r[3]=(-1)
6 OpenRead 0 2 0 0 table=users, root=2, iDb=0
7 Rewind 0 15 0 0 Rewind table users
8 Variable 2 2 0 0 r[2]=parameter(2); OFFSET expr
9 MustBeInt 2 0 0 0
10 IfPos 2 14 1 0 r[2]>0 -> r[2]-=1, goto 14
11 Column 0 0 4 0 r[4]=users.x
12 ResultRow 4 1 0 0 output=r[4]
13 DecrJumpZero 1 15 0 0 if (--r[1]==0) goto 15
14 Next 0 8 0 0
15 Halt 0 0 0 0
16 Transaction 0 1 1 0 iDb=0 tx_mode=Read
17 Goto 0 1 0 0
```
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com >
Closes #3360
2025-09-27 08:20:54 +03:00
Preston Thorpe
ddbedecace
Merge 'fix encryption config in the sync-client' from Nikita Sivukhin
...
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com >
Closes #3379
2025-09-26 19:01:27 -04:00
Pekka Enberg
222ab125c1
Turso 0.2.0-pre.9
2025-09-26 19:00:14 +03:00
Nikita Sivukhin
fe4bfb7c88
fix encryption config in the sync-client
2025-09-26 19:29:37 +04:00
Nikita Sivukhin
5bf69350b3
add simple tests for offset/limit binding
2025-09-26 18:06:20 +04:00
Nikita Sivukhin
a0c47b98b8
fix test
2025-09-26 17:42:11 +04:00
Nikita Sivukhin
52f3216211
fix avg aggregation
...
- ignore NULL rows as SQLite do
- emit NULL instead of NaN when no rows were aggregated
- adjust agg column alias name
2025-09-26 17:11:06 +04:00
Pekka Enberg
cc70ec892b
Merge 'Fix .schema command for empty databases' from Diego Reis
...
Fixes #3274
Closes #3342
2025-09-25 17:25:46 +03:00
Pekka Enberg
f8130d051f
Merge 'Fix JavaScript bindings' from Nikita Sivukhin
...
This PR makes all JS db packages to have uniform interface: `new
Database(...)` constructor with explicit `connect()` and `close()`
methods.
Also, this PR adds docstrings in the code and properly support few
better-sqlite options (readonly, fileMustExist, timeout)
Closes #3334
2025-09-25 17:24:03 +03:00
Diego Reis
7a56c93b81
Makes clippy happy
2025-09-25 10:42:14 -03:00
Nikita Sivukhin
27a7f7faa7
fix clippy
2025-09-25 12:12:39 +04:00
Nikita Sivukhin
3c0b04b530
fix clippy
2025-09-25 12:08:10 +04:00
Nikita Sivukhin
a938bdcf09
fix exec to run over multiple statements in the string
2025-09-25 12:03:52 +04:00
Nikita Sivukhin
ddfa77997d
adjust sync package napi-rs code
2025-09-25 10:54:50 +04:00
Nikita Sivukhin
f8d077c24b
replace cell with mutex
2025-09-25 10:54:31 +04:00
Nikita Sivukhin
6fe5a0b61e
add comments and small test adjustments
2025-09-25 10:52:18 +04:00
Nikita Sivukhin
d08bcb6a17
adjust sync package
2025-09-25 10:52:05 +04:00
Nikita Sivukhin
afbfa98a8d
adjust sync native package
2025-09-24 18:43:50 +04:00
Nikita Sivukhin
28c9850b57
properly guard access to the private fields
2025-09-24 17:24:27 +04:00
Nikita Sivukhin
cd9cf71568
cleanup napi-rs bindings Rust code
2025-09-24 17:06:52 +04:00
Nikita Sivukhin
2ccd50ad69
add explicit async connect method to the database instance
2025-09-24 17:06:23 +04:00
Nikita Sivukhin
a5c2d5beb7
get rid of global module variable - otherwise there will be a race when both database-browser and sync-browser are used
2025-09-24 12:01:27 +04:00
Pekka Enberg
f72600431b
Turso 0.2.0-pre.8
2025-09-24 09:08:34 +03:00
Nikita Sivukhin
1faafdb57e
use wasm-runtime from NPM instead of patched sources
2025-09-23 12:28:16 +04:00
Pekka Enberg
f6e3beda45
Turso 0.2.0-pre.7
2025-09-22 20:44:08 +03:00
TcMits
17c91c1fe2
resolve conflicts
2025-09-22 16:03:52 +07:00
Pekka Enberg
26f90257a6
Turso 0.2.0-pre.6
2025-09-22 11:44:21 +03:00
Pekka Enberg
f4b0fb17f7
Turso 0.2.0-pre.5
2025-09-22 11:34:22 +03:00
Pekka Enberg
fbad158213
Turso 0.2.0-pre.4
2025-09-22 09:15:55 +03:00
Pekka Enberg
6280cfc59d
Merge branch 'main' into sync-improvements
2025-09-22 07:35:39 +03:00
Pekka Enberg
54176d4548
Merge 'Add encryption throughput test' from Avinash Sajjanshetty
...
```
cargo run --release -- -b 100 -i 100000 --read-ratio 75
cargo run --release -- -b 100 -i 100000 --read-ratio 75 --encryption
```
```
Total time: 629.51s
Transaction throughput: 158.85 txns/sec
Operation throughput: 15885.37 ops/sec
- Read operations: 7500165 (7500165 found, 0 not found)
- Read throughput: 11914.29 reads/sec
- Write operations: 2499835
- Write throughput: 3971.08 writes/sec
```
vs
```
Total time: 665.05s
Transaction throughput: 150.36 txns/sec
Operation throughput: 15036.47 ops/sec
- Read operations: 7500165 (7500165 found, 0 not found)
- Read throughput: 11277.60 reads/sec
- Write operations: 2499835
- Write throughput: 3758.87 writes/sec
```
Closes #3230
2025-09-22 07:34:29 +03:00