Subversion Repositories uuid_mac_utils

Rev

Rev 82 | Rev 84 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 82 Rev 83
Line 244... Line 244...
244
 
244
 
245
<h3 id="gen_uuidv8_sqlserver">Generate SQL server sortable time-based (version 8) UUID</h3>
245
<h3 id="gen_uuidv8_sqlserver">Generate SQL server sortable time-based (version 8) UUID</h3>
246
 
246
 
247
<p><i>The sorting of SQL Server is rather confusing and incompatible with UUIDv6 and UUIDv7.<br>
247
<p><i>The sorting of SQL Server is rather confusing and incompatible with UUIDv6 and UUIDv7.<br>
248
Therefore this method developed by <a href="https://www.hickelsoft.de/">HickelSOFT</a>
248
Therefore this method developed by <a href="https://www.hickelsoft.de/">HickelSOFT</a>
249
generates UUID which are sortable by SQL Server.<br>
249
generates UUIDs which are sortable by SQL Server.<br>
250
Version 1: Resolution of 1 milliseconds, random part of 16 bits, local timezone, NOT UUIDv8 conform.<br>
-
 
251
Version 2: Resolution of 1 milliseconds, random part of 18 bits, UTC time, UUIDv8 conform.</i><br>
250
They have a time resolution of 1 milliseconds combined with 18 bits of random data.</i><br>
252
<a href="https://gist.github.com/danielmarschall/7fafd270a3bc107d38e8449ce7420c25">C# implementation</a> |
251
<a href="https://gist.github.com/danielmarschall/7fafd270a3bc107d38e8449ce7420c25">C# implementation</a> |
253
<a href="https://github.com/danielmarschall/uuid_mac_utils/blob/master/includes/uuid_utils.inc.php">PHP implementation</a>
252
<a href="https://github.com/danielmarschall/uuid_mac_utils/blob/master/includes/uuid_utils.inc.php">PHP implementation</a>
254
</p>
253
</p>
255
 
254
 
256
<script>
255
<script>
Line 258... Line 257...
258
        document.getElementById("uuidv8_sqlserver_info_button").style.display = "none";
257
        document.getElementById("uuidv8_sqlserver_info_button").style.display = "none";
259
        document.getElementById("uuidv8_sqlserver_info").style.display = "block";
258
        document.getElementById("uuidv8_sqlserver_info").style.display = "block";
260
}
259
}
261
</script>
260
</script>
262
<p><a id="uuidv8_sqlserver_info_button" href="javascript:show_uuidv8_sqlserver_info()">Show format</a>
261
<p><a id="uuidv8_sqlserver_info_button" href="javascript:show_uuidv8_sqlserver_info()">Show format</a>
263
<pre id="uuidv8_sqlserver_info" style="display:none">Version 2: Resolution of 1 milliseconds, random part of 18 bits, UTC time, UUIDv8 conform:
262
<pre id="uuidv8_sqlserver_info" style="display:none">Version 2: Resolution of 1 milliseconds, random part of 18 bits, UTC time, 48 bit random "signature", UUIDv8 conform:
264
- 16 bit Random data
263
- 16 bit Random data
265
-  8 bit UTC Milliseconds transformed from 1000ms to 0..255 (hex encoded)
264
-  8 bit UTC Milliseconds transformed from 1000ms to 0..255 (hex encoded)
266
-  8 bit UTC Seconds (hex encoded)
265
-  8 bit UTC Seconds (hex encoded)
267
- 16 bit UTC Minute of the day (1..1440, hex encoded)
266
- 16 bit UTC Minute of the day (1..1440, hex encoded)
268
-  4 bit UUID version 8
267
-  4 bit UUID version 8
269
- 12 bit UTC Day of the year (1..366, hex encoded)
268
- 12 bit UTC Day of the year (1..366, hex encoded)
270
-  2 bit UUID Variant (0b10)
269
-  2 bit UUID Variant (0b10)
271
-  2 bit Random data
270
-  2 bit Random data
272
- 12 bit UTC Year (hex encoded)
271
- 12 bit UTC Year (hex encoded)
273
- 48 bit Signature "HICKEL" = 0x4849434B454C
272
- 48 bit Signature 0x5ce32bd83b96
274
 
273
 
275
Version 1: Resolution of 1 milliseconds, random part of 16 bits, local timezone, NOT UUIDv8 conform.
274
Version 1: Resolution of 1 milliseconds, random part of 16 bits, local timezone, 48 zero bit "signature", NOT UUIDv8 conform.
276
- 16 bit Random data
275
- 16 bit Random data
277
-  8 bit Generator's local timezone Milliseconds transformed from 1000ms to 0..255 (hex encoded)
276
-  8 bit Generator's local timezone Milliseconds transformed from 1000ms to 0..255 (hex encoded)
278
-  8 bit Generator's local timezone Seconds (BCD encoded)
277
-  8 bit Generator's local timezone Seconds (BCD encoded)
279
-  8 bit Generator's local timezone Minute (BCD encoded)
278
-  8 bit Generator's local timezone Minute (BCD encoded)
280
-  8 bit Generator's local timezone Hour (BCD encoded)
279
-  8 bit Generator's local timezone Hour (BCD encoded)