Field/Record level constraints???

TomC

Member
We are trying to use OracleDictionary.EnforceConstraints and having a bit of trouble when interacting with our table from a grid. How do you catch these field check constraints when they occur? For that matter, how do you catch them at the record level. We tried implementing OnPostError for our TOracleDataSet descendant which gets called fine if EnforceConstraints is False. The code we tried;

begin
odsAL_Lane.Cancel;
Action := daRetry;
end;

This sort of works except we get a "Bug in InternalPost" message box. We have a message in TranslateMessage for our CHECK constraint that is being violated that only can be seen if running in the IDE. This is seen as the message portion of an EDatabaseError.

Back to Field level. TranslateMessage works the same there as well. After seeing the message in the IDE the application crashes.

What is the best, efficient, recommended way to work with constraints using the TOracleDataset, DOA, and Grids?

Tom Clowers
Systems Analyst/Programmer
ECMS - Technical Lead
Expeditors International of WA, Inc.
tom.clowers@expeditors.com

[This message has been edited by TomC (edited 25 May 2000).]
 
The combination of Cancel and daRetry is probably the cause of the 'Bug in InternalPost' message. If you first Cancel the DataSet, the modifications will get undone and the DataSet will no longer be in edit mode. After the Cancel there is really nothing left to retry and you get the error.

The "best" way to work with constraints is to put everything on the server (constraints and triggers), including the messages (through the MessageTable). This way you can maintain the integrity rules independent of the application(s). The most efficient (performance-wise) way is to program everything locally, so that you can validate input without the need to go to the server.

------------------
Marco Kalter
Allround Automations
 
Back
Top