Subject | Re: [firebird-support] Feature request : Generator tables |
---|---|
Author | Ann W. Harrison |
Post date | 2004-02-20T20:54:36Z |
At 04:26 AM 2/20/2004, Jonathan Neve wrote:
I'll get a grip on myself now. That technique works as long as the user
doesn't care what is displayed on the screen. In which case, why
bother? gen-id(gen_name, 0) doesn't reserve the value for you. If two
users do it at the same, time, they'll both get the same value. Which is
fine, as long as that value is not used in secondary tables or stored in
the primary table. But why bother calling gen_id if you're going to ignore
the result?
As for the rest, what's wrong with concatenating a properly acquired
generator value with whatever other useful stuff the user wants to see?
Regards
Ann
>Yes, of course. However, there are ways to get around this problem. ForOh no no no... Don't do that. Oh dear no, don't do that! Oh my.... Sorry,
>example, what I usually do, is first get the generator value and display
>it, using "gen_id(gen_name, 0) + 1", and then, if and when the user
>confirms, I actually increment the generator. This avoids all
>concurrency issues in a simple way.
I'll get a grip on myself now. That technique works as long as the user
doesn't care what is displayed on the screen. In which case, why
bother? gen-id(gen_name, 0) doesn't reserve the value for you. If two
users do it at the same, time, they'll both get the same value. Which is
fine, as long as that value is not used in secondary tables or stored in
the primary table. But why bother calling gen_id if you're going to ignore
the result?
As for the rest, what's wrong with concatenating a properly acquired
generator value with whatever other useful stuff the user wants to see?
Regards
Ann