Sequentielle GUIDs erzeugen
Folgende Funktion erzeugt sequentielle GUIDs.
Während normale GUIDs eine quasi zufällige Folge bilden, sind sequentielle GUIDs die auf einem PC erzeugt wurden geordnet. normale GUIDs (hexadezimal codiert)
Code:
sequentielle GUIDs
CF739CDDB1582749B9E89752ED823C0E
29A77A8CC306D94E8CD0B9567DFD7B76 49F9E9E6B2A4B649A616CE96D3AD497F 9222BBBCC8057B4782D35E600D5F5805
Code:
Sequentielle GUIDs können als Primärschlüssel einer Tabelle eine bessere DB Leistung bringen als herkömmliche GUIDs.
660E110911009511B1DF7AFC8491FD96
660E110911009511B1DF7AFC8491FD97 660E110911009511B1DF7AFC8491FD98 660E110911009511B1DF7AFC8491FD99 660E110911009511B1DF7AFC8491FD9A
Delphi-Quellcode:
type
TUuidCreateSequential = function(out guid:TGUID):Integer; stdcall; var _UuidCreateSequential : TUuidCreateSequential; procedure CreateSequentialGuid(var guid: TGUID); begin if not Assigned(_UuidCreateSequential) then begin _UuidCreateSequential := GetProcAddress(GetModuleHandle('rpcrt4.dll'), 'UuidCreateSequential'); end; if Assigned(_UuidCreateSequential) then begin if _UuidCreateSequential(guid) <> 0 then OleCheck(CoCreateGuid(guid)); // Fallback auf Standard GUID end else OleCheck(CoCreateGuid(guid)); // Fallback auf Standard GUID end; |
AW: Sequentielle GUIDs erzeugen
Ergänzung: Läuft erst ab Windows 2000 (Für alle die noch sich noch mit Win9x/ME herumärgern müssen). Siehe MSDN
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:59 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz