Subject RE: [IBO] FieldByName()
Author Jason Wharton
Adrian,

> Could you please spare the time to explain, how I would now
> access a field in the query.
>
> Eg IB_Query1.FieldByName('Example').AsString;
>
> Now ? IB_Query1.Example.AsString ??

Nothing on the outside has changed. You still use FieldByName() as you
would always do before.

What I'm talking about is the internal operations of IBO. I used to have
loops for various things using FieldByName() in them such that every time a
certain event took place this code was being executed. Now, in the place of
them I have field maps that are internally maintained to store the param and
field pointers for MasterLinks, MasterParamLinks and KeyLinks.

So, in a loop with MasterLinks it looks like this:

for ii := 0 to MasterLinks.Count - 1 do
begin
tmpCol := TIB_Column( FMasterLinksFieldMap[ii] );


instead of

for ii := 0 to MasterLinks.Count - 1 do
begin
tmpCol := MasterDataset.FieldByName( MasterLinks.IndexValues[ii] );


This makes the execution of things instant rather than scanning lots of
fields.


I particularly noticed IBO getting a little more sluggish with queries that
had a lot of columns in them. There's no need for anything to be sluggish
anywhere for internal operation so I am focusing in on those parts and
optimizing them. I want snappy interfaces even on slower PC's.


Regards,
Jason Wharton