Subject | Re: [IBO] RE: help |
---|---|
Author | Jason Wharton |
Post date | 2002-02-27T05:35:05Z |
Jerry,
In short, what you are trying to do with transactions doesn't make any sense
to me. It would help if you told why you are using two transactions. At a
first glance it looks like you are over complicating something that should
be much more simple. Apologies that I have merely skimmed over this just
giving my impressions.
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
In short, what you are trying to do with transactions doesn't make any sense
to me. It would help if you told why you are using two transactions. At a
first glance it looks like you are over complicating something that should
be much more simple. Apologies that I have merely skimmed over this just
giving my impressions.
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
----- Original Message -----
From: "Gerald W. McCaig - Efi Soft" <gwmccaig@...>
To: <IBObjects@yahoogroups.com>
Sent: Tuesday, February 26, 2002 7:46 PM
Subject: [IBO] RE: help
> Hi Jason,
>
> I have a question, in regards to the IBO Query & Transaction...
>
> My application has a screen where you can create a new record, and then
> multiple detail items under that record. So, I am running two transactions
> on two queries. I am having a problem though. I am only committing the
> changes to the detail right before I commit the changes to the master
> record. The problem is, if I add a few items, then begin adding
> another...but made a mistake...and need to cancel the current one or
delete
> one that was in error, the record still shows open and also posts when I
> commit the transaction.
>
> Let me give you a brief code overview, and maybe you can tell me where I
am
> going wrong...
>
> ----------------------------------------------------
>
> if not MasterTrn.InTransaction then
> MasterTrn.StartTransaction;
>
> MasterQry.Append;
> ---
> if not DetailQry.InTransaction then
> DetailQry.StartTransaction;
>
> DetailQry.Append;
> ---
> [if Detail OK] DetailQry.ApplyUpdates;
> ---
> [if Detail Cancel] DetailQry.CancelUpdates;
> ---
> [if Detail Delete] DetailQry.Delete;
> ---
> [When Master is Posted]...
> if DetailQry.InTransaction then
> DetailQry.Commit;
>
> MasterQry.ApplyUpdates;
>
> If MasterQry.InTransaction then
> MasterQry.CommitRetaining;
> ---
> [When Master is Canceled]...
> if DetailQry.InTransaction then
> DetailQry.Rollback;
>
> MasterQry.CancelUpdates;
>
> If MasterQry.InTransaction then
> MasterQry.Rollback;
> ----------------------------------------------------
>
> So, for example: I create a Master Record, I add 6 Items,
> but two of them were canceled during entry, when I save
> the Master, all 6 get recorded. I know that if I commit
> the transaction after each detail item that it will solve
> this problem, but it creates another problem because it
> doesn't rollback the six records automatically if I cancel
> the Master.
>
> Any ideas? Please.
>
> Jerry