~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/schema.h

  • Committer: Brian Aker
  • Date: 2011-02-21 17:37:00 UTC
  • mto: (2192.1.1 drizzle-staging)
  • mto: This revision was merged to the branch mainline in revision 2193.
  • Revision ID: brian@tangent.org-20110221173700-6wdfbxm60zq9q9se
Merge in change from REPLICATION to REPLICATE as keyword.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems
 
4
 *  Copyright (C) 2009 Sun Microsystems, Inc.
5
5
 *
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.
30
30
  */
31
31
 
 
32
 
 
33
 
32
34
#ifndef DRIZZLED_IDENTIFIER_SCHEMA_H
33
35
#define DRIZZLED_IDENTIFIER_SCHEMA_H
34
36
 
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>
39
42
 
40
43
#include <assert.h>
47
50
 
48
51
#include <boost/algorithm/string.hpp>
49
52
 
 
53
#include <drizzled/visibility.h>
 
54
 
50
55
namespace drizzled {
51
 
 
52
 
static std::string catalog("local");
53
 
 
54
 
class SchemaIdentifier
 
56
namespace identifier {
 
57
 
 
58
class DRIZZLED_API Schema : public Identifier
55
59
{
56
60
  std::string db;
57
61
  std::string db_path;
58
 
  std::string catalog;
59
62
 
60
63
public:
61
 
  typedef std::vector <SchemaIdentifier> vector;
62
 
  typedef const SchemaIdentifier& const_reference;
63
 
 
64
 
  SchemaIdentifier(const std::string &db_arg);
65
 
 
66
 
  virtual ~SchemaIdentifier()
 
64
  typedef std::vector <Schema> vector;
 
65
  typedef const Schema& const_reference;
 
66
 
 
67
  Schema(const std::string &db_arg);
 
68
 
 
69
  virtual ~Schema()
67
70
  { }
68
71
 
69
72
  virtual void getSQLPath(std::string &arg) const;
 
73
 
70
74
  const std::string &getPath() const;
71
75
 
72
76
  const std::string &getSchemaName() const
74
78
    return db;
75
79
  }
76
80
 
77
 
  const std::string &getCatalogName() const
78
 
  {
79
 
    return catalog;
80
 
  }
 
81
  const std::string &getCatalogName() const;
81
82
 
82
83
  virtual bool isValid() const;
83
84
 
 
85
  inline virtual bool isSystem() const
 
86
  {
 
87
    return false;
 
88
  }
 
89
 
84
90
  bool compare(const std::string &arg) const;
85
 
  bool compare(SchemaIdentifier::const_reference) const;
 
91
  bool compare(Schema::const_reference) const;
86
92
 
87
 
  friend bool operator<(SchemaIdentifier::const_reference left, SchemaIdentifier::const_reference right)
 
93
  friend bool operator<(Schema::const_reference left, Schema::const_reference right)
88
94
  {
89
95
    return  boost::algorithm::to_upper_copy(left.getSchemaName()) < boost::algorithm::to_upper_copy(right.getSchemaName());
90
96
  }
91
97
 
92
 
  friend std::ostream& operator<<(std::ostream& output,
93
 
                                  SchemaIdentifier::const_reference identifier)
94
 
  {
95
 
    output << "SchemaIdentifier:(";
96
 
    output <<  identifier.catalog;
97
 
    output << ", ";
98
 
    output <<  identifier.db;
99
 
    output << ", ";
100
 
    output << identifier.getPath();
101
 
    output << ")";
102
 
 
103
 
    return output;  // for multiple << operators.
104
 
  }
105
 
 
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)
108
100
  {
109
101
    return boost::iequals(left.getSchemaName(), right.getSchemaName());
110
102
  }
111
103
};
112
104
 
113
 
 
 
105
std::ostream& operator<<(std::ostream& output, const Schema&identifier);
 
106
 
 
107
 
 
108
} /* namespace identifier */
114
109
} /* namespace drizzled */
115
110
 
116
111
#endif /* DRIZZLED_IDENTIFIER_SCHEMA_H */