156
161
uint32_t max_key_parts() const { return 0; }
157
162
uint32_t max_key_length() const { return 0; }
158
163
bool doDoesTableExist(Session& session, TableIdentifier &identifier);
164
int doRenameTable(Session&, TableIdentifier &from, TableIdentifier &to);
162
bool Tina::doDoesTableExist(Session&, TableIdentifier &identifier)
168
int Tina::doRenameTable(Session &session,
169
TableIdentifier &from, TableIdentifier &to)
164
ProtoCache::iterator iter;
166
pthread_mutex_lock(&proto_cache_mutex);
167
iter= proto_cache.find(identifier.getPath());
169
if (iter != proto_cache.end())
172
for (const char **ext= bas_ext(); *ext ; ext++)
174
if (rename_file_ext(from.getPath().c_str(), to.getPath().c_str(), *ext))
176
if ((error=errno) != ENOENT)
173
pthread_mutex_unlock(&proto_cache_mutex);
179
int Tina::doDropTable(Session&,
182
session.renameTableMessage(from, to);
187
bool Tina::doDoesTableExist(Session &session, TableIdentifier &identifier)
189
return session.doesTableMessageExist(identifier);
193
int Tina::doDropTable(Session &session,
180
194
TableIdentifier &identifier)
183
197
int enoent_or_zero= ENOENT; // Error if no file was deleted
184
198
char buff[FN_REFLEN];
185
ProtoCache::iterator iter;
187
200
for (const char **ext= bas_ext(); *ext ; ext++)
198
211
error= enoent_or_zero;
201
pthread_mutex_lock(&proto_cache_mutex);
202
iter= proto_cache.find(identifier.getPath());
204
if (iter!= proto_cache.end())
205
proto_cache.erase(iter);
206
pthread_mutex_unlock(&proto_cache_mutex);
214
session.removeTableMessage(identifier);
233
int Tina::doGetTableDefinition(Session&,
241
int Tina::doGetTableDefinition(Session &session,
234
242
drizzled::TableIdentifier &identifier,
235
243
drizzled::message::Table &table_message)
238
ProtoCache::iterator iter;
240
pthread_mutex_lock(&proto_cache_mutex);
241
iter= proto_cache.find(identifier.getPath());
243
if (iter!= proto_cache.end())
245
table_message.CopyFrom(((*iter).second));
248
pthread_mutex_unlock(&proto_cache_mutex);
245
if (session.getTableMessage(identifier, table_message))
254
252
static Tina *tina_engine= NULL;
256
static int tina_init_func(drizzled::plugin::Registry ®istry)
254
static int tina_init_func(drizzled::plugin::Context &context)
259
257
tina_engine= new Tina("CSV");
260
registry.add(tina_engine);
258
context.add(tina_engine);
262
260
pthread_mutex_init(&tina_mutex,MY_MUTEX_INIT_FAST);
266
static int tina_done_func(drizzled::plugin::Registry ®istry)
268
registry.remove(tina_engine);
271
pthread_mutex_destroy(&tina_mutex);
277
266
TinaShare::TinaShare(const char *table_name_arg)
1397
1386
this (the database will call ::open() if it needs to).
1400
int Tina::doCreateTable(Session *,
1389
int Tina::doCreateTable(Session *session,
1401
1390
Table& table_arg,
1402
1391
drizzled::TableIdentifier &identifier,
1403
drizzled::message::Table& create_proto)
1392
drizzled::message::Table &create_proto)
1405
1394
char name_buff[FN_REFLEN];
1406
1395
int create_file;
1434
1423
internal::my_close(create_file, MYF(0));
1436
pthread_mutex_lock(&proto_cache_mutex);
1437
proto_cache.insert(make_pair(identifier.getPath(), create_proto));
1438
pthread_mutex_unlock(&proto_cache_mutex);
1425
session->storeTableMessage(identifier, create_proto);
1450
1437
"CSV storage engine",
1451
1438
PLUGIN_LICENSE_GPL,
1452
1439
tina_init_func, /* Plugin Init */
1453
tina_done_func, /* Plugin Deinit */
1454
1440
NULL, /* system variables */
1455
1441
NULL /* config options */