Commit Graph

3716 Commits

Author SHA1 Message Date
PThorpe92
a2b9d8d371 Use Correct flag on idx insert to prevent seeking 2025-04-05 11:19:09 -04:00
PThorpe92
068ab4ab27 Refactor btree to reuse existing insert and seek with idx keys 2025-04-05 11:19:09 -04:00
PThorpe92
007fbe8cc7 Fix unique index issue and prealloc in sql string for schema 2025-04-05 11:19:09 -04:00
PThorpe92
2c3fd509fe Remove unused imports and consolidate ordering comparison 2025-04-05 11:19:09 -04:00
PThorpe92
e020ba3dfe Add enum for interpreting a value as a register or literal for insns 2025-04-05 11:19:07 -04:00
PThorpe92
b0016a0ee2 Support create index with SeekEnd and IdxCreate opcode functionality 2025-04-05 11:15:36 -04:00
PThorpe92
45a8e5e226 Add close_cursors helper method to program builder 2025-04-05 11:06:18 -04:00
PThorpe92
20adedff4c Remove Order enum in place of ast::SortOrder 2025-04-05 11:06:18 -04:00
PThorpe92
7567b30d00 Add SeekEnd to compat.md 2025-04-05 11:06:18 -04:00
PThorpe92
4741544dfd Add query translation for create index 2025-04-05 11:06:18 -04:00
PThorpe92
293974e692 Update COMPAT.md 2025-04-05 11:06:11 -04:00
Pekka Enberg
ed7271a08c Merge 'Implement Clone and Debug for Rust binding's Database' from Isaiah Gamble
Derive `Clone` for the Rust binding's `Database` and implement `Debug`.
Closes #1238

Closes #1257
2025-04-05 08:37:23 +03:00
Pekka Enberg
883d183471 Merge 'Update cargo-dist and switch to Astral's version' from Hiroaki Yutani
Close #1250
This pull request switches `cargo-dist` to Astral's "unofficial fork"
version. In addition, this updates `cargo-dist` to version 0.28.3, so
the diff, which I generated just by `dist init`, contains the updates
since version 0.21.0.
- `cargo-dist` command was renamed to `dist`
- As of [version 0.23.0](https://github.com/axodotdev/cargo-
dist/releases/tag/v0.23.0), cargo-dist uses a dedicated config file
`dist-workspace.toml` instead of the field of `Cargo.toml`

Closes #1256
2025-04-05 08:35:47 +03:00
Hiroaki Yutani
3fa1cb56a5 Update cargo-dist and switch to Astral's version 2025-04-05 09:10:48 +09:00
Pekka Enberg
c3eaf47180 Merge 'Add support for default values in INSERT statements' from Diego Reis
While working on #494 I noticed that default values defined in schemas
weren't being applied.
Before:
![image](https://github.com/user-attachments/assets/af3a31be-
accd-47b4-848f-3820497e32ac)
Now:
![image](https://github.com/user-
attachments/assets/0ccb194c-4caa-481d-8f47-2405c3db06bb)

Closes #1249
2025-04-04 08:59:44 +03:00
Pekka Enberg
a90cbe4b62 Merge 'Fix virtual table translation issues' from Preston Thorpe
closes #1240
some idiot (read: me) had the init label of `CREATE VIRTUAL TABLE`
translation completely in the wrong place 🤔

Closes #1247
2025-04-04 08:58:02 +03:00
Diego Reis
43daba9942 core/translate: Add support for default values in INSERT statements 2025-04-04 01:32:13 -03:00
Diego Reis
38d842d675 docs/insn: Standardizes comments for insn to doc comments 2025-04-04 00:56:54 -03:00
PThorpe92
97c68f905a Move test back to original setup to ensure issue is solved 2025-04-03 20:22:47 -04:00
PThorpe92
ae2be30204 Move init label to proper place in create vtab translation 2025-04-03 20:22:14 -04:00
PThorpe92
22fd3e9781 Fix cli tests 2025-04-03 15:23:49 -04:00
Pekka Enberg
73a35329d0 Merge 'Fix overflow position in write_page()' from Lâm Hoàng Phúc
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1241
2025-04-03 16:33:20 +03:00
Pekka Enberg
ccbea57a4d Merge 'docs(readme): update discord link' from Jamie Barton
Closes #1242

Closes #1243
2025-04-03 15:35:16 +03:00
Jamie Barton
83ec159b0c docs(readme): update discord link 2025-04-03 13:09:24 +01:00
Pekka Enberg
67627e18c8 Limbo 0.0.19-pre.4 2025-04-03 13:36:01 +03:00
Pekka Enberg
4392193856 bindings/javascript: Fix package repository URLs 2025-04-03 13:34:30 +03:00
Pekka Enberg
4f34373392 Limbo 0.0.19-pre.3 2025-04-03 12:39:17 +03:00
Pekka Enberg
64bd0c141a github: Fix JavaScript publish workflow permissions
The workflow enables npm's provenance feature, which requires write
permissions to the "id-token" on Github actions:

https://tsmx.net/npmjs-built-and-signed-on-github-actions/
2025-04-03 12:38:01 +03:00
TcMits
56fa9049c3 fix: overflow pos in write_page 2025-04-03 15:02:53 +07:00
Pekka Enberg
a5ee6493c0 Limbo 0.0.19-pre.2 2025-04-03 10:43:36 +03:00
Pekka Enberg
4342438801 scripts: Add more npm packages to update-version.py 2025-04-03 10:43:28 +03:00
Pekka Enberg
a279056e88 bindings/javascript: Drop pre-publish step
We don't want napi creating releases.
2025-04-03 10:41:15 +03:00
Pekka Enberg
7075c75b24 Limbo 0.0.19-pre.1 2025-04-03 10:03:01 +03:00
Pekka Enberg
c61063c697 github: Fix JavaScript workflow release parsing 2025-04-03 10:03:01 +03:00
Pekka Enberg
16bc28b0af sqlite3-parser: Change debug logging to trace level
SQL scanner at debug level spams the logs pretty hard when debugging...
2025-04-03 07:46:07 +03:00
tsar-boomba
89c0b0b862 Implement Clone and Debug for rust binding's Database 2025-04-02 18:22:57 -07:00
Pekka Enberg
7b9c0e9231 Merge 'More VDBE cleanups' from Pekka Enberg
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1237
2025-04-02 19:25:41 +03:00
Pekka Enberg
24063bd9c0 core/vdbe: Add newline between op functions 2025-04-02 18:57:07 +03:00
Pekka Enberg
c592e27dca core/vdbe: Move explain() to last method in Program
...it's the least interesting one and we should have `step()` at the top.
2025-04-02 18:55:35 +03:00
Pekka Enberg
ed1854c8de Merge 'Request load page on insert_into_page' from Pere Diaz Bou
We assumed page was loaded because before inserting we would move there.
`NewRowId` unfortunately moves cursor to the rightmost page causing
eviction of root page -- this arose the issue with `insert_into_page`
not loading the page we were supposed to have loaded so I added
`return_if_locked_maybe_load` which is a utility macro to check if the
page is locked and if not, load it if needed.

