summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2013-11-05 20:30:36 +0200
committerMichael Widenius <monty@askmonty.org>2013-11-05 20:30:36 +0200
commit6cc9f4ac5c1530087ae1b808ab0fdcc58b308b54 (patch)
tree249760e31ed7b75bf4353bcc3543a97ce8afa0aa /client
parentafa49d7919554995726bf710d8a36cb6f4357777 (diff)
downloadmariadb-git-6cc9f4ac5c1530087ae1b808ab0fdcc58b308b54.tar.gz
Added usage of handler error names to mysqltest
include/CMakeLists.txt: Added handler_ername.h include/handler_ername.h: Names of handler error messages mysql-test/extra/binlog_tests/binlog.test: Test using handler error names mysql-test/r/mysqltest.result: Update for new error message mysql-test/t/auto_increment.test: Test using handler error names mysql-test/t/auto_increment_ranges.inc: Test using handler error names mysql-test/t/replace.test: Test using handler error names
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.cc48
1 files changed, 37 insertions, 11 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 3602ae96937..4bb4495631b 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -5161,11 +5161,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));
@@ -5183,15 +5189,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));
@@ -5207,9 +5224,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;
@@ -5294,7 +5320,7 @@ void do_get_errcodes(struct st_command *command)
{
die("The sqlstate definition must start with an uppercase S");
}
- else if (*p == 'E')
+ else if (*p == 'E' || *p == 'H')
{
/* Error name string */
@@ -5303,9 +5329,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')
+ else if (*p == 'e' || *p == 'h')
{
- die("The error name definition must start with an uppercase E");
+ die("The error name definition must start with an uppercase E or H");
}
else
{