diff --git a/appveyor.yml b/appveyor.yml
index a33694df..9a8b75d9 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -79,7 +79,7 @@ install:
}
- echo Downloading MSODBCSQL 17
# AppVeyor build works are x64 VMs and 32-bit ODBC driver cannot be installed on it
- - ps: (new-object net.webclient).DownloadFile('https://download.microsoft.com/download/2/c/c/2cc12eab-a3aa-45d6-95bb-13f968fb6cd6/en-US/17.7.2.1/x64/msodbcsql.msi', 'c:\projects\msodbcsql.msi')
+ - ps: (new-object net.webclient).DownloadFile('https://download.microsoft.com/download/a/e/b/aeb7d4ff-ca20-45db-86b8-8a8f774ce97b/en-US/17.8.1.1/x64/msodbcsql.msi', 'c:\projects\msodbcsql.msi')
- cmd /c start /wait msiexec /i "c:\projects\msodbcsql.msi" /q IACCEPTMSODBCSQLLICENSETERMS=YES ADDLOCAL=ALL
- echo Checking the version of MSODBCSQL
- reg query "HKLM\SOFTWARE\ODBC\odbcinst.ini\ODBC Driver 17 for SQL Server"
diff --git a/test/bvt/sqlsrv/connect.inc b/test/bvt/sqlsrv/connect.inc
index bbe25ad0..71759d9e 100644
--- a/test/bvt/sqlsrv/connect.inc
+++ b/test/bvt/sqlsrv/connect.inc
@@ -16,4 +16,11 @@ function dropProc($conn, $procName)
sqlsrv_query($conn, $tsql);
}
+// RevisionNumber in SalesOrderHeader is subject to a trigger incrementing it whenever
+// changes are made to SalesOrderDetail. Since RevisionNumber is a tinyint, it can
+// overflow quickly if the BVT tests often run. Disable the trigger.
+function disableTrigger($conn)
+{
+ sqlsrv_query($conn, 'DISABLE TRIGGER uSalesOrderHeader ON Sales.SalesOrderHeader');
+}
?>
diff --git a/test/bvt/sqlsrv/msdn_sqlsrv_begin_transaction.phpt b/test/bvt/sqlsrv/msdn_sqlsrv_begin_transaction.phpt
index d5fcddb1..742d01d3 100644
--- a/test/bvt/sqlsrv/msdn_sqlsrv_begin_transaction.phpt
+++ b/test/bvt/sqlsrv/msdn_sqlsrv_begin_transaction.phpt
@@ -14,8 +14,7 @@ if( $conn === false )
die( print_r( sqlsrv_errors(), true ));
}
-$tsql = "DISABLE TRIGGER uSalesOrderHeader ON Sales.SalesOrderHeader";
-$stmt = sqlsrv_query($conn, $tsql);
+disableTrigger($conn);
/* Initiate transaction. */
/* Exit script if transaction cannot be initiated. */
@@ -64,9 +63,6 @@ else
$d_sql = "DELETE FROM Sales.SalesOrderDetail WHERE SalesOrderID=43659 AND OrderQty=5 AND ProductID=709 AND SpecialOfferID=1 AND Unitprice=5.70";
$stmt3 = sqlsrv_query($conn, $d_sql);
-$tsql = "ENABLE TRIGGER uSalesOrderHeader ON Sales.SalesOrderHeader";
-$stmt = sqlsrv_query($conn, $tsql);
-
/* Free statement and connection resources. */
sqlsrv_free_stmt( $stmt1);
sqlsrv_free_stmt( $stmt2);
diff --git a/test/bvt/sqlsrv/msdn_sqlsrv_execute_string.phpt b/test/bvt/sqlsrv/msdn_sqlsrv_execute_string.phpt
index 322ab392..d4d241a1 100644
--- a/test/bvt/sqlsrv/msdn_sqlsrv_execute_string.phpt
+++ b/test/bvt/sqlsrv/msdn_sqlsrv_execute_string.phpt
@@ -57,12 +57,7 @@ echo "
";
sqlsrv_free_stmt( $stmt);
-// RevisionNumber in SalesOrderHeader is subject to a trigger incrementing it whenever
-// changes are made to SalesOrderDetail. Since RevisonNumber is a tinyint, it can
-// overflow quickly if this test is often run. So disable the trigger.
-$tsql = "DISABLE TRIGGER uSalesOrderHeader ON Sales.SalesOrderHeader";
-$stmt = sqlsrv_query($conn, $tsql);
-
+disableTrigger($conn);
/* Prepare with string type in parameter. */
$tsql = "UPDATE Sales.SalesOrderDetail
@@ -142,10 +137,6 @@ else
}
echo sqlsrv_rows_affected( $stmt)." rows affected.
";
-// Re-enable the trigger
-$tsql = "ENABLE TRIGGER uSalesOrderHeader ON Sales.SalesOrderHeader";
-$stmt = sqlsrv_query($conn, $tsql);
-
/* Free the statement and connection resources. */
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
diff --git a/test/bvt/sqlsrv/msdn_sqlsrv_query.phpt b/test/bvt/sqlsrv/msdn_sqlsrv_query.phpt
index 62a16627..55de6d23 100644
--- a/test/bvt/sqlsrv/msdn_sqlsrv_query.phpt
+++ b/test/bvt/sqlsrv/msdn_sqlsrv_query.phpt
@@ -15,11 +15,7 @@ if( $conn === false )
die( print_r( sqlsrv_errors(), true));
}
-// RevisionNumber in SalesOrderHeader is subject to a trigger incrementing it whenever
-// changes are made to SalesOrderDetail. Since RevisonNumber is a tinyint, it can
-// overflow quickly if this test is often run. So disable the trigger.
-$tsql = "DISABLE TRIGGER uSalesOrderHeader ON Sales.SalesOrderHeader";
-$stmt = sqlsrv_query($conn, $tsql);
+disableTrigger($conn);
/* Set up the parameterized query. */
$tsql = "INSERT INTO Sales.SalesOrderDetail
@@ -47,10 +43,6 @@ else
die( print_r( sqlsrv_errors(), true));
}
-// Re-enable the trigger
-$tsql = "ENABLE TRIGGER uSalesOrderHeader ON Sales.SalesOrderHeader";
-$stmt = sqlsrv_query($conn, $tsql);
-
/* Free statement and connection resources. */
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
diff --git a/test/functional/pdo_sqlsrv/pdo_ae_output_param_floats.phpt b/test/functional/pdo_sqlsrv/pdo_ae_output_param_floats.phpt
index 3fccd103..a12a6c4b 100644
--- a/test/functional/pdo_sqlsrv/pdo_ae_output_param_floats.phpt
+++ b/test/functional/pdo_sqlsrv/pdo_ae_output_param_floats.phpt
@@ -1,7 +1,8 @@
--TEST--
Test for retrieving encrypted data of floats as output parameters
--DESCRIPTION--
-Use PDOstatement::bindParam with all PDO::PARAM_ types
+Use PDOstatement::bindParam with all PDO::PARAM_ types. This test generates input float. For your reference:
+https://en.wikipedia.org/wiki/Single-precision_floating-point_format#Precision_limitations_on_integer_values
--ENV--
PHPT_EXEC=true
--SKIPIF--
@@ -51,9 +52,9 @@ function testOutputFloats($fetchNumeric, $inout)
$inputValues = array();
// create random input values
for ($i = 0; $i < 2; $i++) {
- $mantissa = rand(1, 100000000);
- $decimals = rand(1, 100000000);
- $floatNum = $mantissa + $decimals / 10000000;
+ $mantissa = rand(1, 10000000);
+ $decimals = rand(1, 100);
+ $floatNum = $mantissa + $decimals / 10000;
if ($i > 0) {
// make the second input negative
$floatNum *= -1;
diff --git a/test/functional/pdo_sqlsrv/pdo_test_TVP_bind_params.phpt b/test/functional/pdo_sqlsrv/pdo_test_TVP_bind_params.phpt
index b08535ea..3c0116d1 100644
--- a/test/functional/pdo_sqlsrv/pdo_test_TVP_bind_params.phpt
+++ b/test/functional/pdo_sqlsrv/pdo_test_TVP_bind_params.phpt
@@ -11,6 +11,16 @@ PHPT_EXEC=true
require_once('MsSetup.inc');
require_once('MsCommon_mid-refactor.inc');
+function verifyPhoto($image, $photo)
+{
+ // With PHP 8.1+, bindColumn() of binary fields will be resource
+ if (PHP_VERSION_ID >= 80100) {
+ return verifyBinaryStream($image, $photo);
+ } else {
+ return verifyBinaryData($image, $photo);
+ }
+}
+
try {
date_default_timezone_set('America/Los_Angeles');
@@ -76,7 +86,7 @@ try {
$stmt = $conn->query($tsql);
$stmt->bindColumn('Photo', $photo, PDO::PARAM_LOB, 0, PDO::SQLSRV_ENCODING_BINARY);
if ($row = $stmt->fetch(PDO::FETCH_BOUND)) {
- if (!verifyBinaryData($images[$index], $photo)) {
+ if (!verifyPhoto($images[$index], $photo)) {
echo 'Image data corrupted for row '. ($index + 1) . PHP_EOL;
}
} else {
diff --git a/test/functional/pdo_sqlsrv/pdo_test_TVP_nulls_buffered.phpt b/test/functional/pdo_sqlsrv/pdo_test_TVP_nulls_buffered.phpt
index 45dae776..4605d882 100644
--- a/test/functional/pdo_sqlsrv/pdo_test_TVP_nulls_buffered.phpt
+++ b/test/functional/pdo_sqlsrv/pdo_test_TVP_nulls_buffered.phpt
@@ -11,6 +11,16 @@ PHPT_EXEC=true
require_once('MsSetup.inc');
require_once('MsCommon_mid-refactor.inc');
+function verifyPhoto($image, $photo)
+{
+ // With PHP 8.1+, bindColumn() of binary fields will be resource
+ if (PHP_VERSION_ID >= 80100) {
+ return verifyBinaryStream($image, $photo);
+ } else {
+ return verifyBinaryData($image, $photo);
+ }
+}
+
try {
date_default_timezone_set('America/Los_Angeles');
@@ -84,8 +94,9 @@ try {
$stmt = $conn->query($tsql);
$index = 2;
$stmt->bindColumn('Photo', $photo, PDO::PARAM_LOB, 0, PDO::SQLSRV_ENCODING_BINARY);
+
if ($row = $stmt->fetch(PDO::FETCH_BOUND)) {
- if (!verifyBinaryData($images[$index], $photo)) {
+ if (!verifyPhoto($images[$index], $photo)) {
echo 'Image data corrupted for row '. ($index + 1) . PHP_EOL;
}
} else {