Subject | Re: [IBO] IBOQuery and GeneratorLinks |
---|---|
Author | Helen Borrie |
Post date | 2005-07-07T06:44:01Z |
At 07:19 AM 7/07/2005 +0200, you wrote:
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.
body of your trigger. It MUST be like:
..as
begin
if (new.id is null) then
new.id = gen_id(gen_tablea, 1);
end
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
method;
OR
Define an ib_dsql object with a parameterised INSERT statement, assign to
its params and Execute it.
ONE OR THE OTHER, BUT NOT BOTH!!
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):
TableA.ID=GEN_TABLEA
TableB.ID=GEN_TABLEB
and so on (it's a stringlist).
Helen
>I have a application where on the window, the datasource of the DB-awareThe GeneratorLinks property of the IBOQuery, you mean. Setting
>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>
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 (appearingNo. However, as a reality check, would you please check the logic in the
>below) is executed, the trigger is fired again with the result that my table
>key increments with 2. Is this normal?
body of your trigger. It MUST be like:
..as
begin
if (new.id is null) then
new.id = gen_id(gen_tablea, 1);
end
>If I use IBX then the trigger isIBX doesn't have much support for server-side features, so what you'd do in
>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(UserSession.ms);
> ExecSQL;
> end;
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
method;
OR
Define an ib_dsql object with a parameterised INSERT statement, assign to
its params and Execute it.
ONE OR THE OTHER, BUT NOT BOTH!!
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):
TableA.ID=GEN_TABLEA
TableB.ID=GEN_TABLEB
and so on (it's a stringlist).
Helen