Error in sql code

asund - January 8, 2009 - 13:50
Project:CDN2 Video
Version:6.x-1.1
Component:Code
Category:bug report
Priority:critical
Assigned:kylebrowning
Status:closed
Description

I get the following error in watchdog when uploading video, and the video is not put into the cck field when returned:
Unknown column 'field_cdn2_video_token' in 'where clause' query: SELECT nid FROM content_type_profile WHERE field_cdn2_video_token = '[my token]#039; in /[my site]/sites/all/modules/cdn2/cdn2.module on line 539.

There seem to be something wrong with the sql coding. It includes the '' signs in the sql command.

If i change (on line 538)

    $query = "SELECT nid FROM {%s} WHERE %s = '%s'";
    $result = db_query($query, 'content_type_'. $content_type, "field_cdn2_video_token", $video_token);

to

    $query = "SELECT nid FROM {%s} WHERE %s = %s";
    $result = db_query($query, 'content_type_'. $content_type, "field_cdn2_video_token", $video_token);

The video gets stored in cck when returned from encoding - but i still get some error messages, so i guess there's more to it than that.

#1

asund - January 8, 2009 - 13:58

The error message didn't print right above - this is what it looks like.

Unknown column & #039;field_cdn2_video_token' in & #039;where clause& #039; query: SELECT nid FROM content_type_rays WHERE field_cdn2_video_token = 0c7afb69-dd88-11dd-ab14-cbe5b0cc8c64 in /home/sites/all/modules/cdn2/cdn2.module on line 539.

(I put spaces after the &'s so you'd see them.)

#2

kylebrowning - March 22, 2009 - 22:07
Assigned to:Anonymous» kylebrowning

Acknowledged

#3

kylebrowning - March 28, 2009 - 01:44
Status:active» fixed

i seemed to have fixed this in drupal6, if you continue to get this error message, let me know.

#4

System Message - April 11, 2009 - 01:50
Status:fixed» closed

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

#5

azriprajwala - October 8, 2009 - 07:19
Status:closed» active

I am having this issue in cdn2 module 6.x-1.9 version.
I am using cck version 6.x-2.5

When I change the query to bellow line it worked for me.

$query = "SELECT nid FROM {%s} WHERE %s = '%s'";
$result = db_query($query, $field_info['table'], $field_info['field_name'].'_video_token', $video_token);

#6

kylebrowning - November 12, 2009 - 08:54
Status:active» fixed

#7

System Message - November 26, 2009 - 09:00
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.