Commit 93c0cddb authored by unknown's avatar unknown

Update "get_errcode_from_name"

 - add missing DBUG_RETURN
 - Change type of st_error->code to uint, that should be more than enough
   to hold the error numbers between 1000 and around 2000

parent 395a1648
...@@ -2429,7 +2429,7 @@ void do_set_charset(struct st_command *command) ...@@ -2429,7 +2429,7 @@ void do_set_charset(struct st_command *command)
typedef struct typedef struct
{ {
const char *name; const char *name;
long code; uint code;
} st_error; } st_error;
static st_error global_error_names[] = static st_error global_error_names[] =
...@@ -2443,8 +2443,8 @@ static st_error global_error_names[] = ...@@ -2443,8 +2443,8 @@ static st_error global_error_names[] =
uint get_errcode_from_name(char *error_name, char *error_end) uint get_errcode_from_name(char *error_name, char *error_end)
{ {
#ifdef HAVE_MYSQLD_ERNAME
DBUG_ENTER("get_errcode_from_name"); DBUG_ENTER("get_errcode_from_name");
#ifdef HAVE_MYSQLD_ERNAME
/* SQL error as string */ /* SQL error as string */
st_error *e= global_error_names; st_error *e= global_error_names;
...@@ -2461,8 +2461,7 @@ uint get_errcode_from_name(char *error_name, char *error_end) ...@@ -2461,8 +2461,7 @@ uint get_errcode_from_name(char *error_name, char *error_end)
if (!strncmp(error_name, e->name, (int) (error_end - error_name)) && if (!strncmp(error_name, e->name, (int) (error_end - error_name)) &&
(uint) strlen(e->name) == (uint) (error_end - error_name)) (uint) strlen(e->name) == (uint) (error_end - error_name))
{ {
return (uint) e->code; DBUG_RETURN(e->code);
break;
} }
} }
if (!e->name) if (!e->name)
...@@ -2472,7 +2471,7 @@ uint get_errcode_from_name(char *error_name, char *error_end) ...@@ -2472,7 +2471,7 @@ uint get_errcode_from_name(char *error_name, char *error_end)
LINT_INIT(error_end); LINT_INIT(error_end);
abort_not_in_this_version(); abort_not_in_this_version();
#endif #endif
return 0; DBUG_RETURN(0);;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment