MySQL 8.3.0
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, 2023, 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 also distributed 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 included with MySQL.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License, version 2.0, for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program; if not, write to the Free Software
24// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25
26#include <string>
27
28struct st_error {
29 const char *name;
31 const char *description;
32 const char *odbc_state;
33 const char *jdbc_state;
34 unsigned int error_index;
35};
36
37/// Get an error code from an error name string.
38///
39/// @param error_name Error name string
40///
41/// @retval -1 if error name is unknown, error code otherwise.
42int get_errcode_from_name(std::string error_name);
43
44/// Get an error name from an error code.
45///
46/// @param error_code Error code
47///
48/// @retval "<Unknown>" keyword if error code is unknown, error name
49/// otherwise.
50const char *get_errname_from_code(int error_code);
51
52#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:42
int get_errcode_from_name(std::string error_name)
Get an error code from an error name string.
Definition: error_names.cc:33
Error structure.
Definition: error_names.h:28
const char * name
Definition: error_names.h:29
int error_code
Definition: error_names.h:30
const char * odbc_state
Definition: error_names.h:32
const char * jdbc_state
Definition: error_names.h:33
unsigned int error_index
Definition: error_names.h:34
const char * description
Definition: error_names.h:31