MXS-1624 Make the QC info object explicit
The query classifier stores information about the statement carried by a GWBUF in the GWBUF itself. We need to be able to store that object out side the lifetime of the GWBUF. So, we require that a query classifier is capable of duplicating references to that object.
This commit is contained in:
parent
d01db42679
commit
4e168f36f7
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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 =
|
||||
|
@ -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 =
|
||||
|
Loading…
x
Reference in New Issue
Block a user