~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/schema.h

  • Committer: Brian Aker
  • Date: 2010-08-18 16:12:58 UTC
  • mto: This revision was merged to the branch mainline in revision 1720.
  • Revision ID: brian@tangent.org-20100818161258-1vm71da888dfvwsx
Remove the code surrounding stack trace.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
  This will replace Table_ident.
30
30
  */
31
31
 
32
 
#ifndef DRIZZLED_SCHEMA_IDENTIFIER_H
33
 
#define DRIZZLED_SCHEMA_IDENTIFIER_H
 
32
#ifndef DRIZZLED_IDENTIFIER_SCHEMA_H
 
33
#define DRIZZLED_IDENTIFIER_SCHEMA_H
34
34
 
35
35
#include <drizzled/enum.h>
36
36
#include "drizzled/definitions.h"
45
45
#include <functional>
46
46
#include <iostream>
47
47
 
 
48
#include <boost/algorithm/string.hpp>
 
49
 
48
50
namespace drizzled {
49
51
 
 
52
static std::string catalog("");
 
53
 
50
54
class SchemaIdentifier
51
55
{
52
56
  std::string db;
53
57
  std::string db_path;
54
 
  std::string lower_db;
 
58
 
55
59
 
56
60
  // @note this should be changed to protected once Session contains an
57
61
  // identifier for current db.
58
62
public:
59
63
 
60
 
  const std::string &getLower()
61
 
  {
62
 
   return lower_db;
63
 
  }
64
 
 
65
64
public:
66
 
  SchemaIdentifier(const std::string &db_arg) :
67
 
    db(db_arg),
68
 
    lower_db(db_arg)
69
 
  { 
70
 
    std::transform(lower_db.begin(), lower_db.end(),
71
 
                   lower_db.begin(), ::tolower);
72
 
  }
 
65
  SchemaIdentifier(const std::string &db_arg);
73
66
 
74
67
  virtual ~SchemaIdentifier()
75
68
  { }
76
69
 
77
70
  virtual const std::string &getSQLPath();
78
 
  const std::string &getPath();
 
71
  const std::string &getPath() const;
79
72
 
80
73
  const std::string &getSchemaName() const
81
74
  {
82
75
    return db;
83
76
  }
84
77
 
85
 
  bool isValid();
86
 
  bool compare(std::string arg) const;
 
78
  const std::string &getCatalogName() const
 
79
  {
 
80
    return catalog;
 
81
  }
 
82
 
 
83
  bool isValid() const;
 
84
  bool compare(const std::string &arg) const;
87
85
 
88
86
  friend bool operator<(const SchemaIdentifier &left, const SchemaIdentifier &right)
89
87
  {
90
 
    return left.lower_db < right.lower_db;
 
88
    return  boost::algorithm::to_upper_copy(left.getSchemaName()) < boost::algorithm::to_upper_copy(right.getSchemaName());
91
89
  }
92
90
 
93
91
  friend std::ostream& operator<<(std::ostream& output,
105
103
  friend bool operator==(const SchemaIdentifier &left,
106
104
                         const SchemaIdentifier &right)
107
105
  {
108
 
    if (left.lower_db == right.lower_db)
109
 
    {
110
 
      return true;
111
 
    }
112
 
 
113
 
    return false;
 
106
    return boost::iequals(left.getSchemaName(), right.getSchemaName());
114
107
  }
115
108
 
116
109
};
117
110
 
118
 
typedef std::list <SchemaIdentifier> SchemaIdentifierList;
 
111
typedef std::vector <SchemaIdentifier> SchemaIdentifiers;
119
112
 
120
113
} /* namespace drizzled */
121
114
 
122
 
#endif /* DRIZZLED_SCHEMA_IDENTIFIER_H */
 
115
#endif /* DRIZZLED_IDENTIFIER_SCHEMA_H */