ID: 25118
User updated by: php at jschreiber dot com
Reported By: php at jschreiber dot com
Status: Open
Bug Type: ODBC related
Operating System: GNU/Linux (Gentoo)
PHP Version: 4.3.2
New Comment:
Hi! I still have the problem, that I can't store BLOBs in
my database. Now, I tried it with the "old' PHP 4.3.2 on a
Solaris machine with IBM DB/2 V8.1 Fixpack 3 installed,
but that didn't work either.
So I started to investigate /ext/odbc/php_odbc.c. The
problem seems to be located in the odbc_execute function.
All my investigations were done with the 4.3.2-version of
that file (or better: v 1.143.2.9 2003/05/02), but I saw,
that there was no major difference to today's cvs version
(at least not in the odbc_execute function).
One of the problems was, that the while loop that calls
SQLPutData was never called, since
SQLExecute(result->stmt) returned SQL_SUCCESS and not
SQL_NEED_DATA as expected. Okay, why is this so?
After the file that shall be put in the BLOB field was
opened some lines above (still in odbc_execute), you call
params[i-1].vallen = SQL_LEN_DATA_AT_EXEC(0);
According to the DB/2 CLI documentation,
SQL_LEN_DATA_AT_EXEC is only needed for bulk inserts and
requires an update or insert via SQLBulkOperations().
So I changed this line to
params[i-1].vallen = SQL_DATA_AT_EXEC;
And--voila--the SQLExecute returned SQL_NEED_DATA and the
loop was executed. But there still is a problem, which I
could not fix: SQLPutData now returns
[IBM][CLI Driver] CLI0112E Error in assignment.
SQLSTATE=22005
May this has something to do with the stuff that Clara
tried to fix with her patch. Do you have any ideas?
I put the trace to
http://www.jschreiber.com/php/blobtest/db2trace3.txt
Jan
Previous Comments:
------------------------------------------------------------------------
[2003-08-28 05:02:05] php at jschreiber dot com
Sorry, guys...! It still doesn't work. I tried it with my "blobtest"
(http://www.jschreiber.com/php/blobtest/). the insert statement
gets executed, but the blob only contains an empty value (x'').
I uploaded a new db2 trace to
http://www.jschreiber.com/php/blobtest/db2trace_new.txt
I hope that helps you!! Again, thank you for trying to fix that. Jan
------------------------------------------------------------------------
[2003-08-28 04:55:49] sniper@php.net
Typo fixed. Thanks. :)
But does this version fix your original problem..?
------------------------------------------------------------------------
[2003-08-28 03:42:01] php at jschreiber dot com
I downloaded php5 directly from cvs (using the gentoo php-cvs
portage), and there seems to be a typo in
php5/ext/odbc/php_odbc.c, line 1433:
433c1433
< sql_c-type = SQL_C_BINARY;
---
> sql_c_type = SQL_C_BINARY;
------------------------------------------------------------------------
[2003-08-28 03:16:16] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2003-08-27 17:53:56] kalowsky@php.net
Try a snapshot of PHP 5
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/25118
--
Edit this bug report at http://bugs.php.net/?id=25118&edit=1