List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:February 15 2011 9:07pm
Subject:bzr commit into connector-net-trunk branch (reggie.burnett:965)
View as plain text  
#At file:///C:/Users/Reggie/work/connector-net/6.3/ based on revid:reggie.burnett@stripped

  965 Reggie Burnett	2011-02-15 [merge]
      merged

    modified:
      CHANGES
      MySql.Data/Provider/Source/NativeDriver.cs
      MySql.Data/Tests/Source/DataReaderTests.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2011-02-14 21:14:52 +0000
+++ b/CHANGES	2011-02-15 21:07:24 +0000
@@ -5,6 +5,8 @@
   (MySQL bug #59438, Oracle bug #11770465)
 - fixed MySqlConnectionStringBuilder.ContainsKey to return true for any alternative versions
   of a keyword (MySQL bug #59835, Oracle bug #11766671)
+- fixed calculation of precision and scale for decimal columns
+  (MySQL bug #59989, Oracle bug #11776346)
 
 Version 6.3.6
 - Fixed TracingDriver so that it normalizes long queries before truncation so we don't get exceptions     

=== modified file 'MySql.Data/Provider/Source/NativeDriver.cs'
--- a/MySql.Data/Provider/Source/NativeDriver.cs	2010-11-30 18:33:23 +0000
+++ b/MySql.Data/Provider/Source/NativeDriver.cs	2011-02-15 21:07:24 +0000
@@ -703,7 +703,7 @@
 
             if (type == MySqlDbType.Decimal || type == MySqlDbType.NewDecimal)
             {
-                field.Precision = (byte)(field.ColumnLength - (int)field.Scale);
+                field.Precision = (byte)(field.ColumnLength - 2);
                 if ((colFlags & ColumnFlags.UNSIGNED) != 0)
                     field.Precision++;
             }

=== modified file 'MySql.Data/Tests/Source/DataReaderTests.cs'
--- a/MySql.Data/Tests/Source/DataReaderTests.cs	2010-08-18 19:48:34 +0000
+++ b/MySql.Data/Tests/Source/DataReaderTests.cs	2011-02-15 21:06:20 +0000
@@ -153,15 +153,19 @@
             }
 		}
 
+        /// <summary>
+        /// Bug #59989	MysqlDataReader.GetSchemaTable returns incorrect Values an types
+        /// </summary>
 		[Test]
 		public void GetSchema() 
 		{
-			string sql = "CREATE TABLE test2(id INT UNSIGNED AUTO_INCREMENT " +
-                "NOT NULL, name VARCHAR(255) NOT NULL, name2 VARCHAR(40), fl FLOAT, " +
-                "dt DATETIME, PRIMARY KEY(id))";
+			string sql = @"CREATE TABLE test2(id INT UNSIGNED AUTO_INCREMENT 
+                NOT NULL, name VARCHAR(255) NOT NULL, name2 VARCHAR(40), fl FLOAT, 
+                dt DATETIME, `udec` DECIMAL(20,6) unsigned,
+                `dec` DECIMAL(44,3), bt boolean, PRIMARY KEY(id))";
 
 			execSQL(sql);
-			execSQL("INSERT INTO test2 VALUES(1,'Test', 'Test', 1.0, now())");
+			execSQL("INSERT INTO test2 VALUES(1,'Test', 'Test', 1.0, now(), 20.0, 12.324, True)");
 
 			MySqlCommand cmd = new MySqlCommand("SELECT * FROM test2", conn);
             using (MySqlDataReader reader = cmd.ExecuteReader())
@@ -174,6 +178,16 @@
                 Assert.AreEqual(false, dt.Rows[1]["AllowDBNull"], "Checking AllowDBNull");
                 Assert.AreEqual(255, dt.Rows[1]["ColumnSize"]);
                 Assert.AreEqual(40, dt.Rows[2]["ColumnSize"]);
+
+                // udec column
+                Assert.AreEqual(21, dt.Rows[5]["ColumnSize"]);
+                Assert.AreEqual(20, dt.Rows[5]["NumericPrecision"]);
+                Assert.AreEqual(6, dt.Rows[5]["NumericScale"]);
+
+                // dec column
+                Assert.AreEqual(46, dt.Rows[6]["ColumnSize"]);
+                Assert.AreEqual(44, dt.Rows[6]["NumericPrecision"]);
+                Assert.AreEqual(3, dt.Rows[6]["NumericScale"]);
             }
 		}
 

No bundle (reason: revision is a merge (you can force generation of a bundle with env var BZR_FORCE_BUNDLE=1)).
Thread
bzr commit into connector-net-trunk branch (reggie.burnett:965) Reggie Burnett15 Feb