When storing the computed field on the database, if one selects the "text" data type, then the data length should not be required (because the "text" type doesn't need a length).

Currently, if you use a "text" field and doesn't specify a data length, when you save the field the module complains with the message "to store this field in the database, please specify the data length."

CommentFileSizeAuthor
#1 computed_field_longtext.patch1.33 KBmlncn

Comments

mlncn’s picture

Status: Active » Needs review
StatusFileSize
new1.33 KB

This is absolutely correct, and in fact prevents the longtext capability from being used at all to save computed fields, which is a limitation for this CCK teaser workaround.

Giving a value produces error messages like this one:

user warning: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(600)' at line 1 query: ALTER TABLE coa_node_content_article ADD COLUMN field_teaser_value text(600) in /var/www/includes/database.mysql.inc on line 121.

So here's a patch. It is applied against the dev branch (which for computed_field.module is the same as the 4.7.x-1.0 official release).

It removes the check for data length when the data type is text, and it borrows from CCK's text.module the bit about setting the longtext type.

The patch may be closer to "code needs work" than "code needs review" but at this point in 4.7's long life, it's more important to be functional than to be sure there's no redundant check for data length.

Agaric has tested this patch. Feedback on everything, including if the patch file is made correctly, much appreciated.

~ ben, Agaric Design Collective, Open Source Web Development

wrunt’s picture

Status: Needs review » Fixed

Thanks Ben, I've comitted a fix for this based on your patch.

Anonymous’s picture

Status: Fixed » Closed (fixed)