根據RFC 4122:
UUID是128位長,並能保證 在空間和時間的唯一性。
但是,如果我們想知道的字符串表示,我們需要檢查ABNF:
UUID = time-low "-" time-mid "-"
time-high-and-version "-"
clock-seq-and-reserved
clock-seq-low "-" node
time-low = 4hexOctet
time-mid = 2hexOctet
time-high-and-version = 2hexOctet
clock-seq-and-reserved = hexOctet
clock-seq-low = hexOctet
node = 6hexOctet
hexOctet = hexDigit hexDigit
hexDigit =
"0"/"1"/"2"/"3"/"4"/"5"/"6"/"7"/"8"/"9"/
"a"/"b"/"c"/"d"/"e"/"f"/
"A"/"B"/"C"/"D"/"E"/"F"
我們總共有16 hexOctet的。我們通過hexOctet加上4個字符(「 - 」)來計算2個字符。無論版本號爲,我們總共有16 * 2 + 4 = 36個字符。
我沒有答案,但您使用哪個數據庫服務器?一些數據庫具有專用於存儲UUID的類型。例如,SQL Server具有'uniqueidentifier'類型。 – 2013-02-25 12:02:17
很好的問題。神諭。我看到「根據http://www.michelrenaud.com/?p=3 – finneycanhelp 2013-02-25 12:08:22
」Oracle中沒有GUID或uniqueidentifier類型「[相關問題](http://stackoverflow.com/questions/153815/how-should -i-STORE-A-GUID-在-預言)。 – 2013-02-25 12:12:10