[Zope-DB] Problem selecting Oracle LOB's

Jorge O. Martinez jmartinez@emediamillworks.com
Tue, 19 Mar 2002 10:11:34 -0500

(I am resubmitting this question because I had initially sent it with 
the wrong subject, and figured people would think it's the same subject. 
Sorry about that).


I have been able to install Zope, DCOracle2, and was able to make a 
connection to the DB, and execute simple queries displaying results just 

However, I have not been able to get LOB's to work. I am following the 
examples from Peterb in:


I am trying to do a select blob, and I get the template to display the 
id (which is the argument I pass), but don't get anything for the 
knowledge_text (the LOB, which is only text), this is what I am getting:


SQL used:
   knowledge_id, knowledge_text
knowledge_id = 44

I know it must be my error because I think I am not calling the "select" 
Python script correctly; I've tried several different ways, and get all 
kinds of errors. Anybody outthere knows what is the correct way to call 
it from the Z SQL Method? This is what I have in my Z SQL Method:


   knowledge_id, knowledge_text
<dtml-sqlgroup where>
   <dtml-sqltest knowledge_id op=eq type=int optional>

<dtml-in select>
<dtml-var sequence-item>

** I am including 1 of the ways how I tried to call the 'select' script 
but it does not work**


And this is the code in the select Python script (same from the sample 
code). I've tried many different ways, this is just the latest:

# Manually iterate over whole result set, copy into list of dicts just
# like dictionaries()
# except we also read all BLOBs in their entirety and put in the value, 
# not the LobLocator

result = []
for row in container.sql_select_blob(id=id):
   lob = row['blob']
   result.append({'id': row['id'], 'blob': lob.read()})
return result

** Note, I've tried this way, and also replacing the 'id=id' for 
'id=knowledge_id', but it did not work, also I replaced the 'blob' for 
'knowledge_text' (my blob), but it doesn't like it **

I am new to Python and Zope, hence this basic question. I am sure it 
must be something simple, so thanks for your patience,


Jorge M.

Jorge O. Martinez
MIS Senior Associate
1100 Mercantile Lane, Suite 119
Largo, MD 20774
E-mail  => jmartinez@eMediaMillWorks.com
Phone   => (301)883-2482 ext. 105
Fax     => (301)883-9754