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(const char *path, const drizzled::message::Schema &db);
40
bool readTableFile(const std::string &path, drizzled::message::Table &table_message);
41
bool readSchemaFile(const std::string &path, drizzled::message::Schema &schema);
45
typedef drizzled::hash_map<std::string, drizzled::message::Schema> SchemaCache;
46
SchemaCache schema_cache;
47
bool schema_cache_filled;
49
pthread_rwlock_t schema_lock;
56
int doCreateTable(drizzled::Session *,
59
drizzled::message::Table&)
64
int doDropTable(drizzled::Session&, const std::string &table_path);
66
bool doCanCreateTable(const drizzled::TableIdentifier &identifier);
68
drizzled::Cursor *create(drizzled::TableShare &,
69
drizzled::memory::Root *)
74
void doGetSchemaNames(std::set<std::string>& set_of_names);
75
bool doGetSchemaDefinition(const std::string &schema_name, drizzled::message::Schema &proto);
77
bool doCreateSchema(const drizzled::message::Schema &schema_message);
79
bool doAlterSchema(const drizzled::message::Schema &schema_message);
81
bool doDropSchema(const std::string &schema_name);
83
int doGetTableDefinition(drizzled::Session& session,
86
const char *table_name,
88
drizzled::message::Table *table_proto);
90
void doGetTableNames(drizzled::CachedDirectory &directory,
92
std::set<std::string> &set_of_names);
94
const char **bas_ext() const
100
#endif /* PLUGIN_SCHEMA_ENGINE_SCHEMA_H */