Re: [cx-oracle-users] Freeing Temporary BLOBs
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2007-02-01 23:47:47
|
I managed to track this down to the fact that I was assuming that only cx_Oracle itself was creating temporary lobs. I now check OCILobIsTemporary() to determine if a LOB is temporary prior to freeing it and call OCILobFreeTemporary() as needed. This will be in the next release. If you need it sooner let me know privately and I can send you a diff or a new binary for a particular platform. On 2/1/07, Henning von Bargen <H.v...@t-...> wrote: > Hello LOB experts, > > how can I free temporary LOBs before the session ends? > > I have a stored function that returns a temporary LOB. > I can successfully get the content from Python, > but when I am not able to free the memory (on the DB server) > before the session ends. > > Here is an example: > > SQL: > > create or replace function test_blob (pi_size in binary_integer) > return blob > is > v_blob blob; > begin > dbms_lob.createtemporary (v_blob, true, DBMS_LOB.SESSION); > dbms_lob.write (v_blob, 1, 1, utl_raw.cast_to_raw(rpad('AB', pi_size, > 'X'))); > return v_blob; > end test_blob; > / > > --------------------- > > Python > > import cx_Oracle > import sys > > import logging > logging.basicConfig(level=logging.INFO, > format='%(asctime)s %(levelname)s %(message)s' > ) > log = logging.getLogger() > > conn = cx_Oracle.connect ("someuser/password@ORCL") > log.info ("connected") > > curs = conn.cursor() > blob = curs.callfunc ("test_blob", cx_Oracle.BLOB, (200,)) > log.info ("FNC returned") > content = blob.read() > log.info ("BLOB data read") > log.info ("data: %r", content) > > curs.execute ("select * from v$temporary_lobs"); > rset = curs.fetchall() > log.info ("v$temporary_lobs=\n%r", rset) > > # THIS DOES NOT WORK, raises cx_Oracle.NotSupportedError: > #curs.setinputsizes(blob=cx_Oracle.BLOB) # does not help > #curs.execute ("begin DBMS_LOB.FREETEMPORARY (:blob); end;", blob=blob) > > del blob > > curs.execute ("select * from v$temporary_lobs"); > rset = curs.fetchall() > log.info ("v$temporary_lobs=\n%r", rset) > > curs.close() > conn.close() > > You can see that even after deleting the blob on the python side, > v$temporary_lobs still shows one LOB. > > I think OCILobFreeTemporary would be the right function here, > but it seems not to be exposed to the python module. > > How to workaround this? > > Henning > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |