Master Detail commits the master on detail exception

Master Detail commits the master on detail exception

Post by Marcio Dia » Tue, 13 Jul 2004 23:22:47


Hi, I'm Using D5.1, IB6, IBX5.04.
I've a lot of NestedDataSets master detail relationships in my applications
but now I've noticed a strange behavior:
When there is an exception on the detail dataset the master is always
applyed!
I'm Using the ApplyUpdates(0); param, also have tried all kinds os possible
values to the Action in the ReconcileError's event.
This behavior doesn't occours when the exception is a Primary Key ou Foreign
Key exception.
This is a IBX Bug or Am I doing something wrong?

Note: The exceptions are raised by Interbase triggers;
 
 
 

Master Detail commits the master on detail exception

Post by Team » Wed, 14 Jul 2004 01:25:41

I assume you are using client datasets since ApplyUpdates(0)
is a CDS call. If so are both the master and detail IBX
components sharing the same transaction. They must in this
situation.

 
 
 

Master Detail commits the master on detail exception

Post by Marcio Dia » Wed, 14 Jul 2004 02:11:27


Yes Jeff, there is only one IBTransaction in the DataModule and both the
master and the detail IBQuery are linked to it.
Have you tried this? Build a simple master-detail relationship using 2
IBQueryes, 2 CDS 1 Provider, 3 DataSources, 1 Tansaction and 1 IBDataBase.
Chosse a simple Interbase database and put a foo exception in the before
insert trigger of the detail table.
The exception fires the OnReconcile error event and you abort the
operation but the master record is applyed.
I've used the IBSQLMonitor to "Debug" the operation and seems that the
master's data are applyed before the OnReconcileError is fired.
Please help me I'm going crazy with this error.

"Jeff Overcash (TeamB)" < XXXX@XXXXX.COM > escreveu na mensagem


applications
possible
Foreign
 
 
 

Master Detail commits the master on detail exception

Post by Team » Wed, 14 Jul 2004 02:21:03

The Delphi 5 version has always fired the autostop action when all the datasets
are closed even if it was not autostarted (this required an interface change and
exists in D6-8 versions). Sounds like you are hitting a problem in this. The
CDS is manually starting the transaction, but when all the datasets are closed.

I would expect the master's to be applied before the OnReconcileError. The real
question is if the transaction is committed before that event. If not, you need
to rollback the master changes in the error event.



--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts, build
a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act
alone, solve equations, analyze a new problem, pitch manure, program a computer,
cook a tasty meal, fight efficiently, die gallantly. Specialization is for
insects. (RAH)