~drizzle-trunk/drizzle/development

390.1.2 by Monty Taylor
Fixed copyright headers in drizzled/
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008 Sun Microsystems, Inc.
390.1.2 by Monty Taylor
Fixed copyright headers in drizzled/
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; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
21
#pragma once
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
22
2141.3.1 by vjsamuel1990 at gmail
Merge encapsulate join_read_const_table() into JoinTable.
23
#include <drizzled/nested_join.h>
584.1.13 by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes.
24
#include <drizzled/table.h>
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
25
2252.1.18 by Olaf van der Spek
Common fwd
26
namespace drizzled {
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
27
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
28
/**
29
 * A Table referenced in the FROM clause.
30
 *
31
 * These table references can be of several types that correspond to
32
 * different SQL elements. Below we list all types of TableLists with
33
 * the necessary conditions to determine when a TableList instance
34
 * belongs to a certain type.
35
 *
36
 * 1) table (TableList::view == NULL)
37
 *    - base table
38
 *    (TableList::derived == NULL)
39
 *    - subquery - TableList::table is a temp table
40
 *    (TableList::derived != NULL)
41
 *    
42
 *    @note
43
 *
44
 *    for schema tables TableList::field_translation may be != NULL
45
 *
46
 * 2) Was VIEW 
47
 * 3) nested table reference (TableList::nested_join != NULL)
48
 *     - table sequence - e.g. (t1, t2, t3)
49
 *     @todo how to distinguish from a JOIN?
50
 *     - general JOIN
51
 *     @todo how to distinguish from a table sequence?
52
 *     - NATURAL JOIN
53
 *     (TableList::natural_join != NULL)
54
 *     - JOIN ... USING
55
 *     (TableList::join_using_fields != NULL)
56
 *     - semi-join
57
 */
327.2.4 by Brian Aker
Refactoring table.h
58
class TableList
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
59
{
60
public:
1034.1.4 by Brian Aker
Fixed TableList to correctly construct (and removed memset() calls in
61
  TableList():
62
    next_local(NULL),
63
    next_global(NULL),
64
    prev_global(NULL),
2385.1.9 by Olaf van der Spek
Use const char* instead of str_ref
65
    schema(NULL),
1034.1.4 by Brian Aker
Fixed TableList to correctly construct (and removed memset() calls in
66
    alias(NULL),
2385.1.9 by Olaf van der Spek
Use const char* instead of str_ref
67
    table_name(NULL),
1034.1.4 by Brian Aker
Fixed TableList to correctly construct (and removed memset() calls in
68
    option(NULL),
69
    on_expr(NULL),
70
    table(NULL),
71
    prep_on_expr(NULL),
72
    cond_equal(NULL),
73
    natural_join(NULL),
74
    is_natural_join(false),
75
    is_join_columns_complete(false),
76
    straight(false),
77
    force_index(false),
78
    ignore_leaves(false),
79
    join_using_fields(NULL),
80
    join_columns(NULL),
81
    next_name_resolution_table(NULL),
82
    index_hints(NULL),
83
    derived_result(NULL),
84
    derived(NULL),
85
    schema_select_lex(NULL),
86
    select_lex(NULL),
87
    next_leaf(NULL),
88
    outer_join(0),
89
    dep_tables(0),
90
    on_expr_dep_tables(0),
91
    nested_join(NULL),
92
    embedding(NULL),
93
    join_list(NULL),
94
    db_type(NULL),
95
    internal_tmp_table(false),
96
    is_alias(false),
1637.2.6 by Vijay Samuel
Merge encapsulate TableList-1.
97
    is_fqtn(false),
98
    create(false)
2385.1.5 by Olaf van der Spek
Refactor
99
  {
100
  }
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
101
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
102
  /**
103
   * List of tables local to a subquery (used by SQL_LIST). Considers
104
   * views as leaves (unlike 'next_leaf' below). Created at parse time
105
   * in Select_Lex::add_table_to_list() -> table_list.link_in_list().
106
   */
327.2.4 by Brian Aker
Refactoring table.h
107
  TableList *next_local;
1034.1.4 by Brian Aker
Fixed TableList to correctly construct (and removed memset() calls in
108
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
109
  /** link in a global list of all queries tables */
1034.1.4 by Brian Aker
Fixed TableList to correctly construct (and removed memset() calls in
110
  TableList *next_global; 
111
  TableList **prev_global;
1874.1.1 by Brian Aker
Encapsulate schema_name it table_list.
112
113
private:
2385.1.8 by Olaf van der Spek
Refactor
114
  const char* schema;
1874.1.1 by Brian Aker
Encapsulate schema_name it table_list.
115
116
public:
2318.8.7 by Olaf van der Spek
Add const
117
  const char *getSchemaName() const
1874.1.1 by Brian Aker
Encapsulate schema_name it table_list.
118
  {
2385.1.8 by Olaf van der Spek
Refactor
119
    return schema;
1874.1.1 by Brian Aker
Encapsulate schema_name it table_list.
120
  }
121
2385.1.9 by Olaf van der Spek
Use const char* instead of str_ref
122
  void setSchemaName(const char* v)
1874.1.1 by Brian Aker
Encapsulate schema_name it table_list.
123
  {
2385.1.9 by Olaf van der Spek
Use const char* instead of str_ref
124
    schema= v;
1874.1.1 by Brian Aker
Encapsulate schema_name it table_list.
125
  }
126
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
127
  const char *alias;
1874.1.2 by Brian Aker
Encapsulate table_name from table_list.
128
129
private:
2385.1.8 by Olaf van der Spek
Refactor
130
  const char* table_name;
1874.1.2 by Brian Aker
Encapsulate table_name from table_list.
131
132
public:
2318.8.7 by Olaf van der Spek
Add const
133
  const char *getTableName() const
1874.1.2 by Brian Aker
Encapsulate table_name from table_list.
134
  {
2385.1.8 by Olaf van der Spek
Refactor
135
    return table_name;
1874.1.2 by Brian Aker
Encapsulate table_name from table_list.
136
  }
137
2385.1.9 by Olaf van der Spek
Use const char* instead of str_ref
138
  void setTableName(const char* v)
2385.1.3 by Olaf van der Spek
Refactor getTableName
139
  {
2385.1.9 by Olaf van der Spek
Use const char* instead of str_ref
140
    table_name= v;
2385.1.3 by Olaf van der Spek
Refactor getTableName
141
  }
142
2318.8.5 by Olaf van der Spek
Refactor setSchemaName() and setTableName()
143
  const char *option; ///< Used by cache index
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
144
  Item *on_expr; ///< Used with outer join
145
  Table *table; ///< opened table
146
  /**
147
   * The structure of ON expression presented in the member above
148
   * can be changed during certain optimizations. This member
149
   * contains a snapshot of AND-OR structure of the ON expression
150
   * made after permanent transformations of the parse tree, and is
151
   * used to restore ON clause before every reexecution of a prepared
152
   * statement or stored procedure.
153
   */
154
  Item *prep_on_expr;
155
  COND_EQUAL *cond_equal; ///< Used with outer join
156
  /**
157
   * During parsing - left operand of NATURAL/USING join where 'this' is
158
   * the right operand. After parsing (this->natural_join == this) iff
159
   * 'this' represents a NATURAL or USING join operation. Thus after
160
   * parsing 'this' is a NATURAL/USING join iff (natural_join != NULL).
161
   */
327.2.4 by Brian Aker
Refactoring table.h
162
  TableList *natural_join;
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
163
  /**
164
   * True if 'this' represents a nested join that is a NATURAL JOIN.
165
   * For one of the operands of 'this', the member 'natural_join' points
166
   * to the other operand of 'this'.
167
   */
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
168
  bool is_natural_join;
1030.1.2 by Brian Aker
More alignment for structures
169
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
170
  /** true if join_columns contains all columns of this table reference. */
1030.1.2 by Brian Aker
More alignment for structures
171
  bool is_join_columns_complete;
172
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
173
  bool straight; ///< optimize with prev table
174
  bool force_index; ///< prefer index over table scan
175
  bool ignore_leaves; ///< preload only non-leaf nodes
176
1637.1.3 by Brian Aker
This fixes the parser to no longer do the bad syntax around the cross join
177
  /*
178
    is the table a cartesian join, assumption is yes unless "solved"
179
  */
180
  bool isCartesian() const;
181
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
182
  /** Field names in a USING clause for JOIN ... USING. */
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
183
  List<String> *join_using_fields;
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
184
  /**
185
   * Explicitly store the result columns of either a NATURAL/USING join or
186
   * an operand of such a join.
187
   */
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
188
  List<Natural_join_column> *join_columns;
189
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
190
  /**
191
   * List of nodes in a nested join tree, that should be considered as
192
   * leaves with respect to name resolution. The leaves are: views,
193
   * top-most nodes representing NATURAL/USING joins, subqueries, and
194
   * base tables. All of these TableList instances contain a
195
   * materialized list of columns. The list is local to a subquery.
196
   */
327.2.4 by Brian Aker
Refactoring table.h
197
  TableList *next_name_resolution_table;
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
198
  /** Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
199
  List<Index_hint> *index_hints;
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
200
  /**
201
   * select_result for derived table to pass it from table creation to table
202
   * filling procedure
203
   */
204
  select_union *derived_result;
205
  Select_Lex_Unit *derived; ///< Select_Lex_Unit of derived table */
206
  Select_Lex *schema_select_lex;
207
  /** link to select_lex where this table was used */
208
  Select_Lex *select_lex;
209
  /**
210
   * List of all base tables local to a subquery including all view
211
   * tables. Unlike 'next_local', this in this list views are *not*
212
   * leaves. Created in setup_tables() -> make_leaves_list().
213
   */
214
  TableList *next_leaf;
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
215
  thr_lock_type lock_type;
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
216
  uint32_t outer_join; ///< Which join type
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
217
218
  void set_underlying_merge();
520.1.22 by Brian Aker
Second pass of thd cleanup
219
  bool setup_underlying(Session *session);
1034.1.4 by Brian Aker
Fixed TableList to correctly construct (and removed memset() calls in
220
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
221
  /**
222
   * If you change placeholder(), please check the condition in
223
   * check_transactional_lock() too.
224
   */
584.1.15 by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes.
225
  bool placeholder();
1188.1.2 by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation.
226
  /**
227
   * Print table as it should be in join list.
228
   * 
229
   * @param str   string where table should be printed
230
   */
2215.2.1 by Stewart Smith
remove enum_query_type which was effectively unused. It was set to one value once, compared to it once (i.e. always true) and passed around everywhere doing nothing.
231
  void print(Session *session, String *str);
1188.1.2 by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation.
232
  /**
233
   * Sets insert_values buffer
234
   *
235
   * @param[in] memory pool for allocating
236
   *
237
   * @retval
238
   *  false - OK
239
   * @retval
240
   *  true - out of memory
241
   */
2385.2.4 by Olaf van der Spek
cppcheck
242
  void set_insert_values();
1188.1.2 by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation.
243
  /**
244
   * Find underlying base tables (TableList) which represent given
245
   * table_to_find (Table)
246
   *
247
   * @param[in] table to find
248
   *
249
   * @retval
250
   *  NULL if table is not found
251
   * @retval
252
   *  Pointer to found table reference
253
   */
327.2.4 by Brian Aker
Refactoring table.h
254
  TableList *find_underlying_table(Table *table);
1188.1.2 by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation.
255
  /**
256
   * Retrieve the first (left-most) leaf in a nested join tree with
257
   * respect to name resolution.
258
   *
259
   * @details
260
   *
261
   * Given that 'this' is a nested table reference, recursively walk
262
   * down the left-most children of 'this' until we reach a leaf
263
   * table reference with respect to name resolution.
264
   *
265
   * @retval
266
   *  If 'this' is a nested table reference - the left-most child of
267
   *  the tree rooted in 'this',
268
   *  else return 'this'
269
   */
327.2.4 by Brian Aker
Refactoring table.h
270
  TableList *first_leaf_for_name_resolution();
1188.1.2 by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation.
271
  /**
272
   * Retrieve the last (right-most) leaf in a nested join tree with
273
   * respect to name resolution.
274
   *
275
   * @details
276
   *
277
   * Given that 'this' is a nested table reference, recursively walk
278
   * down the right-most children of 'this' until we reach a leaf
279
   * table reference with respect to name resolution.
280
   *
281
   * @retval
282
   *  If 'this' is a nested table reference - the right-most child of
283
   *  the tree rooted in 'this',
284
   *  else 'this'
285
   */
327.2.4 by Brian Aker
Refactoring table.h
286
  TableList *last_leaf_for_name_resolution();
1188.1.2 by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation.
287
  /**
288
   * Test if this is a leaf with respect to name resolution.
289
   *
290
   * @details
291
   * 
292
   * A table reference is a leaf with respect to name resolution if
293
   * it is either a leaf node in a nested join tree (table, view,
294
   * schema table, subquery), or an inner node that represents a
295
   * NATURAL/USING join, or a nested join with materialized join
296
   * columns.
297
   *
298
   * @retval
299
   *  true if a leaf, false otherwise.
300
   */
2385.2.4 by Olaf van der Spek
cppcheck
301
  bool is_leaf_for_name_resolution() const;
327.2.4 by Brian Aker
Refactoring table.h
302
  inline TableList *top_table()
1054.1.7 by Brian Aker
Refactor TableList methods.
303
  { return this; }
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
304
1188.1.2 by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation.
305
  /**
306
   * Return subselect that contains the FROM list this table is taken from
307
   *
308
   * @retval
309
   *  Subselect item for the subquery that contains the FROM list
310
   *  this table is taken from if there is any
311
   * @retval
312
   *  NULL otherwise
313
   */
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
314
  Item_subselect *containing_subselect();
315
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
316
  /**
317
   * Compiles the tagged hints list and fills up st_table::keys_in_use_for_query,
318
   * st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by,
319
   * st_table::force_index and st_table::covering_keys.
1188.1.2 by Jay Pipes
Style and doxygen cleanup ONLY. Moves method documentation from source into header files. Removes TAB characters and cleans up indentation.
320
   *
321
   * @param the Table to operate on.
322
   *
323
   * @details
324
   *
325
   * The parser collects the index hints for each table in a "tagged list"
326
   * (TableList::index_hints). Using the information in this tagged list
327
   * this function sets the members Table::keys_in_use_for_query,
328
   * Table::keys_in_use_for_group_by, Table::keys_in_use_for_order_by,
329
   * Table::force_index and Table::covering_keys.
330
   *
331
   * Current implementation of the runtime does not allow mixing FORCE INDEX
332
   * and USE INDEX, so this is checked here. Then the FORCE INDEX list
333
   * (if non-empty) is appended to the USE INDEX list and a flag is set.
334
   * 
335
   * Multiple hints of the same kind are processed so that each clause
336
   * is applied to what is computed in the previous clause.
337
   * 
338
   * For example:
339
   *       USE INDEX (i1) USE INDEX (i2)
340
   *    is equivalent to
341
   *       USE INDEX (i1,i2)
342
   *    and means "consider only i1 and i2".
343
   *
344
   * Similarly
345
   *       USE INDEX () USE INDEX (i1)
346
   *    is equivalent to
347
   *       USE INDEX (i1)
348
   *    and means "consider only the index i1"
349
   *
350
   * It is OK to have the same index several times, e.g. "USE INDEX (i1,i1)" is
351
   * not an error.
352
   *
353
   * Different kind of hints (USE/FORCE/IGNORE) are processed in the following
354
   * order:
355
   *    1. All indexes in USE (or FORCE) INDEX are added to the mask.
356
   *    2. All IGNORE INDEX
357
   *       e.g. "USE INDEX i1, IGNORE INDEX i1, USE INDEX i1" will not use i1 at all
358
   *       as if we had "USE INDEX i1, USE INDEX i1, IGNORE INDEX i1".
359
   *       As an optimization if there is a covering index, and we have
360
   *       IGNORE INDEX FOR GROUP/order_st, and this index is used for the JOIN part,
361
   *       then we have to ignore the IGNORE INDEX FROM GROUP/order_st.
362
   *
363
   * @retval
364
   *   false no errors found
365
   * @retval
366
   *   true found and reported an error.
1188.1.1 by Jay Pipes
Style-only cleanups and doxygenation of TableList class and its members.
367
   */
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
368
  bool process_index_hints(Table *table);
1637.1.3 by Brian Aker
This fixes the parser to no longer do the bad syntax around the cross join
369
370
  friend std::ostream& operator<<(std::ostream& output, const TableList &list)
371
  {
372
    output << "TableList:(";
2385.1.7 by Olaf van der Spek
Rename set_db to set_schema
373
    output << list.getSchemaName();
1637.1.3 by Brian Aker
This fixes the parser to no longer do the bad syntax around the cross join
374
    output << ", ";
2385.1.5 by Olaf van der Spek
Refactor
375
    output << list.getTableName();
1637.1.3 by Brian Aker
This fixes the parser to no longer do the bad syntax around the cross join
376
    output << ", ";
377
    output << list.alias;
378
    output << ", ";
379
    output << "is_natural_join:" << list.is_natural_join;
380
    output << ", ";
381
    output << "is_join_columns_complete:" << list.is_join_columns_complete;
382
    output << ", ";
383
    output << "straight:" << list.straight;
384
    output << ", ";
385
    output << "force_index" << list.force_index;
386
    output << ", ";
387
    output << "ignore_leaves:" << list.ignore_leaves;
388
    output << ", ";
389
    output << "create:" << list.create;
390
    output << ", ";
391
    output << "outer_join:" << list.outer_join;
392
    output << ", ";
393
    output << "nested_join:" << list.nested_join;
394
    output << ")";
395
396
    return output;  // for multiple << operators.
397
  }
1637.2.6 by Vijay Samuel
Merge encapsulate TableList-1.
398
399
  void setIsAlias(bool in_is_alias)
400
  {
401
    is_alias= in_is_alias;
402
  }
403
404
  void setIsFqtn(bool in_is_fqtn)
405
  {
406
    is_fqtn= in_is_fqtn;
407
  }
408
409
  void setCreate(bool in_create)
410
  {
411
    create= in_create;
412
  }
413
414
  void setInternalTmpTable(bool in_internal_tmp_table)
415
  {
416
    internal_tmp_table= in_internal_tmp_table;
417
  }
418
419
  void setDbType(plugin::StorageEngine *in_db_type)
420
  {
421
    db_type= in_db_type;
422
  }
423
424
  void setJoinList(List<TableList> *in_join_list)
425
  {
426
    join_list= in_join_list;
427
  }
428
1637.2.7 by Vijay Samuel
Merge encapsulate TableList-2.
429
  void setEmbedding(TableList *in_embedding)
430
  {
431
    embedding= in_embedding;
432
  }
433
2141.3.3 by vjsamuel1990 at gmail
Merge change nested_join_st to NestedJoin
434
  void setNestedJoin(NestedJoin *in_nested_join)
1637.2.7 by Vijay Samuel
Merge encapsulate TableList-2.
435
  {
436
    nested_join= in_nested_join;
437
  }
438
439
  void setDepTables(table_map in_dep_tables)
440
  {
441
    dep_tables= in_dep_tables;
442
  }
443
444
  void setOnExprDepTables(table_map in_on_expr_dep_tables)
445
  {
446
    on_expr_dep_tables= in_on_expr_dep_tables;
447
  }
448
1637.2.6 by Vijay Samuel
Merge encapsulate TableList-1.
449
  bool getIsAlias() const
450
  {
451
    return is_alias;
452
  }
453
454
  bool getIsFqtn() const
455
  {
456
    return is_fqtn;
457
  }
458
1637.2.9 by Vijay Samuel
Merge Brian's request for isCreate() instead of getCreate().
459
  bool isCreate() const
1637.2.6 by Vijay Samuel
Merge encapsulate TableList-1.
460
  {
461
    return create;
462
  }
463
464
  bool getInternalTmpTable() const
465
  {
466
    return internal_tmp_table;
467
  }
468
469
  plugin::StorageEngine *getDbType() const
470
  {
471
    return db_type;
472
  }
473
1637.2.7 by Vijay Samuel
Merge encapsulate TableList-2.
474
  TableList *getEmbedding() const
475
  {
476
    return embedding;
477
  }
478
1637.2.6 by Vijay Samuel
Merge encapsulate TableList-1.
479
  List<TableList> *getJoinList() const
480
  {
481
    return join_list;
482
  }
483
2141.3.3 by vjsamuel1990 at gmail
Merge change nested_join_st to NestedJoin
484
  NestedJoin *getNestedJoin() const
1637.2.7 by Vijay Samuel
Merge encapsulate TableList-2.
485
  {
486
    return nested_join;
487
  }
488
489
  table_map getDepTables() const
490
  {
491
    return dep_tables;
492
  }
493
494
  table_map getOnExprDepTables() const
495
  {
496
    return on_expr_dep_tables;
497
  }
498
1910.2.4 by Brian Aker
Push some functions behind classes.
499
  void unlock_table_name();
500
  void unlock_table_names(TableList *last_table= NULL);
501
1637.2.6 by Vijay Samuel
Merge encapsulate TableList-1.
502
private:
1637.2.7 by Vijay Samuel
Merge encapsulate TableList-2.
503
  table_map dep_tables; ///< tables the table depends on
504
  table_map on_expr_dep_tables; ///< tables on expression depends on
2141.3.3 by vjsamuel1990 at gmail
Merge change nested_join_st to NestedJoin
505
  NestedJoin *nested_join; ///< if the element is a nested join
1637.2.7 by Vijay Samuel
Merge encapsulate TableList-2.
506
  TableList *embedding; ///< nested join containing the table
1637.2.6 by Vijay Samuel
Merge encapsulate TableList-1.
507
  List<TableList> *join_list; ///< join list the table belongs to
508
  plugin::StorageEngine *db_type; ///< table_type for handler
509
  bool internal_tmp_table;
2134.1.1 by Brian Aker
Remove dead bit from tablelist class.
510
1637.2.6 by Vijay Samuel
Merge encapsulate TableList-1.
511
  /** true if an alias for this table was specified in the SQL. */
512
  bool is_alias;
513
514
  /** 
515
   * true if the table is referred to in the statement using a fully
516
   * qualified name (<db_name>.<table_name>).
517
   */
518
  bool is_fqtn;
2134.1.1 by Brian Aker
Remove dead bit from tablelist class.
519
1641.1.1 by Zimin
move the comment of 'create' in TableList as well
520
  /**
521
   * This TableList object corresponds to the table to be created
522
   * so it is possible that it does not exist (used in CREATE TABLE
523
   * ... SELECT implementation).
524
   */
1637.2.6 by Vijay Samuel
Merge encapsulate TableList-1.
525
  bool create;
526
327.1.5 by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h
527
};
520.6.7 by Monty Taylor
Moved a bunch of crap out of common_includes.
528
529
void close_thread_tables(Session *session);
530
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
531
} /* namespace drizzled */
532