Commit Graph

91 Commits

Author SHA1 Message Date
PThorpe92
04abb200a7 Get name of argument for scalars in extensions to allow for less rigid naming 2025-03-01 14:27:33 -05:00
PThorpe92
e7713e87ec Prevent extensions from accidentally freeing value types, fix comments 2025-03-01 14:27:33 -05:00
Pekka Enberg
7f2525ac27 Merge 'Implement create virtual table using vtab modules, more work on virtual tables' from Preston Thorpe
This PR started out as one to improve the API of extensions but I ended
up building on top of this quite a bit and it just kept going. Sorry
this one is so large but there wasn't really a good stopping point, as
it kept leaving stuff in broken states.
**VCreate**: Support for `CREATE VIRTUAL TABLE t USING vtab_module`
**VUpdate**: Support for `INSERT` and `DELETE` methods on virtual
tables.
Sqlite uses `xUpdate` function with the `VUpdate` opcode to handle all
insert/update/delete functionality in virtual tables..
have to just document that:
```
if args[0] == NULL:  INSERT args[1] the values in args[2..]

if args[1] == NULL: DELETE args[0]

if args[0] != NULL && len(args) > 2: Update values=args[2..]  rowid=args[0]
```
I know I asked @jussisaurio on discord about this already, but it just
sucked so bad that I added some internal translation so we could expose
a [nice API](https://github.com/tursodatabase/limbo/pull/996/files#diff-
3e8f8a660b11786745b48b528222d11671e9f19fa00a032a4eefb5412e8200d1R54) and
handle the logic ourselves while keeping with sqlite's opcodes.
I'll change it back if I have to, I just thought it was genuinely awful
to have to rely on comments to explain all that to extension authors.
The included extension is not meant to be a legitimately useful one, it
is there for testing purposes. I did something similar in #960 using a
test extension, so I figure when they are both merged, I will go back
and combine them into one since you can do many kinds at once, and that
way it will reduce the amount of crates and therefore compile time.
1. Remaining opcodes.
2. `UPDATE` (when we support the syntax)
3. `xConnect` - expose API for a DB connection to a vtab so it can
perform arbitrary queries.

Closes #996
2025-02-25 15:31:12 +02:00
meteorgan
97337614db extensions/time: normalize offset_sec 2025-02-19 21:25:14 +08:00
Pekka Enberg
8ac09b73bf extensions/uuid: Fix mimalloc version 2025-02-18 20:08:30 +02:00
Pekka Enberg
a783a4d17c extensions/time: Fix mimalloc version 2025-02-18 20:08:17 +02:00
Pekka Enberg
11a93900e3 extensions/core: Fix mimalloc version in README.md 2025-02-18 20:07:45 +02:00
Pekka Enberg
25f0694dfc extensions/series: Fix mimalloc version 2025-02-18 20:07:09 +02:00
Pekka Enberg
bd6083c66d extensions/regexp: Fix mimalloc version 2025-02-18 20:06:43 +02:00
Pekka Enberg
89202f0be3 extensions/percentile: Fix mimalloc version 2025-02-18 20:05:51 +02:00
Pekka Enberg
45a015f5c2 extensions/crypto: Fix mimalloc version 2025-02-18 20:05:10 +02:00
Pekka Enberg
19903bbe5f extensions/uuid: Add description to Cargo.toml 2025-02-18 19:38:25 +02:00
Pekka Enberg
6cb6f6308f extensions/time: Add description to Cargo.toml 2025-02-18 19:38:04 +02:00
Pekka Enberg
e8d98250c2 extensions/series: Add description to Cargo.toml 2025-02-18 19:37:42 +02:00
Pekka Enberg
215fc66360 extensions/regexp: Add description to Cargo.toml 2025-02-18 19:36:36 +02:00
Pekka Enberg
38c76f1831 extensions/percentile: Add description to Cargo.toml 2025-02-18 19:36:10 +02:00
Pekka Enberg
237246b3ca extensions/crypto: Add description to Cargo.toml 2025-02-18 19:35:42 +02:00
Pekka Enberg
9b84e7e919 extensions/core: Add description to Cargo.toml 2025-02-18 19:34:32 +02:00
PThorpe92
7b05f53335 Add more tests for vtab impl 2025-02-17 23:22:02 -05:00
PThorpe92
c4f42549f4 Fix selecting from empty table error in kv extension 2025-02-17 22:53:51 -05:00
PThorpe92
e63436dc47 Fix sqlite_schema and remove explicit vtables 2025-02-17 20:44:45 -05:00
PThorpe92
38e54ca85e Update schema dot command to show virtual tables 2025-02-17 20:44:45 -05:00
PThorpe92
0547d397b1 Update extension api for vtable interface 2025-02-17 20:44:45 -05:00
PThorpe92
813e7e57d8 Add simple demo vtable extension kvstore 2025-02-17 20:44:44 -05:00
PThorpe92
9c8083231c Implement create virtual table and VUpdate opcode 2025-02-17 20:44:44 -05:00
PThorpe92
d775b3ea5a Improve extension API with results, fix paths in proc macros 2025-02-17 20:44:39 -05:00
Pekka Enberg
43574528c9 Merge 'Switch to workspace dependencies' from Pekka Enberg
...makes it easier to specify a version, which is needed for `cargo
publish`.

