UUID

Stai visualizzando una vecchia versione di questo article. Visualizza la versione più recente.

Sintassi

UUID()

Spiegazione

Restituisce un Universal Unique Identifier (UUID) generato secondo "DCE 1.1: Remote Procedure Call" (Appendice A) CAE (Common Applications Environment) Specifications, pubblicato da The Open Group nell'October 1997 (Documento Numero C706).

L'UUID è pensato come numero che è unico nello spazio e nel tempo. Due chiamate a UUID() devono generare due valori diversi, anche se sono effettuate su due computer separati e non connessi tra loro.

L'UUID è un numero di 128 bit rappresentato da una stringa utf8 di cinque cifre esadecimali, nel formato aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:

  • I primi tre numeri sono generati da un timestamp.
  • Il quarto numero garantisce l'unicità temporale, nel caso in cui il valore timestamp perda tale caratteristica (ad esempio a causa dell'ora legale).
  • The fifth number is an IEEE 802 node number that provides spatial uniqueness. A random number is substituted if the latter is not available (for example, because the host computer has no Ethernet card, or we do not know how to find the hardware address of an interface on your operating system). In this case, spatial uniqueness cannot be guaranteed. Nevertheless, a collision should have very low probability.

    Currently, the MAC address of an interface is taken into account only on FreeBSD and Linux. On other operating systems, MySQL uses a randomly generated 48-bit number.

Esempi

MariaDB [(none)]> SELECT UUID();
+--------------------------------------+
| UUID()                               |
+--------------------------------------+
| cd41294a-afb0-11df-bc9b-00241dd75637 |
+--------------------------------------+

Vedi anche

  • UUID_SHORT() ; Restituisce un Universal Unique Identifier breve (64 bit)

Commenti

Sto caricando i commenti......
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.