Nikita Sivukhin
dd913dec22
move connect at the top
2025-11-28 01:06:44 +04:00
Nikita Sivukhin
1c373fd275
vide code python bindings
2025-11-27 17:54:10 +04:00
Nikita Sivukhin
0c05cd3ca7
rewrite python bindings to be almost direct translation of sdk-kit
2025-11-27 17:53:31 +04:00
Nikita Sivukhin
2944e6d7c7
prevent concurrent use of the statements over single connection
2025-11-27 15:44:32 +04:00
Nikita Sivukhin
ef3db24a49
rename methods in core a little bit
2025-11-27 14:12:47 +04:00
Nikita Sivukhin
7b38240379
small fixes in sdk-kit
2025-11-27 14:12:29 +04:00
Nikita Sivukhin
78705493d8
use sdk-kit in python bindings
2025-11-27 14:12:08 +04:00
Nikita Sivukhin
414c8a8196
more fixes
2025-11-26 23:15:06 +04:00
Nikita Sivukhin
e81b08eb47
review fixes
2025-11-26 21:49:35 +04:00
Nikita Sivukhin
14f16e6e0a
make the capi more safe
2025-11-26 21:14:08 +04:00
Nikita Sivukhin
19ae3c48a5
fix bugs and add more comments
2025-11-26 18:40:52 +04:00
Nikita Sivukhin
33a8bf93c1
fix review comments
2025-11-26 18:04:33 +04:00
Nikita Sivukhin
e83327ddae
rename capi -> sdk-kit and implement both rsapi and capi
2025-11-26 17:10:01 +04:00
Nikita Sivukhin
6f3d87bdb6
fix bug
2025-11-26 12:27:46 +04:00
Nikita Sivukhin
c9e697d80e
add method to execute multiple statements
2025-11-26 12:03:48 +04:00
Nikita Sivukhin
bcdc877164
add statement finalize api
2025-11-25 17:45:06 +04:00
Nikita Sivukhin
cee2b94c2f
small fix
2025-11-25 17:25:00 +04:00
Nikita Sivukhin
9e807daea4
add logging hook and experimental features in the db config
2025-11-25 17:22:40 +04:00
Nikita Sivukhin
d984af6264
implement basic C bindings
2025-11-25 16:47:21 +04:00
Nikita Sivukhin
8fabe12f5d
add turso capi bindings signatures
2025-11-25 12:56:10 +04:00
Nikita Sivukhin
1bce053333
cargo fmt
2025-11-25 11:24:26 +04:00
Nikita Sivukhin
4ad0f6a98d
a little bit of documentation
2025-11-25 11:22:56 +04:00
Nikita Sivukhin
e39e60ef18
introduce program execution state in order to run stmt to completion in case of finalize or reset
2025-11-25 11:14:20 +04:00
Nikita Sivukhin
cb3ae4d7fd
remove unnecessary constant
...
- it is not exported as a symbol - so no need to have it
2025-11-21 14:27:04 +04:00
Nikita Sivukhin
78b9fa54a5
fix clippy
2025-11-21 14:04:04 +04:00
Nikita Sivukhin
daaa91259b
remove debug logs
2025-11-21 13:58:20 +04:00
Nikita Sivukhin
228f2c1be9
return proper error code in case of certain LimboErrors
2025-11-21 13:58:07 +04:00
Nikita Sivukhin
f5e8eaa6c1
enable indices by default
2025-11-21 13:57:34 +04:00
Nikita Sivukhin
139ec0035e
copy errors codes from SQLite
2025-11-21 13:56:56 +04:00
Pekka Enberg
2f078f13e6
Merge 'simulator: only check all tables if we have any tables to check' from Pedro Muniz
...
Fixes : #3996
Closes #3997
2025-11-21 09:39:55 +02:00
pedrocarlo
03f38ae72c
simulator: only check all tables if we have any tables to check
2025-11-21 01:10:55 -03:00
Preston Thorpe
e40b07122d
Merge 'Support table xinfo' from Nikita Sivukhin
...
Build & publish @tursodatabase/database / db-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / Test DB bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Test DB bindings on browser@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Publish (push) Blocked by required conditions
Python / sdist (push) Waiting to run
Python / Release (push) Blocked by required conditions
Python / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / linux (x86_64) (push) Waiting to run
Python / macos-arm64 (aarch64) (push) Waiting to run
Rust / cargo-fmt-check (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust / clippy (push) Waiting to run
Rust / simulator (push) Waiting to run
Rust / test-limbo (push) Waiting to run
Rust / test-sqlite (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Rust Benchmarks+Nyrkiö / vfs-bench-compile (push) Waiting to run
Support extended pragma `table_xinfo` which in addition to all
`table_info` columns report extra column about if the column is
hidden/generated/dynamic (while usually all such columns filtered out
from the output of `table_info` pragma).
Reviewed-by: Preston Thorpe <preston@turso.tech>
Closes #3994
2025-11-20 19:51:52 -05:00
Pere Diaz Bou
86119b0dba
Merge 'core/mvcc/cursor: implement prev and last ' from Pere Diaz Bou
...
Build & publish @tursodatabase/database / db-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / Test DB bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Test DB bindings on browser@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Publish (push) Blocked by required conditions
Python / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / linux (x86_64) (push) Waiting to run
Python / macos-arm64 (aarch64) (push) Waiting to run
Python / sdist (push) Waiting to run
Python / Release (push) Blocked by required conditions
Rust / test-limbo (push) Waiting to run
Rust / test-sqlite (push) Waiting to run
Rust / clippy (push) Waiting to run
Rust / simulator (push) Waiting to run
Rust / cargo-fmt-check (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Rust Benchmarks+Nyrkiö / vfs-bench-compile (push) Waiting to run
Backward scan of a table wasn't implemented yet in MVCC so this achieves
that. I added simple test for mixed btree and mvcc backward scan but I
should add more intense testing for this.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Implements backward scanning and last() in MVCC lazy cursor and adds
directional rowid iteration in the MVCC store, with new tests for mixed
MVCC+B-Tree backward scans.
>
> - **MVCC Cursor (`core/mvcc/cursor.rs`)**:
> - Implement `prev()` and `last()` with mixed MVCC/B-Tree
coordination using `IterationDirection`.
> - Add `PrevState` and extend state machine to handle backward
iteration.
> - Update `get_new_position_from_mvcc_and_btree(...)` to choose
rowids based on direction.
> - Integrate B-Tree cursor calls (`last`, `prev`) and adjust
`rewind`/rowid selection; tweak next-rowid when at `End`.
> - **MVCC Store (`core/mvcc/database/mod.rs`)**:
> - Add `get_prev_row_id_for_table(...)` and generalized
`get_row_id_for_table_in_direction(...)` supporting forward/backward
scans.
> - Add tracing and minor refactors around next/prev rowid retrieval.
> - **Tests (`core/mvcc/database/tests.rs`)**:
> - Add test for backward scan combining B-Tree and MVCC and an
ignored test covering delete during backward scan.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot ) for commit
430bd457e6 . This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot ).</sup>
<!-- /CURSOR_SUMMARY -->
Closes #3980
2025-11-20 18:41:41 +01:00
Nikita Sivukhin
0c1e2a8a10
fix test
2025-11-20 18:03:32 +04:00
Nikita Sivukhin
ab3ba6a91a
adjust registers allocation
2025-11-20 18:00:54 +04:00
Nikita Sivukhin
035705bc63
fix bugs and improve comments
2025-11-20 17:54:36 +04:00
Nikita Sivukhin
801f51a77d
fix build
2025-11-20 17:49:18 +04:00
Nikita Sivukhin
b08374be46
support table_xinfo pragma
2025-11-20 17:38:10 +04:00
Pekka Enberg
c205f41158
Merge 'core: Switch to parking_lot::Mutex' from Pekka Enberg
...
Build & publish @tursodatabase/database / db-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / Test DB bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Test DB bindings on browser@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Publish (push) Blocked by required conditions
Python / configure-strategy (push) Waiting to run
Python / lint (push) Waiting to run
Python / test (push) Blocked by required conditions
Python / macos-arm64 (aarch64) (push) Waiting to run
Python / Release (push) Blocked by required conditions
Python / linux (x86_64) (push) Waiting to run
Python / sdist (push) Waiting to run
Rust / cargo-fmt-check (push) Waiting to run
Rust / test-sqlite (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust / clippy (push) Waiting to run
Rust / simulator (push) Waiting to run
Rust / test-limbo (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Rust Benchmarks+Nyrkiö / vfs-bench-compile (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
It's faster and we eliminate bunch of unwrap() calls.
Closes #3993
2025-11-20 11:17:12 +02:00
Pekka Enberg
d808db6af9
core: Switch to parking_lot::Mutex
...
It's faster and we eliminate bunch of unwrap() calls.
2025-11-20 10:42:02 +02:00
Pere Diaz Bou
430bd457e6
core/mvcc: fix tests with delete
2025-11-19 17:18:44 +01:00
Pere Diaz Bou
bf1afb56cf
core/mvcc: test with delete after checkpoint
2025-11-19 16:56:32 +01:00
Pere Diaz Bou
b4c11705f3
core/mvcc: few suggestions from pr
2025-11-19 16:44:24 +01:00
Jussi Saurio
9a3cc2ac40
Merge 'Triggers: fix issues with ALTER TABLE' from Jussi Saurio
...
Build & publish @tursodatabase/database / db-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / db-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-apple-darwin - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-aarch64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-wasm32-wasip1-threads - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-pc-windows-msvc - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / sync-bindings-x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
Build & publish @tursodatabase/database / Test DB bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Test DB bindings on browser@20 (push) Blocked by required conditions
Build & publish @tursodatabase/database / Publish (push) Blocked by required conditions
Python / test (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / linux (x86_64) (push) Waiting to run
Python / configure-strategy (push) Waiting to run
Python / macos-arm64 (aarch64) (push) Waiting to run
Python / sdist (push) Waiting to run
Python / Release (push) Blocked by required conditions
Rust / clippy (push) Waiting to run
Rust / cargo-fmt-check (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust / simulator (push) Waiting to run
Rust / test-limbo (push) Waiting to run
Rust / test-sqlite (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Rust Benchmarks+Nyrkiö / vfs-bench-compile (push) Waiting to run
Still in draft, because there's a ton of stupid AI slop
## Fixes
Closes #3983
Closes #3984
- Disallow DROP COLUMN on columns referenced in triggers
- Propagate RENAME COLUMN to trigger SQL definitions
## Drop Column details
DROP COLUMN is not allowed when the column is mentioned in a trigger on
the table the column is dropped from, eg:
```
turso> CREATE TABLE t(x,y);
turso> CREATE TRIGGER foo BEFORE INSERT ON t BEGIN INSERT INTO t VALUES (NEW.x); END;
turso> ALTER TABLE t DROP COLUMN x;
× Parse error: cannot drop column "x": it is referenced in trigger foo
```
However, it is allowed if the trigger is on another table:
```
turso> CREATE TABLE t(x,y);
turso> CREATE TABLE u(x,y);
turso> CREATE TRIGGER bar BEFORE INSERT ON t BEGIN INSERT INTO u(y) VALUES (NEW.x); END;
turso> ALTER TABLE u DROP COLUMN y;
turso> INSERT INTO t VALUES (1,1);
× Parse error: table u has no column named y
```
## AI Disclosure
Nearly all of the code here is vibecoded. I first asked Cursor Composer
to create an initial implementation. Then, I asked it to try to discover
edge cases using the `turso` and `sqlite3` CLIs, and write tests+fixes
for the edge cases found.
The code is a bit slop and there is a LOT of it because the AST
traversal to rewrite column references is all mostly from scratch, but
this isn't a particularly performance-critical use case and it should
solve most of the issues with RENAME and DROP COLUMN.
Closes #3986
2025-11-19 15:00:07 +02:00
Jussi Saurio
32063334f9
fix operator precedence bug
2025-11-19 14:29:33 +02:00
Jussi Saurio
fddcea788b
refactor
2025-11-19 14:29:33 +02:00
Jussi Saurio
5d9a0b15f8
Handle qualified column references in triggers wrt ALTER TABLE
2025-11-19 14:29:33 +02:00
Jussi Saurio
dbdf60a628
extract common functionality
2025-11-19 14:29:33 +02:00
Jussi Saurio
745cdc3aa2
Align trigger sql rewrite behavior with sqlite
...
SQLite doesn't rewrite INSERT lists or WHEN clause, it instead
lets the trigger go "stale" and will cause runtime errors. This
may not be great behavior, but it's compatible...
2025-11-19 14:29:33 +02:00
Jussi Saurio
5b1c69a9d0
fix ai slop with more ai slop
2025-11-19 14:29:33 +02:00