Nikita Sivukhin
8d513b229f
add simple tcl tests
2025-02-02 19:43:13 +04:00
Nikita Sivukhin
1bd8b4ef7a
pass null_eq flag for instructions generated for expressions (not in the conditions)
2025-02-02 02:51:51 +04:00
Kould
1bf651bd37
chore: rollback using rowid(sqlite3 unsupported)
2025-01-14 22:56:49 +08:00
Kould
5305a9d0fd
feat: support keyword rowid
2025-01-14 22:41:40 +08:00
Jussi Saurio
1bcdf99eab
core/optimizer: do expression rewriting on all expressions
2025-01-10 10:04:07 +02:00
psvri
2d84956fda
Fix quote escape in literals
2025-01-05 01:35:29 +05:30
Kacper Madej
9e01c22a5e
Handle quoting identifiers properly
2024-12-18 19:45:06 +01:00
Alex Miller
88c862ce4d
Comments, resolve label better, make tests more fun
2024-12-10 19:59:54 -08:00
Alex Miller
eb00226cfe
Add support for CASE expressions.
...
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 18 0 0 Start at 18
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 17 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 14 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 14 0 0
14 ResultRow 1 1 0 0 output=r[1]
15 NextAsync 0 0 0 0
16 NextAwait 0 5 0 0
17 Halt 0 0 0 0
18 Transaction 0 0 0 0
19 Integer 0 1 0 0 r[1]=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.
2024-12-08 14:09:03 -08:00
Pekka Enberg
5efc218e6e
Merge 'support subtract in translate_expr() (not in condition expressions yet)' from Jussi Saurio
...
closes #402
Closes #403
2024-11-18 09:28:23 +02:00
jussisaurio
491bdd3bfc
support subtract in translate_expr() (not in condition expressions yet)
2024-11-17 18:47:16 +02:00
jussisaurio
9a4864bc6a
support parenthesized(single expr) in translate_expr()
2024-11-17 18:36:30 +02:00
jussisaurio
db0e2ea54f
Change another compat test to work around sqlite's weird choice to use the age index
2024-10-05 18:25:04 +03:00
Lauri Virtanen
0597c048fc
Better support for BLOBs
...
- Limbo command line shell supports e.g. `SELECT x'616263';`
- `EXPLAIN SELECT x'616263';` lists the opcode
Missing:
- Command line shell not entirely compatible with SQLite when blobs have
non-printable characters in the middle (e.g. `SELECT x'610062';`)
- Python bindings not supported (incoming soon)
2024-09-22 17:55:00 +03:00
jussisaurio
d70eb6b3d7
fix seekrowid operator not emitting result when root
2024-08-17 09:16:24 +03:00
jussisaurio
2e32ca0bdb
More structured query planner
2024-08-16 19:42:03 +03:00
Pekka Enberg
0c703a228d
testing: Make individual test files executable
...
Each test file is standalone to make it easy to run just some specific
tests. However, some of the files didn't have the executable bit.
2024-07-29 09:41:40 +03:00
Bennett Clement
0bf0b41692
Use case insensitive lookup for table and column
2024-07-22 16:27:36 +08:00
Pekka Enberg
190e5844e7
testing: select.test
2024-07-16 07:26:44 +03:00