Subject RE: Re: [ib-support] Idea for a new field type for FB 2,0 or IB 7?
Author akahanek@qgir.cz
And what about, if I receive the number from a table inside a stored procedure like this:

CREATE TABLE MYGEN (
SERIESNAME VARCHAR(10),
VALUE INTEGER
)

Inside the procedure:
1. lock the desired row
2. increment the value
3. read the new value
4. unlock the row
5. return the new value

This should happen very quickly so I would not wonder about conflicts and no other user can obtain the same value for the desired series.

Ales

> -----Original Message-----
> From: Helen Borrie [mailto:helebor@...]
> Sent: Friday, February 08, 2002 3:22 PM
> To: ib-support@yahoogroups.com
> Subject: RE: Re: [ib-support] Idea for a new field type for
> FB 2,0 or IB 7?
>
>
> At 02:55 PM 08-02-02 +0100, you wrote:
> >Helen,
> >what dangerous situation can happen when maintaining the
> "own generators values for the auditable series" in a table ... ?
>
> Briefly, in a multi-user situation, without control over the
> numbers, more than one user can create the next number in the
> series. It was a long time since this thread was posted (3
> months) but the proposed code went something like this:
> ...
> Last_Num = select Max(serialnum) for SerialNumbers;
> New_Num = :Last_Num + 1;
> Insert into SerialNumbers (serialnum)
> values(:New_Num);
>
> or, a variation:
>
> Last_Num = gen_id(gen_SerialNum,0);
> New_Num = :Last_Num = 1;
> Insert...etc.
>
> or any variations that do similar stuff in a client application...
>
> The original topic was talking about getting serial-numbering
> with no gaps. The TI paper suggests a technique for
> achieving this (with auditing of deletions and recycling of
> "lost" numbers) using a generator. It discusses the
> multi-user issues....
>
> regards,
> Helen
>
>
> All for Open and Open for All
> Firebird Open SQL Database ยท http://firebirdsql.org
> _______________________________________________________
>
>
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~-->
> Sponsored by VeriSign - The Value of Trust
> Pinpoint the right security solution for your company - FREE
> Guide from industry leader VeriSign gives you all the facts.
> http://us.click.yahoo.com/lWSNbC/WdiDAA/yigFAA/dpFolB/TM
> --------------------------------------------------------------
> -------~->
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/