Work around edit data trailing comment bug (#641)

* Work around edit data trailing comment bug

* Use Environment.NewLine
This commit is contained in:
Matt Irvine
2018-06-18 17:39:25 -07:00
committed by Karl Burtram
parent 7322854c7b
commit f244d307e2

View File

@@ -358,6 +358,11 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
List<DbColumn[]> columnSchemas = null;
if (getFullColumnSchema)
{
// Executing the same query twice with different command behavior causes the second
// execution to return no rows if there's a trailing comment with no newline after,
// so add a newline to the end of the query. See https://github.com/Microsoft/sqlopsstudio/issues/1424
dbCommand.CommandText += Environment.NewLine;
// Fetch schema info separately, since CommandBehavior.KeyInfo will include primary
// 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.