[Zope] Help with DCOracle2 and CLOB data reads

David Thibault dthibault@esperion.com
Wed, 29 Jan 2003 09:51:45 -0500


Hello all,

I have a database with a CLOB data column that I'm trying to read data from.
I am using DCOracle2, and the howto found here:
http://www.zope.org/Members/peterb/oracle_lobs

Also, I have found the DCOracle2 Users' guide here:
http://iteso.mx/~jose/DCOracle2.pdf

Neither of these are helping me, though.  I downloaded the example zexp file
from the first link above.  After customizing the column names for my
database, I get a page that shows the following information:
CORPORATE_ID	MOLFORMULA (the clob field)
'CID-0000926'  	None

I can't figure out why the blob isn't showing up. I edited the example
scripts again to include a LOBLENGTH field in the HTML results, and I get
something similar to this:
CORPORATE_ID	LOBLENGTH	MOLFORMULA
'CID-0000926'  	10		None

Therefore, I AM getting some data in the loblocator.  I just can't figure
out how to get it to text.  I even tried the following:
for row in container.sql_select_blob(corporate_id=id):
  lob = row['molformula'] #I also tried numerical row indexes 
				  #here (row[1]) but that didn't help either
  length = lob.length()
  formula = lob.read(length)
  formula2 = str(formula)  #THIS I ADDED TO TRY TO FORCE IT TO A STRING,
				   # ALSO I TRIED repr() BUT IT DIDN'T HELP
EITHER
  result.append({'corporate_id': row['corporate_id'], 'length':
length,'molformula': formula2})

I added the comments to the code above (I know it breaks the indent
rules...it wasn't there when I ran the code).  If I query the table via
SQLPlus to see if any of the clob fields are null (select ID from test where
clob is null) I get 2 IDs (out of 811 records).  Therefore, I have made sure
I'm not querying those clobs for the time being.  Any help here would be
greatly appreciated.

Thanks,
Dave