1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2009 Sun Microsystems
4
* Copyright (C) 2009 Sun Microsystems, Inc.
6
6
* This program is free software; you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
29
29
This will replace Table_ident.
32
34
#ifndef DRIZZLED_IDENTIFIER_SCHEMA_H
33
35
#define DRIZZLED_IDENTIFIER_SCHEMA_H
35
37
#include <drizzled/enum.h>
36
#include "drizzled/definitions.h"
37
#include "drizzled/message/table.pb.h"
38
#include <drizzled/definitions.h>
39
#include <drizzled/message/table.pb.h>
40
#include <drizzled/catalog/local.h>
38
41
#include <string.h>
40
43
#include <assert.h>
48
51
#include <boost/algorithm/string.hpp>
53
#include <drizzled/visibility.h>
50
55
namespace drizzled {
52
static std::string catalog("local");
54
class SchemaIdentifier
56
namespace identifier {
58
class DRIZZLED_API Schema : public Identifier
57
61
std::string db_path;
61
typedef std::vector <SchemaIdentifier> vector;
62
typedef const SchemaIdentifier& const_reference;
64
SchemaIdentifier(const std::string &db_arg);
66
virtual ~SchemaIdentifier()
64
typedef std::vector <Schema> vector;
65
typedef const Schema& const_reference;
67
Schema(const std::string &db_arg);
69
72
virtual void getSQLPath(std::string &arg) const;
70
74
const std::string &getPath() const;
72
76
const std::string &getSchemaName() const
77
const std::string &getCatalogName() const
81
const std::string &getCatalogName() const;
82
83
virtual bool isValid() const;
85
inline virtual bool isSystem() const
84
90
bool compare(const std::string &arg) const;
85
bool compare(SchemaIdentifier::const_reference) const;
91
bool compare(Schema::const_reference) const;
87
friend bool operator<(SchemaIdentifier::const_reference left, SchemaIdentifier::const_reference right)
93
friend bool operator<(Schema::const_reference left, Schema::const_reference right)
89
95
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::const_reference identifier)
95
output << "SchemaIdentifier:(";
96
output << identifier.catalog;
98
output << identifier.db;
100
output << identifier.getPath();
103
return output; // for multiple << operators.
106
friend bool operator==(SchemaIdentifier::const_reference left,
107
SchemaIdentifier::const_reference right)
98
friend bool operator==(Schema::const_reference left,
99
Schema::const_reference right)
109
101
return boost::iequals(left.getSchemaName(), right.getSchemaName());
105
std::ostream& operator<<(std::ostream& output, const Schema&identifier);
108
} /* namespace identifier */
114
109
} /* namespace drizzled */
116
111
#endif /* DRIZZLED_IDENTIFIER_SCHEMA_H */