Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 4 of 4 total |
Use of CURRENT_GUID and CreateGUID |
Sun, Oct 19 2014 8:15 PM | Permanent Link |
Peter Evans | Subject : Use of CURRENT_GUID and CreateGUID
In the document 'edb2sql.pdf' in section 10.4 CURRENT_GUID. This states "The CURRENT_GUID function returns a new GUID value as a 38-character string". I have used the following code to create my own GUID. var MyGuid : TGUID; if System.SysUtils.CreateGUID(MyGuid) = 0 then AObj.RecGuid := GUIDToString(MyGuid); I get a string like : {6EF101DC-C1F8-423A-B2BA-E7027C8F26C9} This is also 38 characters long. Does this look like what CURRENT_GUID returns? Why is there a need to have the { and } characters in the string? Couldn't they be eliminated, and the - characters, so the string is 32 characters? Regards, Peter Evans |
Sun, Oct 19 2014 11:13 PM | Permanent Link |
Raul Team Elevate | On 10/19/2014 8:15 PM, Peter Evans wrote:
> Does this look like what CURRENT_GUID returns? Yes and probably created very much the same way. > Why is there a need to have the { and } characters in the string? It's one of the standard guid formats (called also registry format sometimes) and happens to be what GUIDToString returns. > Couldn't they be eliminated, and the - characters, so the string is 32 > characters? Sure but it would not add any real value (other than saving few bytes). The other common format is the one without {} so then it's 36 length and binary version is 128bits so if you wanted space savings then that would be one to go with. IMHO the 32 byte version would be major pain to read when you need to look at records in EDBManager or such. binary version would be even worse of course. 36 length would be OK but then everybody would have to keep implementing this (i.e. you could no longer use the GUIDToString function as is) and you would break all existing code that uses 38. Raul |
Mon, Oct 20 2014 4:21 AM | Permanent Link |
Matthew Jones | It is also worth saying that the GUID field can be any string you want,
so long as it is unique of course. I found this handy for debugging - I can type in "matthew" and then see it in the right places etc. IIRC you have to trim the string when you retrieve it from the database if it is less than the 38 char otherwise it has spaces appended. -- Matthew Jones |
Mon, Oct 20 2014 7:49 AM | Permanent Link |
Peter Evans | Raul and Matthew,
Thank you for those replies. You have convinced me to accept the current representation of the GUID. I will leave things alone. Regards, Peter Evans |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |