Merge branch '2.1' into develop

This commit is contained in:
Johan Wikman
2017-06-26 12:29:46 +02:00
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_MAJOR "2" CACHE STRING "Major version")
set(MAXSCALE_VERSION_MINOR "1" CACHE STRING "Minor 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 # This should only be incremented if a package is rebuilt
set(MAXSCALE_BUILD_NUMBER 1 CACHE STRING "Release number") set(MAXSCALE_BUILD_NUMBER 1 CACHE STRING "Release number")

View File

@ -5,7 +5,7 @@
"column": "a" "column": "a"
}, },
"with": { "with": {
"fill": "X" "fill": "Y"
} }
}, },
{ {
@ -22,7 +22,7 @@
}, },
"with": { "with": {
"value": "012345-ABCD", "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); insert into masking values (NULL, NULL, NULL);
select * from masking; select * from masking;
a x y a x y
XXXXX hello hello YYYYY hello hello
NULL hello hello NULL hello hello
XXXXX NULL hello YYYYY NULL hello
XXXXX hello NULL YYYYY hello NULL
NULL NULL hello NULL NULL hello
XXXXX NULL NULL YYYYY NULL NULL
NULL NULL NULL NULL NULL NULL
drop table masking; drop table masking;
create table masking (x TEXT, a TEXT, y TEXT); 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); insert into masking values (NULL, NULL, NULL);
select * from masking; select * from masking;
x a y x a y
hello XXXXX hello hello YYYYY hello
NULL XXXXX hello NULL YYYYY hello
hello NULL hello hello NULL hello
hello XXXXX NULL hello YYYYY NULL
NULL NULL hello NULL NULL hello
hello NULL NULL hello NULL NULL
NULL NULL NULL NULL NULL NULL
@ -47,11 +47,11 @@ insert into masking values ("hello", NULL, NULL);
insert into masking values (NULL, NULL, NULL); insert into masking values (NULL, NULL, NULL);
select * from masking; select * from masking;
x y a x y a
hello hello XXXXX hello hello YYYYY
NULL hello XXXXX NULL hello YYYYY
hello NULL XXXXX hello NULL YYYYY
hello hello NULL hello hello NULL
NULL NULL XXXXX NULL NULL YYYYY
hello NULL NULL hello NULL NULL
NULL NULL NULL NULL NULL NULL
drop table masking; 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"); insert into masking values ("blah", "012345-ABC", "012345-ABC");
select * from masking; select * from masking;
a b c a b c
XXXX 012345-ABC XXXXXXXXXX YYYY XXXXXXXXXX YYYYYYYYYY
delete from masking; delete from masking;
insert into masking values ("blahblah", "221073-01AB", "012345-ABC"); insert into masking values ("blahblah", "221073-01AB", "012345-ABC");
select * from masking; select * from masking;
a b c a b c
XXXXXXXX 012345-ABCD XXXXXXXXXX YYYYYYYY 012345-ABCD YYYYYYYYYY
delete from masking; delete from masking;
insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB"); insert into masking values ("221073-01AB", "221073-01AB", "221073-01AB");
select * from masking; select * from masking;
a b c a b c
XXXXXXXXXXX 012345-ABCD 012345-ABCD YYYYYYYYYYY 012345-ABCD 012345-ABCD
delete from masking; delete from masking;

View File

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

View File

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

View File

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