Skip to content

Commit a529ee0

Browse files
committed
Revert "Reduce allocations when executing a command."
This reverts commit 266fe62.
1 parent 3260706 commit a529ee0

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

src/MySqlConnector/Core/ServerSession.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public ServerSession(ConnectionPool? pool, int poolGeneration, int id)
4545
Pool = pool;
4646
PoolGeneration = poolGeneration;
4747
HostName = "";
48-
SingleCommandList = new IMySqlCommand[1];
4948
m_logArguments = new object?[] { "{0}".FormatInvariant(Id), null };
5049
Log.Debug("Session{0} created new session", m_logArguments);
5150
}
@@ -66,7 +65,6 @@ public ServerSession(ConnectionPool? pool, int poolGeneration, int id)
6665
public bool SupportsDeprecateEof => m_supportsDeprecateEof;
6766
public bool SupportsSessionTrack => m_supportsSessionTrack;
6867
public bool ProcAccessDenied { get; set; }
69-
public IMySqlCommand[] SingleCommandList { get; }
7068

7169
public void ReturnToPool()
7270
{

src/MySqlConnector/MySql.Data.MySqlClient/MySqlCommand.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,7 @@ internal async Task<DbDataReader> ExecuteReaderAsync(CommandBehavior behavior, I
267267
throw exception;
268268

269269
m_commandBehavior = behavior;
270-
var commandList = m_connection!.Session.SingleCommandList;
271-
var oldCommand = commandList[0];
272-
try
273-
{
274-
commandList[0] = this;
275-
return await CommandExecutor.ExecuteReaderAsync(commandList, SingleCommandPayloadCreator.Instance, behavior, ioBehavior, cancellationToken).ConfigureAwait(false);
276-
}
277-
finally
278-
{
279-
commandList[0] = oldCommand;
280-
}
270+
return await CommandExecutor.ExecuteReaderAsync(new IMySqlCommand[] { this }, SingleCommandPayloadCreator.Instance, behavior, ioBehavior, cancellationToken).ConfigureAwait(false);
281271
}
282272

283273
public MySqlCommand Clone() => new MySqlCommand(this);

0 commit comments

Comments
 (0)