summaryrefslogtreecommitdiff
path: root/sql/unireg.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/unireg.h')
-rw-r--r--sql/unireg.h58
1 files changed, 22 insertions, 36 deletions
diff --git a/sql/unireg.h b/sql/unireg.h
index e1947d8d3cd..b0cfb3841ef 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 MAX_ERROR_RANGES 4 /* 1000-2000, 2000-3000, 3000-4000, 4000-5000 */
+#define ERRORS_PER_RANGE 1000
-#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 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_NOREFRESH)
#define ME_ERROR (ME_BELL | ME_NOREFRESH)
@@ -82,68 +83,53 @@
/* Defines for use with openfrm, openprt and openfrd */
-#define READ_ALL 1 /* openfrm: Read all parameters */
-#define CHANGE_FRM 2 /* openfrm: open .frm as O_RDWR */
-#define READ_KEYINFO 4 /* L{s nyckeldata fr}n filen */
-#define EXTRA_RECORD 8 /* Reserve space for an extra record */
-#define DONT_OPEN_TABLES 8 /* Don't open database-files (frd) */
-#define DONT_OPEN_MASTER_REG 16 /* Don't open first reg-file (prt) */
-#define EXTRA_LONG_RECORD 16 /* Plats f|r dubbel s|k-record */
-#define COMPUTE_TYPES 32 /* Kontrollera type f|r f{ltena */
-#define SEARCH_PRG 64 /* S|k efter registret i 'prg_dev' */
-#define READ_USED_NAMES 128 /* L{s anv{nda formul{rnamn */
-#define DONT_GIVE_ERROR 256 /* Don't do frm_error on openfrm */
-#define READ_SCREENS 1024 /* Read screens, info and helpfile */
-#define DELAYED_OPEN 4096 /* Open table later */
-#define OPEN_VIEW 8192 /* Allow open on view */
-#define OPEN_VIEW_NO_PARSE 16384 /* Open frm only if it's a view,
- but do not parse view itself */
+#define READ_ALL (1 << 0) /* openfrm: Read all parameters */
+#define EXTRA_RECORD (1 << 3) /* Reserve space for an extra record */
+#define DELAYED_OPEN (1 << 12) /* Open table later */
+#define OPEN_VIEW_NO_PARSE (1 << 14) /* Open frm only if it's a view,
+ but do not parse view itself */
/**
This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine
The flag means that we need to open FRM file only to get necessary data.
*/
-#define OPEN_FRM_FILE_ONLY 32768
+#define OPEN_FRM_FILE_ONLY (1 << 15)
/**
This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine
The flag means that we need to process tables only to get necessary data.
Views are not processed.
*/
-#define OPEN_TABLE_ONLY (OPEN_FRM_FILE_ONLY*2)
+#define OPEN_TABLE_ONLY (1 << 16)
/**
This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine
The flag means that we need to process views only to get necessary data.
Tables are not processed.
*/
-#define OPEN_VIEW_ONLY (OPEN_TABLE_ONLY*2)
+#define OPEN_VIEW_ONLY (1 << 17)
/**
This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine.
The flag means that we need to open a view using
open_normal_and_derived_tables() function.
*/
-#define OPEN_VIEW_FULL (OPEN_VIEW_ONLY*2)
+#define OPEN_VIEW_FULL (1 << 18)
/**
This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine.
The flag means that I_S table uses optimization algorithm.
*/
-#define OPTIMIZE_I_S_TABLE (OPEN_VIEW_FULL*2)
+#define OPTIMIZE_I_S_TABLE (1 << 19)
/**
This flag is used to instruct tdc_open_view() to check metadata version.
*/
-#define CHECK_METADATA_VERSION (OPEN_TRIGGER_ONLY*2)
+#define CHECK_METADATA_VERSION (1 << 20)
/*
The flag means that we need to process trigger files only.
*/
-#define OPEN_TRIGGER_ONLY (OPTIMIZE_I_S_TABLE*2)
-
-#define SC_INFO_LENGTH 4 /* Form format constant */
-#define TE_INFO_LENGTH 3
-#define MTYP_NOEMPTY_BIT 128
+#define OPEN_TRIGGER_ONLY (1 << 21)
/*
Minimum length pattern before Turbo Boyer-Moore is used
@@ -210,7 +196,7 @@ static inline bool is_binary_frm_header(uchar *head)
return head[0] == 254
&& head[1] == 1
&& head[2] >= FRM_VER
- && head[2] <= FRM_VER+4;
+ && head[2] <= FRM_VER_CURRENT;
}
#endif