Closes #991
2025-02-14 12:21:24 +02:00
meteorgan
744df6eedf fix some typo 2025-02-13 23:03:41 +08:00
Pekka Enberg
ac54c35f92 Switch to workspace dependencies
...makes it easier to specify a version, which is needed for `cargo publish`.
2025-02-12 17:28:04 +02:00
l.gualtieri
6bd40f0507 Add support for REGEXP_REPLACE in limbo extension #740 2025-02-11 20:04:59 +01:00
Aarni Koskela
eaea02c567 Fix a handful of typos 2025-02-09 18:08:29 +02:00
meteorgan
a99d9a8988 chore: remove unused dependencies 2025-02-09 21:05:06 +08:00
Jussi Saurio
49e08c43b7 remove invalid comments 2025-02-07 10:11:31 +02:00
Jussi Saurio
cb9d929eab call cursor methods instead of duplicating logic 2025-02-07 10:09:42 +02:00
Jussi Saurio
93c3689070 make tests better and fix more edge cases 2025-02-06 23:41:31 +02:00
Jussi Saurio
d5f58f5fea Add quickcheck tests for generate_series() and refine implementation 2025-02-06 18:36:21 +02:00
PThorpe92
cd83ac6146 Remove error from vcursor trait in extensions 2025-02-06 09:15:39 -05:00
PThorpe92
a8ae957162 Add tests for series extension, finish initial vtable impl 2025-02-06 09:15:39 -05:00
PThorpe92
ad30ccdc0e Add docs in extension README for vtable modules 2025-02-06 09:15:39 -05:00
PThorpe92
d4c06545e1 Refactor vtable impl and remove Rc Refcell from module 2025-02-06 09:15:39 -05:00
PThorpe92
661c74e338 Apply new planner structure to virtual table impl 2025-02-06 09:15:28 -05:00
Jussi Saurio
f5f77c0bd1 Initial virtual table implementation 2025-02-06 07:51:50 -05:00
Pekka Enberg
238fb9c977 Merge 'Sqlean Crypto extension' from Diego Reis
Introduces a new `crypto` extension, compatible with the Sqlean [crypto
extension](https://github.com/nalgeon/sqlean/blob/main/docs/crypto.md).

Closes #903
2025-02-06 13:46:01 +02:00
Diego Reis
05057a04ac completes crypto extension
It aims to be compatible with https://github.com/nalgeon/sqlean/blob/main/docs/crypto.md
2025-02-06 01:42:47 -03:00
Diego Reis
846d5ed414 add md5 and encode to extension 2025-02-06 00:04:36 -03:00
Diego Reis
dd58be3b60 Add basic structure for crypto extension 2025-02-05 23:09:26 -03:00
krishvishal
7c86ac71da Move vector out of extensions 2025-02-06 06:57:53 +05:30
pedrocarlo
a4251e0448 add dynamic linking in extensions/time/Cargo.toml 2025-02-01 20:14:23 -03:00
pedrocarlo
26f24f93ad cargo clippy 2025-02-01 16:28:40 -03:00
pedrocarlo
9acba9c140 added tests 2025-02-01 16:13:37 -03:00