reading invalid dates from mysql db raises exception

Bug #1076592 reported by J Derek Wilson on 2012-11-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oursql
Undecided
Unassigned

Bug Description

This should not happen because I want to be able to get the data in the database out of the database even if it is invalid. The database stores data and if I store something dumb it should just let me get it back.

The only thing that really needs to change is lines 502-504 in statement.pyx:

- elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP,
- MYSQL_TYPE_DATE) and d.t.year == 0:
- val = None
+ elif c.type in (MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP,
+ MYSQL_TYPE_DATE) and (d.t.year == 0 or d.t.month == 0 or
+ d.t.day == 0):
+ val = PyString_FromStringAndSize(&d.c, c.length)

much better to deliver a meaningless string than a meaningful absence of data where there wasn't one.

Debra Virden (teddydlv) on 2013-03-03
description: updated
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers