1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

merge 10-base->10.0

This commit is contained in:
unknown
2013-11-11 23:40:53 +02:00
50 changed files with 617 additions and 108 deletions

View File

@@ -3041,6 +3041,10 @@ void open_file(const char *name)
5.try in basedir
*/
#ifdef __WIN__
fix_win_paths(curname, sizeof(curname));
#endif
bool in_overlay= opt_overlay_dir &&
!strncmp(curname, opt_overlay_dir, overlay_dir_len);
bool in_suiteir= opt_overlay_dir && !in_overlay &&
@@ -5180,11 +5184,17 @@ static st_error global_error_names[] =
{ 0, 0, 0 }
};
uint get_errcode_from_name(char *error_name, char *error_end)
#include <my_base.h>
static st_error handler_error_names[] =
{
/* SQL error as string */
st_error *e= global_error_names;
{ "<No error>", -1U, "" },
#include <handler_ername.h>
{ 0, 0, 0 }
};
uint get_errcode_from_name(const char *error_name, const char *error_end,
st_error *e)
{
DBUG_ENTER("get_errcode_from_name");
DBUG_PRINT("enter", ("error_name: %s", error_name));
@@ -5202,15 +5212,26 @@ uint get_errcode_from_name(char *error_name, char *error_end)
DBUG_RETURN(e->code);
}
}
if (!e->name)
die("Unknown SQL error name '%s'", error_name);
DBUG_RETURN(0);
}
const char *get_errname_from_code (uint error_code)
{
st_error *e= global_error_names;
uint get_errcode_from_name(const char *error_name, const char *error_end)
{
uint tmp;
if ((tmp= get_errcode_from_name(error_name, error_end,
global_error_names)))
return tmp;
if ((tmp= get_errcode_from_name(error_name, error_end,
handler_error_names)))
return tmp;
die("Unknown SQL error name '%s'", error_name);
}
const char *unknown_error= "<Unknown>";
const char *get_errname_from_code (uint error_code, st_error *e)
{
DBUG_ENTER("get_errname_from_code");
DBUG_PRINT("enter", ("error_code: %d", error_code));
@@ -5226,9 +5247,18 @@ const char *get_errname_from_code (uint error_code)
}
}
/* Apparently, errors without known names may occur */
DBUG_RETURN("<Unknown>");
DBUG_RETURN(unknown_error);
}
const char *get_errname_from_code(uint error_code)
{
const char *name;
if ((name= get_errname_from_code(error_code, global_error_names)) !=
unknown_error)
return name;
return get_errname_from_code(error_code, handler_error_names);
}
void do_get_errcodes(struct st_command *command)
{
struct st_match_err *to= saved_expected_errors.err;
@@ -5313,7 +5343,7 @@ void do_get_errcodes(struct st_command *command)
{
die("The sqlstate definition must start with an uppercase S");
}
else if (*p == 'E' || *p == 'W')
else if (*p == 'E' || *p == 'W' || *p == 'H')
{
/* Error name string */
@@ -5322,9 +5352,9 @@ void do_get_errcodes(struct st_command *command)
to->type= ERR_ERRNO;
DBUG_PRINT("info", ("ERR_ERRNO: %d", to->code.errnum));
}
else if (*p == 'e' || *p == 'w')
else if (*p == 'e' || *p == 'w' || *p == 'h')
{
die("The error name definition must start with an uppercase E or W");
die("The error name definition must start with an uppercase E or W or H");
}
else
{