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