#At file:///C:/work/connector-net/6.1/ based on revid:reggie.burnett@stripped
852 Reggie Burnett 2010-09-17
- Added MySqlHelper.ExecuteReader that takes an external connection and array of paramters (bug #56755)
modified:
CHANGES
MySql.Data/Provider/Source/MySqlHelper.cs
=== modified file 'CHANGES'
=== modified file 'CHANGES'
--- a/CHANGES 2010-08-26 19:00:05 +0000
+++ b/CHANGES 2010-09-17 16:22:58 +0000
@@ -1,3 +1,5 @@
+- Added MySqlHelper.ExecuteReader that takes an external connection and array of paramters (bug #56755)
+
Version 6.1.5
- 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:03:33 +0000
+++ b/MySql.Data/Provider/Source/MySqlHelper.cs 2010-09-17 16:22:58 +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-20100917162258-8fgr6a4ntngxoku8.bundle
| Thread |
|---|
| • bzr commit into connector-net-6.1 branch (reggie.burnett:852) Bug#56755 | Reggie Burnett | 17 Sep |