Hi All,

I have/had this class:

class Birthday(sqlobject.SQLObject):
     day = sqlobject.IntCol()
     month = sqlobject.IntCol()
     year = sqlobject.IntCol()

The choice for IntCol above DateTimeCol was simply not to complicate my 
very first attempt to sqlobject too much.

As you see in my app I handle dates as three int's
A bonus to this is that I can do queries on distinct values with:

query=sqlobject.sqlbuilder.Select(Birthday.q.month,groupBy=Birthday.q.month)
     resultlist=Birthday._connection.queryAll(str(query))

As my app grew with options I thought date math could be better done 
with DateTime functions.
I changed the class to:

class Birthday(sqlobject.SQLObject):
     date = sqlobject.DateTimeCol(default=mx.DateTime.now())


Now, I have all the date calculations available but...
how do I do my distinct value lookup on day, month and year?

Are there solutions other than converting the int's to a DateTime object 
before doing the date calculations?


Thanks.



Frans.




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to