如何处理Facebook的新UID大小? [英] How to handle Facebooks new UID sizes?
问题描述
100000XXXXXXXXX
)这似乎对于php来说很大。 保存数据库中的数字会产生相同的值( 2147483647
)。我猜这也是PHP的错误,因为我相信uid会适合一个无符号的bigint?
我不太确定从这里走到哪里,任何建议?
修复是将UID永久存储为字符串。在MySQL中使用 VARCHAR
字段类型,您将会很好。
一般来说,许多数据库专家会告诉你解释另一个应用程序的外键(在这种情况下就是UID)是<坏>坏坏,你应该把它们当作不透明的文本来处理。
I've been working a little bit on a Facebook application, but when I registered a new user to test the friend interaction the new user got a uid (100000XXXXXXXXX
) that seems to big for php to handle.
Saving the number in the database results in the same value (2147483647
). I'm guessing this is also PHPs fault, as I would believe the uid would fit in an unsigned bigint?
I'm not quite sure where to go from here, any suggestions?
The fix is to store the UID as a string always. Use the VARCHAR
field type in MySQL and you will be fine.
In general, many database gurus will tell you that interpreting another application's foreign keys (like UID in this case) is bad bad bad and you should handle them as opaque text.
这篇关于如何处理Facebook的新UID大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!