Commit Graph

38 Commits

Author SHA1 Message Date
Pekka Enberg
20d3399c71 Merge 'implement is and is not where constraints' from Glauber Costa
The main difference between = and != is how null values are handled.
SQLite passes a flag "NULLEQ" to Eq and Ne to disambiguate that.
In the presence of that flag, NULL = NULL.
Some prep work is done to make sure we can pass a flag instead of a
boolean to Eq and Ne. I looked into the bitflags crate but got a bit
scared with the list of dependencies.
Warning:
The following query produces a different result for Limbo:
```
select * from demo where value is null or id == 2;
```
I strongly suspect the issue is with the OR implementation, though. The
bytecode generated is quite different.

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

Closes #847
2025-02-01 17:24:11 +02:00
Glauber Costa
f300d2c8e8 rename register for IsNull opcode
Now it has the same name as NotNull, so it is easier to write macros
2025-01-31 19:09:01 -05:00
Glauber Costa
7aa3cc26ad simplify the writing of bytecode programs
Instead of always having the caller specify all instructions, this
work introduces convenience functions into the program builder,
making the code a lot cleaner.
2025-01-31 11:35:51 -05:00
PThorpe92
545990f806 Support returning column names from prepared statement 2025-01-23 11:02:31 -05:00
Jussi Saurio
f88a4d6ac6 Add jump_if_null to cmp insns to account for either operand being NULL 2025-01-20 16:54:39 +02:00
ben594
28ce68091f Modified changes and total_changes scalarfuncs to be more like sqlite
Fmt and clippy

Remove print
2025-01-19 20:51:13 -05:00
Jorge López
2cc8cb9ad8 syntactic changes: use assert_eq!() instead of assert!() for equality comparisons 2025-01-18 18:37:50 +01:00
Levy A.
9b8722f38e refactor: more well rounded implementation
`?0` parameters are now handled by the parser.
2025-01-15 16:53:26 -03:00
Levy A.
5de2694834 feat: more parameter support
add `Statement::{parameter_index, parameter_name, parameter_count,
bind_at}`. some refactoring is still needed, this is quite a rough
iteration
2025-01-15 16:51:04 -03:00
Levy A.
d3582a382f fix: small bugs 2025-01-15 16:51:04 -03:00
Levy A.
08c8c655e9 feat: initial implementation of Statement::bind 2025-01-15 16:51:04 -03:00
Jussi Saurio
9909539b9d Store cursor type (table,index,pseudo,sorter) when allocating cursor 2025-01-11 17:04:16 +02:00
Jussi Saurio
731ff1480f Simplify working with labels
TLDR: no need to call either of:

program.emit_insn_with_label_dependency() -> just call program.emit_insn()
program.defer_label_resolution() -> just call program.resolve_label()

Changes:

- make BranchOffset an explicit enum (Label, Offset, Placeholder)
- remove program.emit_insn_with_label_dependency() - label dependency is automatically detected
- for label to offset mapping, use a hashmap from label(negative i32) to offset (positive u32)
- resolve all labels in program.build()
- remove program.defer_label_resolution() - all labels are resolved in build()
2025-01-07 12:53:10 +02:00
김선우
ad2d515ffd Merge branch 'main' into feature/delete-planning 2024-12-27 23:21:35 +09:00
Pekka Enberg
464508bb29 core/vdbe: Kill unused next_free_register() 2024-12-27 10:55:31 +02:00
김선우
906975e1ca Add limit support 2024-12-24 12:25:04 +09:00
jussisaurio
885b6ecd76 Remove 'cursor_hint': it is never needed 2024-11-26 17:31:51 +02:00
jussisaurio
7ecc252507 fix rest of the failing tests 2024-11-26 17:31:51 +02:00
limeng.1
8cca659052 impl order by desc 2024-11-19 11:39:07 +08:00
Pere Diaz Bou
d1dee484df properly format table and "if not exists" support 2024-11-16 17:02:53 +01:00
Pekka Enberg
fc5e42bb94 CREATE TABLE support 2024-11-16 13:07:10 +01:00
Pere Diaz Bou
c0e51c4ca6 wip wal 2024-11-05 15:29:53 +01:00
jussisaurio
f02da18acd index scan wip foo doesnt work yet 2024-10-05 18:25:04 +03:00
김선우
28884181be Fix clippy 2024-09-15 16:23:27 +09:00
jussisaurio
a108dea825 GROUP BY 2024-09-14 16:14:45 +03:00
jussisaurio
e8c894e532 More flexible Emitter via stateful operators 2024-08-17 12:55:16 +03:00
jussisaurio
20c085614f Add ability to annotate instructions with comments 2024-08-01 20:34:45 +03:00
jussisaurio
f344e07868 extract method 2024-08-01 17:54:29 +03:00
jussisaurio
551b11303f Broaden the type of expr that qualifies as seekrowid candidate 2024-08-01 17:23:59 +03:00
jussisaurio
97dfae437c SeekRowid VM instruction 2024-08-01 17:23:59 +03:00
Pekka Enberg
f8a43361db core: Move pager.rs to storage module 2024-08-01 11:52:50 +03:00
Pere Diaz Bou
84bf0ea96a core: remove a bunch of warnings
Signed-off-by: Pere Diaz Bou <pere-altea@hotmail.com>
2024-07-31 17:27:02 +02:00
Pere Diaz Bou
463292c2fe core: fix rebase errors 2024-07-31 17:27:02 +02:00
Pere Diaz Bou
e6f8b34f2b core: insert_to_page almost complete 2024-07-31 17:27:02 +02:00
Pekka Enberg
0cb993e152 Merge pull request #204 from jussisaurio/multi-way-join
Refactor join processing / support multiway joins
2024-07-24 11:06:32 +03:00
jussisaurio
588ab1af06 Run formatting and enforce formatting in CI 2024-07-23 23:14:36 +03:00
jussisaurio
84cf4033d5 Refactor join processing
- Make all constraints a list of WhereTerms in a ProcessedWhereClause
- Support multiple joins instead of just one
2024-07-23 15:04:40 +03:00
Pekka Enberg
8f00888a6c core: Move ProgramBuilder to vdbe/builder module 2024-07-23 14:30:31 +03:00