Subject Re: Archiving data into another database
Author Svein Erling Tysvær
--- In, Riho wrote:
> I use IBO 4.2Hc and Firebird 1.5 in Windows XP SP2
> I have 2 databases - one for working data and another for archiving
> old data. I regularly dump older data from one base to another based
> by records timestamp.
> For this I have 2 TIB_Connections, 1 TIB_Transaction that contains
> both connections in his properties and TIB_Cursor for reading and
> TIB_Query for writing data:
> Trans->StartTransaction();
> for(...)
> {sRowData = QFrom->Fields->RowData;
> QTo->Insert();
> QTo->Fields->RowData = sRowData;
> QTo->Post();
> }
> DeleteSQL->ExecSQL(); //deletes transfered old records
> Trans->Commit();
> I noticed that approximately after 100 records the program hangs a
> minute or more in Post() and then continues.
> I'm interestedto get rid of this longish delay in datatransfer.
> Am I doing something wrong in my coding - maybe there is more
> correct solution?
> Riho

Well, using a TIB_DSQL and Params or ParamByName is normally more
appropriate than TIB_Queries for inserting records. Though I must
admit that I don't use RowData myself. Also, deleting could be time
consuming if you use indexes with poor selectivity.