feat: Support MySQL's DIV operator (#876)

* feat: MySQL's DIV operator

* fix: do not use `_` prefix for used variable

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
eitsupi 2023-05-18 02:26:14 +09:00 committed by GitHub
parent feaa13c9a9
commit 097e7ad56e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 1 deletions

View file

@ -1982,6 +1982,8 @@ impl<'a> Parser<'a> {
const AND_PREC: u8 = 10;
const OR_PREC: u8 = 5;
const DIV_OP_PREC: u8 = 40;
/// Get the precedence of the next token
pub fn get_next_precedence(&self) -> Result<u8, ParserError> {
// allow the dialect to override precedence logic
@ -2031,6 +2033,7 @@ impl<'a> Parser<'a> {
Token::Word(w) if w.keyword == Keyword::ILIKE => Ok(Self::LIKE_PREC),
Token::Word(w) if w.keyword == Keyword::SIMILAR => Ok(Self::LIKE_PREC),
Token::Word(w) if w.keyword == Keyword::OPERATOR => Ok(Self::BETWEEN_PREC),
Token::Word(w) if w.keyword == Keyword::DIV => Ok(Self::DIV_OP_PREC),
Token::Eq
| Token::Lt
| Token::LtEq