Flashvideo does not see a field I created and it says unknown column although it exists. CCK database structure is wrong

battlingnewbie - August 3, 2009 - 18:24
Project:FlashVideo
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

The maintainer of flashvideo says my datbase structure is wrong because I am trying for flashvideo to convert files and place the converted file in a cck field I created. The maintainer said this:
This is approximately what you should be seeing in the database table (see attachment). If you're not seeing this, I'd probably recommend posting to the CCK and/or FileField issue queues and see why your database structure is different.

I attach what my database looks like. Why is mine different? Why did everything work fine with Drupal 6.10? How do I fix this so that my videos get converted by flashvideo?

This is the error I get when trying to delete a test video I created:
* user warning: Unknown column 'field_converted_fid' in 'field list' query: UPDATE content_type_video SET field_video_fid = NULL, field_video_list = NULL, field_converted_fid = NULL, field_converted_list = NULL, field_thumbnail_fid = NULL, field_thumbnail_list = NULL WHERE nid = 2 in /home/gigguide/public_html/hosted/usagigguide.com/sites/all/modules/flashvideo/flashvideo.module on line 2488.
* user warning: Unknown column 'field_converted_fid' in 'field list' query: UPDATE content_type_video SET field_video_fid = NULL, field_video_list = NULL, field_converted_fid = NULL, field_converted_list = NULL, field_thumbnail_fid = NULL, field_thumbnail_list = NULL WHERE nid = 2 in /home/gigguide/public_html/hosted/usagigguide.com/sites/all/modules/flashvideo/flashvideo.module on line 2488.

Please can someone help me?

AttachmentSize
expected_video_table_structure.png86.29 KB
error flash.png458.49 KB

#1

markus_petrux - August 3, 2009 - 18:48
Project:Content Construction Kit (CCK)» FlashVideo
Version:6.x-2.4» 6.x-1.x-dev
Component:fieldgroup.module» Code
Priority:critical» normal

It looks like CCK has moved your fields off the content type table and it is now using per field storage. This may happen if the field is shared between several content types, or it is defined to use multiple values.

The error happens in flashvideo.module on line 2488, and this suggests that module is not building the SQL statement properly.

See this issue for hints on how CCK decides if the field uses per type or per field storage: #531140: cck fields are storing in diferrent sql tables?

#2

attheshow - August 3, 2009 - 19:36
Version:6.x-1.x-dev» 6.x-1.5-rc3
Status:active» postponed (maintainer needs more info)

Dear c,

So, is markus right? Are the fields that you're using being used by more than one content type in your system? Or maybe you've set your original video field to receive only one video and your finished video and thumbnail fields are set to receive multiple video files?

FYI, I'm going to close the older issue #505912: I cannot get flashvideo to convert my files and start using this one.

-Mark

#3

battlingnewbie - August 4, 2009 - 03:40

I have set the video field to receive one and the other to receive multiple because the last time I set the field to just one I got an error so when I changed it to unlimited it was fixed for the issue I had then. So am I suppose to just have one video field, one converted field and one thumbnail field?

I have changed it back and it still doesn't work. It doesn't give me the errors but I don't see the finished video. I don't see the thumbnail. There is nothing except the title How do I fix this please? I need to have this video thing working and soon.

So can you not have the same fields for different content types? What is the existing fields then for?

#4

battlingnewbie - August 4, 2009 - 03:39

The database structure is correct like the picture you showed me but I do not see the video. It just doesn't display. How do I fix this please?

On the other site I have I changed the fields to receive one and it just says conversion failed. If I delete it I don't get errors but it doesn't convert the file and now video or thumbnail is shown

#5

attheshow - August 4, 2009 - 03:53

Are you inserting the [video] tag into the body of your node? If not, please read about this in the "Help" section included with the module.

#6

battlingnewbie - August 5, 2009 - 08:34

I have created three CCK fields:

video
converted
thumbnail

I upload the video and the way it has worked in the past so far is that it converts the video and displays the converted video and the thumbnail. I have never used the video tag and placed in the body of any node I create. I just upload the video and then save. Then I will get a message saying it created the .flv file and it created the .jpg file. I am not seeing any of those messages and the converted video is not there and neither is the thumbnail

If you look at the files on the server there is no .flv file so actually it does nothing. it doesn't create the converted file or the thumbnail so the [video] tag will not work because there is no file to show. Why is it not doing anything? What should I do?+

The files are uploaded but not converted. I don't get a message that the conversion failed like it's happened before. Now it's just nothing.

On my other site it says conversion failed. Then I deleted the content type video and I uninstalled flashvideo. Reinstalled flashvideo and recreated the video content type with the three cck fields: video, converted, thumbnail. Tried to create a video and nothing. It doesn't show the files were created and it surely don't show the video or the thumbnail. Running cron also does nothing. The files are there but they are not being converted. My whole site depends on this and it worked fine with Drupal 6.10. What do I do please?

