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