mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-23 17:05:36 +01:00
Fix incorrect LIMIT/OFFSET parsing of form LIMIT x,y
In this case x is the OFFSET and y is the LIMIT, not the other way around.
This commit is contained in:
@@ -2603,16 +2603,24 @@ impl<'a> Parser<'a> {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let limit = self.parse_expr(0)?;
|
||||
let offset = match self.peek()? {
|
||||
let expr = self.parse_expr(0)?;
|
||||
let (limit, offset) = match self.peek()? {
|
||||
Some(tok) => match tok.token_type.unwrap() {
|
||||
TK_OFFSET | TK_COMMA => {
|
||||
eat_assert!(self, TK_OFFSET, TK_COMMA);
|
||||
Some(self.parse_expr(0)?)
|
||||
TK_COMMA => {
|
||||
eat_assert!(self, TK_COMMA);
|
||||
let offset = expr;
|
||||
let limit = self.parse_expr(0)?;
|
||||
(limit, Some(offset))
|
||||
}
|
||||
_ => None,
|
||||
TK_OFFSET => {
|
||||
eat_assert!(self, TK_OFFSET);
|
||||
let limit = expr;
|
||||
let offset = self.parse_expr(0)?;
|
||||
(limit, Some(offset))
|
||||
}
|
||||
_ => (expr, None),
|
||||
},
|
||||
_ => None,
|
||||
_ => (expr, None),
|
||||
};
|
||||
|
||||
Ok(Some(Limit {
|
||||
|
||||
Reference in New Issue
Block a user