1
#ifdef USE_PRAGMA_INTERFACE
2
#pragma interface /* gcc class implementation */
6
#ifndef DRIZZLED_TMP_TABLE_H
7
#define DRIZZLED_TMP_TABLE_H
13
class Natural_join_column;
15
class st_select_lex_unit;
16
class ST_SCHEMA_TABLE;
18
class TMP_TABLE_PARAM;
19
class Field_translator;
23
enum enum_schema_table_state
26
PROCESSED_BY_CREATE_SORT_INDEX,
27
PROCESSED_BY_JOIN_EXEC
34
TABLE_LIST() {} /* Remove gcc warning */
37
Prepare TABLE_LIST that consists of one table instance to use in
38
simple_open_and_lock_tables
40
inline void init_one_table(const char *db_name_arg,
41
const char *table_name_arg,
42
enum thr_lock_type lock_type_arg)
44
memset(this, 0, sizeof(*this));
45
db= (char*) db_name_arg;
46
table_name= alias= (char*) table_name_arg;
47
lock_type= lock_type_arg;
51
List of tables local to a subquery (used by SQL_LIST). Considers
52
views as leaves (unlike 'next_leaf' below). Created at parse time
53
in st_select_lex::add_table_to_list() -> table_list.link_in_list().
55
TABLE_LIST *next_local;
56
/* link in a global list of all queries tables */
57
TABLE_LIST *next_global, **prev_global;
58
char *db, *alias, *table_name, *schema_table_name;
59
char *option; /* Used by cache index */
60
Item *on_expr; /* Used with outer join */
63
(Valid only for semi-join nests) Bitmap of tables that are within the
64
semi-join (this is different from bitmap of all nest's children because
65
tables that were pulled out of the semi-join nest remain listed as
68
table_map sj_inner_tables;
69
/* Number of IN-compared expressions */
72
The structure of ON expression presented in the member above
73
can be changed during certain optimizations. This member
74
contains a snapshot of AND-OR structure of the ON expression
75
made after permanent transformations of the parse tree, and is
76
used to restore ON clause before every reexecution of a prepared
77
statement or stored procedure.
80
COND_EQUAL *cond_equal; /* Used with outer join */
82
During parsing - left operand of NATURAL/USING join where 'this' is
83
the right operand. After parsing (this->natural_join == this) iff
84
'this' represents a NATURAL or USING join operation. Thus after
85
parsing 'this' is a NATURAL/USING join iff (natural_join != NULL).
87
TABLE_LIST *natural_join;
89
True if 'this' represents a nested join that is a NATURAL JOIN.
90
For one of the operands of 'this', the member 'natural_join' points
91
to the other operand of 'this'.
94
/* Field names in a USING clause for JOIN ... USING. */
95
List<String> *join_using_fields;
97
Explicitly store the result columns of either a NATURAL/USING join or
98
an operand of such a join.
100
List<Natural_join_column> *join_columns;
101
/* true if join_columns contains all columns of this table reference. */
102
bool is_join_columns_complete;
105
List of nodes in a nested join tree, that should be considered as
106
leaves with respect to name resolution. The leaves are: views,
107
top-most nodes representing NATURAL/USING joins, subqueries, and
108
base tables. All of these TABLE_LIST instances contain a
109
materialized list of columns. The list is local to a subquery.
111
TABLE_LIST *next_name_resolution_table;
112
/* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
113
List<Index_hint> *index_hints;
114
Table *table; /* opened table */
115
uint table_id; /* table id (from binlog) for opened table */
117
select_result for derived table to pass it from table creation to table
120
select_union *derived_result;
122
Reference from aux_tables to local list entry of main select of
123
multi-delete statement:
124
delete t1 from t2,t1 where t1.a<'B' and t2.b=t1.b;
125
here it will be reference of first occurrence of t1 to second (as you
126
can see this lists can't be merged)
128
TABLE_LIST *correspondent_table;
129
st_select_lex_unit *derived; /* SELECT_LEX_UNIT of derived table */
130
ST_SCHEMA_TABLE *schema_table; /* Information_schema table */
131
st_select_lex *schema_select_lex;
133
True when the view field translation table is used to convert
134
schema table fields for backwards compatibility with SHOW command.
136
bool schema_table_reformed;
137
TMP_TABLE_PARAM *schema_table_param;
138
/* link to select_lex where this table was used */
139
st_select_lex *select_lex;
140
Field_translator *field_translation; /* array of VIEW fields */
141
/* pointer to element after last one in translation table above */
142
Field_translator *field_translation_end;
144
List (based on next_local) of underlying tables of this view. I.e. it
145
does not include the tables of subqueries used in the view. Is set only
148
TABLE_LIST *merge_underlying_list;
150
List of all base tables local to a subquery including all view
151
tables. Unlike 'next_local', this in this list views are *not*
152
leaves. Created in setup_tables() -> make_leaves_list().
154
TABLE_LIST *next_leaf;
155
thr_lock_type lock_type;
156
uint outer_join; /* Which join type */
157
uint shared; /* Used in multi-upd */
159
size_t table_name_length;
160
bool straight; /* optimize with prev table */
161
bool updating; /* for replicate-do/ignore table */
162
bool force_index; /* prefer index over table scan */
163
bool ignore_leaves; /* preload only non-leaf nodes */
164
table_map dep_tables; /* tables the table depends on */
165
table_map on_expr_dep_tables; /* tables on expression depends on */
166
struct st_nested_join *nested_join; /* if the element is a nested join */
167
TABLE_LIST *embedding; /* nested join containing the table */
168
List<TABLE_LIST> *join_list;/* join list the table belongs to */
169
bool cacheable_table; /* stop PS caching */
170
handlerton *db_type; /* table_type for handler */
171
char timestamp_buffer[20]; /* buffer for timestamp (19+1) */
173
This TABLE_LIST object corresponds to the table to be created
174
so it is possible that it does not exist (used in CREATE TABLE
175
... SELECT implementation).
178
/* For transactional locking. */
179
int lock_timeout; /* NOWAIT or WAIT [X] */
180
bool lock_transactional; /* If transactional lock requested. */
181
bool internal_tmp_table;
182
/** true if an alias for this table was specified in the SQL. */
184
/** true if the table is referred to in the statement using a fully
185
qualified name (<db_name>.<table_name>).
189
uint i_s_requested_object;
190
bool has_db_lookup_value;
191
bool has_table_lookup_value;
192
uint table_open_method;
193
enum enum_schema_table_state schema_table_state;
194
void set_underlying_merge();
195
bool setup_underlying(THD *thd);
196
void cleanup_items();
198
If you change placeholder(), please check the condition in
199
check_transactional_lock() too.
203
return derived || schema_table || (create && !table->getDBStat()) || !table;
205
void print(THD *thd, String *str, enum_query_type query_type);
206
bool set_insert_values(MEM_ROOT *mem_root);
207
TABLE_LIST *find_underlying_table(Table *table);
208
TABLE_LIST *first_leaf_for_name_resolution();
209
TABLE_LIST *last_leaf_for_name_resolution();
210
bool is_leaf_for_name_resolution();
211
inline TABLE_LIST *top_table()
215
Cleanup for re-execution in a prepared statement or a stored
218
void reinit_before_use(THD *thd);
219
Item_subselect *containing_subselect();
222
Compiles the tagged hints list and fills up st_table::keys_in_use_for_query,
223
st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by,
224
st_table::force_index and st_table::covering_keys.
226
bool process_index_hints(Table *table);
228
#endif /* DRIZZLED_TMP_TABLE_H */