cvs: pecl /ibm_db2/tests test_1551.phpt test_163.phpt
| From: | Kellen Bombardier | Date: | Wed, 05 Sep 2007 20:20:11 +0000 |
| Subject: | cvs: pecl /ibm_db2/tests test_1551.phpt test_163.phpt | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-8513@lists.php.net to get a copy of this message | ||
kfbombar Wed Sep 5 20:20:11 2007 UTC
Added files:
/pecl/ibm_db2/tests test_163.phpt test_1551.phpt
Log:
Adding tests to further check the fetching of binary data
http://cvs.php.net/viewvc.cgi/pecl/ibm_db2/tests/test_163.phpt?view=markup&rev=1.1
Index: pecl/ibm_db2/tests/test_163.phpt
+++ pecl/ibm_db2/tests/test_163.phpt
--TEST--
IBM-DB2: db2_fetch_both() - fetch binary data and iterate over result set
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$username,$password);
$orig = fopen("pic1.jpg", "rb");
$new = fopen("pic1_out.jpg", "wb");
$result = db2_exec($conn, "select photo_format, picture, length(picture) from emp_photo where
photo_format='jpg' and empno='000130'");
$row = db2_fetch_both($result);
if ($row) {
fwrite($new, $row['PICTURE']);
}
$file0 = file_get_contents("pic1.jpg");
$file1 = file_get_contents("pic1_out.jpg");
if(strcmp($file0, $file1) == 0) {
echo "The files are the same...good.";
} else {
echo "The files are not the same...bad.";
}
$result = db2_exec($conn, "select photo_format, picture, length(picture) from emp_photo");
$count = 0;
while ($row = db2_fetch_both($result)) {
$count++;
}
echo "\nIterated over $count rows.";
--EXPECT--
The files are the same...good.
Iterated over 8 rows.
http://cvs.php.net/viewvc.cgi/pecl/ibm_db2/tests/test_1551.phpt?view=markup&rev=1.1
Index: pecl/ibm_db2/tests/test_1551.phpt
+++ pecl/ibm_db2/tests/test_1551.phpt
--TEST--
IBM-DB2: db2_fetch_assoc() - fetch binary data and iterate over result set
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once('connection.inc');
$conn = db2_connect($db,$username,$password);
$orig = fopen("pic1.jpg", "rb");
$new = fopen("pic1_out.jpg", "wb");
$result = db2_exec($conn, "select photo_format, picture, length(picture) from emp_photo where
photo_format='jpg' and empno='000130'");
$row = db2_fetch_assoc($result);
if ($row) {
fwrite($new, $row['PICTURE']);
}
$file0 = file_get_contents("pic1.jpg");
$file1 = file_get_contents("pic1_out.jpg");
if(strcmp($file0, $file1) == 0) {
echo "The files are the same...good.";
} else {
echo "The files are not the same...bad.";
}
$result = db2_exec($conn, "select photo_format, picture, length(picture) from emp_photo");
$count = 0;
while ($row = db2_fetch_assoc($result)) {
$count++;
}
echo "\nIterated over $count rows.";
--EXPECT--
The files are the same...good.
Iterated over 8 rows.