drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
plugin/schema_engine/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 <unordered_map>
26#include <boost/thread/shared_mutex.hpp>
27
28extern 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_catalog(drizzled::identifier::Catalog &catalog_identifier);
37 void prime();
38
39 typedef std::unordered_map<std::string, drizzled::message::schema::shared_ptr> SchemaCache;
40 SchemaCache schema_cache;
41 bool schema_cache_filled;
42
43 boost::shared_mutex mutex;
44
45public:
46 Schema();
47
49 {
50 return NULL;
51 }
52
53 void doGetSchemaIdentifiers(drizzled::identifier::schema::vector&);
54 drizzled::message::schema::shared_ptr doGetSchemaDefinition(const drizzled::identifier::Schema&);
55
56 bool doCreateSchema(const drizzled::message::Schema&);
57
58 bool doAlterSchema(const drizzled::message::Schema&);
59
60 bool doDropSchema(const drizzled::identifier::Schema&);
61
62 // Below are table methods that we don't implement (and don't need)
63
64 int doGetTableDefinition(drizzled::Session&,
66 drizzled::message::Table&)
67 {
68 return ENOENT;
69 }
70
71 bool doDoesTableExist(drizzled::Session&, const drizzled::identifier::Table&)
72 {
73 return false;
74 }
75
77 {
78 return drizzled::HA_ERR_NO_SUCH_TABLE;
79 }
80
81 int doCreateTable(drizzled::Session&,
84 const drizzled::message::Table&)
85 {
86 return drizzled::ER_TABLE_PERMISSION_DENIED;
87 }
88
90 {
91 return drizzled::HA_ERR_NO_SUCH_TABLE;
92 }
93
94 const char** bas_ext() const;
95
96 void get_auto_increment(uint64_t, uint64_t,
97 uint64_t,
98 uint64_t *,
99 uint64_t *)
100 {}
101
102 void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
103 const drizzled::identifier::Schema &schema_identifier,
104 drizzled::identifier::table::vector &set_of_identifiers);
105};
106
const char ** bas_ext() const
bool writeSchemaFile(const drizzled::identifier::Schema &schema_identifier, const drizzled::message::Schema &db)
int doDropTable(drizzled::Session &, const drizzled::identifier::Table &)