mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-23 01:25:42 -05:00
Only register message handler once for GO N queries (#611)
This commit is contained in:
committed by
Karl Burtram
parent
7415c529f3
commit
b81ba929ba
@@ -242,6 +242,14 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
{
|
||||
await BatchStart(this);
|
||||
}
|
||||
|
||||
// Register the message listener to *this instance* of the batch
|
||||
// Note: This is being done to associate messages with batches
|
||||
ReliableSqlConnection sqlConn = conn as ReliableSqlConnection;
|
||||
if (sqlConn != null)
|
||||
{
|
||||
sqlConn.GetUnderlyingConnection().InfoMessage += ServerMessageHandler;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -262,7 +270,6 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
finally
|
||||
{
|
||||
// Remove the message event handler from the connection
|
||||
ReliableSqlConnection sqlConn = conn as ReliableSqlConnection;
|
||||
if (sqlConn != null)
|
||||
{
|
||||
sqlConn.GetUnderlyingConnection().InfoMessage -= ServerMessageHandler;
|
||||
@@ -438,9 +445,6 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
DbCommand dbCommand;
|
||||
if (sqlConn != null)
|
||||
{
|
||||
// Register the message listener to *this instance* of the batch
|
||||
// Note: This is being done to associate messages with batches
|
||||
sqlConn.GetUnderlyingConnection().InfoMessage += ServerMessageHandler;
|
||||
dbCommand = sqlConn.GetUnderlyingConnection().CreateCommand();
|
||||
|
||||
// Add a handler for when the command completes
|
||||
|
||||
Reference in New Issue
Block a user