~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/schema_engine/schema.h

  • Committer: Monty Taylor
  • Date: 2009-04-25 20:45:19 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 1003.
  • Revision ID: mordred@inaugust.com-20090425204519-lgrl7mz2r66v0jby
Blackhole.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2010 Brian Aker
5
 
 *
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.
10
 
 *
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.
15
 
 *
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
19
 
 */
20
 
 
21
 
#ifndef PLUGIN_SCHEMA_ENGINE_SCHEMA_H
22
 
#define PLUGIN_SCHEMA_ENGINE_SCHEMA_H
23
 
 
24
 
#include <assert.h>
25
 
#include <drizzled/plugin/storage_engine.h>
26
 
#include <drizzled/data_home.h>
27
 
#include <drizzled/hash.h>
28
 
 
29
 
#include <pthread.h>
30
 
 
31
 
extern const drizzled::CHARSET_INFO *default_charset_info;
32
 
 
33
 
static const char *schema_exts[] = {
34
 
  NULL
35
 
};
36
 
 
37
 
class Schema : public drizzled::plugin::StorageEngine
38
 
{
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);
41
 
 
42
 
  void prime();
43
 
 
44
 
  typedef drizzled::hash_map<std::string, drizzled::message::Schema> SchemaCache;
45
 
  SchemaCache schema_cache;
46
 
  bool schema_cache_filled;
47
 
 
48
 
  pthread_rwlock_t schema_lock;
49
 
 
50
 
public:
51
 
  Schema();
52
 
 
53
 
  ~Schema();
54
 
 
55
 
 
56
 
  bool doCanCreateTable(drizzled::TableIdentifier &identifier);
57
 
 
58
 
  drizzled::Cursor *create(drizzled::TableShare &,
59
 
                           drizzled::memory::Root *)
60
 
  {
61
 
    return NULL;
62
 
  }
63
 
 
64
 
  void doGetSchemaIdentifiers(drizzled::SchemaIdentifierList &set_of_names);
65
 
  bool doGetSchemaDefinition(drizzled::SchemaIdentifier&, drizzled::message::Schema &proto);
66
 
 
67
 
  bool doCreateSchema(const drizzled::message::Schema &schema_message);
68
 
 
69
 
  bool doAlterSchema(const drizzled::message::Schema &schema_message);
70
 
 
71
 
  bool doDropSchema(drizzled::SchemaIdentifier&);
72
 
 
73
 
  // Below are table methods that we don't implement (and don't need)
74
 
 
75
 
  int doGetTableDefinition(drizzled::Session&,
76
 
                           drizzled::TableIdentifier&,
77
 
                           drizzled::message::Table&)
78
 
  {
79
 
    return ENOENT;
80
 
  }
81
 
 
82
 
 
83
 
  void doGetTableNames(drizzled::CachedDirectory&,
84
 
                       drizzled::SchemaIdentifier&,
85
 
                       std::set<std::string>&)
86
 
  {
87
 
  }
88
 
 
89
 
  bool doDoesTableExist(drizzled::Session&, drizzled::TableIdentifier&)
90
 
  {
91
 
    return false;
92
 
  }
93
 
 
94
 
  int doRenameTable(drizzled::Session&, drizzled::TableIdentifier&, drizzled::TableIdentifier&)
95
 
  {
96
 
    return EPERM;
97
 
  }
98
 
 
99
 
  int doCreateTable(drizzled::Session&,
100
 
                    drizzled::Table&,
101
 
                    drizzled::TableIdentifier&,
102
 
                    drizzled::message::Table&)
103
 
  {
104
 
    return EPERM;
105
 
  }
106
 
 
107
 
  int doDropTable(drizzled::Session&, drizzled::TableIdentifier&)
108
 
  {
109
 
    return 0;
110
 
  }
111
 
 
112
 
  const char **bas_ext() const 
113
 
  {
114
 
    return schema_exts;
115
 
  }
116
 
 
117
 
  void get_auto_increment(uint64_t, uint64_t,
118
 
                          uint64_t,
119
 
                          uint64_t *,
120
 
                          uint64_t *)
121
 
  {}
122
 
  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
123
 
                             drizzled::SchemaIdentifier &schema_identifier,
124
 
                             drizzled::TableIdentifiers &set_of_identifiers);
125
 
};
126
 
 
127
 
#endif /* PLUGIN_SCHEMA_ENGINE_SCHEMA_H */