List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:September 17 2010 4:24pm
Subject:bzr commit into connector-net-6.2 branch (reggie.burnett:899)
View as plain text  
#At file:///C:/work/connector-net/6.2/ based on revid:reggie.burnett@stripped

  899 Reggie Burnett	2010-09-17 [merge]
      merged

    modified:
      CHANGES
      MySql.Data/Provider/Source/MySqlHelper.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES	2010-08-27 16:32:45 +0000
+++ b/CHANGES	2010-09-17 16:24:05 +0000
@@ -1,3 +1,5 @@
+- Added MySqlHelper.ExecuteReader that takes an external connection and array of paramters (bug #56755)
+
 Version 6.2.4
 - Fix authorization popup after modifying stored procedure in VS (Bug #44715)
 - Dispose EventLog after use in MySql.Web.dll provider classes, to avoid wasting resources

=== modified file 'MySql.Data/Provider/Source/MySqlHelper.cs'
--- a/MySql.Data/Provider/Source/MySqlHelper.cs	2010-08-18 19:48:34 +0000
+++ b/MySql.Data/Provider/Source/MySqlHelper.cs	2010-09-17 16:24:05 +0000
@@ -298,21 +298,29 @@
 		public static MySqlDataReader ExecuteReader(string connectionString, string commandText, params MySqlParameter[] commandParameters)
 		{
 			//create & open a SqlConnection
-			MySqlConnection cn = new MySqlConnection(connectionString);
-			cn.Open();
+			using (MySqlConnection cn = new MySqlConnection(connectionString))
+            {
+    			cn.Open();
 
-			try
-			{
 				//call the private overload that takes an internally owned connection in place of the connection string
-				return ExecuteReader(cn, null, commandText, commandParameters, false );
-			}
-			catch
-			{
-				//if we fail to return the SqlDatReader, we need to close the connection ourselves
-				cn.Close();
-				throw;
+				return ExecuteReader(cn, null, commandText, commandParameters, false);
 			}
 		}
+
+        /// <summary>
+        /// Executes a single command against a MySQL database.
+        /// </summary>
+        /// <param name="connection">Connection to use for the command</param>
+        /// <param name="commandText">Command text to use</param>
+        /// <param name="commandParameters">Array of <see cref="MySqlParameter"/> objects to use with the command</param>
+        /// <returns><see cref="MySqlDataReader"/> object ready to read the results of the command</returns>
+        public static MySqlDataReader ExecuteReader(MySqlConnection connection, string commandText, params MySqlParameter[] commandParameters)
+        {
+            //call the private overload that takes an internally owned connection in place of the connection string
+            return ExecuteReader(connection, null, commandText, commandParameters, true);
+        }
+
+
 		#endregion
 
 		#region ExecuteScalar


Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20100917162405-9trjh0q4e2bjyzvo.bundle
Thread
bzr commit into connector-net-6.2 branch (reggie.burnett:899) Reggie Burnett17 Sep