~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.h

Reverted changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "drizzled/cached_directory.h"
34
34
#include "drizzled/plugin/monitored_in_transaction.h"
35
35
 
36
 
#include "drizzled/hash.h"
 
36
#include <drizzled/unordered_map.h>
37
37
 
38
38
#include <bitset>
39
39
#include <string>
61
61
  HTON_BIT_NOT_USER_SELECTABLE,
62
62
  HTON_BIT_TEMPORARY_NOT_SUPPORTED,   // Having temporary tables not supported
63
63
  HTON_BIT_TEMPORARY_ONLY,
64
 
  HTON_BIT_FILE_BASED, // use for check_lowercase_names
65
64
  HTON_BIT_DOES_TRANSACTIONS,
66
65
  HTON_BIT_STATS_RECORDS_IS_EXACT,
67
66
  HTON_BIT_NULL_IN_KEY,
68
67
  HTON_BIT_CAN_INDEX_BLOBS,
69
 
  HTON_BIT_PRIMARY_KEY_REQUIRED_FOR_POSITION,
70
68
  HTON_BIT_PRIMARY_KEY_IN_READ_INDEX,
71
69
  HTON_BIT_PARTIAL_COLUMN_READ,
72
70
  HTON_BIT_TABLE_SCAN_ON_INDEX,
93
91
static const std::bitset<HTON_BIT_SIZE> HTON_NOT_USER_SELECTABLE(1 << HTON_BIT_NOT_USER_SELECTABLE);
94
92
static const std::bitset<HTON_BIT_SIZE> HTON_TEMPORARY_NOT_SUPPORTED(1 << HTON_BIT_TEMPORARY_NOT_SUPPORTED);
95
93
static const std::bitset<HTON_BIT_SIZE> HTON_TEMPORARY_ONLY(1 << HTON_BIT_TEMPORARY_ONLY);
96
 
static const std::bitset<HTON_BIT_SIZE> HTON_FILE_BASED(1 << HTON_BIT_FILE_BASED);
97
94
static const std::bitset<HTON_BIT_SIZE> HTON_HAS_DOES_TRANSACTIONS(1 << HTON_BIT_DOES_TRANSACTIONS);
98
95
static const std::bitset<HTON_BIT_SIZE> HTON_STATS_RECORDS_IS_EXACT(1 << HTON_BIT_STATS_RECORDS_IS_EXACT);
99
96
static const std::bitset<HTON_BIT_SIZE> HTON_NULL_IN_KEY(1 << HTON_BIT_NULL_IN_KEY);
100
97
static const std::bitset<HTON_BIT_SIZE> HTON_CAN_INDEX_BLOBS(1 << HTON_BIT_CAN_INDEX_BLOBS);
101
 
static const std::bitset<HTON_BIT_SIZE> HTON_PRIMARY_KEY_REQUIRED_FOR_POSITION(1 << HTON_BIT_PRIMARY_KEY_REQUIRED_FOR_POSITION);
102
98
static const std::bitset<HTON_BIT_SIZE> HTON_PRIMARY_KEY_IN_READ_INDEX(1 << HTON_BIT_PRIMARY_KEY_IN_READ_INDEX);
103
99
static const std::bitset<HTON_BIT_SIZE> HTON_PARTIAL_COLUMN_READ(1 << HTON_BIT_PARTIAL_COLUMN_READ);
104
100
static const std::bitset<HTON_BIT_SIZE> HTON_TABLE_SCAN_ON_INDEX(1 << HTON_BIT_TABLE_SCAN_ON_INDEX);
124
120
namespace plugin
125
121
{
126
122
 
127
 
typedef hash_map<std::string, StorageEngine *> EngineMap;
 
123
typedef unordered_map<std::string, StorageEngine *> EngineMap;
128
124
typedef std::vector<StorageEngine *> EngineVector;
129
125
 
130
126
typedef std::set<std::string> TableNameList;
214
210
  virtual ~StorageEngine();
215
211
 
216
212
  virtual int doGetTableDefinition(Session &session,
217
 
                                   TableIdentifier &identifier,
 
213
                                   const drizzled::TableIdentifier &identifier,
218
214
                                   message::Table &table_message)
219
215
  {
220
216
    (void)session;
284
280
protected:
285
281
  virtual int doCreateTable(Session &session,
286
282
                            Table &table_arg,
287
 
                            TableIdentifier &identifier,
 
283
                            const drizzled::TableIdentifier &identifier,
288
284
                            message::Table &message)= 0;
289
285
 
290
286
  virtual int doRenameTable(Session &session,
291
 
                            TableIdentifier &from, TableIdentifier &to)= 0;
 
287
                            const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to)= 0;
292
288
 
293
289
public:
294
290
 
295
 
  int renameTable(Session &session, TableIdentifier &from, TableIdentifier &to);
 
291
  int renameTable(Session &session, const drizzled::TableIdentifier &from, const drizzled::TableIdentifier &to);
296
292
 
297
293
  // @todo move these to protected
298
294
  virtual void doGetTableNames(CachedDirectory &directory,
304
300
                                     TableIdentifiers &set_of_identifiers)= 0;
305
301
 
306
302
  virtual int doDropTable(Session &session,
307
 
                          TableIdentifier &identifier)= 0;
 
303
                          const drizzled::TableIdentifier &identifier)= 0;
308
304
 
309
305
  /* Class Methods for operating on plugin */
310
306
  static bool addPlugin(plugin::StorageEngine *engine);
311
307
  static void removePlugin(plugin::StorageEngine *engine);
312
308
 
313
309
  static int getTableDefinition(Session& session,
314
 
                                TableIdentifier &identifier,
 
310
                                const drizzled::TableIdentifier &identifier,
315
311
                                message::Table &table_proto,
316
312
                                bool include_temporary_tables= true);
317
313
  static bool doesTableExist(Session &session,
318
 
                             TableIdentifier &identifier,
 
314
                             const drizzled::TableIdentifier &identifier,
319
315
                             bool include_temporary_tables= true);
320
316
 
321
 
  virtual bool doDoesTableExist(Session& session, TableIdentifier &identifier);
 
317
  virtual bool doDoesTableExist(Session& session, const drizzled::TableIdentifier &identifier);
322
318
 
323
319
  static plugin::StorageEngine *findByName(const std::string &find_str);
324
320
  static plugin::StorageEngine *findByName(Session& session, const std::string &find_str);
327
323
  static void dropDatabase(char* path);
328
324
  static bool flushLogs(plugin::StorageEngine *db_type);
329
325
  static int dropTable(Session& session,
330
 
                       TableIdentifier &identifier);
 
326
                       const drizzled::TableIdentifier &identifier);
331
327
  static int dropTable(Session& session,
332
328
                       StorageEngine &engine,
333
 
                       TableIdentifier &identifier);
 
329
                       const drizzled::TableIdentifier &identifier);
334
330
  static void getTableNames(Session &session, drizzled::SchemaIdentifier& schema_identifier, TableNameList &set_of_names);
335
331
  static void getTableIdentifiers(Session &session, SchemaIdentifier &schema_identifier, TableIdentifiers &set_of_identifiers);
336
332
 
337
333
  // Check to see if any SE objects to creation.
338
 
  static bool canCreateTable(drizzled::TableIdentifier &identifier);
339
 
  virtual bool doCanCreateTable(drizzled::TableIdentifier &identifier)
 
334
  static bool canCreateTable(const drizzled::TableIdentifier &identifier);
 
335
  virtual bool doCanCreateTable(const drizzled::TableIdentifier &identifier)
340
336
  { (void)identifier;  return true; }
341
337
 
342
338
  // @note All schema methods defined here
343
339
  static void getSchemaIdentifiers(Session &session, SchemaIdentifierList &schemas);
344
 
  static bool getSchemaDefinition(TableIdentifier &identifier, message::Schema &proto);
 
340
  static bool getSchemaDefinition(const drizzled::TableIdentifier &identifier, message::Schema &proto);
345
341
  static bool getSchemaDefinition(drizzled::SchemaIdentifier &identifier, message::Schema &proto);
346
342
  static bool doesSchemaExist(drizzled::SchemaIdentifier &identifier);
347
343
  static const CHARSET_INFO *getSchemaCollation(drizzled::SchemaIdentifier &identifier);
373
369
  }
374
370
 
375
371
  static int createTable(Session& session,
376
 
                         TableIdentifier &identifier,
377
 
                         bool update_create_info,
 
372
                         const drizzled::TableIdentifier &identifier,
378
373
                         message::Table& table_proto);
379
374
 
380
375
  static void removeLostTemporaryTables(Session &session, const char *directory);
400
395
  virtual uint32_t max_supported_key_part_length(void) const { return 255; }
401
396
 
402
397
  /* TODO-> Make private */
403
 
  static int deleteDefinitionFromPath(TableIdentifier &identifier);
404
 
  static int renameDefinitionFromPath(TableIdentifier &dest, TableIdentifier &src);
405
 
  static int writeDefinitionFromPath(TableIdentifier &identifier, message::Table &proto);
 
398
  static int deleteDefinitionFromPath(const drizzled::TableIdentifier &identifier);
 
399
  static int renameDefinitionFromPath(const drizzled::TableIdentifier &dest, const drizzled::TableIdentifier &src);
 
400
  static int writeDefinitionFromPath(const drizzled::TableIdentifier &identifier, message::Table &proto);
406
401
  static bool readTableFile(const std::string &path, message::Table &table_message);
407
402
 
408
403
public:
422
417
  {
423
418
    return false;
424
419
  }
 
420
 
 
421
  virtual bool validateCreateTableOption(const std::string &key, const std::string &state)
 
422
  {
 
423
    (void)key;
 
424
    (void)state;
 
425
 
 
426
    return false;
 
427
  }
 
428
 
 
429
  virtual bool validateCreateSchemaOption(const std::string &key, const std::string &state)
 
430
  {
 
431
    (void)key;
 
432
    (void)state;
 
433
 
 
434
    return false;
 
435
  }
425
436
};
426
437
 
427
438
} /* namespace plugin */