(
items: Vec<InterpolateItem<Expr>>,
ctx: &mut Context,
)
| 557 | } |
| 558 | |
| 559 | pub(super) fn translate_query_sstring( |
| 560 | items: Vec<InterpolateItem<Expr>>, |
| 561 | ctx: &mut Context, |
| 562 | ) -> Result<sql_ast::Query> { |
| 563 | let string = translate_sstring(items, ctx)?; |
| 564 | |
| 565 | let re = Regex::new(r"(?i)^SELECT\b").unwrap(); |
| 566 | let prefix = string.trim().get(0..7).unwrap_or_default(); |
| 567 | |
| 568 | if re.is_match(prefix) { |
| 569 | if let Some(string) = string.trim().strip_prefix(prefix) { |
| 570 | return Ok(default_query(sql_ast::SetExpr::Select(Box::new( |
| 571 | sql_ast::Select { |
| 572 | projection: vec![sql_ast::SelectItem::UnnamedExpr(sql_ast::Expr::Identifier( |
| 573 | sql_ast::Ident::new(string), |
| 574 | ))], |
| 575 | ..default_select() |
| 576 | }, |
| 577 | )))); |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | Err( |
| 582 | Error::new_simple("s-strings representing a table must start with `SELECT `".to_string()) |
| 583 | .push_hint("this is a limitation by current compiler implementation"), |
| 584 | ) |
| 585 | } |
| 586 | |
| 587 | pub(super) fn translate_query_operator( |
| 588 | name: String, |
no test coverage detected