summaryrefslogtreecommitdiff
path: root/client/mysqltest.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2013-11-08 20:59:08 +0400
committerAlexander Barkov <bar@mnogosearch.org>2013-11-08 20:59:08 +0400
commite02ad98c63506c3260ac3a365e72886d7d02304a (patch)
tree88ff7149921c8f4e47d5a628bfdc8f4241ad8c06 /client/mysqltest.cc
parent7876d53b5f17e2c906f41d97e22514c1e36640bb (diff)
parentd79d0c4045f5b93ded001ca6b963727b3362cd15 (diff)
downloadmariadb-git-e02ad98c63506c3260ac3a365e72886d7d02304a.tar.gz
Merge 5.5 -> 10.0-base
Diffstat (limited to 'client/mysqltest.cc')
-rw-r--r--client/mysqltest.cc48
1 files changed, 37 insertions, 11 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 347a2e4f736..6e3c8d1eab3 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -5180,11 +5180,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 +5208,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)
+
+uint get_errcode_from_name(const char *error_name, const char *error_end)
{
- st_error *e= global_error_names;
+ 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 +5243,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 +5339,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 +5348,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
{