Page 1 of 1

TOraQuery->GetObject ("ObjectName") fails with Invalid Attribute Name Exception

Posted: Thu 19 Mar 2015 16:11
by Morelli
Hi Folks,

we have migrated our Project from XE to XE6 C++ Builder and updated to the ODAC Version 9.4.12.

Since this migration (without any code-changes) we get the Problem that the following code throws sometimes a "Invalid Attribute Name"-Exception:

Code: Select all

TOraObject* sdoGeometry = TOraQuery->GetObject ("SHAPE");
MSdoGeomType sdoGtype = sdoGeometry->AttrAsInteger["SDO_GTYPE"]; //Exception here
Randomly this code throws or works! Some times it works, and some times not!
The Problem seems to be the first LOC, due the TOraObject is not correctly getted!

The TOraQuery is properly initialized and ObjectView = true.

Is there a known issue concerning this Problem - is there a Workaround?
Or are there newer techniques to get an Object from a TOraQuery?

Thanks for your help!

Re: TOraQuery->GetObject ("ObjectName") fails with Invalid Attribute Name Exception

Posted: Fri 20 Mar 2015 09:13
by AlexP
Hello,

Please send a complete sample reproducing the problem, since simple retrieving of the object attribute doesn't reproduce the described situation.

Re: TOraQuery->GetObject ("ObjectName") fails with Invalid Attribute Name Exception

Posted: Mon 23 Mar 2015 14:12
by Morelli
Is there a known issue concerning this Problem - is there a Workaround?
Or are there newer techniques to get an Object from a TOraQuery?

Thanks for your help!

Re: TOraQuery->GetObject ("ObjectName") fails with Invalid Attribute Name Exception

Posted: Tue 24 Mar 2015 06:25
by AlexP
For access to an attribute by name, you can use the following code:

Code: Select all

  ShowMessage(IntToStr(OraQuery1->GetObject(L"SHAPE")->AttrAsInteger[L"SDO_GTYPE"]));
  ShowMessage(IntToStr(OraQuery1->FieldByName(L"SHAPE.SDO_GTYPE")->AsInteger));