~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_list.h

Merge in Stewart's FK work

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
21
21
#ifndef DRIZZLED_TABLE_LIST_H
22
22
#define DRIZZLED_TABLE_LIST_H
23
23
 
24
 
#include <drizzled/nested_join.h>
25
24
#include <drizzled/table.h>
26
25
 
27
26
namespace drizzled
42
41
  class StorageEngine;
43
42
}
44
43
 
 
44
struct nested_join_st;
 
45
 
45
46
/**
46
47
 * A Table referenced in the FROM clause.
47
48
 *
127
128
  /** link in a global list of all queries tables */
128
129
  TableList *next_global; 
129
130
  TableList **prev_global;
130
 
 
131
 
private:
132
131
  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
132
  const char *alias;
151
 
 
152
 
private:
153
 
  const char *table_name;
154
 
 
155
 
public:
156
 
  const char *getTableName()
157
 
  {
158
 
    return table_name;
159
 
  }
160
 
 
161
 
  void setTableName(const char *arg)
162
 
  {
163
 
    table_name= arg;
164
 
  }
165
 
 
 
133
  char *table_name;
166
134
  char *option; ///< Used by cache index
167
135
  Item *on_expr; ///< Used with outer join
168
136
  Table *table; ///< opened table
391
359
   *   true found and reported an error.
392
360
   */
393
361
  bool process_index_hints(Table *table);
 
362
  /**
 
363
   * Creates a table definition cache key for this table entry.
 
364
   *
 
365
   * @param[out] Create key here (must be of size MAX_DBKEY_LENGTH)
 
366
   *
 
367
   * @note
 
368
   *
 
369
   * The table cache_key is created from:
 
370
   *   db_name + \0
 
371
   *   table_name + \0
 
372
   *
 
373
   * if the table is a tmp table, we add the following to make each tmp table
 
374
   * unique on the slave:
 
375
   *
 
376
   * 4 bytes for master thread id
 
377
   * 4 bytes pseudo thread id
 
378
   *
 
379
   * @retval
 
380
   *  Length of key
 
381
   */
 
382
  uint32_t create_table_def_key(char *key);
394
383
 
395
384
  friend std::ostream& operator<<(std::ostream& output, const TableList &list)
396
385
  {
456
445
    embedding= in_embedding;
457
446
  }
458
447
 
459
 
  void setNestedJoin(NestedJoin *in_nested_join)
 
448
  void setNestedJoin(nested_join_st *in_nested_join)
460
449
  {
461
450
    nested_join= in_nested_join;
462
451
  }
506
495
    return join_list;
507
496
  }
508
497
 
509
 
  NestedJoin *getNestedJoin() const
 
498
  nested_join_st *getNestedJoin() const
510
499
  {
511
500
    return nested_join;
512
501
  }
521
510
    return on_expr_dep_tables;
522
511
  }
523
512
 
524
 
  void unlock_table_name();
525
 
  void unlock_table_names(TableList *last_table= NULL);
526
 
 
527
513
private:
 
514
 
528
515
  table_map dep_tables; ///< tables the table depends on
529
516
  table_map on_expr_dep_tables; ///< tables on expression depends on
530
 
  NestedJoin *nested_join; ///< if the element is a nested join
 
517
  nested_join_st *nested_join; ///< if the element is a nested join
531
518
  TableList *embedding; ///< nested join containing the table
532
519
  List<TableList> *join_list; ///< join list the table belongs to
533
520
  plugin::StorageEngine *db_type; ///< table_type for handler
 
521
  char timestamp_buffer[20]; ///< buffer for timestamp (19+1)
534
522
  bool internal_tmp_table;
535
 
 
536
523
  /** true if an alias for this table was specified in the SQL. */
537
524
  bool is_alias;
538
525
 
541
528
   * qualified name (<db_name>.<table_name>).
542
529
   */
543
530
  bool is_fqtn;
544
 
 
545
531
  /**
546
532
   * This TableList object corresponds to the table to be created
547
533
   * so it is possible that it does not exist (used in CREATE TABLE