Internal recursive helper that carries a depth counter to enforce `MAX_CONVERT_DEPTH` and prevent stack overflow on malformed ASTs.
(expr: &Expr, depth: &mut usize)
| 43 | /// Internal recursive helper that carries a depth counter to enforce |
| 44 | /// `MAX_CONVERT_DEPTH` and prevent stack overflow on malformed ASTs. |
| 45 | pub(super) fn convert_expr_depth(expr: &Expr, depth: &mut usize) -> Result<SqlExpr> { |
| 46 | *depth += 1; |
| 47 | if *depth > MAX_CONVERT_DEPTH { |
| 48 | return Err(SqlError::Unsupported { |
| 49 | detail: format!("expression nesting depth exceeds maximum of {MAX_CONVERT_DEPTH}"), |
| 50 | }); |
| 51 | } |
| 52 | let result = convert_expr_inner(expr, depth); |
| 53 | *depth -= 1; |
| 54 | result |
| 55 | } |
| 56 | |
| 57 | fn convert_expr_inner(expr: &Expr, depth: &mut usize) -> Result<SqlExpr> { |
| 58 | match expr { |
no test coverage detected