Databases Reference
In-Depth Information
In the next member, each plugin specifies its license. This does not strictly do
anything as such, but should help with accidental distribution of a plugin under the
wrong license. There are currently three possible values for the license member:
License
Description
PLUGIN_LICENSE_PROPRIETARY
Any proprietary license
PLUGIN_LICENSE_GPL
GPL license
PLUGIN_LICENSE_BSD
BSD license
Then we come to the init and deinit members, which are pointers to the plugin
initialization and de-initialization functions. The initialization function is called when
the plugin is loaded during INSTALL PLUGIN or server startup. The de-initialization
function is called when a plugin is unloaded, which, again, can happen for two
reasons, UNINSTALL PLUGIN or server shutdown. In a Daemon plugin the initialization
function is often used to fork a thread to run the main function of the plugin. Both
the initialization and the de-initialization functions should return 0 on success or 1
on failure.
The version member should be used for the current version of our plugin. A
two-component version is encoded as a hexadecimal number, where the lower 8
bits store the second component (minor version) and all others bits store the first
component (major version). For example, if the version is set to 0x205, MySQL will
show it as "2.5", and if the version is set to 0x123FF, MySQL will show it as "291.255".
Unfortunately, there is no way to store in this member a more complex version such
as "1.10.14b-RC2".
MySQL has many status variables that can be seen with the SHOW STATUS statement,
and there are different third-party tools that analyze this data, how the status
variables change over time, draw graphs, and so on. A plugin can benefit from that
and make its status and various statistics and performance values visible as MySQL
status variables. A pointer to the list of the plugin status variables is stored in the
status_vars member.
Similarly, there is a SHOW VARIABLES statement. It lists all MySQL system variables ,
variables that are used to alter the behavior of the server. They can have server-
wide or session-only effect, some of them can be set on the command line or in the
configuration file. They can be modifiable run-time or read-only. This is all available
to plugins too. A plugin can add new system variables to the server, global or session,
with or without command-line option support, modifiable or read-only. As we would
expect, a pointer to the array of these variables goes into the system_vars member.
Finally there is one __reserved1 member, which is unused in MySQL 5.1 and
should be set to NULL .
Search WWH ::




Custom Search