From: Date: December 13 2006 5:46pm Subject: Connector/NET commit: r496 - trunk/TestSuite List-Archive: http://lists.mysql.com/commits/16892 X-Bug: 23862 Message-Id: <200612131646.kBDGkLfq002210@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: trunk/TestSuite/CommandBuilderTests.cs Log: Bug #23862 Problem with CommandBuilder 'GetInsertCommand' method This was not a bug in the 5.0 trunk but we added the test case anyway. Modified: trunk/TestSuite/CommandBuilderTests.cs =================================================================== --- trunk/TestSuite/CommandBuilderTests.cs 2006-12-13 16:41:57 UTC (rev 495) +++ trunk/TestSuite/CommandBuilderTests.cs 2006-12-13 16:46:21 UTC (rev 496) @@ -258,5 +258,42 @@ Assert.Fail(ex.Message); } } + + /// + /// Bug #23862 Problem with CommandBuilder 'GetInsertCommand' method + /// + [Test] + public void AutoIncrementColumnsOnInsert() + { + execSQL("DROP TABLE IF EXISTS test"); + execSQL("CREATE TABLE test (id INT UNSIGNED NOT NULL AUTO_INCREMENT, " + + "name VARCHAR(100), PRIMARY KEY(id))"); + MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM test", conn); + MySqlCommandBuilder cb = new MySqlCommandBuilder(da); + + DataTable dt = new DataTable(); + da.Fill(dt); + dt.Columns[0].AutoIncrement = true; + //Assert.IsTrue(dt.Columns[0].AutoIncrement); + dt.Columns[0].AutoIncrementSeed = -1; + dt.Columns[0].AutoIncrementStep = -1; + DataRow row = dt.NewRow(); + row["name"] = "Test"; + + try + { + dt.Rows.Add(row); + da.Update(dt); + } + catch (Exception ex) + { + Assert.Fail(ex.Message); + } + dt.Clear(); + da.Fill(dt); + Assert.AreEqual(1, dt.Rows.Count); + Assert.AreEqual(1, dt.Rows[0]["id"]); + Assert.AreEqual("Test", dt.Rows[0]["name"]); + } } }