~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/schema_engine/schema.h

  • Committer: Lee
  • Date: 2008-10-30 22:02:01 UTC
  • mto: (572.1.2 devel)
  • mto: This revision was merged to the branch mainline in revision 573.
  • Revision ID: lbieber@lbieber-desktop-20081030220201-elb6qprbzpn7c5a4
add my name to the AUTHORS file

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::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);
40
 
 
41
 
  void prime();
42
 
  void startup(drizzled::Session &session);
43
 
 
44
 
  typedef boost::unordered_map<std::string, drizzled::message::schema::shared_ptr> SchemaCache;
45
 
  SchemaCache schema_cache;
46
 
  bool schema_cache_filled;
47
 
 
48
 
  boost::shared_mutex mutex;
49
 
 
50
 
public:
51
 
  Schema();
52
 
 
53
 
  ~Schema();
54
 
 
55
 
 
56
 
  drizzled::Cursor *create(drizzled::Table &)
57
 
  {
58
 
    return NULL;
59
 
  }
60
 
 
61
 
  void doGetSchemaIdentifiers(drizzled::identifier::Schema::vector &set_of_names);
62
 
  bool doGetSchemaDefinition(const drizzled::identifier::Schema&, drizzled::message::schema::shared_ptr &proto);
63
 
 
64
 
  bool doCreateSchema(const drizzled::message::Schema &schema_message);
65
 
 
66
 
  bool doAlterSchema(const drizzled::message::Schema &schema_message);
67
 
 
68
 
  bool doDropSchema(const drizzled::identifier::Schema&);
69
 
 
70
 
  // Below are table methods that we don't implement (and don't need)
71
 
 
72
 
  int doGetTableDefinition(drizzled::Session&,
73
 
                           const drizzled::identifier::Table&,
74
 
                           drizzled::message::Table&)
75
 
  {
76
 
    return ENOENT;
77
 
  }
78
 
 
79
 
  bool doDoesTableExist(drizzled::Session&, const drizzled::identifier::Table&)
80
 
  {
81
 
    return false;
82
 
  }
83
 
 
84
 
  int doRenameTable(drizzled::Session&, const drizzled::identifier::Table&, const drizzled::identifier::Table&)
85
 
  {
86
 
    return drizzled::HA_ERR_NO_SUCH_TABLE;
87
 
  }
88
 
 
89
 
  int doCreateTable(drizzled::Session&,
90
 
                    drizzled::Table&,
91
 
                    const drizzled::identifier::Table&,
92
 
                    drizzled::message::Table&)
93
 
  {
94
 
    return drizzled::ER_TABLE_PERMISSION_DENIED;
95
 
  }
96
 
 
97
 
  int doDropTable(drizzled::Session&, const drizzled::identifier::Table&)
98
 
  {
99
 
    return drizzled::HA_ERR_NO_SUCH_TABLE;
100
 
  }
101
 
 
102
 
  const char **bas_ext() const 
103
 
  {
104
 
    return schema_exts;
105
 
  }
106
 
 
107
 
  void get_auto_increment(uint64_t, uint64_t,
108
 
                          uint64_t,
109
 
                          uint64_t *,
110
 
                          uint64_t *)
111
 
  {}
112
 
 
113
 
  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
114
 
                             const drizzled::identifier::Schema &schema_identifier,
115
 
                             drizzled::identifier::Table::vector &set_of_identifiers);
116
 
};
117
 
 
118
 
#endif /* PLUGIN_SCHEMA_ENGINE_SCHEMA_H */