List:Commits« Previous MessageNext Message »
From:rburnett Date:August 3 2007 5:44pm
Subject:Connector/NET commit: r837 - in branches/5.0: . Driver/Source TestSuite/Source
View as plain text  
Modified:
   branches/5.0/CHANGES
   branches/5.0/Driver/Source/datareader.cs
   branches/5.0/TestSuite/Source/DataReaderTests.cs
Log:
Fixed problem where attempting to load a reader into a datatable using a table with a multi-column primary key would result in multiple constraints being added to the datatable. No test case added to the 1.0 tree as loading a datatable with a reader is a .Net 2.0 thing. (Bug #30204)


Modified: branches/5.0/CHANGES
===================================================================
--- branches/5.0/CHANGES	2007-08-03 17:40:39 UTC (rev 836)
+++ branches/5.0/CHANGES	2007-08-03 17:44:45 UTC (rev 837)
@@ -39,7 +39,14 @@
     had to be changed to check for this.
   - Fixed problem where date columns that appear in keys caused updates to 
     fail (bug #30077)
-    
+  - Added code to suppress finalizers for low level socket objects and then
+    added a finalizer to the protocol object so pooled connections will get 
+    closed on process exit    
+  - Fixed problem where attempting to load a reader into a datatable using a table 
+	with a multi-column primary key would result in multiple constraints being added
+	to the datatable. No test case added to the 1.0 tree as loading a datatable
+	with a reader is a .Net 2.0 thing. (Bug #30204)
+          
 Version 5.0.7 5/16/2007
 
   Bugs fixed

Modified: branches/5.0/Driver/Source/datareader.cs
===================================================================
--- branches/5.0/Driver/Source/datareader.cs	2007-08-03 17:40:39 UTC (rev 836)
+++ branches/5.0/Driver/Source/datareader.cs	2007-08-03 17:44:45 UTC (rev 837)
@@ -605,7 +605,7 @@
 				r["AllowDBNull"] = f.AllowsNull;
 				r["IsReadOnly"] = false;
 				r["IsRowVersion"] = false;
-				r["IsUnique"] = f.IsUnique || f.IsPrimaryKey;
+				r["IsUnique"] = f.IsUnique;
 				r["IsKey"] = f.IsPrimaryKey;
 				r["IsAutoIncrement"] = f.IsAutoIncrement;
 				r["BaseSchemaName"] = f.DatabaseName;

Modified: branches/5.0/TestSuite/Source/DataReaderTests.cs
===================================================================
--- branches/5.0/TestSuite/Source/DataReaderTests.cs	2007-08-03 17:40:39 UTC (rev 836)
+++ branches/5.0/TestSuite/Source/DataReaderTests.cs	2007-08-03 17:44:45 UTC (rev 837)
@@ -855,5 +855,35 @@
                 Assert.IsFalse(reader.IsDBNull(1));
             }
         }
+
+        /// <summary>
+        /// Bug #30204  	Incorrect ConstraintException
+        /// </summary>
+        [Test]
+        public void ConstraintWithLoadingReader()
+        {
+            execSQL("DROP TABLE IF EXISTS test");
+            execSQL(@"CREATE TABLE test (ID_A int(11) NOT NULL,
+				ID_B int(11) NOT NULL, PRIMARY KEY (ID_A,ID_B)
+				) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
+
+            MySqlCommand cmd = new MySqlCommand("SELECT * FROM test", conn);
+            DataTable dt = new DataTable();
+
+            using (MySqlDataReader reader = cmd.ExecuteReader())
+            {
+                dt.Load(reader);
+            }
+
+            DataRow row = dt.NewRow();
+            row["ID_A"] = 2;
+            row["ID_B"] = 3;
+            dt.Rows.Add(row);
+
+            row = dt.NewRow();
+            row["ID_A"] = 2;
+            row["ID_B"] = 4;
+            dt.Rows.Add(row);
+        }
 	}
 }

Thread
Connector/NET commit: r837 - in branches/5.0: . Driver/Source TestSuite/Sourcerburnett3 Aug