When the cron hook runs I get this error and no reminders sent...

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 'DISTINCT(r.nid), r.timestamp, u.uid AS user, u.name, u.mail, n.title, nr.body, e' at line 1 query: SELECT DISTINCT(n.nid), DISTINCT(r.nid), r.timestamp, u.uid AS user, u.name, u.mail, n.title, nr.body, e.event_start FROM node n INNER JOIN node_revisions nr ON n.vid = nr.vid INNER JOIN remindme_node r ON r.nid = n.nid INNER JOIN users u ON r.uid = u.uid INNER JOIN event e ON e.nid = r.nid INNER JOIN node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 0 AND na.realm = 'simple_access'))) AND n.status = 1 AND r.timestamp > 0 AND 1148873132 + r.timestamp > e.event_start in C:\Program Files\Apache Group\Apache2\htdocs\includes\database.mysql.inc on line 120.

Comments

pcwick’s picture

Although I get no remindme related errors when cron runs, remindme does not seem to be sending out reminder emails.

Timotheos’s picture

Line 230 is the offender.
$sql = db_rewrite_sql('SELECT n.nid, DISTINCT(r.nid), r.timestamp, u.uid AS user, u.name, u.mail, n.title, nr.body, e.event_start FROM {node} n INNER JOIN {node_revisions} nr ON n.vid = nr.vid INNER JOIN {remindme_node} r ON r.nid = n.nid INNER JOIN {users} u ON r.uid = u.uid INNER JOIN {event} e ON e.nid = r.nid WHERE n.status = 1 AND r.timestamp > 0 AND '. variable_get('remindme_send_last', time()) .' + r.timestamp > e.event_start');

The db_rewrite_sql function is adding another DISTINCT (see above) which is screwing up the statement. So if I take out the existing DISTINCT around r.nid it starts to work (kingda, just with other problems).
$sql = db_rewrite_sql('SELECT n.nid, r.nid, r.timestamp, u.uid AS user, u.name, u.mail, n.title, nr.body, e.event_start FROM {node} n INNER JOIN {node_revisions} nr ON n.vid = nr.vid INNER JOIN {remindme_node} r ON r.nid = n.nid INNER JOIN {users} u ON r.uid = u.uid INNER JOIN {event} e ON e.nid = r.nid WHERE n.status = 1 AND r.timestamp > 0 AND '. variable_get('remindme_send_last', time()) .' + r.timestamp > e.event_start');

So is this the way to go?

Cromicon’s picture

Same but with 4.6 latest download
Any resolution on this?

Cromicon’s picture

Seems to work if you remove DISTINCT. What were the other problems Timotheos ?

Timotheos’s picture

Killes did an update to CVS on June 14th that introduced other critical problems (http://drupal.org/node/69286) so I can't test whether this is fixed or not.

apaderno’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

I am closing this issue, since it's for a Drupal version that isn't supported.