Merge branch '2.1' into develop

This commit is contained in:
Johan Wikman 2017-06-26 12:29:46 +02:00
commit b83538d011
7 changed files with 59 additions and 48 deletions

View File

@ -5,7 +5,7 @@
set(MAXSCALE_VERSION_MAJOR "2" CACHE STRING "Major version")
set(MAXSCALE_VERSION_MINOR "1" CACHE STRING "Minor version")
set(MAXSCALE_VERSION_PATCH "3" CACHE STRING "Patch version")
set(MAXSCALE_VERSION_PATCH "4" CACHE STRING "Patch version")
# This should only be incremented if a package is rebuilt
set(MAXSCALE_BUILD_NUMBER 1 CACHE STRING "Release number")

View File

@ -5,7 +5,7 @@
"column": "a"
},
"with": {
"fill": "X"
"fill": "Y"
}
},
{
@ -22,7 +22,7 @@
},
"with": {
"value": "012345-ABCD",
"fill": "X"
"fill": "Y"
}
}
]

View File

@ -11,12 +11,12 @@ insert into masking values ("hello", NULL, NULL);
insert into masking values (NULL, NULL, NULL);
select * from masking;
a x y
XXXXX hello hello
YYYYY hello hello
NULL hello hello
XXXXX NULL hello
XXXXX hello NULL
YYYYY NULL hello
YYYYY hello NULL
NULL NULL hello
XXXXX NULL NULL
YYYYY NULL NULL
NULL NULL NULL
drop table masking;
create table masking (x TEXT, a TEXT, y TEXT);
@ -29,10 +29,10 @@ insert into masking values ("hello", NULL, NULL);
insert into masking values (NULL, NULL, NULL);
select * from masking;
x a y
hello XXXXX hello
NULL XXXXX hello
hello YYYYY hello
NULL YYYYY hello
hello NULL hello
hello XXXXX NULL
hello YYYYY NULL
NULL NULL hello
hello NULL NULL
NULL NULL NULL
@ -47,11 +47,11 @@ insert into masking values ("hello", NULL, NULL);
insert into masking values (NULL, NULL, NULL);
select * from masking;
x y a
hello hello XXXXX
NULL hello XXXXX
hello NULL XXXXX
hello hello YYYYY
NULL hello YYYYY
hello NULL YYYYY
hello hello NULL
NULL NULL XXXXX
NULL NULL YYYYY
hello NULL NULL
NULL NULL NULL
drop table masking;

View File

@ -5,15 +5,15 @@ create table masking (a TEXT, b TEXT, c TEXT);
insert into masking values ("blah", "012345-ABC", "012345-ABC");
select * from masking;
a b c
XXXX 012345-ABC XXXXXXXXXX
YYYY XXXXXXXXXX YYYYYYYYYY
delete from masking;
insert into masking values ("blahblah", "221073-01AB", "012345-ABC");
select * from masking;
a b c
XXXXXXXX 012345-ABCD XXXXXXXXXX
YYYYYYYY 012345-ABCD YYYYYYYYYY
delete from masking;
insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB");
select * from masking;
a b c
XXXXXXXXXXX 012345-ABCD 012345-ABCD
YYYYYYYYYYY 012345-ABCD 012345-ABCD
delete from masking;

View File

@ -31,46 +31,46 @@ insert into masking_ENUM values ("aaa");
insert into masking_SET values ("aaa");
select * from masking_BINARY;
a
XXX
YYY
select * from masking_VARBINARY;
a
XXX
YYY
select * from masking_CHAR;
a
XXX
YYY
select * from masking_VARCHAR;
a
XXX
YYY
select * from masking_BLOB;
a
XXX
YYY
select * from masking_TINYBLOB;
a
XXX
YYY
select * from masking_MEDIUMBLOB;
a
XXX
YYY
select * from masking_LONGBLOB;
a
XXX
YYY
select * from masking_TEXT;
a
XXX
YYY
select * from masking_TINYTEXT;
a
XXX
YYY
select * from masking_MEDIUMTEXT;
a
XXX
YYY
select * from masking_LONGTEXT;
a
XXX
YYY
select * from masking_ENUM;
a
XXX
YYY
select * from masking_SET;
a
XXX
YYY
create table masking_INT (a INT);
create table masking_REAL (a REAL(3, 2));
create table masking_DECIMAL (a DECIMAL(3, 2));

