tweaking ADO RecordSet tuple?

Eduard Hiti KatMouse at gmx.de
Wed Feb 14 14:59:16 EST 2001


I'm using ADO with Python just fine.
COM Unicode usage was always handled very well by win32com.

Date values can be converted to 'time' module format simply by using int():

    import pywintypes, time

    t = pywintypes.Time(time.time())     # this is the COM date type in
Python
    time.strftime("%Y-%m-%d %H:%M:%S", time.localtime( int(t) ) )

This seems to be a little messy, since time.time() returns a float, so
conversion with int() will lose information. What is worse, using float()
will return wrong values.

pywintypes.Time has a 'Format' method, too:

    t.Format("%m%d%Y")

which will return a string representation of the date.

I heard that the mxDateTime module has excellent support for COM date types,
but I didn't need it, so can't comment on that module.

Greetings,

    Eduard


----- Original Message -----
From: <fluxent at yahoo.com>
Newsgroups: comp.lang.python
To: <python-list at cwi.nl>
Sent: Wednesday, February 14, 2001 7:30 PM
Subject: tweaking ADO RecordSet tuple?


| context/architecture: Python, ASP, MsSQL. Sending query to MsSQL,
| getting back RecordSet, outputting HTML table.
|
| Am I correct in understanding that to work with a RecordSet in
| a "normal" (to me) manner, I need to:
| - transpose it, since GetRows returns columns, not rows
| - convert from unicode and dateobjects to useful stuff
|
| Is there some code sitting someplace that people are usually using
| for this purpose? Or are so few people using ADO that it hasn't
| bubbled up?
|
|
|






More information about the Python-list mailing list