This PR restructure JS packages and also adds support for OPFS for
tursodatabase in browser.
The new structure looks like this:
1. `@tursodatabase/database-common` - contains abstract JS code for
bindings which depends only on `NativeDB` interface and not on the
explicit native bindings
2. `@tursodatabase/database` - contains native bindings for the database
and re-use `core` package
3. `@tursodatabase/database-browser` - contains bindings for browser
(WASM + OPFS)
As OPFS sync API (which is the most performant one in the web) works
only in the web worker - this PR also make few operations async in order
to run them as `napi-rs` AsyncTask. The following operations became
async in `promise.ts` for node and browser: `pragma` / `exec` / `close`.
Also, as few code pathes during initialization are non-async - they
complicates integration of sync constructor in the browser with OPFS.
So, right now - turso support only `connect` method for browser in non-
memory mode.
Closes#2927
Our current UPDATE/DELETE fuzz tests are coupled to the btree and do not
exercise the VDBE code paths at all, so a separate one makes sense.
This test repeats the following:
- Creates one table with n columns
- Creates (0..=n) indexes
- Executes UPDATE/DELETE statements
- Asserts that both sqlite and tursodb have the same DB state after each
stmt
Closes#2978
Our current UPDATE/DELETE fuzz tests are coupled to the btree and do
not exercise the VDBE code paths at all, so a separate one makes sense.
This test repeats the following:
- Creates one table with n columns
- Creates (0..=n) indexes
- Executes UPDATE/DELETE statements
- Asserts that both sqlite and tursodb have the same DB state after each stmt
Convert `LEFT JOIN` to `INNER JOIN` when the result of `LEFT JOIN` can
never be different from the result of an `INNER JOIN`
This is useful because 1. it uses less instructions and 2. it allows for
join reordering due to inner join commutativity
Reviewed-by: Preston Thorpe <preston@turso.tech>
Closes#2972
current code is incorrectly assuming that `index_cursor.rowid()` always
finds a rowid, but this is not the case when `NullRow` has previously
been called.
Reviewed-by: Preston Thorpe <preston@turso.tech>
Closes#2973
#2928 was reverted, but let's at least add the ability to create an
equivalent big schema so that the issues reported by Preston using that
larger schema can be reproduced and fixed.
Reviewed-by: Preston Thorpe <preston@turso.tech>
Closes#2960
The MakeRecord instruction now accepts an optional affinity_str
parameter that applies column-specific type conversions before creating
records. When provided, the affinity string is applied
character-by-character to each register using the existing
apply_affinity_char() function, matching SQLite's behavior.
Fixes#2040Fixes#2041
only use `self.stack.top()` when we need to store `Arc<Page>` in struct
```sh
Execute `SELECT count() FROM users`/limbo_execute_select_count
time: [5.3733 µs 5.3801 µs 5.3881 µs]
change: [-34.047% -33.949% -33.851%] (p = 0.00 < 0.05)
Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high severe
```
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Closes#2962