[DB-SIG] Last round for DB API 1.1

M.-A. Lemburg mal@lemburg.com
Thu, 18 Mar 1999 10:02:24 +0100

Andy Dustman wrote:
> On Wed, 17 Mar 1999, M.-A. Lemburg wrote:
> > Ah, something else I've noticed with the latest version of MySQL:
> > something in the way of handling time and timestamps changed causing
> > those values to be corrupted in case they include a seconds fraction
> > part, e.g. '12:30:45.5' won't make it into the database, '12:30:45.00'
> > will show up as '00:00:00'. Since the DateTime types produce
> > strings *with* fraction by default, you'll probably have to use
> > the .strftime() methods to pass strings without the fraction part
> > to MySQL.
> This doesn't seem to happen with the TIMESTAMP type, if I send it
> str(<DateTime Object>). It truncates the fractional seconds, but otherwise
> it's okay.

Well, a .strftime() approach is probably more flexible. The str()
way is really only meant as convenience when printing date/time

> Produces a warning as well (on my interface, you can set
> whether or not Warning should be raised on a per-cursor basis).

That's a good one: I've had some trouble lately with drivers
(e.g. the MS SQL Server driver) sending warnings at connection
time. The result was that no connection was possible because
mxODBC kept raising a Warning exception...

I guess a callback approach is worth considering for warnings.
Or maybe the interface should just remember the Warning exception
and raise it *after* it has finished processing the request (a little
hackish I'm afraid).

> I have not tried other time types, but could this by a myODBC problem?

Nope. I've checked it using the mysql direct query interface.
It does the same thing: no warnings, truncated or even
non-sense data in the database.

Marc-Andre Lemburg                               Y2000: 288 days left
          : Python Pages >>> http://starship.skyport.net/~lemburg/  :