Hello!

I'm having this issue with imagecache which I've been unable to resolve so far. When I try to install it I get the following error...

* user warning: BLOB/TEXT column 'data' can't have a default value query: CREATE TABLE imagecache_action ( actionid INT UNSIGNED NOT NULL PRIMARY KEY, presetid INT UNSIGNED NOT NULL DEFAULT 0, weight INT NOT NULL DEFAULT 0, data TEXT NOT NULL DEFAULT '') /*!40100 DEFAULT CHARACTER SET utf8 */ in C:\Program Files\Apache2\htdocs\includes\database.mysql.inc on line 172.
* warning: Invalid argument supplied for foreach() in C:\Program Files\Apache2\htdocs\includes\common.inc on line 734.
* warning: strtr() [function.strtr]: The second argument is not an array. in C:\Program Files\Apache2\htdocs\includes\common.inc on line 749.

The "imagecache_preset" table installs just fine.....

I've tried to modify the imagecache.install in various ways as I thought the error was to be found there. And has actually been able to make it install properly. The only result being that it totally breaks as soon as I try to make a preset. I'm starting to believe I've got a problem with my setup rather....

running:
Apache 2.2.4
Mysql 5.0
PHP 5.2
Win XP

Any ideas

Nic

Comments

nikkelei’s picture

Oh yes... What I did to make it install properly was changing the imagecache.install file from:

$ret2 = db_query('CREATE TABLE {imagecache_action} (
actionid INT UNSIGNED NOT NULL PRIMARY KEY,
presetid INT UNSIGNED NOT NULL DEFAULT 0,
weight INT NOT NULL DEFAULT 0,
data TEXT NOT NULL DEFAULT \'\')

into

$ret2 = db_query('CREATE TABLE {imagecache_action} (
actionid INT UNSIGNED NOT NULL PRIMARY KEY,
presetid INT UNSIGNED NOT NULL DEFAULT 0,
weight INT NOT NULL DEFAULT 0,
data VARCHAR(255) NOT NULL DEFAULT \'\')

however when I try to create presets I get all kinds of errors....

drewish’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new672 bytes

here's a patch that fixes the .install file.

recidive’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new681 bytes

MySql 5 doc says "BLOB and TEXT columns cannot have DEFAULT values". But a bug was causing MySql to silently ignore DEFAULT values in these column types. I got imagecache installed properly and here is what I have currently in my database:

mysql> show create table imagecache_action\G
*************************** 1. row ***************************
       Table: imagecache_action
Create Table: CREATE TABLE `imagecache_action` (
  `actionid` int(10) unsigned NOT NULL,
  `presetid` int(10) unsigned NOT NULL default '0',
  `weight` int(11) NOT NULL default '0',
  `data` text NOT NULL,
  PRIMARY KEY  (`actionid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

Here is a patch that remove DEFAULT value for 'data' column but keeps this column as NOT NULL.

drewish’s picture

i don't think the non null really matters one way or another.

nikkelei’s picture

Ok!

Seems to fix it.....

Thanks!

recidive’s picture

@nikkelei: did you test this? If so, could you mark this issue "ready to be committed"?

dopry’s picture

Committed to DRUPAL-5.

Anonymous’s picture

Status: Needs review » Closed (fixed)