List:Commits« Previous MessageNext Message »
From:rburnett Date:April 24 2008 3:46pm
Subject:Connector/NET commit: r1257 - in branches/5.1: . Driver/Source/Types TestSuite/Source
View as plain text  
Modified:
   branches/5.1/CHANGES
   branches/5.1/Driver/Source/Types/MySqlBit.cs
   branches/5.1/TestSuite/Source/DataTypeTests.cs
Log:
 - Fixed problem where the bit data type would continue to return null values
   once it saw a null value in a previous row (bug #36313)      


Modified: branches/5.1/CHANGES
===================================================================
--- branches/5.1/CHANGES	2008-04-15 17:03:41 UTC (rev 1256)
+++ branches/5.1/CHANGES	2008-04-24 13:46:29 UTC (rev 1257)
@@ -10,6 +10,8 @@
  - Fixed problem with connections staying open after being used with SqlDataSource.
    The problem was that we were not returning an enumerator for our reader with the
    closeReader option set to true when we were supposed to.  (Bug #34460)
+ - Fixed problem where the bit data type would continue to return null values
+   once it saw a null value in a previous row (bug #36313)      
       
 Version 5.1.5 - 
   - Fixed problem with membership provider where FindUserByEmail would fail trying to add

Modified: branches/5.1/Driver/Source/Types/MySqlBit.cs
===================================================================
--- branches/5.1/Driver/Source/Types/MySqlBit.cs	2008-04-15 17:03:41 UTC (rev 1256)
+++ branches/5.1/Driver/Source/Types/MySqlBit.cs	2008-04-24 13:46:29 UTC (rev 1257)
@@ -87,11 +87,9 @@
 
 		public IMySqlValue ReadValue(MySqlStream stream, long length, bool isNull)
 		{
+            this.isNull = isNull;
 			if (isNull)
-			{
-				this.isNull = true;
 				return this;
-			}
 
 			if (buffer == null)
 				buffer = new byte[8];

Modified: branches/5.1/TestSuite/Source/DataTypeTests.cs
===================================================================
--- branches/5.1/TestSuite/Source/DataTypeTests.cs	2008-04-15 17:03:41 UTC (rev 1256)
+++ branches/5.1/TestSuite/Source/DataTypeTests.cs	2008-04-24 13:46:29 UTC (rev 1257)
@@ -842,5 +842,43 @@
             Assert.AreEqual(1, dt.Rows[0][2]);
             Assert.AreEqual(0, dt.Rows[1][2]);
         }
+
+        /// <summary>
+        /// Bug #36313 BIT result is lost in the left outer join 
+        /// </summary>
+        [Test]
+        public void BitInLeftOuterJoin()
+        {
+            execSQL("DROP TABLE IF EXISTS Main");
+            execSQL("DROP TABLE IF EXISTS Child");
+            execSQL(@"CREATE TABLE Main (Id int(10) unsigned NOT NULL AUTO_INCREMENT,
+                Descr varchar(45) NOT NULL, PRIMARY KEY (`Id`)) 
+                ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1");
+            execSQL(@"INSERT INTO Main (Id,Descr) VALUES (1,'AAA'), (2,'BBB'), (3,
'CCC')");
+
+            execSQL(@"CREATE TABLE Child (Id int(10) unsigned NOT NULL AUTO_INCREMENT,
+                MainId int(10) unsigned NOT NULL, Value int(10) unsigned NOT NULL,
+                Enabled bit(1) NOT NULL, PRIMARY KEY (`Id`)) 
+                ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1");
+            execSQL(@"INSERT INTO Child (Id, MainId, Value, Enabled) VALUES
(1,2,12345,0x01)");
+
+            MySqlDataAdapter da = new MySqlDataAdapter(
+                @"SELECT m.Descr, c.Value, c.Enabled FROM Main m 
+                LEFT OUTER JOIN Child c ON m.Id=c.MainId ORDER BY m.Descr", conn);
+            DataTable dt = new DataTable();
+            da.Fill(dt);
+            Assert.AreEqual(3, dt.Rows.Count);
+            Assert.AreEqual("AAA", dt.Rows[0][0]);
+            Assert.AreEqual("BBB", dt.Rows[1][0]);
+            Assert.AreEqual("CCC", dt.Rows[2][0]);
+
+            Assert.AreEqual(DBNull.Value, dt.Rows[0][1]);
+            Assert.AreEqual(12345, dt.Rows[1][1]);
+            Assert.AreEqual(DBNull.Value, dt.Rows[2][1]);
+
+            Assert.AreEqual(DBNull.Value, dt.Rows[0][2]);
+            Assert.AreEqual(1, dt.Rows[1][2]);
+            Assert.AreEqual(DBNull.Value, dt.Rows[2][2]);
+        }
 	}
 }

Thread
Connector/NET commit: r1257 - in branches/5.1: . Driver/Source/Types TestSuite/Sourcerburnett24 Apr