Subject Re: large data compare app - TIBOQuery or other component choice?
Author rogervellacott
This suggestion is nothing to do with IBO, and would work on IBX or
TDataset also. It simply eliminates the potentially slow
FieldByName calls.

Before running, do the following

for i := 0 to Q1.FieldCount-1 do
Q1.Fields[i].Tag := Q2.FieldList.IndexOf(Q1.Fields[i].FieldName);

and then your compare looks like this
for i := 0 to Q1.FieldCount-1 do
with Q1.Fields[i] do
if Value <> Q2.Fields[Tag].Value then

If you are already using the TField Tag properties for something
else, then create an array of integers to hold the Q2 field numbers.

Roger Vellacott
Passfield Data Systems Ltd

--- In, nick irons <nick@...> wrote:
> Hi,
> I'm a newbie to IBO (have used IBX 5ish years) and would like help
pointing me
> to the most efficient component for a large compare task to be run
> I'm trying to find differences between two databases, and have
approximately 1.7
> million records of interest spread between 12 tables.
> I am using two TIBOQuerys, pointing the first (unidirectional) to
the whole of
> the data of interest per table, then dynamically building a select
in the second
> per row. For each row I then compare every field until I find a
difference or
> have compared all fields. Upon finding a difference, some other
code handles
> the data change. My compare code as follows:
> (qResyncSourceData.Fields[j].Value <>
> qResyncCompareData.FieldByName(qResyncSourceData.Fields
> If anyone can point me to a faster way to do this I'd be very
> currently yields about 200,000 rows per hour on a 1.6mhz laptop.
> Thanks in advance,
> Nick