errmsg.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #ifndef ERRMSG_INCLUDED
  2. #define ERRMSG_INCLUDED
  3. /* Copyright (c) 2000, 2022, Oracle and/or its affiliates.
  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. This program is also distributed with certain software (including
  8. but not limited to OpenSSL) that is licensed under separate terms,
  9. as designated in a particular file or component or in included license
  10. documentation. The authors of MySQL hereby grant you an additional
  11. permission to link the program and your derivative works with the
  12. separately licensed software that they have included with MySQL.
  13. Without limiting anything contained in the foregoing, this file,
  14. which is part of C Driver for MySQL (Connector/C), is also subject to the
  15. Universal FOSS Exception, version 1.0, a copy of which can be found at
  16. http://oss.oracle.com/licenses/universal-foss-exception.
  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. 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. @file include/errmsg.h
  26. Error messages for MySQL clients.
  27. These are constant and use the CR_ prefix.
  28. <mysqlclient_ername.h> will contain auto-generated mappings
  29. containing the symbolic name and the number from this file,
  30. and the english error messages in libmysql/errmsg.c.
  31. Dynamic error messages for the daemon are in share/language/errmsg.sys.
  32. The server equivalent to <errmsg.h> is <mysqld_error.h>.
  33. The server equivalent to <mysqlclient_ername.h> is <mysqld_ername.h>.
  34. Note that the auth subsystem also uses codes with a CR_ prefix.
  35. */
  36. void init_client_errs(void);
  37. void finish_client_errs(void);
  38. extern const char *client_errors[]; /* Error messages */
  39. #define CR_MIN_ERROR 2000 /* For easier client code */
  40. #define CR_MAX_ERROR 2999
  41. #define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
  42. /* Do not add error numbers before CR_ERROR_FIRST. */
  43. /* If necessary to add lower numbers, change CR_ERROR_FIRST accordingly. */
  44. #define CR_ERROR_FIRST 2000 /*Copy first error nr.*/
  45. #define CR_UNKNOWN_ERROR 2000
  46. #define CR_SOCKET_CREATE_ERROR 2001
  47. #define CR_CONNECTION_ERROR 2002
  48. #define CR_CONN_HOST_ERROR 2003
  49. #define CR_IPSOCK_ERROR 2004
  50. #define CR_UNKNOWN_HOST 2005
  51. #define CR_SERVER_GONE_ERROR 2006
  52. #define CR_VERSION_ERROR 2007
  53. #define CR_OUT_OF_MEMORY 2008
  54. #define CR_WRONG_HOST_INFO 2009
  55. #define CR_LOCALHOST_CONNECTION 2010
  56. #define CR_TCP_CONNECTION 2011
  57. #define CR_SERVER_HANDSHAKE_ERR 2012
  58. #define CR_SERVER_LOST 2013
  59. #define CR_COMMANDS_OUT_OF_SYNC 2014
  60. #define CR_NAMEDPIPE_CONNECTION 2015
  61. #define CR_NAMEDPIPEWAIT_ERROR 2016
  62. #define CR_NAMEDPIPEOPEN_ERROR 2017
  63. #define CR_NAMEDPIPESETSTATE_ERROR 2018
  64. #define CR_CANT_READ_CHARSET 2019
  65. #define CR_NET_PACKET_TOO_LARGE 2020
  66. #define CR_EMBEDDED_CONNECTION 2021
  67. #define CR_PROBE_SLAVE_STATUS 2022
  68. #define CR_PROBE_SLAVE_HOSTS 2023
  69. #define CR_PROBE_SLAVE_CONNECT 2024
  70. #define CR_PROBE_MASTER_CONNECT 2025
  71. #define CR_SSL_CONNECTION_ERROR 2026
  72. #define CR_MALFORMED_PACKET 2027
  73. #define CR_WRONG_LICENSE 2028
  74. /* new 4.1 error codes */
  75. #define CR_NULL_POINTER 2029
  76. #define CR_NO_PREPARE_STMT 2030
  77. #define CR_PARAMS_NOT_BOUND 2031
  78. #define CR_DATA_TRUNCATED 2032
  79. #define CR_NO_PARAMETERS_EXISTS 2033
  80. #define CR_INVALID_PARAMETER_NO 2034
  81. #define CR_INVALID_BUFFER_USE 2035
  82. #define CR_UNSUPPORTED_PARAM_TYPE 2036
  83. #define CR_SHARED_MEMORY_CONNECTION 2037
  84. #define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 2038
  85. #define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 2039
  86. #define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 2040
  87. #define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 2041
  88. #define CR_SHARED_MEMORY_FILE_MAP_ERROR 2042
  89. #define CR_SHARED_MEMORY_MAP_ERROR 2043
  90. #define CR_SHARED_MEMORY_EVENT_ERROR 2044
  91. #define CR_SHARED_MEMORY_CONNECT_ABANDONED_ERROR 2045
  92. #define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2046
  93. #define CR_CONN_UNKNOW_PROTOCOL 2047
  94. #define CR_INVALID_CONN_HANDLE 2048
  95. #define CR_UNUSED_1 2049
  96. #define CR_FETCH_CANCELED 2050
  97. #define CR_NO_DATA 2051
  98. #define CR_NO_STMT_METADATA 2052
  99. #define CR_NO_RESULT_SET 2053
  100. #define CR_NOT_IMPLEMENTED 2054
  101. #define CR_SERVER_LOST_EXTENDED 2055
  102. #define CR_STMT_CLOSED 2056
  103. #define CR_NEW_STMT_METADATA 2057
  104. #define CR_ALREADY_CONNECTED 2058
  105. #define CR_AUTH_PLUGIN_CANNOT_LOAD 2059
  106. #define CR_DUPLICATE_CONNECTION_ATTR 2060
  107. #define CR_AUTH_PLUGIN_ERR 2061
  108. #define CR_INSECURE_API_ERR 2062
  109. #define CR_FILE_NAME_TOO_LONG 2063
  110. #define CR_SSL_FIPS_MODE_ERR 2064
  111. #define CR_DEPRECATED_COMPRESSION_NOT_SUPPORTED 2065
  112. #define CR_COMPRESSION_WRONGLY_CONFIGURED 2066
  113. #define CR_KERBEROS_USER_NOT_FOUND 2067
  114. #define CR_LOAD_DATA_LOCAL_INFILE_REJECTED 2068
  115. #define CR_LOAD_DATA_LOCAL_INFILE_REALPATH_FAIL 2069
  116. #define CR_DNS_SRV_LOOKUP_FAILED 2070
  117. #define CR_MANDATORY_TRACKER_NOT_FOUND 2071
  118. #define CR_INVALID_FACTOR_NO 2072
  119. #define CR_CANT_GET_SESSION_DATA 2073
  120. #define CR_ERROR_LAST /*Copy last error nr:*/ 2073
  121. /* Add error numbers before CR_ERROR_LAST and change it accordingly. */
  122. /* Visual Studio requires '__inline' for C code */
  123. static inline const char *ER_CLIENT(int client_errno) {
  124. if (client_errno >= CR_ERROR_FIRST && client_errno <= CR_ERROR_LAST)
  125. return client_errors[client_errno - CR_ERROR_FIRST];
  126. return client_errors[CR_UNKNOWN_ERROR - CR_ERROR_FIRST];
  127. }
  128. #endif /* ERRMSG_INCLUDED */