fix for queries with both order by and limit

This commit is contained in:
virattara 2018-10-12 16:10:00 +05:30
parent 335607f6bb
commit 9f47e8ac94
2 changed files with 37 additions and 13 deletions

View file

@ -1166,23 +1166,20 @@ impl Parser {
// look for optional ASC / DESC specifier
let asc = match self.peek_token() {
Some(Token::Keyword(k)) => {
self.next_token(); // consume it
match k.to_uppercase().as_ref() {
"ASC" => true,
"DESC" => false,
_ => {
return parser_err!(format!(
"Invalid modifier for ORDER BY expression: {:?}",
k
))
}
"ASC" => {
self.next_token();
true
},
"DESC" => {
self.next_token();
false
},
_ => true
}
}
Some(Token::Comma) => true,
Some(other) => {
return parser_err!(format!("Unexpected token after ORDER BY expr: {:?}", other))
}
None => true,
_ => true,
};
expr_list.push(SQLOrderByExpr::new(Box::new(expr), asc));