I'm getting a PDOException error from computed field - but it is related to the INSERT statement being generated by the module.

I think this is because I have written a piece of PHP that only generates a result if there is one to be had, which is fine with me, I do not want to use NULL values because I do not want anything to be inserted into the database if there is no result. (this has to do with the way the data is being used.)

There does not seem to be an option in the "Store in Database" settings to not insert this record if there is no result... at least obviously, and it's not possible to change the field now as there is data already in storage. So my main question is, how can I stop the insert query running if there is nothing for it to run with?

The error is obviously causing problems because I am unable to save new content on which the field is set. If the conditions are true however, the code is working just great :)

Comments

Rhicreate’s picture

This is my error, seems to be the placeholder in the last column that is missing...

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_representative_node_value' at row 1: INSERT INTO {field_data_field_representative_node} (entity_type, entity_id, revision_id, bundle, delta, language, field_representative_node_value) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => taxonomy_term [:db_insert_placeholder_1] => 142 [:db_insert_placeholder_2] => 142 [:db_insert_placeholder_3] => colleges_universities [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => ) in field_sql_storage_field_storage_write() (line 448 of /Applications/XAMPP/xamppfiles/htdocs/drupal/modules/field/modules/field_sql_storage/field_sql_storage.module).

Anybody able to help?!

tsmulugeta’s picture

Issue summary: View changes

I'm having the same problem. Any update on this issue?