limbo/testing
Pekka Enberg ba28999d05 Merge 'Add partial support for datetime() function' from Preston Thorpe
This PR adds the `datetime` function, with all the support currently
that date/time have for modifiers, and `julianday` function, as well as
some additional modifiers for date/time/datetime.
There are a couple considerations here, I left a couple comments but
essentially there is going to have to be some more work done to track
the state of the expression during the application of modifiers, to
handle a bunch of edge-cases like re-applying the same timezone modifier
to itself, or converting an integer automatically assumed to be
julianday, into epoch, or `ceiling`/`floor` which will determine
relative addition of time in cases like
```
2024-01-31 +1 month = 2024-03-02
```
which was painful enough to get working to begin with.
I couldn't get the `julianday_converter` library to get the exact same
float precision as sqlite, so function is included that matches their
output, for some reason floating point math + `.floor()` would give the
correct result. They seem to 'round' to 8 decimal places, and I was able
to get this to work with the same output as sqlite, except in cases like
`2234.5`, in which case we return `2234.5000000` because of the `fmt`
precision:
```rust
pub fn exec_julianday(time_value: &OwnedValue) -> Result<String> {
    let dt = parse_naive_date_time(time_value);
    match dt {
        // if we did something heinous like: parse::<f64>().unwrap().to_string()
        // that would solve the precision issue, but dear lord...
        Some(dt) => Ok(format!("{:.1$}", to_julian_day_exact(&dt), 8)),
        None => Ok(String::new()),
    }
}
```
Suggestions would be appreciated on the float precision issue.

Reviewed-by: Sonny <14060682+sonhmai@users.noreply.github.com>

Closes #600
2025-01-05 20:13:13 +02:00
..
test_files Feat: Import csv support 2025-01-03 15:20:22 +05:30
wal testing: Add test database + WAL file 2024-08-03 12:16:34 +03:00
agg-functions.test support TRUE and FALSE in predicates 2024-12-13 22:58:29 +02:00
all.test feat: subqueries in FROM clause 2024-12-31 14:18:29 +02:00
cmdlineshell.test refactor(testing): move .table tests to shelltests.py 2024-12-18 09:10:37 +02:00
coalesce.test testing: coalesce.test 2024-07-16 07:20:35 +03:00
gen-database.py testing: update testing with products table and cross join test 2024-07-09 18:08:16 +02:00
glob.test Fix glob 2024-12-30 17:02:31 +05:30
groupby.test Dont assume GROUP BY has aggregates 2024-12-16 00:30:38 +02:00
insert.test Feature: last_insert_rowid() 2024-12-09 22:48:42 +05:30
join.test Handle quoting identifiers properly 2024-12-18 19:45:06 +01:00
json.test PR remarks #2 2025-01-02 15:09:16 +07:00
like.test Support like function with escape 2024-12-28 13:55:12 +05:30
math.test Fix integer overflow output to be same result as sqlite3 2025-01-04 18:14:09 +05:30
orderby.test test ordering by aggregate not mentioned in select 2024-11-26 17:31:51 +02:00
pragma.test pragma: inital approach to handle pragma statements 2024-12-18 17:26:16 +01:00
scalar-functions-datetime.test Julianday function and additional tests/comments 2025-01-04 10:42:34 -05:00
scalar-functions.test Fix sqlite_version() out of bound 2024-12-27 11:39:33 -03:00
select.test Fix quote escape in literals 2025-01-05 01:35:29 +05:30
shelltests.py Merge 'Remove SQLite headers dependency from compat tests' from dkaluza 2025-01-04 10:12:28 +02:00
subquery.test feat: subqueries in FROM clause 2024-12-31 14:18:29 +02:00
tester.tcl Add test function with regex 2024-12-27 11:39:02 -03:00
testing.db index scan wip foo doesnt work yet 2024-10-05 18:25:04 +03:00
testing_norowidalias.db Run all tcl tests on 2 separate dbs (1. with rowid aliases 2. without rowid aliases) 2024-12-14 17:13:45 +02:00
where.test fix: index seek wrong 2025-01-02 11:11:44 +08:00