~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/schema.h

  • Committer: Monty Taylor
  • Date: 2010-09-28 07:45:44 UTC
  • mto: (1799.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1800.
  • Revision ID: mordred@inaugust.com-20100928074544-s3ujnv6s8wro74l2
Added BSD copying file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
 
50
50
namespace drizzled {
51
51
 
52
 
static std::string catalog("local");
 
52
static std::string catalog("");
53
53
 
54
54
class SchemaIdentifier
55
55
{
56
56
  std::string db;
57
57
  std::string db_path;
58
 
  std::string catalog;
59
 
 
60
 
public:
61
 
  typedef std::vector <SchemaIdentifier> vector;
62
 
  typedef const SchemaIdentifier& const_reference;
63
 
 
 
58
 
 
59
 
 
60
  // @note this should be changed to protected once Session contains an
 
61
  // identifier for current db.
 
62
public:
 
63
 
 
64
public:
64
65
  SchemaIdentifier(const std::string &db_arg);
65
66
 
66
67
  virtual ~SchemaIdentifier()
67
68
  { }
68
69
 
69
 
  virtual void getSQLPath(std::string &arg) const;
 
70
  virtual const std::string &getSQLPath();
70
71
  const std::string &getPath() const;
71
72
 
72
73
  const std::string &getSchemaName() const
79
80
    return catalog;
80
81
  }
81
82
 
82
 
  virtual bool isValid() const;
83
 
 
 
83
  bool isValid() const;
84
84
  bool compare(const std::string &arg) const;
85
 
  bool compare(SchemaIdentifier::const_reference) const;
86
85
 
87
 
  friend bool operator<(SchemaIdentifier::const_reference left, SchemaIdentifier::const_reference right)
 
86
  friend bool operator<(const SchemaIdentifier &left, const SchemaIdentifier &right)
88
87
  {
89
88
    return  boost::algorithm::to_upper_copy(left.getSchemaName()) < boost::algorithm::to_upper_copy(right.getSchemaName());
90
89
  }
91
90
 
92
91
  friend std::ostream& operator<<(std::ostream& output,
93
 
                                  SchemaIdentifier::const_reference identifier)
 
92
                                  SchemaIdentifier &identifier)
94
93
  {
95
94
    output << "SchemaIdentifier:(";
96
 
    output <<  identifier.catalog;
97
 
    output << ", ";
98
95
    output <<  identifier.db;
99
96
    output << ", ";
100
97
    output << identifier.getPath();
103
100
    return output;  // for multiple << operators.
104
101
  }
105
102
 
106
 
  friend bool operator==(SchemaIdentifier::const_reference left,
107
 
                         SchemaIdentifier::const_reference right)
 
103
  friend bool operator==(const SchemaIdentifier &left,
 
104
                         const SchemaIdentifier &right)
108
105
  {
109
106
    return boost::iequals(left.getSchemaName(), right.getSchemaName());
110
107
  }
 
108
 
111
109
};
112
110
 
 
111
typedef std::vector <SchemaIdentifier> SchemaIdentifiers;
113
112
 
114
113
} /* namespace drizzled */
115
114