Re: OO and relation "impedance mismatch"

From: Tony Andrews <andrewst_at_onetel.com>
Date: 5 Oct 2004 08:45:13 -0700
Message-ID: <1096991113.299376.301190_at_h37g2000oda.googlegroups.com>


Kenneth Downs wrote:
> So many years ago I started coding a tell-me-everything-I-did-wrong
approach
> to error reporting, where it says, "Save failed on the following 3
> errors:..."
>
> Sadly, you cannot do this with declarative constraints. The db
products I
> have used, SQL Server and DB/2, both operate on fail-on-first mode,
and you
> get a vendor message instead of your own lovingly crafted and easy to
> understand helpful suggestion.
>
> But if you use a trigger, you can do tell-me-everything-I-did-wrong.
The
> best I have so far come up with is to return a table of error codes
and
> descriptions with each save attempt. An empty table is a successful
save.
> This lets you provide descriptions to humans, or you can use the
codes to
> do i18n translations, or use the code for automated error handling.

I don't agree with your triggers-instead-of-constraints approach, for reasons given elsewhere. But I do agree with the aim of getting all the errors at once. The best way for that to happen would be for the DBMS to have an option to apply all the applicable constraints, and to return a set of errors instead of just the first error.

Of course, you still won't like the vendor message, but that's OK because you can intercept it in your application code and replace with a nice message. Some work, but a lot less than rolling your own constraint triggers I bet.

I wonder whether any DBMS has, or is considering having, such a feature? Received on Tue Oct 05 2004 - 17:45:13 CEST

Original text of this message