~drizzle-trunk/drizzle/development

575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
4
 *  Copyright (C) 2008 Sun Microsystems
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; version 2 of the License.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, write to the Free Software
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 */
19
968.2.29 by Monty Taylor
First steps towards new plugin reg.
20
#ifndef DRIZZLED_PLUGIN_STORAGE_ENGINE_H
21
#define DRIZZLED_PLUGIN_STORAGE_ENGINE_H
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
22
575.4.7 by Monty Taylor
More header cleanup.
23
575.1.5 by Monty Taylor
Moved stuff to handlerton.cc
24
#include <drizzled/definitions.h>
1130.1.1 by Monty Taylor
Merged in plugin-slot-reorg patches.
25
#include <drizzled/plugin.h>
1039.3.3 by Stewart Smith
Move handler::create to StorageEngine::create_table
26
#include <drizzled/handler_structs.h>
1812.3.8 by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how
27
#include <drizzled/message.h>
1130.2.5 by Monty Taylor
Some carnage. I'm sure it'll need fixed.
28
#include "drizzled/plugin/plugin.h"
1241.9.12 by Monty Taylor
Trims more out of server_includes.h.
29
#include "drizzled/sql_string.h"
1660.1.1 by Brian Aker
Merge in move identifier work.
30
#include "drizzled/identifier.h"
1241.9.44 by Monty Taylor
Made magic with cached_directory.
31
#include "drizzled/cached_directory.h"
1273.1.30 by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager
32
#include "drizzled/plugin/monitored_in_transaction.h"
1183.1.5 by Brian Aker
Reworked getTableNames() interface. Way simpler, less mallocs....
33
960.2.40 by Monty Taylor
Made name private. Wow, we just don't use it for anything do we.
34
#include <bitset>
35
#include <string>
971.1.25 by Monty Taylor
Moved StorageEngine onto drizzled::Registry.
36
#include <vector>
1241.9.44 by Monty Taylor
Made magic with cached_directory.
37
#include <set>
960.2.40 by Monty Taylor
Made name private. Wow, we just don't use it for anything do we.
38
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
39
namespace drizzled
40
{
41
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
42
class TableList;
575.1.5 by Monty Taylor
Moved stuff to handlerton.cc
43
class Session;
1183.1.2 by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted
44
class Cursor;
1237.9.3 by Padraig O'Sullivan
Removed one the includes I put in server_includes.h for the last commit to get rid of the inclusion
45
typedef struct st_hash HASH;
575.1.5 by Monty Taylor
Moved stuff to handlerton.cc
46
1000.1.3 by Brian Aker
Renamed TABLE_SHARE to TableShare
47
class TableShare;
1228.1.5 by Monty Taylor
Merged in some naming things.
48
typedef drizzle_lex_string LEX_STRING;
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
49
typedef bool (stat_print_fn)(Session *session, const char *type, uint32_t type_len,
50
                             const char *file, uint32_t file_len,
51
                             const char *status, uint32_t status_len);
52
960.2.24 by Monty Taylor
Changed handlerton to StorageEngine.
53
/* Possible flags of a StorageEngine (there can be 32 of them) */
960.2.27 by Monty Taylor
Reworked transformed handlerton into class StorageEngine.
54
enum engine_flag_bits {
631.1.2 by Yoshinori Sano
Move hton_flag_bits and HTON_* to handlerton.h. Remove TODOs previously added.
55
  HTON_BIT_ALTER_NOT_SUPPORTED,       // Engine does not support alter
56
  HTON_BIT_HIDDEN,                    // Engine does not appear in lists
57
  HTON_BIT_NOT_USER_SELECTABLE,
58
  HTON_BIT_TEMPORARY_NOT_SUPPORTED,   // Having temporary tables not supported
1063.9.2 by Brian Aker
Committing Stewart's tmp fix
59
  HTON_BIT_TEMPORARY_ONLY,
1183.1.17 by Brian Aker
Added Innodb specific vector (well... for any engine)
60
  HTON_BIT_DOES_TRANSACTIONS,
1233.1.2 by Brian Aker
Move stat read define into engine flags.
61
  HTON_BIT_STATS_RECORDS_IS_EXACT,
1233.1.3 by Brian Aker
Move more of the flags up to engine flags.
62
  HTON_BIT_NULL_IN_KEY,
63
  HTON_BIT_CAN_INDEX_BLOBS,
1233.1.4 by Brian Aker
Added:
64
  HTON_BIT_PRIMARY_KEY_IN_READ_INDEX,
65
  HTON_BIT_PARTIAL_COLUMN_READ,
66
  HTON_BIT_TABLE_SCAN_ON_INDEX,
1233.1.5 by Brian Aker
More table_flags converted.
67
  HTON_BIT_FAST_KEY_READ,
68
  HTON_BIT_NO_BLOBS,
69
  HTON_BIT_HAS_RECORDS,
70
  HTON_BIT_NO_AUTO_INCREMENT,
1233.1.6 by Brian Aker
Remove table_flags from MyISAM.
71
  HTON_BIT_DUPLICATE_POS,
72
  HTON_BIT_AUTO_PART_KEY,
1233.1.7 by Brian Aker
Final table flag removal.
73
  HTON_BIT_REQUIRE_PRIMARY_KEY,
74
  HTON_BIT_REQUIRES_KEY_COLUMNS_FOR_DELETE,
75
  HTON_BIT_PRIMARY_KEY_REQUIRED_FOR_DELETE,
76
  HTON_BIT_NO_PREFIX_CHAR_KEYS,
77
  HTON_BIT_HAS_CHECKSUM,
1235.1.2 by Brian Aker
Added engine flag so that an engine can skip store_lock.
78
  HTON_BIT_SKIP_STORE_LOCK,
1273.19.30 by Brian Aker
Performance patch... we now only cycle through engines that actually have
79
  HTON_BIT_SCHEMA_DICTIONARY,
1395.1.3 by Brian Aker
Pass through on refactoring, locks now are wrapped up in layer above.
80
  HTON_BIT_FOREIGN_KEYS,
631.1.2 by Yoshinori Sano
Move hton_flag_bits and HTON_* to handlerton.h. Remove TODOs previously added.
81
  HTON_BIT_SIZE
82
};
83
84
static const std::bitset<HTON_BIT_SIZE> HTON_NO_FLAGS(0);
85
static const std::bitset<HTON_BIT_SIZE> HTON_ALTER_NOT_SUPPORTED(1 << HTON_BIT_ALTER_NOT_SUPPORTED);
86
static const std::bitset<HTON_BIT_SIZE> HTON_HIDDEN(1 << HTON_BIT_HIDDEN);
87
static const std::bitset<HTON_BIT_SIZE> HTON_NOT_USER_SELECTABLE(1 << HTON_BIT_NOT_USER_SELECTABLE);
88
static const std::bitset<HTON_BIT_SIZE> HTON_TEMPORARY_NOT_SUPPORTED(1 << HTON_BIT_TEMPORARY_NOT_SUPPORTED);
1063.9.2 by Brian Aker
Committing Stewart's tmp fix
89
static const std::bitset<HTON_BIT_SIZE> HTON_TEMPORARY_ONLY(1 << HTON_BIT_TEMPORARY_ONLY);
1183.1.17 by Brian Aker
Added Innodb specific vector (well... for any engine)
90
static const std::bitset<HTON_BIT_SIZE> HTON_HAS_DOES_TRANSACTIONS(1 << HTON_BIT_DOES_TRANSACTIONS);
1233.1.2 by Brian Aker
Move stat read define into engine flags.
91
static const std::bitset<HTON_BIT_SIZE> HTON_STATS_RECORDS_IS_EXACT(1 << HTON_BIT_STATS_RECORDS_IS_EXACT);
1233.1.3 by Brian Aker
Move more of the flags up to engine flags.
92
static const std::bitset<HTON_BIT_SIZE> HTON_NULL_IN_KEY(1 << HTON_BIT_NULL_IN_KEY);
93
static const std::bitset<HTON_BIT_SIZE> HTON_CAN_INDEX_BLOBS(1 << HTON_BIT_CAN_INDEX_BLOBS);
1233.1.4 by Brian Aker
Added:
94
static const std::bitset<HTON_BIT_SIZE> HTON_PRIMARY_KEY_IN_READ_INDEX(1 << HTON_BIT_PRIMARY_KEY_IN_READ_INDEX);
95
static const std::bitset<HTON_BIT_SIZE> HTON_PARTIAL_COLUMN_READ(1 << HTON_BIT_PARTIAL_COLUMN_READ);
96
static const std::bitset<HTON_BIT_SIZE> HTON_TABLE_SCAN_ON_INDEX(1 << HTON_BIT_TABLE_SCAN_ON_INDEX);
1233.1.5 by Brian Aker
More table_flags converted.
97
static const std::bitset<HTON_BIT_SIZE> HTON_FAST_KEY_READ(1 << HTON_BIT_FAST_KEY_READ);
98
static const std::bitset<HTON_BIT_SIZE> HTON_NO_BLOBS(1 << HTON_BIT_NO_BLOBS);
99
static const std::bitset<HTON_BIT_SIZE> HTON_HAS_RECORDS(1 << HTON_BIT_HAS_RECORDS);
1233.1.7 by Brian Aker
Final table flag removal.
100
static const std::bitset<HTON_BIT_SIZE> HTON_NO_AUTO_INCREMENT(1 << HTON_BIT_NO_AUTO_INCREMENT);
1233.1.6 by Brian Aker
Remove table_flags from MyISAM.
101
static const std::bitset<HTON_BIT_SIZE> HTON_DUPLICATE_POS(1 << HTON_BIT_DUPLICATE_POS);
102
static const std::bitset<HTON_BIT_SIZE> HTON_AUTO_PART_KEY(1 << HTON_BIT_AUTO_PART_KEY);
1233.1.7 by Brian Aker
Final table flag removal.
103
static const std::bitset<HTON_BIT_SIZE> HTON_REQUIRE_PRIMARY_KEY(1 << HTON_BIT_REQUIRE_PRIMARY_KEY);
104
static const std::bitset<HTON_BIT_SIZE> HTON_REQUIRES_KEY_COLUMNS_FOR_DELETE(1 << HTON_BIT_REQUIRES_KEY_COLUMNS_FOR_DELETE);
105
static const std::bitset<HTON_BIT_SIZE> HTON_PRIMARY_KEY_REQUIRED_FOR_DELETE(1 << HTON_BIT_PRIMARY_KEY_REQUIRED_FOR_DELETE);
106
static const std::bitset<HTON_BIT_SIZE> HTON_NO_PREFIX_CHAR_KEYS(1 << HTON_BIT_NO_PREFIX_CHAR_KEYS);
107
static const std::bitset<HTON_BIT_SIZE> HTON_HAS_CHECKSUM(1 << HTON_BIT_HAS_CHECKSUM);
1235.1.2 by Brian Aker
Added engine flag so that an engine can skip store_lock.
108
static const std::bitset<HTON_BIT_SIZE> HTON_SKIP_STORE_LOCK(1 << HTON_BIT_SKIP_STORE_LOCK);
1273.19.30 by Brian Aker
Performance patch... we now only cycle through engines that actually have
109
static const std::bitset<HTON_BIT_SIZE> HTON_HAS_SCHEMA_DICTIONARY(1 << HTON_BIT_SCHEMA_DICTIONARY);
1395.1.3 by Brian Aker
Pass through on refactoring, locks now are wrapped up in layer above.
110
static const std::bitset<HTON_BIT_SIZE> HTON_HAS_FOREIGN_KEYS(1 << HTON_BIT_FOREIGN_KEYS);
1233.1.4 by Brian Aker
Added:
111
631.1.2 by Yoshinori Sano
Move hton_flag_bits and HTON_* to handlerton.h. Remove TODOs previously added.
112
1039.3.3 by Stewart Smith
Move handler::create to StorageEngine::create_table
113
class Table;
1273.1.4 by Jay Pipes
This patch significantly reworks the way that
114
class NamedSavepoint;
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
115
1130.1.4 by Monty Taylor
Moved StorageEngine into plugin namespace.
116
namespace plugin
117
{
118
1273.1.15 by Jay Pipes
This patch completes the first step in the splitting of
119
typedef std::vector<StorageEngine *> EngineVector;
120
1309.1.12 by Brian Aker
Cleanup of rm schema;
121
typedef std::set<std::string> TableNameList;
122
1228.1.3 by Monty Taylor
All of the outstanding plugin loader system cleanups:
123
extern const std::string UNKNOWN_STRING;
124
extern const std::string DEFAULT_DEFINITION_FILE_EXT;
1130.1.13 by Monty Taylor
Moved some simple methods back into header to they can be inlined. Removed a couple wrapper methods.
125
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
126
/*
960.2.24 by Monty Taylor
Changed handlerton to StorageEngine.
127
  StorageEngine is a singleton structure - one instance per storage engine -
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
128
  to provide access to storage engine functionality that works on the
1183.1.2 by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted
129
  "global" level (unlike Cursor class that works on a per-table basis)
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
130
960.2.24 by Monty Taylor
Changed handlerton to StorageEngine.
131
  usually StorageEngine instance is defined statically in ha_xxx.cc as
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
132
960.2.25 by Monty Taylor
First step of hton rename.
133
  static StorageEngine { ... } xxx_engine;
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
134
*/
1273.1.30 by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager
135
class StorageEngine : public Plugin,
136
                      public MonitoredInTransaction
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
137
{
1220.2.1 by Brian Aker
Move cursor flags up to storage engine flags. These need to be merged.
138
public:
139
  typedef uint64_t Table_flags;
140
141
private:
1183.1.2 by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted
142
  const std::bitset<HTON_BIT_SIZE> flags; /* global Cursor flags */
964.1.6 by Monty Taylor
Moved savepoint stuff to protected virtual methods, moved the offset to private, and moved the logic about adding the offset to the passed-in pointer and adding the offset to the global offset inside of the class.
143
1415 by Brian Aker
Mass overhaul to use schema_identifier.
144
  static EngineVector &getSchemaEngines();
145
1273.1.15 by Jay Pipes
This patch completes the first step in the splitting of
146
  virtual void setTransactionReadWrite(Session& session);
1039.3.8 by Stewart Smith
Re-introduce marking transaction as read-write for engine on create_table:
147
1273.1.21 by Jay Pipes
* Remove dead ha_innobase::init_table_handle_for_HANDLER()
148
  /*
149
   * Indicates to a storage engine the start of a
150
   * new SQL statement.
151
   */
152
  virtual void doStartStatement(Session *session)
153
  {
154
    (void) session;
155
  }
156
157
  /*
158
   * Indicates to a storage engine the end of
159
   * the current SQL statement in the supplied
160
   * Session.
161
   */
162
  virtual void doEndStatement(Session *session)
163
  {
164
    (void) session;
165
  }
166
964.1.6 by Monty Taylor
Moved savepoint stuff to protected virtual methods, moved the offset to private, and moved the logic about adding the offset to the passed-in pointer and adding the offset to the global offset inside of the class.
167
protected:
1183.1.27 by Brian Aker
Fix issue where there are too many files in data directory. We now only
168
  std::string table_definition_ext;
169
170
public:
1213 by Brian Aker
Fixes startup failures when temporary tables were left behind in a crash.
171
  const std::string& getTableDefinitionFileExtension()
1183.1.27 by Brian Aker
Fix issue where there are too many files in data directory. We now only
172
  {
173
    return table_definition_ext;
174
  }
175
1228.3.1 by Monty Taylor
Removed NameMap. Also remove the aliases from the plugin, since we can just
176
private:
177
  std::vector<std::string> aliases;
178
179
public:
180
  const std::vector<std::string>& getAliases() const
181
  {
182
    return aliases;
183
  }
184
185
  void addAlias(std::string alias)
186
  {
187
    aliases.push_back(alias);
188
  }
189
1183.1.27 by Brian Aker
Fix issue where there are too many files in data directory. We now only
190
protected:
964.1.6 by Monty Taylor
Moved savepoint stuff to protected virtual methods, moved the offset to private, and moved the logic about adding the offset to the passed-in pointer and adding the offset to the global offset inside of the class.
191
192
  /**
1183.1.29 by Brian Aker
Clean up interface so that Truncate sets the propper engine when
193
    @brief
194
    Used as a protobuf storage currently by TEMP only engines.
195
  */
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
196
  typedef std::map <std::string, message::Table> ProtoCache;
1183.1.29 by Brian Aker
Clean up interface so that Truncate sets the propper engine when
197
  ProtoCache proto_cache;
1183.1.30 by Brian Aker
Added engine internal locks (instead of the session based....)
198
  pthread_mutex_t proto_cache_mutex;
1183.1.29 by Brian Aker
Clean up interface so that Truncate sets the propper engine when
199
960.2.27 by Monty Taylor
Reworked transformed handlerton into class StorageEngine.
200
public:
960.2.40 by Monty Taylor
Made name private. Wow, we just don't use it for anything do we.
201
1030.1.1 by Brian Aker
Straighten out structures (remove some some dead bits).
202
  StorageEngine(const std::string name_arg,
1273.1.15 by Jay Pipes
This patch completes the first step in the splitting of
203
                const std::bitset<HTON_BIT_SIZE> &flags_arg= HTON_NO_FLAGS);
1030.1.1 by Brian Aker
Straighten out structures (remove some some dead bits).
204
205
  virtual ~StorageEngine();
206
1358.1.2 by Brian Aker
Long pass through the system to use more of TableIdentifiers.
207
  virtual int doGetTableDefinition(Session &session,
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
208
                                   const drizzled::TableIdentifier &identifier,
1354.1.1 by Brian Aker
Modify ptr to reference.
209
                                   message::Table &table_message)
1183.1.11 by Brian Aker
Updating with new engine interface to I_S
210
  {
1183.1.29 by Brian Aker
Clean up interface so that Truncate sets the propper engine when
211
    (void)session;
1358.1.2 by Brian Aker
Long pass through the system to use more of TableIdentifiers.
212
    (void)identifier;
1354.1.1 by Brian Aker
Modify ptr to reference.
213
    (void)table_message;
1183.1.29 by Brian Aker
Clean up interface so that Truncate sets the propper engine when
214
1183.1.11 by Brian Aker
Updating with new engine interface to I_S
215
    return ENOENT;
216
  }
1095.3.5 by Stewart Smith
StorageEngine::getTableProto() instead of table_proto_exists. allowing engines to implement their own getTableProtoImpl() to check if table exists. if proto is not null, should fill proto. This is next step (replacing calls to read_table_proto with calls to SE::getTableProto.
217
1216.1.1 by Brian Aker
Move print_error up to Engine.
218
  /* Old style cursor errors */
219
protected:
220
  void print_keydup_error(uint32_t key_nr, const char *msg, Table &table);
221
  void print_error(int error, myf errflag, Table *table= NULL);
222
  virtual bool get_error_message(int error, String *buf);
223
public:
224
  virtual void print_error(int error, myf errflag, Table& table);
225
964.1.4 by Monty Taylor
Moved flags into private area.
226
  bool is_user_selectable() const
227
  {
228
    return not flags.test(HTON_BIT_NOT_USER_SELECTABLE);
229
  }
230
231
  bool check_flag(const engine_flag_bits flag) const
232
  {
233
    return flags.test(flag);
234
  }
235
1235.1.13 by Brian Aker
Next pass through interface to move index flag bits up to engine.
236
  // @todo match check_flag interface
237
  virtual uint32_t index_flags(enum  ha_key_alg) const { return 0; }
1273.1.22 by Jay Pipes
Automates registration of statement transaction resources. No more need for storage engines to call TransactionServices::trans_register_ha(session, false, engine). yeah \o/
238
  virtual void startStatement(Session *session)
1273.1.21 by Jay Pipes
* Remove dead ha_innobase::init_table_handle_for_HANDLER()
239
  {
240
    doStartStatement(session);
241
  }
1273.1.22 by Jay Pipes
Automates registration of statement transaction resources. No more need for storage engines to call TransactionServices::trans_register_ha(session, false, engine). yeah \o/
242
  virtual void endStatement(Session *session)
1273.1.21 by Jay Pipes
* Remove dead ha_innobase::init_table_handle_for_HANDLER()
243
  {
244
    doEndStatement(session);
245
  }
1235.1.13 by Brian Aker
Next pass through interface to move index flag bits up to engine.
246
964.1.2 by Monty Taylor
Removed extra space.
247
  /*
1273.1.32 by Jay Pipes
Fixes Bug #530870
248
   * Called during Session::cleanup() for all engines
249
   */
964.1.2 by Monty Taylor
Removed extra space.
250
  virtual int close_connection(Session  *)
251
  {
252
    return 0;
253
  }
1869.1.4 by Brian Aker
TableShare is no longer in the house (i.e. we no longer directly have a copy
254
  virtual Cursor *create(Table &)= 0;
964.1.2 by Monty Taylor
Removed extra space.
255
  /* args: path */
256
  virtual bool flush_logs() { return false; }
257
  virtual bool show_status(Session *, stat_print_fn *, enum ha_stat_type)
258
  {
259
    return false;
260
  }
261
1039.3.1 by Stewart Smith
move bas_ext to StorageEngine instead of handler
262
  /**
263
    If frm_error() is called then we will use this to find out what file
264
    extentions exist for the storage engine. This is also used by the default
1183.1.2 by Brian Aker
Rename of handler to Cursor. You would not believe how long I have wanted
265
    rename_table and delete_table method in Cursor.cc.
1039.3.1 by Stewart Smith
move bas_ext to StorageEngine instead of handler
266
267
    For engines that have two file name extentions (separate meta/index file
268
    and data file), the order of elements is relevant. First element of engine
269
    file name extentions array should be meta/index file extention. Second
270
    element - data file extention. This order is assumed by
271
    prepare_for_repair() when REPAIR Table ... USE_FRM is issued.
272
  */
273
  virtual const char **bas_ext() const =0;
274
1039.3.9 by Stewart Smith
beat identifiers with an ugly stick (otherwise known as "coding standards" and s/create_table/createTable/)
275
protected:
1413 by Brian Aker
doCreateTable() was still taking a pointer instead of a session reference.
276
  virtual int doCreateTable(Session &session,
277
                            Table &table_arg,
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
278
                            const drizzled::TableIdentifier &identifier,
1413 by Brian Aker
doCreateTable() was still taking a pointer instead of a session reference.
279
                            message::Table &message)= 0;
1095.3.29 by Stewart Smith
s/Impl/Implementation/
280
1390 by Brian Aker
Update interface to use Identifiers directly.
281
  virtual int doRenameTable(Session &session,
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
282
                            const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to)= 0;
1095.3.29 by Stewart Smith
s/Impl/Implementation/
283
1039.3.9 by Stewart Smith
beat identifiers with an ugly stick (otherwise known as "coding standards" and s/create_table/createTable/)
284
public:
1039.3.8 by Stewart Smith
Re-introduce marking transaction as read-write for engine on create_table:
285
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
286
  int renameTable(Session &session, const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to);
1039.3.3 by Stewart Smith
Move handler::create to StorageEngine::create_table
287
1429.1.3 by Brian Aker
Merge in work for fetching a list of table identifiers.
288
  virtual void doGetTableIdentifiers(CachedDirectory &directory,
1642 by Brian Aker
This adds const to SchemaIdentifier.
289
                                     const drizzled::SchemaIdentifier &schema_identifier,
1429.1.3 by Brian Aker
Merge in work for fetching a list of table identifiers.
290
                                     TableIdentifiers &set_of_identifiers)= 0;
1358.1.3 by Brian Aker
doDropTable() now only uses identifier.
291
1358.1.2 by Brian Aker
Long pass through the system to use more of TableIdentifiers.
292
  virtual int doDropTable(Session &session,
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
293
                          const drizzled::TableIdentifier &identifier)= 0;
1183.1.5 by Brian Aker
Reworked getTableNames() interface. Way simpler, less mallocs....
294
1160.1.1 by Brian Aker
Refactor SE createTable back to engine class.
295
  /* Class Methods for operating on plugin */
1130.1.19 by Monty Taylor
Added error reporting to plugin registration.
296
  static bool addPlugin(plugin::StorageEngine *engine);
1130.1.18 by Monty Taylor
Changed ::add() and ::remove() to ::addPlugin() and ::removePlugin() so that
297
  static void removePlugin(plugin::StorageEngine *engine);
1130.1.12 by Monty Taylor
Moved service stuff into plugin/
298
1183.1.29 by Brian Aker
Clean up interface so that Truncate sets the propper engine when
299
  static int getTableDefinition(Session& session,
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
300
                                const drizzled::TableIdentifier &identifier,
1354.1.1 by Brian Aker
Modify ptr to reference.
301
                                message::Table &table_proto,
1273.19.11 by Brian Aker
This restores temporary tables back to being viewable via show/select.
302
                                bool include_temporary_tables= true);
1358.1.1 by Brian Aker
Fixes regression in performance from Exists patch.
303
  static bool doesTableExist(Session &session,
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
304
                             const drizzled::TableIdentifier &identifier,
1273.19.11 by Brian Aker
This restores temporary tables back to being viewable via show/select.
305
                             bool include_temporary_tables= true);
1130.1.12 by Monty Taylor
Moved service stuff into plugin/
306
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
307
  virtual bool doDoesTableExist(Session& session, const drizzled::TableIdentifier &identifier);
1358.1.1 by Brian Aker
Fixes regression in performance from Exists patch.
308
1384 by Brian Aker
Merge
309
  static plugin::StorageEngine *findByName(const std::string &find_str);
310
  static plugin::StorageEngine *findByName(Session& session, const std::string &find_str);
311
1130.1.12 by Monty Taylor
Moved service stuff into plugin/
312
  static void closeConnection(Session* session);
313
  static void dropDatabase(char* path);
314
  static bool flushLogs(plugin::StorageEngine *db_type);
1223.4.16 by Brian Aker
Drop Table now uses identifier.
315
  static int dropTable(Session& session,
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
316
                       const drizzled::TableIdentifier &identifier);
1395.1.12 by Brian Aker
Fixes failure related to Heap's hack on deletion. Also cleans up error
317
  static int dropTable(Session& session,
318
                       StorageEngine &engine,
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
319
                       const drizzled::TableIdentifier &identifier);
1663.1.4 by Brian Aker
Removed identifier bit
320
  static void getIdentifiers(Session &session,
321
                             const SchemaIdentifier &schema_identifier,
322
                             TableIdentifiers &set_of_identifiers);
1183.1.5 by Brian Aker
Reworked getTableNames() interface. Way simpler, less mallocs....
323
1320.1.8 by Brian Aker
Temporary fix for allowing engines to say "don't do this".
324
  // Check to see if any SE objects to creation.
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
325
  static bool canCreateTable(const drizzled::TableIdentifier &identifier);
326
  virtual bool doCanCreateTable(const drizzled::TableIdentifier &identifier)
1320.1.8 by Brian Aker
Temporary fix for allowing engines to say "don't do this".
327
  { (void)identifier;  return true; }
328
1273.13.38 by Brian Aker
Add in new show work.
329
  // @note All schema methods defined here
1663.1.4 by Brian Aker
Removed identifier bit
330
  static void getIdentifiers(Session &session, SchemaIdentifiers &schemas);
1812.3.8 by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how
331
  static bool getSchemaDefinition(const drizzled::TableIdentifier &identifier, message::SchemaPtr &proto);
332
  static bool getSchemaDefinition(const drizzled::SchemaIdentifier &identifier, message::SchemaPtr &proto);
1642 by Brian Aker
This adds const to SchemaIdentifier.
333
  static bool doesSchemaExist(const drizzled::SchemaIdentifier &identifier);
334
  static const CHARSET_INFO *getSchemaCollation(const drizzled::SchemaIdentifier &identifier);
1856.2.8 by Joseph Daly
working alter, drop, create schema
335
  static bool createSchema(const drizzled::message::Schema &schema_message);
1642 by Brian Aker
This adds const to SchemaIdentifier.
336
  static bool dropSchema(const drizzled::SchemaIdentifier &identifier);
1273.19.26 by Brian Aker
Move Alter schema to SE interface.
337
  static bool alterSchema(const drizzled::message::Schema &schema_message);
1273.20.2 by Brian Aker
Adding on more bits for schema engine.
338
1273.20.1 by Brian Aker
Basic engine with test.
339
  // @note make private/protected
1643.3.3 by Brian Aker
Updated to harmonize the identifier API.
340
  virtual void doGetSchemaIdentifiers(SchemaIdentifiers&)
1415 by Brian Aker
Mass overhaul to use schema_identifier.
341
  { }
1273.20.2 by Brian Aker
Adding on more bits for schema engine.
342
1812.3.8 by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how
343
  virtual bool doGetSchemaDefinition(const drizzled::SchemaIdentifier&, drizzled::message::SchemaPtr&)
1273.20.2 by Brian Aker
Adding on more bits for schema engine.
344
  { 
345
    return false; 
346
  }
1273.13.9 by Brian Aker
Updating test cases + added Drizzle specific schema_names and schema_info.
347
1856.2.8 by Joseph Daly
working alter, drop, create schema
348
  virtual bool doCreateSchema(const drizzled::message::Schema&)
1856.2.10 by Joseph Daly
fix up non diff
349
  { return false; }
1415 by Brian Aker
Mass overhaul to use schema_identifier.
350
351
  virtual bool doAlterSchema(const drizzled::message::Schema&)
1856.2.10 by Joseph Daly
fix up non diff
352
  { return false; }
1415 by Brian Aker
Mass overhaul to use schema_identifier.
353
1642 by Brian Aker
This adds const to SchemaIdentifier.
354
  virtual bool doDropSchema(const drizzled::SchemaIdentifier&)
1856.2.10 by Joseph Daly
fix up non diff
355
  { return false; }
1273.19.31 by Brian Aker
Fix dropSchema().
356
1130.1.13 by Monty Taylor
Moved some simple methods back into header to they can be inlined. Removed a couple wrapper methods.
357
  static inline const std::string &resolveName(const StorageEngine *engine)
358
  {
359
    return engine == NULL ? UNKNOWN_STRING : engine->getName();
360
  }
1130.1.12 by Monty Taylor
Moved service stuff into plugin/
361
1223.4.15 by Brian Aker
Final step to make createTable() use the TableIdentifier.
362
  static int createTable(Session& session,
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
363
                         const drizzled::TableIdentifier &identifier,
1320.1.6 by Brian Aker
Remove unused createTable() option
364
                         message::Table& table_proto);
1183.1.1 by Brian Aker
Rework interface pieces on SE (sort of... dumb ones...)
365
1213 by Brian Aker
Fixes startup failures when temporary tables were left behind in a crash.
366
  static void removeLostTemporaryTables(Session &session, const char *directory);
367
1869.1.4 by Brian Aker
TableShare is no longer in the house (i.e. we no longer directly have a copy
368
  Cursor *getCursor(Table &share);
1233.1.9 by Brian Aker
Move max key stuff up to engine.
369
370
  uint32_t max_record_length() const
371
  { return std::min((unsigned int)HA_MAX_REC_LENGTH, max_supported_record_length()); }
372
  uint32_t max_keys() const
373
  { return std::min((unsigned int)MAX_KEY, max_supported_keys()); }
374
  uint32_t max_key_parts() const
375
  { return std::min((unsigned int)MAX_REF_PARTS, max_supported_key_parts()); }
376
  uint32_t max_key_length() const
377
  { return std::min((unsigned int)MAX_KEY_LENGTH, max_supported_key_length()); }
378
  uint32_t max_key_part_length(void) const
379
  { return std::min((unsigned int)MAX_KEY_LENGTH, max_supported_key_part_length()); }
380
381
  virtual uint32_t max_supported_record_length(void) const
382
  { return HA_MAX_REC_LENGTH; }
383
  virtual uint32_t max_supported_keys(void) const { return 0; }
384
  virtual uint32_t max_supported_key_parts(void) const { return MAX_REF_PARTS; }
385
  virtual uint32_t max_supported_key_length(void) const { return MAX_KEY_LENGTH; }
386
  virtual uint32_t max_supported_key_part_length(void) const { return 255; }
387
1237.6.12 by Brian Aker
Adding patch for engine methods for definition files.
388
  /* TODO-> Make private */
1618.1.1 by Brian Aker
Modify TableIdentifier to be const
389
  static int deleteDefinitionFromPath(const drizzled::TableIdentifier &identifier);
390
  static int renameDefinitionFromPath(const drizzled::TableIdentifier &dest, const drizzled::TableIdentifier &src);
391
  static int writeDefinitionFromPath(const drizzled::TableIdentifier &identifier, message::Table &proto);
1395.1.8 by Brian Aker
Cleanup usage of TI so that the NULL ones no longer exist.
392
  static bool readTableFile(const std::string &path, message::Table &table_message);
1273.1.30 by Jay Pipes
* Completes the blueprint for splitting the XA Resource Manager
393
394
public:
395
  /* 
396
   * The below are simple virtual overrides for the plugin::MonitoredInTransaction
397
   * interface.
398
   */
399
  virtual bool participatesInSqlTransaction() const
400
  {
401
    return false; /* plugin::StorageEngine is non-transactional in terms of SQL */
402
  }
403
  virtual bool participatesInXaTransaction() const
404
  {
405
    return false; /* plugin::StorageEngine is non-transactional in terms of XA */
406
  }
407
  virtual bool alwaysRegisterForXaTransaction() const
408
  {
409
    return false;
410
  }
1502.1.30 by Brian Aker
First pass on cleanup of Stewart's patch, plus re-engineer to make it work a
411
412
  virtual bool validateCreateTableOption(const std::string &key, const std::string &state)
413
  {
414
    (void)key;
415
    (void)state;
416
417
    return false;
418
  }
419
420
  virtual bool validateCreateSchemaOption(const std::string &key, const std::string &state)
421
  {
422
    (void)key;
423
    (void)state;
424
425
    return false;
426
  }
575.1.3 by Monty Taylor
Moved some stuff out of handler.h.
427
};
428
1130.1.4 by Monty Taylor
Moved StorageEngine into plugin namespace.
429
} /* namespace plugin */
430
} /* namespace drizzled */
431
968.2.29 by Monty Taylor
First steps towards new plugin reg.
432
#endif /* DRIZZLED_PLUGIN_STORAGE_ENGINE_H */