Commit Graph

3236 Commits

Author SHA1 Message Date
Pere Diaz Bou
17bf67e8a9 Add first multi threaded test which fails. 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
e20dd59353 Make schema a RWLock
This makes it work like in SQLite where only one schema writer is permitted and readers will return error while preparing statement if the schema is changing.
2025-03-05 14:07:48 +01:00
Pere Diaz Bou
e4a8ee5402 move load extensions to Connection
Extensions are loaded per connection and not per database as per SQLite
behaviour. This also helps with removing locks.
2025-03-05 14:07:48 +01:00
Pere Diaz Bou
0149e86356 add todo comments to remove mutex from database structures 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
8daf7666d1 Make database Sync + Send 2025-03-05 14:07:48 +01:00
Pere Diaz Bou
205cd148ca Merge 'Enable local file connection in Rust binding' from 南宫茜
It's so weird that other bindings can open local file but Rust binding
itself cannot.

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

Closes #1095
2025-03-05 14:05:35 +01:00
Pere Diaz Bou
8012c3484a Merge 'Shell command completion' from Pedro Muniz
This PR adds tab completion to the CLI app. To achieve that I
implemented a simplified, but similar, Vtable that given a prefix and a
line, it outputs rows of candidates. Currently, it only supports auto
completion for SQLite keywords, but in the future we can autocomplete
database names and columns when `PRAGMA database_list` is implemented.
Also, some work will need to be done for detecting whether some syntax
would be legal in certain scenarios, but I think this is better
delegated to a future PR.

Closes #1050
2025-03-05 14:04:30 +01:00
Pedro Muniz
c75e1ce263 Merge branch 'main' into completions 2025-03-05 09:47:48 -03:00
Pekka Enberg
49b75d33ba Limbo 0.0.16 2025-03-05 13:46:17 +02:00
南宫茜
71921ee178 Enable local file connection in Rust binding
It's so weird that other bindings can open local file but Rust binding itself cannot.
2025-03-05 17:38:23 +08:00
pedrocarlo
5d5e6be7dd cleanup comments 2025-03-04 14:44:11 -03:00
pedrocarlo
168a2deffb merging changes from extension cleanup PR 2025-03-04 14:43:07 -03:00
pedrocarlo
04d7d8ab87 autocomplete working 2025-03-04 14:43:07 -03:00
pedrocarlo
99d979eb80 first version of vtable with keyword autocomplete 2025-03-04 14:43:07 -03:00
pedrocarlo
ca574651d9 wip 2025-03-04 14:42:13 -03:00
Pekka Enberg
9f1b43d06d Merge 'Adjust codeowners order' from Pere Diaz Bou
Last matched pattern is the one that will be used, this fixes it.

Closes #1092
2025-03-04 19:25:05 +02:00
Pekka Enberg
0f8bfefe6e Merge 'core: Clean up B-Tree creation code' from Pekka Enberg
Move page allocation to pager so that we don't need to instantiate a
cursor to create a B-Tree.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1093
2025-03-04 19:24:44 +02:00
Pekka Enberg
f57d2b32af core: Clean up B-Tree creation code
Move page allocation to pager so that we don't need to instantiate a
cursor to create a B-Tree.
2025-03-04 18:38:06 +02:00
Pere Diaz Bou
025f96e9bb adjust codeowners order 2025-03-04 17:30:50 +01:00
Pekka Enberg
d2cf4c42cb Merge 'Cursor cleanups' from Pekka Enberg
Clean up the cursor lookup code in VDBE in preparation for multi-version
cursor support.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1090
2025-03-04 15:38:58 +02:00
Pekka Enberg
f3ee86d784 core/vdbe: Replace get_btree_{table,index}_cursor() calls with get_cursor() 2025-03-04 15:17:57 +02:00
Pekka Enberg
cdcaebb878 core/vdbe: Unify B-Tree cursors 2025-03-04 14:35:40 +02:00
Pekka Enberg
8e56646b12 Merge 'core/vdbe: Kill call_external_function macro' from Pekka Enberg
The call_external_function macro has exactly one call-site and,
therefore, only makes the code harder to read.

Closes #1089
2025-03-04 14:32:20 +02:00
Pekka Enberg
1c0d9c3b46 core/vdbe: Replace get_pseudo_cursor() calls with get_cursor() 2025-03-04 14:18:52 +02:00
Pekka Enberg
c12f2aeca4 core/vdbe: Replace get_sorter() calls with get_cursor() 2025-03-04 13:51:05 +02:00
Pekka Enberg
45539a4fe5 core/vdbe: Replace get_vtab_cursor() calls with get_cursor() 2025-03-04 13:43:49 +02:00
Pekka Enberg
085f93ce79 core/vdbe: Add ProgramState::get_cursor() helper 2025-03-04 12:23:35 +02:00
Pekka Enberg
3aeb11b673 core/vdbe: Add ProgramStatem::get_btree_{table,index}_cursor() helpers 2025-03-04 11:40:43 +02:00
Pekka Enberg
222808ab6c ore/vdbe: Add ProgramState::get_pseudo_cursor() helper 2025-03-04 11:21:24 +02:00
Pekka Enberg
06446b768b core/vdbe: Add ProgramState::get_sorter() helper 2025-03-04 11:18:09 +02:00
Pekka Enberg
e4ebb6d9e1 core/vdbe: Add ProgramState::get_vtab_cursor() helper 2025-03-04 11:16:29 +02:00
Pekka Enberg
dc525dd7d1 core/vdbe: Kill call_external_function macro
The call_external_function macro has exactly one call-site and,
therefore, only makes the code harder to read.
2025-03-04 11:01:09 +02:00
Pekka Enberg
19a348c91a Merge 'Print seed for failed fuzz tests' from Pedro Muniz
Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1047
2025-03-04 10:25:47 +02:00
Pekka Enberg
ddb188132c Merge 'Clean up extension types API, introduce json text subtype' from Preston Thorpe
This PR cleans up some comments in the extension API and prevents
extensions themselves from calling 'free' on Value types that are
exposed to the user facing traits, as well as changes the `from_ffi`
method for OwnedValues to take ownership and automatically free the
values to prevent memory leaks.
This PR also finds the name of the `args: &[Value]` argument for scalar
functions in extensions, and uses that in the proc macro, instead of
relying on documentation to communicate that the parameter must be named
`args`.

