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