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:

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


Previous Comments:
------------------------------------------------------------------------

[2003-09-08 08:56:51] php at jschreiber dot com

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

------------------------------------------------------------------------

[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] [EMAIL PROTECTED]

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] [EMAIL PROTECTED]

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



------------------------------------------------------------------------

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

Reply via email to