MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
unireg.h
1 #ifndef UNIREG_INCLUDED
2 #define UNIREG_INCLUDED
3 
4 /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; version 2 of the License.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software Foundation,
17  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
18 
19 
20 #include "my_global.h" /* ulonglong */
21 #include "mysql_version.h" /* FRM_VER */
22 
23 /* Extra functions used by unireg library */
24 
26 
27 #ifndef NO_ALARM_LOOP
28 #define NO_ALARM_LOOP /* lib5 and popen can't use alarm */
29 #endif
30 
31 /* These paths are converted to other systems (WIN95) before use */
32 
33 #define LANGUAGE "english/"
34 #define ERRMSG_FILE "errmsg.sys"
35 #define TEMP_PREFIX "MY"
36 #define LOG_PREFIX "ML"
37 #define PROGDIR "bin/"
38 #ifndef MYSQL_DATADIR
39 #define MYSQL_DATADIR "data/"
40 #endif
41 #ifndef SHAREDIR
42 #define SHAREDIR "share/"
43 #endif
44 #ifndef PLUGINDIR
45 #define PLUGINDIR "lib/plugin"
46 #endif
47 
48 #define CURRENT_THD_ERRMSGS current_thd->variables.lc_messages->errmsgs->errmsgs
49 #define DEFAULT_ERRMSGS my_default_lc_messages->errmsgs->errmsgs
50 
51 #define ER(X) CURRENT_THD_ERRMSGS[(X) - ER_ERROR_FIRST]
52 #define ER_DEFAULT(X) DEFAULT_ERRMSGS[(X) - ER_ERROR_FIRST]
53 #define ER_SAFE(X) (((X) >= ER_ERROR_FIRST && (X) <= ER_ERROR_LAST) ? ER(X) : "Invalid error code")
54 #define ER_THD(thd,X) ((thd)->variables.lc_messages->errmsgs->errmsgs[(X) - \
55  ER_ERROR_FIRST])
56 #define ER_THD_OR_DEFAULT(thd,X) ((thd) ? ER_THD(thd, X) : ER_DEFAULT(X))
57 
58 
59 #define ME_INFO (ME_HOLDTANG+ME_OLDWIN+ME_NOREFRESH)
60 #define ME_ERROR (ME_BELL+ME_OLDWIN+ME_NOREFRESH)
61 #define MYF_RW MYF(MY_WME+MY_NABP) /* Vid my_read & my_write */
62 
63 #define SPECIAL_USE_LOCKS 1 /* Lock used databases */
64 #define SPECIAL_NO_NEW_FUNC 2 /* Skip new functions */
65 #define SPECIAL_SKIP_SHOW_DB 4 /* Don't allow 'show db' */
66 #define SPECIAL_WAIT_IF_LOCKED 8 /* Wait if locked database */
67 #define SPECIAL_SAME_DB_NAME 16 /* form name = file name */
68 #define SPECIAL_ENGLISH 32 /* English error messages */
69 #define SPECIAL_NO_RESOLVE 64 /* Don't use gethostname */
70 #define SPECIAL_NO_PRIOR 128 /* Obsolete */
71 #define SPECIAL_BIG_SELECTS 256 /* Don't use heap tables */
72 #define SPECIAL_NO_HOST_CACHE 512 /* Don't cache hosts */
73 #define SPECIAL_SHORT_LOG_FORMAT 1024
74 /* 2048 is no longer used */
75 #define SPECIAL_LOG_QUERIES_NOT_USING_INDEXES 4096 /* Obsolete */
76 
77  /* Extern defines */
78 #define store_record(A,B) memcpy((A)->B,(A)->record[0],(size_t) (A)->s->reclength)
79 #define restore_record(A,B) memcpy((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
80 #define cmp_record(A,B) memcmp((A)->record[0],(A)->B,(size_t) (A)->s->reclength)
81 #define empty_record(A) { \
82  restore_record((A),s->default_values); \
83  memset((A)->null_flags, 255, (A)->s->null_bytes);\
84  }
85 
86  /* Defines for use with openfrm, openprt and openfrd */
87 
88 #define READ_ALL 1 /* openfrm: Read all parameters */
89 #define CHANGE_FRM 2 /* openfrm: open .frm as O_RDWR */
90 #define READ_KEYINFO 4 /* L{s nyckeldata fr}n filen */
91 #define EXTRA_RECORD 8 /* Reservera plats f|r extra record */
92 #define DONT_OPEN_TABLES 8 /* Don't open database-files (frd) */
93 #define DONT_OPEN_MASTER_REG 16 /* Don't open first reg-file (prt) */
94 #define EXTRA_LONG_RECORD 16 /* Plats f|r dubbel s|k-record */
95 #define COMPUTE_TYPES 32 /* Kontrollera type f|r f{ltena */
96 #define SEARCH_PRG 64 /* S|k efter registret i 'prg_dev' */
97 #define READ_USED_NAMES 128 /* L{s anv{nda formul{rnamn */
98 #define DONT_GIVE_ERROR 256 /* Don't do frm_error on openfrm */
99 #define READ_SCREENS 1024 /* Read screens, info and helpfile */
100 #define DELAYED_OPEN 4096 /* Open table later */
101 #define OPEN_VIEW 8192 /* Allow open on view */
102 #define OPEN_VIEW_NO_PARSE 16384 /* Open frm only if it's a view,
103  but do not parse view itself */
104 
109 #define OPEN_FRM_FILE_ONLY 32768
110 
116 #define OPEN_TABLE_ONLY OPEN_FRM_FILE_ONLY*2
117 
123 #define OPEN_VIEW_ONLY OPEN_TABLE_ONLY*2
124 
130 #define OPEN_VIEW_FULL OPEN_VIEW_ONLY*2
131 
136 #define OPTIMIZE_I_S_TABLE OPEN_VIEW_FULL*2
137 
140 #define OPEN_TRIGGER_ONLY OPTIMIZE_I_S_TABLE*2
141 
144 #define CHECK_METADATA_VERSION OPEN_TRIGGER_ONLY*2
145 
146 #define SC_INFO_LENGTH 4 /* Form format constant */
147 #define TE_INFO_LENGTH 3
148 #define MTYP_NOEMPTY_BIT 128
149 
150 /*
151  Minimum length pattern before Turbo Boyer-Moore is used
152  for SELECT "text" LIKE "%pattern%", excluding the two
153  wildcards in class Item_func_like.
154 */
155 #define MIN_TURBOBM_PATTERN_LEN 3
156 
157 /*
158  Defines for binary logging.
159  Do not decrease the value of BIN_LOG_HEADER_SIZE.
160  Do not even increase it before checking code.
161 */
162 
163 #define BIN_LOG_HEADER_SIZE 4
164 
165 #define DEFAULT_KEY_CACHE_NAME "default"
166 
167 /* Include prototypes for unireg */
168 
169 #include "mysqld_error.h"
170 #include "structs.h" /* All structs we need */
171 #include "sql_list.h" /* List<> */
172 #include "field.h" /* Create_field */
173 
174 bool mysql_create_frm(THD *thd, const char *file_name,
175  const char *db, const char *table,
176  HA_CREATE_INFO *create_info,
177  List<Create_field> &create_field,
178  uint key_count,KEY *key_info,handler *db_type);
179 int rea_create_table(THD *thd, const char *path,
180  const char *db, const char *table_name,
181  HA_CREATE_INFO *create_info,
182  List<Create_field> &create_field,
183  uint key_count,KEY *key_info,
184  handler *file,
185  bool no_ha_table);
186 #endif