I'm getting the primary key problem (I've read TW doesn't seem to recognize primary key, btw).

The primary key definition from Schema for my import table is:

  'primary key' => array('Array'),

which is clearly cackked given that all the other ones look something like:

  'primary key' => array('did'),

Since you depend on Schema it's looking like the problem is over there, not in TW.

Comments

aangel’s picture

I think I've isolated the problem in tw.module line 438.

Schema returns the primary key as the zero-eth array element of $schema['primary key'] but TW is performing this test:
if (in_array($colname, $pks))

expecting the primary key index name to be where the zero-eth element is instead.

Changing line 336 which currently reads:

      $pks = $schema['primary key'];

to read:

      $pks = $schema['primary key'][0];

allows TW to correctly identify the primary key.

Not knowing the code well enough, I'm not sure if Schema is setting up the wrong structure or if TW is expecting the wrong structure. Hope this helps.

Now that I can get past this error, I'll try my import tomorrow.

mikeryan’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce this with either a single-column or two-column primary key, and adding [0] breaks it for me - is there any more info you can provide? $schema['primary key'] should be an array of the fields in the primary key, there shouldn't be an intermediate array.

sdsheridan’s picture

The problem appears to be that "maxvalue" is a reserved word in MySQL 5.5 and up (perhaps earlier, but not apparently as early as 5.1), so without surrounding it in back-quotes, the insert or update fails for all numeric types. However, using "drupal_write_record", that doesn't seem to happen in the code per all the API documentation as far as i can see, so it's failing on the inserts and updates.

Solution: change the column name (best solution i think), or don't use "drupal_write_record" to do the updates...

Shawn

Alex Andrascu’s picture

Alex Andrascu’s picture

I won't create another issue for this but please fix the existing ones so we can get this working on MySQL 5.5

Thank you,
Alex

Mixologic’s picture

Issue summary: View changes

This is fixed by getting rid of 'maxvalue' here: #1100896: Reserved SQL keywords being used

Mixologic’s picture