Subject Re: [firebird-support] Multiple generators
Author Daniel Rail
Hi,

At June 12, 2006, 12:13 PM, killerion wrote:

> In my DB, I need to keep track of different the offices of a company,
> and they want to be able to create or eliminate the offices, but
> depending on type, location, etc... they have different types of
> identifiers, now I want to know if I can use multiple generators for
> one table or do I need to manage them in different tables... if it is
> possible to do this how?

Generators are not really linked to a table. They end up being linked
by the way of a trigger. So, yes you can have multiple generators per
table.

Here are some ideas in how I would approach this problem. It would be
to have a primary key field based on a generator generated value, this
field is basically for easier updating, even if the user would most
likely never see this value. And, have a generator for each office
with a trigger that would be able to distinguish for which office the
record is for and use the proper generator. Or, you could use a table
containing the list of generators with the corresponding table and
office, and use that table as your reference for which generator to
use.



--
Best regards,
Daniel Rail
Senior Software Developer
ACCRA Consultants Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)