29
29
This will replace Table_ident.
32
#ifndef DRIZZLED_SCHEMA_IDENTIFIER_H
33
#define DRIZZLED_SCHEMA_IDENTIFIER_H
32
#ifndef DRIZZLED_IDENTIFIER_SCHEMA_H
33
#define DRIZZLED_IDENTIFIER_SCHEMA_H
35
35
#include <drizzled/enum.h>
36
36
#include "drizzled/definitions.h"
45
45
#include <functional>
46
46
#include <iostream>
48
#include <boost/algorithm/string.hpp>
48
50
namespace drizzled {
52
static std::string catalog("local");
50
54
class SchemaIdentifier
53
57
std::string db_path;
56
61
// @note this should be changed to protected once Session contains an
57
62
// identifier for current db.
60
const std::string &getLower()
66
SchemaIdentifier(const std::string &db_arg) :
69
lower_db.append(db_arg);
71
std::transform(lower_db.begin(), lower_db.end(),
72
lower_db.begin(), ::tolower);
66
SchemaIdentifier(const std::string &db_arg);
75
68
virtual ~SchemaIdentifier()
78
71
virtual const std::string &getSQLPath();
79
const std::string &getPath();
72
const std::string &getPath() const;
81
74
const std::string &getSchemaName() const
87
bool compare(std::string arg);
89
friend bool operator<(SchemaIdentifier &left, SchemaIdentifier &right)
91
return left.lower_db < right.lower_db;
94
friend std::ostream& operator<<(std::ostream& output, SchemaIdentifier &identifier)
79
const std::string &getCatalogName() const
85
bool compare(const std::string &arg) const;
87
friend bool operator<(const SchemaIdentifier &left, const SchemaIdentifier &right)
89
return boost::algorithm::to_upper_copy(left.getSchemaName()) < boost::algorithm::to_upper_copy(right.getSchemaName());
92
friend std::ostream& operator<<(std::ostream& output,
93
SchemaIdentifier &identifier)
96
95
output << "SchemaIdentifier:(";
96
output << identifier.catalog;
97
98
output << identifier.db;
99
100
output << identifier.getPath();
102
103
return output; // for multiple << operators.
105
friend bool operator==(SchemaIdentifier &left, SchemaIdentifier &right)
106
friend bool operator==(const SchemaIdentifier &left,
107
const SchemaIdentifier &right)
107
if (left.lower_db == right.lower_db)
109
return boost::iequals(left.getSchemaName(), right.getSchemaName());
117
typedef std::list <SchemaIdentifier> SchemaIdentifierList;
114
typedef std::vector <SchemaIdentifier> SchemaIdentifiers;
119
116
} /* namespace drizzled */
121
#endif /* DRIZZLED_SCHEMA_IDENTIFIER_H */
118
#endif /* DRIZZLED_IDENTIFIER_SCHEMA_H */