~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.h

  • Committer: Lee Bieber
  • Date: 2011-01-15 03:08:27 UTC
  • mfrom: (1994.5.38 doc)
  • mto: This revision was merged to the branch mainline in revision 2087.
  • Revision ID: kalebral@gmail.com-20110115030827-0h9s99kiknrmt9ti
Merge Stewart - some documentation clean up

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#define DRIZZLED_PLUGIN_STORAGE_ENGINE_H
22
22
 
23
23
 
24
 
#include <drizzled/cached_directory.h>
25
24
#include <drizzled/definitions.h>
26
 
#include <drizzled/error_t.h>
 
25
#include <drizzled/plugin.h>
27
26
#include <drizzled/handler_structs.h>
28
 
#include <drizzled/identifier.h>
29
27
#include <drizzled/message.h>
30
28
#include <drizzled/message/cache.h>
31
 
#include <drizzled/plugin.h>
32
 
#include <drizzled/plugin/monitored_in_transaction.h>
33
 
#include <drizzled/plugin/plugin.h>
34
 
#include <drizzled/sql_string.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>
35
36
 
36
37
#include <bitset>
37
38
#include <string>
38
39
#include <vector>
39
40
#include <set>
40
41
 
41
 
#include <drizzled/visibility.h>
42
 
 
43
42
namespace drizzled
44
43
{
45
44
 
124
123
typedef std::set<std::string> TableNameList;
125
124
 
126
125
extern const std::string UNKNOWN_STRING;
127
 
extern DRIZZLED_API const std::string DEFAULT_DEFINITION_FILE_EXT;
 
126
extern const std::string DEFAULT_DEFINITION_FILE_EXT;
128
127
 
129
128
 
130
129
/*
136
135
 
137
136
  static StorageEngine { ... } xxx_engine;
138
137
*/
139
 
class DRIZZLED_API StorageEngine :
140
 
  public Plugin,
141
 
  public MonitoredInTransaction
 
138
class StorageEngine : public Plugin,
 
139
                      public MonitoredInTransaction
142
140
{
143
141
  friend class SEAPITester;
144
142
public:
211
209
 
212
210
protected:
213
211
  virtual int doGetTableDefinition(Session &session,
214
 
                                   const drizzled::identifier::Table &identifier,
 
212
                                   const drizzled::TableIdentifier &identifier,
215
213
                                   message::Table &table_message)
216
214
  {
217
215
    (void)session;
222
220
  }
223
221
 
224
222
  /* Old style cursor errors */
225
 
  void print_keydup_error(uint32_t key_nr, const char *msg, const Table &table) const;
226
 
  virtual bool get_error_message(int error, String *buf) const;
 
223
  void print_keydup_error(uint32_t key_nr, const char *msg, Table &table);
 
224
  virtual bool get_error_message(int error, String *buf);
227
225
 
228
226
public:
229
 
  virtual void print_error(int error, myf errflag, const Table& table) const;
 
227
  virtual void print_error(int error, myf errflag, Table& table);
230
228
 
231
229
  bool is_user_selectable() const
232
230
  {
281
279
protected:
282
280
  virtual int doCreateTable(Session &session,
283
281
                            Table &table_arg,
284
 
                            const drizzled::identifier::Table &identifier,
 
282
                            const drizzled::TableIdentifier &identifier,
285
283
                            message::Table &message)= 0;
286
284
 
287
285
  virtual int doRenameTable(Session &session,
288
 
                            const drizzled::identifier::Table &from, const drizzled::identifier::Table &to)= 0;
 
286
                            const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to)= 0;
289
287
 
290
288
  virtual int doDropTable(Session &session,
291
 
                          const drizzled::identifier::Table &identifier)= 0;
 
289
                          const drizzled::TableIdentifier &identifier)= 0;
292
290
 
293
291
  virtual void doGetTableIdentifiers(CachedDirectory &directory,
294
 
                                     const drizzled::identifier::Schema &schema_identifier,
295
 
                                     identifier::Table::vector &set_of_identifiers)= 0;
296
 
 
297
 
  virtual bool doDoesTableExist(Session& session, const drizzled::identifier::Table &identifier);
298
 
 
299
 
  virtual bool doCanCreateTable(const drizzled::identifier::Table &identifier)
 
292
                                     const drizzled::SchemaIdentifier &schema_identifier,
 
293
                                     TableIdentifier::vector &set_of_identifiers)= 0;
 
