Make it possible to specify query classifier name.
If none provided or if the name is empty, the default query classifier is loaded.
This commit is contained in:
@ -40,24 +40,29 @@ static const char default_qc_name[] = "qc_mysqlembedded";
|
||||
static QUERY_CLASSIFIER* classifier;
|
||||
|
||||
|
||||
bool qc_init(void)
|
||||
bool qc_init(const char* plugin_name)
|
||||
{
|
||||
QC_TRACE();
|
||||
ss_dassert(!classifier);
|
||||
|
||||
if (!plugin_name || (*plugin_name == 0))
|
||||
{
|
||||
plugin_name = default_qc_name;
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
void* module = load_module(default_qc_name, MODULE_QUERY_CLASSIFIER);
|
||||
void* module = load_module(plugin_name, MODULE_QUERY_CLASSIFIER);
|
||||
|
||||
if (module)
|
||||
{
|
||||
classifier = (QUERY_CLASSIFIER*) module;
|
||||
MXS_NOTICE("%s loaded.", default_qc_name);
|
||||
MXS_NOTICE("%s loaded.", plugin_name);
|
||||
|
||||
success = classifier->qc_init();
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Could not load %s.", default_qc_name);
|
||||
MXS_ERROR("Could not load %s.", plugin_name);
|
||||
}
|
||||
|
||||
return success;
|
||||
|
@ -74,7 +74,7 @@ typedef enum
|
||||
|
||||
#define QUERY_IS_TYPE(mask,type) ((mask & type) == type)
|
||||
|
||||
bool qc_init(void);
|
||||
bool qc_init(const char* plugin_name);
|
||||
void qc_end(void);
|
||||
|
||||
bool qc_thread_init(void);
|
||||
|
Reference in New Issue
Block a user