24
24
#include <assert.h>
25
25
#include <drizzled/plugin/storage_engine.h>
26
#include <drizzled/data_home.h>
27
#include <drizzled/hash.h>
26
#include <boost/unordered_map.hpp>
27
#include <boost/thread/shared_mutex.hpp>
31
29
extern const drizzled::CHARSET_INFO *default_charset_info;
37
35
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);
37
bool writeSchemaFile(const drizzled::identifier::Schema &schema_identifier, const drizzled::message::Schema &db);
38
bool readSchemaFile(const drizzled::identifier::Schema &schema_identifier, drizzled::message::Schema &schema);
44
typedef drizzled::hash_map<std::string, drizzled::message::Schema> SchemaCache;
42
typedef boost::unordered_map<std::string, drizzled::message::schema::shared_ptr> SchemaCache;
45
43
SchemaCache schema_cache;
46
44
bool schema_cache_filled;
48
pthread_rwlock_t schema_lock;
46
boost::shared_mutex mutex;
56
bool doCanCreateTable(drizzled::TableIdentifier &identifier);
58
drizzled::Cursor *create(drizzled::TableShare &,
59
drizzled::memory::Root *)
54
drizzled::Cursor *create(drizzled::Table &)
64
void doGetSchemaIdentifiers(drizzled::SchemaIdentifierList &set_of_names);
65
bool doGetSchemaDefinition(drizzled::SchemaIdentifier&, drizzled::message::Schema &proto);
59
void doGetSchemaIdentifiers(drizzled::identifier::Schema::vector &set_of_names);
60
bool doGetSchemaDefinition(const drizzled::identifier::Schema&, drizzled::message::schema::shared_ptr &proto);
67
62
bool doCreateSchema(const drizzled::message::Schema &schema_message);
69
64
bool doAlterSchema(const drizzled::message::Schema &schema_message);
71
bool doDropSchema(drizzled::SchemaIdentifier&);
66
bool doDropSchema(const drizzled::identifier::Schema&);
73
68
// Below are table methods that we don't implement (and don't need)
75
70
int doGetTableDefinition(drizzled::Session&,
76
drizzled::TableIdentifier&,
71
const drizzled::identifier::Table&,
77
72
drizzled::message::Table&)
83
void doGetTableNames(drizzled::CachedDirectory&,
84
drizzled::SchemaIdentifier&,
85
std::set<std::string>&)
89
bool doDoesTableExist(drizzled::Session&, drizzled::TableIdentifier&)
77
bool doDoesTableExist(drizzled::Session&, const drizzled::identifier::Table&)
94
int doRenameTable(drizzled::Session&, drizzled::TableIdentifier&, drizzled::TableIdentifier&)
82
int doRenameTable(drizzled::Session&, const drizzled::identifier::Table&, const drizzled::identifier::Table&)
84
return drizzled::HA_ERR_NO_SUCH_TABLE;
99
87
int doCreateTable(drizzled::Session&,
101
drizzled::TableIdentifier&,
89
const drizzled::identifier::Table&,
102
90
drizzled::message::Table&)
92
return drizzled::ER_TABLE_PERMISSION_DENIED;
107
int doDropTable(drizzled::Session&, drizzled::TableIdentifier&)
95
int doDropTable(drizzled::Session&, const drizzled::identifier::Table&)
97
return drizzled::HA_ERR_NO_SUCH_TABLE;
112
100
const char **bas_ext() const
122
111
void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
123
drizzled::SchemaIdentifier &schema_identifier,
124
drizzled::TableIdentifiers &set_of_identifiers);
112
const drizzled::identifier::Schema &schema_identifier,
113
drizzled::identifier::Table::vector &set_of_identifiers);
127
116
#endif /* PLUGIN_SCHEMA_ENGINE_SCHEMA_H */