summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorunknown <magnus@neptunus.(none)>2004-05-13 11:56:45 +0200
committerunknown <magnus@neptunus.(none)>2004-05-13 11:56:45 +0200
commitd4399619bde4b03b433f312a7a220b4b9d543bf5 (patch)
treece8310eb64adcdac83e99a34e4fc79bee0fbe200 /sql/handler.cc
parent3cf87a5b5703a0fbc3566b7f0e530e6fb1523f47 (diff)
downloadmariadb-git-d4399619bde4b03b433f312a7a220b4b9d543bf5.tar.gz
WL #1729 Handler: error text for NDB errors
- New solution after discussions with Sergei, no handler specific code or error messages should be in sql layer. next_result, only check for error if check is -1 Improved index_read include/mysqld_error.h: New error codes ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG, update number to 298. Removed prevoius ER_NDB_ERROR, handler specific error should not be here. sql/ha_ndbcluster.cc: Removed print_error from ha_ndbcluster, added code to handler::print_error to ask handler::get_error_message for message for an error. Fix bug in next_result, only check for error if -1 is returned. Make index_read easier, special case where pk_read or unique_index_read is detected and as default do ordered_index_scan sql/ha_ndbcluster.h: Remplace print_error with get_error_message sql/handler.cc: Add new function get_error_message usedc to ask handler for a message for an error. Call get_error_message from print_error if error code is not known. sql/handler.h: Add new function get_error_message sql/share/czech/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/danish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/dutch/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/english/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/estonian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/french/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/german/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/greek/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/hungarian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/italian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/korean/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/norwegian-ny/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/norwegian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/polish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/portuguese/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/romanian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/russian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/serbian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/slovak/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/spanish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/swedish/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG sql/share/ukrainian/errmsg.txt: Error message for ER_GET_ERRMSG and ER_GET_TEMPORARY_ERRMSG
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc31
1 files changed, 30 insertions, 1 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 7374242ebf8..615e2515824 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1120,7 +1120,20 @@ void handler::print_error(int error, myf errflag)
break;
default:
{
- my_error(ER_GET_ERRNO,errflag,error);
+ /* The error was "unknown" to this function.
+ Ask handler if it has got a message for this error */
+ bool temporary= FALSE;
+ const char* msg= get_error_message(&error, &temporary);
+ if (msg)
+ {
+ const char* engine= ha_get_storage_engine(table->db_type);
+ if (temporary)
+ my_error(ER_GET_TEMPORARY_ERRMSG,error,msg,engine);
+ else
+ my_error(ER_GET_ERRMSG,error,msg,engine);
+ }
+ else
+ my_error(ER_GET_ERRNO,errflag,error);
DBUG_VOID_RETURN;
}
}
@@ -1129,6 +1142,22 @@ void handler::print_error(int error, myf errflag)
}
+/*
+ Return an error message specific to this handler
+
+ SYNOPSIS
+ error [in/out] error code previously returned by handler
+ temporary [out] temporary error, transaction should be retried if true
+
+ The returned pointer to error message should not be freed.
+ */
+
+const char* handler::get_error_message(int *error, bool *temporary)
+{
+ return NULL;
+}
+
+
/* Return key if error because of duplicated keys */
uint handler::get_dup_key(int error)