Commit 9e3a6897 authored by acurtis@xiphis.org's avatar acurtis@xiphis.org

plugin version changes

parent 9d4d1e81
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
Plugin API. Common for all plugin types. Plugin API. Common for all plugin types.
*/ */
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0000 #define MYSQL_PLUGIN_INTERFACE_VERSION 0x0001
/* /*
The allowable types of plugins The allowable types of plugins
...@@ -51,11 +51,11 @@ struct st_mysql_plugin ...@@ -51,11 +51,11 @@ struct st_mysql_plugin
int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */ int type; /* the plugin type (a MYSQL_XXX_PLUGIN value) */
void *info; /* pointer to type-specific plugin descriptor */ void *info; /* pointer to type-specific plugin descriptor */
const char *name; /* plugin name */ const char *name; /* plugin name */
uint version; /* plugin version */
const char *author; /* plugin author (for SHOW PLUGINS) */ const char *author; /* plugin author (for SHOW PLUGINS) */
const char *descr; /* general descriptive text (for SHOW PLUGINS ) */ const char *descr; /* general descriptive text (for SHOW PLUGINS ) */
int (*init)(void); /* the function to invoke when plugin is loaded */ int (*init)(void); /* the function to invoke when plugin is loaded */
int (*deinit)(void); /* the function to invoke when plugin is unloaded */ int (*deinit)(void); /* the function to invoke when plugin is unloaded */
uint version; /* plugin version (for SHOW PLUGINS) */
}; };
/************************************************************************* /*************************************************************************
......
...@@ -401,23 +401,6 @@ int ha_initialize_handlerton(handlerton *hton) ...@@ -401,23 +401,6 @@ int ha_initialize_handlerton(handlerton *hton)
if (hton == NULL) if (hton == NULL)
DBUG_RETURN(1); DBUG_RETURN(1);
/* check major version */
if ((hton->interface_version>>24) != (MYSQL_HANDLERTON_INTERFACE_VERSION>>24))
{
sql_print_error("handlerton major version incompatible");
DBUG_PRINT("warning", ("handlerton major version incompatible"));
DBUG_RETURN(1);
}
/* check minor version */
if ((hton->interface_version>>16)&0xff <
(MYSQL_HANDLERTON_INTERFACE_VERSION>>16)&0xff)
{
sql_print_error("handlerton minor version incompatible");
DBUG_PRINT("warning", ("handlerton minor version incompatible"));
DBUG_RETURN(1);
}
switch (hton->state) switch (hton->state)
{ {
case SHOW_OPTION_NO: case SHOW_OPTION_NO:
......
...@@ -337,7 +337,7 @@ typedef struct ...@@ -337,7 +337,7 @@ typedef struct
handlerton structure version handlerton structure version
*/ */
const int interface_version; const int interface_version;
#define MYSQL_HANDLERTON_INTERFACE_VERSION 0x00000000 #define MYSQL_HANDLERTON_INTERFACE_VERSION 0x0000
/* /*
......
...@@ -101,8 +101,7 @@ bool mysqld_show_storage_engines(THD *thd) ...@@ -101,8 +101,7 @@ bool mysqld_show_storage_engines(THD *thd)
static int make_version_string(char *buf, int buf_length, uint version) static int make_version_string(char *buf, int buf_length, uint version)
{ {
return my_snprintf(buf, buf_length, "%d.%d.%d", return my_snprintf(buf, buf_length, "%d.%d", version>>8,version&0xff);
(version>>24)&0xff, (version>>16)&0xff,version&0xffff);
} }
static my_bool show_plugins(THD *thd, st_plugin_int *plugin, static my_bool show_plugins(THD *thd, st_plugin_int *plugin,
...@@ -117,18 +116,23 @@ static my_bool show_plugins(THD *thd, st_plugin_int *plugin, ...@@ -117,18 +116,23 @@ static my_bool show_plugins(THD *thd, st_plugin_int *plugin,
restore_record(table, s->default_values); restore_record(table, s->default_values);
table->field[0]->store(plugin->name.str, plugin->name.length, cs); table->field[0]->store(plugin->name.str, plugin->name.length, cs);
table->field[1]->store(version_buf,
make_version_string(version_buf, sizeof(version_buf), plug->version),
cs);
switch (plugin->state) switch (plugin->state)
{ {
/* case PLUGIN_IS_FREED: does not happen */ /* case PLUGIN_IS_FREED: does not happen */
case PLUGIN_IS_DELETED: case PLUGIN_IS_DELETED:
table->field[1]->store(STRING_WITH_LEN("DELETED"), cs); table->field[2]->store(STRING_WITH_LEN("DELETED"), cs);
break; break;
case PLUGIN_IS_UNINITIALIZED: case PLUGIN_IS_UNINITIALIZED:
table->field[1]->store(STRING_WITH_LEN("INACTIVE"), cs); table->field[2]->store(STRING_WITH_LEN("INACTIVE"), cs);
break; break;
case PLUGIN_IS_READY: case PLUGIN_IS_READY:
table->field[1]->store(STRING_WITH_LEN("ACTIVE"), cs); table->field[2]->store(STRING_WITH_LEN("ACTIVE"), cs);
break; break;
default: default:
DBUG_ASSERT(0); DBUG_ASSERT(0);
...@@ -137,63 +141,56 @@ static my_bool show_plugins(THD *thd, st_plugin_int *plugin, ...@@ -137,63 +141,56 @@ static my_bool show_plugins(THD *thd, st_plugin_int *plugin,
switch (plug->type) switch (plug->type)
{ {
case MYSQL_UDF_PLUGIN: case MYSQL_UDF_PLUGIN:
table->field[2]->store(STRING_WITH_LEN("UDF"), cs); table->field[3]->store(STRING_WITH_LEN("UDF"), cs);
break; break;
case MYSQL_STORAGE_ENGINE_PLUGIN: case MYSQL_STORAGE_ENGINE_PLUGIN:
table->field[2]->store(STRING_WITH_LEN("STORAGE"), cs); table->field[3]->store(STRING_WITH_LEN("STORAGE"), cs);
break; break;
case MYSQL_FTPARSER_PLUGIN: case MYSQL_FTPARSER_PLUGIN:
table->field[2]->store(STRING_WITH_LEN("FTPARSER"), cs); table->field[3]->store(STRING_WITH_LEN("FTPARSER"), cs);
break; break;
default: default:
table->field[2]->store(STRING_WITH_LEN("UNKNOWN"), cs); table->field[3]->store(STRING_WITH_LEN("UNKNOWN"), cs);
break; break;
} }
if (plug->version) table->field[4]->store(version_buf,
{ make_version_string(version_buf, sizeof(version_buf),
table->field[3]->store(version_buf, *(uint *)plug->info), cs);
make_version_string(version_buf, sizeof(version_buf), plug->version),
cs);
table->field[3]->set_notnull();
}
else
table->field[3]->set_null();
if (plug->info)
{
table->field[4]->store(version_buf,
make_version_string(version_buf, sizeof(version_buf),
*(uint *)plug->info), cs);
table->field[4]->set_notnull();
}
else
table->field[4]->set_null();
if (plugin->plugin_dl) if (plugin->plugin_dl)
{ {
table->field[5]->store(plugin->plugin_dl->dl.str, table->field[5]->store(plugin->plugin_dl->dl.str,
plugin->plugin_dl->dl.length, cs); plugin->plugin_dl->dl.length, cs);
table->field[5]->set_notnull(); table->field[5]->set_notnull();
table->field[6]->store(version_buf,
make_version_string(version_buf, sizeof(version_buf),
plugin->plugin_dl->version),
cs);
table->field[6]->set_notnull();
} }
else else
{
table->field[5]->set_null(); table->field[5]->set_null();
table->field[6]->set_null();
}
if (plug->author) if (plug->author)
{ {
table->field[6]->store(plug->author, strlen(plug->author), cs); table->field[7]->store(plug->author, strlen(plug->author), cs);
table->field[6]->set_notnull(); table->field[7]->set_notnull();
} }
else else
table->field[6]->set_null(); table->field[7]->set_null();
if (plug->descr) if (plug->descr)
{ {
table->field[7]->store(plug->descr, strlen(plug->descr), cs); table->field[8]->store(plug->descr, strlen(plug->descr), cs);
table->field[7]->set_notnull(); table->field[8]->set_notnull();
} }
else else
table->field[7]->set_null(); table->field[8]->set_null();
return schema_table_store_record(thd, table); return schema_table_store_record(thd, table);
} }
...@@ -4293,11 +4290,12 @@ ST_FIELD_INFO variables_fields_info[]= ...@@ -4293,11 +4290,12 @@ ST_FIELD_INFO variables_fields_info[]=
ST_FIELD_INFO plugin_fields_info[]= ST_FIELD_INFO plugin_fields_info[]=
{ {
{"PLUGIN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name"}, {"PLUGIN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name"},
{"PLUGIN_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0},
{"PLUGIN_STATUS", 10, MYSQL_TYPE_STRING, 0, 0, "Status"}, {"PLUGIN_STATUS", 10, MYSQL_TYPE_STRING, 0, 0, "Status"},
{"PLUGIN_TYPE", 10, MYSQL_TYPE_STRING, 0, 0, "Type"}, {"PLUGIN_TYPE", 10, MYSQL_TYPE_STRING, 0, 0, "Type"},
{"PLUGIN_VERSION", 20, MYSQL_TYPE_STRING, 0, 1, 0}, {"PLUGIN_TYPE_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0},
{"PLUGIN_TYPE_VERSION", 20, MYSQL_TYPE_STRING, 0, 1, 0},
{"PLUGIN_LIBRARY", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, "Library"}, {"PLUGIN_LIBRARY", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, "Library"},
{"PLUGIN_LIBRARY_VERSION", 20, MYSQL_TYPE_STRING, 0, 1, 0},
{"PLUGIN_AUTHOR", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0}, {"PLUGIN_AUTHOR", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{"PLUGIN_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0}, {"PLUGIN_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0} {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
......
...@@ -949,11 +949,11 @@ mysql_declare_plugin ...@@ -949,11 +949,11 @@ mysql_declare_plugin
MYSQL_STORAGE_ENGINE_PLUGIN, MYSQL_STORAGE_ENGINE_PLUGIN,
&tina_hton, &tina_hton,
tina_hton.name, tina_hton.name,
0x00010000 /* 0.1.0 */,
"Brian Aker, MySQL AB", "Brian Aker, MySQL AB",
"CSV Storage Engine", "CSV Storage Engine",
tina_init_func, /* Plugin Init */ tina_init_func, /* Plugin Init */
tina_done_func /* Plugin Deinit */ tina_done_func, /* Plugin Deinit */
0x0100 /* 1.0 */,
} }
mysql_declare_plugin_end; mysql_declare_plugin_end;
...@@ -730,11 +730,11 @@ mysql_declare_plugin ...@@ -730,11 +730,11 @@ mysql_declare_plugin
MYSQL_STORAGE_ENGINE_PLUGIN, MYSQL_STORAGE_ENGINE_PLUGIN,
&example_hton, &example_hton,
example_hton.name, example_hton.name,
0x01000000 /* 1.0.0 */,
"Brian Aker, MySQL AB", "Brian Aker, MySQL AB",
"Example Storage Engine", "Example Storage Engine",
tina_init_func, /* Plugin Init */ tina_init_func, /* Plugin Init */
tina_done_func /* Plugin Deinit */ tina_done_func, /* Plugin Deinit */
0x0001 /* 0.1 */,
} }
mysql_declare_plugin_end; mysql_declare_plugin_end;
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