address review comments

This commit is contained in:
v-kaywon 2018-03-15 13:08:04 -07:00
parent e6af597cad
commit 600e338a1f
6 changed files with 47 additions and 45 deletions

View file

@ -29,7 +29,7 @@ $conn = AE\connect();
foreach ($dataTypes as $dataType) {
$maxcol = strpos($dataType, "(max)");
foreach ($lengths as $m) {
if ($maxcol !== false) {
if ($maxcol) {
$typeFull = $dataType;
} else {
$typeFull = "$dataType($m)";
@ -43,7 +43,7 @@ foreach($dataTypes as $dataType) {
$inputs = array(new AE\BindParamOption($inputValues[0], null, "SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY)"),
new AE\BindParamOption($inputValues[1], null, "SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_BINARY)"));
$r;
$stmt = AE\insertRow($conn, $tbname, array("c_det" => $inputs[0], "c_rand" => $inputs[1]), $r, AE\INSERT_PREPARE_PARAMS);
$stmt = AE\insertRow($conn, $tbname, array($colMetaArr[0]->colName => $inputs[0], $colMetaArr[1]->colName => $inputs[1]), $r, AE\INSERT_PREPARE_PARAMS);
// create a stored procedure and sql string for calling the stored procedure
$spname = 'selectAllColumns';
@ -58,7 +58,7 @@ foreach($dataTypes as $dataType) {
foreach ($sqltypeLengths as $n) {
$sqltypeconst;
$sqltypeFull;
if ($maxsqltype !== false) {
if ($maxsqltype) {
$sqltypeconst = SQLSRV_SQLTYPE_VARBINARY('max');
$sqltypeFull = $sqlType;
} else {
@ -77,8 +77,6 @@ foreach($dataTypes as $dataType) {
if (($n != $m || $maxsqltype || $maxcol) && !($maxcol && $maxsqltype)) {
if (AE\isDataEncrypted()) {
if ($r !== false) {
var_dump($n);
var_dump($m);
echo "AE: Conversion from $typeFull to output $sqltypeFull should not be supported\n";
} else {
if (sqlsrv_errors()[0]['SQLSTATE'] != "22018") {
@ -121,6 +119,7 @@ foreach($dataTypes as $dataType) {
}
}
}
dropProc($conn, $spname);
dropTable($conn, $tbname);
}
}

View file

@ -29,7 +29,7 @@ $conn = AE\connect();
foreach ($dataTypes as $dataType) {
$maxcol = strpos($dataType, "(max)");
foreach ($lengths as $m) {
if ($maxcol !== false) {
if ($maxcol) {
$typeFull = $dataType;
} else {
$typeFull = "$dataType($m)";
@ -40,7 +40,7 @@ foreach($dataTypes as $dataType) {
$tbname = getTempTableName("test_" . str_replace(array('(', ')'), '', $dataType) . $m, false);
$colMetaArr = array(new AE\ColumnMeta($typeFull, "c1", null, false));
AE\createTable($conn, $tbname, $colMetaArr);
$stmt = AE\insertRow($conn, $tbname, array("c1" => $inputValue));
$stmt = AE\insertRow($conn, $tbname, array($colMetaArr[0]->colName => $inputValue));
// create a stored procedure and sql string for calling the stored procedure
$spname = 'selectAllColumns';
@ -55,7 +55,7 @@ foreach($dataTypes as $dataType) {
foreach ($sqltypeLengths as $n) {
$sqltypeconst;
$sqltypeFull;
if ($maxsqltype !== false) {
if ($maxsqltype) {
$sqltypeconst = SQLSRV_SQLTYPE_VARCHAR('max');
$sqltypeFull = $sqlType;
} else {
@ -73,8 +73,6 @@ foreach($dataTypes as $dataType) {
if (($n != $m || $maxsqltype || $maxcol) && !($maxcol && $maxsqltype)) {
if (AE\isDataEncrypted()) {
if ($r !== false) {
var_dump($n);
var_dump($m);
echo "AE: Conversion from $typeFull to output $sqltypeFull should not be supported\n";
} else {
if (sqlsrv_errors()[0]['SQLSTATE'] != "22018") {
@ -117,6 +115,7 @@ foreach($dataTypes as $dataType) {
}
}
}
dropProc($conn, $spname);
dropTable($conn, $tbname);
}
}

View file

@ -41,7 +41,7 @@ foreach($dataTypes as $dataType) {
$tbname = "test_" . $dataType . $m1 . $m2;
$colMetaArr = array(new AE\ColumnMeta($typeFull, "c_det"), new AE\ColumnMeta($typeFull, "c_rand", null, false));
AE\createTable($conn, $tbname, $colMetaArr);
$stmt = AE\insertRow($conn, $tbname, array("c_det" => $inputValues[0], "c_rand" => $inputValues[1]));
$stmt = AE\insertRow($conn, $tbname, array($colMetaArr[0]->colName => $inputValues[0], $colMetaArr[1]->colName => $inputValues[1]));
// create a stored procedure and sql string for calling the stored procedure
$spname = 'selectAllColumns';
@ -128,6 +128,7 @@ foreach($dataTypes as $dataType) {
}
}
}
dropProc($conn, $spname);
dropTable($conn, $tbname);
}
}

View file

@ -27,7 +27,7 @@ foreach($bits as $m) {
$tbname = "test_" . $dataType . $m;
$colMetaArr = array(new AE\ColumnMeta($typeFull, "c_det"), new AE\ColumnMeta($typeFull, "c_rand", null, false));
AE\createTable($conn, $tbname, $colMetaArr);
$stmt = AE\insertRow($conn, $tbname, array("c_det" => $inputValues[0], "c_rand" => $inputValues[1]));
$stmt = AE\insertRow($conn, $tbname, array($colMetaArr[0]->colName => $inputValues[0], $colMetaArr[1]->colName => $inputValues[1]));
// create a stored procedure and sql string for calling the stored procedure
$spname = 'selectAllColumns';
@ -44,7 +44,9 @@ foreach($bits as $m) {
$r = sqlsrv_execute($stmt);
// check the case when the column number of bits is less than 25
// with AE: should not work
// when the number of bits is between 1 and 24, it corresponds to a storage size of 4 bytes
// when the number of bits is between 25 and 53, it corresponds to a storage size of 8 bytes
// with AE: should not work because SQLSRV_SQLTYPE_FLOAT maps to float(53) and conversion from a larger float to a smaller float is not supported
// without AE: should work
if ($m < 25) {
if (AE\isDataEncrypted()) {
@ -85,6 +87,7 @@ foreach($bits as $m) {
// cleanup
sqlsrv_free_stmt($stmt);
}
dropProc($conn, $spname);
dropTable($conn, $tbname);
}
sqlsrv_close($conn);

View file

@ -23,7 +23,7 @@ foreach ($dataTypes as $dataType) {
$tbname = "test_" . $dataType;
$colMetaArr = array( new AE\ColumnMeta($dataType, "c_det"), new AE\ColumnMeta($dataType, "c_rand", null, false));
AE\createTable($conn, $tbname, $colMetaArr);
$stmt = AE\insertRow($conn, $tbname, array("c_det" => $inputValues[0], "c_rand" => $inputValues[1]));
$stmt = AE\insertRow($conn, $tbname, array($colMetaArr[0]->colName => $inputValues[0], $colMetaArr[1]->colName => $inputValues[1]));
// create a stored procedure and sql string for calling the stored procedure
$spname = 'selectAllColumns';
@ -75,6 +75,7 @@ foreach ($dataTypes as $dataType) {
sqlsrv_free_stmt($stmt);
}
}
dropProc($conn, $spname);
dropTable($conn, $tbname);
}
sqlsrv_close($conn);

View file

@ -29,7 +29,7 @@ $conn = AE\connect();
foreach ($dataTypes as $dataType) {
$maxcol = strpos($dataType, "(max)");
foreach ($lengths as $m) {
if ($maxcol !== false) {
if ($maxcol) {
$typeFull = $dataType;
} else {
$typeFull = "$dataType($m)";
@ -40,7 +40,7 @@ foreach($dataTypes as $dataType) {
$tbname = "test_" . str_replace(array('(', ')'), '', $dataType) . $m;
$colMetaArr = array(new AE\ColumnMeta($typeFull, "c1", null, false));
AE\createTable($conn, $tbname, $colMetaArr);
$stmt = AE\insertRow($conn, $tbname, array("c1" => $inputValue));
$stmt = AE\insertRow($conn, $tbname, array($colMetaArr[0]->colName => $inputValue));
// create a stored procedure and sql string for calling the stored procedure
$spname = 'selectAllColumns';
@ -55,7 +55,7 @@ foreach($dataTypes as $dataType) {
foreach ($sqltypeLengths as $n) {
$sqltypeconst;
$sqltypeFull;
if ($maxsqltype !== false) {
if ($maxsqltype) {
$sqltypeconst = SQLSRV_SQLTYPE_NVARCHAR('max');
$sqltypeFull = $sqlType;
} else {
@ -73,8 +73,6 @@ foreach($dataTypes as $dataType) {
if (($n != $m || $maxsqltype || $maxcol) && !($maxcol && $maxsqltype)) {
if (AE\isDataEncrypted()) {
if ($r !== false) {
var_dump($n);
var_dump($m);
echo "AE: Conversion from $typeFull to output $sqltypeFull should not be supported\n";
} else {
if (sqlsrv_errors()[0]['SQLSTATE'] != "22018") {
@ -116,6 +114,7 @@ foreach($dataTypes as $dataType) {
}
}
}
dropProc($conn, $spname);
dropTable($conn, $tbname);
}
}