|
|
|
@ -4371,96 +4371,6 @@ int ha_discover(THD *thd, const char *db, const char *name, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Call this function in order to give the handler the possiblity |
|
|
|
to ask engine if there are any new tables that should be written to disk |
|
|
|
or any dropped tables that need to be removed from disk |
|
|
|
*/ |
|
|
|
struct st_find_files_args |
|
|
|
{ |
|
|
|
const char *db; |
|
|
|
const char *path; |
|
|
|
const char *wild; |
|
|
|
bool dir; |
|
|
|
List<LEX_STRING> *files; |
|
|
|
}; |
|
|
|
|
|
|
|
static my_bool find_files_handlerton(THD *thd, plugin_ref plugin, |
|
|
|
void *arg) |
|
|
|
{ |
|
|
|
st_find_files_args *vargs= (st_find_files_args *)arg; |
|
|
|
handlerton *hton= plugin_data(plugin, handlerton *); |
|
|
|
|
|
|
|
|
|
|
|
if (hton->state == SHOW_OPTION_YES && hton->find_files) |
|
|
|
if (hton->find_files(hton, thd, vargs->db, vargs->path, vargs->wild, |
|
|
|
vargs->dir, vargs->files)) |
|
|
|
return TRUE; |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
|
|
|
|
int |
|
|
|
ha_find_files(THD *thd,const char *db,const char *path, |
|
|
|
const char *wild, bool dir, List<LEX_STRING> *files) |
|
|
|
{ |
|
|
|
int error= 0; |
|
|
|
DBUG_ENTER("ha_find_files"); |
|
|
|
DBUG_PRINT("enter", ("db: '%s' path: '%s' wild: '%s' dir: %d", |
|
|
|
db, path, wild, dir)); |
|
|
|
st_find_files_args args= {db, path, wild, dir, files}; |
|
|
|
|
|
|
|
plugin_foreach(thd, find_files_handlerton, |
|
|
|
MYSQL_STORAGE_ENGINE_PLUGIN, &args); |
|
|
|
/* The return value is not currently used */ |
|
|
|
DBUG_RETURN(error); |
|
|
|
} |
|
|
|
|
|
|
|
/**
|
|
|
|
Ask handler if the table exists in engine. |
|
|
|
@retval |
|
|
|
HA_ERR_NO_SUCH_TABLE Table does not exist |
|
|
|
@retval |
|
|
|
HA_ERR_TABLE_EXIST Table exists |
|
|
|
@retval |
|
|
|
\# Error code |
|
|
|
*/ |
|
|
|
struct st_table_exists_in_engine_args |
|
|
|
{ |
|
|
|
const char *db; |
|
|
|
const char *name; |
|
|
|
int err; |
|
|
|
}; |
|
|
|
|
|
|
|
static my_bool table_exists_in_engine_handlerton(THD *thd, plugin_ref plugin, |
|
|
|
void *arg) |
|
|
|
{ |
|
|
|
st_table_exists_in_engine_args *vargs= (st_table_exists_in_engine_args *)arg; |
|
|
|
handlerton *hton= plugin_data(plugin, handlerton *); |
|
|
|
|
|
|
|
int err= HA_ERR_NO_SUCH_TABLE; |
|
|
|
|
|
|
|
if (hton->state == SHOW_OPTION_YES && hton->table_exists_in_engine) |
|
|
|
err = hton->table_exists_in_engine(hton, thd, vargs->db, vargs->name); |
|
|
|
|
|
|
|
vargs->err = err; |
|
|
|
if (vargs->err == HA_ERR_TABLE_EXIST) |
|
|
|
return TRUE; |
|
|
|
|
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
|
|
|
|
int ha_table_exists_in_engine(THD* thd, const char* db, const char* name) |
|
|
|
{ |
|
|
|
DBUG_ENTER("ha_table_exists_in_engine"); |
|
|
|
DBUG_PRINT("enter", ("db: %s, name: %s", db, name)); |
|
|
|
st_table_exists_in_engine_args args= {db, name, HA_ERR_NO_SUCH_TABLE}; |
|
|
|
plugin_foreach(thd, table_exists_in_engine_handlerton, |
|
|
|
MYSQL_STORAGE_ENGINE_PLUGIN, &args); |
|
|
|
DBUG_PRINT("exit", ("error: %d", args.err)); |
|
|
|
DBUG_RETURN(args.err); |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef HAVE_NDB_BINLOG
|
|
|
|
/*
|
|
|
|
TODO: change this into a dynamic struct |
|
|
|
|