ZF-6473: Can not insert data in Oracle BLOB column
Description
I have oracle 10g as backend database. We need to store user uploaded files in a table with BLOB column. I attempted to do so by passing form variable and then with using php global $_FILES array. Both cases oracle throws error identifying passed value as string. I did not see any documentation if Zend supports Oracle BLOB datatype management. We are using zend core 2.5.0. Is this functionality supported?
Comments
Posted by Roger Hunwicks (rhunwicks) on 2009-07-01T10:49:03.000+0000
We started using ZF at version 1.5 or so, and at that time it didn't seem to support BLOBs - I haven't looked recently to see if this has changed.
We have a My_Db_Adapter_Oracle which overrides Zend_Db_Adapter_Oracle and overrides the insert() function as follows (there is some extra stuff to track whether a transaction is already open):
It shouldn't be too hard for you to take this approach with your application.
It should also be possible to add this code into Zend_Db_Adapter_Oracle if any of the maintainers are interested.
I would be happy to help with it if one of the maintainers can tell me what needs to be done.
Posted by Gabriel Baez (gabrielbaez) on 2009-08-05T10:36:26.000+0000
We use zend framework at work with a Oracle Database this feature would definitely make things easier to deal with BLOBs.
Posted by Guilherme Pereira (gpsa) on 2009-09-04T07:50:50.000+0000
I would like to give my contribution. Advantage the insert function, I changed it to recognize the situation where hava SCHEMA and TABLE in $table var, and we can use this idea to the update option: \ \
Posted by Benjamin Eberlei (beberlei) on 2009-10-02T05:06:34.000+0000
I don't like the solution using describeTable(), this seems like a serious performance hit for users that don't realize that insert() and update() need this function and therefore a cache should be wrapped around it.
Since you retrieve a OCI-LOB instance anways from a select on a BLOB or CLOB field, wouldn'it be much more easy just to allow this methods to handle instances of that type correctly?
For example:
Posted by Benjamin Eberlei (beberlei) on 2009-10-02T05:08:04.000+0000
I just realized my solution isnt enough, the information about CLOB or BLOB is missing for the insert function, forget it :-)
Posted by Gabriel Baez (gabrielbaez) on 2010-01-25T11:14:04.000+0000
Any updates on this issue?
Posted by Cristiano G Carvalho (kikolino) on 2011-12-27T17:56:39.000+0000
A litle solution for Zend models. See.
Model Cars
class Custom_Row_Cars extends Zend_Db_Table_Row_Abstract {
}
class Application_Model_DbTable_Cars extends Zend_Db_Table_Abstract {
}
CLOB field are resource. In case are read with function stream_get_contents