I have a node where I want to put more videos.

So I use multiple upload feature.
I created a cck for the original file (e.g name = source), a cck for the converted file(e.g name=converted) and a cck for the thumbnail image (e.g name=thumb).

When you save the node with your uploaded video, cck seems to create an entry record not only for the original file (in content_field_source table), but even for the cck converted field and cck thumbnail field.

For this reason in the source is present this code:

// For multi-upload file fields
db_query("INSERT INTO {content_". $cck_finished_thumbnail_field ."} (vid, nid, delta, ". $cck_finished_thumbnail_field ."_fid, ". $cck_finished_thumbnail_field ."_list) VALUES (%d, %d, %d, %d, 0)", $newfile->nid, $newfile->nid, $params->video_index, $newfile->fid);
// Get rid of the initial NULL entry.
db_query("DELETE FROM {content_". $cck_finished_thumbnail_field ."} WHERE nid = %d AND ". $cck_finished_thumbnail_field ."_fid IS NULL", $newfile->nid);

This code doesn't works for me, because the INSERT create a duplicate entry for PRIMARY key (nid,vid) (the initial cck NULL entry is still present).
I had tested this starting with all involved tables empty.
My fix is to execute the DELETE query for first.

Comments

attheshow’s picture

Status: Active » Postponed (maintainer needs more info)

The primary key on this table appears to be a combination of "vid" and "delta", not "nid" and "vid". I just tried uploading mutiple videos repeatedly to a node and did not receive any MySQL errors.

attheshow’s picture

Status: Postponed (maintainer needs more info) » Fixed

Ok, I spotted the error. Looks like it was when you upload a single video to a multi-value field. Committed fix to dev version. Thanks.

Status: Fixed » Closed (fixed)

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