294
 
 
295
  virtual bool doDoesTableExist(Session& session, const drizzled::TableIdentifier &identifier);
 
296
 
 
297
  virtual bool doCanCreateTable(const drizzled::TableIdentifier &identifier)
300
298
  { (void)identifier;  return true; }
301
299
 
302
300
public:
317
315
  friend class StorageEngineGetTableDefinition;
318
316
  friend class DropTableByIdentifier;
319
317
 
320
 
  int renameTable(Session &session, const drizzled::identifier::Table &from, const drizzled::identifier::Table &to);
 
318
  int renameTable(Session &session, const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to);
321
319
 
322
320
  /* Class Methods for operating on plugin */
323
321
  static bool addPlugin(plugin::StorageEngine *engine);
324
322
  static void removePlugin(plugin::StorageEngine *engine);
325
323
 
 
324
  static int getTableDefinition(Session& session,
 
325
                                const drizzled::TableIdentifier &identifier,
 
326
                                message::table::shared_ptr &table_proto,
 
327
                                bool include_temporary_tables= true);
326
328
  static message::table::shared_ptr getTableMessage(Session& session,
327
 
                                                    const drizzled::identifier::Table &identifier,
 
329
                                                    const drizzled::TableIdentifier &identifier,
 
330
                                                    drizzled::error_t &error,
328
331
                                                    bool include_temporary_tables= true);
329
332
  static bool doesTableExist(Session &session,
330
 
                             const drizzled::identifier::Table &identifier,
 
333
                             const drizzled::TableIdentifier &identifier,
331
334
                             bool include_temporary_tables= true);
332
335
 
333
336
  static plugin::StorageEngine *findByName(const std::string &find_str);
338
341
  static bool flushLogs(plugin::StorageEngine *db_type);
339
342
 
340
343
  static bool dropTable(Session& session,
341
 
                        const drizzled::identifier::Table &identifier);
 
344
                        const drizzled::TableIdentifier &identifier);
342
345
  static bool dropTable(Session& session,
343
 
                        const drizzled::identifier::Table &identifier,
 
346
                        const drizzled::TableIdentifier &identifier,
344
347
                        drizzled::error_t &error);
345
348
 
346
349
  static bool dropTable(Session& session,
347
350
                        StorageEngine &engine,
348
 
                        identifier::Table::const_reference identifier,
 
351
                        TableIdentifier::const_reference identifier,
349
352
                        drizzled::error_t &error);
350
353
 
351
354
  static void getIdentifiers(Session &session,
352
 
                             const identifier::Schema &schema_identifier,
353
 
                             identifier::Table::vector &set_of_identifiers);
 
355
                             const SchemaIdentifier &schema_identifier,
 
356
                             TableIdentifier::vector &set_of_identifiers);
354
357
 
355
358
  // Check to see if any SE objects to creation.
356
 
  static bool canCreateTable(const drizzled::identifier::Table &identifier);
 
359
  static bool canCreateTable(const drizzled::TableIdentifier &identifier);
357
360
 
358
361
  // @note All schema methods defined here
359
 
  static void getIdentifiers(Session &session, identifier::Schema::vector &schemas);
360
 
  static message::schema::shared_ptr getSchemaDefinition(const drizzled::identifier::Table &identifier);
361
 
  static message::schema::shared_ptr getSchemaDefinition(const drizzled::identifier::Schema &identifier);
362
 
  static bool doesSchemaExist(const drizzled::identifier::Schema &identifier);
363
 
  static const CHARSET_INFO *getSchemaCollation(const drizzled::identifier::Schema &identifier);
 
362
  static void getIdentifiers(Session &session, SchemaIdentifier::vector &schemas);
 
363
  static bool getSchemaDefinition(const drizzled::TableIdentifier &identifier, message::schema::shared_ptr &proto);
 
364
  static bool getSchemaDefinition(const drizzled::SchemaIdentifier &identifier, message::schema::shared_ptr &proto);
 
365
  static bool doesSchemaExist(const drizzled::SchemaIdentifier &identifier);
 
