Sachin Singh
01fa02364d
correctly handle edge cases
2025-04-11 08:34:29 +05:30
Sachin Singh
5ffdd42f12
Additional tests
2025-04-11 06:02:07 +05:30
Duncan Lutz
aa7c64cb19
feat: added likely scalar function
2025-04-06 23:14:30 -06:00
PThorpe92
66f0835d51
Add tests for corrected behavior around casting
2025-02-24 11:21:25 -05:00
Jussi Saurio
baf2aec3e9
Fix incorrect CAST text->numeric if valid prefix is 1 char long
2025-02-18 15:07:36 +02:00
Nikita Sivukhin
2ee5382689
add substr cases in TCL tests
2025-02-15 13:25:49 +04:00
Pekka Enberg
00a546e775
Merge 'Fix string funcs' from Nikita Sivukhin
...
Add fuzz test for string functions and fix 2 bugs in implementation of
`LTRIM/RTRIM/TRIM` and `QUOTE`:
- `QUOTE` needs to escape internal quote(`'`) symbols
- `LTRIM`/`RTRIM`/`TRIM` needs to check if they have additional argument
Closes #958
2025-02-10 11:17:51 +02:00
Pekka Enberg
55058cade3
Merge 'Fix cast' from Nikita Sivukhin
...
Fix codegen for `CAST` expression and also adjust implementation of
`CAST: Real -> Int` because `SQLite` use "closest integer between the
REAL value and zero" as a CAST result.
Closes #956
2025-02-10 10:53:56 +02:00
Nikita Sivukhin
5fa6a452c1
add TCL test for quoting of quotes
2025-02-09 23:43:34 +04:00
Nikita Sivukhin
3c4d9a93af
fix rounding of REAL to INTEGER
...
- SQLite rounds (x: f64) to the nearest number between x and 0 - so
basically truncates the x
2025-02-09 22:32:54 +04:00
Aarni Koskela
eaea02c567
Fix a handful of typos
2025-02-09 18:08:29 +02:00
Diego Reis
2d0c16c428
Fix sqlite_version() out of bound
2024-12-27 11:39:33 -03:00
Kacper Madej
cdb24d3de1
Handle issues with nested arguments
2024-12-20 11:32:57 +01:00
Kacper Kołodziej
64bfa2eb79
test: unhex(x, y) suite
...
Tests for `unhex(x, y)` (two arguments version).
Part of solution for #144
2024-12-14 00:55:44 +01:00
Pekka Enberg
2b85d2a600
Merge 'Add implementation and tests for replace scalar function' from Alperen Keleş
...
Adds `replace` scalar function.
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Closes #446
2024-12-13 11:02:08 +02:00
JeanArhancet
8bf6572e9e
feat: support unary positive
2024-12-13 02:07:34 +01:00
Alperen Keleş
841a4fe2f8
Merge branch 'tursodatabase:main' into main
2024-12-12 13:13:41 -05: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
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
Alex Miller
e85df1c895
resolve labels to current offset. make test clearer.
2024-12-10 19:36:54 -08:00
Kacper Kołodziej
e4d31cbe34
add tests for octet_length scalar function
2024-12-10 22:56:38 +01:00
Kacper Kołodziej
e68a86532a
tests: length function with multibyte characters
...
Depending on encoding, some characters have more than one byte. Add
failing test to verify if current implementation of scalar function
`length` takes that into account.
2024-12-10 22:47:22 +01:00
Alex Miller
183ea8e362
Implement support for iif().
...
In sqlite, iif() looks like:
sqlite> create table iiftest(a int, b int, c int);
sqlite> explain select iif(a,b,c) from iiftest;
addr opcode p1 p2 p3 p4 p5 comment
---- ------------- ---- ---- ---- ------------- -- -------------
0 Init 0 11 0 0 Start at 11
1 OpenRead 0 2 0 3 0 root=2 iDb=0; iiftest
2 Rewind 0 10 0 0
3 Column 0 0 2 0 r[2]= cursor 0 column 0
4 IfNot 2 7 1 0
5 Column 0 1 1 0 r[1]= cursor 0 column 1
6 Goto 0 8 0 0
7 Column 0 2 1 0 r[1]= cursor 0 column 2
8 ResultRow 1 1 0 0 output=r[1]
9 Next 0 3 0 1
10 Halt 0 0 0 0
11 Transaction 0 0 1 0 1 usesStmtJournal=0
12 Goto 0 1 0 0
And with this change, in limbo it looks like:
addr opcode p1 p2 p3 p4 p5 comment
---- ----------------- ---- ---- ---- ------------- -- -------
0 Init 0 14 0 0 Start at 14
1 OpenReadAsync 0 2 0 0 table=iiftest, root=2
2 OpenReadAwait 0 0 0 0
3 RewindAsync 0 0 0 0
4 RewindAwait 0 13 0 0 Rewind table iiftest
5 Column 0 0 2 0 r[2]=iiftest.a
6 IfNot 2 9 1 0 if !r[2] goto 9
7 Column 0 1 1 0 r[1]=iiftest.b
8 Goto 0 10 0 0
9 Column 0 2 1 0 r[1]=iiftest.c
10 ResultRow 1 1 0 0 output=r[1]
11 NextAsync 0 0 0 0
12 NextAwait 0 5 0 0
13 Halt 0 0 0 0
14 Transaction 0 0 0 0
15 Goto 0 1 0 0
2024-12-07 21:04:03 -08:00
jussisaurio
ddd0cc041c
implement CAST(col as type)
2024-11-17 22:12:22 +02:00
Lauri Virtanen
0ae1412193
Add instr(X,Y)
scalar function
...
Relates to issue #144
2024-10-06 20:19:37 +03:00
Lauri Virtanen
9e80a0c4a8
Add randomblob(N)
scalar function
...
Relates to issue #144
2024-10-03 00:05:23 +03:00
Pekka Enberg
6fcd818160
Merge 'Add unhex(X)
scalar function' from Lauri Virtanen
...
This commit adds `unhex(X)` scalar function. Function with `unhex(X,Y)`
two arguments is not implemented yet.
Relates to issue #144
Closes #353
2024-10-02 11:01:15 +03:00
Lauri Virtanen
adc6f9b6cd
Add unhex(X)
scalar function
...
This commit adds `unhex(X)` scalar function. Function with `unhex(X,Y)`
two arguments is not implemented yet.
Relates to issue #144
2024-09-30 00:13:43 +03:00
Lauri Virtanen
f612ead8a3
Add zeroblob(N)
scalar function
...
Relates to issue #144
2024-09-29 23:39:53 +03:00
JeanArhancet
222fea9cc8
fix: cmp number/text
2024-09-25 17:39:37 +02: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
baishen
5c00c576a5
Add support for hex scalar function
2024-09-22 08:50:08 -04:00
jussisaurio
c738674c5d
Merge 'fix: cmp integer/float' from Jean Arhancet
...
Closes https://github.com/penberg/limbo/issues/339
Reviewed-by: Lauri Virtanen <pere-altea@hotmail.com>
Closes #340
2024-09-21 18:06:04 +03:00
JeanArhancet
41c1708ee7
fix: cmp integer/float
2024-09-21 16:10:42 +02:00
Lauri Virtanen
67573e12e5
Add typeof(X)
scalar function
2024-09-21 15:56:29 +03:00
Pekka Enberg
9bbfdab5fa
Revert "Merge 'Add support for sqlite_version() scalar function' from Kim Seon Woo"
...
This reverts commit e365c12ce0
, reversing
changes made to 21bd1a961e
. The pull request broke some tests:
```
thread 'main' panicked at core/vdbe/mod.rs:1713:72:
index out of bounds: the len is 3 but the index is 3
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
while executing
"exec {*}$command"
(procedure "evaluate_sql" line 3)
invoked from within
"evaluate_sql $sqlite_exec $sql"
(procedure "run_test" line 2)
invoked from within
"run_test $::sqlite_exec $combined_sql $combined_expected_output"
(procedure "do_execsql_test" line 5)
invoked from within
"do_execsql_test sqlite_version {
SELECT sqlite_version();
} {3.46.1}"
(file "./testing/scalar-functions.test" line 434)
invoked from within
"source $testdir/scalar-functions.test"
(file "./testing/all.test" line 16)
make: *** [Makefile:59: test-compat] Error 1
```
2024-09-16 14:28:18 +03:00
김선우
6b40acabbc
Add support for sqlite_version() scalar function
2024-09-16 18:38:42 +09:00
JeanArhancet
d03a734f21
feat: add sign function
2024-09-15 14:57:01 +02:00
김선우
8b3e4da8da
Apply comments
...
- Specify the number of arguments using arg_count
- Add test for concat_ws
2024-09-15 10:04:30 +09:00
김선우
fc07ca9d73
Add support for concat_ws
2024-09-14 23:47:45 +09:00
jussisaurio
0839211a49
Pass FuncCtx to Insn::Function to keep track of arg count
2024-09-14 12:38:14 +03:00
sonhmai
9cc965186f
core: support modifiers in date function
2024-09-03 14:28:07 +07:00
Rajiv Harlalka
3447a553e1
chore: move tests
...
Signed-off-by: Rajiv Harlalka <rajivharlalka009@gmail.com>
2024-08-30 20:34:48 +05:30
Rajiv Harlalka
e2013b0ef6
add unixepoch tests
...
Signed-off-by: Rajiv Harlalka <rajivharlalka009@gmail.com>
2024-08-30 20:28:35 +05:30
sonhmai
c32bb91dd5
core: support modifiers in time function
2024-08-24 18:31:34 +07:00
Kim Seon Woo
8bb2a48cb6
Add support for nullif scalar function
2024-08-20 18:36:06 +02:00
JeanArhancet
b6c720c90a
feat: add quote function
2024-08-17 09:28:14 +02:00