~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/table.h

  • Committer: Brian Aker
  • Date: 2011-01-17 23:44:48 UTC
  • mfrom: (2088.1.5 drizzle-build)
  • Revision ID: brian@tangent.org-20110117234448-0tt6rd6fxa3csdaf
Rollup of all changes for identifier/error

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
#include <boost/functional/hash.hpp>
52
52
 
53
53
namespace drizzled {
54
 
 
55
54
class Table;
56
55
 
57
 
class TableIdentifier : public SchemaIdentifier
 
56
namespace identifier {
 
57
 
 
58
class Table : public identifier::Schema
58
59
{
59
60
public:
60
61
  typedef message::Table::TableType Type;
61
 
  typedef std::vector <TableIdentifier> vector;
62
 
  typedef const TableIdentifier& const_reference;
63
 
  typedef TableIdentifier& reference;
 
62
  typedef std::vector <Table> vector;
 
63
  typedef const Table& const_reference;
 
64
  typedef Table& reference;
64
65
 
65
66
  class Key
66
67
  {
129
130
  }
130
131
 
131
132
public:
132
 
  TableIdentifier(const Table &table);
 
133
 
 
134
  Table(const drizzled::Table &table);
133
135
                   
134
 
  TableIdentifier( const SchemaIdentifier &schema,
135
 
                   const std::string &table_name_arg,
136
 
                   Type tmp_arg= message::Table::STANDARD) :
137
 
    SchemaIdentifier(schema),
138
 
    type(tmp_arg),
139
 
    table_name(table_name_arg)
140
 
  { 
141
 
    init();
142
 
  }
143
 
 
144
 
  TableIdentifier( const std::string &db_arg,
145
 
                   const std::string &table_name_arg,
146
 
                   Type tmp_arg= message::Table::STANDARD) :
147
 
    SchemaIdentifier(db_arg),
148
 
    type(tmp_arg),
149
 
    table_name(table_name_arg)
150
 
  { 
151
 
    init();
152
 
  }
153
 
 
154
 
  TableIdentifier( const std::string &schema_name_arg,
 
136
  Table(const identifier::Schema &schema,
 
137
        const std::string &table_name_arg,
 
138
        Type tmp_arg= message::Table::STANDARD) :
 
139
    Schema(schema),
 
140
    type(tmp_arg),
 
141
    table_name(table_name_arg)
 
142
  { 
 
143
    init();
 
144
  }
 
145
 
 
146
  Table( const std::string &db_arg,
 
147
                   const std::string &table_name_arg,
 
148
                   Type tmp_arg= message::Table::STANDARD) :
 
149
    Schema(db_arg),
 
150
    type(tmp_arg),
 
151
    table_name(table_name_arg)
 
152
  { 
 
153
    init();
 
154
  }
 
155
 
 
156
  Table( const std::string &schema_name_arg,
155
157
                   const std::string &table_name_arg,
156
158
                   const std::string &path_arg ) :
157
 
    SchemaIdentifier(schema_name_arg),
 
159
    Schema(schema_name_arg),
158
160
    type(message::Table::TEMPORARY),
159
161
    path(path_arg),
160
162
    table_name(table_name_arg)
162
164
    init();
163
165
  }
164
166
 
165
 
  using SchemaIdentifier::compare;
 
167
  using Schema::compare;
166
168
 
167
169
  bool isTmp() const
168
170
  {
213
215
 
214
216
  void copyToTableMessage(message::Table &message) const;
215
217
 
216
 
  friend bool operator<(TableIdentifier::const_reference left, TableIdentifier::const_reference right)
 
218
  friend bool operator<(Table::const_reference left, Table::const_reference right)
217
219
  {
218
220
    if (left.getKey() < right.getKey())
219
221
    {
223
225
    return false;
224
226
  }
225
227
 
226
 
  friend std::ostream& operator<<(std::ostream& output, TableIdentifier::const_reference identifier)
 
228
  friend std::ostream& operator<<(std::ostream& output, Table::const_reference identifier)
227
229
  {
228
230
    const char *type_str;
229
231
 
230
 
    output << "TableIdentifier:(";
 
232
    output << "Table:(";
231
233
    output <<  identifier.getSchemaName();
232
234
    output << ", ";
233
235
    output << identifier.getTableName();
258
260
    return output;  // for multiple << operators.
259
261
  }
260
262
 
261
 
  friend bool operator==(TableIdentifier::const_reference left, TableIdentifier::const_reference right)
 
263
  friend bool operator==(Table::const_reference left, Table::const_reference right)
262
264
  {
263
265
    if (left.getHashValue() == right.getHashValue())
264
266
    {
288
290
  }
289
291
};
290
292
 
291
 
std::size_t hash_value(TableIdentifier const& b);
292
 
std::size_t hash_value(TableIdentifier::Key const& b);
 
293
std::size_t hash_value(Table const& b);
 
294
std::size_t hash_value(Table::Key const& b);
293
295
 
 
296
} /* namespace identifier */
294
297
} /* namespace drizzled */
295
298
 
296
299
#endif /* DRIZZLED_IDENTIFIER_TABLE_H */