我使用什么结构类型来处理HTML内容(MySQL) [英] What structure type do I use for HTML content (MySQL)
问题描述
我想将一段缩小的HTML字符串放入数据库行中 - 考虑到它可能是非常大的字符串,我将使用以下类型的结构类型:
我尝试过 LONGTEXT
,但是当我尝试插入时似乎不起作用。
LONGTEXT
可能过分 - 它允许数据大小达到4GB。
MEDIUMTEXT
允许16MB。
TEXT
允许64KB。
$ b
TINYTEXT
只允许255个字符。
很少有HTML文档的大小为64KB,因此 TEXT
应该适合您。如果您真的想要安全,请参阅 MEDIUMTEXT
。
参考: http://dev.mysql.com/doc/refman/5.0/en/string- type-overview.html
I want to put a minified string of HTML into a database row - bare in mind it could be pretty large string, what kind of structure type do I use out of the following:
I've tried LONGTEXT
but that doesn't seem to work when I try to insert.
LONGTEXT
is probably excessive -- it allows data sizes up to 4GB.
MEDIUMTEXT
allows 16MB.
TEXT
allows 64KB.
TINYTEXT
allows only 255 characters.
Very few HTML documents are going to be 64KB in size, so a TEXT
ought to be suitable for you. If you really want to be safe, go for a MEDIUMTEXT
.
Reference: http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html
这篇关于我使用什么结构类型来处理HTML内容(MySQL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!