List:Commits« Previous MessageNext Message »
From:rburnett Date:July 22 2008 9:20pm
Subject:Connector/NET commit: r1350 - in branches/5.2: . MySql.Data/Provider/Source MySql.Data/Provider/Source/Types MySql.Data/Tests/Source
View as plain text  
Modified:
   branches/5.2/CHANGES
   branches/5.2/MySql.Data/Provider/Source/Types/MySqlDouble.cs
   branches/5.2/MySql.Data/Provider/Source/Types/MySqlSingle.cs
   branches/5.2/MySql.Data/Provider/Source/command.cs
   branches/5.2/MySql.Data/Tests/Source/CommandTests.cs
   branches/5.2/MySql.Data/Tests/Source/DataTypeTests.cs
Log:
merged

Modified: branches/5.2/CHANGES
===================================================================
--- branches/5.2/CHANGES	2008-07-22 19:16:42 UTC (rev 1349)
+++ branches/5.2/CHANGES	2008-07-22 19:20:16 UTC (rev 1350)
@@ -89,7 +89,9 @@
  - Improved documentation concerning autoincrement columns and the DataColumn class (bug
#37350)
  - Fixed problem where executing a command that results in a fatal exception would not
    close the connection.  (bug #37991)
-
+ - Fixed problem where executing a command with a null connection object would result in
+   a null reference exception instead of an InvalidOp (bug #38276)
+   
 Version 5.1.6 
  - Fixed problem where parameters lists were not showing when you tried to alter a
routine 
    in server explorer.  (bug #34359)
@@ -231,6 +233,8 @@
     close the connection.  (bug #37991)
   - Fixed problem with byte and unsigned byte values writing more too many bytes when
     using prepared statements (bug #37968)      
+  - Fixed writing of single and double values to write out the proper number of digits
+    (bug #33322)
         
 Version 5.0.9 - 4/14/08
 

Modified: branches/5.2/MySql.Data/Provider/Source/Types/MySqlDouble.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/Types/MySqlDouble.cs	2008-07-22 19:16:42 UTC
(rev 1349)
+++ branches/5.2/MySql.Data/Provider/Source/Types/MySqlDouble.cs	2008-07-22 19:20:16 UTC
(rev 1350)
@@ -86,7 +86,7 @@
 			if (binary)
 				stream.Write(BitConverter.GetBytes(v));
 			else
-				stream.WriteStringNoNull(v.ToString(
+				stream.WriteStringNoNull(v.ToString("R",
 					 CultureInfo.InvariantCulture));
 		}
 

Modified: branches/5.2/MySql.Data/Provider/Source/Types/MySqlSingle.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/Types/MySqlSingle.cs	2008-07-22 19:16:42 UTC
(rev 1349)
+++ branches/5.2/MySql.Data/Provider/Source/Types/MySqlSingle.cs	2008-07-22 19:20:16 UTC
(rev 1350)
@@ -85,7 +85,7 @@
 			if (binary)
 				stream.Write(BitConverter.GetBytes(v));
 			else
-				stream.WriteStringNoNull(v.ToString(
+				stream.WriteStringNoNull(v.ToString("R", 
 					 CultureInfo.InvariantCulture));
 		}
 

Modified: branches/5.2/MySql.Data/Provider/Source/command.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/command.cs	2008-07-22 19:16:42 UTC (rev 1349)
+++ branches/5.2/MySql.Data/Provider/Source/command.cs	2008-07-22 19:20:16 UTC (rev 1350)
@@ -286,11 +286,13 @@
 		/// </summary>
 		private void CheckState()
 		{
-			// There must be a valid and open connection.
-			if ((connection == null || connection.State != ConnectionState.Open) && 
-                !connection.SoftClosed)
-				throw new InvalidOperationException("Connection must be valid and open");
+            // There must be a valid and open connection.
+            if (connection == null)
+                throw new InvalidOperationException("Connection must be valid and
open.");
 
+            if (connection.State != ConnectionState.Open &&
!connection.SoftClosed)
+                throw new InvalidOperationException("Connection must be valid and
open.");
+
 			// Data readers have to be closed first
 			if (connection.Reader != null && cursorPageSize == 0)
 				throw new MySqlException("There is already an open DataReader associated with this
Connection which must be closed first.");

Modified: branches/5.2/MySql.Data/Tests/Source/CommandTests.cs
===================================================================
--- branches/5.2/MySql.Data/Tests/Source/CommandTests.cs	2008-07-22 19:16:42 UTC (rev
1349)
+++ branches/5.2/MySql.Data/Tests/Source/CommandTests.cs	2008-07-22 19:20:16 UTC (rev
1350)
@@ -426,6 +426,24 @@
             cmd.Connection = c;
             Assert.AreEqual(66, cmd.CommandTimeout);
         }
+
+        /// <summary>
+        /// Bug #38276 Short circuit evaluation error in MySqlCommand.CheckState() 
+        /// </summary>
+        [Test]
+        public void SetNullConnection()
+        {
+            MySqlCommand command = new MySqlCommand();
+            command.CommandText = "SELECT 1";
+            command.Connection = null;
+            try
+            {
+                object o = command.ExecuteScalar();
+            }
+            catch (InvalidOperationException)
+            {
+            }
+        }
     }
 
 

Modified: branches/5.2/MySql.Data/Tests/Source/DataTypeTests.cs
===================================================================
--- branches/5.2/MySql.Data/Tests/Source/DataTypeTests.cs	2008-07-22 19:16:42 UTC (rev
1349)
+++ branches/5.2/MySql.Data/Tests/Source/DataTypeTests.cs	2008-07-22 19:20:16 UTC (rev
1350)
@@ -953,5 +953,28 @@
                 reader.Read();
             }
         }
+
+        /// <summary>
+        /// Bug #33322 Incorrect Double/Single value saved to MySQL database using MySQL
Connector for  
+        /// </summary>
+        [Test]
+        public void StoringAndRetrievingDouble()
+        {
+            execSQL("DROP TABLE IF EXISTS Test");
+            execSQL("CREATE TABLE Test (v DOUBLE(25,20) NOT NULL)");
+
+            MySqlCommand cmd = new MySqlCommand("INSERT INTO Test VALUES (?v)", conn);
+            cmd.Parameters.Add("?v", MySqlDbType.Double);
+            cmd.Parameters[0].Value = Math.PI;
+            cmd.ExecuteNonQuery();
+
+            cmd.CommandText = "SELECT * FROM Test";
+            using (MySqlDataReader reader = cmd.ExecuteReader())
+            {
+                reader.Read();
+                double d = reader.GetDouble(0);
+                Assert.AreEqual(Math.PI, d);
+            }
+        }
     }
 }

Thread
Connector/NET commit: r1350 - in branches/5.2: . MySql.Data/Provider/Source MySql.Data/Provider/Source/Types MySql.Data/Tests/Sourcerburnett22 Jul