Extract step SELECT expressions and optional WHERE condition as SQL text. Returns `(step_exprs, condition)`.
(expr: &SetExpr)
| 225 | /// |
| 226 | /// Returns `(step_exprs, condition)`. |
| 227 | fn extract_step_exprs_and_condition(expr: &SetExpr) -> Option<(Vec<String>, Option<String>)> { |
| 228 | let select = match expr { |
| 229 | SetExpr::Select(s) => s, |
| 230 | _ => return None, |
| 231 | }; |
| 232 | let step_exprs = select |
| 233 | .projection |
| 234 | .iter() |
| 235 | .map(|item| match item { |
| 236 | ast::SelectItem::UnnamedExpr(e) => format!("{e}"), |
| 237 | ast::SelectItem::ExprWithAlias { expr: e, .. } => format!("{e}"), |
| 238 | ast::SelectItem::Wildcard(_) => "*".into(), |
| 239 | ast::SelectItem::QualifiedWildcard(name, _) => format!("{name}.*"), |
| 240 | }) |
| 241 | .collect(); |
| 242 | let condition = select.selection.as_ref().map(|e| format!("{e}")); |
| 243 | Some((step_exprs, condition)) |
| 244 | } |
| 245 | |
| 246 | // ── Validation ──────────────────────────────────────────────────────────────── |
| 247 |
no test coverage detected