| 1 |
# Parameter to set before including this file. |
| 2 |
|
| 3 |
# $privilege_check = 'true' or 'false' |
| 4 |
# $global_database_encryption_default = 'true' or 'false' |
| 5 |
# $database_encryption = 'y' or 'n' |
| 6 |
# $has_grant = 'y' or 'n' |
| 7 |
# $expected_error = ER_* |
| 8 |
# $explicit_encryption_clause = 'true' or 'false' |
| 9 |
|
| 10 |
--let caseno=`SELECT $caseno+1` |
| 11 |
--echo # [CREATE DATABASE] Case $caseno ) |
| 12 |
--echo ````````````````````````````````````````````````````````` |
| 13 |
|
| 14 |
if ($has_grant == 'true') |
| 15 |
{ |
| 16 |
--echo # Granting TABLE_ENCRYPTION_ADMIN for user. |
| 17 |
connection default; |
| 18 |
GRANT TABLE_ENCRYPTION_ADMIN ON *.* TO u1@localhost; |
| 19 |
connection con1; |
| 20 |
} |
| 21 |
|
| 22 |
eval SET GLOBAL table_encryption_privilege_check=$privilege_check; |
| 23 |
eval SET SESSION default_table_encryption=$global_database_encryption_default; |
| 24 |
|
| 25 |
--error $expected_error |
| 26 |
if ($explicit_encryption_clause == 'true') |
| 27 |
{ |
| 28 |
if ($with_default == 'true') |
| 29 |
{ |
| 30 |
eval CREATE DATABASE db1 DEFAULT ENCRYPTION=$database_encryption; |
| 31 |
} |
| 32 |
if ($with_default == 'false') |
| 33 |
{ |
| 34 |
eval CREATE DATABASE db1 ENCRYPTION=$database_encryption; |
| 35 |
} |
| 36 |
} |
| 37 |
--error $expected_error |
| 38 |
if ($explicit_encryption_clause != 'true') |
| 39 |
{ |
| 40 |
eval CREATE DATABASE db1; |
| 41 |
} |
| 42 |
SHOW WARNINGS; |
| 43 |
if ($expected_error == '0') |
| 44 |
{ |
| 45 |
SHOW CREATE DATABASE db1; |
| 46 |
SELECT SCHEMA_NAME, DEFAULT_ENCRYPTION |
| 47 |
FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='db1'; |
| 48 |
DROP DATABASE db1; |
| 49 |
} |
| 50 |
|
| 51 |
if ($has_grant == 'true') |
| 52 |
{ |
| 53 |
--echo # Revoke TABLE_ENCRYPTION_ADMIN |
| 54 |
connection default; |
| 55 |
REVOKE TABLE_ENCRYPTION_ADMIN ON *.* FROM u1@localhost; |
| 56 |
connection con1; |
| 57 |
} |
| 58 |
|
| 59 |
SET GLOBAL table_encryption_privilege_check=false; |
| 60 |
SET SESSION default_table_encryption=false; |