~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/schema.h

  • Committer: Jay Pipes
  • Date: 2010-03-09 20:02:29 UTC
  • mto: This revision was merged to the branch mainline in revision 1339.
  • Revision ID: jpipes@serialcoder-20100309200229-dfrliy4fads9vyf4
Fixes Bug #535296 by only incrementing ha_commit_count when its a normal transaction commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; either version 2 of the License, or
9
 
 *  (at your option) any later version.
10
 
 *
11
 
 *  This program is distributed in the hope that it will be useful,
12
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 *  GNU General Public License for more details.
15
 
 *
16
 
 *  You should have received a copy of the GNU General Public License
17
 
 *  along with this program; if not, write to the Free Software
18
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 
 */
20
 
 
21
 
/* 
22
 
  This is a "work in progress". The concept needs to be replicated throughout
23
 
  the code, but we will start with baby steps for the moment. To not incur
24
 
  cost until we are complete, for the moment it will do no allocation.
25
 
 
26
 
  This is mainly here so that it can be used in the SE interface for
27
 
  the time being.
28
 
 
29
 
  This will replace Table_ident.
30
 
  */
31
 
 
32
 
 
33
 
 
34
 
#ifndef DRIZZLED_IDENTIFIER_SCHEMA_H
35
 
#define DRIZZLED_IDENTIFIER_SCHEMA_H
36
 
 
37
 
#include <drizzled/enum.h>
38
 
#include <drizzled/definitions.h>
39
 
#include <drizzled/message/table.pb.h>
40
 
#include <drizzled/catalog/local.h>
41
 
#include <string.h>
42
 
 
43
 
#include <assert.h>
44
 
 
45
 
#include <ostream>
46
 
#include <list>
47
 
#include <algorithm>
48
 
#include <functional>
49
 
#include <iostream>
50
 
 
51
 
#include <boost/algorithm/string.hpp>
52
 
 
53
 
#include <drizzled/visibility.h>
54
 
 
55
 
namespace drizzled {
56
 
namespace identifier {
57
 
 
58
 
class DRIZZLED_API Schema : public Identifier
59
 
{
60
 
  std::string db;
61
 
  std::string db_path;
62
 
 
63
 
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()
70
 
  { }
71
 
 
72
 
  virtual void getSQLPath(std::string &arg) const;
73
 
 
74
 
  const std::string &getPath() const;
75
 
 
76
 
  const std::string &getSchemaName() const
77
 
  {
78
 
    return db;
79
 
  }
80
 
 
81
 
  const std::string &getCatalogName() const;
82
 
 
83
 
  virtual bool isValid() const;
84
 
 
85
 
  inline virtual bool isSystem() const
86
 
  {
87
 
    return false;
88
 
  }
89
 
 
90
 
  bool compare(const std::string &arg) const;
91
 
  bool compare(Schema::const_reference) const;
92
 
 
93
 
  friend bool operator<(Schema::const_reference left, Schema::const_reference right)
94
 
  {
95
 
    return  boost::algorithm::to_upper_copy(left.getSchemaName()) < boost::algorithm::to_upper_copy(right.getSchemaName());
96
 
  }
97
 
 
98
 
  friend bool operator==(Schema::const_reference left,
99
 
                         Schema::const_reference right)
100
 
  {
101
 
    return boost::iequals(left.getSchemaName(), right.getSchemaName());
102
 
  }
103
 
};
104
 
 
105
 
std::ostream& operator<<(std::ostream& output, const Schema&identifier);
106
 
 
107
 
 
108
 
} /* namespace identifier */
109
 
} /* namespace drizzled */
110
 
 
111
 
#endif /* DRIZZLED_IDENTIFIER_SCHEMA_H */