1 /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License, version 2.0,
5    as published by the Free Software Foundation.
6 
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 
14    Without limiting anything contained in the foregoing, this file,
15    which is part of C Driver for MySQL (Connector/C), is also subject to the
16    Universal FOSS Exception, version 1.0, a copy of which can be found at
17    http://oss.oracle.com/licenses/universal-foss-exception.
18 
19    This program is distributed in the hope that it will be useful,
20    but WITHOUT ANY WARRANTY; without even the implied warranty of
21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22    GNU General Public License, version 2.0, for more details.
23 
24    You should have received a copy of the GNU General Public License
25    along with this program; if not, write to the Free Software
26    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
27 
28 /* Error messages for MySQL clients */
29 /* (Error messages for the daemon are in share/language/errmsg.sys) */
30 
31 #include <my_global.h>
32 #include <my_sys.h>
33 #include "errmsg.h"
34 
35 const char **mysql_client_errors = client_errors;
36 const char *client_errors[]=
37 {
38   "Unknown MySQL error",
39   "Can't create UNIX socket (%d)",
40   "Can't connect to local MySQL server through socket '%-.100s' (%d)",
41   "Can't connect to MySQL server on '%-.100s' (%d)",
42   "Can't create TCP/IP socket (%d)",
43   "Unknown MySQL server host '%-.100s' (%d)",
44   "MySQL server has gone away",
45   "Protocol mismatch; server version = %d, client version = %d",
46   "MySQL client ran out of memory",
47   "Wrong host info",
48   "Localhost via UNIX socket",
49   "%-.100s via TCP/IP",
50   "Error in server handshake",
51   "Lost connection to MySQL server during query",
52   "Commands out of sync; you can't run this command now",
53   "Named pipe: %-.32s",
54   "Can't wait for named pipe to host: %-.64s  pipe: %-.32s (%lu)",
55   "Can't open named pipe to host: %-.64s  pipe: %-.32s (%lu)",
56   "Can't set state of named pipe to host: %-.64s  pipe: %-.32s (%lu)",
57   "Can't initialize character set %-.32s (path: %-.100s)",
58   "Got packet bigger than 'max_allowed_packet' bytes",
59   "Embedded server",
60   "Error on SHOW SLAVE STATUS:",
61   "Error on SHOW SLAVE HOSTS:",
62   "Error connecting to slave:",
63   "Error connecting to master:",
64   "SSL connection error: %-.100s",
65   "Malformed packet",
66   "This client library is licensed only for use with MySQL servers having '%s' license",
67   "Invalid use of null pointer",
68   "Statement not prepared",
69   "No data supplied for parameters in prepared statement",
70   "Data truncated",
71   "No parameters exist in the statement",
72   "Invalid parameter number",
73   "Can't send long data for non-string/non-binary data types (parameter: %d)",
74   "Using unsupported buffer type: %d  (parameter: %d)",
75   "Shared memory: %-.100s",
76   "Can't open shared memory; client could not create request event (%lu)",
77   "Can't open shared memory; no answer event received from server (%lu)",
78   "Can't open shared memory; server could not allocate file mapping (%lu)",
79   "Can't open shared memory; server could not get pointer to file mapping (%lu)",
80   "Can't open shared memory; client could not allocate file mapping (%lu)",
81   "Can't open shared memory; client could not get pointer to file mapping (%lu)",
82   "Can't open shared memory; client could not create %s event (%lu)",
83   "Can't open shared memory; no answer from server (%lu)",
84   "Can't open shared memory; cannot send request event to server (%lu)",
85   "Wrong or unknown protocol",
86   "Invalid connection handle",
87   "Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)",
88   "Row retrieval was canceled by mysql_stmt_close() call",
89   "Attempt to read column without prior row fetch",
90   "Prepared statement contains no metadata",
91   "Attempt to read a row while there is no result set associated with the statement",
92   "This feature is not implemented yet",
93   "Lost connection to MySQL server at '%s', system error: %d",
94   "Statement closed indirectly because of a preceeding %s() call",
95   "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again",
96   "This handle is already connected. Use a separate handle for each connection.",
97   "Authentication plugin '%s' cannot be loaded: %s",
98   "There is an attribute with the same name already",
99   "Authentication plugin '%s' reported error: %s",
100   ""
101 };
102 
get_client_errmsgs()103 const char** get_client_errmsgs()
104 {
105   return client_errors;
106 }
107 
108 /*
109   Register client error messages for use with my_error().
110 
111   SYNOPSIS
112     init_client_errs()
113 
114   RETURN
115     void
116 */
117 
init_client_errs(void)118 void init_client_errs(void)
119 {
120   compile_time_assert(array_elements(client_errors) ==
121                       (CR_ERROR_LAST - CR_ERROR_FIRST + 2));
122   (void) my_error_register(get_client_errmsgs, CR_ERROR_FIRST, CR_ERROR_LAST);
123 }
124 
125 
126 /*
127   Unregister client error messages.
128 
129   SYNOPSIS
130     finish_client_errs()
131 
132   RETURN
133     void
134 */
135 
finish_client_errs(void)136 void finish_client_errs(void)
137 {
138   (void) my_error_unregister(CR_ERROR_FIRST, CR_ERROR_LAST);
139 }
140