26 #ifndef SQL_PRIV_INCLUDED
27 #define SQL_PRIV_INCLUDED
45 #define WARN_DEPRECATED(Thd,Old,New) \
47 if (((THD *) Thd) != NULL) \
48 push_warning_printf(((THD *) Thd), Sql_condition::WARN_LEVEL_WARN, \
49 ER_WARN_DEPRECATED_SYNTAX, \
50 ER(ER_WARN_DEPRECATED_SYNTAX), \
53 sql_print_warning("The syntax '%s' is deprecated and will be removed " \
54 "in a future release. Please use %s instead.", \
80 #define SELECT_DISTINCT (1ULL << 0) // SELECT, user
81 #define SELECT_STRAIGHT_JOIN (1ULL << 1) // SELECT, user
82 #define SELECT_DESCRIBE (1ULL << 2) // SELECT, user
83 #define SELECT_SMALL_RESULT (1ULL << 3) // SELECT, user
84 #define SELECT_BIG_RESULT (1ULL << 4) // SELECT, user
85 #define OPTION_FOUND_ROWS (1ULL << 5) // SELECT, user
86 #define OPTION_TO_QUERY_CACHE (1ULL << 6) // SELECT, user
87 #define SELECT_NO_JOIN_CACHE (1ULL << 7) // intern
89 #define OPTION_AUTOCOMMIT (1ULL << 8) // THD, user
90 #define OPTION_BIG_SELECTS (1ULL << 9) // THD, user
91 #define OPTION_LOG_OFF (1ULL << 10) // THD, user
92 #define OPTION_QUOTE_SHOW_CREATE (1ULL << 11) // THD, user, unused
93 #define TMP_TABLE_ALL_COLUMNS (1ULL << 12) // SELECT, intern
94 #define OPTION_WARNINGS (1ULL << 13) // THD, user
95 #define OPTION_AUTO_IS_NULL (1ULL << 14) // THD, user, binlog
96 #define OPTION_FOUND_COMMENT (1ULL << 15) // SELECT, intern, parser
97 #define OPTION_SAFE_UPDATES (1ULL << 16) // THD, user
98 #define OPTION_BUFFER_RESULT (1ULL << 17) // SELECT, user
99 #define OPTION_BIN_LOG (1ULL << 18) // THD, user
100 #define OPTION_NOT_AUTOCOMMIT (1ULL << 19) // THD, user
101 #define OPTION_BEGIN (1ULL << 20) // THD, intern
102 #define OPTION_TABLE_LOCK (1ULL << 21) // THD, intern
103 #define OPTION_QUICK (1ULL << 22) // SELECT (for DELETE)
107 #define SELECT_ALL (1ULL << 24) // SELECT, user, parser
110 #define OPTION_NO_FOREIGN_KEY_CHECKS (1ULL << 26) // THD, user, binlog
113 #define OPTION_RELAXED_UNIQUE_CHECKS (1ULL << 27) // THD, user, binlog
114 #define SELECT_NO_UNLOCK (1ULL << 28) // SELECT, intern
115 #define OPTION_SCHEMA_TABLE (1ULL << 29) // SELECT, intern
117 #define OPTION_SETUP_TABLES_DONE (1ULL << 30) // intern
119 #define OPTION_SQL_NOTES (1ULL << 31) // THD, user
124 #define TMP_TABLE_FORCE_MYISAM (1ULL << 32)
125 #define OPTION_PROFILING (1ULL << 33)
131 #define SELECT_HIGH_PRIORITY (1ULL << 34) // SELECT, user
141 #define OPTION_MASTER_SQL_ERROR (1ULL << 35)
148 #define OPTION_ALLOW_BATCH (ULL(1) << 36) // THD, intern (slave)
159 template <
class T> T available_buffer(
const char* buf_start,
160 const char* buf_current,
163 return buf_len - (buf_current - buf_start);
177 template <
class T>
bool valid_buffer_range(T jump,
178 const char* buf_start,
179 const char* buf_current,
182 return (jump <= available_buffer(buf_start, buf_current, buf_len));
189 #define OPTIMIZER_SWITCH_INDEX_MERGE (1ULL << 0)
190 #define OPTIMIZER_SWITCH_INDEX_MERGE_UNION (1ULL << 1)
191 #define OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION (1ULL << 2)
192 #define OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT (1ULL << 3)
193 #define OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN (1ULL << 4)
194 #define OPTIMIZER_SWITCH_INDEX_CONDITION_PUSHDOWN (1ULL << 5)
196 #define OPTIMIZER_SWITCH_MRR (1ULL << 6)
203 #define OPTIMIZER_SWITCH_MRR_COST_BASED (1ULL << 7)
204 #define OPTIMIZER_SWITCH_BNL (1ULL << 8)
205 #define OPTIMIZER_SWITCH_BKA (1ULL << 9)
206 #define OPTIMIZER_SWITCH_MATERIALIZATION (1ULL << 10)
207 #define OPTIMIZER_SWITCH_SEMIJOIN (1ULL << 11)
208 #define OPTIMIZER_SWITCH_LOOSE_SCAN (1ULL << 12)
209 #define OPTIMIZER_SWITCH_FIRSTMATCH (1ULL << 13)
210 #define OPTIMIZER_SWITCH_SUBQ_MAT_COST_BASED (1ULL << 14)
211 #define OPTIMIZER_SWITCH_USE_INDEX_EXTENSIONS (1ULL << 15)
212 #define OPTIMIZER_SWITCH_LAST (1ULL << 16)
218 #define OPTIMIZER_SWITCH_ALL 1
224 #ifdef OPTIMIZER_SWITCH_ALL
225 #define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \
226 OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \
227 OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION | \
228 OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT | \
229 OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN |\
230 OPTIMIZER_SWITCH_INDEX_CONDITION_PUSHDOWN | \
231 OPTIMIZER_SWITCH_MRR | \
232 OPTIMIZER_SWITCH_MRR_COST_BASED | \
233 OPTIMIZER_SWITCH_BNL | \
234 OPTIMIZER_SWITCH_MATERIALIZATION | \
235 OPTIMIZER_SWITCH_SEMIJOIN | \
236 OPTIMIZER_SWITCH_LOOSE_SCAN | \
237 OPTIMIZER_SWITCH_FIRSTMATCH | \
238 OPTIMIZER_SWITCH_SUBQ_MAT_COST_BASED | \
239 OPTIMIZER_SWITCH_USE_INDEX_EXTENSIONS)
241 #define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \
242 OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \
243 OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION | \
244 OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT | \
245 OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN |\
246 OPTIMIZER_SWITCH_INDEX_CONDITION_PUSHDOWN | \
247 OPTIMIZER_SWITCH_MRR | \
248 OPTIMIZER_SWITCH_MRR_COST_BASED | \
249 OPTIMIZER_SWITCH_BNL | \
250 OPTIMIZER_SWITCH_USE_INDEX_EXTENSIONS)
276 #define CONTEXT_ANALYSIS_ONLY_PREPARE 1
284 #define CONTEXT_ANALYSIS_ONLY_VIEW 2
289 #define CONTEXT_ANALYSIS_ONLY_DERIVED 4
292 #define UNCACHEABLE_DEPENDENT 1
293 #define UNCACHEABLE_RAND 2
294 #define UNCACHEABLE_SIDEEFFECT 4
296 #define UNCACHEABLE_EXPLAIN 8
298 #define UNCACHEABLE_UNITED 16
299 #define UNCACHEABLE_CHECKOPTION 32
304 #define IS_EQUAL_NO 0
305 #define IS_EQUAL_YES 1
306 #define IS_EQUAL_PACK_LENGTH 2
308 enum enum_parsing_place
320 OPT_DEFAULT= 0, OPT_SESSION, OPT_GLOBAL
325 enum enum_yes_no_unknown
327 TVL_YES, TVL_NO, TVL_UNKNOWN
341 extern void turn_parser_debug_on();
349 inline int hexchar_to_int(
char c)
351 if (c <= '9' && c >=
'0')
354 if (c <= 'f' && c >=
'a')
360 #define ER_NOT_RW_DIR_PATHSIZE 200
362 #define IS_TABLESPACES_TABLESPACE_NAME 0
363 #define IS_TABLESPACES_ENGINE 1
364 #define IS_TABLESPACES_TABLESPACE_TYPE 2
365 #define IS_TABLESPACES_LOGFILE_GROUP_NAME 3
366 #define IS_TABLESPACES_EXTENT_SIZE 4
367 #define IS_TABLESPACES_AUTOEXTEND_SIZE 5
368 #define IS_TABLESPACES_MAXIMUM_SIZE 6
369 #define IS_TABLESPACES_NODEGROUP_ID 7
370 #define IS_TABLESPACES_TABLESPACE_COMMENT 8