简体   繁体   English

longtext字段的最大长度

[英]Maximum length for longtext field

I'm developing a database driven website for a Chinese audience in PHP. 我正在为PHP中国观众开发一个数据库驱动的网站。 The content is stored in the database as a longtext field. 内容作为longtext字段存储在数据库中。

I was wondering how can I be sure the data to be stored isn't truncated? 我想知道如何确保要存储的数据不会被截断?

It depends on the characters' sizes and some configuration options. 这取决于字符的大小和一些配置选项。

LONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name] LONGTEXT [CHARACTER SET charset_name] [COLLATE collat​​ion_name]

A TEXT column with a maximum length of 4,294,967,295 or 4GB (2^32 – 1) characters. 一个TEXT列,最大长度为4,294,967,295或4GB(2 ^ 32 - 1)个字符。 The effective maximum length is less if the value contains multi-byte characters. 如果值包含多字节字符,则有效最大长度较小。 The effective maximum length of LONGTEXT columns also depends on the configured maximum packet size in the client/server protocol and available memory. LONGTEXT列的有效最大长度还取决于客户端/服务器协议中配置的最大数据包大小和可用内存。 Each LONGTEXT value is stored using a four-byte length prefix that indicates the number of bytes in the value. 每个LONGTEXT值使用一个四字节长度前缀存储,该前缀表示值中的字节数。

http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM