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:
http://d.pr/2URu
I've tried LONGTEXT
but that doesn't seem to work when I try to insert.
The four BLOB types are TINYBLOB , BLOB , MEDIUMBLOB , and LONGBLOB . These differ only in the maximum length of the values they can hold. The four TEXT types are TINYTEXT , TEXT , MEDIUMTEXT , and LONGTEXT . These correspond to the four BLOB types and have the same maximum lengths and storage requirements.
MySQL supports SQL data types in several categories: numeric types, date and time types, string (character and byte) types, spatial types, and the JSON data type.
Some Differences Between VARCHAR and TEXTThe VAR in VARCHAR means that you can set the max size to anything between 1 and 65,535. TEXT fields have a fixed max size of 65,535 characters. A VARCHAR can be part of an index whereas a TEXT field requires you to specify a prefix length, which can be part of an index.
MySQL does not have a boolean (or bool) data type. Instead, it converts boolean values into integer data types (TINYINT). When you create a table with a boolean data type, MySQL outputs data as 0, if false, and 1, if true.
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
I would use TEXT. What are the options you were thinking about?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With