Skip to content

Commit

Permalink
Fix IBM DB2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim authored and derrabus committed Aug 28, 2023
1 parent 308fa1f commit 504462e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
4 changes: 0 additions & 4 deletions src/Driver/IBMDB2/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le
$this->lobs[$param] = &$variable;
break;

case ParameterType::BINARY:
$this->bind($param, $variable, DB2_PARAM_IN, DB2_BINARY);
break;

default:
$this->bind($param, $variable, DB2_PARAM_IN, DB2_CHAR);
break;
Expand Down
46 changes: 29 additions & 17 deletions tests/Functional/BinaryDataAccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use function array_map;
use function hex2bin;
use function is_resource;
use function pack;
use function stream_get_contents;

use const CASE_LOWER;
Expand Down Expand Up @@ -270,10 +269,23 @@ public function testFetchOneWithTypes(): void

public function testNativeArrayListSupport(): void
{
$binaryValues = [
hex2bin('A0AEFA'),
hex2bin('1F43BA'),
hex2bin('8C9D2A'),
hex2bin('72E8AA'),
hex2bin('5B6F9A'),
hex2bin('DAB24A'),
hex2bin('3E71CA'),
hex2bin('F0D6EA'),
hex2bin('6A8B5A'),
hex2bin('C582FA'),
];

for ($i = 100; $i < 110; $i++) {
$this->connection->insert('binary_fetch_table', [
'test_int' => $i,
'test_binary' => pack('L', $i),
'test_binary' => $binaryValues[$i - 100],
], [
'test_binary' => ParameterType::BINARY,
]);
Expand All @@ -293,11 +305,11 @@ public function testNativeArrayListSupport(): void
'SELECT test_int FROM binary_fetch_table WHERE test_binary IN (?)',
[
[
pack('L', 100),
pack('L', 101),
pack('L', 102),
pack('L', 103),
pack('L', 104),
$binaryValues[0],
$binaryValues[1],
$binaryValues[2],
$binaryValues[3],
$binaryValues[4],
],
],
[ArrayParameterType::BINARY],
Expand All @@ -311,11 +323,11 @@ public function testNativeArrayListSupport(): void
'SELECT test_binary FROM binary_fetch_table WHERE test_binary IN (?)',
[
[
pack('L', 100),
pack('L', 101),
pack('L', 102),
pack('L', 103),
pack('L', 104),
$binaryValues[0],
$binaryValues[1],
$binaryValues[2],
$binaryValues[3],
$binaryValues[4],
],
],
[ArrayParameterType::BINARY],
Expand All @@ -332,11 +344,11 @@ public function testNativeArrayListSupport(): void
);

self::assertEquals([
pack('L', 100),
pack('L', 101),
pack('L', 102),
pack('L', 103),
pack('L', 104),
$binaryValues[0],
$binaryValues[1],
$binaryValues[2],
$binaryValues[3],
$binaryValues[4],
], $data);
}
}

0 comments on commit 504462e

Please sign in to comment.