~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/schema.h

merged with up to date trunk

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