~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_list.h

  • Committer: patrick crews
  • Date: 2010-05-20 03:29:50 UTC
  • mto: This revision was merged to the branch mainline in revision 1565.
  • Revision ID: patrick.crews@sun.com-20100520032950-7452uruysx9kb6bn
Fixed incorrectly altered test commenting to reflect the proper bug descriptions (mysqldump v. drizzledump)

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
    straight(false),
95
95
    force_index(false),
96
96
    ignore_leaves(false),
 
97
    create(false),
97
98
    join_using_fields(NULL),
98
99
    join_columns(NULL),
99
100
    next_name_resolution_table(NULL),
104
105
    select_lex(NULL),
105
106
    next_leaf(NULL),
106
107
    outer_join(0),
 
108
    shared(0),
107
109
    db_length(0),
108
110
    table_name_length(0),
109
111
    dep_tables(0),
115
117
    internal_tmp_table(false),
116
118
    is_alias(false),
117
119
    is_fqtn(false),
118
 
    create(false)
 
120
    has_db_lookup_value(false),
 
121
    has_table_lookup_value(false)
119
122
  {}
120
123
 
121
124
  /**
129
132
  TableList *next_global; 
130
133
  TableList **prev_global;
131
134
 
132
 
private:
133
135
  char *db;
134
 
 
135
 
public:
136
 
  const char *getSchemaName()
137
 
  {
138
 
    return db;
139
 
  }
140
 
 
141
 
  char **getSchemaNamePtr()
142
 
  {
143
 
    return &db;
144
 
  }
145
 
 
146
 
  void setSchemaName(char *arg)
147
 
  {
148
 
    db= arg;
149
 
  }
150
 
 
151
136
  const char *alias;
152
 
 
153
 
private:
154
137
  char *table_name;
155
 
 
156
 
public:
157
 
  const char *getTableName()
158
 
  {
159
 
    return table_name;
160
 
  }
161
 
 
162
 
  char **getTableNamePtr()
163
 
  {
164
 
    return &table_name;
165
 
  }
166
 
 
167
 
  void setTableName(char *arg)
168
 
  {
169
 
    table_name= arg;
170
 
  }
171
 
 
172
138
  char *option; ///< Used by cache index
173
139
  Item *on_expr; ///< Used with outer join
174
140
  Table *table; ///< opened table
203
169
  bool force_index; ///< prefer index over table scan
204
170
  bool ignore_leaves; ///< preload only non-leaf nodes
205
171
 
206
 
  /*
207
 
    is the table a cartesian join, assumption is yes unless "solved"
208
 
  */
209
 
  bool isCartesian() const;
 
172
  /**
 
173
   * This TableList 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).
 
176
   */
 
177
  bool create;
210
178
 
211
179
  /** Field names in a USING clause for JOIN ... USING. */
212
180
  List<String> *join_using_fields;
243
211
  TableList *next_leaf;
244
212
  thr_lock_type lock_type;
245
213
  uint32_t outer_join; ///< Which join type
 
214
  uint32_t shared; ///<Used in multi-upd
246
215
  size_t db_length;
247
216
  size_t table_name_length;
 
217
  table_map dep_tables; ///< tables the table depends on
 
218
  table_map on_expr_dep_tables; ///< tables on expression depends on
 
219
  nested_join_st *nested_join; ///< if the element is a nested join
 
220
  TableList *embedding; ///< nested join containing the table
 
221
  List<TableList> *join_list; ///< join list the table belongs to
 
222
  plugin::StorageEngine *db_type; ///< table_type for handler
 
223
  char timestamp_buffer[20]; ///< buffer for timestamp (19+1)
 
224
  bool internal_tmp_table;
 
225
  /** true if an alias for this table was specified in the SQL. */
 
226
  bool is_alias;
 
227
  /** 
 
228
   * true if the table is referred to in the statement using a fully
 
229
   * qualified name (<db_name>.<table_name>).
 
230
   */
 
231
  bool is_fqtn;
 
232
 
 
233
  bool has_db_lookup_value;
 
234
  bool has_table_lookup_value;
248
235
 
249
236
  void set_underlying_merge();
250
237
  bool setup_underlying(Session *session);
397
384
   *   true found and reported an error.
398
385
   */
399
386
  bool process_index_hints(Table *table);
400
 
 
401
 
  friend std::ostream& operator<<(std::ostream& output, const TableList &list)
402
 
  {
403
 
    output << "TableList:(";
404
 
    output << list.db;
405
 
    output << ", ";
406
 
    output << list.table_name;
407
 
    output << ", ";
408
 
    output << list.alias;
409
 
    output << ", ";
410
 
    output << "is_natural_join:" << list.is_natural_join;
411
 
    output << ", ";
412
 
    output << "is_join_columns_complete:" << list.is_join_columns_complete;
413
 
    output << ", ";
414
 
    output << "straight:" << list.straight;
415
 
    output << ", ";
416
 
    output << "force_index" << list.force_index;
417
 
    output << ", ";
418
 
    output << "ignore_leaves:" << list.ignore_leaves;
419
 
    output << ", ";
420
 
    output << "create:" << list.create;
421
 
    output << ", ";
422
 
    output << "outer_join:" << list.outer_join;
423
 
    output << ", ";
424
 
    output << "nested_join:" << list.nested_join;
425
 
    output << ")";
426
 
 
427
 
    return output;  // for multiple << operators.
428
 
  }
