49
51
#include <boost/functional/hash.hpp>
51
#include "drizzled/visibility.h"
53
53
namespace drizzled {
56
namespace identifier {
58
class DRIZZLED_API Table : public Schema
57
class TableIdentifier : public SchemaIdentifier
61
60
typedef message::Table::TableType Type;
62
typedef std::vector <Table> vector;
63
typedef const Table& const_reference;
64
typedef Table& reference;
61
typedef std::vector <TableIdentifier> vector;
62
typedef const TableIdentifier& const_reference;
63
typedef TableIdentifier& reference;
135
Table(const drizzled::Table &table);
132
TableIdentifier(const Table &table);
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,
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,
158
155
const std::string &table_name_arg,
159
156
const std::string &path_arg ) :
160
Schema(schema_name_arg),
157
SchemaIdentifier(schema_name_arg),
161
158
type(message::Table::TEMPORARY),
163
160
table_name(table_name_arg)
219
214
void copyToTableMessage(message::Table &message) const;
221
friend bool operator<(Table::const_reference left, Table::const_reference right)
216
friend bool operator<(TableIdentifier::const_reference left, TableIdentifier::const_reference right)
223
218
if (left.getKey() < right.getKey())
231
friend bool operator==(Table::const_reference left, Table::const_reference right)
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)
233
263
if (left.getHashValue() == right.getHashValue())
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);
291
std::size_t hash_value(TableIdentifier const& b);
292
std::size_t hash_value(TableIdentifier::Key const& b);
265
} /* namespace identifier */
266
294
} /* namespace drizzled */
268
296
#endif /* DRIZZLED_IDENTIFIER_TABLE_H */