TOracleObject.Assign and Collections

Sonique

Member²
A puzzling problem with Collections. I can quite happily create a new TOracleObject then copy an existing one using the Assign method. If I do the same for a collection type, it seems that the element data does not get copied. ie:

Obj1 := Query1.ObjField(0);
Obj2 := TOracleObject.Create(Session,'my_type','');
Obj2.Assign(Obj1);
// Obj1.ElementCount returns 3
// Obj2.ElementCount returns 2

Is this an Oracle problem (tested against 8.1.6) or is it a DOA problem? There's nothing obvious in the OCI documentation to indicate that anything more than OCIObjectCopy is required ....

Thanks,

Paul
 
This indeed doesn't seem to work as expected. No errors or warnings are returned, so it does seem like a Net8 restriction or bug. I can't find any reference to limitations for collection objects though.

------------------
Marco Kalter
Allround Automations
 
Having resolved this apparent OCI bug (by way of manually copying all collection elements after calling TOracleObject.Assign), I've run into a stumbling block. If I have a table collection with an element type of BFile, I can not copy the element if it is not null (SetElement will not write BFILE elements of course).

This is not an urgent issue, and I know SetElement should not be changed to allow BFILE's to be written in to an element, but it does increase the urgency of resolving the original problem.

My initial suggestion (unless the reason for the failure of OCIObjectcopy can be determined) would be to modify the Assign method so that it copies the elements for collections. BFILE elements could then also be copied, and SetElement can stay how it is ...
 
Back
Top