質問

What is the best field type and length to store Device UUID returned by PhoneGap?

What I learnt so far, is that 64 character string is the best option. However:

  • there are different ways, how each device define own UUID in PhoneGap,
  • it is quite unknown to me, what is the length of device UUID under iOS devices,
  • PhoneGap 3.0 moved this to plugin layer and introduced another formats for Tizen etc. devices,
  • Wikipedia brings "even more mess" in terms of unifing this problem across different mobile devices,

To make things even more complicated, I've learnt from my own examples, that even though PhoneGap states, that UUID is 64 characters long hexadecimal string, it currently returns only 16 characters for this purpose.

If this is hexadecimal string, then field type in MySQL must clearly be string as well. But, what length should I use to make myself sure, that I'll be able to record correct device UUID on any type of mobile devices, supported by PhoneGap, and that I will not waste to much space in my database (like I would do, when using 64 characters long string for storing 16 characters long hexadecimal string).

役に立ちましたか?

解決

Since UUID ca vary in length from platform and device type, I suggest using either varchar or tinytext field type to store this data. Both are capable of handling the upper limit of these string lengths and wont add too much overhead to the database.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top