Closes #1054
2025-03-04 10:24:19 +02:00
Pekka Enberg
13ae224cf7 Merge 'Minor improvements to extension docs' from Pedro Muniz
Reviewed-by: Preston Thorpe (@PThorpe92)
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1059
2025-03-04 10:23:38 +02:00
Pekka Enberg
2e4c18dca2 Merge 'Escape character is ignored in LIKE function' from lgualtieri75
Fixes #1051

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1074
2025-03-04 10:23:09 +02:00
Pekka Enberg
01f121b567 Merge 'adding limbo.quit to cleanly quit the subprocess in python tests' from Pedro Muniz
Closes #1071
2025-03-04 10:21:49 +02:00
Pekka Enberg
cedfa92b22 Merge 'Add sqlean ipaddr extension' from EmNudge
Relatively simple one, although I notice we don't have a lot of testing
here. The extensions have all their tests in the python cli extension
tests. Do we want to keep it that way or motivate inline rust tests for
these modules?

Closes #1081
2025-03-04 10:21:11 +02:00
Pekka Enberg
8a3bdbfdf3 Merge 'Add "dump" and "load" to the help menu' from EmNudge
These 2 were missing from the help menu and are both pretty useful.
Noticed `.exit` is also missing, ambivalent about this one since it's
rarely needed.
Also removed all ending periods to make these consistent (sqlite uses
this punctuation style as well)

Closes #1072
2025-03-04 10:16:59 +02:00
Pekka Enberg
bb79aeeb08 Merge 'bindings/java: Implement returning updated counts and version information ' from Kim Seon Woo
### Purpose
- Do some minor nits
  - Implement logic that returns updated count when running
executeUpdate
  - Implement version related functions
### Reference
- https://github.com/tursodatabase/limbo/issues/615

Closes #1086
2025-03-04 09:38:32 +02:00
Pekka Enberg
fb91477e51 Merge 'Display blobs as blob literals in .dump' from Mohamed Hossam
Fixes [#1084](https://github.com/tursodatabase/limbo/issues/1084),
displays blobs as blob literals for the `.dump` command:
```
limbo> CREATE TABLE IF NOT EXISTS files (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    data BLOB
);
INSERT INTO files (data) VALUES (X'89504E470D0A1A0A0000000D49484452000000');
limbo> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE files (id INTEGER PRIMARY KEY AUTOINCREMENT, data BLOB);
INSERT INTO files VALUES(1,X'89504e470d0a1a0a0000000d49484452000000');
COMMIT;
```

Closes #1087
2025-03-04 09:37:51 +02:00
Pekka Enberg
3204c889eb Merge 'Antithesis testing' from Pekka Enberg
Closes #1063
2025-03-04 09:34:18 +02:00
Pekka Enberg
be4014a1df Initial pass on Antithesis testing
This adds a "limbo_stress" tool for stress testing Limbo in
non-deterministic way together with support code to run the tests under
Antithesis (which makes them deterministic). The stress tester does not
really do anything useful yet, this is just a step to make sure we can
run tests under Antithesis.
2025-03-04 09:29:57 +02:00
m0hossam
37df657b87 Use fold() and write! macro instead of format! 2025-03-03 17:31:49 +02:00
m0hossam
dbe0a64d50 Display blob literals in .dump 2025-03-03 16:43:21 +02:00
김선우
412bdf5585 Apply cargo formatting 2025-03-03 21:55:10 +09:00
Pere Diaz Bou
c393ce896a Merge 'Add BalanceInfo into WriteInfo' from Pere Diaz Bou
This PR is a cleanup of stuff that I found while eating a burguer:
* `WriteInfo` now includes `BalanceInfo` to hold balance information so
that we can release it at will.
* Remove: `new_pages` and `scratch_cells`
* Once `balance_non_root` completes, it now resets state to
`BalanceStart` so that we can trigger other balance if needed. (we need
to add tests for this).
* Remove extra allocation of divider cells.

Closes #1082
2025-03-03 11:38:13 +01:00
김선우
f8052a9860 Implement totalChanges 2025-03-03 14:35:23 +09:00
김선우
6b223421ae Extract LimboPropertiesHolder 2025-03-03 14:35:23 +09:00
Pere Diaz Bou
1de4861414 fix balance_non_root should trigger balance again 2025-03-02 23:16:32 +01:00