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

  861 Reggie Burnett	2011-02-15
      - fixed calculation of precision and scale for decimal columns
        (MySQL bug #59989, Oracle bug #11776346)

    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:11:26 +0000
+++ b/CHANGES	2011-02-15 21:04:25 +0000
@@ -26,6 +26,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.0.7
 - Fix authorization popup after modifying stored procedure in VS (Bug #44715)

=== modified file 'MySql.Data/Provider/Source/NativeDriver.cs'
--- a/MySql.Data/Provider/Source/NativeDriver.cs	2010-11-30 18:28:31 +0000
+++ b/MySql.Data/Provider/Source/NativeDriver.cs	2011-02-15 21:04:25 +0000
@@ -698,7 +698,7 @@
             field.Scale = (byte)packet.ReadByte();
             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-03-11 20:56:27 +0000
+++ b/MySql.Data/Tests/Source/DataReaderTests.cs	2011-02-15 21:04:25 +0000
@@ -151,15 +151,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())
@@ -172,6 +176,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"]);
             }
 		}
 


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110215210425-pa3699qvyldx12ou.bundle
Thread
bzr commit into connector-net-6.0 branch (reggie.burnett:861) Bug#59989Bug#11776346Reggie Burnett15 Feb