固定宽度二进制数据的理想字段类型 [英] Ideal Field Type For Fixed Width Binary Data

查看:105
本文介绍了固定宽度二进制数据的理想字段类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我要存储二进制数据(哈希值)并且它们总是128字节长,我应该使用哪种字段类型? BLOB很好,但是宽度不是固定的(并且会生成动态表).CHAR需要一个字符集.

If I want to store binary data (hash values) and they're always 128bytes long, what field type should I use? BLOBs are nice, but they aren't fixed width (and result in dynamic tables).. CHAR requires a charset.

推荐答案

您可以使用二进制,所以BINARY(128).

请注意,如果要存储字符数据,则使用操作系统的标准字符集将字符转换为其字节值,因此必须考虑所有跨平台问题.

Note that if you're storing character data, then the standard character set of the operating system is used to convert the character to it's byte value, so you'd have to take any cross-platform issues into consideration.

这篇关于固定宽度二进制数据的理想字段类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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