If you check in the database then the record is there but it is showing NULL for all the fields.
Edit Delete 6 6 7 1 a:9:{s:11:"description";s:0:"";s:8:"duration";d:5.... NULL NULL NULL NULL NULL NULL

It can't have anything to do with permissions since I am logged in as user/1. It's on two sites like this!

So will someone be able to help me?
Am I the only one having this issue? Why is it on two sites like this?

If I don't use cck and try and do it the cron way it also does nothing. So what do I do? I have installed it uninstalled it, rebuilt the site, created and deleted the content type and checked everything. The module does not work on two of my sites. Please help!

#7

markus_petrux - August 4, 2009 - 08:13

I think flashvideo module needs to query for database information related to the CCK fields using CCK APIs.

http://drupal.org/node/531140#comment-1854518

CCK may store field columns in per-content-type or per-field tables, depending on several factors (is field shared? allows multiple values?).

#8

battlingnewbie - August 4, 2009 - 08:36

No the fields are not shared and only allow single values.

#9

TwiiK - August 4, 2009 - 10:57

"Are the fields that you're using being used by more than one content type in your system? "

Is this wrong? I am getting this error: "Unknown column 'delta' in 'field list' query: INSERT INTO content_field_finished_thumbnail [...]"

Because the module assumes I am using a multi value field when in fact I am just using the same field shared across 2 content types. Does this module not support that by design?

I see in the module around line 744 that it assumes you either have a single upload field on 1 content type or you must have a multi upload field on 1 content type. What about my scenario where a single upload field is shared across multiple content types?

I just hacked it for now because I'm on a deadline, but it would be nice if it was fixed or if someone gave me an explanation why it is like this. :)

#10

battlingnewbie - August 5, 2009 - 11:39

Can someone please help me?

I've tested flashvideo on three sites and it doesn't work

#11

TwiiK - August 14, 2009 - 10:39

Here's the part of the code I think ignores our (or at least my scenario) of using a single upload field shared across multiple content types:

line 745:

          // For single-upload file fields
          if (db_column_exists($cck_table, $cck_original_video_field .'_fid')) {
            db_query("UPDATE {". $cck_table ."} SET ". $cck_finished_thumbnail_field ."_fid = %d, ". $cck_finished_thumbnail_field ."_list = 0 WHERE nid = %d", $newfile->fid, $newfile->nid);
          }
          else { // For multi-upload file fields
            // Get rid of the initial NULL entry.
            db_query("DELETE FROM {content_". $cck_finished_thumbnail_field ."} WHERE nid = %d", $newfile->nid);
            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->vid, $newfile->nid, $params->video_index, $newfile->fid);
          }

It has 2 scenarios:

- A single-upload field on one content type
- A multi-upload field on one or more content types

I think it should also cover my scenario:

- A single-upload field on two or more content types

In my mind that bit of code should look something like this:

          // For single-upload file fields
          if (db_column_exists($cck_table, $cck_original_video_field .'_fid')) {
            db_query("UPDATE {". $cck_table ."} SET ". $cck_finished_thumbnail_field ."_fid = %d, ". $cck_finished_thumbnail_field ."_list = 0 WHERE nid = %d", $newfile->fid, $newfile->nid);
          }
          else if (some check in here) { // For single upload field shared across multiple content types
            // Get rid of the initial NULL entry.
            db_query("DELETE FROM {content_". $cck_finished_thumbnail_field ."} WHERE nid = %d", $newfile->nid);
            // The same query as the one below, just without the delta values
            db_query("INSERT INTO {content_". $cck_finished_thumbnail_field ."} (vid, nid, ". $cck_finished_thumbnail_field ."_fid, ". $cck_finished_thumbnail_field ."_list) VALUES (%d, %d, %d, 0)", $newfile->vid, $newfile->nid, $newfile->fid);
          }
          else { // For multi-upload file fields
            // Get rid of the initial NULL entry.
            db_query("DELETE FROM {content_". $cck_finished_thumbnail_field ."} WHERE nid = %d", $newfile->nid);
            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->vid, $newfile->nid, $params->video_index, $newfile->fid);
          }

#12

markus_petrux - August 14, 2009 - 10:52

@TwiiK: Rather than adding if/else here, FlashVideo should ask CCK for the table name. Just follow the link in my comment in #7 to see how.

#13

TwiiK - August 14, 2009 - 12:08

That sounds much smarter, yes. :)

I haven't really investigated it all that much, I just hacked it to make it work for me because I was in a hurry.

#14

attheshow - August 16, 2009 - 22:10
Version:6.x-1.5-rc3» 6.x-1.x-dev
Status:postponed (maintainer needs more info)» needs review

I've just checked in some changes for this. They don't account for the scenario Twiik brought up where some fields are shared and some are not, but the changes do make use of the CCK functions pointed out by markus_petrux. Thanks!

#15

aasarava - November 30, 2009 - 21:47

Here is the missing else-if check that TwiiK noted in comment #11:

<?php
         
else if (!isset($cck_finished_video_field_db_info['columns']['delta'])) {
?>

This should allow the Flashvideo module to support using a shared CCK field for the video upload field. In other words, you can have multiple content types that share the same video Filefield.

In my testing, this else-if statement along with TwiiK's code in #11 seems to work fine. Can anyone else test, or can the maintainer comment on whether they see any problems with this?

#16

travist - December 1, 2009 - 02:21

Thanks for this aasarava,

If Mark ( attheshow ) does not commit this, I certainly will when I am back on task mid December. I am hoping to finally have a stable release out by then.

Thanks everyone for your efforts on clearing out these remaining issues.

Travis.

 
 

Drupal is a registered trademark of Dries Buytaert.