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