psvri
3ac3fdf0a2
Fix glob
2024-12-30 17:02:31 +05:30
Lauri Virtanen
10065bda35
Don't use inaccurate pi values, make clippy happy
2024-12-29 19:22:45 +02:00
Lauri Virtanen
854005b977
Run cargo clippy --fix && cargo fmt
2024-12-29 19:22:28 +02:00
PThorpe92
f6cd707544
Add clippy CI, fix or ignore warnings where appropriate
2024-12-29 10:25:41 -05:00
Pekka Enberg
f87dc7cacc
Merge 'Support like function with escape' from Vrishabh
...
I have added support for like function with escape i.e like(X,Y,Z) .
There is good opportunity to refactor/cleanup the like operations which
can be done in another PR, as I wanted to keep the changes small .
Closes #568
2024-12-29 16:58:06 +02:00
adamnemecek
97647ff056
Clean up code to use Self
...
Closes #556
2024-12-29 10:07:38 +02:00
psvri
1922b8ea38
Support like function with escape
2024-12-28 13:55:12 +05:30
PThorpe92
f08d62b446
Add Remainder vdbe oppcode
2024-12-27 15:39:02 -05:00
Pekka Enberg
5b8f00cb8d
Merge 'Fixes like function when pattern has regex meta chars' from Vrishabh
...
Fixes #552
In our construct regex function, we were not escaping the required
characters properly which was causing the failure.
Limbo output with this branch
```
limbo> select like('\%A', '\A');
1
limbo> select like('A$%', 'A$');
1
limbo> select like('%a.a', 'aaaa');
0
```
Closes #553
2024-12-27 18:35:47 +02:00
김선우
ad2d515ffd
Merge branch 'main' into feature/delete-planning
2024-12-27 23:21:35 +09:00
Peter Sooley
28244b10d6
implement json_array_length
2024-12-26 15:08:11 -08:00
psvri
12e49da1d0
fmt fixes
2024-12-26 22:42:46 +05:30
psvri
4368e8767b
Fix like function giving wrong results
2024-12-26 22:38:54 +05:30
Pekka Enberg
37e1f35df8
Fix Cargo.toml in macros crate
2024-12-25 11:54:16 +02:00
Pere Diaz Bou
aed14117c9
core: transaction support
2024-12-24 18:04:30 +01:00
김선우
56165fb0d6
Merge branch 'main' into feature/delete-planning
2024-12-24 12:29:19 +09:00
김선우
57c7a56e35
Apply fmt, clippy
2024-12-22 14:27:21 +09:00
김선우
9a8b94ef93
First successful implementation of delete planning
2024-12-22 13:16:16 +09:00
PThorpe92
c06c4115f1
Adapt OwnedValues in uuid ext to new LimboText
2024-12-21 09:17:53 -05:00
PThorpe92
2fcae80902
Create ext directory for outside funcs, add uuid to ext dir
2024-12-21 09:16:04 -05:00
PThorpe92
c1561ecbb0
Tests for uuid funcitons, add compat docs
2024-12-21 09:13:48 -05:00
PThorpe92
b207f7ded5
Give uuidv7 optional unix time arg
2024-12-21 09:13:48 -05:00
PThorpe92
fcab0ae299
Add uuid support for v4 and v7
2024-12-21 09:13:46 -05:00
vignesh-j-shetty
a43a1d204c
renamed macro crate
2024-12-21 13:19:04 +05:30
vignesh-j-shetty
1e72fee343
Implemented proc_macro_derive extract description from rust docs and generate get_description function
2024-12-21 12:23:04 +05:30
jussisaurio
5b4ef4412b
Merge 'Implement json_array' from Kacper Madej
...
Implements [json_array](https://sqlite.org/json1.html#jarray ).
As a side quest, this PR also fixes an issue with the `CHAR` function
which didn't work properly if the parameters were non-leaf AST nodes.
The PR is quite big, because as I mentioned in https://github.com/tursod
atabase/limbo/issues/127#issuecomment-2541307979 we had to modify
`OwnedValue::Text` to support a `subtype` parameter, which is what
SQLite does.
Closes #504
2024-12-20 16:35:40 +02:00
Kacper Madej
cdb24d3de1
Handle issues with nested arguments
2024-12-20 11:32:57 +01:00
Kacper Madej
19ae42dfa3
Implement json_array
2024-12-20 11:15:48 +01:00
Pekka Enberg
e93ac38e55
Add statement interruption support
...
This adds an interrupt() method to Statement that allows apps to
interrupt a running statement. Please note that this is different from
`sqlite3_interrupt()` which interrupts all ongoing operations in a
database. Although we want to support that too, per statement interrupt
is much more useful to apps.
2024-12-19 12:30:32 +02:00
Lauri Virtanen
fe42930239
Take log function argument count from function context
2024-12-17 00:14:26 +02:00
Lauri Virtanen
f5c82503f9
Be more explicit with pi() being the only nullary math function
2024-12-17 00:14:25 +02:00
Lauri Virtanen
e69ee80fac
Support log(X) and log(B,X) math functions
2024-12-17 00:14:25 +02:00
Lauri Virtanen
89d0289444
Support pi() function
2024-12-17 00:14:25 +02:00
Lauri Virtanen
5e426a7624
Support binary math functions
2024-12-16 22:29:05 +02:00
Lauri Virtanen
f69fdc1645
Support unary math functions
2024-12-16 19:31:20 +02:00
Lauri Virtanen
9720f63a55
Add types for mathematical functions
2024-12-16 19:31:20 +02:00
Kacper Kołodziej
c04839d9e0
functions: add unhex(x, y) version
...
For `unhex(x, y)` handle trimming `y` characters from the beginning and
end of `x` value before decoding.
Part of solutions of #144 .
2024-12-14 00:55:44 +01:00
alpaylan
4f395623ab
fix the comment on replace panic in case of text cast failure
2024-12-12 15:03:35 -05:00
Alperen Keleş
841a4fe2f8
Merge branch 'tursodatabase:main' into main
2024-12-12 13:13:41 -05:00
Pekka Enberg
5796b418b9
Merge 'Add support for soundex() function' from flaneur
...
add [soundex](https://www.sqlite.org/lang_corefunc.html#soundex ) scalar
function.
it seems that sqlite did not enable `soundex()` function by default
unless build it with `SQLITE_SOUNDEX`, while the sqlite in the ci
workflow did not enable it. this pr skipped the test over `soundex()`
temporarily in the `scalar-function.test` file.
Closes #453
2024-12-12 18:10:46 +02:00
Pekka Enberg
91764b85e6
Merge 'Add bitwise vdbe ops' from Preston Thorpe
...
Love the project, been following your blog posts for quite a while now.
I asked on Discord prior to submitting this, just because I didn't see a
specific issue for this feature... but if this PR is out of scope for
contributors, feel free to close it as I just had a good time hacking on
it.
This PR adds support for `BitAnd`, `BitOr`, and `BitNot` operators in
the vdbe, as well as unary expressions applied to aggregate functions;
which was needed in order to have `BitNot` support the same tests that
the other operators had.
*Also added unary negation of function calls, because since unary ops
were added, I figured adding support for the other existing unary
operator might be in scope, but lmk if not.
Let me know if there is any more tests or documentation to add/improve.
Closes #445
2024-12-12 17:35:12 +02:00
Li Yazhou
03288e5170
add impl about scalar function soundex with test
2024-12-12 21:48:05 +08:00
Alex Miller
c4d4569dc9
Merge remote-tracking branch 'upstream/main' into expr-iif
2024-12-11 20:13:54 -08:00
alpaylan
021456326e
change 0.1+0.2 test into 0.3 as limbo does not yet support decimals
2024-12-11 16:32:06 -05:00
alpaylan
da28ed51ca
add implementation and tests for replace scalar function
2024-12-11 16:23:13 -05:00
PThorpe92
d5391dc716
Add vdbe bitwise operators: and, or, not
2024-12-11 11:06:22 -05:00
jussisaurio
eb9374aebf
Merge 'Add support for CASE expressions.' from Alex Miller
...
There's two forms of case:
CASE (WHEN [bool expr] THEN [value])+ (ELSE [value])? END
which checks a series of boolean conditions, and:
CASE expr (WHEN [expr] THEN [value})+ (ELSE [value])? END
Which checks a series of equality conditions.
This implements support for both. Note that the ELSE is optional, and
will be equivalent to `ELSE null` if not specified.
sqlite3 gives the implementation as:
```
sqlite> explain select case a WHEN a THEN b WHEN c THEN d ELSE 0 END from casetest;
addr opcode p1 p2 p3 p4 p5 comment
---- ------------- ---- ---- ---- ------------- -- -------------
0 Init 0 16 0 0 Start at 16
1 OpenRead 0 3 0 4 0 root=3 iDb=0; casetest
2 Rewind 0 15 0 0
3 Column 0 0 2 0 r[2]= cursor 0 column 0
4 Column 0 0 3 0 r[3]= cursor 0 column 0
5 Ne 3 8 2 BINARY-8 83 if r[2]!=r[3] goto 8
6 Column 0 1 1 0 r[1]= cursor 0 column 1
7 Goto 0 13 0 0
8 Column 0 2 3 0 r[3]= cursor 0 column 2
9 Ne 3 12 2 BINARY-8 83 if r[2]!=r[3] goto 12
10 Column 0 3 1 0 r[1]= cursor 0 column 3
11 Goto 0 13 0 0
12 Integer 0 1 0 0 r[1]=0
13 ResultRow 1 1 0 0 output=r[1]
14 Next 0 3 0 1
15 Halt 0 0 0 0
16 Transaction 0 0 2 0 1 usesStmtJournal=0
17 Goto 0 1 0 0
```
and after this patch, limbo gives:
```
addr opcode p1 p2 p3 p4 p5 comment
---- ----------------- ---- ---- ---- ------------- -- -------
0 Init 0 19 0 0 Start at 19
1 OpenReadAsync 0 4 0 0 table=casetest, root=4
2 OpenReadAwait 0 0 0 0
3 RewindAsync 0 0 0 0
4 RewindAwait 0 18 0 0 Rewind table casetest
5 Column 0 0 2 0 r[2]=casetest.a
6 Column 0 0 3 0 r[3]=casetest.a
7 Ne 2 3 10 0 if r[2]!=r[3] goto 10
8 Column 0 1 1 0 r[1]=casetest.b
9 Goto 0 15 0 0
10 Column 0 2 3 0 r[3]=casetest.c
11 Ne 2 3 14 0 if r[2]!=r[3] goto 14
12 Column 0 3 1 0 r[1]=casetest.d
13 Goto 0 15 0 0
14 Integer 0 1 0 0 r[1]=0
15 ResultRow 1 1 0 0 output=r[1]
16 NextAsync 0 0 0 0
17 NextAwait 0 5 0 0
18 Halt 0 0 0 0
19 Transaction 0 0 0 0
20 Goto 0 1 0 0
```
And then as there's nowhere to annotate this new support in COMPAT.md, I
added a corresponding heading for SELECT expressions and what is/isn't
supported.
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com >
Closes #425
2024-12-11 17:05:41 +02:00
Pekka Enberg
04f196113a
Merge 'Add last_insert_rowid() function' from Krishna Vishal
...
- Changed `Cursor` trait to be able to get access to `root_page`
- SQLite only updates last_insert_rowid for non-schema inserts. So we
check if the `InsertAwait` is not for `root_page` before updating
rowid
In SQLite it looks like this:
```
sqlite> EXPLAIN SELECT last_insert_rowid();
addr opcode p1 p2 p3 p4 p5 comment
---- ------------- ---- ---- ---- ------------- -- -------------
0 Init 0 4 0 0
1 Function 0 0 1 last_insert_rowid(0) 0
2 ResultRow 1 1 0 0
3 Halt 0 0 0 0
4 Goto 0 1 0 0
```
In limbo it will look like this:
```
limbo> EXPLAIN SELECT last_insert_rowid();
addr opcode p1 p2 p3 p4 p5 comment
---- ----------------- ---- ---- ---- ------------- -- -------
0 Init 0 4 0 0 Start at 4
1 Function 0 2 1 last_insert_rowid 0 r[1]=func()
2 ResultRow 1 1 0 0 output=r[1]
3 Halt 0 0 0 0
4 Transaction 0 0 0 0
5 Goto 0 1 0 0
```
Closes #427
2024-12-11 10:44:34 +02:00
Pekka Enberg
eda1f5396c
Merge 'Add octet_length scalar function' from Kacper Kołodziej
...
Adds `octet_length` scalar function.
Part of solution for: #144
Closes #430
2024-12-11 07:44:04 +02:00
Kacper Kołodziej
d4bff2c93e
add octet_length scalar function
2024-12-10 22:56:38 +01:00