summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
authorbrian@zim.(none) <>2006-09-15 10:28:00 -0700
committerbrian@zim.(none) <>2006-09-15 10:28:00 -0700
commit7194b6d75abf490de0b2fc7b389ee8aa1d043377 (patch)
tree23dd89b8830f721d6e87266e1e75109a0c51996d /sql/sql_plugin.cc
parent24df00f232daed11b55f23f6d160e1bfabc86fdd (diff)
downloadmariadb-git-7194b6d75abf490de0b2fc7b389ee8aa1d043377.tar.gz
This changes the order of the universe, black is now the new white.
In practice this means that handlerton is now created by the server and is passed to the engine. Plugin startups can now also control how plugins are inited (and can optionally pass values). Bit more flexibility to those who want to write plugin interfaces to the database.
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc58
1 files changed, 31 insertions, 27 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 84810fb3324..97c28dd1fa5 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -477,13 +477,6 @@ err:
void plugin_deinitialize(struct st_plugin_int *plugin)
{
- if (plugin_type_deinitialize[plugin->plugin->type] &&
- (*plugin_type_deinitialize[plugin->plugin->type])(plugin))
- {
- sql_print_error("Plugin '%s' of type %s failed deinitialization",
- plugin->name.str, plugin_type_names[plugin->plugin->type]);
- }
-
if (plugin->plugin->status_vars)
{
#ifdef FIX_LATER
@@ -504,10 +497,18 @@ void plugin_deinitialize(struct st_plugin_int *plugin)
#endif /* FIX_LATER */
}
- if (plugin->plugin->deinit)
+ if (plugin_type_deinitialize[plugin->plugin->type])
+ {
+ if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin))
+ {
+ sql_print_error("Plugin '%s' of type %s failed deinitialization",
+ plugin->name.str, plugin_type_names[plugin->plugin->type]);
+ }
+ }
+ else if (plugin->plugin->deinit)
{
DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
- if (plugin->plugin->deinit())
+ if (plugin->plugin->deinit(NULL))
{
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
plugin->name.str));
@@ -556,6 +557,27 @@ static int plugin_initialize(struct st_plugin_int *plugin)
{
DBUG_ENTER("plugin_initialize");
+ if (plugin_type_initialize[plugin->plugin->type])
+ {
+ if ((*plugin_type_initialize[plugin->plugin->type])(plugin))
+ {
+ sql_print_error("Plugin '%s' registration as a %s failed.",
+ plugin->name.str, plugin_type_names[plugin->plugin->type]);
+ goto err;
+ }
+ }
+ else if (plugin->plugin->init)
+ {
+ if (plugin->plugin->init(NULL))
+ {
+ sql_print_error("Plugin '%s' init function returned error.",
+ plugin->name.str);
+ goto err;
+ }
+ }
+
+ plugin->state= PLUGIN_IS_READY;
+
if (plugin->plugin->status_vars)
{
#ifdef FIX_LATER
@@ -576,24 +598,6 @@ static int plugin_initialize(struct st_plugin_int *plugin)
add_status_vars(plugin->plugin->status_vars); // add_status_vars makes a copy
#endif /* FIX_LATER */
}
- if (plugin->plugin->init)
- {
- if (plugin->plugin->init())
- {
- sql_print_error("Plugin '%s' init function returned error.",
- plugin->name.str);
- goto err;
- }
- }
- if (plugin_type_initialize[plugin->plugin->type] &&
- (*plugin_type_initialize[plugin->plugin->type])(plugin))
- {
- sql_print_error("Plugin '%s' registration as a %s failed.",
- plugin->name.str, plugin_type_names[plugin->plugin->type]);
- goto err;
- }
-
- plugin->state= PLUGIN_IS_READY;
DBUG_RETURN(0);
err: