use isDataEncrypted helper function for output tests

This commit is contained in:
v-kaywon 2018-03-14 10:55:36 -07:00
parent b65d34fb23
commit e6af597cad
6 changed files with 12 additions and 11 deletions

View file

@ -75,7 +75,7 @@ foreach($dataTypes as $dataType) {
// with AE: should not work
// without AE: should work, except when a SQLSRV_SQLTYPE_VARBINARY length (n) is less than a binary column length (m) for SQLSRV_PARAM_OUT
if (($n != $m || $maxsqltype || $maxcol) && !($maxcol && $maxsqltype)) {
if (AE\isColEncrypted()) {
if (AE\isDataEncrypted()) {
if ($r !== false) {
var_dump($n);
var_dump($m);
@ -87,7 +87,7 @@ foreach($dataTypes as $dataType) {
}
}
} else {
if (strpos($sqltypeFull, "VARBINARY") !== false && $dataType == "binary" && $m > $n && strpos($sqltypeFull, "max") === false && $dir == "SQLSRV_PARAM_OUT") {
if (!AE\isColEncrypted() && strpos($sqltypeFull, "VARBINARY") !== false && $dataType == "binary" && $m > $n && strpos($sqltypeFull, "max") === false && $dir == "SQLSRV_PARAM_OUT") {
if ($r !== false) {
echo "Conversions from $typeFull to output $sqltypeFull should not be supported\n";
}

View file

@ -37,7 +37,7 @@ foreach($dataTypes as $dataType) {
echo "\nTesting $typeFull:\n";
// create and populate table containing char(m) or varchar(m) columns
$tbname = "test_" . str_replace(array('(', ')'), '', $dataType) . $m;
$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));
@ -71,7 +71,7 @@ foreach($dataTypes as $dataType) {
// with AE: should not work
// without AE: should work, except when a SQLSRV_SQLTYPE_VARCHAR length (n) is less than a char column length (m)
if (($n != $m || $maxsqltype || $maxcol) && !($maxcol && $maxsqltype)) {
if (AE\isColEncrypted()) {
if (AE\isDataEncrypted()) {
if ($r !== false) {
var_dump($n);
var_dump($m);
@ -83,9 +83,10 @@ foreach($dataTypes as $dataType) {
}
}
} else {
if (strpos($sqltypeFull, "VARCHAR") !== false && $dataType == "char" && $m > $n && strpos($sqltypeFull, "max") === false && $dir == "SQLSRV_PARAM_OUT") {
if (!AE\isColEncrypted() && strpos($sqltypeFull, "VARCHAR") !== false && $dataType == "char" && $m > $n && strpos($sqltypeFull, "max") === false && $dir == "SQLSRV_PARAM_OUT") {
if ($r !== false) {
echo "Conversions from $typeFull to output $sqltypeFull should not be supported\n";
var_dump($c1);
}
} else {
if ($r === false) {

View file

@ -77,7 +77,7 @@ foreach($dataTypes as $dataType) {
$c_detOut = 0.0;
$c_randOut = 0.0;
$stmt = sqlsrv_prepare($conn, $sql, array(array(&$c_detOut, constant($dir), SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), $sqltypeconst), array(&$c_randOut, constant($dir), SQLSRV_PHPTYPE_STRING(SQLSRV_ENC_CHAR), $sqltypeconst)));
$stmt = sqlsrv_prepare($conn, $sql, array(array(&$c_detOut, constant($dir), null, $sqltypeconst), array(&$c_randOut, constant($dir), null, $sqltypeconst)));
$r = sqlsrv_execute($stmt);
// check the case when the SQLSRV_SQLTYPE precision (n1) is not the same as the column precision (m1)
@ -85,7 +85,7 @@ foreach($dataTypes as $dataType) {
// with AE: should not work
// without AE: should not work if n1 - n2 < m1 - m2
if ($n1 != $m1 || $n2 != $m2) {
if (AE\isColEncrypted()) {
if (AE\isDataEncrypted()) {
if ($r !== false) {
echo "AE: Conversion from $typeFull to output $sqltypeFull should not be supported\n";
} else {

View file

@ -47,7 +47,7 @@ foreach($bits as $m) {
// with AE: should not work
// without AE: should work
if ($m < 25) {
if (AE\isColEncrypted()) {
if (AE\isDataEncrypted()) {
if ($r !== false) {
echo "AE: Conversion between $typeFull to output $sqlType should not be supported\n";
} else {

View file

@ -41,7 +41,7 @@ foreach ($dataTypes as $dataType) {
// check the case if the column type is not the same as the SQLSRV_SQLTYPE
if ($sqlType != "SQLSRV_SQLTYPE_" . strtoupper($dataType)) {
if (AE\isColEncrypted()) {
if (AE\isDataEncrypted()) {
if ($r !== false) {
echo "AE: Conversion from $dataType to output $sqlType should not be supported\n";
} else {

View file

@ -71,7 +71,7 @@ foreach($dataTypes as $dataType) {
// with AE: should not work
// without AE: should work, except when a SQLSRV_SQLTYPE_NVARCHAR length (n) is less than a nchar column length (m)
if (($n != $m || $maxsqltype || $maxcol) && !($maxcol && $maxsqltype)) {
if (AE\isColEncrypted()) {
if (AE\isDataEncrypted()) {
if ($r !== false) {
var_dump($n);
var_dump($m);
@ -83,7 +83,7 @@ foreach($dataTypes as $dataType) {
}
}
} else {
if (strpos($sqltypeFull, "NVARCHAR") !== false && $dataType == "nchar" && $m > $n && strpos($sqltypeFull, "max") === false && $dir == "SQLSRV_PARAM_OUT") {
if (!AE\isColEncrypted() && strpos($sqltypeFull, "NVARCHAR") !== false && $dataType == "nchar" && $m > $n && strpos($sqltypeFull, "max") === false && $dir == "SQLSRV_PARAM_OUT") {
if ($r !== false) {
echo "Conversions from $typeFull to output $sqltypeFull should not be supported\n";
}