~drizzle-trunk/drizzle/development

1502.1.19 by Brian Aker
Adds concept of table owned TableShare.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2010 Brian Aker
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 */
20
21
/* Structs that defines the Table */
22
1843.8.4 by Brian Aker
Committing refactor of table out (this is part of the concurrency work).
23
#ifndef DRIZZLED_TABLE_INSTANCE_H
24
#define DRIZZLED_TABLE_INSTANCE_H
1502.1.19 by Brian Aker
Adds concept of table owned TableShare.
25
26
namespace drizzled
27
{
28
1843.8.4 by Brian Aker
Committing refactor of table out (this is part of the concurrency work).
29
namespace table
30
{
31
32
class Instance : public Table
1502.1.19 by Brian Aker
Adds concept of table owned TableShare.
33
{
1827.2.3 by Brian Aker
Switches table_share_instance to be a member of table, not table_share
34
  TableShare _share;
1835.1.3 by Brian Aker
Fix variable such that we no longer pass share to varstring on creation.
35
  bool _has_variable_width;
1532.1.1 by Brian Aker
Merge of change to flip table instance to be share instance
36
1502.1.19 by Brian Aker
Adds concept of table owned TableShare.
37
public:
1843.8.5 by Brian Aker
Added concurrent type.
38
  Instance() :
39
    _share(message::Table::INTERNAL),
1835.1.3 by Brian Aker
Fix variable such that we no longer pass share to varstring on creation.
40
    _has_variable_width(false)
1532.1.1 by Brian Aker
Merge of change to flip table instance to be share instance
41
  {
42
  }
43
1878.5.1 by Brian Aker
Update instance for handling construction of virtual_tmp
44
  Instance(Session *session, List<CreateField> &field_list);
45
1827.2.3 by Brian Aker
Switches table_share_instance to be a member of table, not table_share
46
  TableShare *getMutableShare(void)
47
  {
48
    return &_share;
49
  }
50
1843.8.7 by Brian Aker
Add assert to setShare() for instance tables (we should never change out a
51
  void setShare(TableShare *)
52
  {
53
    assert(0);
54
  }
55
1827.2.3 by Brian Aker
Switches table_share_instance to be a member of table, not table_share
56
  const TableShare *getShare(void) const
57
  {
58
    return &_share;
1532.1.1 by Brian Aker
Merge of change to flip table instance to be share instance
59
  }
60
1859.2.10 by Brian Aker
Move all of the table bits out so that Table is an abstract class.
61
  bool hasShare() const { return true; }
62
1903.1.1 by Brian Aker
Merge of partial set of patches for locks.
63
  void release() {};
64
1835.1.3 by Brian Aker
Fix variable such that we no longer pass share to varstring on creation.
65
  bool hasVariableWidth() const
66
  {
67
    return _has_variable_width;
68
  }
69
1843.8.3 by Brian Aker
Break out table types (first pass).
70
  bool create_myisam_tmp_table(KeyInfo *keyinfo,
71
                               MI_COLUMNDEF *start_recinfo,
72
                               MI_COLUMNDEF **recinfo,
73
                               uint64_t options);
74
  void setup_tmp_table_column_bitmaps();
75
  bool open_tmp_table();
76
1835.1.3 by Brian Aker
Fix variable such that we no longer pass share to varstring on creation.
77
  void setVariableWidth()
78
  {
79
    _has_variable_width= true;
80
  }
81
1859.2.1 by Brian Aker
Small moveable.
82
  ~Instance();
1502.1.19 by Brian Aker
Adds concept of table owned TableShare.
83
};
84
1843.8.4 by Brian Aker
Committing refactor of table out (this is part of the concurrency work).
85
} /* namespace table */
1502.1.19 by Brian Aker
Adds concept of table owned TableShare.
86
} /* namespace drizzled */
87
1843.8.4 by Brian Aker
Committing refactor of table out (this is part of the concurrency work).
88
#endif /* DRIZZLED_TABLE_INSTANCE_H */