Add ability to use binary expressions in SQL SELECT statements

This commit is contained in:
Tobie Morgan Hitchcock 2022-07-18 22:10:00 +01:00
parent 548520662d
commit eaedfbbb7c

View file

@ -1235,52 +1235,61 @@ pub fn double(i: &str) -> IResult<&str, Value> {
pub fn single(i: &str) -> IResult<&str, Value> { pub fn single(i: &str) -> IResult<&str, Value> {
alt(( alt((
map(tag_no_case("NONE"), |_| Value::None), alt((
map(tag_no_case("VOID"), |_| Value::Void), map(tag_no_case("NONE"), |_| Value::None),
map(tag_no_case("NULL"), |_| Value::Null), map(tag_no_case("VOID"), |_| Value::Void),
map(tag_no_case("true"), |_| Value::True), map(tag_no_case("NULL"), |_| Value::Null),
map(tag_no_case("false"), |_| Value::False), map(tag_no_case("true"), |_| Value::True),
map(subquery, Value::from), map(tag_no_case("false"), |_| Value::False),
map(function, Value::from), )),
map(datetime, Value::from), alt((
map(duration, Value::from), map(subquery, Value::from),
map(geometry, Value::from), map(function, Value::from),
map(unique, Value::from), map(datetime, Value::from),
map(number, Value::from), map(duration, Value::from),
map(object, Value::from), map(geometry, Value::from),
map(array, Value::from), map(unique, Value::from),
map(param, Value::from), map(number, Value::from),
map(regex, Value::from), map(object, Value::from),
map(model, Value::from), map(array, Value::from),
map(idiom, Value::from), map(param, Value::from),
map(thing, Value::from), map(regex, Value::from),
map(strand, Value::from), map(model, Value::from),
map(idiom, Value::from),
map(thing, Value::from),
map(strand, Value::from),
)),
))(i) ))(i)
} }
pub fn select(i: &str) -> IResult<&str, Value> { pub fn select(i: &str) -> IResult<&str, Value> {
alt(( alt((
map(tag_no_case("NONE"), |_| Value::None), alt((
map(tag_no_case("VOID"), |_| Value::Void), map(tag_no_case("NONE"), |_| Value::None),
map(tag_no_case("NULL"), |_| Value::Null), map(tag_no_case("VOID"), |_| Value::Void),
map(tag_no_case("true"), |_| Value::True), map(tag_no_case("NULL"), |_| Value::Null),
map(tag_no_case("false"), |_| Value::False), map(tag_no_case("true"), |_| Value::True),
map(subquery, Value::from), map(tag_no_case("false"), |_| Value::False),
map(function, Value::from), )),
map(datetime, Value::from), alt((
map(duration, Value::from), map(expression, Value::from),
map(geometry, Value::from), map(subquery, Value::from),
map(unique, Value::from), map(function, Value::from),
map(number, Value::from), map(datetime, Value::from),
map(object, Value::from), map(duration, Value::from),
map(array, Value::from), map(geometry, Value::from),
map(param, Value::from), map(unique, Value::from),
map(regex, Value::from), map(number, Value::from),
map(model, Value::from), map(object, Value::from),
map(edges, Value::from), map(array, Value::from),
map(thing, Value::from), map(param, Value::from),
map(table, Value::from), map(regex, Value::from),
map(strand, Value::from), map(model, Value::from),
map(edges, Value::from),
map(thing, Value::from),
map(table, Value::from),
map(strand, Value::from),
)),
))(i) ))(i)
} }