Heads-up! How D2 cached-updates can lose updates

I have observed how D2 C/S can fail to make updates when the
TDatabase.ApplyUpdates method is called, and fail to return a nonzero return
code or exception to the program.

I first observed this phenomenon when, in a form with a master/detail
relation, updates to the detail table didn't occur.  Investigation showed that
the detail dataset remained in the "inserting" state, and no SQL query at all
was issued to the server.  But there was no exception, not even a nonzero
return-code from the underlying BDE call.

This put the source of the problem into familiar territory:  the
cached-updates mechanism (in DB.PAS and DBTABLES.PAS) makes heavy use of
callbacks, where BDE routines call preassigned subroutines in your
application.  I know from painful past experience that exceptions generally do
not flow "through" such mechanisms.

By placing breakpoints in the VCL code on both sides of these callbacks, I was
able to trap into the Delphi code at the time when it has been invoked by BDE.
(It is good to know that Delphi's IDE can actually do this.)  I determined at
this point that the SQL query was failing with the error "field not found,"
caused by parameter substitution, and was able to unwind the problem from
there.

So, the m{*word*203}of this story is, so to speak, "heads-up, this problem can bite
you too."