~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/schema_engine/schema.h

  • Committer: Monty Taylor
  • Date: 2009-03-04 02:48:12 UTC
  • mto: (917.1.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 918.
  • Revision ID: mordred@inaugust.com-20090304024812-5wb6wpye5c1iitbq
Applied atomic patch to current tree.

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