[Zope] OT: creating unique IDs for table rows

Dieter Maurer dieter@handshake.de
Sat, 18 Aug 2001 22:18:56 +0200 (CEST)


Carlos A. Carnero Delgado writes:
 > I'm currently creating a string which adds a current time (GMT) and a
 > random number then I get a SHA digest out of it. It works well for
 > testing purposes, but I'd like to get something more orthogonal and
 > with more "uniqueness". BTW, the underlying RDBMS doesn't support
 > autogenerated sequences or anything like that.
If your RDBMS has a reliable transaction system, you may
use your database for id generation:

    m= select max(id) from id_table

    id= m+1

    insert into id_table values(id+1)


Dieter