25
25
#include <drizzled/field/timestamp.h>
26
26
#include <drizzled/field/varstring.h>
32
static const string engine_name("MEMORY");
29
34
pthread_mutex_t THR_LOCK_heap= PTHREAD_MUTEX_INITIALIZER;
31
static handler *heap_create_handler(handlerton *hton,
35
int heap_deinit(void *)
37
class HeapEngine : public StorageEngine
40
HeapEngine(string name_arg) : StorageEngine(name_arg) {}
41
virtual handler *create(TABLE_SHARE *table,
44
return new (mem_root) ha_heap(this, table);
48
int heap_init(void *p)
50
StorageEngine **engine= static_cast<StorageEngine **>(p);
51
*engine= new HeapEngine(engine_name);
53
(*engine)->state= SHOW_OPTION_YES;
54
(*engine)->flags= HTON_CAN_RECREATE;
59
int heap_deinit(void *p)
61
HeapEngine *engine= static_cast<HeapEngine *>(p);
37
64
pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST);
39
66
return hp_panic(HA_PANIC_CLOSE);
43
int heap_init(void *p)
45
heap_hton= (handlerton *)p;
46
heap_hton->state= SHOW_OPTION_YES;
47
heap_hton->create= heap_create_handler;
48
heap_hton->flags= HTON_CAN_RECREATE;
53
static handler *heap_create_handler(handlerton *hton,
57
return new (mem_root) ha_heap(hton, table);
61
71
/*****************************************************************************
63
73
*****************************************************************************/
65
ha_heap::ha_heap(handlerton *hton, TABLE_SHARE *table_arg)
66
:handler(hton, table_arg), file(0), records_changed(0), key_stat_version(0),
75
ha_heap::ha_heap(StorageEngine *engine_arg, TABLE_SHARE *table_arg)
76
:handler(engine_arg, table_arg), file(0), records_changed(0), key_stat_version(0),