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

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

same as prior attachment, but minus the debugging print statement.

  • util.py

     
    4343###############################################
    4444
    4545def typecast_date(s):
     46    if s == "0000-00-00":
     47        # workaround mysql issue.
     48        # see http://code.djangoproject.com/ticket/2763 and 2369
     49        return None     
    4650    return s and datetime.date(*map(int, s.split('-'))) or None # returns None if s is null
    4751
    4852def typecast_time(s): # does NOT store time zone information
     
    5761def typecast_timestamp(s): # does NOT store time zone information
    5862    # "2005-07-29 15:48:00.590358-05"
    5963    # "2005-07-29 09:56:00-05"
     64    if s == "0000-00-00 00:00:00":
     65        # workaround mysql issue.
     66        # see http://code.djangoproject.com/ticket/2763 and 2369
     67        return None     
    6068    if not s: return None
    6169    if not ' ' in s: return typecast_date(s)
    6270    d, t = s.split()
Back to Top