View File

@ -10,7 +10,7 @@
# "column": "a"
# },
# "with": {
# "fill": "X"
# "fill": "Y"
# }
# },
# {
@ -27,7 +27,7 @@
# },
# "with": {
# "value": "012345-ABCD",
# "fill": "X"
# "fill": "Y"
# }
# }
# ]
@ -46,38 +46,38 @@ use maskingdb;
#
create table masking (a TEXT, b TEXT, c TEXT);
# - a should be just "X...",
# - b should be unchanged as the length does not match the string of "value", and
# there is no catch all "fill".
# - c should be just "X..." as the length does not match, so "value" is not applied
# - a should be just "Y...",
# - b should be changed into "X..." as the length does not match and there is no
# specific fill value, so the default "X" is used.
# - c should be just "Y..." as the length does not match, so "value" is not applied
# and has "fill", which is applied.
#
#a b c
#XXXX 012345-ABC XXXXXXXXXX
#YYYY XXXXXXXXXX YYYYYYYYYY
insert into masking values ("blah", "012345-ABC", "012345-ABC");
select * from masking;
delete from masking;
# - a should be just "X...",
# - a should be just "Y...",
# - b should be changed as the length matches the length of the string of "value"
# - c should be just "X..." as the length does not match, so "value" is not applied
# - c should be just "Y..." as the length does not match, so "value" is not applied
# and has "fill", which is applied.
#
#a b c
#XXXXXXXX 012345-ABCD XXXXXXXXXX
#YYYYYYYY 012345-ABCD YYYYYYYYYY
insert into masking values ("blahblah", "221073-01AB", "012345-ABC");
select * from masking;
delete from masking;
# - a should be just "X...",
# - a should be just "Y...",
# - b should be changed as the length matches the length of the string of "value"
# - c should be chanched into a specific string as the length matches the string of
# "value"
#
#a b c
#a b c
#XXXXXXXXXXX 012345-ABCD 012345-ABCD
# a should still be just "X", b should be "012345-ABCD" and c should be "012345-ABCD"
#YYYYYYYYYYY 012345-ABCD 012345-ABCD
# a should still be just "Y", b should be "012345-ABCD" and c should be "012345-ABCD"
insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB");
select * from masking;
delete from masking;

View File

@ -12,6 +12,7 @@
*/
#include <maxscale/cppdefs.hh>
#include <algorithm>
#include <iostream>
#include <maxscale/modutil.h>
#include <maxscale/paths.h>
@ -69,6 +70,7 @@ struct test_case
uint32_t type_mask;
} test_cases[] =
{
// Keep these all uppercase, lowercase are tested programmatically.
{ "BEGIN", QUERY_TYPE_BEGIN_TRX },
{ "BEGIN WORK", QUERY_TYPE_BEGIN_TRX },
@ -299,14 +301,23 @@ bool test(uint32_t (*getter)(GWBUF*), bool dont_bail_out)
string base(pTest->zStmt);
cout << base << endl;
string s;
s = base;
if (!test(getter, s.c_str(), pTest->type_mask))
if (!test(getter, base.c_str(), pTest->type_mask))
{
rc = false;
}
if (dont_bail_out || rc)
{
// Test all lowercase.
string lc(base);
transform(lc.begin(), lc.end(), lc.begin(), ::tolower);
if (!test(getter, lc.c_str(), pTest->type_mask))
{
rc = false;
}
}
if (dont_bail_out || rc)
{
if (!test_with_prefixes(getter, base, pTest->type_mask))