diff --git a/include/maxscale/query_classifier.h b/include/maxscale/query_classifier.h index 14298ae18..484d09e3a 100644 --- a/include/maxscale/query_classifier.h +++ b/include/maxscale/query_classifier.h @@ -17,7 +17,7 @@ MXS_BEGIN_DECLS -#define MXS_QUERY_CLASSIFIER_VERSION {2, 0, 0} +#define MXS_QUERY_CLASSIFIER_VERSION {3, 0, 0} /** * qc_init_kind_t specifies what kind of initialization should be performed. @@ -155,6 +155,14 @@ typedef enum qc_result QC_RESULT_ERROR } qc_result_t; +/** + * QC_STMT_INFO is an opaque type where the query classifier stores + * information about a statement. + */ +typedef struct qc_stmt_info +{ +} QC_STMT_INFO; + /** * QUERY_CLASSIFIER defines the object a query classifier plugin must * implement and return. @@ -406,6 +414,16 @@ typedef struct query_classifier * @return QC_RESULT_OK if @sql_mode is valid, otherwise QC_RESULT_ERROR. */ int32_t (*qc_set_sql_mode)(qc_sql_mode_t sql_mode); + + /** + * Dups the provided info object. After having been dupped, the info object + * can be stored on another GWBUF. + * + * @param info The info to be dupped. + * + * @return The same info that was provided as argument. + */ + QC_STMT_INFO* (*qc_dup)(QC_STMT_INFO* info); } QUERY_CLASSIFIER; /** diff --git a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc index af7d5dbef..302b3edc5 100644 --- a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc +++ b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc @@ -3488,6 +3488,13 @@ int32_t qc_mysql_set_sql_mode(qc_sql_mode_t sql_mode) return rv; } +QC_STMT_INFO* qc_mysql_dup(QC_STMT_INFO* info) +{ + // TODO: Not implemented yet. + ss_dassert(!true); + return info; +} + /** * EXPORTS */ @@ -3521,6 +3528,7 @@ extern "C" qc_mysql_get_server_version, qc_mysql_get_sql_mode, qc_mysql_set_sql_mode, + qc_mysql_dup, }; static MXS_MODULE info = diff --git a/query_classifier/qc_sqlite/qc_sqlite.cc b/query_classifier/qc_sqlite/qc_sqlite.cc index 8f96e75f2..9920147e8 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.cc +++ b/query_classifier/qc_sqlite/qc_sqlite.cc @@ -4300,6 +4300,7 @@ static void qc_sqlite_set_server_version(uint64_t version); static void qc_sqlite_get_server_version(uint64_t* version); static int32_t qc_sqlite_get_sql_mode(qc_sql_mode_t* sql_mode); static int32_t qc_sqlite_set_sql_mode(qc_sql_mode_t sql_mode); +static QC_STMT_INFO* qc_sqlite_dup(QC_STMT_INFO* info); static bool get_key_and_value(char* arg, const char** pkey, const char** pvalue) { @@ -4958,6 +4959,13 @@ int32_t qc_sqlite_set_sql_mode(qc_sql_mode_t sql_mode) return rv; } +QC_STMT_INFO* qc_sqlite_dup(QC_STMT_INFO* info) +{ + // TODO: Not implemented yet. + ss_dassert(!true); + return info; +} + /** * EXPORTS */ @@ -4991,6 +4999,7 @@ MXS_MODULE* MXS_CREATE_MODULE() qc_sqlite_get_server_version, qc_sqlite_get_sql_mode, qc_sqlite_set_sql_mode, + qc_sqlite_dup }; static MXS_MODULE info =