1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2009 Sun Microsystems
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.
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.
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
22
This is a "work in progress". The concept needs to be replicated throughout
23
the code, but we will start with baby steps for the moment. To not incur
24
cost until we are complete, for the moment it will do no allocation.
26
This is mainly here so that it can be used in the SE interface for
29
This will replace Table_ident.
32
#ifndef DRIZZLED_SCHEMA_IDENTIFIER_H
33
#define DRIZZLED_SCHEMA_IDENTIFIER_H
35
#include <drizzled/enum.h>
36
#include "drizzled/definitions.h"
37
#include "drizzled/message/table.pb.h"
50
class SchemaIdentifier
56
// @note this should be changed to protected once Session contains an
57
// 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);
75
virtual ~SchemaIdentifier()
78
virtual const std::string &getSQLPath();
79
const std::string &getPath();
81
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)
96
output << "SchemaIdentifier:(";
97
output << identifier.db;
99
output << identifier.getPath();
102
return output; // for multiple << operators.
105
friend bool operator==(SchemaIdentifier &left, SchemaIdentifier &right)
107
if (left.lower_db == right.lower_db)
117
typedef std::list <SchemaIdentifier> SchemaIdentifierList;
119
} /* namespace drizzled */
121
#endif /* DRIZZLED_SCHEMA_IDENTIFIER_H */