MySQL 8.0.39
Source Code Documentation
message_data.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2014, 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 MESSAGE_DATA_INCLUDED
27#define MESSAGE_DATA_INCLUDED
28
29#include <iostream>
30#include <string>
31
32#include "my_inttypes.h"
33
34namespace Mysql {
35namespace Tools {
36namespace Base {
37
44};
45
46/**
47 Structure to represent message from server sent after executing query.
48 */
50 public:
51 Message_data(uint64 code, std::string message, Message_type message_type);
52 virtual ~Message_data() = default;
53 uint64 get_code() const;
54 std::string get_message() const;
56 bool is_fatal() const;
57 std::string get_message_type_string() const;
58
59 static const char *message_type_strings[];
61 /**
62 Prints errors, warnings and notes to standard error.
63 */
64 virtual void print_error(std::string program_name) const;
65
66 private:
68 std::string m_message;
70};
71
72class Warning_data : public Message_data {
73 public:
74 Warning_data(uint64 code, std::string message, Message_type message_type)
75 : Message_data(code, message, message_type) {}
76 void print_error(std::string program_name) const override;
77};
78
79} // namespace Base
80} // namespace Tools
81} // namespace Mysql
82
83#endif
Structure to represent message from server sent after executing query.
Definition: message_data.h:49
uint64 get_code() const
Definition: message_data.cc:38
uint64 m_code
Definition: message_data.h:67
Message_data(uint64 code, std::string message, Message_type message_type)
Definition: message_data.cc:34
std::string get_message() const
Definition: message_data.cc:39
std::string m_message
Definition: message_data.h:68
static const char * message_type_strings[]
Definition: message_data.h:59
std::string get_message_type_string() const
Definition: message_data.cc:41
static const int message_type_strings_count
Definition: message_data.h:60
Message_type get_message_type() const
Definition: message_data.cc:40
bool is_fatal() const
Check if fatal error is encountered that mysql_upgrade cannot ignore.
Definition: message_data.cc:64
virtual void print_error(std::string program_name) const
Prints errors, warnings and notes to standard error.
Definition: message_data.cc:45
Message_type m_message_type
Definition: message_data.h:69
Definition: message_data.h:72
Warning_data(uint64 code, std::string message, Message_type message_type)
Definition: message_data.h:74
void print_error(std::string program_name) const override
Prints errors, warnings and notes to standard error.
Definition: message_data.cc:74
message_type
Definition: fido_common.h:43
Some integer typedefs for easier portability.
uint64_t uint64
Definition: my_inttypes.h:69
Message_type
Definition: message_data.h:38
@ Message_type_note
Definition: message_data.h:40
@ Message_type_unknown
Definition: message_data.h:43
@ Message_type_warning
Definition: message_data.h:41
@ Message_type_error
Definition: message_data.h:42
@ Message_type_info
Definition: message_data.h:39
Definition: abstract_connection_program.h:38