Subject Re: [ib-support] Accessing current transaction start timestamp
Author IB/FB List
Lele,

You could create a field in First database that is a flag that indicates if
the record was exported or not.

You define triggers for After Insert, After Update and mark the field
"export" as 0 and runs the wuery to export every record that has the export
flag field not setted.

For each record that you process you mark it as exported.

It's a very simple and basic replication method, but I think it can mark in
a better way what records are not exported.


Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br


At 15:37 11/11/2002 +0000, you wrote:
>Hi all,
>
>I need to transfer data between two different DBs. Basically what I do
>is the following:
> a. start a snapshot transaction on the source
> b. select 'now' from source_db as START
> c. select previous_export_timestamp from source_db
> d. for each table in source_db:
> d1. start transaction on dest
> d2. select * from table where last_modified >= previous_export_timestamp
> d3. insert into dest_db:table
> d4. commit dest transaction
> e. store START as previous_export_timestamp in source_db
>
>and it's almost working, but I have a logical problem: given that
>point a) executes at 10:00:00, there is a little delay before I get
>the timestamp from b), say 10:00:02. It's just a few seconds, but it's
>more than enough to cause "loss" of records: next iteration, the
>export will touch only records modified after 10:00:02.
>
>The ideal would be getting the exact timestamp of a). Is it at all
>possible? If not, how could I circumvent the problem?
>
>I noticed the existence of RDB$TRANSACTIONS.TIMESTAMP, but the doc
>talks about "multi-database" transaction, but I couldn't figure out
>how to use that feature.
>
>thanx&bye,
>lele.