Delete query is called while updating the cck field value of node.
After debugging i find following code in
var/www/drupal-7.40/modules/field/modules/field_sql_storage/field_sql_storage.module
in field_sql_storage_field_storage_write($entity_type, $entity, $op, $fields)
we have following code
// Delete and insert, rather than update, in case a value was added.
if ($op == FIELD_STORAGE_UPDATE) {
// Delete languages present in the incoming $entity->$field_name.
// Delete all languages if $entity->$field_name is empty.
$languages = !empty($entity->$field_name) ? $field_languages : $all_languages;
if ($languages) {
db_delete($table_name)
->condition('entity_type', $entity_type)
->condition('entity_id', $id)
->condition('language', $languages, 'IN')
->execute();
db_delete($revision_name)
->condition('entity_type', $entity_type)
->condition('entity_id', $id)
->condition('revision_id', $vid)
->condition('language', $languages, 'IN')
->execute();
}
}
May be someone explain why ? And also can i use update Query instead of delete, insert ?