the i18n module's hook breaks the query on line 171:

$result = db_query(db_rewrite_sql("SELECT {node}.nid, {node}.title FROM {node} where type in (".implode(',',$allowed_types).") ORDER BY {node}.created DESC"));

I had to change both the where to uppercase, and tell the rewrite the "node" was the primary table...

$result = db_query(db_rewrite_sql("SELECT {node}.nid, {node}.title FROM {node} WHERE type in (".implode(',',$allowed_types).") ORDER BY {node}.created DESC", "node"));

Can someone update the code in CVS?

Comments

pixelpreview@gmail.com’s picture

I have the same problem with file import module :

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN i18n_node i18n ON n.nid = i18n.nid WHERE (i18n.language ='en' OR i18n' at line 1 query: SELECT node.nid, node.title FROM node where type in ('page') LEFT JOIN i18n_node i18n ON n.nid = i18n.nid WHERE (i18n.language ='en' OR i18n.language ='' OR i18n.language IS NULL) ORDER BY node.created DESC in C:\xampp\htdocs\cmd\includes\database.mysqli.inc on line 156.

The module don't show the node id and the node title on the admin of the module
please help

it's the where clause ... The db_rewrite_sql is not correctly called in the module and i18n can't append his proper where to the sql syntax from this module.

the soluce is to write a file_import_db_rewrite_sql() function in the module with a $array['where'] = "the where clause".
and to call this new function at the line 171

neochief’s picture

Status: Active » Fixed

db_rewrite_sql calls removed in 5.1 and 6.x, so it should not bother anyone starting from this moment

Status: Fixed » Closed (fixed)

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