Closes #1138
2025-04-02 18:52:25 +03:00
Pere Diaz Bou
65c4cb1e0e Merge 'core/vdbe: Rename execute_insn_* to op_*' from Pekka Enberg
The "execute::execute_insn" prefix is noisy, let's rename the
instruction operation functions to something shorter and sweeter.

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1235
2025-04-02 17:25:12 +02:00
Pekka Enberg
265457f175 Merge 'Don't emit Transaction for simple SELECT statements' from Diego Reis
First step to close #1226.
Before:
![image](https://github.com/user-
attachments/assets/990bc6e2-a8f1-44db-9f82-f70a430663c1)
After:
![image](https://github.com/user-
attachments/assets/a587e207-d10f-487b-97b1-47b46f5dceff)
Reusing the same register is a bit trickier, I'm understanding how
SQLite does this optimization to apply here as well.
EDIT: Now we reuse the register and have the same number of bytecodes as
SQLite.
![image](https://github.com/user-
attachments/assets/bd7d769b-a680-4e77-ac2d-a3f1728bfdb7)

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1227
2025-04-02 18:12:20 +03:00
Pekka Enberg
3420955db7 core/vdbe: Rename execute_insn_* to op_*
The "execute::execute_insn" prefix is noisy, let's rename the
instruction operation functions to something shorter and sweeter.
2025-04-02 18:02:02 +03:00
Pere Diaz Bou
5dedc68fda remove arc import 2025-04-02 16:56:34 +02:00
Pekka Enberg
ee203e30ba Merge 'Remove RWLock from Shared wal state' from Pere Diaz Bou
Fixes #780
WalShared state can be shared without having to wrap everything with a
lock, and instead use atomics on some places and rwlock on others -- for
now.
## Results:
From:
----
```
Execute `SELECT 1`/limbo_execute_select_1
                        time:   [34.125 ns 34.218 ns 34.324 ns]
Execute `SELECT 1`/sqlite_execute_select_1
                        time:   [28.124 ns 28.254 ns 28.385 ns]
```
To:
----
```bash
Execute `SELECT 1`/limbo_execute_select_1
                        time:   [31.919 ns 32.113 ns 32.327 ns]
Execute `SELECT 1`/sqlite_execute_select_1
                        time:   [29.662 ns 29.900 ns 30.139 ns]

```
And with `begin_read_tx` inlined:
----
```bash
Execute `SELECT 1`/limbo_execute_select_1
                        time:   [30.543 ns 30.585 ns 30.632 ns]
```

Closes #1225
2025-04-02 17:47:45 +03:00
Pere Diaz Bou
e85fb86ff4 Request load page on insert_into_page
We assumed page was loaded because before inserting we would move there. `NewRowId` unfortunately moves cursor to the rightmost page causing eviction of root page -- this arose the issue with `insert_into_page` not loading the page we were supposed to have loaded so I added `return_if_locked_maybe_load` which is a utility macro to check if the page is locked and if not, load it if needed.
2025-04-02 16:24:53 +02:00
Pere Diaz Bou
46814d2bd7 ignore warning mut_from_ref 2025-04-02 16:18:36 +02:00
Pere Diaz Bou
e2d00a9f96 inline start transactions from pager and wal
Execute `SELECT 1`/limbo_execute_select_1
                        time:   [30.543 ns 30.585 ns 30.632 ns]
2025-04-02 16:18:36 +02:00
Pere Diaz Bou
2a49fe9bd2 Remove RWLock from Shared wal state
WalShared state can be shared without having to wrap everything with a
lock, and instead use atomics on some places and rwlock on others -- for
now.

## Results:
From:
----
Execute `SELECT 1`/limbo_execute_select_1
                        time:   [34.125 ns 34.218 ns 34.324 ns]
Execute `SELECT 1`/sqlite_execute_select_1
                        time:   [28.124 ns 28.254 ns 28.385 ns]

To:
----
Gnuplot not found, using plotters backend
Execute `SELECT 1`/limbo_execute_select_1
                        time:   [31.919 ns 32.113 ns 32.327 ns]
Execute `SELECT 1`/sqlite_execute_select_1
                        time:   [29.662 ns 29.900 ns 30.139 ns]
2025-04-02 16:18:36 +02:00
Pekka Enberg
cd5ef7c7db Merge 'Reuse register in binary expressions if they're equal ' from Diego Reis
Alongside with #1227, this PR closes #1226
Before:
![image](https://github.com/user-attachments/assets/d9fd4ff4-957d-46cd-
abe0-63d0b2c4acdb)
After:
![image](https://github.com/user-
attachments/assets/2ce4b8f1-f8f8-423a-8d35-d947de2794cb)

Closes #1234
2025-04-02 17:02:35 +03:00