List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:November 3 2009 6:01pm
Subject:bzr commit into connector-net-trunk branch (reggie.burnett:794)
Bug#48460
View as plain text  
#At file:///D:/bzr-connector-net/trunk/ based on revid:reggie.burnett@stripped

  794 Reggie Burnett	2009-11-03 [merge]
      - applied user-suggested patch to enable type-safe cloning (bug #48460)

    modified:
      CHANGES
      MySql.Data/Provider/Source/Connection.cs
      MySql.Data/Provider/Source/command.cs
      MySql.Data/Provider/Source/parameter.cs
      MySql.Data/Tests/Source/CommandTests.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2009-11-03 16:18:52 +0000
+++ b/CHANGES	2009-11-03 18:01:44 +0000
@@ -5,6 +5,7 @@
   considered a guid if it has a *character* length of 36, not a *byte* length of 36 (bug #47985)
 - fixed unsigned types in views when used as entities (bug # 47872) 
 - now exposing the MySqlDecimal type along with GetMySqlDecimal methods on data reader (bug #48100)    
+- applied user-suggested patch to enable type-safe cloning (bug #48460)
 
 Version 6.2.0
 - we now cleanup idle connections in the pool, if they were not used for too long

=== modified file 'MySql.Data/Provider/Source/Connection.cs'
--- a/MySql.Data/Provider/Source/Connection.cs	2009-10-22 15:27:25 +0000
+++ b/MySql.Data/Provider/Source/Connection.cs	2009-11-03 18:00:36 +0000
@@ -498,7 +498,7 @@
         /// Creates a new MySqlConnection object with the exact same ConnectionString value
         /// </summary>
         /// <returns>A cloned MySqlConnection object</returns>
-        object ICloneable.Clone()
+        public MySqlConnection Clone()
         {
             MySqlConnection clone = new MySqlConnection();
             string connectionString = settings.ConnectionString;
@@ -507,6 +507,11 @@
             return clone;
         }
 
+        object ICloneable.Clone()
+        {
+            return this.Clone();
+        }
+
         #endregion
 
         #region IDisposeable

=== modified file 'MySql.Data/Provider/Source/command.cs'
--- a/MySql.Data/Provider/Source/command.cs	2009-10-22 15:27:25 +0000
+++ b/MySql.Data/Provider/Source/command.cs	2009-11-03 18:00:36 +0000
@@ -703,24 +703,32 @@
 		#endregion
 
 		#region ICloneable
+
 		/// <summary>
 		/// Creates a clone of this MySqlCommand object.  CommandText, Connection, and Transaction properties
 		/// are included as well as the entire parameter list.
 		/// </summary>
 		/// <returns>The cloned MySqlCommand object</returns>
-		object ICloneable.Clone()
+		public MySqlCommand Clone()
 		{
 			MySqlCommand clone = new MySqlCommand(cmdText, connection, curTransaction);
             clone.CommandType = CommandType;
             clone.CommandTimeout = CommandTimeout;
             clone.batchableCommandText = batchableCommandText;
+            clone.UpdatedRowSource = UpdatedRowSource;
 
 			foreach (MySqlParameter p in parameters)
 			{
-				clone.Parameters.Add((p as ICloneable).Clone());
+				clone.Parameters.Add(p.Clone());
 			}
 			return clone;
 		}
+
+        object ICloneable.Clone()
+        {
+            return this.Clone();
+        }
+
 		#endregion
 
         #region Batching support

=== modified file 'MySql.Data/Provider/Source/parameter.cs'
--- a/MySql.Data/Provider/Source/parameter.cs	2009-07-13 18:01:18 +0000
+++ b/MySql.Data/Provider/Source/parameter.cs	2009-11-03 17:58:32 +0000
@@ -608,7 +608,7 @@
 
         #region ICloneable
 
-        object ICloneable.Clone()
+        public MySqlParameter Clone()
         {
             MySqlParameter clone = new MySqlParameter(paramName, mySqlDbType, direction,
                 sourceColumn, sourceVersion, paramValue);
@@ -617,6 +617,11 @@
             return clone;
         }
 
+        object ICloneable.Clone()
+        {
+            return this.Clone();
+        }
+
         #endregion
 
         /// <summary>

=== modified file 'MySql.Data/Tests/Source/CommandTests.cs'
--- a/MySql.Data/Tests/Source/CommandTests.cs	2009-09-24 21:59:05 +0000
+++ b/MySql.Data/Tests/Source/CommandTests.cs	2009-11-03 18:00:36 +0000
@@ -128,9 +128,9 @@
 		[Test]
 		public void CloneCommand() 
 		{
-			IDbCommand cmd = new MySqlCommand();
-			IDbCommand cmd2 = ((ICloneable)cmd).Clone() as IDbCommand;
-			cmd2.ToString();
+			MySqlCommand cmd = new MySqlCommand();
+            MySqlCommand newCommand = cmd.Clone();
+            IDbCommand newCommand2 = (IDbCommand)(cmd as ICloneable).Clone();
 		}
 
 		[Test]


Attachment: [text/bzr-bundle] bzr/reggie.burnett@sun.com-20091103180144-ibhk2jko2jaof6fv.bundle
Thread
bzr commit into connector-net-trunk branch (reggie.burnett:794)Bug#48460Reggie Burnett3 Nov