Fixed value replacement and added more tests for canonicalization of queries

The value replacement was not taking session or system variables into notice.
This commit is contained in:
Markus Makela
2016-01-07 12:04:55 +02:00
parent 995ed8c9d2
commit 9c9e30fa08
4 changed files with 155 additions and 5 deletions

View File

@ -2033,7 +2033,8 @@ void skygw_file_close(
static pcre2_code* replace_values_re = NULL;
static const PCRE2_SPTR replace_values_pattern = (PCRE2_SPTR) "(?i)([-=,+*/([:space:]]|\\b)([0-9.]+|NULL)([-=,+*/)[:space:];]|$)";
static const PCRE2_SPTR replace_values_pattern = (PCRE2_SPTR) "(?i)([-=,+*/([:space:]]|\\b|[@])"
"(?:[0-9.]+|(?<=[@])[a-z_]+|NULL)([-=,+*/)[:space:];]|$)";
/**
* Replace every literal number and NULL value with a question mark.
@ -2042,7 +2043,7 @@ static const PCRE2_SPTR replace_values_pattern = (PCRE2_SPTR) "(?i)([-=,+*/([:sp
*/
char* replace_values(const char* str)
{
static const PCRE2_SPTR replace = (PCRE2_SPTR) "$1?$3";
static const PCRE2_SPTR replace = (PCRE2_SPTR) "$1?$2";
pcre2_match_data* mdata;
size_t orig_len = strlen(str);
size_t len = orig_len;