Bug #17736 Selecting a row with with empty date '0000-00-00' results in Read() hanging.
Submitted: 27 Feb 2006 11:31 Modified: 4 Sep 2006 14:06
Reporter: Matthew Cheale Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.07 OS:Windows (Win32)
Assigned to: CPU Architecture:Any

[27 Feb 2006 11:31] Matthew Cheale
Description:
C# Web Service so using .Net 2.0.

How to repeat:
Create a row in the database with a blank date '0000-00-00'.

try
{
MySqlConnection oDbConn = new MySqlConnection();
oDbConn.ConnectionString = "Server=<server>;Uid=<uid>;Pwd=<pwd>;Database=<db>;";
oDbConn.Open();
MySqlCommand oDbCmd = new MySqlCommand( "SELECT `date` FROM `table` WHERE `id` = ?id", oDbConn );
oDbCmd.Prepare();
oDbCmd.Parameters.Add( "id", 1 );
MySqlDataReader oDbRes = oDbCmd.ExecuteReader();
oDbRes.Read();
oDbRes.Close();
oDbCmd.Dispose();
oDbConn.Close();
oDbConn.Dispose();
return true;
}
catch( Exception e )
{
return false;
}

Suggested fix:
Anything other than a hang, throw an Exception or create an uninitialised DateTime object.
[27 Feb 2006 13:49] MySQL Verification Team
verified that a hang occurs with date field of '0000-00-00'. Testcase attached (internal only).
[1 Jun 2006 21:41] 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/7185
[30 Aug 2006 19:36] Reggie Burnett
pushed to 1.0.8
[4 Sep 2006 14:06] MC Brown
A note has been added to the 1.0.8 changelog.