Subject | RE: [IBO] Problem with GetByName |
---|---|
Author | Jason Wharton |
Post date | 2017-11-15T17:28:11Z |
You should use the FindField() method in order to just get a
result without an exception with NIL being the result of a column not
found.
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]
Sent: Tuesday, September 05, 2017 2:16 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] Problem with GetByName
Now I discovered a new problem in IBO5.9 that did not come up in 4,8.
When I want to check if a column does exist in a TIB_Query, i used to call:
if assigned (IB_Query.fieldbyname (fieldname)) then
.......
Now in v5.9 that raises an exception.
I expect it to just return nil.
I digged into the code using the debugger and found in the method TIB_Row.GetByName in IB_Components that there is a difference to the same method IBO4.8 that causes that problem.
Close to the end of the method there is now
if ( not Result ) and ( AFieldName <> '' ) and
( UseSQLNameUnqualifiedInByNameLookup ) then
what was
if ( not Result ) and ( AFieldName <> '' ) then
in v4.8.
So I had to set UseSQLNameUnqualifiedInByNameLookup to true in the initialization part of one of
my units to get it to work again. As this is the only point in the IBO5.9 source
where this variable is used, I think it will not do any harm, but would be great
if someone can tell me, if it is critical and I would really be interested in
knowing way that was introduced in IBO 5.
Best Regards
Helmut