diff --git a/query_classifier/qc_sqlite/qc_sqlite.cc b/query_classifier/qc_sqlite/qc_sqlite.cc index bfc5c524a..0ae6e2023 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.cc +++ b/query_classifier/qc_sqlite/qc_sqlite.cc @@ -1575,18 +1575,16 @@ public: } } - void mxs_sqlite3BeginTrigger(Parse* pParse, /* The parse context of the CREATE TRIGGER statement - * */ - Token* pName1, /* The name of the trigger */ - Token* pName2, /* The name of the trigger */ - int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */ - int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */ - IdList* pColumns, /* column list if this is an UPDATE OF trigger */ - SrcList* pTableName, /* The name of the table/view the trigger applies to - * */ - Expr* pWhen, /* WHEN clause */ - int isTemp, /* True if the TEMPORARY keyword is present */ - int noErr) /* Suppress errors if the trigger already exists */ + void mxs_sqlite3BeginTrigger(Parse* pParse, /* The parse context of the CREATE TRIGGER statement */ + Token* pName1, /* The name of the trigger */ + Token* pName2, /* The name of the trigger */ + int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */ + int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */ + IdList* pColumns, /* column list if this is an UPDATE OF trigger */ + SrcList* pTableName, /* The name of the table/view the trigger applies to */ + Expr* pWhen, /* WHEN clause */ + int isTemp, /* True if the TEMPORARY keyword is present */ + int noErr) /* Suppress errors if the trigger already exists */ { mxb_assert(this_thread.initialized); @@ -2632,6 +2630,11 @@ public: m_type_mask = (QUERY_TYPE_WRITE | QUERY_TYPE_COMMIT); break; + case TK_XA: + m_status = QC_QUERY_TOKENIZED; + m_type_mask = QUERY_TYPE_WRITE; + break; + default: ; } 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 67088e537..917b68f68 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y @@ -639,6 +639,7 @@ columnid(A) ::= nm(X). { VALUE VIEW /*VIRTUAL*/ /*WITH*/ WORK + XA %endif . %wildcard ANY. diff --git a/query_classifier/qc_sqlite/sqlite-src-3110100/src/tokenize.c b/query_classifier/qc_sqlite/sqlite-src-3110100/src/tokenize.c index 84e4a4538..a698d29ba 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/src/tokenize.c +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/src/tokenize.c @@ -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; 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 675c543c4..a8746a7df 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/tool/mkkeywordhash.c +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/tool/mkkeywordhash.c @@ -500,6 +500,7 @@ static Keyword aKeywordTable[] = { #ifdef MAXSCALE { "WORK", "TK_WORK", ALWAYS }, { "WRITE", "TK_WRITE", ALWAYS }, + { "XA", "TK_XA", ALWAYS }, #endif { "ZEROFILL", "TK_ZEROFILL", ALWAYS }, };