Subject | Re: FW: [IBO] Another Simple question |
---|---|
Author | Helen Borrie |
Post date | 2002-02-06T05:34:21Z |
At 06:08 AM 06-02-02 -0800, you wrote:
Dion, you've done it again - you are so mean about the info you provide for your problems! People spend time trying to solve one problem when the problem really lies in the bits you forget to mention...Why didn't you say you were connecting to two different databases???????? That changes everything.
</rant>
What you need here is a two-phase-commit transaction, crossing both connections and isolated from other transactions.
Therefore, you need one ib_connection for each database. You can ignore the DefaultTransaction for both (or use it for other tasks).
Drop in a single ib_transaction. Set the ib_connection property to one of the ib_connections, the ib_transaction1 property to the other.
Now, pick up that code revision I posted yesterday and add code to start both transactions explicitly, and at the end, to commit both. Handle exceptions on the ib_connection components themselves. You will get exactly what you want.
Try to work this out for yourself but, if you get stuck, just ask again.
regards,
Helen
All for Open and Open for All
Firebird Open SQL Database ยท http://firebirdsql.org
_______________________________________________________
>-----Original Message-----<rant>
>From: Dion [mailto:dion@...]
>Sent: Wednesday, February 06, 2002 6:06 AM
>To: 'IBObjects@yahoogroups.com'
>Subject: RE: [IBO] Another Simple question
>
>
>A unit of work. An all or nothing result, either all parts of the
>transaction get committed or none. The scenario is as follows. The client
>needed to capture data pronto. Networking was not catered for at that stage,
>let alone tested, thus info was captured on two seperate machine(a
>nightmare, I know). These two databases need to be merged, hence the all or
>nothing request. If a member cannot be saved, his linked beneficiary and
>covered members cannot be saved(posted). In this case, log the error and let
>the user handle the update manually(% wise, this should be =- 5)
Dion, you've done it again - you are so mean about the info you provide for your problems! People spend time trying to solve one problem when the problem really lies in the bits you forget to mention...Why didn't you say you were connecting to two different databases???????? That changes everything.
</rant>
What you need here is a two-phase-commit transaction, crossing both connections and isolated from other transactions.
Therefore, you need one ib_connection for each database. You can ignore the DefaultTransaction for both (or use it for other tasks).
Drop in a single ib_transaction. Set the ib_connection property to one of the ib_connections, the ib_transaction1 property to the other.
Now, pick up that code revision I posted yesterday and add code to start both transactions explicitly, and at the end, to commit both. Handle exceptions on the ib_connection components themselves. You will get exactly what you want.
Try to work this out for yourself but, if you get stuck, just ask again.
regards,
Helen
All for Open and Open for All
Firebird Open SQL Database ยท http://firebirdsql.org
_______________________________________________________