~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/schema.h

  • Committer: Lee Bieber
  • Date: 2011-01-05 19:01:18 UTC
  • mfrom: (2053.2.3 trunk-bug-696188)
  • Revision ID: kalebral@gmail.com-20110105190118-kiq5sez67rvi4kl7
Merge Andrew - fix bug 696188: error handling for drizzle client stdin replacement problems

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
  This will replace Table_ident.
30
30
  */
31
31
 
32
 
 
33
 
 
34
32
#ifndef DRIZZLED_IDENTIFIER_SCHEMA_H
35
33
#define DRIZZLED_IDENTIFIER_SCHEMA_H
36
34
 
37
35
#include <drizzled/enum.h>
38
 
#include <drizzled/definitions.h>
39
 
#include <drizzled/message/table.pb.h>
40
 
#include <drizzled/catalog/local.h>
 
36
#include "drizzled/definitions.h"
 
37
#include "drizzled/message/table.pb.h"
41
38
#include <string.h>
42
39
 
43
40
#include <assert.h>
50
47
 
51
48
#include <boost/algorithm/string.hpp>
52
49
 
53
 
#include <drizzled/visibility.h>
54
 
 
55
50
namespace drizzled {
56
 
namespace identifier {
57
 
 
58
 
class DRIZZLED_API Schema : public Identifier
 
51
 
 
52
static std::string catalog("local");
 
53
 
 
54
class SchemaIdentifier : public Identifier
59
55
{
60
56
  std::string db;
61
57
  std::string db_path;
 
58
  std::string catalog;
62
59
 
63
60
public:
64
 
  typedef std::vector <Schema> vector;
65
 
  typedef const Schema& const_reference;
66
 
 
67
 
  Schema(const std::string &db_arg);
68
 
 
69
 
  virtual ~Schema()
 
61
  typedef std::vector <SchemaIdentifier> vector;
 
62
  typedef const SchemaIdentifier& const_reference;
 
63
 
 
64
  SchemaIdentifier(const std::string &db_arg);
 
65
 
 
66
  virtual ~SchemaIdentifier()
70
67
  { }
71
68
 
72
69
  virtual void getSQLPath(std::string &arg) const;
78
75
    return db;
79
76
  }
80
77
 
81
 
  const std::string &getCatalogName() const;
 
78
  const std::string &getCatalogName() const
 
79
  {
 
80
    return catalog;
 
81
  }
82
82
 
83
83
  virtual bool isValid() const;
84
84
 
85
 
  inline virtual bool isSystem() const
86
 
  {
87
 
    return false;
88
 
  }
89
 
 
90
85
  bool compare(const std::string &arg) const;
91
 
  bool compare(Schema::const_reference) const;
 
86
  bool compare(SchemaIdentifier::const_reference) const;
92
87
 
93
 
  friend bool operator<(Schema::const_reference left, Schema::const_reference right)
 
88
  friend bool operator<(SchemaIdentifier::const_reference left, SchemaIdentifier::const_reference right)
94
89
  {
95
90
    return  boost::algorithm::to_upper_copy(left.getSchemaName()) < boost::algorithm::to_upper_copy(right.getSchemaName());
96
91
  }
97
92
 
98
 
  friend bool operator==(Schema::const_reference left,
99
 
                         Schema::const_reference right)
 
93
  friend std::ostream& operator<<(std::ostream& output,
 
94
                                  SchemaIdentifier::const_reference identifier)
 
95
  {
 
96
    output << "SchemaIdentifier:(";
 
97
    output <<  identifier.catalog;
 
98
    output << ", ";
 
99
    output <<  identifier.db;
 
100
    output << ", ";
 
101
    output << identifier.getPath();
 
102
    output << ")";
 
103
 
 
104
    return output;  // for multiple << operators.
 
105
  }
 
106
 
 
107
  friend bool operator==(SchemaIdentifier::const_reference left,
 
108
                         SchemaIdentifier::const_reference right)
100
109
  {
101
110
    return boost::iequals(left.getSchemaName(), right.getSchemaName());
102
111
  }
103
112
};
104
113
 
105
 
std::ostream& operator<<(std::ostream& output, const Schema&identifier);
106
 
 
107
 
 
108
 
} /* namespace identifier */
 
114
 
109
115
} /* namespace drizzled */
110
116
 
111
117
#endif /* DRIZZLED_IDENTIFIER_SCHEMA_H */