-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3993 from georgelorchpercona/ps-5.7-7238
PS-7238 - Backport Data Masking plugin to 5.7
- Loading branch information
Showing
57 changed files
with
2,325 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Berlin | ||
Munich | ||
Bremen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Houston | ||
Phoenix | ||
El Paso | ||
Detroit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Plugin Data Masking: gen_blacklist | ||
# | ||
CREATE FUNCTION gen_blacklist RETURNS STRING SONAME 'data_masking.so'; | ||
CREATE FUNCTION gen_dictionary_drop RETURNS STRING SONAME 'data_masking.so'; | ||
CREATE FUNCTION gen_dictionary_load RETURNS STRING SONAME 'data_masking.so'; | ||
SELECT gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities'); | ||
gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities') | ||
Dictionary load success | ||
SELECT gen_dictionary_load('../../std_data/data_masking/us_cities.txt', 'us_cities'); | ||
gen_dictionary_load('../../std_data/data_masking/us_cities.txt', 'us_cities') | ||
Dictionary load success | ||
SELECT gen_blacklist('Moscow', 'DE_Cities', 'US_Cities'); | ||
gen_blacklist('Moscow', 'DE_Cities', 'US_Cities') | ||
Moscow | ||
SELECT gen_dictionary_drop('de_cities'); | ||
gen_dictionary_drop('de_cities') | ||
Dictionary removed | ||
SELECT gen_dictionary_drop('us_cities'); | ||
gen_dictionary_drop('us_cities') | ||
Dictionary removed | ||
DROP FUNCTION gen_dictionary_load; | ||
DROP FUNCTION gen_dictionary_drop; | ||
DROP FUNCTION gen_blacklist; |
19 changes: 19 additions & 0 deletions
19
mysql-test/suite/data_masking/r/gen_dictionary_drop.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Plugin Data Masking: gen_dictionary_drop | ||
# | ||
CREATE FUNCTION gen_dictionary_drop RETURNS STRING SONAME 'data_masking.so'; | ||
CREATE FUNCTION gen_dictionary_load RETURNS STRING SONAME 'data_masking.so'; | ||
SELECT gen_dictionary_drop('de_cities'); | ||
gen_dictionary_drop('de_cities') | ||
Dictionary removal error: dictionary not present in global list | ||
SELECT gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities'); | ||
gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities') | ||
Dictionary load success | ||
SELECT gen_dictionary_drop('de_cities'); | ||
gen_dictionary_drop('de_cities') | ||
Dictionary removed | ||
SELECT gen_dictionary_drop('de_cities'); | ||
gen_dictionary_drop('de_cities') | ||
Dictionary removal error: dictionary not present in global list | ||
DROP FUNCTION gen_dictionary_load; | ||
DROP FUNCTION gen_dictionary_drop; |
14 changes: 14 additions & 0 deletions
14
mysql-test/suite/data_masking/r/gen_dictionary_load.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# | ||
# Plugin Data Masking: gen_dictionary_load | ||
# | ||
CREATE FUNCTION gen_dictionary_load RETURNS STRING SONAME 'data_masking.so'; | ||
SELECT gen_dictionary_load('de_cities.txt', 'de_cities'); | ||
gen_dictionary_load('de_cities.txt', 'de_cities') | ||
Dictionary load error: dictionary file not readable | ||
SELECT gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities'); | ||
gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities') | ||
Dictionary load success | ||
SELECT gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities'); | ||
gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities') | ||
Dictionary load error: a dictionary with that name already exists | ||
DROP FUNCTION gen_dictionary_load; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# Plugin Data Masking: mask_inner | ||
# | ||
CREATE FUNCTION mask_inner RETURNS STRING SONAME 'data_masking.so'; | ||
SELECT mask_inner('This is a string', 5, 1); | ||
mask_inner('This is a string', 5, 1) | ||
This XXXXXXXXXXg | ||
SELECT mask_inner('This is a string', 1, 5); | ||
mask_inner('This is a string', 1, 5) | ||
TXXXXXXXXXXtring | ||
SELECT mask_inner('This is a string', 5, 1, '#'); | ||
mask_inner('This is a string', 5, 1, '#') | ||
This ##########g | ||
SELECT mask_inner(NULL, 1, 2); | ||
mask_inner(NULL, 1, 2) | ||
NULL | ||
SELECT mask_inner(NULL, 1, 2, '#'); | ||
mask_inner(NULL, 1, 2, '#') | ||
NULL | ||
SELECT mask_inner('This is a string', -1, 5); | ||
mask_inner('This is a string', -1, 5) | ||
NULL | ||
SELECT mask_inner('This is a string', 1, -5); | ||
mask_inner('This is a string', 1, -5) | ||
NULL | ||
SELECT mask_inner('This is a string', 1, 25); | ||
mask_inner('This is a string', 1, 25) | ||
This is a string | ||
SELECT mask_inner('This is a string', 100, 500); | ||
mask_inner('This is a string', 100, 500) | ||
This is a string | ||
DROP FUNCTION mask_inner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# Plugin Data Masking: mask_outer | ||
# | ||
CREATE FUNCTION mask_outer RETURNS STRING SONAME 'data_masking.so'; | ||
SELECT mask_outer('This is a string', 5, 1); | ||
mask_outer('This is a string', 5, 1) | ||
XXXXXis a strinX | ||
SELECT mask_outer('This is a string', 1, 5); | ||
mask_outer('This is a string', 1, 5) | ||
Xhis is a sXXXXX | ||
SELECT mask_outer('This is a string', 5, 1, '#'); | ||
mask_outer('This is a string', 5, 1, '#') | ||
#####is a strin# | ||
SELECT mask_outer(NULL, 5, 1); | ||
mask_outer(NULL, 5, 1) | ||
NULL | ||
SELECT mask_outer(NULL, 5, 1, '#'); | ||
mask_outer(NULL, 5, 1, '#') | ||
NULL | ||
SELECT mask_outer('This is a string', -1, 5); | ||
mask_outer('This is a string', -1, 5) | ||
NULL | ||
SELECT mask_outer('This is a string', 1, -5); | ||
mask_outer('This is a string', 1, -5) | ||
NULL | ||
SELECT mask_outer('This is a string', 1, 25); | ||
mask_outer('This is a string', 1, 25) | ||
Xhis is a string | ||
SELECT mask_outer('This is a string', 100, 500); | ||
mask_outer('This is a string', 100, 500) | ||
XXXXXXXXXXXXXXXX | ||
DROP FUNCTION mask_outer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# Plugin Data Masking: mask_pan | ||
# | ||
CREATE FUNCTION mask_pan RETURNS STRING SONAME 'data_masking.so'; | ||
SELECT mask_pan("1234567890122461"); | ||
mask_pan("1234567890122461") | ||
XXXXXXXXXXXX2461 | ||
SELECT mask_pan("123456789012246"); | ||
mask_pan("123456789012246") | ||
XXXXXXXXXXX2246 | ||
SELECT mask_pan(NULL); | ||
mask_pan(NULL) | ||
NULL | ||
SELECT mask_pan(""); | ||
mask_pan("") | ||
NULL | ||
SELECT mask_pan("123496798465498779"); | ||
mask_pan("123496798465498779") | ||
123496798465498779 | ||
SELECT mask_pan("this is not a pan"); | ||
mask_pan("this is not a pan") | ||
this is not a pan | ||
DROP FUNCTION mask_pan; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# Plugin Data Masking: mask_pan_relaxed | ||
# | ||
CREATE FUNCTION mask_pan_relaxed RETURNS STRING SONAME 'data_masking.so'; | ||
SELECT mask_pan_relaxed("1234567890122461"); | ||
mask_pan_relaxed("1234567890122461") | ||
123456XXXXXX2461 | ||
SELECT mask_pan_relaxed("123456789012246"); | ||
mask_pan_relaxed("123456789012246") | ||
123456XXXXX2246 | ||
SELECT mask_pan_relaxed(NULL); | ||
mask_pan_relaxed(NULL) | ||
NULL | ||
SELECT mask_pan_relaxed(""); | ||
mask_pan_relaxed("") | ||
|
||
SELECT mask_pan_relaxed("123496798465498779"); | ||
mask_pan_relaxed("123496798465498779") | ||
123496798465498779 | ||
SELECT mask_pan_relaxed("this is not a pan"); | ||
mask_pan_relaxed("this is not a pan") | ||
this is not a pan | ||
DROP FUNCTION mask_pan_relaxed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Plugin Data Masking: mask_ssn | ||
# | ||
CREATE FUNCTION mask_ssn RETURNS STRING SONAME 'data_masking.so'; | ||
SELECT mask_ssn("123-45-6789"); | ||
mask_ssn("123-45-6789") | ||
XXX-XX-6789 | ||
SELECT mask_ssn(NULL); | ||
mask_ssn(NULL) | ||
NULL | ||
SELECT mask_ssn(""); | ||
mask_ssn("") | ||
NULL | ||
SELECT mask_ssn("123496798465498779"); | ||
mask_ssn("123496798465498779") | ||
NULL | ||
SELECT mask_ssn("this is not an ssn"); | ||
mask_ssn("this is not an ssn") | ||
NULL | ||
DROP FUNCTION mask_ssn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# Plugin Data Masking: view | ||
# | ||
CREATE FUNCTION mask_ssn RETURNS STRING SONAME 'data_masking.so'; | ||
CREATE TABLE customer (id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, ssn VARCHAR(11), first_name VARCHAR(100), last_name VARCHAR(100)); | ||
INSERT INTO customer (ssn, first_name, last_name) VALUES ('123-45-0007', 'Joanna', 'Bond'); | ||
CREATE VIEW masked_customer AS SELECT id, first_name, last_name, mask_ssn(CONVERT(ssn USING binary)) AS ssn FROM customer; | ||
SELECT id, ssn FROM masked_customer WHERE first_name = 'Joanna' AND last_name = 'Bond'; | ||
id ssn | ||
1 XXX-XX-0007 | ||
DROP VIEW masked_customer; | ||
DROP TABLE customer; | ||
DROP FUNCTION mask_ssn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$DATA_MASKING_PLUGIN_OPT $DATA_MASKING_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--echo # | ||
--echo # Plugin Data Masking: gen_blacklist | ||
--echo # | ||
CREATE FUNCTION gen_blacklist RETURNS STRING SONAME 'data_masking.so'; | ||
CREATE FUNCTION gen_dictionary_drop RETURNS STRING SONAME 'data_masking.so'; | ||
CREATE FUNCTION gen_dictionary_load RETURNS STRING SONAME 'data_masking.so'; | ||
|
||
SELECT gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities'); | ||
SELECT gen_dictionary_load('../../std_data/data_masking/us_cities.txt', 'us_cities'); | ||
SELECT gen_blacklist('Moscow', 'DE_Cities', 'US_Cities'); | ||
SELECT gen_dictionary_drop('de_cities'); | ||
SELECT gen_dictionary_drop('us_cities'); | ||
|
||
DROP FUNCTION gen_dictionary_load; | ||
DROP FUNCTION gen_dictionary_drop; | ||
DROP FUNCTION gen_blacklist; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$DATA_MASKING_PLUGIN_OPT $DATA_MASKING_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--echo # | ||
--echo # Plugin Data Masking: gen_dictionary_drop | ||
--echo # | ||
CREATE FUNCTION gen_dictionary_drop RETURNS STRING SONAME 'data_masking.so'; | ||
CREATE FUNCTION gen_dictionary_load RETURNS STRING SONAME 'data_masking.so'; | ||
|
||
SELECT gen_dictionary_drop('de_cities'); | ||
SELECT gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities'); | ||
SELECT gen_dictionary_drop('de_cities'); | ||
SELECT gen_dictionary_drop('de_cities'); | ||
|
||
DROP FUNCTION gen_dictionary_load; | ||
DROP FUNCTION gen_dictionary_drop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$DATA_MASKING_PLUGIN_OPT $DATA_MASKING_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--echo # | ||
--echo # Plugin Data Masking: gen_dictionary_load | ||
--echo # | ||
CREATE FUNCTION gen_dictionary_load RETURNS STRING SONAME 'data_masking.so'; | ||
|
||
SELECT gen_dictionary_load('de_cities.txt', 'de_cities'); | ||
SELECT gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities'); | ||
SELECT gen_dictionary_load('../../std_data/data_masking/de_cities.txt', 'de_cities'); | ||
|
||
DROP FUNCTION gen_dictionary_load; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$DATA_MASKING_PLUGIN_OPT $DATA_MASKING_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--echo # | ||
--echo # Plugin Data Masking: mask_inner | ||
--echo # | ||
CREATE FUNCTION mask_inner RETURNS STRING SONAME 'data_masking.so'; | ||
|
||
SELECT mask_inner('This is a string', 5, 1); | ||
SELECT mask_inner('This is a string', 1, 5); | ||
SELECT mask_inner('This is a string', 5, 1, '#'); | ||
SELECT mask_inner(NULL, 1, 2); | ||
SELECT mask_inner(NULL, 1, 2, '#'); | ||
SELECT mask_inner('This is a string', -1, 5); | ||
SELECT mask_inner('This is a string', 1, -5); | ||
SELECT mask_inner('This is a string', 1, 25); | ||
SELECT mask_inner('This is a string', 100, 500); | ||
|
||
DROP FUNCTION mask_inner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$DATA_MASKING_PLUGIN_OPT $DATA_MASKING_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--echo # | ||
--echo # Plugin Data Masking: mask_outer | ||
--echo # | ||
CREATE FUNCTION mask_outer RETURNS STRING SONAME 'data_masking.so'; | ||
|
||
SELECT mask_outer('This is a string', 5, 1); | ||
SELECT mask_outer('This is a string', 1, 5); | ||
SELECT mask_outer('This is a string', 5, 1, '#'); | ||
SELECT mask_outer(NULL, 5, 1); | ||
SELECT mask_outer(NULL, 5, 1, '#'); | ||
SELECT mask_outer('This is a string', -1, 5); | ||
SELECT mask_outer('This is a string', 1, -5); | ||
SELECT mask_outer('This is a string', 1, 25); | ||
SELECT mask_outer('This is a string', 100, 500); | ||
|
||
DROP FUNCTION mask_outer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$DATA_MASKING_PLUGIN_OPT $DATA_MASKING_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--echo # | ||
--echo # Plugin Data Masking: mask_pan | ||
--echo # | ||
CREATE FUNCTION mask_pan RETURNS STRING SONAME 'data_masking.so'; | ||
|
||
SELECT mask_pan("1234567890122461"); | ||
SELECT mask_pan("123456789012246"); | ||
SELECT mask_pan(NULL); | ||
SELECT mask_pan(""); | ||
SELECT mask_pan("123496798465498779"); | ||
SELECT mask_pan("this is not a pan"); | ||
|
||
DROP FUNCTION mask_pan; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$DATA_MASKING_PLUGIN_OPT $DATA_MASKING_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--echo # | ||
--echo # Plugin Data Masking: mask_pan_relaxed | ||
--echo # | ||
CREATE FUNCTION mask_pan_relaxed RETURNS STRING SONAME 'data_masking.so'; | ||
|
||
SELECT mask_pan_relaxed("1234567890122461"); | ||
SELECT mask_pan_relaxed("123456789012246"); | ||
SELECT mask_pan_relaxed(NULL); | ||
SELECT mask_pan_relaxed(""); | ||
SELECT mask_pan_relaxed("123496798465498779"); | ||
SELECT mask_pan_relaxed("this is not a pan"); | ||
|
||
DROP FUNCTION mask_pan_relaxed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$DATA_MASKING_PLUGIN_OPT $DATA_MASKING_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--echo # | ||
--echo # Plugin Data Masking: mask_ssn | ||
--echo # | ||
CREATE FUNCTION mask_ssn RETURNS STRING SONAME 'data_masking.so'; | ||
|
||
SELECT mask_ssn("123-45-6789"); | ||
SELECT mask_ssn(NULL); | ||
SELECT mask_ssn(""); | ||
SELECT mask_ssn("123496798465498779"); | ||
SELECT mask_ssn("this is not an ssn"); | ||
|
||
DROP FUNCTION mask_ssn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$DATA_MASKING_PLUGIN_OPT $DATA_MASKING_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--echo # | ||
--echo # Plugin Data Masking: view | ||
--echo # | ||
CREATE FUNCTION mask_ssn RETURNS STRING SONAME 'data_masking.so'; | ||
|
||
CREATE TABLE customer (id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, ssn VARCHAR(11), first_name VARCHAR(100), last_name VARCHAR(100)); | ||
INSERT INTO customer (ssn, first_name, last_name) VALUES ('123-45-0007', 'Joanna', 'Bond'); | ||
CREATE VIEW masked_customer AS SELECT id, first_name, last_name, mask_ssn(CONVERT(ssn USING binary)) AS ssn FROM customer; | ||
SELECT id, ssn FROM masked_customer WHERE first_name = 'Joanna' AND last_name = 'Bond'; | ||
DROP VIEW masked_customer; | ||
DROP TABLE customer; | ||
|
||
DROP FUNCTION mask_ssn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Oracle and/or its affiliates | ||
Francisco Miguel Biete Banon |
Oops, something went wrong.