mirror of
https://github.com/php/pecl-database-ibm_db2.git
synced 2026-03-24 07:12:22 +01:00
Mostly involved finding resources relative to the script directory instead of from the current directory, which make test sets as the source directory. Instead of writing a file and then reading it back in to compare, just build up a string in memory and compare them. Connecting to a missing db alias returns an empty SQLSTATE. I'm not sure if/when that changed, but I've adjusted the code to handle either case. Finally, escape.dat was missing a \r in the file.
30 lines
647 B
PHP
30 lines
647 B
PHP
--TEST--
|
|
IBM-DB2: db2_fetch_array() - fetch one row of binary data
|
|
--SKIPIF--
|
|
<?php require_once('skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require_once('connection.inc');
|
|
|
|
$conn = db2_connect($db,$username,$password);
|
|
|
|
$in_file = "spook.png";
|
|
$in = file_get_contents(dirname(__FILE__)."/".$in_file);
|
|
|
|
$result = db2_exec($conn, "SELECT picture, LENGTH(picture) FROM animal_pics WHERE name = 'Spook'");
|
|
$row = db2_fetch_array($result);
|
|
$out = "";
|
|
if ($row) {
|
|
$out .= $row[0];
|
|
}
|
|
|
|
if(strcmp($in, $out) == 0) {
|
|
echo "The files are the same...good.";
|
|
} else {
|
|
echo "The files are not the same...bad.";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
The files are the same...good.
|