Trim and squeeze whitespace when canonicalizing queries
The canonical form of the query should ignore changes in whitespace as the semantics of the query stays the same regardless of the amount of whitespace.
This commit is contained in:
@ -183,14 +183,24 @@ char* qc_get_canonical(GWBUF* query)
|
|||||||
{
|
{
|
||||||
QC_TRACE();
|
QC_TRACE();
|
||||||
ss_dassert(classifier);
|
ss_dassert(classifier);
|
||||||
|
|
||||||
|
char *rval;
|
||||||
|
|
||||||
if (classifier->qc_get_canonical)
|
if (classifier->qc_get_canonical)
|
||||||
{
|
{
|
||||||
return classifier->qc_get_canonical(query);
|
rval = classifier->qc_get_canonical(query);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return modutil_get_canonical(query);
|
rval = modutil_get_canonical(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rval)
|
||||||
|
{
|
||||||
|
squeeze_whitespace(rval);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool qc_query_has_clause(GWBUF* query)
|
bool qc_query_has_clause(GWBUF* query)
|
||||||
|
Reference in New Issue
Block a user