Skip to content

Commit 504462e

Browse files
shyimderrabus
authored andcommitted
Fix IBM DB2 tests
1 parent 308fa1f commit 504462e

File tree

2 files changed

+29
-21
lines changed

2 files changed

+29
-21
lines changed

src/Driver/IBMDB2/Statement.php

-4
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,6 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le
108108
$this->lobs[$param] = &$variable;
109109
break;
110110

111-
case ParameterType::BINARY:
112-
$this->bind($param, $variable, DB2_PARAM_IN, DB2_BINARY);
113-
break;
114-
115111
default:
116112
$this->bind($param, $variable, DB2_PARAM_IN, DB2_CHAR);
117113
break;

tests/Functional/BinaryDataAccessTest.php

+29-17
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use function array_map;
1717
use function hex2bin;
1818
use function is_resource;
19-
use function pack;
2019
use function stream_get_contents;
2120

2221
use const CASE_LOWER;
@@ -270,10 +269,23 @@ public function testFetchOneWithTypes(): void
270269

271270
public function testNativeArrayListSupport(): void
272271
{
272+
$binaryValues = [
273+
hex2bin('A0AEFA'),
274+
hex2bin('1F43BA'),
275+
hex2bin('8C9D2A'),
276+
hex2bin('72E8AA'),
277+
hex2bin('5B6F9A'),
278+
hex2bin('DAB24A'),
279+
hex2bin('3E71CA'),
280+
hex2bin('F0D6EA'),
281+
hex2bin('6A8B5A'),
282+
hex2bin('C582FA'),
283+
];
284+
273285
for ($i = 100; $i < 110; $i++) {
274286
$this->connection->insert('binary_fetch_table', [
275287
'test_int' => $i,
276-
'test_binary' => pack('L', $i),
288+
'test_binary' => $binaryValues[$i - 100],
277289
], [
278290
'test_binary' => ParameterType::BINARY,
279291
]);
@@ -293,11 +305,11 @@ public function testNativeArrayListSupport(): void
293305
'SELECT test_int FROM binary_fetch_table WHERE test_binary IN (?)',
294306
[
295307
[
296-
pack('L', 100),
297-
pack('L', 101),
298-
pack('L', 102),
299-
pack('L', 103),
300-
pack('L', 104),
308+
$binaryValues[0],
309+
$binaryValues[1],
310+
$binaryValues[2],
311+
$binaryValues[3],
312+
$binaryValues[4],
301313
],
302314
],
303315
[ArrayParameterType::BINARY],
@@ -311,11 +323,11 @@ public function testNativeArrayListSupport(): void
311323
'SELECT test_binary FROM binary_fetch_table WHERE test_binary IN (?)',
312324
[
313325
[
314-
pack('L', 100),
315-
pack('L', 101),
316-
pack('L', 102),
317-
pack('L', 103),
318-
pack('L', 104),
326+
$binaryValues[0],
327+
$binaryValues[1],
328+
$binaryValues[2],
329+
$binaryValues[3],
330+
$binaryValues[4],
319331
],
320332
],
321333
[ArrayParameterType::BINARY],
@@ -332,11 +344,11 @@ public function testNativeArrayListSupport(): void
332344
);
333345

334346
self::assertEquals([
335-
pack('L', 100),
336-
pack('L', 101),
337-
pack('L', 102),
338-
pack('L', 103),
339-
pack('L', 104),
347+
$binaryValues[0],
348+
$binaryValues[1],
349+
$binaryValues[2],
350+
$binaryValues[3],
351+
$binaryValues[4],
340352
], $data);
341353
}
342354
}

0 commit comments

Comments
 (0)