1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2010 Brian Aker
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.
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.
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
21
#ifndef PLUGIN_SCHEMA_ENGINE_SCHEMA_H
22
#define PLUGIN_SCHEMA_ENGINE_SCHEMA_H
25
#include <drizzled/plugin/storage_engine.h>
26
#include <drizzled/data_home.h>
27
#include <drizzled/hash.h>
31
extern const drizzled::CHARSET_INFO *default_charset_info;
33
static const char *schema_exts[] = {
37
class Schema : public drizzled::plugin::StorageEngine
39
bool writeSchemaFile(drizzled::SchemaIdentifier &schema_identifier, const drizzled::message::Schema &db);
40
bool readSchemaFile(const std::string &schema_file_name, drizzled::message::Schema &schema);
44
typedef drizzled::hash_map<std::string, drizzled::message::Schema> SchemaCache;
45
SchemaCache schema_cache;
46
bool schema_cache_filled;
48
pthread_rwlock_t schema_lock;
56
bool doCanCreateTable(drizzled::TableIdentifier &identifier);
58
drizzled::Cursor *create(drizzled::TableShare &,
59
drizzled::memory::Root *)
64
void doGetSchemaIdentifiers(drizzled::SchemaIdentifierList &set_of_names);
65
bool doGetSchemaDefinition(drizzled::SchemaIdentifier&, drizzled::message::Schema &proto);
67
bool doCreateSchema(const drizzled::message::Schema &schema_message);
69
bool doAlterSchema(const drizzled::message::Schema &schema_message);
71
bool doDropSchema(drizzled::SchemaIdentifier&);
73
// Below are table methods that we don't implement (and don't need)
75
int doGetTableDefinition(drizzled::Session&,
76
drizzled::TableIdentifier&,
77
drizzled::message::Table&)
83
void doGetTableNames(drizzled::CachedDirectory&,
84
drizzled::SchemaIdentifier&,
85
std::set<std::string>&)
89
bool doDoesTableExist(drizzled::Session&, drizzled::TableIdentifier&)
94
int doRenameTable(drizzled::Session&, drizzled::TableIdentifier&, drizzled::TableIdentifier&)
99
int doCreateTable(drizzled::Session&,
101
drizzled::TableIdentifier&,
102
drizzled::message::Table&)
107
int doDropTable(drizzled::Session&, drizzled::TableIdentifier&)
112
const char **bas_ext() const
117
void get_auto_increment(uint64_t, uint64_t,
122
void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
123
drizzled::SchemaIdentifier &schema_identifier,
124
drizzled::TableIdentifiers &set_of_identifiers);
127
#endif /* PLUGIN_SCHEMA_ENGINE_SCHEMA_H */