Merge 'Add support for substr scalar function' from Kim Seon Woo

Add support for `substr` scalar function. We can reuse the `substring` logic which is already implemted.

## Related issue
https://github.com/penberg/limbo/issues/144

Closes #289
This commit is contained in:
Pekka Enberg
2024-08-16 14:36:55 +03:00
5 changed files with 23 additions and 4 deletions

View File

@@ -255,6 +255,22 @@ do_execsql_test max-null {
select max(null,null)
} {}
do_execsql_test substr-3-args {
SELECT substr('limbo', 1, 3);
} {lim}
do_execsql_test substr-3-args-exceed-length {
SELECT substr('limbo', 1, 10);
} {limbo}
do_execsql_test substr-3-args-start-exceed-length {
SELECT substr('limbo', 10, 3);
} {}
do_execsql_test substr-2-args {
SELECT substr('limbo', 3);
} {mbo}
do_execsql_test substring-3-args {
SELECT substring('limbo', 1, 3);
} {lim}