You can call the mysql_load_plugin() function to load an OBClient plug-in of the specified name and type.
Syntax
struct st_mysql_client_plugin *
mysql_load_plugin(MYSQL *mysql,
const char *name,
int type,
int argc,
...)
Arguments
mysql: a pointer to aMYSQLstructure. The plug-in API does not require a connection to the OBServer, but this structure must be properly initialized. The structure is used to obtain connection-related information.name: The name of the plug-in that you want to load.type: The type of the plug-in that you want to load. You can set it to-1to disable type checking. Iftypeis not-1, only plug-ins that match the type are considered for loading.argc: The number of following arguments. Set it to 0 if no following argument exists.
Return values
A pointer to the plug-in is returned after the plug-in is loaded. NULL is returned if an error occurred.
Errors
Call the mysql_error() or mysql_errno() function to check for errors.
Notes
An error occurs if the type is invalid or the plug-in cannot be loaded. You cannot load multiple plug-ins of the same type. An error occurs if you try to load a plug-in of a type already loaded.
Alternatively, you can load plug-ins by setting the LIBMYSQL_PLUGINS environment variable to a list of plug-in names separated with semicolons (;). Example:
export LIBMYSQL_PLUGINS="myplugin1;myplugin2;myplugin3"
Plug-ins named by LIBMYSQL_PLUGINS are loaded when the client program calls mysql_library_init(). No error is reported if problems occur in loading these plug-ins. The LIBMYSQL_PLUGIN_DIR environment variable can be set to the path name of the directory in which client plug-ins are searched for. This variable is used in two ways:
- During the preloading of client plug-ins, the value of the
--plugin-diroption is not available. Therefore, client plug-in loading fails unless the plug-ins are located in the hardwired default directory. If the plug-ins are located elsewhere,LIBMYSQL_PLUGIN_DIRenvironment variable can be set to the proper directory to enable plug-in preloading to succeed.
- For explicit client plug-in loading, the
mysql_load_plugin()andmysql_load_plugin_v()functions are used. C API functions use theLIBMYSQL_PLUGIN_DIRvalue if it exists and the--plugin-diroption is not given. If--plugin-diris given,mysql_load_plugin()andmysql_load_plugin_v()ignoreLIBMYSQL_PLUGIN_DIR.