429
 
 
430
 
  void setIsAlias(bool in_is_alias)
431
 
  {
432
 
    is_alias= in_is_alias;
433
 
  }
434
 
 
435
 
  void setIsFqtn(bool in_is_fqtn)
436
 
  {
437
 
    is_fqtn= in_is_fqtn;
438
 
  }
439
 
 
440
 
  void setCreate(bool in_create)
441
 
  {
442
 
    create= in_create;
443
 
  }
444
 
 
445
 
  void setInternalTmpTable(bool in_internal_tmp_table)
446
 
  {
447
 
    internal_tmp_table= in_internal_tmp_table;
448
 
  }
449
 
 
450
 
  void setDbType(plugin::StorageEngine *in_db_type)
451
 
  {
452
 
    db_type= in_db_type;
453
 
  }
454
 
 
455
 
  void setJoinList(List<TableList> *in_join_list)
456
 
  {
457
 
    join_list= in_join_list;
458
 
  }
459
 
 
460
 
  void setEmbedding(TableList *in_embedding)
461
 
  {
462
 
    embedding= in_embedding;
463
 
  }
464
 
 
465
 
  void setNestedJoin(nested_join_st *in_nested_join)
466
 
  {
467
 
    nested_join= in_nested_join;
468
 
  }
469
 
 
470
 
  void setDepTables(table_map in_dep_tables)
471
 
  {
472
 
    dep_tables= in_dep_tables;
473
 
  }
474
 
 
475
 
  void setOnExprDepTables(table_map in_on_expr_dep_tables)
476
 
  {
477
 
    on_expr_dep_tables= in_on_expr_dep_tables;
478
 
  }
479
 
 
480
 
  bool getIsAlias() const
481
 
  {
482
 
    return is_alias;
483
 
  }
484
 
 
485
 
  bool getIsFqtn() const
486
 
  {
487
 
    return is_fqtn;
488
 
  }
489
 
 
490
 
  bool isCreate() const
491
 
  {
492
 
    return create;
493
 
  }
494
 
 
495
 
  bool getInternalTmpTable() const
496
 
  {
497
 
    return internal_tmp_table;
498
 
  }
499
 
 
500
 
  plugin::StorageEngine *getDbType() const
501
 
  {
502
 
    return db_type;
503
 
  }
504
 
 
505
 
  TableList *getEmbedding() const
506
 
  {
507
 
    return embedding;
508
 
  }
509
 
 
510
 
  List<TableList> *getJoinList() const
511
 
  {
512
 
    return join_list;
513
 
  }
514
 
 
515
 
  nested_join_st *getNestedJoin() const
516
 
  {
517
 
    return nested_join;
518
 
  }
519
 
 
520
 
  table_map getDepTables() const
521
 
  {
522
 
    return dep_tables;
523
 
  }
524
 
 
525
 
  table_map getOnExprDepTables() const
526
 
  {
527
 
    return on_expr_dep_tables;
528
 
  }
529
 
 
530
 
  void unlock_table_name();
531
 
  void unlock_table_names(TableList *last_table= NULL);
532
 
 
533
 
private:
534
 
 
535
 
  table_map dep_tables; ///< tables the table depends on
536
 
  table_map on_expr_dep_tables; ///< tables on expression depends on
537
 
  nested_join_st *nested_join; ///< if the element is a nested join
538
 
  TableList *embedding; ///< nested join containing the table
539
 
  List<TableList> *join_list; ///< join list the table belongs to
540
 
  plugin::StorageEngine *db_type; ///< table_type for handler
541
 
  char timestamp_buffer[20]; ///< buffer for timestamp (19+1)
542
 
  bool internal_tmp_table;
543
 
  /** true if an alias for this table was specified in the SQL. */
544
 
  bool is_alias;
545
 
 
546
 
  /** 
547
 
   * true if the table is referred to in the statement using a fully
548
 
   * qualified name (<db_name>.<table_name>).
549
 
   */
550
 
  bool is_fqtn;
551
387
  /**
552
 
   * This TableList object corresponds to the table to be created
553
 
   * so it is possible that it does not exist (used in CREATE TABLE
554
 
   * ... SELECT implementation).
 
388
   * Creates a table definition cache key for this table entry.
 
389
   *
 
390
   * @param[out] Create key here (must be of size MAX_DBKEY_LENGTH)
 
391
   *
 
392
   * @note
 
393
   *
 
394
   * The table cache_key is created from:
 
395
   *   db_name + \0
 
396
   *   table_name + \0
 
397
   *
 
398
   * if the table is a tmp table, we add the following to make each tmp table
 
399
   * unique on the slave:
 
400
   *
 
401
   * 4 bytes for master thread id
 
402
   * 4 bytes pseudo thread id
 
403
   *
 
404
   * @retval
 
405
   *  Length of key
555
406
   */
556
 
  bool create;
557
 
 
 
407
  uint32_t create_table_def_key(char *key);
558
408
};
559
409
 
560
410
void close_thread_tables(Session *session);