From bedfd462f7265e4a1f2de94b315888055516f8cc Mon Sep 17 00:00:00 2001 From: v-kaywon Date: Tue, 7 Nov 2017 15:59:28 -0800 Subject: [PATCH] fix decimal related tests to work on SQL Server 2k12 --- .../pdo_ae_insert_pdoparam_money.phpt | 2 +- .../pdo_ae_insert_pdoparam_numeric.phpt | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/test/functional/pdo_sqlsrv/pdo_ae_insert_pdoparam_money.phpt b/test/functional/pdo_sqlsrv/pdo_ae_insert_pdoparam_money.phpt index 563b0b90..71c50593 100644 --- a/test/functional/pdo_sqlsrv/pdo_ae_insert_pdoparam_money.phpt +++ b/test/functional/pdo_sqlsrv/pdo_ae_insert_pdoparam_money.phpt @@ -26,7 +26,7 @@ try { // insert a row $inputValues = array_slice(${explode("(", $dataType)[0] . "_params"}, 1, 2); $r; - $stmt = insertRow($conn, $tbname, array("c_det" => new BindParamOp(1, $inputValues[0], $pdoParamType), "c_rand" => new BindParamOp(2, $inputValues[1], $pdoParamType)), "prepareBindParam", $r); + $stmt = insertRow($conn, $tbname, array("c_det" => new BindParamOp(1, (string)$inputValues[0], $pdoParamType), "c_rand" => new BindParamOp(2, (string)$inputValues[1], $pdoParamType)), "prepareBindParam", $r); if (!isColEncrypted()) { diff --git a/test/functional/pdo_sqlsrv/pdo_ae_insert_pdoparam_numeric.phpt b/test/functional/pdo_sqlsrv/pdo_ae_insert_pdoparam_numeric.phpt index 6cfd7f81..6dc7f755 100644 --- a/test/functional/pdo_sqlsrv/pdo_ae_insert_pdoparam_numeric.phpt +++ b/test/functional/pdo_sqlsrv/pdo_ae_insert_pdoparam_numeric.phpt @@ -24,7 +24,11 @@ try { // insert a row $inputValues = array_slice(${explode("(", $dataType)[0] . "_params"}, 1, 2); $r; - $stmt = insertRow($conn, $tbname, array( "c_det" => new BindParamOp(1, $inputValues[0], $pdoParamType), "c_rand" => new BindParamOp(2, $inputValues[1], $pdoParamType)), "prepareBindParam", $r); + if ($dataType == "decimal(18,5)") { + $stmt = insertRow($conn, $tbname, array( "c_det" => new BindParamOp(1, (string)$inputValues[0], $pdoParamType), "c_rand" => new BindParamOp(2, (string)$inputValues[1], $pdoParamType)), "prepareBindParam", $r); + } else { + $stmt = insertRow($conn, $tbname, array( "c_det" => new BindParamOp(1, $inputValues[0], $pdoParamType), "c_rand" => new BindParamOp(2, $inputValues[1], $pdoParamType)), "prepareBindParam", $r); + } if ($r === false) { isIncompatibleTypesError($stmt, $dataType, $pdoParamType); } else { @@ -113,20 +117,20 @@ c_rand: 2147483647 Testing decimal(18,5): ****PDO param type PDO::PARAM_BOOL is compatible with encrypted decimal(18,5)**** -c_det: -9223372036854.80078 -c_rand: 9223372036854.80078 +c_det: -9223372036854.80000 +c_rand: 9223372036854.80000 ****PDO param type PDO::PARAM_NULL is compatible with encrypted decimal(18,5)**** c_det: c_rand: ****PDO param type PDO::PARAM_INT is compatible with encrypted decimal(18,5)**** -c_det: -9223372036854.80078 -c_rand: 9223372036854.80078 +c_det: -9223372036854.80000 +c_rand: 9223372036854.80000 ****PDO param type PDO::PARAM_STR is compatible with encrypted decimal(18,5)**** c_det: -9223372036854.80000 c_rand: 9223372036854.80000 ****PDO param type PDO::PARAM_LOB is compatible with encrypted decimal(18,5)**** -c_det: -9223372036854.80078 -c_rand: 9223372036854.80078 +c_det: -9223372036854.80000 +c_rand: 9223372036854.80000 Testing numeric(10,5): ****PDO param type PDO::PARAM_BOOL is compatible with encrypted numeric(10,5)****