MySQL 8.0.40
Source Code Documentation
abstract_mysql_chain_element_extension.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2015, 2024, Oracle and/or its affiliates.
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 designed to work 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 either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License, version 2.0, for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef ABSTRACT_MYSQL_CHAIN_ELEMENT_EXTENSION_INCLUDED
27#define ABSTRACT_MYSQL_CHAIN_ELEMENT_EXTENSION_INCLUDED
28
29#include <functional>
30#include <optional>
31
32#include <sys/types.h>
33
39#include "my_inttypes.h"
40
41#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8mb4"
42#define MAX_NAME_LEN (64 * 3)
43
44namespace Mysql {
45namespace Tools {
46namespace Dump {
47
49 protected:
51 I_connection_provider *connection_provider,
52 std::function<bool(const Mysql::Tools::Base::Message_data &)>
53 *message_handler,
55
57
59
61
62 std::string get_server_version_string();
63
64 int compare_no_case_latin_with_db_string(const std::string &latin_name,
65 const std::string &db_name);
66
67 /**
68 Gets CREATE statement for specified object. If object type is database,
69 then object_name should be empty.
70 */
71 std::optional<std::string> get_create_statement(
73 const std::string &database_name, const std::string &object_name,
74 const std::string &object_type, uint field_id = 1);
75
76 /**
77 Quotes char string, taking into account compatible mode.
78 */
79 std::string quote_name(const std::string &name);
80
81 std::string get_quoted_object_full_name(const Abstract_data_object *object);
82
83 std::string get_quoted_object_full_name(const std::string &database_name,
84 const std::string &object_name);
85
87
89
90 private:
92 std::function<bool(const Mysql::Tools::Base::Message_data &)>
96};
97
98} // namespace Dump
99} // namespace Tools
100} // namespace Mysql
101
102#endif
Structure to represent message from server sent after executing query.
Definition: message_data.h:49
Helper class to run SQL query on existing MySQL database server connection, receive all data and all ...
Definition: mysql_query_runner.h:49
Base class for all main DB objects.
Definition: abstract_data_object.h:41
Definition: abstract_mysql_chain_element_extension.h:48
int compare_no_case_latin_with_db_string(const std::string &latin_name, const std::string &db_name)
Definition: abstract_mysql_chain_element_extension.cc:80
CHARSET_INFO * get_charset() const
Definition: abstract_mysql_chain_element_extension.cc:170
uint64 get_server_version()
Definition: abstract_mysql_chain_element_extension.cc:61
CHARSET_INFO * m_charset
Definition: abstract_mysql_chain_element_extension.h:95
I_connection_provider * get_connection_provider() const
Definition: abstract_mysql_chain_element_extension.cc:57
Abstract_mysql_chain_element_extension(I_connection_provider *connection_provider, std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, const Mysql_chain_element_options *options)
Definition: abstract_mysql_chain_element_extension.cc:38
const Mysql_chain_element_options * m_options
Definition: abstract_mysql_chain_element_extension.h:94
Mysql::Tools::Base::Mysql_query_runner * get_runner() const
Definition: abstract_mysql_chain_element_extension.cc:52
std::string get_server_version_string()
Definition: abstract_mysql_chain_element_extension.cc:71
const Mysql_chain_element_options * get_mysql_chain_element_options() const
Definition: abstract_mysql_chain_element_extension.cc:165
std::optional< std::string > get_create_statement(Mysql::Tools::Base::Mysql_query_runner *runner, const std::string &database_name, const std::string &object_name, const std::string &object_type, uint field_id=1)
Gets CREATE statement for specified object.
Definition: abstract_mysql_chain_element_extension.cc:86
std::string quote_name(const std::string &name)
Quotes char string, taking into account compatible mode.
Definition: abstract_mysql_chain_element_extension.cc:134
I_connection_provider * m_connection_provider
Definition: abstract_mysql_chain_element_extension.h:91
std::function< bool(const Mysql::Tools::Base::Message_data &)> * m_message_handler
Definition: abstract_mysql_chain_element_extension.h:93
std::string get_quoted_object_full_name(const Abstract_data_object *object)
Definition: abstract_mysql_chain_element_extension.cc:150
Interface for all objects that can process data in any part of dump process.
Definition: i_chain_element.h:41
Definition: i_connection_provider.h:38
Definition: mysql_chain_element_options.h:37
Some integer typedefs for easier portability.
uint64_t uint64
Definition: my_inttypes.h:69
Definition: abstract_connection_program.h:38
Definition: options.cc:49
const char * db_name
Definition: rules_table_service.cc:55
static const LEX_CSTRING field_id
Definition: sql_show_processlist.cc:49
case opt name
Definition: sslopt-case.h:33
Definition: m_ctype.h:385
unsigned int uint
Definition: uca9-dump.cc:75