~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.h

  • Committer: Brian Aker
  • Date: 2011-03-27 07:03:49 UTC
  • mfrom: (2252.2.3 drizzle-ga)
  • Revision ID: brian@tangent.org-20110327070349-ihqsw1cl19lu8j65
MergeĀ inĀ staging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_PLUGIN_STORAGE_ENGINE_H
21
 
#define DRIZZLED_PLUGIN_STORAGE_ENGINE_H
22
 
 
 
20
#pragma once
23
21
 
24
22
#include <drizzled/definitions.h>
25
 
#include <drizzled/plugin.h>
 
23
#include <drizzled/error_t.h>
26
24
#include <drizzled/handler_structs.h>
27
25
#include <drizzled/message.h>
28
26
#include <drizzled/message/cache.h>
29
 
#include "drizzled/plugin/plugin.h"
30
 
#include "drizzled/sql_string.h"
31
 
#include "drizzled/identifier.h"
32
 
#include "drizzled/cached_directory.h"
33
 
#include "drizzled/plugin/monitored_in_transaction.h"
34
 
 
35
 
#include <drizzled/error_t.h>
 
27
#include <drizzled/plugin.h>
 
28
#include <drizzled/plugin/monitored_in_transaction.h>
 
29
#include <drizzled/plugin/plugin.h>
 
30
#include <drizzled/sql_string.h>
36
31
 
37
32
#include <bitset>
38
33
#include <string>
39
34
#include <vector>
40
35
#include <set>
41
36
 
42
 
namespace drizzled
43
 
