Subject RE: [firebird-support] Get duplicate generator value? Am I doing wrong?
Author Kevin Stanton
As always - Thanks Helen!

Kevin



_____

From: Helen Borrie [mailto:helebor@...]
Sent: Friday, April 01, 2005 2:35 PM
To: firebird-support@yahoogroups.com
Subject: RE: [firebird-support] Get duplicate generator value? Am I doing
wrong?



At 07:47 AM 1/04/2005 -0800, Kevin Stanton wrote:

>Hi Helen,
>
>I thought there was also a transaction issue as well. I was getting
>duplicates as well at one point using a TIB_Cursor and you recommended the
>following:
>
>qryGetOrderNos is TIB_DSQL
>
> with qryGetOrderNos do
> begin
> try
> trNextID.StartTransaction;
>
> SQL.Strings[0] := 'select gen_id ( gen_orderno, ' +
IntToStr(OrderCnt)
>+ ' ) as EOrderNo from rdb$database';
> If NOT Prepared then Prepare;
> Execute;
> eo := FieldByName('EOrderNo').AsInteger;
> trNextID.Commit;
> except
> trNextID.Rollback;
> raise;
> end;
> end;

This doesn't look like my code! maybe a mod of someone else's,
though. This routine could certainly return duplicates - it would only
take the increment expression evaluating to '0' to cause that.





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