On Sat, Jan 21, 2006 at 12:12:30PM -0800, Cliff Wells wrote:
> class Event ( SQLObject ):
>     summary = StringCol ( )
>     date = DateTimeCol ( )
> 
> What's the right way to select the articles for a particular day?  
> 
> I can use 
> 
> events = Event.select ( AND ( Event.q.date > datetime ( year, month, day ),
>                               Event.q.date < datetime ( year, month, day + 1 
> ) ) )
> 
> but I'm wondering if there's a more concise way.

   I don't think there is.

   Can I fix some bugs in the code? The first comparison should be ">=", I
think.
   datetime ( year, month, day + 1 ) will return wrong result or even raise
an exception if the day is the last day of the month. You'd better use
datetime arithmetic, timedelta, etc.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to