Subject RE: [ib-support] Generated ID and constraints
Author Wilson, Fred
This wil *NOT* work in a multiuser environment at all !! Remember that the
generator is not under transaction control, it's outside of transaction
control.


Best regards,
Fred Wilson
SE, Bell & Howell
fred.wilson@... <mailto:fred.wilson@...>



-----Original Message-----
From: Douglas Tosi [mailto:douglasht@...]
Sent: Wednesday, December 19, 2001 10:17 AM
To: ib-support@yahoogroups.com
Subject: Re: [ib-support] Generated ID and constraints


Hi,

> If any constraint causes an exeption user get error message but my
> generator already increased.

In the Before Insert trigger, do:
NEW.ID = GEN_ID(GEN, 0);
and in the After insert trigger:
DummyVar = GEN_ID(GEN, 1);

That way you assign the current gen value to the id, and if the insert is
successful increment the gen.
I'm not sure if this method works ok on a highly concurrent environment...

hth,
dog




Yahoo! Groups Sponsor

ADVERTISEMENT

<http://rd.yahoo.com/M=178320.1681224.3270152.1261774/D=egroupweb/S=17050077
09:HM/A=879171/R=0/*http://www.fastweb.com/ib/yahoo-57f>

<http://us.adserver.yahoo.com/l?M=178320.1681224.3270152.1261774/D=egroupmai
l/S=1705007709:HM/A=879171/rand=682734607>

To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .