When configuring a Block Inject region for multiple content types, the following error was thrown.

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'node_name' at row 1: UPDATE {block_inject} SET region=:db_update_placeholder_0, node_type=:db_update_placeholder_1, node_name=:db_update_placeholder_2 WHERE (id = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => Adsense Body [:db_update_placeholder_1] => blog, page, story, book, article [:db_update_placeholder_2] => Blog entry, Page, Story, Book page, Article [:db_condition_placeholder_0] => 1 ) in block_inject_update_region() (line 293 of /usr/local/data/d7.modules/block_inject/block_inject.module).

Altering the block_inject table fields node_type and node_name from varchar(36) to varchar(256) corrected the problem.

This will continue to be an issue on sites with a large number of content types if the entire list is stored in a single field. Perhaps the code base should be restructured to permit better handling of the list, perhaps as multiple records.

Comments

upchuk’s picture

Status: Active » Needs work

Hey there triskelion,

I can't believe I left varchar(36). That does have to be changed and I will put out a new release with an update.

I think the field can also be bigger than a varchar (like a TEXT or something) so also larger sites can fit their content types in there.

Thanks for letting me know!

upchuk’s picture

Status: Needs work » Patch (to be ported)
StatusFileSize
new666 bytes

I created a patch for this update. If you wouldn't mind checking it out.

Will include it in the next release.

Cheers!

upchuk’s picture

StatusFileSize
new666 bytes

Sorry, I think there was a problem with the filename and I couldn't edit my earlier comment attachment which is weird..

Here you have the correct attachment.

Triskelion’s picture

Status: Patch (to be ported) » Needs work
StatusFileSize
new1.15 KB

I tested your patch and it applied fine, but the update was not detected. Have made a couple of minor changes so the update works. Noticed you included the patch in the dev version, so I rolled the patch against the current dev.

upchuk’s picture

Status: Needs work » Fixed

Cool!
Thanks! Wonder why for you the update was not detected. As far as I can see you only removed the $sandbox param. I will roll this back into the dev version and when the other issue is fixed too I will put out a new release.

Thanks for your help.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

inferno_msk’s picture

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'u3311_drupal7.block_inject_exceptions' doesn't exist: SELECT bie.bi_id AS bi_id FROM {block_inject_exceptions} bie WHERE (nid = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 1492 ) в функции block_inject_green_light() (строка 464 в файле /home/u3311/domains/site.ru/sites/all/modules/block_inject/block_inject.module).

path - not work!!!

upchuk’s picture

A yes, I'm on it, sorry about that!

upchuk’s picture

Try updating to the new release.