(expr: &ast::Expr, ctx: &str)
| 86 | } |
| 87 | |
| 88 | pub(super) fn expect_string_array(expr: &ast::Expr, ctx: &str) -> Result<Vec<String>> { |
| 89 | let elems = match expr { |
| 90 | ast::Expr::Array(arr) => arr.elem.clone(), |
| 91 | ast::Expr::Function(f) |
| 92 | if matches!( |
| 93 | crate::parser::normalize::normalize_object_name_checked(&f.name) |
| 94 | .as_deref() |
| 95 | .unwrap_or(""), |
| 96 | "make_array" | "array" |
| 97 | ) => |
| 98 | { |
| 99 | match &f.args { |
| 100 | ast::FunctionArguments::List(list) => collect_args(&list.args), |
| 101 | _ => Vec::new(), |
| 102 | } |
| 103 | } |
| 104 | _ => { |
| 105 | return Err(SqlError::Unsupported { |
| 106 | detail: format!("{ctx}: expected array literal, got {expr}"), |
| 107 | }); |
| 108 | } |
| 109 | }; |
| 110 | elems |
| 111 | .iter() |
| 112 | .map(|e| expect_string_literal(e, ctx)) |
| 113 | .collect() |
| 114 | } |
| 115 | |
| 116 | pub(super) fn is_null_literal(expr: &ast::Expr) -> bool { |
| 117 | matches!( |
no test coverage detected