Karl_T Posted July 4, 2017 Share Posted July 4, 2017 I would like to save very long string to a text field. My case is that I am saving canvas serialized data into text field for saving as state. However, the the text link cannot excceed certain length which is around 66535 something even though I set the field's max length as 0. What I can do to release the limit? Thanks. Link to comment Share on other sites More sharing options...
Sergio Posted July 4, 2017 Share Posted July 4, 2017 I think the textarea fields are configured as MediumText on the database, so you'll have to change that if your needs exceed its maximum length. Check this page for a reference (this is using InnoDB engine, BTW): https://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html#data-types-storage-reqs-strings 2 Link to comment Share on other sites More sharing options...
Robin S Posted July 5, 2017 Share Posted July 5, 2017 Rather than edit the DB for an existing field, you could make a simple fieldtype module that extends FieldtypeTextarea: <?php class FieldtypeLongTextarea extends FieldtypeTextarea { /** * Module information */ public static function getModuleInfo() { return array( 'title' => 'Long Textarea', 'version' => 1, 'summary' => 'Field that stores multiple lines of text in a MySQL LONGTEXT column type.', ); } /** * Get database schema used by the Field * * @param Field $field * @return array * */ public function getDatabaseSchema(Field $field) { $schema = parent::getDatabaseSchema($field); $schema['data'] = 'longtext NOT NULL'; $schema['keys']['data'] = 'FULLTEXT KEY data (data)'; return $schema; } } 3 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now