The TZ function is not the same as the TIMEZONE function

pull/10/head
Tpt 6 years ago
parent c760042321
commit 8de71d4536
  1. 3
      lib/src/sparql/algebra.rs
  2. 3
      lib/src/sparql/sparql_grammar.rustpeg

@ -458,6 +458,7 @@ pub enum Expression {
MinutesFunctionCall(Box<Expression>), MinutesFunctionCall(Box<Expression>),
SecondsFunctionCall(Box<Expression>), SecondsFunctionCall(Box<Expression>),
TimezoneFunctionCall(Box<Expression>), TimezoneFunctionCall(Box<Expression>),
TzFunctionCall(Box<Expression>),
NowFunctionCall(), NowFunctionCall(),
UUIDFunctionCall(), UUIDFunctionCall(),
StrUUIDFunctionCall(), StrUUIDFunctionCall(),
@ -568,6 +569,7 @@ impl fmt::Display for Expression {
Expression::MinutesFunctionCall(e) => write!(f, "MINUTES({})", e), Expression::MinutesFunctionCall(e) => write!(f, "MINUTES({})", e),
Expression::SecondsFunctionCall(e) => write!(f, "SECONDS({})", e), Expression::SecondsFunctionCall(e) => write!(f, "SECONDS({})", e),
Expression::TimezoneFunctionCall(e) => write!(f, "TIMEZONE({})", e), Expression::TimezoneFunctionCall(e) => write!(f, "TIMEZONE({})", e),
Expression::TzFunctionCall(e) => write!(f, "TZ({})", e),
Expression::NowFunctionCall() => write!(f, "NOW()"), Expression::NowFunctionCall() => write!(f, "NOW()"),
Expression::UUIDFunctionCall() => write!(f, "UUID()"), Expression::UUIDFunctionCall() => write!(f, "UUID()"),
Expression::StrUUIDFunctionCall() => write!(f, "STRUUID()"), Expression::StrUUIDFunctionCall() => write!(f, "STRUUID()"),
@ -818,6 +820,7 @@ impl<'a> fmt::Display for SparqlExpression<'a> {
Expression::MinutesFunctionCall(e) => write!(f, "MINUTES({})", SparqlExpression(&*e)), Expression::MinutesFunctionCall(e) => write!(f, "MINUTES({})", SparqlExpression(&*e)),
Expression::SecondsFunctionCall(e) => write!(f, "SECONDS({})", SparqlExpression(&*e)), Expression::SecondsFunctionCall(e) => write!(f, "SECONDS({})", SparqlExpression(&*e)),
Expression::TimezoneFunctionCall(e) => write!(f, "TIMEZONE({})", SparqlExpression(&*e)), Expression::TimezoneFunctionCall(e) => write!(f, "TIMEZONE({})", SparqlExpression(&*e)),
Expression::TzFunctionCall(e) => write!(f, "TZ({})", SparqlExpression(&*e)),
Expression::NowFunctionCall() => write!(f, "NOW()"), Expression::NowFunctionCall() => write!(f, "NOW()"),
Expression::UUIDFunctionCall() => write!(f, "UUID()"), Expression::UUIDFunctionCall() => write!(f, "UUID()"),
Expression::StrUUIDFunctionCall() => write!(f, "STRUUID()"), Expression::StrUUIDFunctionCall() => write!(f, "STRUUID()"),

@ -786,7 +786,8 @@ BuiltInCall -> Expression =
"HOURS"i _ '(' _ e:Expression _ ')' { Expression::HoursFunctionCall(Box::new(e)) } / "HOURS"i _ '(' _ e:Expression _ ')' { Expression::HoursFunctionCall(Box::new(e)) } /
"MINUTES"i _ '(' _ e:Expression _ ')' { Expression::MinutesFunctionCall(Box::new(e)) } / "MINUTES"i _ '(' _ e:Expression _ ')' { Expression::MinutesFunctionCall(Box::new(e)) } /
"SECONDS"i _ '(' _ e:Expression _ ')' { Expression::SecondsFunctionCall(Box::new(e)) } / "SECONDS"i _ '(' _ e:Expression _ ')' { Expression::SecondsFunctionCall(Box::new(e)) } /
("TIMEZONE"i / "TZ"i) _ '(' _ e:Expression _ ')' { Expression::TimezoneFunctionCall(Box::new(e)) } / "TIMEZONE"i _ '(' _ e:Expression _ ')' { Expression::TimezoneFunctionCall(Box::new(e)) } /
"TZ"i _ '(' _ e:Expression _ ')' { Expression::TzFunctionCall(Box::new(e)) } /
"NOW"i _ NIL { Expression::NowFunctionCall() } / "NOW"i _ NIL { Expression::NowFunctionCall() } /
"UUID"i _ NIL { Expression::UUIDFunctionCall() }/ "UUID"i _ NIL { Expression::UUIDFunctionCall() }/
"STRUUID"i _ NIL { Expression::StrUUIDFunctionCall() } / "STRUUID"i _ NIL { Expression::StrUUIDFunctionCall() } /

Loading…
Cancel
Save