~drizzle-trunk/drizzle/development

1273.20.1 by Brian Aker
Basic engine with test.
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
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
21
#pragma once
1273.20.1 by Brian Aker
Basic engine with test.
22
23
#include <assert.h>
24
#include <drizzled/plugin/storage_engine.h>
1678.1.1 by Monty Taylor
Removed our unordered wrappers. We use Boost now.
25
#include <boost/unordered_map.hpp>
1755.2.6 by Brian Aker
Remove usage of non-boost lock type.
26
#include <boost/thread/shared_mutex.hpp>
1273.20.1 by Brian Aker
Basic engine with test.
27
28
extern const drizzled::CHARSET_INFO *default_charset_info;
29
30
static const char *schema_exts[] = {
31
  NULL
32
};
33
34
class Schema : public drizzled::plugin::StorageEngine
35
{
2087.4.1 by Brian Aker
Merge in schema identifier.
36
  bool writeSchemaFile(const drizzled::identifier::Schema &schema_identifier, const drizzled::message::Schema &db);
37
  bool readSchemaFile(const drizzled::identifier::Schema &schema_identifier, drizzled::message::Schema &schema);
2104.1.5 by Brian Aker
This fix issue where encoded schema would be lost on restart, and also fixes
38
  bool readSchemaFile(std::string filename, drizzled::message::Schema &schema);
1309.1.3 by Brian Aker
Cache for Schema.
39
40
  void prime();
2079.4.1 by Brian Aker
Merge in code to all plugins to do whatever they need to do once all other
41
  void startup(drizzled::Session &session);
1309.1.3 by Brian Aker
Cache for Schema.
42
1966.2.1 by Brian Aker
Clean up style for shared_ptr for messages around table/schema.
43
  typedef boost::unordered_map<std::string, drizzled::message::schema::shared_ptr> SchemaCache;
1309.1.3 by Brian Aker
Cache for Schema.
44
  SchemaCache schema_cache;
45
  bool schema_cache_filled;
46
1755.2.6 by Brian Aker
Remove usage of non-boost lock type.
47
  boost::shared_mutex mutex;
1273.19.27 by Brian Aker
Move schema writing code to schema engine plugin.
48
1273.20.1 by Brian Aker
Basic engine with test.
49
public:
50
  Schema();
51
1309.1.3 by Brian Aker
Cache for Schema.
52
  ~Schema();
1273.20.1 by Brian Aker
Basic engine with test.
53
1309.1.30 by Brian Aker
Simplify dropTable() (will add exceptions right now)
54
1869.1.4 by Brian Aker
TableShare is no longer in the house (i.e. we no longer directly have a copy
55
  drizzled::Cursor *create(drizzled::Table &)
1273.20.1 by Brian Aker
Basic engine with test.
56
  {
57
    return NULL;
58
  }
59
2087.4.1 by Brian Aker
Merge in schema identifier.
60
  void doGetSchemaIdentifiers(drizzled::identifier::Schema::vector &set_of_names);
2159.2.2 by Brian Aker
Remove additional spot where we passed in a reference of a shared pointer.
61
  drizzled::message::schema::shared_ptr doGetSchemaDefinition(const drizzled::identifier::Schema&);
1273.20.1 by Brian Aker
Basic engine with test.
62
1856.2.8 by Joseph Daly
working alter, drop, create schema
63
  bool doCreateSchema(const drizzled::message::Schema &schema_message);
1273.19.25 by Brian Aker
createSchema() now works via SE interface.
64
1273.19.26 by Brian Aker
Move Alter schema to SE interface.
65
  bool doAlterSchema(const drizzled::message::Schema &schema_message);
66
2087.4.1 by Brian Aker
Merge in schema identifier.
67
  bool doDropSchema(const drizzled::identifier::Schema&);
1273.19.31 by Brian Aker
Fix dropSchema().
68
1412 by Brian Aker
Innodb is now in the house (aka... it handls its own DFE).
69
  // Below are table methods that we don't implement (and don't need)
70
71
  int doGetTableDefinition(drizzled::Session&,
2087.4.2 by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers.
72
                           const drizzled::identifier::Table&,
1412 by Brian Aker
Innodb is now in the house (aka... it handls its own DFE).
73
                           drizzled::message::Table&)
74
  {
75
    return ENOENT;
76
  }
77
2087.4.2 by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers.
78
  bool doDoesTableExist(drizzled::Session&, const drizzled::identifier::Table&)
1412 by Brian Aker
Innodb is now in the house (aka... it handls its own DFE).
79
  {
80
    return false;
81
  }
82
2087.4.2 by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers.
83
  int doRenameTable(drizzled::Session&, const drizzled::identifier::Table&, const drizzled::identifier::Table&)
1412 by Brian Aker
Innodb is now in the house (aka... it handls its own DFE).
84
  {
2068.7.3 by Brian Aker
Merge in work for error messages being standardized by error_t
85
    return drizzled::HA_ERR_NO_SUCH_TABLE;
1412 by Brian Aker
Innodb is now in the house (aka... it handls its own DFE).
86
  }
87
1413 by Brian Aker
doCreateTable() was still taking a pointer instead of a session reference.
88
  int doCreateTable(drizzled::Session&,
1412 by Brian Aker
Innodb is now in the house (aka... it handls its own DFE).
89
                    drizzled::Table&,
2087.4.2 by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers.
90
                    const drizzled::identifier::Table&,
2224.4.2 by Brian Aker
Merge in work around making all passing of table as const.
91
                    const drizzled::message::Table&)
1412 by Brian Aker
Innodb is now in the house (aka... it handls its own DFE).
92
  {
2068.7.1 by Brian Aker
First pass through error correction in SE interface for drop table.
93
    return drizzled::ER_TABLE_PERMISSION_DENIED;
1412 by Brian Aker
Innodb is now in the house (aka... it handls its own DFE).
94
  }
95
2087.4.2 by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers.
96
  int doDropTable(drizzled::Session&, const drizzled::identifier::Table&)
1412 by Brian Aker
Innodb is now in the house (aka... it handls its own DFE).
97
  {
2068.7.3 by Brian Aker
Merge in work for error messages being standardized by error_t
98
    return drizzled::HA_ERR_NO_SUCH_TABLE;
1389 by Brian Aker
Large reord in ALTER TABLE for RENAME.
99
  }
100
1273.20.1 by Brian Aker
Basic engine with test.
101
  const char **bas_ext() const 
102
  {
103
    return schema_exts;
104
  }
1429.1.3 by Brian Aker
Merge in work for fetching a list of table identifiers.
105
1377.7.2 by Stewart Smith
make get_auto_increment pure virtual and force engines not supporting auto_increment to be explicit about it
106
  void get_auto_increment(uint64_t, uint64_t,
107
                          uint64_t,
108
                          uint64_t *,
109
                          uint64_t *)
110
  {}
2068.7.1 by Brian Aker
First pass through error correction in SE interface for drop table.
111
1429.1.3 by Brian Aker
Merge in work for fetching a list of table identifiers.
112
  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
2087.4.1 by Brian Aker
Merge in schema identifier.
113
                             const drizzled::identifier::Schema &schema_identifier,
2087.4.2 by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers.
114
                             drizzled::identifier::Table::vector &set_of_identifiers);
1273.20.1 by Brian Aker
Basic engine with test.
115
};
116