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:
Markus Makela 2016-09-20 20:58:42 +03:00
parent 62ab834e8a
commit 08d980b433

View File

@ -183,14 +183,24 @@ char* qc_get_canonical(GWBUF* query)
{
QC_TRACE();
ss_dassert(classifier);
char *rval;
if (classifier->qc_get_canonical)
{
return classifier->qc_get_canonical(query);
rval = classifier->qc_get_canonical(query);
}
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)