Skip to content

Commit

Permalink
Fix Bug#27441433 - RESETREADER: MYSQLDATAREADER CANNOT OUTLIVE PARENT…
Browse files Browse the repository at this point in the history
… MYSQLCOMMAND SINCE 6.10

Removed the ResetReader method when a MySqlCommand object is disposed of, because it restricted access to the MySqlDataReader object after the MySqlCommand object closed
  • Loading branch information
davaldezr committed Jan 17, 2020
1 parent cfd96d2 commit 32e2faa
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -3,6 +3,7 @@
- Added support to handle Schema validation in the commands CreateCollection and ModifyCollection (WL13007)
- Added support for compressing data exchanged between the server and client when using the X Protocol. A new connection option,
compression, provides the following values: Preferred (Default), Required, Disabled (WL12980).
- Removed the ResetReader method when a MySqlCommand object is disposed of, because it restricted access to the MySqlDataReader object after the MySqlCommand object closed (MySQL Bug #89159, Oracle Bug #27441433).


8.0.19
Expand Down
2 changes: 0 additions & 2 deletions MySQL.Data/src/command.cs
Expand Up @@ -941,8 +941,6 @@ protected override void Dispose(bool disposing)
if (statement != null && statement.IsPrepared)
statement.CloseStatement();

ResetReader();

base.Dispose(disposing);

disposed = true;
Expand Down
23 changes: 23 additions & 0 deletions MySQL.Data/tests/MySql.Data.Tests/CmdTests.cs
Expand Up @@ -678,6 +678,29 @@ public void CloneCommand()
IDbCommand newCommand2 = (IDbCommand)(cmd as ICloneable).Clone();
}

/// <summary>
/// Bug 27441433 - RESETREADER: MYSQLDATAREADER CANNOT OUTLIVE PARENT MYSQLCOMMAND SINCE 6.10
/// </summary>
[Fact]
public void ExecuteReaderAfterClosingCommand()
{
MySqlDataReader reader;

using (MySqlConnection conn = new MySqlConnection(Connection.ConnectionString))
{
using (MySqlCommand cmd = new MySqlCommand("SELECT 'TEST'", conn))
{
conn.Open();
cmd.CommandType = CommandType.Text;
reader = cmd.ExecuteReader();
}

Assert.True(reader.Read());
Assert.Equal("TEST", reader.GetString(0));
Assert.False(reader.Read());
}
}

#region SQL Injection

/// <summary>
Expand Down

0 comments on commit 32e2faa

Please sign in to comment.