I've seen this mentioned on your personal blog but it's still a problem so I'll file a bug here. If you install FlashVideo module on a Windows-based installation of Drupal you get the error:

"user warning: BLOB/TEXT column 'input_file' can't have a default value query: CREATE TABLE ffmpeg_data ( did int(10) unsigned NOT NULL AUTO_INCREMENT, fid int(10) unsigned NOT NULL default '0', created timestamp NOT NULL, input_file text NOT NULL default '', output_file text NOT NULL default '', status tinyint(1) unsigned NOT NULL default '0', data text NOT NULL default '', PRIMARY KEY (did) ) TYPE=MyISAM COMMENT='size is in bytes' /*!40100 DEFAULT CHARACTER SET utf8 */; in D:\web\departments\public\shared\drupal\includes\database.mysql.inc on line 172."

The result is that ffmpeg_data table is not created. Easily fixed by removing the " default '' " for columns of type text. They will already default to '' in MySQL if NOT NULL is given so it's redundant.

Comments

travist’s picture

I will fix this for the next version... Thanks!

I just committed this to CVS.

dazweeja’s picture

Thanks Travis but I've just discovered that text columns don't default to '' in later versions of MySQL on Windows either. Sorry, I should have looked into the consequences more thoroughly before I made this suggestion.

Although it is correct to remove the default value from text columns because they are not supported in MySQL 5 (see link below), it does cause some issues with your code when inserting into the database, as you do have to provide a value for all text columns.

You could change 1053 to:

db_query("INSERT INTO {ffmpeg_data} (fid, created, input_file, output_file, status, data) VALUES (%d, NOW(), '%s', '%s', %d, '')", $oldfile->fid, $oldfile->filepath, $newfile->filepath, 1);

And 1240-1250 to (this is actually a few lines shorter):

$data = '';
if(flashvideo_variable_get($node_type, 'logdata', 0)) {
$data = "Command: $command";
$data .= "\n";
$data .= "Data: $ffmpeg_data";
}
db_query("INSERT INTO {ffmpeg_data} (fid, created, input_file, output_file, status, data) VALUES (%d, NOW(), '%s', '%s', %d, '%s')", $file->fid, $filepath, $output_path, 0, $data);

Here's the page from MySQL stating that default values for text columns are not supported:

http://dev.mysql.com/doc/refman/5.0/en/blob.html

The reason why it fails on Windows is because default sql_mode is set to STRICT_TRANS_TABLES and it isn't on Linux:

http://bugs.mysql.com/bug.php?id=25520