MySQL 8.0.40
Source Code Documentation
Mysql::Tools::Dump::Sql_formatter Class Reference

Prints object data in SQL format. More...

#include <sql_formatter.h>

Inheritance diagram for Mysql::Tools::Dump::Sql_formatter:
[legend]

Public Member Functions

 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)
 
 ~Sql_formatter () override
 
void format_object (Item_processing_data *item_to_process) override
 Creates string representation for output of DB object related to specified dump task object. More...
 
void register_progress_watcher (I_progress_watcher *new_progress_watcher) override
 Add new Progress Watcher to report to. More...
 
uint64 get_id () const override
 Returns an application unique ID of this chain element object. More...
 
- Public Member Functions inherited from Mysql::Tools::Dump::Abstract_output_writer_wrapper
void register_output_writer (I_output_writer *new_output_writter) override
 Add new Output Writer to supply formatted strings to. More...
 
- Public Member Functions inherited from Mysql::Tools::Dump::Abstract_chain_element
Abstract_chain_elementoperator= (Abstract_chain_element &&other)=delete
 Disable move assignment to avoid Wvirtual-move-assign warning. More...
 
- Public Member Functions inherited from Mysql::Tools::Dump::I_chain_element
 ~I_chain_element () override
 
- Public Member Functions inherited from Mysql::Tools::Dump::I_progress_reporter
virtual ~I_progress_reporter ()
 
- Public Member Functions inherited from Mysql::Tools::Dump::I_output_writer_wrapper
virtual ~I_output_writer_wrapper ()=default
 

Protected Member Functions

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. More...
 
- Protected Member Functions inherited from Mysql::Tools::Dump::Abstract_output_writer_wrapper
 Abstract_output_writer_wrapper (std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator)
 
void append_output (const std::string &data_to_append)
 
- Protected Member Functions inherited from Mysql::Tools::Dump::Abstract_chain_element
 Abstract_chain_element (std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator)
 
template<typename TType , typename TClass >
bool try_process_task (Item_processing_data *item_to_process, void(TClass::*processing_func)(TType *, Item_processing_data *))
 Process task object with specified function if that task object can be casted to type TType. More...
 
template<typename TType , typename TClass >
bool try_process_task (Item_processing_data *item_to_process, void(TClass::*processing_func)(TType *))
 Process task object with specified function if that task object can be casted to type TType. More...
 
void object_processing_starts (Item_processing_data *item_to_process)
 
Item_processing_dataobject_to_be_processed_in_child (Item_processing_data *current_item_data, I_chain_element *child_chain_element)
 
Item_processing_datanew_task_created (I_dump_task *dump_task_created)
 
Item_processing_datanew_chain_created (Chain_data *new_chain_data, Item_processing_data *parent_processing_data, I_chain_element *child_chain_element)
 
Item_processing_datanew_chain_created (Item_processing_data *current_item_data, I_dump_task *dump_task_created)
 
void object_processing_ends (Item_processing_data *processed_item)
 
uint64 generate_new_object_id ()
 
Simple_id_generatorget_object_id_generator () const
 
void pass_message (const Mysql::Tools::Base::Message_data &message_data)
 Passes message to message callback. More...
 
std::function< bool(const Mysql::Tools::Base::Message_data &)> * get_message_handler () const
 
virtual bool need_callbacks_in_child ()
 
- Protected Member Functions inherited from Mysql::Tools::Dump::Abstract_progress_reporter
bool have_progress_watcher ()
 Specifies if have any Progress Watcher registered. More...
 
void report_new_chain_created (Item_processing_data *new_chain_creator)
 Reports new non-empty chain being created by Chain Maker or new row fetched from table by Table Reader. More...
 
void report_object_processing_started (Item_processing_data *process_data)
 Report new object(table, row or any other) was started processing by specified Object Reader, Table Reader, Formatter or Row Formatter. More...
 
void report_object_processing_ended (Item_processing_data *finished_process_data)
 Report object(table, row or any other) finished being processed. More...
 
virtual void report_crawler_completed (I_crawler *crawler)
 Reports crawler ended enumerating objects and creating chains for them. More...
 
void register_progress_watchers_in_child (I_progress_reporter *reporter)
 
- Protected Member Functions inherited from Mysql::Tools::Dump::Abstract_mysql_chain_element_extension
 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)
 
Mysql::Tools::Base::Mysql_query_runnerget_runner () const
 
I_connection_providerget_connection_provider () const
 
uint64 get_server_version ()
 
std::string get_server_version_string ()
 
int compare_no_case_latin_with_db_string (const std::string &latin_name, const std::string &db_name)
 
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. More...
 
std::string quote_name (const std::string &name)
 Quotes char string, taking into account compatible mode. More...
 
std::string get_quoted_object_full_name (const Abstract_data_object *object)
 
std::string get_quoted_object_full_name (const std::string &database_name, const std::string &object_name)
 
const Mysql_chain_element_optionsget_mysql_chain_element_options () const
 
CHARSET_INFOget_charset () const
 

Private Member Functions

void format_plain_sql_object (Abstract_plain_sql_object_dump_task *plain_sql_dump_task)
 
void format_dump_start (Dump_start_dump_task *dump_start_dump_task)
 
void format_dump_end (Dump_end_dump_task *dump_start_dump_task)
 
void format_database_start (Database_start_dump_task *database_definition_dump_task)
 
void format_table_definition (Table_definition_dump_task *table_definition_dump_task)
 
void format_table_indexes (Table_deferred_indexes_dump_task *table_indexes_dump_task)
 
void format_row_group (Row_group_dump_task *row_group)
 
void format_sql_objects_definer (Abstract_plain_sql_object_dump_task *, std::string)
 
bool innodb_stats_tables (std::string db, std::string table)
 Check if the table is innodb stats table in mysql database. More...
 

Private Attributes

Mysql::Tools::Base::Mysql_query_runnerm_escaping_runner
 
const Mysqldump_tool_chain_maker_optionsm_mysqldump_tool_options
 
const Sql_formatter_optionsm_options
 

Detailed Description

Prints object data in SQL format.

Constructor & Destructor Documentation

◆ Sql_formatter()

Sql_formatter::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 
)

◆ ~Sql_formatter()

Sql_formatter::~Sql_formatter ( )
override

Member Function Documentation

◆ format_database_start()

void Sql_formatter::format_database_start ( Database_start_dump_task database_definition_dump_task)
private

◆ format_dump_end()

void Sql_formatter::format_dump_end ( Dump_end_dump_task dump_start_dump_task)
private

◆ format_dump_start()

void Sql_formatter::format_dump_start ( Dump_start_dump_task dump_start_dump_task)
private

◆ format_object()

void Sql_formatter::format_object ( Item_processing_data item_to_process)
overridevirtual

Creates string representation for output of DB object related to specified dump task object.

Implements Mysql::Tools::Dump::I_data_formatter.

◆ format_plain_sql_object()

void Sql_formatter::format_plain_sql_object ( Abstract_plain_sql_object_dump_task plain_sql_dump_task)
private

◆ format_row_group()

void Sql_formatter::format_row_group ( Row_group_dump_task row_group)
private

◆ format_sql_objects_definer()

void Sql_formatter::format_sql_objects_definer ( Abstract_plain_sql_object_dump_task plain_sql_dump_task,
std::string  object_type 
)
private

◆ format_table_definition()

void Sql_formatter::format_table_definition ( Table_definition_dump_task table_definition_dump_task)
private

◆ format_table_indexes()

void Sql_formatter::format_table_indexes ( Table_deferred_indexes_dump_task table_indexes_dump_task)
private

◆ get_id()

uint64 Mysql::Tools::Dump::Sql_formatter::get_id ( ) const
inlineoverridevirtual

Returns an application unique ID of this chain element object.

This helps progress watching with multiple parts of chain during all objects processing.

Reimplemented from Mysql::Tools::Dump::Abstract_chain_element.

◆ innodb_stats_tables()

bool Sql_formatter::innodb_stats_tables ( std::string  db,
std::string  table 
)
private

Check if the table is innodb stats table in mysql database.

Parameters
[in]dbDatabase name
[in]tableTable name
Return values
trueif it is innodb stats table else false

◆ item_completion_in_child_callback()

void Mysql::Tools::Dump::Sql_formatter::item_completion_in_child_callback ( Item_processing_data item_processed)
inlineoverrideprotectedvirtual

This callback can be requested to be called by child for any object processing.

This will be called when the object processing has completed. Note that this function may be called from multiple threads so all implementations must be thread-safe.

Reimplemented from Mysql::Tools::Dump::Abstract_chain_element.

◆ register_progress_watcher()

void Mysql::Tools::Dump::Sql_formatter::register_progress_watcher ( I_progress_watcher new_progress_watcher)
inlineoverridevirtual

Add new Progress Watcher to report to.

Reimplemented from Mysql::Tools::Dump::Abstract_chain_element.

Member Data Documentation

◆ m_escaping_runner

Mysql::Tools::Base::Mysql_query_runner* Mysql::Tools::Dump::Sql_formatter::m_escaping_runner
private

◆ m_mysqldump_tool_options

const Mysqldump_tool_chain_maker_options* Mysql::Tools::Dump::Sql_formatter::m_mysqldump_tool_options
private

◆ m_options

const Sql_formatter_options* Mysql::Tools::Dump::Sql_formatter::m_options
private

The documentation for this class was generated from the following files: