MXS-2508 Fix problem
DIV and MOD are now also accepted instead of / and % respectively. MOD is a keyword but (in principle incorrectly) decays into an id when used in some other context. That is so that it will be parser by the general function rule ("id ( ... )"). If used incorrectly, the server will later reject.
This commit is contained in:
@ -929,9 +929,11 @@ public:
|
|||||||
case TK_BITOR:
|
case TK_BITOR:
|
||||||
case TK_CASE:
|
case TK_CASE:
|
||||||
case TK_CAST:
|
case TK_CAST:
|
||||||
|
case TK_DIV:
|
||||||
case TK_IN:
|
case TK_IN:
|
||||||
case TK_ISNULL:
|
case TK_ISNULL:
|
||||||
case TK_MINUS:
|
case TK_MINUS:
|
||||||
|
case TK_MOD:
|
||||||
case TK_NOTNULL:
|
case TK_NOTNULL:
|
||||||
case TK_PLUS:
|
case TK_PLUS:
|
||||||
case TK_SLASH:
|
case TK_SLASH:
|
||||||
@ -4011,6 +4013,9 @@ static const char* get_token_symbol(int token)
|
|||||||
case TK_CAST:
|
case TK_CAST:
|
||||||
return "cast";
|
return "cast";
|
||||||
|
|
||||||
|
case TK_DIV:
|
||||||
|
return "div";
|
||||||
|
|
||||||
case TK_IN:
|
case TK_IN:
|
||||||
return "in";
|
return "in";
|
||||||
|
|
||||||
@ -4020,6 +4025,9 @@ static const char* get_token_symbol(int token)
|
|||||||
case TK_MINUS:
|
case TK_MINUS:
|
||||||
return "-";
|
return "-";
|
||||||
|
|
||||||
|
case TK_MOD:
|
||||||
|
return "mod";
|
||||||
|
|
||||||
case TK_NOTNULL:
|
case TK_NOTNULL:
|
||||||
return "isnotnull";
|
return "isnotnull";
|
||||||
|
|
||||||
|
@ -631,6 +631,10 @@ columnid(A) ::= nm(X). {
|
|||||||
/*KEY*/
|
/*KEY*/
|
||||||
/*LIKE_KW*/
|
/*LIKE_KW*/
|
||||||
MASTER /*MATCH*/ MERGE
|
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
|
NAMES NEXT
|
||||||
NO
|
NO
|
||||||
OF OFFSET OPEN
|
OF OFFSET OPEN
|
||||||
@ -670,7 +674,7 @@ columnid(A) ::= nm(X). {
|
|||||||
%right ESCAPE.
|
%right ESCAPE.
|
||||||
%left BITAND BITOR LSHIFT RSHIFT.
|
%left BITAND BITOR LSHIFT RSHIFT.
|
||||||
%left PLUS MINUS.
|
%left PLUS MINUS.
|
||||||
%left STAR SLASH REM.
|
%left DIV MOD STAR SLASH REM.
|
||||||
%left CONCAT.
|
%left CONCAT.
|
||||||
%left COLLATE.
|
%left COLLATE.
|
||||||
%right BITNOT.
|
%right BITNOT.
|
||||||
@ -2165,7 +2169,7 @@ expr(A) ::= INTERVAL expr(X) id. {
|
|||||||
A=X; // We simply ignore 'INTERVAL'
|
A=X; // We simply ignore 'INTERVAL'
|
||||||
}
|
}
|
||||||
%endif
|
%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);}
|
{spanBinaryExpr(&A,pParse,@OP,&X,&Y);}
|
||||||
expr(A) ::= expr(X) CONCAT(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}
|
%type likeop {struct LikeOp}
|
||||||
|
@ -242,6 +242,7 @@ static Keyword aKeywordTable[] = {
|
|||||||
{ "DISTINCT", "TK_DISTINCT", ALWAYS },
|
{ "DISTINCT", "TK_DISTINCT", ALWAYS },
|
||||||
#ifdef MAXSCALE
|
#ifdef MAXSCALE
|
||||||
{ "DISTINCTROW", "TK_DISTINCT", ALWAYS },
|
{ "DISTINCTROW", "TK_DISTINCT", ALWAYS },
|
||||||
|
{ "DIV", "TK_DIV", ALWAYS },
|
||||||
{ "DO", "TK_DO", ALWAYS },
|
{ "DO", "TK_DO", ALWAYS },
|
||||||
#endif
|
#endif
|
||||||
{ "DROP", "TK_DROP", ALWAYS },
|
{ "DROP", "TK_DROP", ALWAYS },
|
||||||
@ -349,6 +350,7 @@ static Keyword aKeywordTable[] = {
|
|||||||
#ifdef MAXSCALE
|
#ifdef MAXSCALE
|
||||||
{ "MASTER", "TK_MASTER", ALWAYS },
|
{ "MASTER", "TK_MASTER", ALWAYS },
|
||||||
{ "MERGE", "TK_MERGE", ALWAYS },
|
{ "MERGE", "TK_MERGE", ALWAYS },
|
||||||
|
{ "MOD", "TK_MOD", ALWAYS },
|
||||||
{ "NAMES", "TK_NAMES", ALWAYS },
|
{ "NAMES", "TK_NAMES", ALWAYS },
|
||||||
#endif
|
#endif
|
||||||
{ "NATURAL", "TK_JOIN_KW", ALWAYS },
|
{ "NATURAL", "TK_JOIN_KW", ALWAYS },
|
||||||
|
Reference in New Issue
Block a user