110
116
size_t savepoint_offset;
111
117
size_t orig_savepoint_offset;
113
void setTransactionReadWrite(Session* session);
119
void setTransactionReadWrite(Session& session);
122
std::string table_definition_ext;
125
const std::string& getTableDefinitionExt()
127
return table_definition_ext;
134
Used as a protobuf storage currently by TEMP only engines.
136
typedef std::map <std::string, drizzled::message::Table> ProtoCache;
137
ProtoCache proto_cache;
138
pthread_mutex_t proto_cache_mutex;
118
141
* Implementing classes should override these to provide savepoint
266
298
virtual const char **bas_ext() const =0;
269
virtual int createTableImplementation(Session *session,
270
const char *table_name,
272
HA_CREATE_INFO *create_info,
273
drizzled::message::Table* proto)= 0;
275
virtual int renameTableImplementation(Session* session,
276
const char *from, const char *to);
278
virtual int deleteTableImplementation(Session* session,
279
const std::string table_path);
301
virtual int doCreateTable(Session *session,
302
const char *table_name,
304
HA_CREATE_INFO& create_info,
305
drizzled::message::Table& proto)= 0;
307
virtual int doRenameTable(Session* session,
308
const char *from, const char *to);
282
int doCreateTable(Session *session, const char *path,
284
HA_CREATE_INFO *create_info,
285
drizzled::message::Table *proto)
287
char name_buff[FN_REFLEN];
288
const char *table_name;
290
table_name= checkLowercaseNames(path, name_buff);
292
setTransactionReadWrite(session);
294
return createTableImplementation(session, table_name, table_arg,
298
313
int renameTable(Session *session, const char *from, const char *to)
300
setTransactionReadWrite(session);
302
return renameTableImplementation(session, from, to);
305
int doDeleteTable(Session* session, const std::string table_path)
307
setTransactionReadWrite(session);
309
return deleteTableImplementation(session, table_path);
315
setTransactionReadWrite(*session);
317
return doRenameTable(session, from, to);
320
// TODO: move these to protected
321
virtual void doGetTableNames(CachedDirectory &directory, std::string& db_name, std::set<std::string>& set_of_names);
322
virtual int doDropTable(Session& session,
323
const std::string table_path)= 0;
312
325
const char *checkLowercaseNames(const char *path, char *tmp_path);
314
virtual TableNameIteratorImplementation* tableNameIterator(const std::string &database)
321
327
/* Class Methods for operating on plugin */
322
328
static bool addPlugin(plugin::StorageEngine *engine);
323
329
static void removePlugin(plugin::StorageEngine *engine);
325
static int getTableProto(const char* path, message::Table *table_proto);
331
static int getTableDefinition(Session& session,
334
const char *table_name,
336
message::Table *table_proto= NULL);
327
static plugin::StorageEngine *findByName(Session *session,
338
static plugin::StorageEngine *findByName(std::string find_str);
339
static plugin::StorageEngine *findByName(Session& session,
328
340
std::string find_str);
329
341
static void closeConnection(Session* session);
330
342
static void dropDatabase(char* path);
333
345
static bool flushLogs(plugin::StorageEngine *db_type);
334
346
static int recover(HASH *commit_list);
335
347
static int startConsistentSnapshot(Session *session);
336
static int deleteTable(Session *session, const char *path, const char *db,
337
const char *alias, bool generate_warning);
348
static int dropTable(Session& session, const char *path, const char *db,
349
const char *alias, bool generate_warning);
350
static void getTableNames(std::string& db_name, std::set<std::string> &set_of_names);
338
352
static inline const std::string &resolveName(const StorageEngine *engine)
340
354
return engine == NULL ? UNKNOWN_STRING : engine->getName();
344
* Return the default storage engine plugin::StorageEngine for thread
346
* defaultStorageEngine(session)
347
* @param session current thread
350
* pointer to plugin::StorageEngine
352
static StorageEngine *defaultStorageEngine(Session *session);
354
static int createTable(Session *session, const char *path,
357
static int createTable(Session& session, const char *path,
355
358
const char *db, const char *table_name,
356
HA_CREATE_INFO *create_info,
359
HA_CREATE_INFO& create_info,
357
360
bool update_create_info,
358
drizzled::message::Table *table_proto);
361
drizzled::message::Table& table_proto,
360
364
Cursor *getCursor(TableShare *share, MEM_ROOT *alloc);
363
class TableNameIteratorImplementation
368
TableNameIteratorImplementation(const std::string &database) : db(database)
370
virtual ~TableNameIteratorImplementation() {};
372
virtual int next(std::string *name)= 0;
376
class TableNameIterator
379
NameMap<plugin::StorageEngine *>::iterator engine_iter;
380
plugin::TableNameIteratorImplementation *current_implementation;
381
plugin::TableNameIteratorImplementation *default_implementation;
382
std::string database;
384
TableNameIterator(const std::string &db);
385
~TableNameIterator();
387
int next(std::string *name);
391
367
} /* namespace plugin */
392
368
} /* namespace drizzled */