MySQL 8.0.40
Source Code Documentation
options.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2021, 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 OPTIONS_INCLUDED
27#define OPTIONS_INCLUDED
28
29struct MYSQL;
30
31namespace options {
32
33/**
34 Command line options container
35*/
36
37class Options {
38 public:
39 /** Help */
40 static bool s_help;
41 /** Be loud */
42 static bool s_verbose;
43 /** Component directory location */
44 static char *s_component_dir;
45 /** Source keyring - Component or plugin */
46 static char *s_source_keyring;
47 /** Source Keyring configuration path - If it is not in component dir */
49 /** Destination keyring - Must be a component */
51 /** Destination Keyring configuration path - If it is not in component dir */
53
54 /*
55 Following parameters are needed if migration involves an active MySQL server
56 */
57
58 /** Flag for online migration */
59 static bool s_online_migration;
60 /** Hostname */
61 static char *s_hostname;
62 /** Port */
63 static unsigned int s_port;
64 /** Socket */
65 static char *s_socket;
66 /** User name */
67 static char *s_username;
68 /** Password */
69 static char *s_password;
70 /** Password to be fetched */
71 static bool s_tty_password;
72};
73
74/**
75 Process command line options
76
77 @param [in, out] argc Number of arguments
78 @param [in, out] argv Command line argument array
79 @param [out] exit_code Exit code
80
81 @returns status of argument processing
82 @retval true Success
83 @retval false Failure
84*/
85bool process_options(int *argc, char ***argv, int &exit_code);
86
87/** Initialize MYSQL connection structures */
89
90/** Deinitialize MYSQL connection structures */
92
94 public:
95 explicit Mysql_connection(bool connect);
97 bool execute(std::string command);
98 bool ok() { return ok_; }
99
100 private:
101 bool ok_;
103};
104} // namespace options
105
106#endif // !OPTIONS_INCLUDED
Definition: options.h:93
bool ok()
Definition: options.h:98
bool ok_
Definition: options.h:101
~Mysql_connection()
Definition: options.cc:349
bool execute(std::string command)
Definition: options.cc:359
Mysql_connection(bool connect)
Definition: options.cc:291
MYSQL * mysql
Definition: options.h:102
Command line options container.
Definition: options.h:37
static char * s_source_keyring_configuration_dir
Source Keyring configuration path - If it is not in component dir.
Definition: options.h:48
static unsigned int s_port
Port.
Definition: options.h:63
static char * s_destination_keyring_configuration_dir
Destination Keyring configuration path - If it is not in component dir.
Definition: options.h:52
static char * s_destination_keyring
Destination keyring - Must be a component.
Definition: options.h:50
static char * s_username
User name.
Definition: options.h:67
static bool s_online_migration
Flag for online migration.
Definition: options.h:59
static char * s_socket
Socket.
Definition: options.h:65
static char * s_password
Password.
Definition: options.h:69
static bool s_help
Help.
Definition: options.h:40
static bool s_tty_password
Password to be fetched.
Definition: options.h:71
static bool s_verbose
Be loud.
Definition: options.h:42
static char * s_source_keyring
Source keyring - Component or plugin.
Definition: options.h:46
static char * s_component_dir
Component directory location.
Definition: options.h:44
static char * s_hostname
Hostname.
Definition: options.h:61
stdx::expected< void, error_type > connect(native_handle_type native_handle, const struct sockaddr *addr, size_t addr_len)
wrap connect() in a portable way.
Definition: socket.h:353
Definition: options.cc:49
bool process_options(int *argc, char ***argv, int &exit_code)
Process command line options.
Definition: options.cc:256
void deinit_connection_basic()
Deinitialize MYSQL connection structures.
Definition: options.cc:280
void init_connection_basic()
Initialize MYSQL connection structures.
Definition: options.cc:279
Definition: mysql.h:299
command
Definition: version_token.cc:280