Subject Re: Fwd: Re: [IBO] defective datapump program
Author Duilio Foschi
>you need to go back and review exactly what you are trying to do

we are getting phylosofic ... :)

>Are you really trying to use a TDatabase with IBO components?

sorry: I gave you an incorrect information.

The DBF table is opened via a plain vanilla TTable object.

>Your datapump program really has to do this:

please, let me write the application my way (Sinatra's voice in the
background) ... :)

If you follow me, the application does have some logic.

It works ok, until the first rollback is done.

It does not need to be a real general-purpose datapump application, I just
want it to transfer current data from DBF tables and FB tables.

I don't need to spend much time in controlling field types, etc. because I
created the FB tables with the right field types.

It is a poor-man datapump program and it works this way:

1. connect a TDatabase to the GDB file
2. open a TTable -say SrcTab - with the correct DatabaseName property
3. open a TIBOTable - say DstTab - in FB
4. for each record in SrcTab
5. start a transaction
6. set DstTab in insert mode (DstTab.Insert)
7. for each field in the current record
8. transfer each field from source to destination
9. if an exception is raised in 8. , do a rollback, choose if I want to go
on with the next record or end the program (still keeping all transferred

I will attentively study the code you suggest, but now I just want to
understand the reason of the program weird behaviour.

The following is the function that transfers 1 record from the DBF table to
the IB table:

function TForm1.PumpData:boolean;
for i:=0 to StrLst.Count-1 do
{read field name}
{copy field value}
DstTab.FieldByName(s).Value:=SrcTab.FieldByName(s).Value; {1}
Database1.Rollback; {2}
result:=me_ask('continue ?')=mrOk;

I don't want the whole transfer to be zeroed by a rollback. Instead, I want
to keep every single record that is transferred ok.

This is the reson why my transaction starts when a new record is reached
and ends (with a commit) when all fields have been transferred and a post
issued, or (with a rollback) when something goes wrong and an exception is
raised (because of - say - a replicated key).

When an exception is raised, I want to choose btw:

1. skip the offending record and go on with the transfer
2. halt the process (still keeping the records that were transferred ok)

The program works ok until the first rollback.

Then, subsequent calls of PumpData with all pass thru line {2}, even if the
data to transfer is completely correct.

This is the weird behaviour I'd like to understand.

Can you explain me why this happens ?

I would expect

Or should I wait for the TI-sheet on error handling ?

>the pdox2ib.exe utility will help

I downloaded it, but it gives an error as soon as you push the Start button
(error # 335544569: IB_DOMAIN table unknown) and also: it just took me 10
minutes to write my own transfer program...

Thank you

Duilio Foschi