~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_list.h

  • Committer: Padraig O'Sullivan
  • Date: 2009-08-07 14:14:58 UTC
  • mfrom: (1112 staging)
  • mto: (1115.3.4 captain)
  • mto: This revision was merged to the branch mainline in revision 1117.
  • Revision ID: osullivan.padraig@gmail.com-20090807141458-qrc3don58s304ore
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
 
21
 
21
22
#ifndef DRIZZLED_TABLE_LIST_H
22
23
#define DRIZZLED_TABLE_LIST_H
23
24
 
24
 
#include <drizzled/nested_join.h>
 
25
/*
 
26
  Table reference in the FROM clause.
 
27
 
 
28
  These table references can be of several types that correspond to
 
29
  different SQL elements. Below we list all types of TableLists with
 
30
  the necessary conditions to determine when a TableList instance
 
31
  belongs to a certain type.
 
32
 
 
33
  1) table (TableList::view == NULL)
 
34
     - base table
 
35
       (TableList::derived == NULL)
 
36
     - subquery - TableList::table is a temp table
 
37
       (TableList::derived != NULL)
 
38
     - information schema table
 
39
       (TableList::schema_table != NULL)
 
40
       NOTICE: for schema tables TableList::field_translation may be != NULL
 
41
  2) Was VIEW 
 
42
  3) nested table reference (TableList::nested_join != NULL)
 
43
     - table sequence - e.g. (t1, t2, t3)
 
44
       TODO: how to distinguish from a JOIN?
 
45
     - general JOIN
 
46
       TODO: how to distinguish from a table sequence?
 
47
     - NATURAL JOIN
 
48
       (TableList::natural_join != NULL)
 
49
       - JOIN ... USING
 
50
         (TableList::join_using_fields != NULL)
 
51
     - semi-join
 
52
       ;
 
53
*/
 
54
 
 
55
 
25
56
#include <drizzled/table.h>
26
57
 
27
 
namespace drizzled
28
 
