Zitat von Graeme Geldenhuys <[EMAIL PROTECTED]>:

> Hi,
>
> I'm trying to do performance testing in Firebird RDBMS using GUID's
> and primary keys. I constantly got PK violations. I then wrote the
> code show below to create 50,000 GUID's and add them to a StringList
> (no duplicates allowed). Every time I run this I get a duplicate GUID
> at iteration 1021.  My original test is supposed to create 5mil
> records, but I can't get past 1000! :-(

Sounds like the Debian openssl key fiasko.
Add it to the list:
http://xkcd.com/424/

Mattias


> Actual program output:
>
> [EMAIL PROTECTED]:index_performance$ ./index_performance.elf
> Duplicate value detected: {FD3DF19D-A878-F8BA-F9D1-108658451E05}
>   List.Count = 1021
>
> GUID's are supposed to be very unique! Wikipedia says something like:
> Create a billion every second for 10 years or something before you
> deplete the range.
> So what is wrong with my code or maybe the Free Pascal implementation?
>
> --------------------[ code ]------------------------------
> procedure TMainForm.btnTestClicked(Sender: TObject);
> var
>   sl: TStringList;
>   s: string;
>   i: integer;
>   d: integer;
>   guid: TGUID;
> begin
>   sl := TStringList.Create;
>   try
>     try
>       sl.Sorted := True;
>       sl.Duplicates := dupError;
>       for i := 1 to 50000 do
>       begin
>         CreateGUID(guid);
>         s := GUIDToString(guid);
>         sl.Add(s);
>       end;
>       writeln('Created 50,000 GUIDs');
>     except
>       on e: EStringListError do
>       begin
>         writeln('Duplicate value detected: ' + s);
>         writeln('  List.Count = ', sl.Count);
>       end;
>       on e: Exception do
>         writeln('Unknown error: ', e.Message);
>     end;
>   finally
>     sl.Free;
>   end;
> end;
> --------------------[ end ]--------------------------------
>
>
> Changing the line that adds the GUID to the StringList by prefixing
> the counter, all is fine. So I can't see a problem in my code.
>
>    sl.Add(IntToStr(i) + s);
>
>
> Regards,
>   - Graeme -
>
>
> _______________________________________________
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> _______________________________________________
> fpc-devel maillist  -  fpc-devel@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>


------------------
Powered by NetMail
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to