56
56
return ha_heap_exts;
59
int createTableImplementation(Session *session, const char *table_name,
60
Table *table_arg, HA_CREATE_INFO *create_info,
61
drizzled::message::Table*);
59
int doCreateTable(Session *session,
60
const char *table_name,
62
HA_CREATE_INFO& create_info,
63
drizzled::message::Table&);
63
65
/* For whatever reason, internal tables can be created by Cursor::open()
66
68
at night with this odd hackish workaround.
68
70
int heap_create_table(Session *session, const char *table_name,
69
Table *table_arg, HA_CREATE_INFO *create_info,
71
Table *table_arg, HA_CREATE_INFO& create_info,
70
72
bool internal_table,
71
73
HP_SHARE **internal_share);
73
int renameTableImplementation(Session*, const char * from, const char * to);
75
int deleteTableImplementation(Session *, const string table_path);
75
int doRenameTable(Session*, const char * from, const char * to);
77
int doDropTable(Session&, const string table_path);
79
int doGetTableDefinition(Session& session,
82
const char *table_name,
84
drizzled::message::Table *table_proto);
86
/* Temp only engine, so do not return values. */
87
void doGetTableNames(CachedDirectory &, string& , set<string>&) { };
91
int HeapEngine::doGetTableDefinition(Session&,
96
drizzled::message::Table *table_proto)
99
ProtoCache::iterator iter;
101
pthread_mutex_lock(&proto_cache_mutex);
102
iter= proto_cache.find(path);
104
if (iter!= proto_cache.end())
107
table_proto->CopyFrom(((*iter).second));
110
pthread_mutex_unlock(&proto_cache_mutex);
79
115
We have to ignore ENOENT entries as the HEAP table is created on open and
80
116
not when doing a CREATE on the table.
82
int HeapEngine::deleteTableImplementation(Session*, const string table_path)
118
int HeapEngine::doDropTable(Session&, const string table_path)
120
ProtoCache::iterator iter;
122
pthread_mutex_lock(&proto_cache_mutex);
123
iter= proto_cache.find(table_path.c_str());
125
if (iter!= proto_cache.end())
126
proto_cache.erase(iter);
127
pthread_mutex_unlock(&proto_cache_mutex);
84
129
return heap_delete_table(table_path.c_str());
142
187
HP_SHARE *internal_share= NULL;
143
188
if (!heap_storage_engine->heap_create_table(ha_session(), name, table,
145
190
internal_table,&internal_share))
147
192
file= internal_table ?
613
int HeapEngine::renameTableImplementation(Session*,
614
const char *from, const char *to)
658
int HeapEngine::doRenameTable(Session*,
659
const char *from, const char *to)
616
661
return heap_rename(from,to);
639
684
return key->rec_per_key[key->key_parts-1];
642
int HeapEngine::createTableImplementation(Session *session,
643
const char *table_name,
645
HA_CREATE_INFO *create_info,
646
drizzled::message::Table*)
687
int HeapEngine::doCreateTable(Session *session,
688
const char *table_name,
690
HA_CREATE_INFO& create_info,
691
drizzled::message::Table& create_proto)
648
694
HP_SHARE *internal_share;
649
return heap_create_table(session, table_name, table_arg, create_info,
696
error= heap_create_table(session, table_name, &table_arg, create_info,
650
697
false, &internal_share);
701
pthread_mutex_lock(&proto_cache_mutex);
702
proto_cache.insert(make_pair(table_name, create_proto));
703
pthread_mutex_unlock(&proto_cache_mutex);
654
710
int HeapEngine::heap_create_table(Session *session, const char *table_name,
655
Table *table_arg, HA_CREATE_INFO *create_info,
711
Table *table_arg, HA_CREATE_INFO& create_info,
656
712
bool internal_table, HP_SHARE **internal_share)
658
714
uint32_t key, parts, mem_per_row_keys= 0, keys= table_arg->s->keys;
822
878
HP_CREATE_INFO hp_create_info;
823
879
hp_create_info.auto_key= auto_key;
824
880
hp_create_info.auto_key_type= auto_key_type;
825
hp_create_info.auto_increment= (create_info->auto_increment_value ?
826
create_info->auto_increment_value - 1 : 0);
881
hp_create_info.auto_increment= (create_info.auto_increment_value ?
882
create_info.auto_increment_value - 1 : 0);
827
883
hp_create_info.max_table_size=session->variables.max_heap_table_size;
828
884
hp_create_info.with_auto_increment= found_real_auto_increment;
829
885
hp_create_info.internal_table= internal_table;