Introduce new qc_parse() prototype
It is now possible to specify what information the caller is interested in. With this the cost for collecting information during the query parsing that nobody is interested in can be avoided.
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
|
||||
#include "../../server/core/maxscale/config.h"
|
||||
|
||||
int32_t qc_dummy_parse(GWBUF* querybuf, int32_t* pResult)
|
||||
int32_t qc_dummy_parse(GWBUF* querybuf, uint32_t collect, int32_t* pResult)
|
||||
{
|
||||
*pResult = QC_QUERY_INVALID;
|
||||
return QC_RESULT_OK;
|
||||
|
@ -136,7 +136,7 @@ bool ensure_query_is_parsed(GWBUF* query)
|
||||
return parsed;
|
||||
}
|
||||
|
||||
int32_t qc_mysql_parse(GWBUF* querybuf, int32_t* result)
|
||||
int32_t qc_mysql_parse(GWBUF* querybuf, uint32_t collect, int32_t* result)
|
||||
{
|
||||
bool parsed = ensure_query_is_parsed(querybuf);
|
||||
|
||||
|
@ -2792,7 +2792,7 @@ static int32_t qc_sqlite_process_init(void);
|
||||
static void qc_sqlite_process_end(void);
|
||||
static int32_t qc_sqlite_thread_init(void);
|
||||
static void qc_sqlite_thread_end(void);
|
||||
static int32_t qc_sqlite_parse(GWBUF* query, int32_t* result);
|
||||
static int32_t qc_sqlite_parse(GWBUF* query, uint32_t collect, int32_t* result);
|
||||
static int32_t qc_sqlite_get_type_mask(GWBUF* query, uint32_t* typemask);
|
||||
static int32_t qc_sqlite_get_operation(GWBUF* query, int32_t* op);
|
||||
static int32_t qc_sqlite_get_created_table_name(GWBUF* query, char** name);
|
||||
@ -3010,7 +3010,7 @@ static void qc_sqlite_thread_end(void)
|
||||
this_thread.initialized = false;
|
||||
}
|
||||
|
||||
static int32_t qc_sqlite_parse(GWBUF* query, int32_t* result)
|
||||
static int32_t qc_sqlite_parse(GWBUF* query, uint32_t collect, int32_t* result)
|
||||
{
|
||||
QC_TRACE();
|
||||
ss_dassert(this_unit.initialized);
|
||||
|
@ -312,13 +312,13 @@ bool compare_parse(QUERY_CLASSIFIER* pClassifier1, GWBUF* pCopy1,
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &start);
|
||||
int32_t rv1;
|
||||
pClassifier1->qc_parse(pCopy1, &rv1);
|
||||
pClassifier1->qc_parse(pCopy1, QC_COLLECT_ALL, &rv1);
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &finish);
|
||||
update_time(&global.time1, start, finish);
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &start);
|
||||
int32_t rv2;
|
||||
pClassifier2->qc_parse(pCopy2, &rv2);
|
||||
pClassifier2->qc_parse(pCopy2, QC_COLLECT_ALL, &rv2);
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &finish);
|
||||
update_time(&global.time2, start, finish);
|
||||
|
||||
|
@ -51,7 +51,7 @@ int main()
|
||||
// being of the opinion that the statement was not the one to be
|
||||
// classified and hence an alien parse-tree being passed to sqlite3's
|
||||
// code generator.
|
||||
qc_parse(stmt);
|
||||
qc_parse(stmt, QC_COLLECT_ALL);
|
||||
|
||||
qc_process_end(QC_INIT_BOTH);
|
||||
|
||||
|
Reference in New Issue
Block a user