Subject Re: [IBO] IBOQuery and GeneratorLinks
Author Helen Borrie
At 07:19 AM 7/07/2005 +0200, you wrote:
>I have a application where on the window, the datasource of the DB-aware
>fields point to a IBOQuery but when I load a record, I use a IB_DSQL
>component. In the IBOQuery I did the following:
>I generated the EditSQL, InsertSQL and DeleteSQL
>In the GeneratorLinks property, I set ID=<name of the generator>

The GeneratorLinks property of the IBOQuery, you mean. Setting
GeneratorLinks on one statement object, e.g. your IBOQuery, only affects
that statement object. So the GeneratorLinks will be known to an InsertSQL
of *that* statement object, but not to other statement objects.

An ib_dsql would be a DIFFERENT statement object. The GeneratorLinks won't
be known to that statement object unless you define it.

>If I insert a record, the trigger is fired and when the code (appearing
>below) is executed, the trigger is fired again with the result that my table
>key increments with 2. Is this normal?

No. However, as a reality check, would you please check the logic in the
body of your trigger. It MUST be like:
if ( is null) then = gen_id(gen_tablea, 1);

>If I use IBX then the trigger is
>fired only once with a update and my table key increments wiith 1.
> with IB_DSQLPhotoAlbum do
> begin
> ParamByName('Description').AsString := edtDescription.text;
> ParamByName('LoadedPhoto').Assign(;
> ExecSQL;
> end;

IBX doesn't have much support for server-side features, so what you'd do in
IBX is pretty irrelevant to what you do in IBO.

As far as I can tell, from your rather confusing descriptions, you are
(wrongly) trying to do inserts to the same table in two different ways
simultaneously and getting two inserts where you actually should have just one.

EITHER, define InsertSQL for your IBOQuery and call the IBOQuery's Insert


Define an ib_dsql object with a parameterised INSERT statement, assign to
its params and Execute it.


You can set GeneratorLinks in either case - or set them globally to have
them kick in in either case.

To set GeneratorLinks globally, make table-qualified entries in the
GeneratorLinks property of the connection object (IBODatabase in your case,
one supposes):


and so on (it's a stringlist).