Subject Re: [IBO] IB_Datapump
Author Helen Borrie
At 11:33 PM 29/10/2007, you wrote:
>>
>> Show us the SQL for the SrcDataset and DstStatement properties and
>also how you are handling the DstLinks and any event handling...
>>
>> Helen
>>
>
>I have the following components:
>
>SrcDatabase: TIB_Database;
>DestDatabase: TIB_Database;
>SrcCursor: TIB_Cursor;
>// DestDSQL: TIB_DSQL; <--- remove
>DataPump: TIB_DataPump;

Add a TIB_Transaction - you need this operation to happen in a single cross-database transaction.


>SrcCursor.IBConnection is set to SrcDataBase
>DestDSQL.IBConnection is set to DestDataBase

Need IB_Transaction of both connections to be your explicit transaction. Make certain that it is in tiConcurrency isolation and has AutoCommit False.


>DataPump.SrcDataSet is set to SrcCursor
>DataPump.DstStatement is set to DestDSQL

No, place the statement directly into DstStatement. The IB_Datapump creates the TIB_Statement internally.


>SrcCursor SQL added
>SELECT DATETIME, SMSSOURCE,SMSNAME, SMSADDRESS, SMSID,
>SMSREP,SMSDEST, CELLNO, CELLMSG FROM OUTMESSAGES WHERE DATETIME
>>= :FROMDATE AND DATETIME <= :TODATE

OK


>DestDSQL SQL added

Place this statement directly into DstStatement.

>INSERT INTO OUTMESSAGES (DATETIME, SMSSOURCE, SMSNAME, SMSADDRESS,
>SMSID, SMSREP,SMSDEST, CELLNO, CELLMSG, IPADDRESS) VALUES
>(:DATETIME, :SMSSOURCE, :SMSNAME, :SMSADDRESS, :SMSID, :SMSREP, :SMSDEST, :CELLNO, :CELLMSG, :IPADDRESS)
>
>The only event handling is the DataPump.OnError event that I just
>log to a file.

Show it to us.

>I have nothing in DstLinks

This is a stringlist for mapping the output fields of the SrcDataset to the input parameters of the DstStatement. You have almost enough here for the component to do this mapping automatically, i.e. parameter names matching output field names and in the same order. But you have an extra parameter in the insert statement (:IPADDRESS). How do you get that into there?

You don't say anything about the processing you do when the user hits the "Pump" button. You will need to:

1. Connect to the two databases.
2. Start the explicit transaction.
3. Prepare the source statement (if not ... Prepared then Prepare)
4. Prepare the destination statement (likewise)
5. Call the Execute method of the datapump.
6. When it's finished, commit the explicit transaction.

Helen