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

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Morelli
Posts: 15
Joined: Thu 19 Mar 2015 15:45

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

Post by Morelli » Thu 19 Mar 2015 16:11

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!

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

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

Post by AlexP » Fri 20 Mar 2015 09:13

Hello,

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

Morelli
Posts: 15
Joined: Thu 19 Mar 2015 15:45

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

Post by Morelli » Mon 23 Mar 2015 14:12

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!

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

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

Post by AlexP » Tue 24 Mar 2015 06:25

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));

Post Reply