123
123
Tina(const string& name_arg)
124
: drizzled::plugin::StorageEngine(name_arg, HTON_CAN_RECREATE | HTON_TEMPORARY_ONLY | HTON_FILE_BASED) {}
124
: drizzled::plugin::StorageEngine(name_arg, HTON_CAN_RECREATE | HTON_TEMPORARY_ONLY |
125
HTON_HAS_DATA_DICTIONARY | HTON_FILE_BASED) {}
125
126
virtual Cursor *create(TableShare *table,
126
127
MEM_ROOT *mem_root)
132
133
return ha_tina_exts;
135
int createTableImplementation(Session *, const char *table_name,
137
HA_CREATE_INFO *, drizzled::message::Table*);
136
int doCreateTable(Session *, const char *table_name,
138
HA_CREATE_INFO&, drizzled::message::Table&);
140
int doGetTableDefinition(Session& session,
143
const char *table_name,
145
drizzled::message::Table *table_proto);
147
/* Temp only engine, so do not return values. */
148
void doGetTableNames(CachedDirectory &, string& , set<string>&) { };
150
int doDropTable(Session&, const string table_path);
153
int Tina::doDropTable(Session&,
154
const string table_path)
157
int enoent_or_zero= ENOENT; // Error if no file was deleted
158
char buff[FN_REFLEN];
159
ProtoCache::iterator iter;
161
for (const char **ext= bas_ext(); *ext ; ext++)
163
fn_format(buff, table_path.c_str(), "", *ext,
164
MY_UNPACK_FILENAME|MY_APPEND_EXT);
165
if (my_delete_with_symlink(buff, MYF(0)))
167
if ((error= my_errno) != ENOENT)
171
enoent_or_zero= 0; // No error for ENOENT
172
error= enoent_or_zero;
175
pthread_mutex_lock(&proto_cache_mutex);
176
iter= proto_cache.find(table_path.c_str());
178
if (iter!= proto_cache.end())
179
proto_cache.erase(iter);
180
pthread_mutex_unlock(&proto_cache_mutex);
185
int Tina::doGetTableDefinition(Session&,
190
drizzled::message::Table *table_proto)
193
ProtoCache::iterator iter;
195
pthread_mutex_lock(&proto_cache_mutex);
196
iter= proto_cache.find(path);
198
if (iter!= proto_cache.end())
201
table_proto->CopyFrom(((*iter).second));
204
pthread_mutex_unlock(&proto_cache_mutex);
141
210
static Tina *tina_engine= NULL;
143
212
static int tina_init_func(drizzled::plugin::Registry ®istry)
1455
1524
this (the database will call ::open() if it needs to).
1458
int Tina::createTableImplementation(Session *, const char *table_name,
1460
HA_CREATE_INFO *, drizzled::message::Table*)
1527
int Tina::doCreateTable(Session *, const char *table_name,
1530
drizzled::message::Table& create_proto)
1462
1532
char name_buff[FN_REFLEN];
1463
1533
File create_file;
1491
1561
my_close(create_file, MYF(0));
1563
pthread_mutex_lock(&proto_cache_mutex);
1564
proto_cache.insert(make_pair(table_name, create_proto));
1565
pthread_mutex_unlock(&proto_cache_mutex);
1496
1570
int ha_tina::check(Session* session, HA_CHECK_OPT *)