Subject | Re: [firebird-support] Get duplicate generator value? Am I doing wrong? |
---|---|
Author | Piotr Gawlicki |
Post date | 2005-04-01T09:58:48Z |
"bigredinf" <bigredinf@...> napisaĆ(a):
never happend again.
Best regards. Piotr Gawlicki
>I had similar problem. When I upgrade Firebird to version 1.5 this problem
> Hi,Groups!
>
> I use Ibobject and firebird 1.03.972 on win2k server.
> I have a application write by delphi,
> when a record before post,I need a lotno,so I write :
> procedure QDtlBeforePost(DataSet: TDataSet);
> begin
> if (qdtllotno.AsString = '') then
> qdtlLOTNO.Value :=
> afgetNewNo_str(qMainINDT.Value, 4);
> end;
>
> function afgetNewNo_str(pddate: tdate):
> string;
> var
> lignid: integer;
> begin
> QGnid.sql.Clear; //QGnid is a Tiboquery
> QGnid.sql.add('select gen_id(gn_lotno,1) from
> rdb$database');
> QGnid.ExecSQL;
> lignid := QGnid.Fields[0].AsInteger;
> Result := FormatDateTime('yymm', PDDATE)
> + inttostr((lignid + 10000000) mod 10000);
> //so if the Gnid get the value 25418
> // then the lotno will become "05035418"
> end;
>
> I though this way the lotno won't be duplicate.
> and this application run just fine about 6 month.
> but last week, my client report they found 2 diffent records with same
> lotno.
> The time between 2 record insert is about 2hours,
> and I am sure they won't insert 10000 record within 2hours.
> Do I do something Wrong?
> Please forget my poor English.
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/firebird-support/
>
> To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
never happend again.
Best regards. Piotr Gawlicki