~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_share.h

Merged trunk and use-std-unordred.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
#include <string>
30
30
 
 
31
#include <drizzled/unordered_map.h>
 
32
 
31
33
#include "drizzled/typelib.h"
32
34
#include "drizzled/my_hash.h"
33
35
#include "drizzled/memory/root.h"
36
38
namespace drizzled
37
39
{
38
40
 
39
 
typedef drizzled::hash_map<std::string, TableShare *> TableDefinitionCache;
 
41
typedef unordered_map<std::string, TableShare *> TableDefinitionCache;
40
42
 
41
43
const static std::string STANDARD_STRING("STANDARD");
42
44
const static std::string TEMPORARY_STRING("TEMPORARY");
65
67
    max_rows(0),
66
68
    table_proto(NULL),
67
69
    storage_engine(NULL),
68
 
    tmp_table(STANDARD_TABLE),
 
70
    tmp_table(message::Table::STANDARD),
69
71
    ref_count(0),
70
72
    null_bytes(0),
71
73
    last_null_bit_pos(0),
126
128
    max_rows(0),
127
129
    table_proto(NULL),
128
130
    storage_engine(NULL),
129
 
    tmp_table(STANDARD_TABLE),
 
131
    tmp_table(message::Table::STANDARD),
130
132
    ref_count(0),
131
133
    null_bytes(0),
132
134
    last_null_bit_pos(0),
213
215
    return table_name.str;
214
216
  }
215
217
 
 
218
  const char *getPath() const
 
219
  {
 
220
    return path.str;
 
221
  }
 
222
 
216
223
  const std::string &getTableName(std::string &name_arg) const
217
224
  {
218
225
    name_arg.clear();
337
344
  {
338
345
    return storage_engine;
339
346
  }
340
 
  enum tmp_table_type tmp_table;
 
347
 
 
348
  TableIdentifier::Type tmp_table;
341
349
 
342
350
  uint32_t ref_count;       /* How many Table objects uses this */
343
351
  uint32_t getTableCount()
499
507
    memset(this, 0, sizeof(TableShare));
500
508
    memory::init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
501
509
    table_category=         TABLE_CATEGORY_TEMPORARY;
502
 
    tmp_table=              INTERNAL_TMP_TABLE;
 
510
    tmp_table=              message::Table::INTERNAL;
503
511
    db.str=                 (char*) key;
504
512
    db.length=           strlen(key);
505
513
    table_cache_key.str=    (char*) key;
533
541
      If someone is waiting for this to be deleted, inform it about this.
534
542
      Don't do a delete until we know that no one is refering to this anymore.
535
543
    */
536
 
    if (tmp_table == STANDARD_TABLE)
 
544
    if (tmp_table == message::Table::STANDARD)
537
545
    {
538
546
      /* share->mutex is locked in release_table_share() */
539
547
      while (waiting_on_cond)
618
626
  static TableShare *getShare(Session *session, 
619
627
                              TableList *table_list, char *key,
620
628
                              uint32_t key_length, uint32_t, int *error);
 
629
 
 
630
  friend std::ostream& operator<<(std::ostream& output, const TableShare &share)
 
631
  {
 
632
    output << "TableShare:(";
 
633
    output <<  share.getSchemaName();
 
634
    output << ", ";
 
635
    output << share.getTableName();
 
636
    output << ", ";
 
637
    output << share.getTableTypeAsString();
 
638
    output << ", ";
 
639
    output << share.getPath();
 
640
    output << ")";
 
641
 
 
642
    return output;  // for multiple << operators.
 
643
  }
621
644
};
622
645
 
623
646
} /* namespace drizzled */