~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.h

  • Committer: Lee Bieber
  • Date: 2011-03-29 22:31:41 UTC
  • mfrom: (2257.1.3 build)
  • Revision ID: kalebral@gmail.com-20110329223141-yxc22h3l2he58sk0
Merge Andrew - 743842: Build failure using GCC 4.6
Merge Stewart - 738022: CachedDirectory silently fails to add entries if stat() fails
Merge Olaf - Common fwd: add copyright, add more declaration

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
 
 
23
 
 
24
 
#include <drizzled/cached_directory.h>
 
20
#pragma once
 
21
 
25
22
#include <drizzled/definitions.h>
26
23
#include <drizzled/error_t.h>
27
24
#include <drizzled/handler_structs.h>
28
 
#include <drizzled/identifier.h>
29
25
#include <drizzled/message.h>
30
26
#include <drizzled/message/cache.h>
31
27
#include <drizzled/plugin.h>
40
36
 
41
37
#include <drizzled/visibility.h>
42
38
 
43
 
namespace drizzled
44
 
{
45
 
 
46
 
class TableList;
47
 
class Session;
48
 
class Cursor;
49
 
typedef struct st_hash HASH;
50
 
 
51
 
class TableShare;
 
39
namespace drizzled {
 
40
 
 
41
struct HASH;
 
42
 
52
43
typedef bool (stat_print_fn)(Session *session, const char *type, uint32_t type_len,
53
44
                             const char *file, uint32_t file_len,
54
45
                             const char *status, uint32_t status_len);
113
104
static const std::bitset<HTON_BIT_SIZE> HTON_HAS_FOREIGN_KEYS(1 << HTON_BIT_FOREIGN_KEYS);
114
105
 
115
106
 
116
 
class Table;
117
 
class NamedSavepoint;
118
 
 
119
 
namespace plugin
120
 
{
 
107
namespace plugin {
121
108
 
122
109
typedef std::vector<StorageEngine *> EngineVector;
123
110
 
282
269
  virtual int doCreateTable(Session &session,
283
270
                            Table &table_arg,
284
271
                            const drizzled::identifier::Table &identifier,
285
 
                            message::Table &message)= 0;
 
272
                            const message::Table &message)= 0;
286
273
 
287
274
  virtual int doRenameTable(Session &session,
288
275
                            const drizzled::identifier::Table &from, const drizzled::identifier::Table &to)= 0;
292
279
 
293
280
  virtual void doGetTableIdentifiers(CachedDirectory &directory,
294
281
                                     const drizzled::identifier::Schema &schema_identifier,
295
 
                                     identifier::Table::vector &set_of_identifiers)= 0;
 
282
                                     identifier::table::vector &set_of_identifiers)= 0;
296
283
 
297
284
  virtual bool doDoesTableExist(Session& session, const drizzled::identifier::Table &identifier);
298
285
 
323
310
  static bool addPlugin(plugin::StorageEngine *engine);
324
311
  static void removePlugin(plugin::StorageEngine *engine);
325
312
 
326
 
  static int getTableDefinition(Session& session,
327
 
                                const drizzled::identifier::Table &identifier,
328
 
                                message::table::shared_ptr &table_proto,
329
 
                                bool include_temporary_tables= true);
330
313
  static message::table::shared_ptr getTableMessage(Session& session,
331
314
                                                    const drizzled::identifier::Table &identifier,
332
 
                                                    drizzled::error_t &error,
333
315
                                                    bool include_temporary_tables= true);
334
316
  static bool doesTableExist(Session &session,
335
317
                             const drizzled::identifier::Table &identifier,
350
332
 
351
333
  static bool dropTable(Session& session,
352
334
                        StorageEngine &engine,
353
 
                        identifier::Table::const_reference identifier,
 
335
                        const identifier::Table& identifier,
354
336
                        drizzled::error_t &error);
355
337
 
356
338
  static void getIdentifiers(Session &session,
357
339
                             const identifier::Schema &schema_identifier,
358
 
                             identifier::Table::vector &set_of_identifiers);
 
340
                             identifier::table::vector &set_of_identifiers);
359
341
 
360
342
  // Check to see if any SE objects to creation.
361
343
  static bool canCreateTable(const drizzled::identifier::Table &identifier);
362
344
 
363
345
  // @note All schema methods defined here
364
 
  static void getIdentifiers(Session &session, identifier::Schema::vector &schemas);
365
 
  static bool getSchemaDefinition(const drizzled::identifier::Table &identifier, message::schema::shared_ptr &proto);
366
 
  static bool getSchemaDefinition(const drizzled::identifier::Schema &identifier, message::schema::shared_ptr &proto);
 
346
  static void getIdentifiers(Session &session, identifier::schema::vector &schemas);
 
347
  static message::schema::shared_ptr getSchemaDefinition(const drizzled::identifier::Table &identifier);
 
348
  static message::schema::shared_ptr getSchemaDefinition(const drizzled::identifier::Schema &identifier);
367
349
  static bool doesSchemaExist(const drizzled::identifier::Schema &identifier);
368
 
  static const CHARSET_INFO *getSchemaCollation(const drizzled::identifier::Schema &identifier);
 
350
  static const charset_info_st *getSchemaCollation(const drizzled::identifier::Schema &identifier);
369
351
  static bool createSchema(const drizzled::message::Schema &schema_message);
370
 
  static bool dropSchema(drizzled::Session& session, identifier::Schema::const_reference identifier);
 
352
  static bool dropSchema(Session &session,
 
353
                         const identifier::Schema& identifier,
 
354
                         message::schema::const_reference schema_message);
371
355
  static bool alterSchema(const drizzled::message::Schema &schema_message);
372
356
 
373
357
  // @note make private/protected
374
358
protected:
375
 
  virtual void doGetSchemaIdentifiers(identifier::Schema::vector&)
 
359
  virtual void doGetSchemaIdentifiers(identifier::schema::vector&)
376
360
  { }
377
361
 
378
 
  virtual bool doGetSchemaDefinition(const drizzled::identifier::Schema&, drizzled::message::schema::shared_ptr&)
 
362
  virtual drizzled::message::schema::shared_ptr doGetSchemaDefinition(const drizzled::identifier::Schema&)
379
363
  { 
380
 
    return false; 
 
364
    return drizzled::message::schema::shared_ptr(); 
381
365
  }
382
366
 
383
367
  virtual bool doCreateSchema(const drizzled::message::Schema&)
404
388
  Cursor *getCursor(Table &share);
405
389
 
406
390
  uint32_t max_record_length() const
407
 
  { return std::min((unsigned int)HA_MAX_REC_LENGTH, max_supported_record_length()); }
 
391
  { return std::min(HA_MAX_REC_LENGTH, max_supported_record_length()); }
408
392
  uint32_t max_keys() const
409
 
  { return std::min((unsigned int)MAX_KEY, max_supported_keys()); }
 
393
  { return std::min(MAX_KEY, max_supported_keys()); }
410
394
  uint32_t max_key_parts() const
411
 
  { return std::min((unsigned int)MAX_REF_PARTS, max_supported_key_parts()); }
 
395
  { return std::min(MAX_REF_PARTS, max_supported_key_parts()); }
412
396
  uint32_t max_key_length() const
413
 
  { return std::min((unsigned int)MAX_KEY_LENGTH, max_supported_key_length()); }
 
397
  { return std::min(MAX_KEY_LENGTH, max_supported_key_length()); }
414
398
  uint32_t max_key_part_length(void) const
415
 
  { return std::min((unsigned int)MAX_KEY_LENGTH, max_supported_key_part_length()); }
 
399
  { return std::min(MAX_KEY_LENGTH, max_supported_key_part_length()); }
416
400
 
417
401
  virtual uint32_t max_supported_record_length(void) const
418
402
  { return HA_MAX_REC_LENGTH; }
425
409
protected:
426
410
  static int deleteDefinitionFromPath(const drizzled::identifier::Table &identifier);
427
411
  static int renameDefinitionFromPath(const drizzled::identifier::Table &dest, const drizzled::identifier::Table &src);
428
 
  static int writeDefinitionFromPath(const drizzled::identifier::Table &identifier, message::Table &proto);
 
412
  static int writeDefinitionFromPath(const drizzled::identifier::Table &identifier, const message::Table &proto);
429
413
  static bool readTableFile(const std::string &path, message::Table &table_message);
430
414
 
431
415
public:
468
452
} /* namespace plugin */
469
453
} /* namespace drizzled */
470
454
 
471
 
#endif /* DRIZZLED_PLUGIN_STORAGE_ENGINE_H */