Print Thread
More null LOB collection element woes
#1192 10/31/00 06:59 AM
Joined: Aug 2000
Posts: 21
Melbourne,VIC,Australia
S
Sonique Offline OP
Member
OP Offline
Member
S
Joined: Aug 2000
Posts: 21
Melbourne,VIC,Australia
Hi,

I've been tracking down my AV's with respect to null LOB's within collections, and have narrowed it down to a problem with The deep copy of the collection itself. If any methods of the LOBLocator for the null LOB element (such as IsNull) have been called, then AV's in the OCI dll's (orageneric8.dll) are raised when the TOracleObject is released.

Create a collection and table as follows:

create type clob_tab_t as table of CLOB;
create table clob_tab (id integer, clobs clob_tab_t)
nested table clobs store as clobs_store;

Now azdd one row to the table containing a null and an empty lob element:

insert into clob_tab values(1,clob_tab_t(null,empty_clob()));

The following code will cause an AV on Obj2.Free:

procedure TForm1.Button2Click(Sender: TObject);
var
Obj,Obj2: TOracleObject;
begin
OracleQuery1.Close;
OracleQuery1.SQL.Text := 'select clobs from clob_tab';

OracleQuery1.Execute;
if not OracleQuery1.Eof then
begin
Obj := OracleQuery1.ObjField(0);
Obj2 := TOracleObject.Create(OracleSession1,Obj.ObjType,'');
Obj2.Assign(Obj);
if Obj2.LOBElements[0].IsNull then
Memo1.Clear; // just do something so the above doesn't compile out

OracleQuery1.Next;
end;
Obj2.Free;

OracleQuery1.Close;
end;

If the code is changed to access LOBElements[1] (empty) rather than LOBElements[0] (null), then there are no AV's.

How do I work around this? I need to call Assign so that I can access the non-null elements, but if I try to test if an element is null oci AV's! I know I can test the original element returned from the object without problem - can I call SetLOBElement after the Assign? Is there some other way perhaps?

Regards

Paul

Re: More null LOB collection element woes
#1193 11/13/00 10:48 PM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
It turns out that OCI8 does not really like to assign NULL LOB's. To work around this problem, we now check if a source LOB is NULL before assigning it to the destination LOB. If it is NULL, the destination LOB is cleared instead. I will send you the source file modifications by e-mail.

------------------
Marco Kalter
Allround Automations


Marco Kalter
Allround Automations
Re: More null LOB collection element woes
#1194 11/14/00 01:57 AM
Joined: Aug 2000
Posts: 21
Melbourne,VIC,Australia
S
Sonique Offline OP
Member
OP Offline
Member
S
Joined: Aug 2000
Posts: 21
Melbourne,VIC,Australia
Hi Marco,

I actually worked around the problem myself in the application code - after calling Assign for an Object, I check to see if the object is a collection of lob's. If so, I iterate the *original* collection, replacing any null lobs in the copy with a new LOB Locator

Paul


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.044s Queries: 13 (0.019s) Memory: 2.5076 MB (Peak: 3.0427 MB) Data Comp: Off Server Time: 2024-05-17 12:00:42 UTC
Valid HTML 5 and Valid CSS