On Mon, 2005-08-08 at 13:39 +0200, Paul J Stevens wrote:
> Some of todays action in svn-trunk:
> 
> I've added two new datetime fields to the dbmail_auto_replies table
> called start_date and stop_date. This way activation and deactivation of
> auto_replies is shoot and forget. If no start_date and/or stop_date is
> specified in the table, default values are used in the query.
> 
>  "SELECT reply_body FROM %sauto_replies "
>  "WHERE user_idnr = %llu "
>  "AND NOW() BETWEEN COALESCE(start_date,DATE '1900-01-01') "
>  "AND COALESCE(stop_date, DATE '3000-01-01'", DBPFX,user_idnr);
> 
> this way, rather than using default values in the table, if a user
> clears such a value, auto_reply behaviour should still follow the rule
> of least surprise.

...

AND (start_date IS NULL OR start_date <= NOW())
AND (stop_date IS NULL OR stop_date >= NOW())

This is certainly a lot clearer about what you're trying to accomplish
and it doesn't require that "DATE" work this way (which, on SQLite, it
doesn't).

Furthermore, no one will have to upgrade in the year three-thousand :)

-- 
Internet Connection High Quality Web Hosting
http://www.internetconnection.net/

Reply via email to