From 47385d259c5ecd5b81da365f6fec234a73d73998 Mon Sep 17 00:00:00 2001 From: zzsmdfj Date: Fri, 18 Nov 2022 23:03:24 +0800 Subject: [PATCH] to MaterializeMySQL_support_drop_mulit_table-fix code-style --- .../MySQL/InterpretersMySQLDDLQuery.cpp | 4 ++-- src/Parsers/MySQL/ASTDropQuery.cpp | 13 ++++++------- src/Parsers/MySQL/ASTDropQuery.h | 1 - 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Interpreters/MySQL/InterpretersMySQLDDLQuery.cpp b/src/Interpreters/MySQL/InterpretersMySQLDDLQuery.cpp index 014d8334560..18ee7583692 100644 --- a/src/Interpreters/MySQL/InterpretersMySQLDDLQuery.cpp +++ b/src/Interpreters/MySQL/InterpretersMySQLDDLQuery.cpp @@ -549,7 +549,7 @@ ASTs InterpreterDropImpl::getRewrittenQueries( return {}; TQuery::QualifiedNames tables = drop_query.names; ASTs rewritten_querys; - for(const auto & table: tables) + for (const auto & table: tables) { const auto & database_name = resolveDatabase(table.schema, mysql_database, mapped_to_database, context); if (database_name != mapped_to_database) @@ -562,7 +562,7 @@ ASTs InterpreterDropImpl::getRewrittenQueries( rewritten_query->is_view = false; rewritten_query->if_exists = drop_query.if_exists; rewritten_querys.push_back(rewritten_query); - } + } return rewritten_querys; } diff --git a/src/Parsers/MySQL/ASTDropQuery.cpp b/src/Parsers/MySQL/ASTDropQuery.cpp index f21f0f66716..2c82c6a2467 100644 --- a/src/Parsers/MySQL/ASTDropQuery.cpp +++ b/src/Parsers/MySQL/ASTDropQuery.cpp @@ -55,7 +55,7 @@ bool ParserDropQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected & ex bool is_temporary = false; if (s_truncate.ignore(pos, expected) && s_table.ignore(pos, expected)) - { + { is_drop = false; query->kind = ASTDropQuery::Kind::Table; ASTDropQuery::QualifiedName name; @@ -63,7 +63,7 @@ bool ParserDropQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected & ex names.push_back(name); else return false; - } + } else if (s_drop.ignore(pos, expected)) { if (s_database.ignore(pos, expected)) @@ -92,7 +92,7 @@ bool ParserDropQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected & ex if (!(name_p.parse(pos, index, expected) && on.ignore(pos, expected))) return false; } - else if (s_event.ignore(pos, expected) || s_function.ignore(pos, expected) || s_server.ignore(pos, expected) + else if (s_event.ignore(pos, expected) || s_function.ignore(pos, expected) || s_server.ignore(pos, expected) || s_trigger.ignore(pos, expected)) { query->kind = ASTDropQuery::Kind::Other; @@ -117,8 +117,8 @@ bool ParserDropQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected & ex if (!ParserList::parseUtil(pos, expected, parse_element, false)) return false; } - } - else + } + else return false; query->if_exists = if_exists; @@ -128,8 +128,7 @@ bool ParserDropQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected & ex query->is_drop = is_drop; query->is_temporary = is_temporary; - return true; - + return true; } } diff --git a/src/Parsers/MySQL/ASTDropQuery.h b/src/Parsers/MySQL/ASTDropQuery.h index af46b55d2c6..c2fea928f62 100644 --- a/src/Parsers/MySQL/ASTDropQuery.h +++ b/src/Parsers/MySQL/ASTDropQuery.h @@ -27,7 +27,6 @@ public: Index, /// TRIGGER,FUNCTION,EVENT and so on, No need for support Other, - }; Kind kind; struct QualifiedName