Subject RE: [IBO] Firebird Generated Keys as Master / Slave Links and IBO Controls
Author Jason Wharton
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