What is the difference between longblob and longtext in mysql?

末鹿安然 提交于 2019-12-08 19:23:12

问题


What is difference between longblob and longtext in mysql?

What should I use to save a long topic ?


回答1:


BLOBs are for Binary Large Objects. If you're storing binary data in your DB, then BLOB would be the table type you want. Otherwise.. longtext.

In your case longtext.




回答2:


BLOB and TEXT are basically identical, except that TEXT fields have character set translation rules applied. BLOB fields do not. So with BLOB what you put in is what you get. With TEXT, what you put may not be what you get out.




回答3:


You can use collation & character sets on TEXT columns, which would mean that:

  1. If you specify a different charset for a connection than the TEXT column is (for instance,latin1 column, utf-8 requested), MySQL will convert the contents to the required charset.
  2. You can sort & compare TEXT columns based on collation.

BLOB's are just 'binary sequences', and you'll get them 'as is'.



来源:https://stackoverflow.com/questions/5555496/what-is-the-difference-between-longblob-and-longtext-in-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!