From 97eae13d0a31b32ecd444f3b82a651ba476f7fff Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Sun, 5 Jan 2025 13:51:02 +0200 Subject: [PATCH] boxed limit (by ignatz) --- vendored/sqlite3-parser/src/parser/ast/mod.rs | 12 ++++++------ vendored/sqlite3-parser/src/parser/parse.y | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/vendored/sqlite3-parser/src/parser/ast/mod.rs b/vendored/sqlite3-parser/src/parser/ast/mod.rs index 78163b0ce..50c7bcacf 100644 --- a/vendored/sqlite3-parser/src/parser/ast/mod.rs +++ b/vendored/sqlite3-parser/src/parser/ast/mod.rs @@ -172,7 +172,7 @@ pub enum Stmt { /// `ORDER BY` order_by: Option>, /// `LIMIT` - limit: Option, + limit: Option>, }, /// `DETACH DATABASE`: db name Detach(Expr), // TODO distinction between DETACH and DETACH DATABASE @@ -260,7 +260,7 @@ pub enum Stmt { /// `ORDER BY` order_by: Option>, /// `LIMIT` - limit: Option, + limit: Option>, }, /// `VACUUM`: database name, into expr Vacuum(Option, Option), @@ -700,7 +700,7 @@ pub struct Select { /// `ORDER BY` pub order_by: Option>, // ORDER BY term does not match any column in the result set /// `LIMIT` - pub limit: Option, + pub limit: Option>, } /// `SELECT` body @@ -740,7 +740,7 @@ pub struct CompoundSelect { /// operator pub operator: CompoundOperator, /// select - pub select: OneSelect, + pub select: Box, } /// Compound operators @@ -1265,10 +1265,10 @@ impl ColumnDefinition { let mut split = col_type.name.split_ascii_whitespace(); let truncate = if split .next_back() - .map_or(false, |s| s.eq_ignore_ascii_case("ALWAYS")) + .is_some_and(|s| s.eq_ignore_ascii_case("ALWAYS")) && split .next_back() - .map_or(false, |s| s.eq_ignore_ascii_case("GENERATED")) + .is_some_and(|s| s.eq_ignore_ascii_case("GENERATED")) { let mut generated = false; for constraint in &cd.constraints { diff --git a/vendored/sqlite3-parser/src/parser/parse.y b/vendored/sqlite3-parser/src/parser/parse.y index 6148b72cd..f2c59c7f3 100644 --- a/vendored/sqlite3-parser/src/parser/parse.y +++ b/vendored/sqlite3-parser/src/parser/parse.y @@ -737,7 +737,7 @@ groupby_opt(A) ::= GROUP BY nexprlist(X) having_opt(Y). {A = Some(GroupBy{ exprs having_opt(A) ::= . {A = None;} having_opt(A) ::= HAVING expr(X). {A = Some(X);} -%type limit_opt {Option} +%type limit_opt {Option>} // The destructor for limit_opt will never fire in the current grammar. // The limit_opt non-terminal only occurs at the end of a single production @@ -749,11 +749,11 @@ having_opt(A) ::= HAVING expr(X). {A = Some(X);} //%destructor limit_opt {sqlite3ExprDelete(pParse->db, $$);} limit_opt(A) ::= . {A = None;} limit_opt(A) ::= LIMIT expr(X). - {A = Some(Limit{ expr: X, offset: None });} + {A = Some(Box::new(Limit{ expr: X, offset: None }));} limit_opt(A) ::= LIMIT expr(X) OFFSET expr(Y). - {A = Some(Limit{ expr: X, offset: Some(Y) });} + {A = Some(Box::new(Limit{ expr: X, offset: Some(Y) }));} limit_opt(A) ::= LIMIT expr(X) COMMA expr(Y). - {A = Some(Limit{ expr: X, offset: Some(Y) });} + {A = Some(Box::new(Limit{ expr: X, offset: Some(Y) }));} /////////////////////////// The DELETE statement ///////////////////////////// //