~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/schema_engine/schema.h

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <assert.h>
25
25
#include <drizzled/plugin/storage_engine.h>
26
 
#include <drizzled/data_home.h>
27
26
#include <boost/unordered_map.hpp>
28
 
 
29
 
#include <pthread.h>
 
27
#include <boost/thread/shared_mutex.hpp>
30
28
 
31
29
extern const drizzled::CHARSET_INFO *default_charset_info;
32
30
 
36
34
 
37
35
class Schema : public drizzled::plugin::StorageEngine
38
36
{
39
 
  bool writeSchemaFile(const 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);
 
39
  bool readSchemaFile(std::string filename, drizzled::message::Schema &schema);
41
40
 
42
41
  void prime();
 
42
  void startup(drizzled::Session &session);
43
43
 
44
 
  typedef boost::unordered_map<std::string, drizzled::message::Schema> SchemaCache;
 
44
  typedef boost::unordered_map<std::string, drizzled::message::schema::shared_ptr> SchemaCache;
45
45
  SchemaCache schema_cache;
46
46
  bool schema_cache_filled;
47
47
 
48
 
  pthread_rwlock_t schema_lock;
 
48
  boost::shared_mutex mutex;
49
49
 
50
50
public:
51
51
  Schema();
53
53
  ~Schema();
54
54
 
55
55
 
56
 
  bool doCanCreateTable(const drizzled::TableIdentifier &identifier);
57
 
 
58
 
  drizzled::Cursor *create(drizzled::TableShare &)
 
56
  drizzled::Cursor *create(drizzled::Table &)
59
57
  {
60
58
    return NULL;
61
59
  }
62
60
 
63
 
  void doGetSchemaIdentifiers(drizzled::SchemaIdentifiers &set_of_names);
64
 
  bool doGetSchemaDefinition(const drizzled::SchemaIdentifier&, drizzled::message::Schema &proto);
 
61
  void doGetSchemaIdentifiers(drizzled::identifier::Schema::vector &set_of_names);
 
62
  bool doGetSchemaDefinition(const drizzled::identifier::Schema&, drizzled::message::schema::shared_ptr &proto);
65
63
 
66
64
  bool doCreateSchema(const drizzled::message::Schema &schema_message);
67
65
 
68
66
  bool doAlterSchema(const drizzled::message::Schema &schema_message);
69
67
 
70
 
  bool doDropSchema(const drizzled::SchemaIdentifier&);
 
68
  bool doDropSchema(const drizzled::identifier::Schema&);
71
69
 
72
70
  // Below are table methods that we don't implement (and don't need)
73
71
 
74
72
  int doGetTableDefinition(drizzled::Session&,
75
 
                           const drizzled::TableIdentifier&,
 
73
                           const drizzled::identifier::Table&,
76
74
                           drizzled::message::Table&)
77
75
  {
78
76
    return ENOENT;
79
77
  }
80
78
 
81
 
 
82
 
  void doGetTableNames(drizzled::CachedDirectory&,
83
 
                       const drizzled::SchemaIdentifier&,
84
 
                       std::set<std::string>&)
85
 
  {
86
 
  }
87
 
 
88
 
  bool doDoesTableExist(drizzled::Session&, const drizzled::TableIdentifier&)
 
79
  bool doDoesTableExist(drizzled::Session&, const drizzled::identifier::Table&)
89
80
  {
90
81
    return false;
91
82
  }
92
83
 
93
 
  int doRenameTable(drizzled::Session&, const drizzled::TableIdentifier&, const drizzled::TableIdentifier&)
 
84
  int doRenameTable(drizzled::Session&, const drizzled::identifier::Table&, const drizzled::identifier::Table&)
94
85
  {
95
 
    return EPERM;
 
86
    return drizzled::HA_ERR_NO_SUCH_TABLE;
96
87
  }
97
88
 
98
89
  int doCreateTable(drizzled::Session&,
99
90
                    drizzled::Table&,
100
 
                    const drizzled::TableIdentifier&,
 
91
                    const drizzled::identifier::Table&,
101
92
                    drizzled::message::Table&)
102
93
  {
103
 
    return EPERM;
 
94
    return drizzled::ER_TABLE_PERMISSION_DENIED;
104
95
  }
105
96
 
106
 
  int doDropTable(drizzled::Session&, const drizzled::TableIdentifier&)
 
97
  int doDropTable(drizzled::Session&, const drizzled::identifier::Table&)
107
98
  {
108
 
    return 0;
 
99
    return drizzled::HA_ERR_NO_SUCH_TABLE;
109
100
  }
110
101
 
111
102
  const char **bas_ext() const 
118
109
                          uint64_t *,
119
110
                          uint64_t *)
120
111
  {}
 
112
 
121
113
  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
122
 
                             const drizzled::SchemaIdentifier &schema_identifier,
123
 
                             drizzled::TableIdentifiers &set_of_identifiers);
 
114
                             const drizzled::identifier::Schema &schema_identifier,
 
115
                             drizzled::identifier::Table::vector &set_of_identifiers);
124
116
};
125
117
 
126
118
#endif /* PLUGIN_SCHEMA_ENGINE_SCHEMA_H */