Hi Oleg,

I think MySQLdb is not wrong, you will understand, the table used in
the test is as above:

class Test:
   time = TimeCol()
   date = DateCol()
   datetime = DateTimeCol()

I done some test and it seems that MySQLdb is returning a
datetime.timedelta instance.

>>> import MySQLdb as my
>>> connection = my.connect(...)
>>> cursor = connection.cursor()
>>> for x in cursor.fetchone():
...        print repr(x), type(x)
...
3L <type 'long'>
datetime.timedelta(0, 32400) <type 'datetime.timedelta'>
datetime.date(2006, 10, 26) <type 'datetime.date'>
datetime.datetime(2006, 10, 25, 9, 0) <type 'datetime.datetime'>
>>>

It is returning datetime.timedelta instances because the last
representable time is datetime.time(23, 59, 59, 999999). Postgresql
has this limitation of 24 hours to the time coltype too, but mysql
does not have this limitation, you could do something like this for my
table "test":

mysql> insert into test values (n, '54:00:00', null, null);
Query OK, 1 row affected (0.00 sec)

mysql> select time from test order by id desc limit 0,1;
+----------+
| time     |
+----------+
| 54:00:00 |
+----------+
1 row in set (0.00 sec)

Just to know, postgresql (throught psycopg) is returning a
DateTimeDelta for TimeCol. Do you have any suggestion now? I think
once TimeCol is a recent addition to sqlobject trunk, it can be
configured to return a timedelta instance reather datetime.time, but
timedelta does not have a strftime method and I am not very familiar
with the code...

Thanks for the help!
Regards,

-- 
Michel Thadeu Sabchuk
Curitiba - Brasil

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to