Hi, I just tried to translate a menu in a database called 'choir' that is also using table prefixes. I get the following error messages:

* user warning: Table 'choir.translatable_object' doesn't exist query: INSERT INTO translatable_object (tid,object_name,object_key,object_field,translation,locale) VALUES (3,'menu','133','title','Der Chor','de') in D:\wamp\drupal5\includes\database.mysql.inc on line 172.
* user warning: Table 'choir.translatable_object' doesn't exist query: INSERT INTO translatable_object (tid,object_name,object_key,object_field,translation,locale) VALUES (4,'menu','133','description','Über den Chor','de') in D:\wamp\drupal5\includes\database.mysql.inc on line 172.

It seems that the table prefix is not applied.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Bodo Maass’s picture

Status: Active » Needs review
FileSize
870 bytes
914 bytes
522 bytes

Ok, to fix this one has to change line 179 in translatable.database.inc into:

  db_query("INSERT INTO {{$table}} (". implode(',', $fields['columns']) .") VALUES (". implode(',', $fields['types']) .")", $fields['values']);

Patch is attached.

I presume that line 210 in this file is also not working with prefixes:

return db_query("UPDATE {$table} SET "...

The curly braces will be parsed by php as delimiters of the variable name to be replaced. So one can either use two curly braces:

return db_query("UPDATE {{$table}} SET "...

or pass the table name as a parameter to the db_query function:

return db_query("UPDATE {%s} SET  ...", $table
sun’s picture

Version: 5.x-1.x-dev » 5.x-1.2
Assigned: Unassigned » sun
FileSize
2.16 KB

Thanks for this bug report. Please test attached patch.

Bodo Maass’s picture

Seems to work fine on a system with table prefixes. I made sure both the insert and the update case were executed.

sun’s picture

Status: Needs review » Fixed

Thanks, committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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