I wonder no one got this recently, but the daily cron never works, since there is a error in building the SQLs.

The error is in line 74 and 83, in function subscription_subscription().

Recent code

$result = db_query(db_rewrite_sql("SELECT n.*, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid WHERE n.created>'%d' AND n.created<='%d'", $arg1, $arg2));

and

$result = db_query(db_rewrite_sql("SELECT c.*, u.uid, u.name, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.timestamp>'%d' AND c.timestamp<='%d'", $arg1, $arg2));

Fix

This is incorrect. $arg1 and $arg2 must be passed to db_query, not db_rewrite_sql. So the following is correct:

$result = db_query(db_rewrite_sql("SELECT n.*, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid WHERE n.created>'%d' AND n.created<='%d'"), $arg1, $arg2);

and

$result = db_query(db_rewrite_sql("SELECT c.*, u.uid, u.name, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.timestamp>'%d' AND c.timestamp<='%d'", "comments", "cid"), $arg1, $arg2);

Comments

gerd riesselmann’s picture

Ups, the text got lost due to a <...

OK. The problem is that $arg1 and $arg2 are passed to db_rewrite_sql. This is wrong. Instead they should be passed to db_query.

So, shorrly, instead of

$result = dbquery(db_rewrite_sql("..SQL..", $arg1, $arg2));

it must be

$result = dbquery(db_rewrite_sql("..SQL.."), $arg1, $arg2);

Node that for querying comments, db_rewrite_sql makes no sense, unless you pass "comments", "cid" as paramter 2 and 3 to db_rewrite_query().

xlyz’s picture

Status: Active » Closed (won't fix)