Subject Re: [ib-support] Re: generator of generators
Author Woody (TMW)
> Maybe I did not make the problem clear enough.
>
> I have N companies accessing a (common) database.
>
> Every time a record is inserted by company X, it must be uniquely
> identified.
>
> As M users of company X can access the database at the same time, the
> only safe way to get a unique ID is to use a generator.
>
> Theoretically, a single generator could be used by all users of all
> companies, but this is not wanted.
>
> So every company must have its own generator.
>
> If you see another solution, please let me know.

As long as you use the combination of the company number and the generated
number, then you can use one common generator. However, one solution I have
used is to create a separate table that holds the ID of the company and the
NEXTVALUE for that company. Then, using some type of locking algorithm, you
can use a type of psuedo-generator by creating a procedure that gets, then
increments, the number for whatever company you pass in. To add another
company, all you need to do is add another record with that company's ID to
the table. No change of code needed.

Woody (TMW)

"Never trust a computer you can't throw out a window."
-Steve Wozniak