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) 2010 Brian Aker
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 #pragma once
22 
23 #include <assert.h>
24 #include <drizzled/plugin/storage_engine.h>
25 #include <boost/unordered_map.hpp>
26 #include <boost/thread/shared_mutex.hpp>
27 
28 extern const drizzled::charset_info_st *default_charset_info;
29 
31 {
32  bool writeSchemaFile(const drizzled::identifier::Schema &schema_identifier, const drizzled::message::Schema &db);
33  bool readSchemaFile(const drizzled::identifier::Schema &schema_identifier, drizzled::message::Schema &schema);
34  bool readSchemaFile(std::string filename, drizzled::message::Schema &schema);
35 
36  void prime();
37 
38  typedef boost::unordered_map<std::string, drizzled::message::schema::shared_ptr> SchemaCache;
39  SchemaCache schema_cache;
40  bool schema_cache_filled;
41 
42  boost::shared_mutex mutex;
43 
44 public:
45  Schema();
46 
48  {
49  return NULL;
50  }
51 
52  void doGetSchemaIdentifiers(drizzled::identifier::schema::vector&);
53  drizzled::message::schema::shared_ptr doGetSchemaDefinition(const drizzled::identifier::Schema&);
54 
55  bool doCreateSchema(const drizzled::message::Schema&);
56 
57  bool doAlterSchema(const drizzled::message::Schema&);
58 
59  bool doDropSchema(const drizzled::identifier::Schema&);
60 
61  // Below are table methods that we don't implement (and don't need)
62 
63  int doGetTableDefinition(drizzled::Session&,
66  {
67  return ENOENT;
68  }
69 
70  bool doDoesTableExist(drizzled::Session&, const drizzled::identifier::Table&)
71  {
72  return false;
73  }
74 
76  {
77  return drizzled::HA_ERR_NO_SUCH_TABLE;
78  }
79 
80  int doCreateTable(drizzled::Session&,
84  {
85  return drizzled::ER_TABLE_PERMISSION_DENIED;
86  }
87 
89  {
90  return drizzled::HA_ERR_NO_SUCH_TABLE;
91  }
92 
93  const char** bas_ext() const;
94 
95  void get_auto_increment(uint64_t, uint64_t,
96  uint64_t,
97  uint64_t *,
98  uint64_t *)
99  {}
100 
101  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
102  const drizzled::identifier::Schema &schema_identifier,
103  drizzled::identifier::table::vector &set_of_identifiers);
104 };
105