~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_list.h

  • Committer: Monty Taylor
  • Date: 2009-03-25 21:06:47 UTC
  • mto: This revision was merged to the branch mainline in revision 964.
  • Revision ID: mordred@inaugust.com-20090325210647-7j1tm98gvct3jxsu
Removed legacy_db_type.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#ifdef USE_PRAGMA_INTERFACE
22
 
#pragma interface                       /* gcc class implementation */
23
 
#endif
24
 
 
25
 
 
26
 
#ifndef DRIZZLED_TMP_TABLE_H
27
 
#define DRIZZLED_TMP_TABLE_H
 
21
 
 
22
#ifndef DRIZZLED_TABLE_LIST_H
 
23
#define DRIZZLED_TABLE_LIST_H
28
24
 
29
25
/*
30
26
  Table reference in the FROM clause.
42
38
     - information schema table
43
39
       (TableList::schema_table != NULL)
44
40
       NOTICE: for schema tables TableList::field_translation may be != NULL
45
 
  2) view (TableList::view != NULL)
46
 
     - merge    (TableList::effective_algorithm == VIEW_ALGORITHM_MERGE)
47
 
           also (TableList::field_translation != NULL)
48
 
     - tmptable (TableList::effective_algorithm == VIEW_ALGORITHM_TMPTABLE)
49
 
           also (TableList::field_translation == NULL)
 
41
  2) Was VIEW 
50
42
  3) nested table reference (TableList::nested_join != NULL)
51
43
     - table sequence - e.g. (t1, t2, t3)
52
44
       TODO: how to distinguish from a JOIN?
61
53
*/
62
54
 
63
55
 
64
 
#include "table.h"
 
56
#include <drizzled/table.h>
65
57
 
66
58
class Index_hint;
67
59
class COND_EQUAL;
68
60
class Natural_join_column;
69
61
class select_union;
70
 
class st_select_lex_unit;
 
62
class Select_Lex_Unit;
71
63
class ST_SCHEMA_TABLE;
72
 
class st_select_lex;
73
 
class TMP_TABLE_PARAM;
74
 
class Field_translator;
 
64
class Select_Lex;
 
65
class Tmp_Table_Param;
75
66
class Item_subselect;
76
67
class Table;
77
68
 
78
 
enum enum_schema_table_state
79
 
80
 
  NOT_PROCESSED= 0,
81
 
  PROCESSED_BY_CREATE_SORT_INDEX,
82
 
  PROCESSED_BY_JOIN_EXEC
83
 
};
84
 
 
 
69
struct nested_join_st;
85
70
 
86
71
class TableList
87
72
{
105
90
  /*
106
91
    List of tables local to a subquery (used by SQL_LIST). Considers
107
92
    views as leaves (unlike 'next_leaf' below). Created at parse time
108
 
    in st_select_lex::add_table_to_list() -> table_list.link_in_list().
 
93
    in Select_Lex::add_table_to_list() -> table_list.link_in_list().
109
94
  */
110
95
  TableList *next_local;
111
96
  /* link in a global list of all queries tables */
122
107
  */
123
108
  table_map     sj_inner_tables;
124
109
  /* Number of IN-compared expressions */
125
 
  uint32_t          sj_in_exprs; 
 
110
  uint32_t          sj_in_exprs;
126
111
  /*
127
112
    The structure of ON expression presented in the member above
128
113
    can be changed during certain optimizations. This member
181
166
    can see this lists can't be merged)
182
167
  */
183
168
  TableList     *correspondent_table;
184
 
  st_select_lex_unit *derived;          /* SELECT_LEX_UNIT of derived table */
 
169
  Select_Lex_Unit *derived;             /* Select_Lex_Unit of derived table */
185
170
  ST_SCHEMA_TABLE *schema_table;        /* Information_schema table */
186
 
  st_select_lex *schema_select_lex;
 
171
  Select_Lex    *schema_select_lex;
187
172
  /*
188
173
    True when the view field translation table is used to convert
189
174
    schema table fields for backwards compatibility with SHOW command.
190
175
  */
191
176
  bool schema_table_reformed;
192
 
  TMP_TABLE_PARAM *schema_table_param;
 
177
  Tmp_Table_Param *schema_table_param;
193
178
  /* link to select_lex where this table was used */
194
 
  st_select_lex *select_lex;
195
 
  Field_translator *field_translation;  /* array of VIEW fields */
196
 
  /* pointer to element after last one in translation table above */
197
 
  Field_translator *field_translation_end;
 
179
  Select_Lex    *select_lex;
198
180
  /*
199
181
    List (based on next_local) of underlying tables of this view. I.e. it
200
182
    does not include the tables of subqueries used in the view. Is set only
222
204
  TableList *embedding;             /* nested join containing the table */
223
205
  List<TableList> *join_list;/* join list the table belongs to   */
224
206
  bool          cacheable_table;        /* stop PS caching */
225
 
  handlerton    *db_type;               /* table_type for handler */
 
207
  StorageEngine *db_type;               /* table_type for handler */
226
208
  char          timestamp_buffer[20];   /* buffer for timestamp (19+1) */
227
209
  /*
228
210
    This TableList object corresponds to the table to be created
247
229
  uint32_t table_open_method;
248
230
  enum enum_schema_table_state schema_table_state;
249
231
  void set_underlying_merge();
250
 
  bool setup_underlying(THD *thd);
 
232
  bool setup_underlying(Session *session);
251
233
  void cleanup_items();
252
234
  /*
253
235
    If you change placeholder(), please check the condition in
254
236
    check_transactional_lock() too.
255
237
  */
256
 
  bool placeholder()
257
 
  {
258
 
    return derived || schema_table || (create && !table->getDBStat()) || !table;
259
 
  }
260
 
  void print(THD *thd, String *str, enum_query_type query_type);
 
238
  bool placeholder();
 
239
  void print(Session *session, String *str, enum_query_type query_type);
261
240
  bool set_insert_values(MEM_ROOT *mem_root);
262
241
  TableList *find_underlying_table(Table *table);
263
242
  TableList *first_leaf_for_name_resolution();
270
249
    Cleanup for re-execution in a prepared statement or a stored
271
250
    procedure.
272
251
  */
273
 
  void reinit_before_use(THD *thd);
 
252
  void reinit_before_use(Session *session);
274
253
  Item_subselect *containing_subselect();
275
254
 
276
 
  /* 
 
255
  /*
277
256
    Compiles the tagged hints list and fills up st_table::keys_in_use_for_query,
278
257
    st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by,
279
258
    st_table::force_index and st_table::covering_keys.
280
259
  */
281
260
  bool process_index_hints(Table *table);
282
261
};
283
 
#endif /* DRIZZLED_TMP_TABLE_H */
 
262
 
 
263
void close_thread_tables(Session *session);
 
264
 
 
265
#endif /* DRIZZLED_TABLE_LIST_H */