Subject Re: [IBO] A few questions about IBO
Author Scronkey
Again, thanks Geoff.
Your info has been golden!

One final query though,

> If the PK you supply is being ignored then your trigger needs
> changing. eg.
>
> IF (NEW.PK IS NULL) THEN
> NEW.PK = GEN_ID(MY_GEN,1);
>
> So that the trigger will only supply a new PK value if no PK was
> provided. This is not only important when using IBO but also many
> other situations such as importing and transfering records.

I am actually writing an import routine right now, and have just
started scratching my head regarding this issue. Your timing is
immaculate!!

In my metadata, I create a generator & a trigger. Now, before the db
is to be used normally, I need to import x amount of records from
the old Pdox database.
As I do not know how many records will be imported, how can I
specify the SET GENERATOR MY_GEN TO X, to correctly reflect the
latest ID to be used, after the import?
I'm assuming that if I don't, the generator will try to use '1', and
theres a very good chance that will have been used already.

Can I do an ALTER GENERATOR, or something?

I'm aware I could allow the generator to be involved during the
import process, but as I'm trying to import detail records also, I'm
worried that inconsistency will happen, do to not being able to
retrieve the last generated value. (or is this possible)

Rgds,
-Ryan

Thanks for your tips on the doc's (TechInfo).
I have read through most of them a couple of times now since last
wednesday, and now some of the more arcane info in them is making a
little more sense.