The creation of Information Schema plugins
The basic structure of the Information Schema plugins in similar to that of Daemon plugins. They need to be declared with mysql_declare_plugin
, and can have status and system variables. The initialization function, though, is a requirement for them, not an option, as this is the function where we define a new Information Schema table and tell MySQL what should happen when it is queried.
Defining Information Schema plugins
Just like with any other plugin type we use a macro to declare a plugin. This time we set the plugin type to MYSQL_INFORMATION_SCHEMA_PLUGIN
. An example of the definition may look like this:
mysql_declare_plugin(mysql_is_my_plugin) { MYSQL_INFORMATION_SCHEMA_PLUGIN, &mysql_is_my_plugin, "IS_MY_PLUGIN", "Andrew Hutchings (Andrew.Hutchings@Sun.COM)", "An information schema plugin", PLUGIN_LICENSE_GPL, is_my_plugin_init, is_my_plugin_deinit, 0x0010, NULL, NULL, NULL }
The differences start when we get to the initialization function...