diff --git a/query_classifier/qc_sqlite/qc_sqlite.c b/query_classifier/qc_sqlite/qc_sqlite.c index 50de7f5dc..d11c111fc 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.c +++ b/query_classifier/qc_sqlite/qc_sqlite.c @@ -2483,6 +2483,26 @@ void maxscaleLock(Parse* pParse, mxs_lock_t type, SrcList* pTables) } } +int maxscaleTranslateKeyword(int token) +{ + switch (token) + { + case TK_CHARSET: + case TK_DO: + case TK_HANDLER: + if (this_unit.sql_mode == QC_SQL_MODE_ORACLE) + { + token = TK_ID; + } + break; + + default: + break; + } + + return token; +} + /** * Register the tokenization of a keyword. * 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 e0b171a5f..fd875b64e 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/src/tokenize.c +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/src/tokenize.c @@ -569,11 +569,17 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){ if (*tokenType != TK_ID) { extern int maxscaleKeyword(int); - if (maxscaleKeyword(*tokenType) != 0) - { - /* Consume the entire string. */ - while ( z[i] ) { - ++i; + extern int maxscaleTranslateKeyword(int); + + *tokenType = maxscaleTranslateKeyword(*tokenType); + + if (*tokenType != TK_ID) { + if (maxscaleKeyword(*tokenType) != 0) + { + /* Consume the entire string. */ + while ( z[i] ) { + ++i; + } } } }