2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
4
* Copyright (C) 2010 Brian Aker
5
* Copyright (C) 2009 Sun Microsystems
5
* Copyright (C) 2009 Sun Microsystems, Inc.
7
7
* This program is free software; you can redistribute it and/or modify
8
8
* it under the terms of the GNU General Public License as published by
51
49
#include <boost/functional/hash.hpp>
51
#include "drizzled/visibility.h"
53
53
namespace drizzled {
57
class TableIdentifier : public SchemaIdentifier
56
namespace identifier {
58
class DRIZZLED_API Table : public Schema
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;
132
TableIdentifier(const Table &table);
135
Table(const drizzled::Table &table);
134
TableIdentifier( const SchemaIdentifier &schema,
135
const std::string &table_name_arg,
136
Type tmp_arg= message::Table::STANDARD) :
137
SchemaIdentifier(schema),
139
table_name(table_name_arg)
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),
149
table_name(table_name_arg)
154
TableIdentifier( const std::string &schema_name_arg,
137
Table(const identifier::Schema &schema,
138
const std::string &table_name_arg,
139
Type tmp_arg= message::Table::STANDARD) :
142
table_name(table_name_arg)
147
Table( const std::string &db_arg,
148
const std::string &table_name_arg,
149
Type tmp_arg= message::Table::STANDARD) :
152
table_name(table_name_arg)
157
Table( const std::string &schema_name_arg,
155
158
const std::string &table_name_arg,
156
159
const std::string &path_arg ) :
157
SchemaIdentifier(schema_name_arg),
160
Schema(schema_name_arg),
158
161
type(message::Table::TEMPORARY),
160
163
table_name(table_name_arg)
214
219
void copyToTableMessage(message::Table &message) const;
216
friend bool operator<(TableIdentifier::const_reference left, TableIdentifier::const_reference right)
221
friend bool operator<(Table::const_reference left, Table::const_reference right)
218
223
if (left.getKey() < right.getKey())
226
friend std::ostream& operator<<(std::ostream& output, TableIdentifier::const_reference identifier)
228
const char *type_str;
230
output << "TableIdentifier:(";
231
output << identifier.getSchemaName();
233
output << identifier.getTableName();
236
switch (identifier.type) {
237
case message::Table::STANDARD:
238
type_str= "standard";
240
case message::Table::INTERNAL:
241
type_str= "internal";
243
case message::Table::TEMPORARY:
244
type_str= "temporary";
246
case message::Table::FUNCTION:
247
type_str= "function";
253
output << identifier.path;
255
output << identifier.getHashValue();
258
return output; // for multiple << operators.
261
friend bool operator==(TableIdentifier::const_reference left, TableIdentifier::const_reference right)
231
friend bool operator==(Table::const_reference left, Table::const_reference right)
263
233
if (left.getHashValue() == right.getHashValue())
291
std::size_t hash_value(TableIdentifier const& b);
292
std::size_t hash_value(TableIdentifier::Key const& b);
261
std::ostream& operator<<(std::ostream& output, Table::const_reference identifier);
262
std::size_t hash_value(Table const& b);
263
std::size_t hash_value(Table::Key const& b);
265
} /* namespace identifier */
294
266
} /* namespace drizzled */
296
268
#endif /* DRIZZLED_IDENTIFIER_TABLE_H */