Subject FW: To Geoff, [IBO] DSQL question
Author Nico Callewaert
Geoff,

I'm just thinking something. In the pre insert trigger I still do
some field validation. What if an error occurs in the trigger, or the user
cancels his insert, I guess that's one generator number wasted ?? Should I
do the checking on the client, to avoid that a record is refused by the
server ?

Thanks,

Nico
-----Oorspronkelijk bericht-----
Van: Geoff Worboys [mailto:geoff@...]
Verzonden: vrijdag 16 maart 2001 11:11
Aan: IBObjects@yahoogroups.com
Onderwerp: Re: [IBO] DSQL question


> I have a DSQL component that inserts records in a table. I
> have a Before Insert trigger with : NEW.RegistNo = gen_id
> (RegistNo_Gen, 1). After the DSQL component, I would like to
> know the value of NEW.RegistNo.

Since you are using DSQL I am supposing that you are assigning the
parameter values in code. What I do in this situation is...

var
tmpID: int64;
begin
tmpID := MyDSQL.GeneratorValue('MYGEN',1);
MyDSQL.ParamByName['RegistNo'].AsInt64 := tmpID;
etc

now I have tmpID that I can use as a parameter to do related things.

This presumes that any insert trigger will only generate a new
identity value if the if New.RegistNo IS NULL. (Which is HIGHLY
recommended.)


HTH

Geoff Worboys
Telesis Computing


Yahoo! Groups Sponsor

Click Here to Find Software Faster


Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

Stamp powered by www.mailround.com




[Non-text portions of this message have been removed]