Drizzled Public API Documentation

schema.h
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 #pragma once
33 
34 #include <boost/algorithm/string.hpp>
35 #include <ostream>
36 
37 namespace drizzled {
38 namespace identifier {
39 
40 class Catalog;
41 
43 {
44  std::string _corrected_db;
45  std::string db;
46  std::string db_path;
48 
49 public:
50  Schema(const drizzled::identifier::Catalog &catalog_arg, str_ref);
51 
52  virtual std::string getSQLPath() const
53  {
54  return db;
55  }
56 
57  const std::string &getPath() const;
58 
59  const std::string &getSchemaName() const
60  {
61  return db;
62  }
63 
64  const std::string &getCompareWithSchemaName() const
65  {
66  return _corrected_db;
67  }
68 
69  const drizzled::identifier::Catalog &getCatalog() const
70  {
71  return _catalog;
72  }
73 
74  const std::string &getCatalogName() const;
75 
76  virtual bool isValid() const;
77 
78  inline virtual bool isSystem() const
79  {
80  return false;
81  }
82 
83  bool compare(const std::string &arg) const;
84  bool compare(const Schema&) const;
85 
86  friend bool operator<(const Schema& left, const Schema& right)
87  {
88  return boost::ilexicographical_compare(left.getSchemaName(), right.getSchemaName());
89  }
90 
91  friend bool operator==(const Schema& left, const Schema& right)
92  {
93  return boost::iequals(left._corrected_db, right._corrected_db);
94  }
95 };
96 
97 std::ostream& operator<<(std::ostream&, const Schema&);
98 
99 
100 } /* namespace identifier */
101 } /* namespace drizzled */
TODO: Rename this file - func.h is stupid.
#define DRIZZLED_API
Definition: visibility.h:62