Alex Rivera | Logout

Maximum length for longtext field

Asked 2010-11-27T23:33:14.920
16

I'm developing a database driven website for a Chinese audience in PHP. The content is stored in the database as a longtext field.

I was wondering how can I be sure the data to be stored isn't truncated?

Edit
Report

1 Answer

35

It depends on the characters' sizes and some configuration options.

LONGTEXT [CHARACTER SET charset_name] [COLLATE collation_name]

A TEXT column with a maximum length of 4,294,967,295 or 4GB (2^32 – 1) characters. 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. Each LONGTEXT value is stored using a four-byte length prefix that indicates the number of bytes in the value.

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

answered 2010-11-27T23:37:51.393

Your Answer