Subject | RE: [firebird-support] Maintaining proper generator values |
---|---|
Author | Doug Chamberlin |
Post date | 2003-11-11T20:52:28Z |
At 11/11/2003 03:28 PM (Tuesday), Wilson, Fred wrote:
not that the generator is set wrong but that the database is in an unusable
state.
Problems can be created from a generator being set to the wrong value.
Problems can also be created from users adding records to the database
using rogue field values. Problems can be created from corrupted database
files. Problems can be created from incorrectly coded applications.
Regardless of where the problems come from, I want to have a process in
place which enables the application to function without errors. For me that
means having the application check for a potential problem and fix it
before continuing.
The only way I know of that this can be done in a reasonable way is to
compare the current generator value with the existing field values and
adjusting the generator. (Yes, you could adjust the problem field values
but that cascades into a bunch of nasty data integrity problems.)
This applies whether you use one generator or more than one. It applies if
you use one generator for more than one purpose or not. It applies if you
use generated values for PKs or for non-PK values.
Does this solve all generator related issues? No. Is it intended to? No.
>The real question is *how* the generator(s) could have gotten set wrongly ??My strategy goes at the issue from a different approach altogether. It is
>We never see it.
>No client application ever sets a generator.
not that the generator is set wrong but that the database is in an unusable
state.
Problems can be created from a generator being set to the wrong value.
Problems can also be created from users adding records to the database
using rogue field values. Problems can be created from corrupted database
files. Problems can be created from incorrectly coded applications.
Regardless of where the problems come from, I want to have a process in
place which enables the application to function without errors. For me that
means having the application check for a potential problem and fix it
before continuing.
The only way I know of that this can be done in a reasonable way is to
compare the current generator value with the existing field values and
adjusting the generator. (Yes, you could adjust the problem field values
but that cascades into a bunch of nasty data integrity problems.)
This applies whether you use one generator or more than one. It applies if
you use one generator for more than one purpose or not. It applies if you
use generated values for PKs or for non-PK values.
Does this solve all generator related issues? No. Is it intended to? No.