address review comments

This commit is contained in:
v-kaywon 2018-03-13 16:15:42 -07:00
parent 87cd9b45e2
commit d88967cf4a
7 changed files with 23 additions and 7 deletions

View file

@ -55,7 +55,7 @@ try {
// check the case when fetching as PDO::PARAM_STR or PDO::PARAM_LOB // check the case when fetching as PDO::PARAM_STR or PDO::PARAM_LOB
// with or without AE: should work // with or without AE: should work
} else { } else {
if (strlen($det) == $m && strlen($rand) == $m) { if (trim($det) == $inputValues[0] && trim($rand) == $inputValues[1]) {
echo "****Retrieving $typeFull data as $pdoParamType is supported****\n"; echo "****Retrieving $typeFull data as $pdoParamType is supported****\n";
} else { } else {
echo "Retrieving $typeFull data as $pdoParamType fails\n"; echo "Retrieving $typeFull data as $pdoParamType fails\n";

View file

@ -44,6 +44,7 @@ try {
echo "Retrieving $dataType data as $pdoParamType should not be supported\n"; echo "Retrieving $dataType data as $pdoParamType should not be supported\n";
} }
// check the case when fetching as PDO::PARAM_STR or PDO::PARAM_LOB // check the case when fetching as PDO::PARAM_STR or PDO::PARAM_LOB
// only check if input values are part of fetched values because some input values do not contain any deicmal places, the value retrieved however has 3 decimal places if the type is a datetime
// with or without AE: should work // with or without AE: should work
} else { } else {
if (strpos($det, $inputValues[0]) !== false && strpos($rand, $inputValues[1]) !== false) { if (strpos($det, $inputValues[0]) !== false && strpos($rand, $inputValues[1]) !== false) {

View file

@ -3,10 +3,10 @@ Test for inserting encrypted data into char types columns with different sizes
--DESCRIPTION-- --DESCRIPTION--
Test conversions between different char types of different sizes Test conversions between different char types of different sizes
With or without Always Encrypted, implicit conversion works if: With or without Always Encrypted, implicit conversion works if:
1. From input of PDO::PARAM_BOOL to a any char column 1. From input of PDO::PARAM_BOOL to any char column
2. From input of PDO::PARAM_INT to a any char column 2. From input of PDO::PARAM_INT to any char column
3. From input of PDO::PARAM_STR to a any char column 3. From input of PDO::PARAM_STR to any char column
4. From input of PDO::PARAM_LOB to a any char column 4. From input of PDO::PARAM_LOB to any char column
--SKIPIF-- --SKIPIF--
<?php require('skipif_mid-refactor.inc'); ?> <?php require('skipif_mid-refactor.inc'); ?>
--FILE-- --FILE--
@ -29,7 +29,10 @@ try {
} }
echo "\nTesting $typeFull:\n"; echo "\nTesting $typeFull:\n";
//create table containing char(m) or varchar(m) columns // create table containing a char(m) or varchar(m) column
// only one column is created because a row has a limitation of 8060 bytes
// for lengths 4096 and 8000, cannot create 2 columns as it will exceed the maximum row sizes
// for AE, only testing randomized here, deterministic is tested in the nchar test
$tbname = getTableName("test_" . str_replace(array('(', ')'), '', $dataType) . $m); $tbname = getTableName("test_" . str_replace(array('(', ')'), '', $dataType) . $m);
$colMetaArr = array(new ColumnMeta($typeFull, "c1", null, "randomized")); $colMetaArr = array(new ColumnMeta($typeFull, "c1", null, "randomized"));
createTable($conn, $tbname, $colMetaArr); createTable($conn, $tbname, $colMetaArr);

View file

@ -29,7 +29,10 @@ try {
} }
echo "\nTesting $typeFull:\n"; echo "\nTesting $typeFull:\n";
//create table containing nchar(m) or nvarchar(m) columns // create table containing nchar(m) or nvarchar(m) columns
// only one column is created because a row has a limitation of 8060 bytes
// for lengths 4096 and 8000, cannot create 2 columns as it will exceed the maximum row sizes
// for AE, only testing deterministic here, randomized is tested in the char test
$tbname = "test_" . str_replace(array('(', ')'), '', $dataType) . $m; $tbname = "test_" . str_replace(array('(', ')'), '', $dataType) . $m;
$colMetaArr = array(new ColumnMeta($typeFull, "c1")); $colMetaArr = array(new ColumnMeta($typeFull, "c1"));
createTable($conn, $tbname, $colMetaArr); createTable($conn, $tbname, $colMetaArr);

View file

@ -32,6 +32,9 @@ foreach($dataTypes as $dataType) {
echo "\nTesting $typeFull:\n"; echo "\nTesting $typeFull:\n";
// create table containing char(m) or varchar(m) columns // create table containing char(m) or varchar(m) columns
// only one column is created because a row has a limitation of 8060 bytes
// for lengths 4096 and 8000, cannot create 2 columns as it will exceed the maximum row sizes
// for AE, only testing deterministic here, randomized is tested in the nchar test
$tbname = "test_" . str_replace(array('(', ')'), '', $dataType) . $m; $tbname = "test_" . str_replace(array('(', ')'), '', $dataType) . $m;
$colMetaArr = array(new AE\ColumnMeta($typeFull, "c1")); $colMetaArr = array(new AE\ColumnMeta($typeFull, "c1"));
AE\createTable($conn, $tbname, $colMetaArr); AE\createTable($conn, $tbname, $colMetaArr);

View file

@ -27,6 +27,9 @@ require_once('MsCommon.inc');
$dataTypes = array("bit", "tinyint", "smallint", "int", "bigint"); $dataTypes = array("bit", "tinyint", "smallint", "int", "bigint");
$sqlTypes = array("SQLSRV_SQLTYPE_BIT", "SQLSRV_SQLTYPE_TINYINT", "SQLSRV_SQLTYPE_SMALLINT", "SQLSRV_SQLTYPE_INT", "SQLSRV_SQLTYPE_BIGINT"); $sqlTypes = array("SQLSRV_SQLTYPE_BIT", "SQLSRV_SQLTYPE_TINYINT", "SQLSRV_SQLTYPE_SMALLINT", "SQLSRV_SQLTYPE_INT", "SQLSRV_SQLTYPE_BIGINT");
// only 1 and 0 inputs are tested as they are the only values that fit into all integer types
// this test is for testing different integer conversions, if the input value does not fit into a datatype,
// the conversion would fail not because the conversion is not supported, but because of other errors such as truncation
$inputValues = array(1, 0); $inputValues = array(1, 0);
// this is a list of implicit datatype conversion that AE supports // this is a list of implicit datatype conversion that AE supports

View file

@ -32,6 +32,9 @@ foreach($dataTypes as $dataType) {
echo "\nTesting $typeFull:\n"; echo "\nTesting $typeFull:\n";
// create table containing nchar(m) or nvarchar(m) columns // create table containing nchar(m) or nvarchar(m) columns
// only one column is created because a row has a limitation of 8060 bytes
// for lengths 4096 and 8000, cannot create 2 columns as it will exceed the maximum row sizes
// for AE, only testing randomized here, deterministic is tested in the char test
$tbname = "test_" . str_replace(array('(', ')'), '', $dataType) . $m; $tbname = "test_" . str_replace(array('(', ')'), '', $dataType) . $m;
$colMetaArr = array(new AE\ColumnMeta($typeFull, "c1", null, false)); $colMetaArr = array(new AE\ColumnMeta($typeFull, "c1", null, false));
AE\createTable($conn, $tbname, $colMetaArr); AE\createTable($conn, $tbname, $colMetaArr);