~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_list.h

  • Committer: Brian Aker
  • Date: 2010-11-08 18:54:26 UTC
  • mto: (1921.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 1916.
  • Revision ID: brian@tangent.org-20101108185426-fymkf2xnelupf11x
Rename lock methods to be style + well make sense.

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),
98
97
    join_using_fields(NULL),
99
98
    join_columns(NULL),
100
99
    next_name_resolution_table(NULL),
105
104
    select_lex(NULL),
106
105
    next_leaf(NULL),
107
106
    outer_join(0),
108
 
    shared(0),
109
 
    i_s_requested_object(0),
110
107
    db_length(0),
111
108
    table_name_length(0),
112
109
    dep_tables(0),
118
115
    internal_tmp_table(false),
119
116
    is_alias(false),
120
117
    is_fqtn(false),
121
 
    has_db_lookup_value(false),
122
 
    has_table_lookup_value(false)
 
118
    create(false)
123
119
  {}
124
120
 
125
121
  /**
133
129
  TableList *next_global; 
134
130
  TableList **prev_global;
135
131
 
 
132
private:
136
133
  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
 
137
151
  const char *alias;
 
152
 
 
153
private:
138
154
  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
 
139
172
  char *option; ///< Used by cache index
140
173
  Item *on_expr; ///< Used with outer join
141
174
  Table *table; ///< opened table
170
203
  bool force_index; ///< prefer index over table scan
171
204
  bool ignore_leaves; ///< preload only non-leaf nodes
172
205
 
173
 
  /**
174
 
   * This TableList object corresponds to the table to be created
175
 
   * so it is possible that it does not exist (used in CREATE TABLE
176
 
   * ... SELECT implementation).
177
 
   */
178
 
  bool create;
 
206
  /*
 
207
    is the table a cartesian join, assumption is yes unless "solved"
 
208
  */
 
209
  bool isCartesian() const;
179
210
 
180
211
  /** Field names in a USING clause for JOIN ... USING. */
181
212
  List<String> *join_using_fields;
212
243
  TableList *next_leaf;
213
244
  thr_lock_type lock_type;
214
245
  uint32_t outer_join; ///< Which join type
215
 
  uint32_t shared; ///<Used in multi-upd
216
 
  uint32_t i_s_requested_object;
217
246
  size_t db_length;
218
247
  size_t table_name_length;
219
 
  table_map dep_tables; ///< tables the table depends on
220
 
  table_map on_expr_dep_tables; ///< tables on expression depends on
221
 
  nested_join_st *nested_join; ///< if the element is a nested join
222
 
  TableList *embedding; ///< nested join containing the table
223
 
  List<TableList> *join_list; ///< join list the table belongs to
224
 
  plugin::StorageEngine *db_type; ///< table_type for handler
225
 
  char timestamp_buffer[20]; ///< buffer for timestamp (19+1)
226
 
  bool internal_tmp_table;
227
 
  /** true if an alias for this table was specified in the SQL. */
228
 
  bool is_alias;
229
 
  /** 
230
 
   * true if the table is referred to in the statement using a fully
231
 
   * qualified name (<db_name>.<table_name>).
232
 
   */
233
 
  bool is_fqtn;
234
 
 
235
 
  bool has_db_lookup_value;
236
 
  bool has_table_lookup_value;
237
248
 
238
249
  void set_underlying_merge();
239
250
  bool setup_underlying(Session *session);
386
397
   *   true found and reported an error.
387
398
   */
388
399
  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;
389
551
  /**
390
 
   * Creates a table definition cache key for this table entry.
391
 
   *
392
 
   * @param[out] Create key here (must be of size MAX_DBKEY_LENGTH)
393
 
   *
394
 
   * @note
395
 
   *
396
 
   * The table cache_key is created from:
397
 
   *   db_name + \0
398
 
   *   table_name + \0
399
 
   *
400
 
   * if the table is a tmp table, we add the following to make each tmp table
401
 
   * unique on the slave:
402
 
   *
403
 
   * 4 bytes for master thread id
404
 
   * 4 bytes pseudo thread id
405
 
   *
406
 
   * @retval
407
 
   *  Length of key
 
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).
408
555
   */
409
 
  uint32_t create_table_def_key(char *key);
 
556
  bool create;
 
557
 
410
558
};
411
559
 
412
560
void close_thread_tables(Session *session);