Skip to content

Commit

Permalink
fix decimal related tests to work on SQL Server 2k12
Browse files Browse the repository at this point in the history
  • Loading branch information
yukiwongky committed Nov 7, 2017
1 parent 7c02574 commit bedfd46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
18 changes: 11 additions & 7 deletions test/functional/pdo_sqlsrv/pdo_ae_insert_pdoparam_numeric.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)****
Expand Down

1 comment on commit bedfd46

@yitam
Copy link
Contributor

@yitam yitam commented on bedfd46 Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to a workaround? Because this was unnecessary before

Please sign in to comment.