Strip a `COLLATE ` wrapper from `expr` and return the inner expression together with whether the collation is a recognised case-insensitive collation.
(expr: &ast::Expr)
| 71 | /// expression together with whether the collation is a recognised |
| 72 | /// case-insensitive collation. |
| 73 | fn strip_collate(expr: &ast::Expr) -> (&ast::Expr, bool) { |
| 74 | if let ast::Expr::Collate { expr, collation } = expr { |
| 75 | let ci = collation |
| 76 | .0 |
| 77 | .iter() |
| 78 | .filter_map(|part| match part { |
| 79 | ast::ObjectNamePart::Identifier(ident) => Some(ident.value.as_str()), |
| 80 | _ => None, |
| 81 | }) |
| 82 | .any(is_case_insensitive_collation); |
| 83 | return (expr.as_ref(), ci); |
| 84 | } |
| 85 | (expr, false) |
| 86 | } |
| 87 | |
| 88 | fn is_case_insensitive_collation(name: &str) -> bool { |
| 89 | name.eq_ignore_ascii_case("NOCASE") |
no test coverage detected