diff --git a/query_classifier/qc_sqlite/qc_sqlite.cc b/query_classifier/qc_sqlite/qc_sqlite.cc index fc85a86e8..8903de849 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.cc +++ b/query_classifier/qc_sqlite/qc_sqlite.cc @@ -929,9 +929,11 @@ public: case TK_BITOR: case TK_CASE: case TK_CAST: + case TK_DIV: case TK_IN: case TK_ISNULL: case TK_MINUS: + case TK_MOD: case TK_NOTNULL: case TK_PLUS: case TK_SLASH: @@ -4011,6 +4013,9 @@ static const char* get_token_symbol(int token) case TK_CAST: return "cast"; + case TK_DIV: + return "div"; + case TK_IN: return "in"; @@ -4020,6 +4025,9 @@ static const char* get_token_symbol(int token) case TK_MINUS: return "-"; + case TK_MOD: + return "mod"; + case TK_NOTNULL: return "isnotnull"; diff --git a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y index d7a248609..19e5f7d21 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y @@ -631,6 +631,10 @@ columnid(A) ::= nm(X). { /*KEY*/ /*LIKE_KW*/ MASTER /*MATCH*/ MERGE + // TODO: MOD is a keyword that should not decay into an id. However, now that is does, + // TODO: also "mod(a, 2)" kind of usage will be accepted. Incorrect use will anyway be + // TODO: rejected by the server. + MOD NAMES NEXT NO OF OFFSET OPEN @@ -670,7 +674,7 @@ columnid(A) ::= nm(X). { %right ESCAPE. %left BITAND BITOR LSHIFT RSHIFT. %left PLUS MINUS. -%left STAR SLASH REM. +%left DIV MOD STAR SLASH REM. %left CONCAT. %left COLLATE. %right BITNOT. @@ -2165,7 +2169,7 @@ expr(A) ::= INTERVAL expr(X) id. { A=X; // We simply ignore 'INTERVAL' } %endif -expr(A) ::= expr(X) STAR|SLASH|REM(OP) expr(Y). +expr(A) ::= expr(X) DIV|MOD|STAR|SLASH|REM(OP) expr(Y). {spanBinaryExpr(&A,pParse,@OP,&X,&Y);} expr(A) ::= expr(X) CONCAT(OP) expr(Y). {spanBinaryExpr(&A,pParse,@OP,&X,&Y);} %type likeop {struct LikeOp} diff --git a/query_classifier/qc_sqlite/sqlite-src-3110100/tool/mkkeywordhash.c b/query_classifier/qc_sqlite/sqlite-src-3110100/tool/mkkeywordhash.c index fd5fe2768..42c8c088c 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/tool/mkkeywordhash.c +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/tool/mkkeywordhash.c @@ -242,6 +242,7 @@ static Keyword aKeywordTable[] = { { "DISTINCT", "TK_DISTINCT", ALWAYS }, #ifdef MAXSCALE { "DISTINCTROW", "TK_DISTINCT", ALWAYS }, + { "DIV", "TK_DIV", ALWAYS }, { "DO", "TK_DO", ALWAYS }, #endif { "DROP", "TK_DROP", ALWAYS }, @@ -349,6 +350,7 @@ static Keyword aKeywordTable[] = { #ifdef MAXSCALE { "MASTER", "TK_MASTER", ALWAYS }, { "MERGE", "TK_MERGE", ALWAYS }, + { "MOD", "TK_MOD", ALWAYS }, { "NAMES", "TK_NAMES", ALWAYS }, #endif { "NATURAL", "TK_JOIN_KW", ALWAYS },