Bug #6006 MySqlDateTime sets IsZero property on all subseq.records after first zero found
Submitted: 10 Oct 2004 13:55 Modified: 21 Oct 2004 14:33
Reporter: Levap Aretnyd Email Updates:
Status: Closed Impact on me:
Category:Connector / NET Severity:S1 (Critical)
Version:1.0.0 beta OS:Windows (Windows 2003)
Assigned to: Reggie Burnett CPU Architecture:Any

[10 Oct 2004 13:55] Levap Aretnyd
ParseMySql method in MySqlDateTime only sets IsZero property to true and never sets is to false (which is default).
When for example a DATE field is fetched from the table and a zero date is found '0000-00-00' all subsequent records in this field are indicated as IsZero(=true). That causes problems itself and for example in ToString() method which then returns '0000-00-00' even when Value is correctly filled in the instance (method explicitly checks IsZero and if set than returns zero date).

How to repeat:
See description.

Suggested fix:
insert explicit set: `isZero = false;` at the beggining of the ParseMySql() in class MySqlDateTime (file:MySqlDateTime.cs, line: 169). Method beginning then should look like this:
	internal void ParseMySql( string s, bool is41 ) 
		isZero = false; // inserted statement
		switch (mySqlDbType) 
// code then goes on unchanged...
[10 Oct 2004 13:56] Levap Aretnyd
Corrected file

Attachment: MySqlDateTime.cs (text/plain), 8.92 KiB.

[21 Oct 2004 14:33] Reggie Burnett
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at