119
// timestamp_buffer[20];
118
120
internal_tmp_table(false),
121
123
has_db_lookup_value(false),
122
has_table_lookup_value(false)
124
has_table_lookup_value(false),
126
// schema_table_state(0)
127
{} /* Remove gcc warning */
126
* List of tables local to a subquery (used by SQL_LIST). Considers
127
* views as leaves (unlike 'next_leaf' below). Created at parse time
128
* in Select_Lex::add_table_to_list() -> table_list.link_in_list().
130
List of tables local to a subquery (used by SQL_LIST). Considers
131
views as leaves (unlike 'next_leaf' below). Created at parse time
132
in Select_Lex::add_table_to_list() -> table_list.link_in_list().
130
134
TableList *next_local;
132
/** link in a global list of all queries tables */
136
/* link in a global list of all queries tables */
133
137
TableList *next_global;
134
138
TableList **prev_global;
139
char *option; ///< Used by cache index
140
Item *on_expr; ///< Used with outer join
141
Table *table; ///< opened table
143
* The structure of ON expression presented in the member above
144
* can be changed during certain optimizations. This member
145
* contains a snapshot of AND-OR structure of the ON expression
146
* made after permanent transformations of the parse tree, and is
147
* used to restore ON clause before every reexecution of a prepared
148
* statement or stored procedure.
151
COND_EQUAL *cond_equal; ///< Used with outer join
153
* During parsing - left operand of NATURAL/USING join where 'this' is
154
* the right operand. After parsing (this->natural_join == this) iff
155
* 'this' represents a NATURAL or USING join operation. Thus after
156
* parsing 'this' is a NATURAL/USING join iff (natural_join != NULL).
143
char *schema_table_name;
144
char *option; /* Used by cache index */
145
Item *on_expr; /* Used with outer join */
146
uint32_t table_id; /* table id (from binlog) for opened table */
147
Table *table; /* opened table */
149
The structure of ON expression presented in the member above
150
can be changed during certain optimizations. This member
151
contains a snapshot of AND-OR structure of the ON expression
152
made after permanent transformations of the parse tree, and is
153
used to restore ON clause before every reexecution of a prepared
154
statement or stored procedure.
157
COND_EQUAL *cond_equal; /* Used with outer join */
159
During parsing - left operand of NATURAL/USING join where 'this' is
160
the right operand. After parsing (this->natural_join == this) iff
161
'this' represents a NATURAL or USING join operation. Thus after
162
parsing 'this' is a NATURAL/USING join iff (natural_join != NULL).
158
164
TableList *natural_join;
160
* True if 'this' represents a nested join that is a NATURAL JOIN.
161
* For one of the operands of 'this', the member 'natural_join' points
162
* to the other operand of 'this'.
166
True if 'this' represents a nested join that is a NATURAL JOIN.
167
For one of the operands of 'this', the member 'natural_join' points
168
to the other operand of 'this'.
164
170
bool is_natural_join;
166
/** true if join_columns contains all columns of this table reference. */
172
/* true if join_columns contains all columns of this table reference. */
167
173
bool is_join_columns_complete;
169
bool straight; ///< optimize with prev table
170
bool force_index; ///< prefer index over table scan
171
bool ignore_leaves; ///< preload only non-leaf nodes
174
* This TableList object corresponds to the table to be created
175
* so it is possible that it does not exist (used in CREATE TABLE
176
* ... SELECT implementation).
180
/** Field names in a USING clause for JOIN ... USING. */
175
bool straight; /* optimize with prev table */
176
bool updating; /* for replicate-do/ignore table */
177
bool force_index; /* prefer index over table scan */
178
bool ignore_leaves; /* preload only non-leaf nodes */
181
This TableList object corresponds to the table to be created
182
so it is possible that it does not exist (used in CREATE TABLE
183
... SELECT implementation).
187
/* Field names in a USING clause for JOIN ... USING. */
181
188
List<String> *join_using_fields;
183
* Explicitly store the result columns of either a NATURAL/USING join or
184
* an operand of such a join.
190
Explicitly store the result columns of either a NATURAL/USING join or
191
an operand of such a join.
186
193
List<Natural_join_column> *join_columns;
189
* List of nodes in a nested join tree, that should be considered as
190
* leaves with respect to name resolution. The leaves are: views,
191
* top-most nodes representing NATURAL/USING joins, subqueries, and
192
* base tables. All of these TableList instances contain a
193
* materialized list of columns. The list is local to a subquery.
196
List of nodes in a nested join tree, that should be considered as
197
leaves with respect to name resolution. The leaves are: views,
198
top-most nodes representing NATURAL/USING joins, subqueries, and
199
base tables. All of these TableList instances contain a
200
materialized list of columns. The list is local to a subquery.
195
202
TableList *next_name_resolution_table;
196
/** Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
203
/* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
197
204
List<Index_hint> *index_hints;
199
* select_result for derived table to pass it from table creation to table
202
select_union *derived_result;
203
Select_Lex_Unit *derived; ///< Select_Lex_Unit of derived table */
204
Select_Lex *schema_select_lex;
205
/** link to select_lex where this table was used */
206
Select_Lex *select_lex;
208
* List of all base tables local to a subquery including all view
209
* tables. Unlike 'next_local', this in this list views are *not*
210
* leaves. Created in setup_tables() -> make_leaves_list().
212
TableList *next_leaf;
206
select_result for derived table to pass it from table creation to table
209
select_union *derived_result;
210
Select_Lex_Unit *derived; /* Select_Lex_Unit of derived table */
211
InfoSchemaTable *schema_table; /* Information_schema table */
212
Select_Lex *schema_select_lex;
213
Tmp_Table_Param *schema_table_param;
214
/* link to select_lex where this table was used */
215
Select_Lex *select_lex;
217
List of all base tables local to a subquery including all view
218
tables. Unlike 'next_local', this in this list views are *not*
219
leaves. Created in setup_tables() -> make_leaves_list().
221
TableList *next_leaf;
213
222
thr_lock_type lock_type;
214
uint32_t outer_join; ///< Which join type
215
uint32_t shared; ///<Used in multi-upd
223
uint32_t outer_join; /* Which join type */
224
uint32_t shared; /* Used in multi-upd */
216
225
uint32_t i_s_requested_object;
218
size_t table_name_length;
219
table_map dep_tables; ///< tables the table depends on
220
table_map on_expr_dep_tables; ///< tables on expression depends on
221
nested_join_st *nested_join; ///< if the element is a nested join
222
TableList *embedding; ///< nested join containing the table
223
List<TableList> *join_list; ///< join list the table belongs to
224
plugin::StorageEngine *db_type; ///< table_type for handler
225
char timestamp_buffer[20]; ///< buffer for timestamp (19+1)
226
bool internal_tmp_table;
227
size_t table_name_length;
228
table_map dep_tables; /* tables the table depends on */
229
table_map on_expr_dep_tables; /* tables on expression depends on */
230
nested_join_st *nested_join; /* if the element is a nested join */
231
TableList *embedding; /* nested join containing the table */
232
List<TableList> *join_list;/* join list the table belongs to */
233
StorageEngine *db_type; /* table_type for handler */
234
char timestamp_buffer[20]; /* buffer for timestamp (19+1) */
235
bool internal_tmp_table;
227
236
/** true if an alias for this table was specified in the SQL. */
230
* true if the table is referred to in the statement using a fully
231
* qualified name (<db_name>.<table_name>).
238
/** true if the table is referred to in the statement using a fully
239
qualified name (<db_name>.<table_name>).
235
243
bool has_db_lookup_value;
236
244
bool has_table_lookup_value;
245
uint32_t table_open_method;
246
enum enum_schema_table_state schema_table_state;
238
248
void set_underlying_merge();
239
249
bool setup_underlying(Session *session);
242
* If you change placeholder(), please check the condition in
243
* check_transactional_lock() too.
252
If you change placeholder(), please check the condition in
253
check_transactional_lock() too.
245
255
bool placeholder();
247
* Print table as it should be in join list.
249
* @param str string where table should be printed
251
256
void print(Session *session, String *str, enum_query_type query_type);
253
* Sets insert_values buffer
255
* @param[in] memory pool for allocating
260
* true - out of memory
262
bool set_insert_values(memory::Root *mem_root);
264
* Find underlying base tables (TableList) which represent given
265
* table_to_find (Table)
267
* @param[in] table to find
270
* NULL if table is not found
272
* Pointer to found table reference
257
bool set_insert_values(MEM_ROOT *mem_root);
274
258
TableList *find_underlying_table(Table *table);
276
* Retrieve the first (left-most) leaf in a nested join tree with
277
* respect to name resolution.
281
* Given that 'this' is a nested table reference, recursively walk
282
* down the left-most children of 'this' until we reach a leaf
283
* table reference with respect to name resolution.
286
* If 'this' is a nested table reference - the left-most child of
287
* the tree rooted in 'this',
290
259
TableList *first_leaf_for_name_resolution();
292
* Retrieve the last (right-most) leaf in a nested join tree with
293
* respect to name resolution.
297
* Given that 'this' is a nested table reference, recursively walk
298
* down the right-most children of 'this' until we reach a leaf
299
* table reference with respect to name resolution.
302
* If 'this' is a nested table reference - the right-most child of
303
* the tree rooted in 'this',
306
260
TableList *last_leaf_for_name_resolution();
308
* Test if this is a leaf with respect to name resolution.
312
* A table reference is a leaf with respect to name resolution if
313
* it is either a leaf node in a nested join tree (table, view,
314
* schema table, subquery), or an inner node that represents a
315
* NATURAL/USING join, or a nested join with materialized join
319
* true if a leaf, false otherwise.
321
261
bool is_leaf_for_name_resolution();
322
262
inline TableList *top_table()
326
* Return subselect that contains the FROM list this table is taken from
329
* Subselect item for the subquery that contains the FROM list
330
* this table is taken from if there is any
334
265
Item_subselect *containing_subselect();
337
* Compiles the tagged hints list and fills up st_table::keys_in_use_for_query,
338
* st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by,
339
* st_table::force_index and st_table::covering_keys.
341
* @param the Table to operate on.
345
* The parser collects the index hints for each table in a "tagged list"
346
* (TableList::index_hints). Using the information in this tagged list
347
* this function sets the members Table::keys_in_use_for_query,
348
* Table::keys_in_use_for_group_by, Table::keys_in_use_for_order_by,
349
* Table::force_index and Table::covering_keys.
351
* Current implementation of the runtime does not allow mixing FORCE INDEX
352
* and USE INDEX, so this is checked here. Then the FORCE INDEX list
353
* (if non-empty) is appended to the USE INDEX list and a flag is set.
355
* Multiple hints of the same kind are processed so that each clause
356
* is applied to what is computed in the previous clause.
359
* USE INDEX (i1) USE INDEX (i2)
362
* and means "consider only i1 and i2".
365
* USE INDEX () USE INDEX (i1)
368
* and means "consider only the index i1"
370
* It is OK to have the same index several times, e.g. "USE INDEX (i1,i1)" is
373
* Different kind of hints (USE/FORCE/IGNORE) are processed in the following
375
* 1. All indexes in USE (or FORCE) INDEX are added to the mask.
376
* 2. All IGNORE INDEX
377
* e.g. "USE INDEX i1, IGNORE INDEX i1, USE INDEX i1" will not use i1 at all
378
* as if we had "USE INDEX i1, USE INDEX i1, IGNORE INDEX i1".
379
* As an optimization if there is a covering index, and we have
380
* IGNORE INDEX FOR GROUP/order_st, and this index is used for the JOIN part,
381
* then we have to ignore the IGNORE INDEX FROM GROUP/order_st.
384
* false no errors found
386
* true found and reported an error.
268
Compiles the tagged hints list and fills up st_table::keys_in_use_for_query,
269
st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by,
270
st_table::force_index and st_table::covering_keys.
388
272
bool process_index_hints(Table *table);
390
* Creates a table definition cache key for this table entry.
392
* @param[out] Create key here (must be of size MAX_DBKEY_LENGTH)
396
* The table cache_key is created from:
400
* if the table is a tmp table, we add the following to make each tmp table
401
* unique on the slave:
403
* 4 bytes for master thread id
404
* 4 bytes pseudo thread id
409
273
uint32_t create_table_def_key(char *key);
412
276
void close_thread_tables(Session *session);
414
} /* namespace drizzled */
416
278
#endif /* DRIZZLED_TABLE_LIST_H */