Skip to content

Commit 2b78e99

Browse files
author
Nisha Gopalakrishnan
committed
Merge from mysql-5.5 to mysql-5.6
2 parents c80ecc3 + 56cf9d2 commit 2b78e99

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

include/errmsg.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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

libmysql/errmsg.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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

108108
void 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

libmysql/libmysql.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
}

0 commit comments

Comments
 (0)