Active
Project:
The eXtensible Catalog (XC) Drupal Toolkit
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Aug 2009 at 14:40 UTC
Updated:
6 Aug 2009 at 14:54 UTC
Everywhere in the code db_query() is used as a wrapper around db_rewrite_sql().
Example:
$sql = 'SELECT * FROM {oaiharvester_sets} WHERE set_id = %d';
$result = db_query(db_rewrite_sql($sql), $set_id);
return $set = db_fetch_object($result);This is not necessary. I now get errors in my log saying:
Unknown column 'n.moderate' in 'where clause' query: SELECT * FROM oaiharvester_harvest_queue WHERE ((n.moderate != 1)) in /home/sites/site23425/web/sites/all/modules/xc/oaiharvester/oaiharvester.module op regel 2323.
Changing $result = db_query(db_rewrite_sql($sql), $set_id); to $result = db_query($sql, $set_id); works.
I replaced every instance of db_rewrite_sql($sql) to $sql and now the errors are gone (and the harvesting is still working).
Comments
Comment #1
mtwesley commentedIt would be better to keep db_rewrite_sql() using this instead:
I also think curly brackets need to be around the table name.
The problem you mentioned is because Drupal uses the node table, "n", and the node id, "nid" by default:
http://api.drupal.org/api/function/db_rewrite_sql