Bug #6975 MySqlDataAdapter.Fill locks up with null or blank fields
Submitted: 3 Dec 2004 4:32 Modified: 7 Dec 2004 17:00
Reporter: Mark White Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:1.0.2-gamma OS:Windows (Windows XP)
Assigned to: Reggie Burnett CPU Architecture:Any

[3 Dec 2004 4:32] Mark White
Description:
MySqlDataAdapter.Fill works when the table has data in every column.  It does not work with a table that has blanks or nulls in any of the columns.  The MySqlDataAdapter.Fill never returns. 

version v1.0.0-beta and ByteFX would not lockup under this condition.  v1.0.0-beta would skip rows after the first row with a null.  (For v1.0.0-beta I worked around that by adding 'NOT NULL' to my columns)

MySql.Data.MySqlClient.MySqlDataAdapter DAMySQLDb = new MySql.Data.MySqlClient.MySqlDataAdapter(sql,connDBMySql);

DAMySQLDb.Fill(sqlDS, dsName);

How to repeat:
Create a table and add rows to it that have blank or null for some of the columns.  Try to load the columns with data and nulls / blanks with the Fill() command.

Suggested fix:
MySqlDataAdapter.Fill correctly returns with data if there are blank or null fields in rows.
[7 Dec 2004 17:00] Reggie Burnett
Thank you for taking the time to report a problem.  Unfortunately
you are not using a current version of the product your reported a
problem with -- the problem might already be fixed. Please download
a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions,
please change the version on this bug report to the version you
tested and change the status back to "Open".  Again, thank you for
your continued support of MySQL.

Additional info:

Mark

I fixed another bug this morning that would cause a data reader to "stall" when multiple resultsets are returned.  Perhaps this is what you are seeing?

In any event, I have a test case that inserts nulls into a table and then reads them back in using .Fill() and it works ok.  Here is the test case.  If you are able to modify this to show the problem, please let me know.  Thanks!

		[Test()]
		public void TestFill()
		{
			execSQL("INSERT INTO Test (id, id2, name, dt) VALUES (NULL, 1, 'Name 1', Now())");
			execSQL("INSERT INTO Test (id, id2, name, dt) VALUES (NULL, 2, NULL, Now())");
			execSQL("INSERT INTO Test (id, id2, name, dt) VALUES (NULL, 3, 'Name 3', Now())");

			MySqlDataAdapter da = new MySqlDataAdapter("select * from Test", conn);
			DataSet ds = new DataSet();
			da.Fill( ds, "Test" );

			Assert.AreEqual( 1, ds.Tables.Count );
			Assert.AreEqual( 3, ds.Tables[0].Rows.Count );

			Assert.AreEqual( 1, ds.Tables[0].Rows[0]["id"] );
			Assert.AreEqual( 2, ds.Tables[0].Rows[1]["id"] );
			Assert.AreEqual( 3, ds.Tables[0].Rows[2]["id"] );

			Assert.AreEqual( 1, ds.Tables[0].Rows[0]["id2"] );
			Assert.AreEqual( 2, ds.Tables[0].Rows[1]["id2"] );
			Assert.AreEqual( 3, ds.Tables[0].Rows[2]["id2"] );

			Assert.AreEqual( "Name 1", ds.Tables[0].Rows[0]["name"] );
			Assert.AreEqual( DBNull.Value, ds.Tables[0].Rows[1]["name"] );
			Assert.AreEqual( "Name 3", ds.Tables[0].Rows[2]["name"] );
		}