1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License, version 2.0, 6 * as published by the Free Software Foundation. 7 * 8 * This program is also distributed with certain software (including 9 * but not limited to OpenSSL) that is licensed under separate terms, 10 * as designated in a particular file or component or in included license 11 * documentation. The authors of MySQL hereby grant you an additional 12 * permission to link the program and your derivative works with the 13 * separately licensed software that they have included with MySQL. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License, version 2.0, for more details. 19 * 20 * You should have received a copy of the GNU General Public License along 21 * with this program; if not, write to the Free Software Foundation, Inc., 22 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 */ 24 25 #ifndef VIEW_STATEMENT_BUILDER_H_ 26 #define VIEW_STATEMENT_BUILDER_H_ 27 28 #include <string> 29 #include "statement_builder.h" 30 #include "find_statement_builder.h" 31 32 namespace xpl { 33 34 class View_statement_builder : public Statement_builder { 35 public: 36 typedef ::Mysqlx::Crud::DropView View_drop; 37 typedef ::Mysqlx::Crud::CreateView View_create; 38 typedef ::Mysqlx::Crud::ModifyView View_modify; 39 View_statement_builder(const Expression_generator & gen)40 explicit View_statement_builder(const Expression_generator &gen) 41 : Statement_builder(gen) {} 42 43 void build(const View_create &msg) const; 44 void build(const View_modify &msg) const; 45 void build(const View_drop &msg) const; 46 47 protected: 48 typedef ::Mysqlx::Crud::ViewAlgorithm Algorithm; 49 typedef ::Mysqlx::Crud::ViewSqlSecurity Sql_security; 50 typedef ::Mysqlx::Crud::ViewCheckOption Check_option; 51 typedef ::google::protobuf::RepeatedPtrField<std::string> Column_list; 52 typedef Find_statement_builder::Find Find; 53 54 void add_definer(const std::string &definer) const; 55 void add_algorithm(const Algorithm &algorithm) const; 56 void add_sql_security(const Sql_security &security) const; 57 void add_check_option(const Check_option &option) const; 58 void add_columns(const Column_list &columns) const; 59 void add_stmt(const Find &find) const; 60 template <typename M> 61 void build_common(const M &msg) const; 62 }; 63 64 } // namespace xpl 65 66 #endif // VIEW_STATEMENT_BUILDER_H_ 67