ID: 27083 User updated by: ceco at noxis dot net Reported By: ceco at noxis dot net -Status: Feedback +Status: Open Bug Type: OCI8 related Operating System: windows 2000 server PHP Version: 4.3.4 New Comment:
in examle 2 on http://www.php.net/manual/en/function.ocinewdescriptor.php it is used exactly like that, only it is clob I cannot use php 5, I made workaround converting blob to hex, sending it as clob and then reconverting it to binary ;-)) a little strange and cpu intensive but works and since it is not very often used I'll have to leave it that way Previous Comments: ------------------------------------------------------------------------ [2004-01-29 09:21:23] [EMAIL PROTECTED] Don't use writeTemporary, it's not intended for writing persistent LOB's. You should use save() or you can upgrade to PHP5 and use $lob->write() method. ------------------------------------------------------------------------ [2004-01-29 06:29:33] ceco at noxis dot net Description: ------------ first of all I should say that it may be documentation problem, because didn't find good documentation of the LOB object i have a oracle procedure, which accepts BLOB (see the code below) it inputs the data in the blob but when i extract (with the oracle tools or with other php script) it is corrupted it is exactly 2 times larger when everything is changed to clob (of course the data is text not jpg), this function work ok also it is workig for me if I use insert into (the_blob) values (empty_blob()) returning the_blob into :the_blob and then bind $lob and use $lob->save but i don't want to have this I think $lob->WriteTemporary mangles the data somehow and corrupts it Reproduce code: --------------- include_once 'config/environment.inc.php'; $fd = fopen('Sample.jpg', 'r'); $data = fread($fd, filesize('Sample.jpg')); fclose($fd); $conn = ocilogon($CFG_DB['username'], $CFG_DB['password'], $CFG_DB['db']); $lob = OCINewDescriptor($conn, OCI_D_LOB); $stmt = OCIParse($conn,"begin TEST_PROC(:the_blob); end;"); OCIBindByName($stmt, ':the_blob', &$lob, -1, OCI_B_BLOB); $lob->WriteTemporary($data); OCIExecute($stmt, OCI_DEFAULT); $lob->close(); $lob->free(); OCICommit($conn); create procedure TEST_PROC(the_blob blob) is begin insert into test_table values (the_blob); end; create table test_table (the_blob blob); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27083&edit=1