Subject | Re: [firebird-support] GUID, What I need to do ? |
---|---|
Author | David Johnson |
Post date | 2004-12-11T00:17:53Z |
You may save the GUID either as a string or as a binary . Personally, i
use a String, but there are space and performance benefits to using a
binary. There are additional benefits that are specific to the Firebird
platform to reorganizing the GUID so the unchanging part comes first,
and the variable part last. Check the mailing list archives - Helen and
Ann have both written extensively on this.
On Windows systems, use the CreateGUID system call. There is a similar
system call on *NIX systems.
If you are using java, download the UUID class (and associated native
libraries and java classes) from www.doomdark.org. If you are using
Hibernate, I have a Hibernate UserType sub-class for saving and
retrieving UUID's.
You could do this with a UDF, but there is no point since the standard
ensures that (a) machines with a MAC address (network card) cannot
generate overlapping GUID's, and (b) while it is remotely possible under
a very specific set of circumstances that you might be able to
regenerate a single GUID on the same machines, part of those
circumstances involve both setting the system clock back and generating
exactly the same random seed value when you fire the algorithm. On
systems without network cards, the BIOS serial number is typically used
instead of the MAC address, and the high bit is set so that the values
cannot overlap with any values generated from a system with a MAC.
Since your app code can naturally call the appropriate operating system
functions, I would (and do) just put it there.
Hope this helps.
use a String, but there are space and performance benefits to using a
binary. There are additional benefits that are specific to the Firebird
platform to reorganizing the GUID so the unchanging part comes first,
and the variable part last. Check the mailing list archives - Helen and
Ann have both written extensively on this.
On Windows systems, use the CreateGUID system call. There is a similar
system call on *NIX systems.
If you are using java, download the UUID class (and associated native
libraries and java classes) from www.doomdark.org. If you are using
Hibernate, I have a Hibernate UserType sub-class for saving and
retrieving UUID's.
You could do this with a UDF, but there is no point since the standard
ensures that (a) machines with a MAC address (network card) cannot
generate overlapping GUID's, and (b) while it is remotely possible under
a very specific set of circumstances that you might be able to
regenerate a single GUID on the same machines, part of those
circumstances involve both setting the system clock back and generating
exactly the same random seed value when you fire the algorithm. On
systems without network cards, the BIOS serial number is typically used
instead of the MAC address, and the high bit is set so that the values
cannot overlap with any values generated from a system with a MAC.
Since your app code can naturally call the appropriate operating system
functions, I would (and do) just put it there.
Hope this helps.
On Fri, 2004-12-10 at 06:14, Martijn Tonies wrote:
>
>
> > Please, I need write my records with GUID (Global Unique Identifier),
> > perhaps I need one UDF, but where I found ?
>
> Google...
>
> http://www.ibphoenix.com/main.nfs?a=ibphoenix&s=1101199972:345924&page=ibp_udf_libs
>
> With regards,
>
> Martijn Tonies
> Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
> Server
> Upscene Productions
> http://www.upscene.com
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>