MySQL 8.3.0
Source Code Documentation
sql_formatter.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2015, 2023, 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 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
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
25#ifndef SQL_FORMATTER_INCLUDED
26#define SQL_FORMATTER_INCLUDED
27
28#include <functional>
29
43#include "my_inttypes.h"
44
45namespace Mysql {
46namespace Tools {
47namespace Dump {
48
49/**
50 Prints object data in SQL format.
51 */
54 public virtual I_data_formatter {
55 public:
57 I_connection_provider *connection_provider,
58 std::function<bool(const Mysql::Tools::Base::Message_data &)>
59 *message_handler,
60 Simple_id_generator *object_id_generator,
61 const Mysqldump_tool_chain_maker_options *mysqldump_tool_options,
63
64 ~Sql_formatter() override;
65
66 /**
67 Creates string representation for output of DB object related to specified
68 dump task object.
69 */
70 void format_object(Item_processing_data *item_to_process) override;
71
72 // Fix "inherits ... via dominance" warnings
74 I_progress_watcher *new_progress_watcher) override {
76 }
77
78 // Fix "inherits ... via dominance" warnings
79 uint64 get_id() const override { return Abstract_chain_element::get_id(); }
80
81 protected:
82 // Fix "inherits ... via dominance" warnings
84 Item_processing_data *item_processed) override {
86 }
87
88 private:
90 Abstract_plain_sql_object_dump_task *plain_sql_dump_task);
91
92 void format_dump_start(Dump_start_dump_task *dump_start_dump_task);
93
94 void format_dump_end(Dump_end_dump_task *dump_start_dump_task);
95
97 Database_start_dump_task *database_definition_dump_task);
98
100 Table_definition_dump_task *table_definition_dump_task);
101
103 Table_deferred_indexes_dump_task *table_indexes_dump_task);
104
105 void format_row_group(Row_group_dump_task *row_group);
106
108 std::string);
109
110 bool innodb_stats_tables(std::string db, std::string table);
111
115};
116
117} // namespace Dump
118} // namespace Tools
119} // namespace Mysql
120
121#endif
Structure to represent message from server sent after executing query.
Definition: message_data.h:48
Helper class to run SQL query on existing MySQL database server connection, receive all data and all ...
Definition: mysql_query_runner.h:48
void register_progress_watcher(I_progress_watcher *new_progress_watcher) override
Add new Progress Watcher to report to.
Definition: abstract_chain_element.h:57
uint64 get_id() const override
Returns an application unique ID of this chain element object.
Definition: abstract_chain_element.cc:35
void item_completion_in_child_callback(Item_processing_data *item_processed) override
This callback can be requested to be called by child for any object processing.
Definition: abstract_chain_element.cc:149
Definition: abstract_mysql_chain_element_extension.h:49
Implementation of common logic for classes that directs execution of dump tasks to Data Formatters.
Definition: abstract_output_writer_wrapper.h:43
Abstract task for dumping object carrying its definition in SQL formatted string only.
Definition: abstract_plain_sql_object_dump_task.h:41
Definition: database_start_dump_task.h:34
Definition: dump_end_dump_task.h:34
Definition: dump_start_dump_task.h:34
Definition: i_connection_provider.h:37
Definition: i_data_formatter.h:35
Definition: i_progress_watcher.h:36
Data structure for objects that are processed in any chain.
Definition: item_processing_data.h:42
Definition: mysqldump_tool_chain_maker_options.h:43
Represents single data row.
Definition: row_group_dump_task.h:42
Definition: simple_id_generator.h:36
Definition: sql_formatter_options.h:47
Prints object data in SQL format.
Definition: sql_formatter.h:54
void format_row_group(Row_group_dump_task *row_group)
Definition: sql_formatter.cc:46
Mysql::Tools::Base::Mysql_query_runner * m_escaping_runner
Definition: sql_formatter.h:112
~Sql_formatter() override
Definition: sql_formatter.cc:490
const Mysqldump_tool_chain_maker_options * m_mysqldump_tool_options
Definition: sql_formatter.h:113
void format_table_definition(Table_definition_dump_task *table_definition_dump_task)
Definition: sql_formatter.cc:219
void format_dump_start(Dump_start_dump_task *dump_start_dump_task)
Definition: sql_formatter.cc:279
void format_sql_objects_definer(Abstract_plain_sql_object_dump_task *, std::string)
Definition: sql_formatter.cc:408
void format_object(Item_processing_data *item_to_process) override
Creates string representation for output of DB object related to specified dump task object.
Definition: sql_formatter.cc:444
void format_database_start(Database_start_dump_task *database_definition_dump_task)
Definition: sql_formatter.cc:245
bool innodb_stats_tables(std::string db, std::string table)
Check if the table is innodb stats table in mysql database.
Definition: sql_formatter.cc:439
void register_progress_watcher(I_progress_watcher *new_progress_watcher) override
Add new Progress Watcher to report to.
Definition: sql_formatter.h:73
void format_table_indexes(Table_deferred_indexes_dump_task *table_indexes_dump_task)
Definition: sql_formatter.cc:192
void item_completion_in_child_callback(Item_processing_data *item_processed) override
This callback can be requested to be called by child for any object processing.
Definition: sql_formatter.h:83
uint64 get_id() const override
Returns an application unique ID of this chain element object.
Definition: sql_formatter.h:79
Sql_formatter(I_connection_provider *connection_provider, std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator, const Mysqldump_tool_chain_maker_options *mysqldump_tool_options, const Sql_formatter_options *options)
Definition: sql_formatter.cc:474
void format_plain_sql_object(Abstract_plain_sql_object_dump_task *plain_sql_dump_task)
Definition: sql_formatter.cc:357
void format_dump_end(Dump_end_dump_task *dump_start_dump_task)
Definition: sql_formatter.cc:255
const Sql_formatter_options * m_options
Definition: sql_formatter.h:114
Represents task for deferred creation secondary indexes for single DB table.
Definition: table_deferred_indexes_dump_task.h:37
Represents single DB table DDL creation task.
Definition: table_definition_dump_task.h:37
Some integer typedefs for easier portability.
uint64_t uint64
Definition: my_inttypes.h:68
Definition: abstract_connection_program.h:39
static PFS_engine_table_share_proxy table
Definition: pfs.cc:60
Definition: options.cc:56