My setup: Drupal 7.21 / PHP 5.3 / IIS 7.5 / SQL Server 2008

My issue: I just updated this module and ran the update script, and received an error.

This is what I saw on the list of pending updates:

ctools module

    6008 - ctools_object_cache needs to be defined as a blob.

And this is the error that I received after it was run:

ctools module
Update #6008

    Failed: PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Implicit conversion from data type nvarchar(max) to varbinary(max) is not allowed. Use the CONVERT function to run this query.: UPDATE [{ctools_object_cache}] SET [data] = [data_old]; Array ( ) in db_change_field() (line 2988 of E:\mysite\drupal\includes\database\database.inc).

That same error is what appears in the "Recent log messages". I then went into the ctools_object_cache table to see the two columns referenced. These are the properties that I see:

Column Name = data_old
Data Type = nvarchar(MAX)
Allow Nulls = Yes

Column Name = data
Data Type = varbinary(MAX)
Allow Nulls = Yes

The table itself is empty of any data. Is there anything that I need to do to finish this update, even manually?

Comments

merlinofchaos’s picture

Status: Active » Closed (duplicate)
merlinofchaos’s picture

I could tell you the command to run to update the table in mysql, but I don't know SQL server at all.

katannshaw’s picture

Thank you for your response merlinofchaos.

The only suggestion I see through the link you provided was by "by deleting the column [ctools_object_cache]. [data_old] and rerunning the update."

That's a pretty scary solution, as I'd never know when that column should be used. Do you know if it's ok to be deleted?

Ctools uses the Database API, correct? Using that's supposed to alleviate the differences between database languages, so I'm not sure why this would only be a problem with SQL Server if that was true. I'd appreciate your help.

merlinofchaos’s picture

The table is used for temporary storing of in process edits on objects. When you truncate that table those in process edits will be lost. At most this will be inconvenient, but not damaging.

CTools uses the function db_change_field() and lets the database driver figure out the correct SQL to use to change the field over. If that causes a PDO exception on only one type of database, that's the fault of the driver.

katannshaw’s picture

Very good. I always appreciate your prompt and clear responses. Thanks for that as always.

I'll add my comments to the duplicate issue report that you referenced and go from there. Thanks.

kcoonce’s picture

This worked for me! Thanks!!