MXS-1278: Sql mode must be specified explicitly

The default sql mode must now be provided explicitly when the query
classifier is setup. This is in preparation for "sql_mode" becoming
a global configuration parameter of MaxScale.
This commit is contained in:
Johan Wikman
2017-06-05 13:07:19 +03:00
parent 057ba4156d
commit a690b44919
15 changed files with 58 additions and 81 deletions

View File

@ -1897,7 +1897,7 @@ int main(int argc, char **argv)
cnf = config_get_global_options();
ss_dassert(cnf);
if (!qc_setup(cnf->qc_name, cnf->qc_args))
if (!qc_setup(cnf->qc_name, QC_SQL_MODE_DEFAULT, cnf->qc_args))
{
const char* logerr = "Failed to initialise query classifier library.";
print_log_n_stderr(true, true, logerr, logerr, eno);

View File

@ -45,7 +45,7 @@ static QUERY_CLASSIFIER* classifier;
static qc_trx_parse_using_t qc_trx_parse_using = QC_TRX_PARSE_USING_PARSER;
bool qc_setup(const char* plugin_name, const char* plugin_args)
bool qc_setup(const char* plugin_name, qc_sql_mode_t sql_mode, const char* plugin_args)
{
QC_TRACE();
ss_dassert(!classifier);
@ -61,7 +61,7 @@ bool qc_setup(const char* plugin_name, const char* plugin_args)
if (classifier)
{
rv = classifier->qc_setup(plugin_args);
rv = classifier->qc_setup(sql_mode, plugin_args);
if (rv != QC_RESULT_OK)
{

View File

@ -184,7 +184,7 @@ int main(int argc, char* argv[])
if (mxs_log_init(NULL, ".", MXS_LOG_TARGET_DEFAULT))
{
// We have to setup something in order for the regexes to be compiled.
if (qc_setup("qc_sqlite", NULL) && qc_process_init(QC_INIT_BOTH))
if (qc_setup("qc_sqlite", QC_SQL_MODE_DEFAULT, NULL) && qc_process_init(QC_INIT_BOTH))
{
Tester tester(verbosity);

View File

@ -421,7 +421,7 @@ int main(int argc, char* argv[])
if (mxs_log_init(NULL, ".", MXS_LOG_TARGET_DEFAULT))
{
// We have to setup something in order for the regexes to be compiled.
if (qc_setup("qc_sqlite", NULL) && qc_process_init(QC_INIT_BOTH))
if (qc_setup("qc_sqlite", QC_SQL_MODE_DEFAULT, NULL) && qc_process_init(QC_INIT_BOTH))
{
rc = EXIT_SUCCESS;