From 001ae8e29a744f0ffe72308feb152eabc35749cf Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Fri, 18 May 2018 12:18:03 +0300 Subject: [PATCH] MXS-1874 Handle SET STATEMENT ... FOR ... The SET STATEMENT ... FOR part can be ignored and the type of the statement be whatever the type of the part following FOR is. --- .../qc_sqlite/sqlite-src-3110100/src/parse.y | 10 +++++++++- .../qc_sqlite/sqlite-src-3110100/tool/mkkeywordhash.c | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) 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 d4498cf37..21707bee2 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y @@ -629,7 +629,7 @@ columnid(A) ::= nm(X). { PREVIOUS QUICK RAISE RECURSIVE /*REINDEX*/ RELEASE /*RENAME*/ /*REPLACE*/ RESTRICT ROLLBACK ROLLUP ROW - SAVEPOINT SELECT_OPTIONS_KW /*SEQUENCE*/ SLAVE /*START*/ STATUS + SAVEPOINT SELECT_OPTIONS_KW /*SEQUENCE*/ SLAVE /*START*/ STATEMENT STATUS TABLES TEMP TEMPTABLE /*TRIGGER*/ /*TRUNCATE*/ // TODO: UNSIGNED is a reserved word and should not automatically convert into an identifer. @@ -3157,6 +3157,14 @@ cmd ::= SET set_scope(X) TRANSACTION transaction_characteristics. { maxscaleSet(pParse, X, MXS_SET_TRANSACTION, 0); } +cmd ::= SET STATEMENT variable_assignments(X) FOR cmd. { + // The parsing of cmd will cause the relevant maxscale-callback to + // be called, so we neither need to call it here, nor free cmd (as + // it will be freed by that callback). The variable definitions we + // just throw away, as they are of no interest. + sqlite3ExprListDelete(pParse->db, X); +} + //////////////////////// The USE statement //////////////////////////////////// // cmd ::= use(X). { 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 5d51ea86a..18017915c 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/tool/mkkeywordhash.c +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/tool/mkkeywordhash.c @@ -442,6 +442,7 @@ static Keyword aKeywordTable[] = { { "SET", "TK_SET", ALWAYS }, #ifdef MAXSCALE { "START", "TK_START", ALWAYS }, + { "STATEMENT", "TK_STATEMENT", ALWAYS }, { "STATUS", "TK_STATUS", ALWAYS }, { "STRAIGHT_JOIN", "TK_STRAIGHT_JOIN",ALWAYS }, #endif