|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-08-17 13:17 UTC] php at jschreiber dot com
Description:
------------
I have a problem concerning BLOB fields and DB/2 V8.1.2.
When I try to store a file with odbc_prepare() and
odbc_execute($stmt, $params) no error code is returned, but the
BLOB contains an empty value ("x''", not a NULL value).
I had this bug since I upgraded from DB/2 7.1 to DB/2 8.1 (and
DB/2 8.1.2 as well).
It's not a programming error--all script were working with DB/2
7.1. It even occurs with the odbc-test included in tests/ directory
of the php source distribution.
I tried all tricks mentioned at
http://www7b.software.ibm.com/dmdd/library/techarticle/0301liu/0301liu.html
but without success.
Reproduce code:
---------------
odbc-t5.php from the tests/ directory of the php source distribution.
Expected result:
----------------
Actual result:
--------------
This is the output:
--- snip ---
ODBC Test 5 - Blobs
Connecting to test as db2inst1 - OK
Dropping table "php_test" - OK
Creating table "php_test": - OK
Table Info:
Name Type Length
ID CHAR 32
GIF BLOB 100000
Inserting data: /tmp/phpnyprAM - - - OK
--- snap ---
It looks like everythings works fine, but the the database contains
just "image1" and "x''".
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 05:00:01 2025 UTC |
I looked at my last trace one more time and saw that SQLBindParameter( hStmt=1:1, iPar=1, fParamType=SQL_PARAM_INPUT, fCType=SQL_C_CHAR, fSQLType=SQL_BLOB, cbColDef=1048576, ibScale=0, rgbValue=&0000000a, cbValueM ax=0, pcbValue=&0820563c ) ---> Time elapsed - +6.810000E-004 seconds is being called with fCType=SQL_C_CHAR instead of SQL_BINARY. So I applied a part of Clara Lius patch to the code and changed the line containg SQL_LEN_DATA_AT_EXEC as described in my last comment. Now my "blobtest" script runs fine!! But the problem seems not to be totally solved - the odbc-test that comes with php seems to "hang" on some statements--sometimes it works, sometimes not... Anyway, I think that was a step in the right direction, so here is my patch: http://www.jschreiber.com/php/blobtest/blob-patch.txt Jan