[Reply]

Stephen,

I think that from what you say, gaps are not a problem, it is uniqueness that you are 
looking for. Am I right?

Assuming I am (for once this year), then all you need to do is to generate the unqiue 
ID outside the transaction that will use it.

eg

Process 1: Start TransactionA - Generate ID (=11)- Commit TransactionA - Start 
TransactionB - start doing whatever .....

Process 2: Start TransactionC - Generate ID (=12)- Commit TransactionC - Start 
TransactionD - start doing whatever .....

.

.

Process 1: Aborts   Rollback TransactionB

Process 3: Start TransactionE - Generate ID (=13) - Commit TransactionE - Start 
TransactionF - start doing whatever .....


To do this, you will need to use a method to generate ID's (Interbase is so easy in 
this sense because generators are produced outside
any transactions) . One way is to have a table which you keep the last value in. Look 
to your database documentation for details on
how to do this. It is so basic to any database activity.

Kind Regards

Gary


At 17:21 on 11/01/2001 you wrote

>To  :
>CC  :
>From: Stephen Bertram, [EMAIL PROTECTED]
>The problem is :
>
>Process 1 generates 11
>Process 2 generates 12
>Process 3 generates 13
>Process 1 issues a rollback - ID 11 is now unused
>Process 4 generates 11 - based on rolledback seed value.
>Process 5 generates 12 !! Duplicate
>Process 6 generates 13 !! Duplicate
>
>Or am I missing something here?  I can't see how to hold a value that is the
>basis for the next value (sequential or random) that isn't reset by a
>rollback.
>
>The other option of holding a table of all used values works well and is
>safe, but we end up with a table of X million rows with an associated index
>that does nothing useful.  If this was the selected option I suspect the
>best functionality would be to create a random number and then check for
>existance.  This at least would avoid the index problems that exist with
>sequential keys in some environments.
>
>Stephen
>
>
>-----Original Message-----
>From: Nic Wise [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, 11 January 2001 4:52 p.m.
>To: Multiple recipients of list delphi
>Subject: Re: [DUG]: [DUG-DB]: Unique IDs
>
>
>> The suggestion that Gary has put forward is exactly what I was thinking
>of,
>> but I still don't see how to "remember" rolled back ID's.
>
>
>do you really need to? does 1 2 3 6 7 8 9 10 14 16 17 make a difference, as
>long as they are all in order???? whats it for?
>
>N
>
>---------------------------------------------------------------------------
>    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                  Website: http://www.delphi.org.nz
>To UnSub, send email to: [EMAIL PROTECTED]
>with body of "unsubscribe delphi"
>---------------------------------------------------------------------------
>    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                  Website: http://www.delphi.org.nz
>To UnSub, send email to: [EMAIL PROTECTED]
>with body of "unsubscribe delphi"



========================================================

Gary Benner   -   Software Developer                  [EMAIL PROTECTED]
Corporate Software New Zealand Limited       Auckland - New Zealand
tel: +64-9 846-6067 (24hr)   fax: +64-9 846-6152     mob: (021)-966-992
Software System Design  -  Consulting  -  Mentoring   -   Data Modelling
Client Server - Delphi  -  Interbase  - Oracle - Web-based Technologies
Electronic Automation and Systems - Microcontroller Design & Software
                                http://www.corporate.co.nz

Ref#: 41006



---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"

Reply via email to