Bug #32010 Connector return incorrect value when pulling 0 datetime
Submitted: 31 Oct 2007 23:10 Modified: 13 Nov 2007 12:35
Reporter: Kendal Goodrich
Status: Closed
Category:Connector/Net Severity:S2 (Serious)
Version:5.0.8.1 OS:Microsoft Windows
Assigned to: Target Version:
Tags: datetime, net connector

[31 Oct 2007 23:10] Kendal Goodrich
Description:
I am using MySql 5.0.45 with Net Connector 5.0.8.1 in Studio 2005.  I recently tried a
query that return the contents of a DateTime column.  The actual value in the database
was '0000-00-00 00:00:00'.  I made sure to use the connection option 'allow zero datetime
= true'.  When I run my application and execute the query using either DataAdapter.Fill or
MySqlCommand.ExecuteScalar, this is the value I get back = 'dddd, MMMM dd, yyyy h:mm:ss
tt'

How to repeat:
Have a table with one record in it.  Have one of the columns be of type DateTime with the
record having a value of 0000-00-00 00:00:00.  Then try and query the database for the
value of the datetime column for that record.

Suggested fix:
?
[1 Nov 2007 18:18] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36906
[1 Nov 2007 18:23] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/36907
[1 Nov 2007 18:24] Reggie Burnett
Fixed in 5.0.9 and 5.1.4
[13 Nov 2007 12:35] MC Brown
A note has been added to the 5.0.9 and 5.1.4 changelogs: 

A date string could be returned incorrectly by MySqlDataTime.ToString() when the date
returned by MySQL was 0000-00-00 00:00:00.