Subject Re: [IBO] How do I post multiple datasets in a single transaction?
Author Rohit Gupta
Mason,

as Helen said, read up about transactions. They work the way they do in
firebird (and hence IBO). Your wishing them to change will not make
them change. What you are describing is how non-sql databases used to
work such as btrieve. Thats not how firebird works.

If you want multiple datasets to commit/rollback together, yo have to
start them up with the same transaction, before you fetch data or create
data.

Rohit

On 25/09/2012 9:20 a.m., masonwheeler wrote:
>
> If I was using DBX, and I wanted to ensure that changes from multiple
> datasets were committed in a single transaction, it would go like this:
>
> tran := connection.BeginTransaction;
> try
> dataset1.ApplyUpdates;
> dataset2.ApplyUpdates;
> connection.CommitFreeAndNil(tran);
> except
> connection.RollbackFreeAndNil(tran);
> end;
>
> IBO doesn't seem to work that way. And in fact, as I've just
> discovered, it doesn't seem to work *at all* when trying to post
> multiple datasets in one transaction.
>
> Here's what I'm trying, using datasets of type TIBOTable:
>
> tran := TIB_Transaction.Create(nil);
> try
> try
> tran.IB_Connection := connection;
> tran.StartTransaction;
> dataset1.IB_Transaction := tran;
> dataset2.IB_Transaction := tran;
> dataset1.ApplyUpdates();
> dataset2.ApplyUpdates();
> tran.Commit;
> except
> tran.Rollback;
> raise;
> end;
> finally
> tran.Free;
> end;
>
> The problem with this is that, for some bizarre reason, assigning the
> transaction object to the dataset SILENTLY CLOSES THE DATASET, which
> causes all the changes that I'm trying to commit to be lost!
>
> What in the world is going on here, and how do I get this to work
> properly?
>
>
>
>
> __________ Information from ESET Endpoint Antivirus, version of virus
> signature database 7512 (20120924) __________
>
> The message was checked by ESET Endpoint Antivirus.
>
> http://www.eset.com


--
Regards

*Rohit Gupta*
B.E. Elec., M.E., Mem IEEE, Member IET
Technical Director
Computer Fanatics Ltd

*Tel *4892280
*Fax *4892290
*Web *www.cfl.co.nz
------------------------------------------------------------------------
This email and any attachments contain information, which is
confidential and may be subject to legal privilege and copyright. If you
are not the intended recipient, you must not use, distribute or copy
this email or attachments. If you have received this in error, please
notify us immediately by return email and then delete this email and any
attachments.


[Non-text portions of this message have been removed]