我找到了 GUID generation routine with python .
运行代码会得到以下结果。
GUID: 00000129e0e72d9b2aab3c1500ac001000e90001 Time: Sat, 17 Jul 2010 09:55:33 (millis: 0.787) IP: 172.16.233.1 Counter: 715865109
这段代码的注释有如下信息。
### GUIDs make wonderful database keys. They require no access to the ### database (to get the max index number), they are extremely unique, and they sort ### automatically by time. GUIDs prevent key clashes when merging ### two databases together, combining data, or generating keys in distributed ### systems.
问题
- 这适用于 SQLite 吗?据我所知,SQLite 中的 INTEGER 类型是 8 字节,而对于 8 字节,不可能以十进制形式存储值 0x00000129e0e72d9b2aab3c1500ac001000e90001 或 101362835865894089778560972572099193929729。
- 有没有什么方法可以使用 SQLite 获得全局唯一 ID?
最佳答案
除了它占用 32 个字节而不是 16 个字节之外,在 SQLite 中将 GUID 存储为文本还有什么问题?
关于database - GUID 作为 SQLite 的唯一键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3272013/