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.

Comments

Status:Active» Needs review
StatusFileSize
new870 bytes
new914 bytes
new522 bytes

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

<?php
  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:

<?php
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:

<?php
return db_query("UPDATE {{$table}} SET "...
?>

or pass the table name as a parameter to the db_query function:
<?php
return db_query("UPDATE {%s} SET  ...", $table
?>

Version:5.x-1.x-dev» 5.x-1.2
Assigned:Unassigned» sun
StatusFileSize
new2.16 KB

Thanks for this bug report. Please test attached patch.

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

Status:Needs review» Fixed

Thanks, committed.

Status:Fixed» Closed (fixed)

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