File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 11#ifndef ERRMSG_INCLUDED
22#define ERRMSG_INCLUDED
33
4- /* Copyright (c) 2000, 2012 , Oracle and/or its affiliates. All rights reserved.
4+ /* Copyright (c) 2000, 2014 , Oracle and/or its affiliates. All rights reserved.
55
66 This program is free software; you can redistribute it and/or modify
77 it under the terms of the GNU General Public License as published by
@@ -32,7 +32,9 @@ extern const char *client_errors[]; /* Error messages */
3232#define CR_MIN_ERROR 2000 /* For easier client code */
3333#define CR_MAX_ERROR 2999
3434#if !defined(ER )
35- #define ER (X ) client_errors[(X)-CR_MIN_ERROR]
35+ #define ER (X ) (((X) >= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST)? \
36+ client_errors[(X)-CR_ERROR_FIRST]: client_errors[CR_UNKNOWN_ERROR])
37+
3638#endif
3739#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
3840
Original file line number Diff line number Diff line change 1- /* Copyright (c) 2000, 2011 , Oracle and/or its affiliates. All rights reserved.
1+ /* Copyright (c) 2000, 2014 , Oracle and/or its affiliates. All rights reserved.
22
33 This program is free software; you can redistribute it and/or modify
44 it under the terms of the GNU General Public License as published by
@@ -107,6 +107,8 @@ const char** get_client_errmsgs()
107107
108108void init_client_errs (void )
109109{
110+ compile_time_assert (array_elements (client_errors ) ==
111+ (CR_ERROR_LAST - CR_ERROR_FIRST + 2 ));
110112 (void ) my_error_register (get_client_errmsgs , CR_ERROR_FIRST , CR_ERROR_LAST );
111113}
112114
Original file line number Diff line number Diff line change 1- /* Copyright (c) 2000, 2013 , Oracle and/or its affiliates. All rights reserved.
1+ /* Copyright (c) 2000, 2014 , Oracle and/or its affiliates. All rights reserved.
22
33 This program is free software; you can redistribute it and/or modify
44 it under the terms of the GNU General Public License as published by
@@ -1335,6 +1335,10 @@ static my_bool my_realloc_str(NET *net, ulong length)
13351335 res = net_realloc (net , buf_length + length );
13361336 if (res )
13371337 {
1338+ if (net -> last_errno == ER_OUT_OF_RESOURCES )
1339+ net -> last_errno = CR_OUT_OF_MEMORY ;
1340+ else if (net -> last_errno == ER_NET_PACKET_TOO_LARGE )
1341+ net -> last_errno = CR_NET_PACKET_TOO_LARGE ;
13381342 strmov (net -> sqlstate , unknown_sqlstate );
13391343 strmov (net -> last_error , ER (net -> last_errno ));
13401344 }
You can’t perform that action at this time.
0 commit comments