Subject Re: generator of generators
Author duilio_fos <irel_llc@libero.it>
> that must be because you insist on selecting option Y instead,
which is incorrect and not feasible, and want the list to provide you
a solution for a problem that no one else would have encountered in
the first place. :-)

Nando,

you are mixing 2 different subjects.

If I meet you in NY and ask you the way to go to LA, I don't want to
hear how nice is Miami, instead.

Let it to me to decide if and why I want to go to LA.

If you don't want or cannot answer the question, I won't be hurted.
But don't try to cheat.

In my first message, I asked if I could create a generator in a
trigger and the answer was no.

This is ok for me. I have several other workarounds.

Then some began asking WHY I wanted to create several generators, and
I had to explain the terms of my problem, which are:

1. a database (accessible via TCP/IP via internet) must be shared by
several users of several companies

2. every user of every company must have the feeling its company is
the only one user of the database

3. every row inserted by a user must be uniquely identified.

as you see, a generator common to the whole database cannot be used,
as it would go against constraint no. 2.

The solution I deviced is to use a generator for every company.

As it is cumbersome to create a generator on-the-fly, I will create -
say - 100 initial generators in the database, called

GEN_1..GEN_100

A different generator will be used to number companies.

The client application will have a way to login to the database as a
new company.

When a new company is created, it will be given number I.

This company will use GEN_I as its sole generator to uniquely
identify the inserted records.

I don't know why the myth of me using a generator to _count_ records
originated.

After one year passed using FB every day, I should know better.

> In short: I'd use a generated OID and - if necessary, an additional
> counter field to cound records for each company.

again: an OID unique to the whole database cannot be used. It is
against the constraints. I know very well that an OID of 10,000 does
not mean that 10,000 records where inserted in the database, but
nonetheless it gives an idea of the activity in the database.

If I insert a record today and it is given OID 1000 and I insert a
new record tomorrow and it is given no 1001, this means that nobody
used the database in the last hours.

This kind of information cannot leak outside. Every company must live
in a separate world.

I expect a few more messages stating that I am wrong and that a
generator cannot used to count inserted records :)

Thank you

Duilio