00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #pragma once
00022
00023 #include <assert.h>
00024 #include <drizzled/plugin/storage_engine.h>
00025 #include <boost/unordered_map.hpp>
00026 #include <boost/thread/shared_mutex.hpp>
00027
00028 extern const drizzled::CHARSET_INFO *default_charset_info;
00029
00030 static const char *schema_exts[] = {
00031 NULL
00032 };
00033
00034 class Schema : public drizzled::plugin::StorageEngine
00035 {
00036 bool writeSchemaFile(const drizzled::identifier::Schema &schema_identifier, const drizzled::message::Schema &db);
00037 bool readSchemaFile(const drizzled::identifier::Schema &schema_identifier, drizzled::message::Schema &schema);
00038 bool readSchemaFile(std::string filename, drizzled::message::Schema &schema);
00039
00040 void prime();
00041 void startup(drizzled::Session &session);
00042
00043 typedef boost::unordered_map<std::string, drizzled::message::schema::shared_ptr> SchemaCache;
00044 SchemaCache schema_cache;
00045 bool schema_cache_filled;
00046
00047 boost::shared_mutex mutex;
00048
00049 public:
00050 Schema();
00051
00052 ~Schema();
00053
00054
00055 drizzled::Cursor *create(drizzled::Table &)
00056 {
00057 return NULL;
00058 }
00059
00060 void doGetSchemaIdentifiers(drizzled::identifier::Schema::vector &set_of_names);
00061 drizzled::message::schema::shared_ptr doGetSchemaDefinition(const drizzled::identifier::Schema&);
00062
00063 bool doCreateSchema(const drizzled::message::Schema &schema_message);
00064
00065 bool doAlterSchema(const drizzled::message::Schema &schema_message);
00066
00067 bool doDropSchema(const drizzled::identifier::Schema&);
00068
00069
00070
00071 int doGetTableDefinition(drizzled::Session&,
00072 const drizzled::identifier::Table&,
00073 drizzled::message::Table&)
00074 {
00075 return ENOENT;
00076 }
00077
00078 bool doDoesTableExist(drizzled::Session&, const drizzled::identifier::Table&)
00079 {
00080 return false;
00081 }
00082
00083 int doRenameTable(drizzled::Session&, const drizzled::identifier::Table&, const drizzled::identifier::Table&)
00084 {
00085 return drizzled::HA_ERR_NO_SUCH_TABLE;
00086 }
00087
00088 int doCreateTable(drizzled::Session&,
00089 drizzled::Table&,
00090 const drizzled::identifier::Table&,
00091 const drizzled::message::Table&)
00092 {
00093 return drizzled::ER_TABLE_PERMISSION_DENIED;
00094 }
00095
00096 int doDropTable(drizzled::Session&, const drizzled::identifier::Table&)
00097 {
00098 return drizzled::HA_ERR_NO_SUCH_TABLE;
00099 }
00100
00101 const char **bas_ext() const
00102 {
00103 return schema_exts;
00104 }
00105
00106 void get_auto_increment(uint64_t, uint64_t,
00107 uint64_t,
00108 uint64_t *,
00109 uint64_t *)
00110 {}
00111
00112 void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
00113 const drizzled::identifier::Schema &schema_identifier,
00114 drizzled::identifier::Table::vector &set_of_identifiers);
00115 };
00116