Ticket #2763: mysql-timedate-null-value-inspectdb.patch

File mysql-timedate-null-value-inspectdb.patch, 937 bytes (added by wam-djangobug@…, 18 years ago)

Patch to address MySQL's NULL value format of time/date stamps.

  • util.py

     
    4343###############################################
    4444
    4545def typecast_date(s):
     46    print s
     47    if s == "0000-00-00":
     48        # workaround mysql issue.
     49        # see http://code.djangoproject.com/ticket/2763 and 2369
     50        return None     
    4651    return s and datetime.date(*map(int, s.split('-'))) or None # returns None if s is null
    4752
    4853def typecast_time(s): # does NOT store time zone information
     
    5762def typecast_timestamp(s): # does NOT store time zone information
    5863    # "2005-07-29 15:48:00.590358-05"
    5964    # "2005-07-29 09:56:00-05"
     65    if s == "0000-00-00 00:00:00":
     66        # workaround mysql issue.
     67        # see http://code.djangoproject.com/ticket/2763 and 2369
     68        return None     
    6069    if not s: return None
    6170    if not ' ' in s: return typecast_date(s)
    6271    d, t = s.split()
Back to Top