MySQL 8.0.39
Source Code Documentation
program.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 PROGRAM_INCLUDED
27#define PROGRAM_INCLUDED
28
29#include <atomic>
30#include <optional>
31
35
36namespace Mysql {
37namespace Tools {
38namespace Dump {
39
41 public:
42 Program();
43
44 ~Program() override;
45
46 std::string get_version() override;
47
48 int get_first_release_year() override;
49
50 std::string get_description() override;
51
52 int execute(const std::vector<std::string> &positional_options) override;
53
54 void create_options() override;
55
56 void error(const Mysql::Tools::Base::Message_data &message) override;
57
58 void short_usage() override;
59
61
63
64 int get_error_code() override;
65
66 private:
68 void error_log_file_callback(char *);
70
75 std::optional<std::string> m_error_log_file;
77 std::atomic<uint32_t> m_error_code;
78};
79
80} // namespace Dump
81} // namespace Tools
82} // namespace Mysql
83
84#endif
Base class for all programs that use connection to MySQL database server.
Definition: abstract_connection_program.h:46
Structure to represent message from server sent after executing query.
Definition: message_data.h:49
Definition: mysql_chain_element_options.h:37
Definition: mysqldump_tool_chain_maker_options.h:44
Definition: program.h:40
std::string get_description() override
Returns string describing shortly current program.
Definition: program.cc:231
FILE * m_stderr
Definition: program.h:76
void error_log_file_callback(char *)
Definition: program.cc:50
void close_redirected_stderr()
Definition: program.cc:46
int execute(const std::vector< std::string > &positional_options) override
Runs main program code.
Definition: program.cc:143
Mysqldump_tool_chain_maker_options * m_mysqldump_tool_chain_maker_options
Definition: program.h:72
std::optional< std::string > m_error_log_file
Definition: program.h:75
bool message_handler(const Mysql::Tools::Base::Message_data &message)
Definition: program.cc:63
int get_first_release_year() override
Returns year of first release of this program.
Definition: program.cc:235
int get_total_connections()
Definition: program.cc:123
std::atomic< uint32_t > m_error_code
Definition: program.h:77
std::string get_version() override
Returns string describing current version of this program.
Definition: program.cc:237
Mysql_chain_element_options * m_mysql_chain_element_options
Definition: program.h:71
bool m_watch_progress
Definition: program.h:74
void create_options() override
Creates all options that will be provided.
Definition: program.cc:80
void check_mutually_exclusive_options()
Definition: program.cc:106
void short_usage() override
Prints program invocation message.
Definition: program.cc:245
~Program() override
Definition: program.cc:239
Program()
Definition: program.cc:254
bool m_single_transaction
Definition: program.h:73
int get_error_code() override
Return error code.
Definition: program.cc:141
void error(const Mysql::Tools::Base::Message_data &message) override
Handles general errors.
Definition: program.cc:68
Definition: abstract_connection_program.h:38
const std::string FILE("FILE")