366
  static const CHARSET_INFO *getSchemaCollation(const drizzled::SchemaIdentifier &identifier);
364
367
  static bool createSchema(const drizzled::message::Schema &schema_message);
365
 
  static bool dropSchema(Session &session,
366
 
                         identifier::Schema::const_reference identifier,
367
 
                         message::schema::const_reference schema_message);
 
368
  static bool dropSchema(drizzled::Session& session, SchemaIdentifier::const_reference identifier);
368
369
  static bool alterSchema(const drizzled::message::Schema &schema_message);
369
370
 
370
371
  // @note make private/protected
371
372
protected:
372
 
  virtual void doGetSchemaIdentifiers(identifier::Schema::vector&)
 
373
  virtual void doGetSchemaIdentifiers(SchemaIdentifier::vector&)
373
374
  { }
374
375
 
375
 
  virtual drizzled::message::schema::shared_ptr doGetSchemaDefinition(const drizzled::identifier::Schema&)
 
376
  virtual bool doGetSchemaDefinition(const drizzled::SchemaIdentifier&, drizzled::message::schema::shared_ptr&)
376
377
  { 
377
 
    return drizzled::message::schema::shared_ptr(); 
 
378
    return false; 
378
379
  }
379
380
 
380
381
  virtual bool doCreateSchema(const drizzled::message::Schema&)
383
384
  virtual bool doAlterSchema(const drizzled::message::Schema&)
384
385
  { return false; }
385
386
 
386
 
  virtual bool doDropSchema(const drizzled::identifier::Schema&)
 
387
  virtual bool doDropSchema(const drizzled::SchemaIdentifier&)
387
388
  { return false; }
388
389
 
389
390
public:
393
394
  }
394
395
 
395
396
  static bool createTable(Session &session,
396
 
                          const identifier::Table &identifier,
 
397
                          const TableIdentifier &identifier,
397
398
                          message::Table& table_message);
398
399
 
399
400
  static void removeLostTemporaryTables(Session &session, const char *directory);
401
402
  Cursor *getCursor(Table &share);
402
403
 
403
404
  uint32_t max_record_length() const
404
 
  { return std::min(HA_MAX_REC_LENGTH, max_supported_record_length()); }
 
405
  { return std::min((unsigned int)HA_MAX_REC_LENGTH, max_supported_record_length()); }
405
406
  uint32_t max_keys() const
406
 
  { return std::min(MAX_KEY, max_supported_keys()); }
 
407
  { return std::min((unsigned int)MAX_KEY, max_supported_keys()); }
407
408
  uint32_t max_key_parts() const
408
 
  { return std::min(MAX_REF_PARTS, max_supported_key_parts()); }
 
409
  { return std::min((unsigned int)MAX_REF_PARTS, max_supported_key_parts()); }
409
410
  uint32_t max_key_length() const
410
 
  { return std::min(MAX_KEY_LENGTH, max_supported_key_length()); }
 
411
  { return std::min((unsigned int)MAX_KEY_LENGTH, max_supported_key_length()); }
411
412
  uint32_t max_key_part_length(void) const
412
 
  { return std::min(MAX_KEY_LENGTH, max_supported_key_part_length()); }
 
413
  { return std::min((unsigned int)MAX_KEY_LENGTH, max_supported_key_part_length()); }
413
414
 
414
415
  virtual uint32_t max_supported_record_length(void) const
415
416
  { return HA_MAX_REC_LENGTH; }
420
421
 
421
422
  /* TODO-> Make private */
422
423
protected:
423
 
  static int deleteDefinitionFromPath(const drizzled::identifier::Table &identifier);
424
 
  static int renameDefinitionFromPath(const drizzled::identifier::Table &dest, const drizzled::identifier::Table &src);
425
 
  static int writeDefinitionFromPath(const drizzled::identifier::Table &identifier, message::Table &proto);
 
424
  static int deleteDefinitionFromPath(const drizzled::TableIdentifier &identifier);
 
425
  static int renameDefinitionFromPath(const drizzled::TableIdentifier &dest, const drizzled::TableIdentifier &src);
 
426
  static int writeDefinitionFromPath(const drizzled::TableIdentifier &identifier, message::Table &proto);
426
427
  static bool readTableFile(const std::string &path, message::Table &table_message);
427
428
 
428
429
public: