Enable fetching WHERE clause from statement in iterator

This commit is contained in:
Tobie Morgan Hitchcock 2022-03-18 19:50:47 +00:00
parent 24752a75d9
commit 5b1d727c25

View file

@ -1,3 +1,4 @@
use crate::sql::cond::Cond;
use crate::sql::group::Groups; use crate::sql::group::Groups;
use crate::sql::limit::Limit; use crate::sql::limit::Limit;
use crate::sql::order::Orders; use crate::sql::order::Orders;
@ -81,6 +82,15 @@ impl fmt::Display for Statement {
} }
impl Statement { impl Statement {
// Returns any SPLIT clause if specified
pub fn conds(self: &Statement) -> Option<&Cond> {
match self {
Statement::Select(v) => v.cond.as_ref(),
Statement::Update(v) => v.cond.as_ref(),
Statement::Delete(v) => v.cond.as_ref(),
_ => None,
}
}
// Returns any SPLIT clause if specified // Returns any SPLIT clause if specified
pub fn split(self: &Statement) -> Option<&Splits> { pub fn split(self: &Statement) -> Option<&Splits> {
match self { match self {