如何处理Facebook的新UID大小? [英] How to handle Facebooks new UID sizes?

查看:256
本文介绍了如何处理Facebook的新UID大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在Facebook应用程序上工作一点,但是当我注册了一个新用户来测试朋友的交互时,新用户有一个uid( 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