diff options
author | Monty <monty@mariadb.org> | 2016-04-05 16:52:40 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2016-04-05 18:00:03 +0300 |
commit | d0b178fb45898486979a504de30ac186f734bb26 (patch) | |
tree | 7a78d5c3ecc02319615042a598a7530099cb217b /sql/unireg.h | |
parent | 38f39a9288dc826ac16ac81a67a4e3174451825d (diff) | |
download | mariadb-git-d0b178fb45898486979a504de30ac186f734bb26.tar.gz |
Added new range of MariaDB error messages, starting from 3000
This is done by splitting variables.errmsg and locale.errmsg to
variables.errmsg_extra and locale.errmsg_extra
The ER() macros in unireg.h now looks more complex than before, but this
isn't critical as most usage of them are with constants and the compiler
will remove most of the test code.
Diffstat (limited to 'sql/unireg.h')
-rw-r--r-- | sql/unireg.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sql/unireg.h b/sql/unireg.h index 10751b6ec93..251597c1884 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -43,15 +43,16 @@ #define PLUGINDIR "lib/plugin" #endif -#define CURRENT_THD_ERRMSGS current_thd->variables.errmsgs -#define DEFAULT_ERRMSGS my_default_lc_messages->errmsgs->errmsgs - -#define ER(X) CURRENT_THD_ERRMSGS[(X) - ER_ERROR_FIRST] -#define ER_DEFAULT(X) DEFAULT_ERRMSGS[(X) - ER_ERROR_FIRST] -#define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : "Invalid error code") -#define ER_SAFE_THD(T,X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER_THD(T,X) : "Invalid error code") -#define ER_THD(thd,X) ((thd)->variables.errmsgs[(X) - ER_ERROR_FIRST]) -#define ER_THD_OR_DEFAULT(thd,X) ((thd) ? ER_THD(thd, X) : ER_DEFAULT(X)) +#define MAX_ERROR_RANGES 4 /* 1000-2000, 2000-3000, 3000-4000, 4000-5000 */ +#define ERRORS_PER_RANGE 1000 + +#define DEFAULT_ERRMSGS my_default_lc_messages->errmsgs->errmsgs +#define CURRENT_THD_ERRMSGS (current_thd)->variables.errmsgs + +#define ER_DEFAULT(X) DEFAULT_ERRMSGS[((X)-ER_ERROR_FIRST) / ERRORS_PER_RANGE][(X)% ERRORS_PER_RANGE] +#define ER_THD(thd,X) ((thd)->variables.errmsgs[((X)-ER_ERROR_FIRST) / ERRORS_PER_RANGE][(X) % ERRORS_PER_RANGE]) +#define ER(X) ER_THD(current_thd, (X)) +#define ER_THD_OR_DEFAULT(thd,X) ((thd) ? ER_THD(thd, (X)) : ER_DEFAULT(X)) #define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH) #define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH) |