[DB-SIG] DB-API Spec. 1.1a1
Bill Tutt
billtut@microsoft.com
Fri, 5 Dec 1997 13:45:43 -0800
Its severe lack of time I'm afraid..
If I had the time, I'd have made all the necessary updates to the Win32 ODBC
codebase...
If only I was getting paid to do Python database work.. *sigh*
Instead I'm busy using ATL OLE DB Consumer templates in C++...
The "best way" for date/time formats is easy.. DON'T
The reason you don't want to do this is because it imposes an uncessary
requirement on the code that works with the database i.e. dealing with
different date formats.. Thats just silly.
The specifics for any date/time format is quite easy...
1) Data its storing i.e. (year, month, day, hour, minute, second, billionths
of a second as an integer)
2) A method to format the date
(perferabbly using a strftime() format string, with an extension for
parts of the data type that strftime() doesn't
deal with)
3) A method to parse a date given a strftime() like format string.
#'s 2 & 3 should be preferrably written in C
Additional code that will need to be written will be some code to convert a
C double into this date type,
as well as conver this date type into a double.
The OLE DateTime type uses a double to represent dates.
All the execute() method should care about is the fact that it is a date,
and the best way for it to tell if its a date, is to have a C based date
module, and make all your dates as instances
of types in said module. So that it can just do a type check instead of
doing "tuple recognition"..
The reason for having the above in a C module is two fold..
1) Shorten the work the C code has to do to accomplish the input binding to
the database.
2) So the C code can easily create and make use of the date type.
Again, DO NOT allow a format for transferring dates in strings in your
Python program...
Parse a date you get into a date type, and pass that to execute().
Bill Tutt
billtut@microsoft.com
Not speaking for Microsoft, etc...
> -----Original Message-----
> From: M.-A. Lemburg [SMTP:lemburg@uni-duesseldorf.de]
> Sent: Friday, December 05, 1997 3:33 AM
> To: DB-SIG @ Python.org
> Subject: Re: [DB-SIG] DB-API Spec. 1.1a1
>
> Funny, now that I've started to put some discussion points
> regarding a new API Spec on the list nobody except Hannu
> seems interested anymore -- or is it just lack of time ?
>
> I'm still looking for "the best way" to set date/time formats.
> Hannu put up the very interesting idea of having execute()
> decide itself for input parameters. This can easily be
> done, since all the module has to test is whether it got a
> tuple or a number (float) and the addition is fully backward compatible.
> But what about the output from the fetch-methods ? I considered
> using a cursor variable for this, but other ways are also
> thinkable:
> - add a parameter to the fetch-methods setting the wanted
> date/time format
> - add a parameter to execute for setting the format for all
> later calls to fetch-methods
>
> Do we need more formats apart from tuples and time floats
> for date/time values, maybe strings ?
>
> --
> Marc-Andre Lemburg
>
>
> _______________
> DB-SIG - SIG on Tabular Databases in Python
>
> send messages to: db-sig@python.org
> administrivia to: db-sig-request@python.org
> _______________
_______________
DB-SIG - SIG on Tabular Databases in Python
send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org
_______________