Commit d7de5c34 authored by unknown's avatar unknown

This pulls two function calls which should have been handlerton calls out of handler.cc.


sql/ha_ndbcluster.cc:
  Adding in new handlerton calls.
sql/handler.cc:
  Calls directly made to NDB have been removed.
sql/handler.h:
  Two additional handlerton structure functions.
parent 2f8849e2
...@@ -6388,6 +6388,8 @@ static int ndbcluster_init() ...@@ -6388,6 +6388,8 @@ static int ndbcluster_init()
#endif #endif
h.flags= HTON_CAN_RECREATE | HTON_TEMPORARY_NOT_SUPPORTED; h.flags= HTON_CAN_RECREATE | HTON_TEMPORARY_NOT_SUPPORTED;
h.discover= ndbcluster_discover; h.discover= ndbcluster_discover;
h.find_files= ndbcluster_find_files;
h.table_exists_in_engine= ndbcluster_table_exists_in_engine;
} }
if (have_ndbcluster != SHOW_OPTION_YES) if (have_ndbcluster != SHOW_OPTION_YES)
......
...@@ -28,11 +28,6 @@ ...@@ -28,11 +28,6 @@
#include <myisampack.h> #include <myisampack.h>
#include <errno.h> #include <errno.h>
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
#define NDB_MAX_ATTRIBUTES_IN_TABLE 128
#include "ha_ndbcluster.h"
#endif
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h" #include "ha_partition.h"
#endif #endif
...@@ -2745,6 +2740,29 @@ int ha_discover(THD *thd, const char *db, const char *name, ...@@ -2745,6 +2740,29 @@ int ha_discover(THD *thd, const char *db, const char *name,
to ask engine if there are any new tables that should be written to disk 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 or any dropped tables that need to be removed from disk
*/ */
typedef struct st_find_files_args
{
const char *db;
const char *path;
const char *wild;
bool dir;
List<char> *files;
};
static my_bool find_files_handlerton(THD *thd, st_plugin_int *plugin,
void *arg)
{
st_find_files_args *vargs= (st_find_files_args *)arg;
handlerton *hton= (handlerton *)plugin->data;
if (hton->state == SHOW_OPTION_YES && hton->find_files)
if (hton->find_files(thd, vargs->db, vargs->path, vargs->wild,
vargs->dir, vargs->files))
return TRUE;
return FALSE;
}
int int
ha_find_files(THD *thd,const char *db,const char *path, ha_find_files(THD *thd,const char *db,const char *path,
...@@ -2754,10 +2772,11 @@ ha_find_files(THD *thd,const char *db,const char *path, ...@@ -2754,10 +2772,11 @@ ha_find_files(THD *thd,const char *db,const char *path,
DBUG_ENTER("ha_find_files"); DBUG_ENTER("ha_find_files");
DBUG_PRINT("enter", ("db: %s, path: %s, wild: %s, dir: %d", DBUG_PRINT("enter", ("db: %s, path: %s, wild: %s, dir: %d",
db, path, wild, dir)); db, path, wild, dir));
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE st_find_files_args args= {db, path, wild, dir, files};
if (have_ndbcluster == SHOW_OPTION_YES)
error= ndbcluster_find_files(thd, db, path, wild, dir, files); plugin_foreach(thd, find_files_handlerton,
#endif MYSQL_STORAGE_ENGINE_PLUGIN, &args);
/* The return value is not currently used */
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -2771,15 +2790,34 @@ ha_find_files(THD *thd,const char *db,const char *path, ...@@ -2771,15 +2790,34 @@ ha_find_files(THD *thd,const char *db,const char *path,
# Error code # Error code
*/ */
typedef struct st_table_exists_in_engine_args
{
const char *db;
const char *name;
};
static my_bool table_exists_in_engine_handlerton(THD *thd, st_plugin_int *plugin,
void *arg)
{
st_table_exists_in_engine_args *vargs= (st_table_exists_in_engine_args *)arg;
handlerton *hton= (handlerton *)plugin->data;
if (hton->state == SHOW_OPTION_YES && hton->table_exists_in_engine)
if ((hton->table_exists_in_engine(thd, vargs->db, vargs->name)) == 1)
return TRUE;
return FALSE;
}
int ha_table_exists_in_engine(THD* thd, const char* db, const char* name) int ha_table_exists_in_engine(THD* thd, const char* db, const char* name)
{ {
int error= 0; int error= 0;
DBUG_ENTER("ha_table_exists_in_engine"); DBUG_ENTER("ha_table_exists_in_engine");
DBUG_PRINT("enter", ("db: %s, name: %s", db, name)); DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE st_table_exists_in_engine_args args= {db, name};
if (have_ndbcluster == SHOW_OPTION_YES) error= plugin_foreach(thd, table_exists_in_engine_handlerton,
error= ndbcluster_table_exists_in_engine(thd, db, name); MYSQL_STORAGE_ENGINE_PLUGIN, &args);
#endif
DBUG_PRINT("exit", ("error: %d", error)); DBUG_PRINT("exit", ("error: %d", error));
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -669,6 +669,10 @@ struct handlerton ...@@ -669,6 +669,10 @@ struct handlerton
struct handler_iterator *fill_this_in); struct handler_iterator *fill_this_in);
int (*discover)(THD* thd, const char *db, const char *name, int (*discover)(THD* thd, const char *db, const char *name,
const void** frmblob, uint* frmlen); const void** frmblob, uint* frmlen);
int (*find_files)(THD *thd,const char *db,const char *path,
const char *wild, bool dir, List<char> *files);
int (*table_exists_in_engine)(THD* thd, const char *db,
const char *name);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment