MySQL 8.0.39
Source Code Documentation
error_names.h
Go to the documentation of this file.
1#ifndef ERROR_NAMES_INCLUDED
2#define ERROR_NAMES_INCLUDED
3
4// Copyright (c) 2018, 2024, Oracle and/or its affiliates.
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License, version 2.0,
8// as published by the Free Software Foundation.
9//
10// This program is designed to work with certain software (including
11// but not limited to OpenSSL) that is licensed under separate terms,
12// as designated in a particular file or component or in included license
13// documentation. The authors of MySQL hereby grant you an additional
14// permission to link the program and your derivative works with the
15// separately licensed software that they have either included with
16// the program or referenced in the documentation.
17//
18// This program is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License, version 2.0, for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with this program; if not, write to the Free Software
25// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
26
27#include <string>
28
29struct st_error {
30 const char *name;
32 const char *description;
33 const char *odbc_state;
34 const char *jdbc_state;
35 unsigned int error_index;
36};
37
38/// Get an error code from an error name string.
39///
40/// @param error_name Error name string
41///
42/// @retval -1 if error name is unknown, error code otherwise.
43int get_errcode_from_name(std::string error_name);
44
45/// Get an error name from an error code.
46///
47/// @param error_code Error code
48///
49/// @retval "<Unknown>" keyword if error code is unknown, error name
50/// otherwise.
51const char *get_errname_from_code(int error_code);
52
53#endif // ERROR_NAMES_INCLUDED
const char * get_errname_from_code(int error_code)
Get an error name from an error code.
Definition: error_names.cc:43
int get_errcode_from_name(std::string error_name)
Get an error code from an error name string.
Definition: error_names.cc:34
Error structure.
Definition: error_names.h:29
const char * name
Definition: error_names.h:30
int error_code
Definition: error_names.h:31
const char * odbc_state
Definition: error_names.h:33
const char * jdbc_state
Definition: error_names.h:34
unsigned int error_index
Definition: error_names.h:35
const char * description
Definition: error_names.h:32