Problem/Motivation
Method date_sql_handler->sql_date_math()
initially supports only integers in $count parameter. But some other modules (like Signup) use this method with field reference in $count. Perhaps such calls work with MySQL, but not with PgSQL. Anyway the idea is worth to be implemented.
Proposed resolution
Allow the method to work with field reference and not only integers.
Remaining tasks
Write a patch.
User interface changes
None.
API changes
Additional possibilities in date_sql_handler->sql_date_math()
.
Original report by @maikeru
Hi,
When using date 6.x-2.7 and signup-6.x-1.0, I receive the following error for each cron run:
query: SELECT n.title, n.nid, n.type, s.reminder_email, s.forwarding_email, field_close_date_value FROM node n INNER JOIN signup s ON s.nid = n.nid INNER JOIN content_field_close_date ON content_field_close_date.vid = n.vid WHERE (s.send_reminder = 1) AND (n.type = 'event') AND ('2011-03-29 05:19:36' >= (field_close_date_value - INTERVAL 's.reminder_days_before DAYS')) AND ('2011-03-29 05:19:36' <= (field_close_date_value + INTERVAL '1 HOURS')) in /var/vhost/www.example.com/modules/signup/includes/cron.inc on line 46.
Related issue here:
http://drupal.org/node/549018Signup now calls sql_date_math in the date module, which has the same INTERVAL issue.
Comment | File | Size | Author |
---|
Comments
Comment #1
maikeru CreditAttribution: maikeru commentedSee attached patch against 2.7.
Comment #2
John Franklin CreditAttribution: John Franklin commentedWorks here.
Comment #4
pingwin4egI rewrote the patch of @maikeru for Date 7.x-2.x, including doc changes.
The patch is for pgsql only. Tests needed for mysql & sqlite.
P.S.: I changed the issue tracker from bug to feature, because the Date API clearly states (in method's docblock) that the method
date_sql_handler->sql_date_math()
takes integer as $count parameter, so it is not its fault. But increased the priority, because other modules already use this feature.Comment #5
Chris Matthews CreditAttribution: Chris Matthews commentedThe 4 year old patch in #4 to date_api_sql.inc does not apply to the latest 7.x-2.x-dev and may be too old to reroll, but I went ahead and tagged the issue accordingly.