Subject | Re: [IBO] IB_Datapump |
---|---|
Author | Helen Borrie |
Post date | 2007-10-29T13:07:28Z |
At 11:33 PM 29/10/2007, you wrote:
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
>>Add a TIB_Transaction - you need this operation to happen in a single cross-database transaction.
>> 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;
>SrcCursor.IBConnection is set to SrcDataBaseNeed IB_Transaction of both connections to be your explicit transaction. Make certain that it is in tiConcurrency isolation and has AutoCommit False.
>DestDSQL.IBConnection is set to DestDataBase
>DataPump.SrcDataSet is set to SrcCursorNo, place the statement directly into DstStatement. The IB_Datapump creates the TIB_Statement internally.
>DataPump.DstStatement is set to DestDSQL
>SrcCursor SQL addedOK
>SELECT DATETIME, SMSSOURCE,SMSNAME, SMSADDRESS, SMSID,
>SMSREP,SMSDEST, CELLNO, CELLMSG FROM OUTMESSAGES WHERE DATETIME
>>= :FROMDATE AND DATETIME <= :TODATE
>DestDSQL SQL addedPlace this statement directly into DstStatement.
>INSERT INTO OUTMESSAGES (DATETIME, SMSSOURCE, SMSNAME, SMSADDRESS,Show it to us.
>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.
>I have nothing in DstLinksThis 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