From e6af597cad1ae0d0864b2933e6e8b717fa65f523 Mon Sep 17 00:00:00 2001 From: v-kaywon Date: Wed, 14 Mar 2018 10:55:36 -0700 Subject: [PATCH] use isDataEncrypted helper function for output tests --- .../sqlsrv/sqlsrv_ae_output_param_sqltype_binary_size.phpt | 4 ++-- .../sqlsrv/sqlsrv_ae_output_param_sqltype_char_size.phpt | 7 ++++--- .../sqlsrv_ae_output_param_sqltype_decimal_precision.phpt | 4 ++-- .../sqlsrv/sqlsrv_ae_output_param_sqltype_float_bits.phpt | 2 +- .../sqlsrv/sqlsrv_ae_output_param_sqltype_int_conv.phpt | 2 +- .../sqlsrv/sqlsrv_ae_output_param_sqltype_nchar_size.phpt | 4 ++-- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_binary_size.phpt b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_binary_size.phpt index 5416364f..0ca547f1 100644 --- a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_binary_size.phpt +++ b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_binary_size.phpt @@ -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"; } diff --git a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_char_size.phpt b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_char_size.phpt index a27335fa..a2da785a 100644 --- a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_char_size.phpt +++ b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_char_size.phpt @@ -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) { diff --git a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_decimal_precision.phpt b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_decimal_precision.phpt index 5a83b4ca..5a168581 100644 --- a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_decimal_precision.phpt +++ b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_decimal_precision.phpt @@ -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 { diff --git a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_float_bits.phpt b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_float_bits.phpt index bbda75e6..3c9fe97c 100644 --- a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_float_bits.phpt +++ b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_float_bits.phpt @@ -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 { diff --git a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_int_conv.phpt b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_int_conv.phpt index 310e21ab..589d2681 100644 --- a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_int_conv.phpt +++ b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_int_conv.phpt @@ -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 { diff --git a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_nchar_size.phpt b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_nchar_size.phpt index 3ab7b31c..c54ac50f 100644 --- a/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_nchar_size.phpt +++ b/test/functional/sqlsrv/sqlsrv_ae_output_param_sqltype_nchar_size.phpt @@ -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"; }