mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Fix for cancel query by adding synchronous readers. (#1246)
* added WIP sync execute method * added syncexecuteonce * replaced executeonce with synchronous reading * removed batch.cs change * restore space
This commit is contained in:
@@ -421,14 +421,14 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
|||||||
// key columns in the result set, even if they weren't part of the select statement.
|
// key columns in the result set, even if they weren't part of the select statement.
|
||||||
// Extra key columns get added to the end, so just correlate via Column Ordinal.
|
// Extra key columns get added to the end, so just correlate via Column Ordinal.
|
||||||
columnSchemas = new List<DbColumn[]>();
|
columnSchemas = new List<DbColumn[]>();
|
||||||
using (DbDataReader reader = await dbCommand.ExecuteReaderAsync(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly, cancellationToken))
|
using (DbDataReader reader = dbCommand.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly))
|
||||||
{
|
{
|
||||||
if (reader != null && reader.CanGetColumnSchema())
|
if (reader != null && reader.CanGetColumnSchema())
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
columnSchemas.Add(reader.GetColumnSchema().ToArray());
|
columnSchemas.Add(reader.GetColumnSchema().ToArray());
|
||||||
} while (await reader.NextResultAsync(cancellationToken));
|
} while (reader.NextResult());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -436,7 +436,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
|||||||
ConnectionService.EnsureConnectionIsOpen(conn);
|
ConnectionService.EnsureConnectionIsOpen(conn);
|
||||||
|
|
||||||
// Execute the command to get back a reader
|
// Execute the command to get back a reader
|
||||||
using (DbDataReader reader = await dbCommand.ExecuteReaderAsync(cancellationToken))
|
using (DbDataReader reader = dbCommand.ExecuteReader())
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -464,7 +464,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
|||||||
// Read until we hit the end of the result set
|
// Read until we hit the end of the result set
|
||||||
await resultSet.ReadResultToEnd(reader, cancellationToken);
|
await resultSet.ReadResultToEnd(reader, cancellationToken);
|
||||||
|
|
||||||
} while (await reader.NextResultAsync(cancellationToken));
|
} while (reader.NextResult());
|
||||||
|
|
||||||
// If there were no messages, for whatever reason (NO COUNT set, messages
|
// If there were no messages, for whatever reason (NO COUNT set, messages
|
||||||
// were emitted, records returned), output a "successful" message
|
// were emitted, records returned), output a "successful" message
|
||||||
|
|||||||
Reference in New Issue
Block a user