[Zope-DB] ZOracleDA and CLOBs

Brian Brinegar brinegar@pier.ecn.purdue.edu
Tue, 13 May 2003 16:52:24 -0500

I am using DCOracle2. I read this in the ZOracleDA readme. If I query a 
table containing CLOBs using the test tab of an Oracle Connection I get 
a error saying "__str__ returned non-string (type None)".  I have 
inserted data into the CLOBs from Zope and I can read it out from sqlplus.

If I create a ZSQL Method that queries the table containing CLOBs and 
use the test tab of that ZSQL method I get the same, "__str__ returned 
non-string (type None)" error. If I change the maximum rows to one I get 
back the results with "<LobLocator object at 0x14f05a98>" in place of 
the LOB value.


Matthew T. Kromer wrote:

> Brian Brinegar wrote:
>> I am having trouble getting the data for a CLOB out of Oracle within 
>> Zope. I started with a ZSQL Method which queries my table containing 
>> CLOBs. I'm not sure what type of object I got back for the CLOB 
>> column. When I try to display it I get an error saying "__str__ 
>> returned non-string (type None)" if I call read() on the result it 
>> returns None.
>> So after poking around a bit I found in the ZOracleDA README file 
>> that LOBs will only work if the "Maximum rows to retrieve" is set to 
>> 1. After making that change the result is "<LobLocator object at 
>> 0x144adf20>" now I'm not sure if this is a ZOracleDA LobLocator or a 
>> DCOracle2 LobLocator object. If I try to call the read() method on 
>> this object I get an Unauthorized Error.
>> I did notice that the LobLocator object in ZOracleDA has a lob 
>> attribute, if I try to access lob on my result I get an Attribute 
>> Error. The LobLocator object in ZOracleDA also has the 
>> __allow_access_to_unprotected_subobjects__ attribute set. So I think 
>> I'm getting back the wrong LobLocator object.
>> Any suggestions?
>> I will play around when I get a chance to see if the _lobConvert 
>> method is functioning correctly.
>> Thank you,
>> Brian Brinegar
>> ECN Web System Developer
>> Purdue University
>> West Lafayette, IN 
> Make sure you're using post 1.2 source or binaries.  The binary build 
> of 1.2 has a stupid LOB bug which makes the code think all LOB objects 
> are temporary objects (ie it never clears the temporary flag) and so 
> you'll never be able to read any real data from them.
> LOB objects at the DA level have implicit reads; ergo if I go into the 
> TEST tab of the database connection and try to query a LOB column, 
> I'll get the actual LOB value back, not the LOB locator back.
> If you use a method or a script to look at the results, you really do 
> get a LOB locator back -- but its str() method does a read of the LOB.
> I dont think the README is correct either -- the restriction of 1 row 
> results is for LONG columns not LOB columns.    BUT, I cant find 
> anything in the README that mentions this anyway, so I'm wondering if 
> you're using DCOracle not DCOracle2?