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