|
|
@ -190,7 +190,9 @@ struct SolutionModifier { |
|
|
|
// [18] SolutionModifier ::= GroupClause? HavingClause? OrderClause? LimitOffsetClauses?
|
|
|
|
// [18] SolutionModifier ::= GroupClause? HavingClause? OrderClause? LimitOffsetClauses?
|
|
|
|
group: Option<GroupClause>, |
|
|
|
group: Option<GroupClause>, |
|
|
|
having: Option<HavingClause>, |
|
|
|
having: Option<HavingClause>, |
|
|
|
|
|
|
|
#[cfg(feature = "order")] |
|
|
|
order: Option<OrderClause>, |
|
|
|
order: Option<OrderClause>, |
|
|
|
|
|
|
|
#[cfg(feature = "limit-offset")] |
|
|
|
limit_offset: Option<LimitOffsetClauses>, |
|
|
|
limit_offset: Option<LimitOffsetClauses>, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -202,9 +204,11 @@ impl fmt::Display for SolutionModifier { |
|
|
|
if let Some(having) = &self.having { |
|
|
|
if let Some(having) = &self.having { |
|
|
|
write!(f, " {having}")?; |
|
|
|
write!(f, " {having}")?; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#[cfg(feature = "order")] |
|
|
|
if let Some(order) = &self.order { |
|
|
|
if let Some(order) = &self.order { |
|
|
|
write!(f, " {order}")?; |
|
|
|
write!(f, " {order}")?; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#[cfg(feature = "limit-offset")] |
|
|
|
if let Some(limit_offset) = &self.limit_offset { |
|
|
|
if let Some(limit_offset) = &self.limit_offset { |
|
|
|
write!(f, " {limit_offset}")?; |
|
|
|
write!(f, " {limit_offset}")?; |
|
|
|
} |
|
|
|
} |
|
|
@ -275,6 +279,7 @@ impl fmt::Display for HavingClause { |
|
|
|
// [22] HavingCondition ::= Constraint
|
|
|
|
// [22] HavingCondition ::= Constraint
|
|
|
|
type HavingCondition = Constraint; |
|
|
|
type HavingCondition = Constraint; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "order")] |
|
|
|
#[derive(Arbitrary)] |
|
|
|
#[derive(Arbitrary)] |
|
|
|
struct OrderClause { |
|
|
|
struct OrderClause { |
|
|
|
// [23] OrderClause ::= 'ORDER' 'BY' OrderCondition+
|
|
|
|
// [23] OrderClause ::= 'ORDER' 'BY' OrderCondition+
|
|
|
@ -282,6 +287,7 @@ struct OrderClause { |
|
|
|
others: Vec<OrderCondition>, |
|
|
|
others: Vec<OrderCondition>, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "order")] |
|
|
|
impl fmt::Display for OrderClause { |
|
|
|
impl fmt::Display for OrderClause { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
write!(f, "ORDER BY {}", self.start)?; |
|
|
|
write!(f, "ORDER BY {}", self.start)?; |
|
|
@ -292,6 +298,7 @@ impl fmt::Display for OrderClause { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "order")] |
|
|
|
#[derive(Arbitrary)] |
|
|
|
#[derive(Arbitrary)] |
|
|
|
enum OrderCondition { |
|
|
|
enum OrderCondition { |
|
|
|
// [24] OrderCondition ::= ( ( 'ASC' | 'DESC' ) BrackettedExpression ) | ( Constraint | Var )
|
|
|
|
// [24] OrderCondition ::= ( ( 'ASC' | 'DESC' ) BrackettedExpression ) | ( Constraint | Var )
|
|
|
@ -303,6 +310,7 @@ enum OrderCondition { |
|
|
|
Var(Var), |
|
|
|
Var(Var), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "order")] |
|
|
|
impl fmt::Display for OrderCondition { |
|
|
|
impl fmt::Display for OrderCondition { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
match self { |
|
|
|
match self { |
|
|
@ -319,6 +327,7 @@ impl fmt::Display for OrderCondition { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "limit-offset")] |
|
|
|
#[derive(Arbitrary)] |
|
|
|
#[derive(Arbitrary)] |
|
|
|
enum LimitOffsetClauses { |
|
|
|
enum LimitOffsetClauses { |
|
|
|
// [25] LimitOffsetClauses ::= LimitClause OffsetClause? | OffsetClause LimitClause?
|
|
|
|
// [25] LimitOffsetClauses ::= LimitClause OffsetClause? | OffsetClause LimitClause?
|
|
|
@ -326,6 +335,7 @@ enum LimitOffsetClauses { |
|
|
|
OffsetLimit(OffsetClause, Option<LimitClause>), |
|
|
|
OffsetLimit(OffsetClause, Option<LimitClause>), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "limit-offset")] |
|
|
|
impl fmt::Display for LimitOffsetClauses { |
|
|
|
impl fmt::Display for LimitOffsetClauses { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
match self { |
|
|
|
match self { |
|
|
@ -337,24 +347,28 @@ impl fmt::Display for LimitOffsetClauses { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "limit-offset")] |
|
|
|
#[derive(Arbitrary)] |
|
|
|
#[derive(Arbitrary)] |
|
|
|
struct LimitClause { |
|
|
|
struct LimitClause { |
|
|
|
// [26] LimitClause ::= 'LIMIT' INTEGER
|
|
|
|
// [26] LimitClause ::= 'LIMIT' INTEGER
|
|
|
|
value: u8, |
|
|
|
value: u8, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "limit-offset")] |
|
|
|
impl fmt::Display for LimitClause { |
|
|
|
impl fmt::Display for LimitClause { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
write!(f, "LIMIT {}", self.value) |
|
|
|
write!(f, "LIMIT {}", self.value) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "limit-offset")] |
|
|
|
#[derive(Arbitrary)] |
|
|
|
#[derive(Arbitrary)] |
|
|
|
struct OffsetClause { |
|
|
|
struct OffsetClause { |
|
|
|
// [27] OffsetClause ::= 'OFFSET' INTEGER
|
|
|
|
// [27] OffsetClause ::= 'OFFSET' INTEGER
|
|
|
|
value: u8, |
|
|
|
value: u8, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "limit-offset")] |
|
|
|
impl fmt::Display for OffsetClause { |
|
|
|
impl fmt::Display for OffsetClause { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
|
|
|
write!(f, "OFFSET {}", self.value) |
|
|
|
write!(f, "OFFSET {}", self.value) |
|
|
|