Bug #80868 [Opn->Fbk]: Missing bytes with DB2 column type LOB
| From: | cmb@php.net | Date: | Mon, 15 Mar 2021 12:52:38 +0000 |
| Subject: | Bug #80868 [Opn->Fbk]: Missing bytes with DB2 column type LOB | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232728@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80868&edit=1
ID: 80868
Updated by: cmb@php.net
Reported by: rick dot meertens at gmail dot com
Summary: Missing bytes with DB2 column type LOB
-Status: Open
+Status: Feedback
Type: Bug
Package: PDO ODBC
Operating System: Windows
PHP Version: 7.3.27
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
That may have the same root cause as bug #80783. Could you please
make an ODBC trace of the script available somewhere (posting as
comment to the bug tracker as a last resort)? And could you also
try with PR 6716[1] which is supposed to fix this issue?
[1] <https://github.com/php/php-src/pull/6716>
Previous Comments:
------------------------------------------------------------------------
[2021-03-15 12:34:37] rick dot meertens at gmail dot com
Description:
------------
While reading a BLOB(1MB) field from an AS400 DB2 database with the PDO ODBC - IBM i Access ODBC
driver we are missing 7 hex chars every 255th position in the stream.
I am using PHP 7.3.27 with the underlying IBMiAccess_v1r1_WindowsAP_English v1.1.8.6 ODBC driver.
-Install the IBM iAccess ODBC driver.
-Enable PHP extension pdo_odbc.
-Create a column with type blob and length 1048576;
-Fill a blob field with:
for($i = 0; $i<50; $i++)
{
$blobData=$blobData."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
}
-Read it with script below.
Test script:
---------------
//credentials
$db_host = '';
$db_user = '';
$db_pass = '';
$table = '';
$blob_field = '';
$id_field = '';
$id = '';
$connection = new PDO("odbc:Driver={iSeries Access ODBC
Driver};System=$db_host;UID=$db_user;PWD=$db_pass;");
$sql = "SELECT $blob_field FROM $table WHERE $id_field = ?";
$stmt = $connection->prepare($sql);
if(!$stmt) {throw new Exception("Error while executing prepare: $sql
[".$connection->errorInfo()."]");}
if(!$stmt->execute(array($id))) { throw new Exception("Error while executing query()
execute: $sql [".$connection->errorInfo()."]");}
$stmt->bindColumn(1, $lob, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);
echo $lob;
//hexToAscii($lob)
Expected result:
----------------
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A666C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
61626364 etcetera
Actual result:
--------------
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636
68696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A66
F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F70717
767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
61626364 etcetera
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80868&edit=1