MXS-2431 Recognize the XA keyword

Recognize the XA keyword and classify the statement as write.
Needs to be dealt with explicitly as sqlite3 assumes there are
no keywords starting with the letter X.
This commit is contained in:
Johan Wikman
2019-04-12 10:33:53 +03:00
parent 62f2a86a5f
commit 4131f09c16
4 changed files with 33 additions and 12 deletions

View File

@ -639,6 +639,7 @@ columnid(A) ::= nm(X). {
VALUE VIEW /*VIRTUAL*/
/*WITH*/
WORK
XA
%endif
.
%wildcard ANY.

View File

@ -626,6 +626,22 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
/* If it is not a BLOB literal, then it must be an ID, since no
** SQL keywords start with the letter 'x'. Fall through */
}
#endif
#ifdef MAXSCALE
// It may be the "XA" keyword.
// If the next character is 'a' or 'A', followed by whitespace or a
// comment, then we are indeed dealing with the "XA" keyword.
if (( z[1]=='a' || z[1]=='A' ) &&
(sqlite3Isspace(z[2]) || // Whitespace
(z[2]=='/' && z[3]=='*') || // Beginning of /* comment
(z[2]=='#') || // # eol comment
(z[2]=='-' && z[3]=='-' && sqlite3Isspace(z[4])))) { // -- eol comment
extern int maxscaleKeyword(int);
*tokenType = TK_XA;
maxscaleKeyword(*tokenType);
return 2;
}
#endif
case CC_ID: {
i = 1;