Subject Re: [IBO] Firebird Generated Keys as Master / Slave Links and IBO Controls
Author George
--- In IBObjects@yahoogroups.com, "Jason Wharton" <supportlist@...>
wrote:
>
> George wrote:
> > We have converted an old BDE App to Firebird using IBO components.
> >
> > We now want to optimise the app to get the benefit of the combined
> > Firebird / IBO functionality.
> >
> > Our problem concerns generators - specifically, having gone to
> > primary keys having no logic in the real world but being
generated by
> > a Firebird Generator, we now have linking problems.
> >
> > From what we understand, for a field to be populated by a
generator
> > it must be left out of the IBO query SQL statement. If this is so
> > then the query doesn't have it and cannot use it as a linking
field
> > in a master/slave relationship.
>
> The surrogate keys (that's what I call them) should still be
included in all
> your queries.
>
> > Can anyone point us to a document that will enlighten us on
Master /
> > Slave relationships using generator populated fields as the key?
>
> Is all you need to do is put a setting in the GeneratorLinks
property for
> the surrogate key column and IBO will take care of providing values
for your
> keys. Just be sure your triggers do not overwrite the values IBO
retrieves.
> Check for NULL before applying a value in a trigger.
>
> You can make a setting at the TIB_Connection.GeneratorLinks level
and it
> will be applied for all datasets on that connection, or you can
isolate a
> setting in your dataset GeneratorLinks property.
>
> > The samples are in Delphi and we are using C++ so can't access
them.
>
> This is something I hope to remedy at some point.
>
> Jason Wharton
>

Jason

Many thanks but what do you mean by 'settings' and should they be in
the master or slave? (Or if only in the transaction - what settings?).

I tried including the generated field in the query and that produces
an error message, obviously the control checks the NOT NULL and
throws an exception before the trigger fires and the generator has a
chance to populate the field.

The trigger itself checks for NULL in accordance with the Bible
(Helen's book).

What I suppose I am really after is a user guide so we don't have to
keep bothering you.

George