(expr: &ast::Expr, ctx: &str)
| 55 | } |
| 56 | |
| 57 | pub(super) fn expect_string_literal(expr: &ast::Expr, ctx: &str) -> Result<String> { |
| 58 | match expr { |
| 59 | ast::Expr::Value(v) => match &v.value { |
| 60 | ast::Value::SingleQuotedString(s) => Ok(s.clone()), |
| 61 | other => Err(SqlError::Unsupported { |
| 62 | detail: format!("{ctx}: expected string literal, got {other}"), |
| 63 | }), |
| 64 | }, |
| 65 | ast::Expr::Identifier(ident) => Ok(normalize_ident(ident)), |
| 66 | _ => Err(SqlError::Unsupported { |
| 67 | detail: format!("{ctx}: expected string literal, got {expr}"), |
| 68 | }), |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | pub(super) fn expect_u32(expr: &ast::Expr, ctx: &str) -> Result<u32> { |
| 73 | match expr { |
no test coverage detected