{
29
 
 
30
58
class Index_hint;
31
59
class COND_EQUAL;
32
60
class Natural_join_column;
33
61
class select_union;
34
62
class Select_Lex_Unit;
 
63
class InfoSchemaTable;
35
64
class Select_Lex;
36
65
class Tmp_Table_Param;
37
66
class Item_subselect;
38
67
class Table;
39
68
 
40
 
namespace plugin
41
 
{
42
 
  class StorageEngine;
43
 
}
 
69
struct nested_join_st;
44
70
 
45
 
/**
46
 
 * A Table referenced in the FROM clause.
47
 
 *
48
 
 * These table references can be of several types that correspond to
49
 
 * different SQL elements. Below we list all types of TableLists with
50
 
 * the necessary conditions to determine when a TableList instance
51
 
 * belongs to a certain type.
52
 
 *
53
 
 * 1) table (TableList::view == NULL)
54
 
 *    - base table
55
 
 *    (TableList::derived == NULL)
56
 
 *    - subquery - TableList::table is a temp table
57
 
 *    (TableList::derived != NULL)
58
 
 *    
59
 
 *    @note
60
 
 *
61
 
 *    for schema tables TableList::field_translation may be != NULL
62
 
 *
63
 
 * 2) Was VIEW 
64
 
 * 3) nested table reference (TableList::nested_join != NULL)
65
 
 *     - table sequence - e.g. (t1, t2, t3)
66
 
 *     @todo how to distinguish from a JOIN?
67
 
 *     - general JOIN
68
 
 *     @todo how to distinguish from a table sequence?
69
 
 *     - NATURAL JOIN
70
 
 *     (TableList::natural_join != NULL)
71
 
 *     - JOIN ... USING
72
 
 *     (TableList::join_using_fields != NULL)
73
 
 *     - semi-join
74
 
 */
75
71
class TableList
76
72
{
77
73
public:
82
78
    db(NULL),
83
79
    alias(NULL),
84
80
    table_name(NULL),
 
81
    schema_table_name(NULL),
85
82
    option(NULL),
86
83
    on_expr(NULL),
 
84
    table_id(0),
87
85
    table(NULL),
88
86
    prep_on_expr(NULL),
89
87
    cond_equal(NULL),
91
89
    is_natural_join(false),
92
90
    is_join_columns_complete(false),
93
91
    straight(false),
 
92
    updating(false), 
94
93
    force_index(false),
95
94
    ignore_leaves(false),
 
95
    create(false),
96
96
    join_using_fields(NULL),
97
97
    join_columns(NULL),
98
98
    next_name_resolution_table(NULL),
99
99
    index_hints(NULL),
100
100
    derived_result(NULL),
101
101
    derived(NULL),
 
102
    schema_table(NULL),
102
103
    schema_select_lex(NULL),
 
104
    schema_table_param(NULL),
103
105
    select_lex(NULL),
104
106
    next_leaf(NULL),
 
107
    // lock_type
105
108
    outer_join(0),
 
109
    shared(0),  
 
110
    i_s_requested_object(0),
106
111
    db_length(0),
107
112
    table_name_length(0),
108
113
    dep_tables(0),
111
116
    embedding(NULL),
112
117
    join_list(NULL),
113
118
    db_type(NULL),
 
119
    // timestamp_buffer[20];
114
120
    internal_tmp_table(false),
115
121
    is_alias(false),
116
122
    is_fqtn(false),
117
 
    create(false)
118
 
  {}
 
123
    has_db_lookup_value(false),
 
124
    has_table_lookup_value(false),
 
125
    table_open_method(0)
 
126
    // schema_table_state(0)
 
127
    {}                          /* Remove gcc warning */
119
128
 
120
 
  /**
121
 
   * List of tables local to a subquery (used by SQL_LIST). Considers
122
 
   * views as leaves (unlike 'next_leaf' below). Created at parse time
123
 
   * in Select_Lex::add_table_to_list() -> table_list.link_in_list().
124
 
   */
 
129
  /*
 
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().
 
133
  */
125
134
  TableList *next_local;
126
135
 
127
 
  /** link in a global list of all queries tables */
 
136
  /* link in a global list of all queries tables */
128
137
  TableList *next_global; 
129
138
  TableList **prev_global;
130
139
 
131
 
private:
132
 
  char *db;
133
 
 
134
 
public:
135
 
  const char *getSchemaName()
136
 
  {
137
 
    return db;
138
 
  }
139
 
 
140
 
  char **getSchemaNamePtr()
141
 
  {
142
 
    return &db;
143
 
  }
144
 
 
145
 
  void setSchemaName(char *arg)
146
 
  {
147
 
    db= arg;
148
 
  }
149
 
 
150
 
  const char *alias;
151
 
 
152
 
private:
153
 
  char *table_name;
154
 
 
155
 
public:
156
 
  const char *getTableName()
157
 
  {
158
 
    return table_name;
159
 
  }
160
 
 
161
 
  char **getTableNamePtr()
162
 
  {
163
 
    return &table_name;
164
 
  }
165
 
 
166
 
  void setTableName(char *arg)
167
 
  {
168
 
    table_name= arg;
169
 
  }
170
 
 
171
 
  char *option; ///< Used by cache index
172
 
  Item *on_expr; ///< Used with outer join
173
 
  Table *table; ///< opened table
174
 
  /**
175
 
   * The structure of ON expression presented in the member above
176
 
   * can be changed during certain optimizations. This member
177
 
   * contains a snapshot of AND-OR structure of the ON expression
178
 
   * made after permanent transformations of the parse tree, and is
179
 
   * used to restore ON clause before every reexecution of a prepared
180
 
   * statement or stored procedure.
181
 
   */
182
 
  Item *prep_on_expr;
183
 
  COND_EQUAL *cond_equal; ///< Used with outer join
184
 
  /**
185
 
   * During parsing - left operand of NATURAL/USING join where 'this' is
186
 
   * the right operand. After parsing (this->natural_join == this) iff
187
 
   * 'this' represents a NATURAL or USING join operation. Thus after
188
 
   * parsing 'this' is a NATURAL/USING join iff (natural_join != NULL).
189
 
   */
 
140
  char          *db;
 
141
  const char            *alias;
 
142
  char          *table_name;
 
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 */
 
148
  /*
 
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.
 
155
  */
 
156
  Item          *prep_on_expr;
 
157
  COND_EQUAL    *cond_equal;            /* Used with outer join */
 
158
  /*
 
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).
 
163
  */
190
164
  TableList *natural_join;
191
 
  /**
192
 
   * True if 'this' represents a nested join that is a NATURAL JOIN.
193
 
   * For one of the operands of 'this', the member 'natural_join' points
194
 
   * to the other operand of 'this'.
195
 
   */
 
165
  /*
 
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'.
 
169
  */
196
170
  bool is_natural_join;
197
171
 
198
 
  /** true if join_columns contains all columns of this table reference. */
 
172
  /* true if join_columns contains all columns of this table reference. */
199
173
  bool is_join_columns_complete;
200
174
 
201
 
  bool straight; ///< optimize with prev table
202
 
  bool force_index; ///< prefer index over table scan
203
 
  bool ignore_leaves; ///< preload only non-leaf nodes
 
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 */
204
179
 
205
180
  /*
206
 
    is the table a cartesian join, assumption is yes unless "solved"
 
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).
207
184
  */
208
 
  bool isCartesian() const;
 
185
  bool          create;
209
186
 
210
 
  /** Field names in a USING clause for JOIN ... USING. */
 
187
  /* Field names in a USING clause for JOIN ... USING. */
211
188
  List<String> *join_using_fields;
212
 
  /**
213
 
   * Explicitly store the result columns of either a NATURAL/USING join or
214
 
   * an operand of such a join.
215
 
   */
 
189
  /*
 
190
    Explicitly store the result columns of either a NATURAL/USING join or
 
191
    an operand of such a join.
 
192
  */
216
193
  List<Natural_join_column> *join_columns;
217
194
 
218
 
  /**
219
 
   * List of nodes in a nested join tree, that should be considered as
220
 
   * leaves with respect to name resolution. The leaves are: views,
221
 
   * top-most nodes representing NATURAL/USING joins, subqueries, and
222
 
   * base tables. All of these TableList instances contain a
223
 
   * materialized list of columns. The list is local to a subquery.
224
 
   */
 
195
  /*
 
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.
 
201
  */
225
202
  TableList *next_name_resolution_table;
226
 
  /** Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
 
203
  /* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
227
204
  List<Index_hint> *index_hints;
228
 
  /**
229
 
   * select_result for derived table to pass it from table creation to table
230
 
   * filling procedure
231
 
   */
232
 
  select_union *derived_result;
233
 
  Select_Lex_Unit *derived; ///< Select_Lex_Unit of derived table */
234
 
  Select_Lex *schema_select_lex;
235
 
  /** link to select_lex where this table was used */
236
 
  Select_Lex *select_lex;
237
 
  /**
238
 
   * List of all base tables local to a subquery including all view
239
 
   * tables. Unlike 'next_local', this in this list views are *not*
240
 
   * leaves. Created in setup_tables() -> make_leaves_list().
241
 
   */
242
 
  TableList *next_leaf;
 
205
  /*
 
206
    select_result for derived table to pass it from table creation to table
 
207
    filling procedure
 
208
  */
 
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;
 
216
  /*
 
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().
 
220
  */
 
221
  TableList     *next_leaf;
243
222
  thr_lock_type lock_type;
244
 
  uint32_t outer_join; ///< Which join type
245
 
  size_t db_length;
246
 
  size_t table_name_length;
 
223
  uint32_t              outer_join;             /* Which join type */
 
224
  uint32_t              shared;                 /* Used in multi-upd */
 
225
  uint32_t i_s_requested_object;
 
226
  size_t        db_length;
 
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;
 
236
  /** true if an alias for this table was specified in the SQL. */
 
237
  bool          is_alias;
 
238
  /** true if the table is referred to in the statement using a fully
 
239
      qualified name (<db_name>.<table_name>).
 
240
  */
 
241
  bool          is_fqtn;
 
242
 
 
243
  bool has_db_lookup_value;
 
244
  bool has_table_lookup_value;
 
245
  uint32_t table_open_method;
 
246
  enum enum_schema_table_state schema_table_state;
247
247
 
248
248
  void set_underlying_merge();
249
249
  bool setup_underlying(Session *session);
250
250
 
251
 
  /**
252
 
   * If you change placeholder(), please check the condition in
253
 
   * check_transactional_lock() too.
254
 
   */
 
251
  /*
 
252
    If you change placeholder(), please check the condition in
 
253
    check_transactional_lock() too.
 
254
  */
255
255
  bool placeholder();
256
 
  /**
257
 
   * Print table as it should be in join list.
258
 
   * 
259
 
   * @param str   string where table should be printed
260
 
   */
261
256
  void print(Session *session, String *str, enum_query_type query_type);
262
 
  /**
263
 
   * Sets insert_values buffer
264
 
   *
265
 
   * @param[in] memory pool for allocating
266
 
   *
267
 
   * @retval
268
 
   *  false - OK
269
 
   * @retval
270
 
   *  true - out of memory
271
 
   */
272
 
  bool set_insert_values(memory::Root *mem_root);
273
 
  /**
274
 
   * Find underlying base tables (TableList) which represent given
275
 
   * table_to_find (Table)
276
 
   *
277
 
   * @param[in] table to find
278
 
   *
279
 
   * @retval
280
 
   *  NULL if table is not found
281
 
   * @retval
282
 
   *  Pointer to found table reference
283
 
   */
 
257
  bool set_insert_values(MEM_ROOT *mem_root);
284
258
  TableList *find_underlying_table(Table *table);
285
 
  /**
286
 
   * Retrieve the first (left-most) leaf in a nested join tree with
287
 
   * respect to name resolution.
288
 
   *
289
 
   * @details
290
 
   *
291
 
   * Given that 'this' is a nested table reference, recursively walk
292
 
   * down the left-most children of 'this' until we reach a leaf
293
 
   * table reference with respect to name resolution.
294
 
   *
295
 
   * @retval
296
 
   *  If 'this' is a nested table reference - the left-most child of
297
 
   *  the tree rooted in 'this',
298
 
   *  else return 'this'
299
 
   */
300
259
  TableList *first_leaf_for_name_resolution();
301
 
  /**
302
 
   * Retrieve the last (right-most) leaf in a nested join tree with
303
 
   * respect to name resolution.
304
 
   *
305
 
   * @details
306
 
   *
307
 
   * Given that 'this' is a nested table reference, recursively walk
308
 
   * down the right-most children of 'this' until we reach a leaf
309
 
   * table reference with respect to name resolution.
310
 
   *
311
 
   * @retval
312
 
   *  If 'this' is a nested table reference - the right-most child of
313
 
   *  the tree rooted in 'this',
314
 
   *  else 'this'
315
 
   */
316
260
  TableList *last_leaf_for_name_resolution();
317
 
  /**
318
 
   * Test if this is a leaf with respect to name resolution.
319
 
   *
320
 
   * @details
321
 
   * 
322
 
   * A table reference is a leaf with respect to name resolution if
323
 
   * it is either a leaf node in a nested join tree (table, view,
324
 
   * schema table, subquery), or an inner node that represents a
325
 
   * NATURAL/USING join, or a nested join with materialized join
326
 
   * columns.
327
 
   *
328
 
   * @retval
329
 
   *  true if a leaf, false otherwise.
330
 
   */
331
261
  bool is_leaf_for_name_resolution();
332
262
  inline TableList *top_table()
333
263
  { return this; }
334
264
 
335
 
  /**
336
 
   * Return subselect that contains the FROM list this table is taken from
337
 
   *
338
 
   * @retval
339
 
   *  Subselect item for the subquery that contains the FROM list
340
 
   *  this table is taken from if there is any
341
 
   * @retval
342
 
   *  NULL otherwise
343
 
   */
344
265
  Item_subselect *containing_subselect();
345
266
 
346
 
  /**
347
 
   * Compiles the tagged hints list and fills up st_table::keys_in_use_for_query,
348
 
   * st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by,
349
 
   * st_table::force_index and st_table::covering_keys.
350
 
   *
351
 
   * @param the Table to operate on.
352
 
   *
353
 
   * @details
354
 
   *
355
 
   * The parser collects the index hints for each table in a "tagged list"
356
 
   * (TableList::index_hints). Using the information in this tagged list
357
 
   * this function sets the members Table::keys_in_use_for_query,
358
 
   * Table::keys_in_use_for_group_by, Table::keys_in_use_for_order_by,
359
 
   * Table::force_index and Table::covering_keys.
360
 
   *
361
 
   * Current implementation of the runtime does not allow mixing FORCE INDEX
362
 
   * and USE INDEX, so this is checked here. Then the FORCE INDEX list
363
 
   * (if non-empty) is appended to the USE INDEX list and a flag is set.
364
 
   * 
365
 
   * Multiple hints of the same kind are processed so that each clause
366
 
   * is applied to what is computed in the previous clause.
367
 
   * 
368
 
   * For example:
369
 
   *       USE INDEX (i1) USE INDEX (i2)
370
 
   *    is equivalent to
371
 
   *       USE INDEX (i1,i2)
372
 
   *    and means "consider only i1 and i2".
373
 
   *
374
 
   * Similarly
375
 
   *       USE INDEX () USE INDEX (i1)
376
 
   *    is equivalent to
377
 
   *       USE INDEX (i1)
378
 
   *    and means "consider only the index i1"
379
 
   *
380
 
   * It is OK to have the same index several times, e.g. "USE INDEX (i1,i1)" is
381
 
   * not an error.
382
 
   *
383
 
   * Different kind of hints (USE/FORCE/IGNORE) are processed in the following
384
 
   * order:
385
 
   *    1. All indexes in USE (or FORCE) INDEX are added to the mask.
386
 
   *    2. All IGNORE INDEX
387
 
   *       e.g. "USE INDEX i1, IGNORE INDEX i1, USE INDEX i1" will not use i1 at all
388
 
   *       as if we had "USE INDEX i1, USE INDEX i1, IGNORE INDEX i1".
389
 
   *       As an optimization if there is a covering index, and we have
390
 
   *       IGNORE INDEX FOR GROUP/order_st, and this index is used for the JOIN part,
391
 
   *       then we have to ignore the IGNORE INDEX FROM GROUP/order_st.
392
 
   *
393
 
   * @retval
394
 
   *   false no errors found
395
 
   * @retval
396
 
   *   true found and reported an error.
397
 
   */
 
267
  /*
 
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.
 
271
  */
398
272
  bool process_index_hints(Table *table);
399
 
 
400
 
  friend std::ostream& operator<<(std::ostream& output, const TableList &list)
401
 
  {
402
 
    output << "TableList:(";
403
 
    output << list.db;
404
 
    output << ", ";
405
 
    output << list.table_name;
406
 
    output << ", ";
407
 
    output << list.alias;
408
 
    output << ", ";
409
 
    output << "is_natural_join:" << list.is_natural_join;
410
 
    output << ", ";
411
 
    output << "is_join_columns_complete:" << list.is_join_columns_complete;
412
 
    output << ", ";
413
 
    output << "straight:" << list.straight;
414
 
    output << ", ";
415
 
    output << "force_index" << list.force_index;
416
 
    output << ", ";
417
 
    output << "ignore_leaves:" << list.ignore_leaves;
418
 
    output << ", ";
419
 
    output << "create:" << list.create;
420
 
    output << ", ";
421
 
    output << "outer_join:" << list.outer_join;
422
 
    output << ", ";
423
 
    output << "nested_join:" << list.nested_join;
424
 
    output << ")";
425
 
 
426
 
    return output;  // for multiple << operators.
427
 
  }
428
 
 
429
 
  void setIsAlias(bool in_is_alias)
430
 
  {
431
 
    is_alias= in_is_alias;
432
 
  }
433
 
 
434
 
  void setIsFqtn(bool in_is_fqtn)
435
 
  {
436
 
    is_fqtn= in_is_fqtn;
437
 
  }
438
 
 
439
 
  void setCreate(bool in_create)
440
 
  {
441
 
    create= in_create;
442
 
  }
443
 
 
444
 
  void setInternalTmpTable(bool in_internal_tmp_table)
445
 
  {
446
 
    internal_tmp_table= in_internal_tmp_table;
447
 
  }
448
 
 
449
 
  void setDbType(plugin::StorageEngine *in_db_type)
450
 
  {
451
 
    db_type= in_db_type;
452
 
  }
453
 
 
454
 
  void setJoinList(List<TableList> *in_join_list)
455
 
  {
456
 
    join_list= in_join_list;
457
 
  }
458
 
 
459
 
  void setEmbedding(TableList *in_embedding)
460
 
  {
461
 
    embedding= in_embedding;
462
 
  }
463
 
 
464
 
  void setNestedJoin(NestedJoin *in_nested_join)
465
 
  {
466
 
    nested_join= in_nested_join;
467
 
  }
468
 
 
469
 
  void setDepTables(table_map in_dep_tables)
470
 
  {
471
 
    dep_tables= in_dep_tables;
472
 
  }
473
 
 
474
 
  void setOnExprDepTables(table_map in_on_expr_dep_tables)
475
 
  {
476
 
    on_expr_dep_tables= in_on_expr_dep_tables;
477
 
  }
478
 
 
479
 
  bool getIsAlias() const
480
 
  {
481
 
    return is_alias;
482
 
  }
483
 
 
484
 
  bool getIsFqtn() const
485
 
  {
486
 
    return is_fqtn;
487
 
  }
488
 
 
489
 
  bool isCreate() const
490
 
  {
491
 
    return create;
492
 
  }
493
 
 
494
 
  bool getInternalTmpTable() const
495
 
  {
496
 
    return internal_tmp_table;
497
 
  }
498
 
 
499
 
  plugin::StorageEngine *getDbType() const
500
 
  {
501
 
    return db_type;
502
 
  }
503
 
 
504
 
  TableList *getEmbedding() const
505
 
  {
506
 
    return embedding;
507
 
  }
508
 
 
509
 
  List<TableList> *getJoinList() const
510
 
  {
511
 
    return join_list;
512
 
  }
513
 
 
514
 
  NestedJoin *getNestedJoin() const
515
 
  {
516
 
    return nested_join;
517
 
  }
518
 
 
519
 
  table_map getDepTables() const
520
 
  {
521
 
    return dep_tables;
522
 
  }
523
 
 
524
 
  table_map getOnExprDepTables() const
525
 
  {
526
 
    return on_expr_dep_tables;
527
 
  }
528
 
 
529
 
  void unlock_table_name();
530
 
  void unlock_table_names(TableList *last_table= NULL);
531
 
 
532
 
private:
533
 
  table_map dep_tables; ///< tables the table depends on
534
 
  table_map on_expr_dep_tables; ///< tables on expression depends on
535
 
  NestedJoin *nested_join; ///< if the element is a nested join
536
 
  TableList *embedding; ///< nested join containing the table
537
 
  List<TableList> *join_list; ///< join list the table belongs to
538
 
  plugin::StorageEngine *db_type; ///< table_type for handler
539
 
  bool internal_tmp_table;
540
 
 
541
 
  /** true if an alias for this table was specified in the SQL. */
542
 
  bool is_alias;
543
 
 
544
 
  /** 
545
 
   * true if the table is referred to in the statement using a fully
546
 
   * qualified name (<db_name>.<table_name>).
547
 
   */
548
 
  bool is_fqtn;
549
 
 
550
 
  /**
551
 
   * This TableList object corresponds to the table to be created
552
 
   * so it is possible that it does not exist (used in CREATE TABLE
553
 
   * ... SELECT implementation).
554
 
   */
555
 
  bool create;
556
 
 
 
273
  uint32_t create_table_def_key(char *key);
557
274
};
558
275
 
559
276
void close_thread_tables(Session *session);
560
277
 
561
 
} /* namespace drizzled */
562
 
 
563
278
#endif /* DRIZZLED_TABLE_LIST_H */