{
44
 
 
 
37
#include <drizzled/visibility.h>
 
38
 
 
39
namespace drizzled {
 
40
 
 
41
class CachedDirectory;
45
42
class TableList;
46
43
class Session;
47
44
class Cursor;
48
 
typedef struct st_hash HASH;
 
45
struct HASH;
49
46
 
50
47
class TableShare;
51
48
typedef bool (stat_print_fn)(Session *session, const char *type, uint32_t type_len,
123
120
typedef std::set<std::string> TableNameList;
124
121
 
125
122
extern const std::string UNKNOWN_STRING;
126
 
extern const std::string DEFAULT_DEFINITION_FILE_EXT;
 
123
extern DRIZZLED_API const std::string DEFAULT_DEFINITION_FILE_EXT;
127
124
 
128
125
 
129
126
/*
135
132
 
136
133
  static StorageEngine { ... } xxx_engine;
137
134
*/
138
 
class StorageEngine : public Plugin,
139
 
                      public MonitoredInTransaction
 
135
class DRIZZLED_API StorageEngine :
 
136
  public Plugin,
 
137
  public MonitoredInTransaction
140
138
{
141
139
  friend class SEAPITester;
142
140
public:
220
218
  }
221
219
 
222
220
  /* Old style cursor errors */
223
 
  void print_keydup_error(uint32_t key_nr, const char *msg, Table &table);
224
 
  virtual bool get_error_message(int error, String *buf);
 
221
  void print_keydup_error(uint32_t key_nr, const char *msg, const Table &table) const;
 
222
  virtual bool get_error_message(int error, String *buf) const;
225
223
 
226
224
public:
227
 
  virtual void print_error(int error, myf errflag, Table& table);
 
225
  virtual void print_error(int error, myf errflag, const Table& table) const;
228
226
 
229
227
  bool is_user_selectable() const
230
228
  {
280
278
  virtual int doCreateTable(Session &session,
281
279
                            Table &table_arg,
282
280
                            const drizzled::identifier::Table &identifier,
283
 
                            message::Table &message)= 0;
 
281
                            const message::Table &message)= 0;
284
282
 
285
283
  virtual int doRenameTable(Session &session,
286
284
                            const drizzled::identifier::Table &from, const drizzled::identifier::Table &to)= 0;
321
319
  static bool addPlugin(plugin::StorageEngine *engine);
322
320
  static void removePlugin(plugin::StorageEngine *engine);
323
321
 
324
 
  static int getTableDefinition(Session& session,
325
 
                                const drizzled::identifier::Table &identifier,
326
 
                                message::table::shared_ptr &table_proto,
327
 
                                bool include_temporary_tables= true);
328
322
  static message::table::shared_ptr getTableMessage(Session& session,
329
323
                                                    const drizzled::identifier::Table &identifier,
330
 
                                                    drizzled::error_t &error,
331
324
                                                    bool include_temporary_tables= true);
332
325
  static bool doesTableExist(Session &session,
333
326
                             const drizzled::identifier::Table &identifier,
348
341
 
349
342
  static bool dropTable(Session& session,
350
343
                        StorageEngine &engine,
351
 
                        identifier::Table::const_reference identifier,
 
344
                        const identifier::Table& identifier,
352
345
                        drizzled::error_t &error);
353
346
 
354
347
  static void getIdentifiers(Session &session,
360
353
 
361
354
  // @note All schema methods defined here
362
355
  static void getIdentifiers(Session &session, identifier::Schema::vector &schemas);
363
 
  static bool getSchemaDefinition(const drizzled::identifier::Table &identifier, message::schema::shared_ptr &proto);
364
 
  static bool getSchemaDefinition(const drizzled::identifier::Schema &identifier, message::schema::shared_ptr &proto);
 
356
  static message::schema::shared_ptr getSchemaDefinition(const drizzled::identifier::Table &identifier);
 
357
  static message::schema::shared_ptr getSchemaDefinition(const drizzled::identifier::Schema &identifier);
365
358
  static bool doesSchemaExist(const drizzled::identifier::Schema &identifier);
366
359
  static const CHARSET_INFO *getSchemaCollation(const drizzled::identifier::Schema &identifier);
367
360
  static bool createSchema(const drizzled::message::Schema &schema_message);
368
 
  static bool dropSchema(drizzled::Session& session, identifier::Schema::const_reference identifier);
 
361
  static bool dropSchema(Session &session,
 
362
                         const identifier::Schema& identifier,
 
363
                         message::schema::const_reference schema_message);
369
364
  static bool alterSchema(const drizzled::message::Schema &schema_message);
370
365
 
371
366
  // @note make private/protected
373
368
  virtual void doGetSchemaIdentifiers(identifier::Schema::vector&)
374
369
  { }
375
370
 
376
 
  virtual bool doGetSchemaDefinition(const drizzled::identifier::Schema&, drizzled::message::schema::shared_ptr&)
 
371
  virtual drizzled::message::schema::shared_ptr doGetSchemaDefinition(const drizzled::identifier::Schema&)
377
372
  { 
378
 
    return false; 
 
373
    return drizzled::message::schema::shared_ptr(); 
379
374
  }
380
375
 
381
376
  virtual bool doCreateSchema(const drizzled::message::Schema&)
402
397
  Cursor *getCursor(Table &share);
403
398
 
404
399
  uint32_t max_record_length() const
405
 
  { return std::min((unsigned int)HA_MAX_REC_LENGTH, max_supported_record_length()); }
 
400
  { return std::min(HA_MAX_REC_LENGTH, max_supported_record_length()); }
406
401
  uint32_t max_keys() const
407
 
  { return std::min((unsigned int)MAX_KEY, max_supported_keys()); }
 
402
  { return std::min(MAX_KEY, max_supported_keys()); }
408
403
  uint32_t max_key_parts() const
409
 
  { return std::min((unsigned int)MAX_REF_PARTS, max_supported_key_parts()); }
 
404
  { return std::min(MAX_REF_PARTS, max_supported_key_parts()); }
410
405
  uint32_t max_key_length() const
411
 
  { return std::min((unsigned int)MAX_KEY_LENGTH, max_supported_key_length()); }
 
406
  { return std::min(MAX_KEY_LENGTH, max_supported_key_length()); }
412
407
  uint32_t max_key_part_length(void) const
413
 
  { return std::min((unsigned int)MAX_KEY_LENGTH, max_supported_key_part_length()); }
 
408
  { return std::min(MAX_KEY_LENGTH, max_supported_key_part_length()); }
414
409
 
415
410
  virtual uint32_t max_supported_record_length(void) const
416
411
  { return HA_MAX_REC_LENGTH; }
423
418
protected:
424
419
  static int deleteDefinitionFromPath(const drizzled::identifier::Table &identifier);
425
420
  static int renameDefinitionFromPath(const drizzled::identifier::Table &dest, const drizzled::identifier::Table &src);
426
 
  static int writeDefinitionFromPath(const drizzled::identifier::Table &identifier, message::Table &proto);
 
421
  static int writeDefinitionFromPath(const drizzled::identifier::Table &identifier, const message::Table &proto);
427
422
  static bool readTableFile(const std::string &path, message::Table &table_message);
428
423
 
429
424
public:
466
461
} /* namespace plugin */
467
462
} /* namespace drizzled */
468
463
 
469
 
#endif /* DRIZZLED_PLUGIN_STORAGE_ENGINE_H */