~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/storage_engine.h

  • Committer: Andrew Hutchings
  • Date: 2011-02-01 10:23:22 UTC
  • mto: (2136.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2137.
  • Revision ID: andrew@linuxjedi.co.uk-20110201102322-oxztcyrjzg3c7yta
Fix counters cleanup

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