From 76282ed1ef5ea6e294192fc3e63f08e9184be5b3 Mon Sep 17 00:00:00 2001 From: Anthony Dresser Date: Tue, 16 Oct 2018 18:12:01 -0700 Subject: [PATCH] Look for showplan colum name (#2919) * change method for finding show plan through column name * formatting --- src/sql/parts/query/execution/queryRunner.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sql/parts/query/execution/queryRunner.ts b/src/sql/parts/query/execution/queryRunner.ts index b0450ce27b..2e7c6f1808 100644 --- a/src/sql/parts/query/execution/queryRunner.ts +++ b/src/sql/parts/query/execution/queryRunner.ts @@ -343,7 +343,11 @@ export default class QueryRunner { } // handle getting queryPlanxml if we need too if (this.isQueryPlan) { - this.getQueryRows(0, 1, 0, 0).then(e => this._planXml.resolve(e.resultSubset.rows[0][0].displayValue)); + // check if this result has show plan, this needs work, it won't work for any other provider + let hasShowPlan = !!result.resultSetSummary.columnInfo.find(e => e.columnName === 'Microsoft SQL Server 2005 XML Showplan'); + if (hasShowPlan) { + this.getQueryRows(0, 1, result.resultSetSummary.batchId, result.resultSetSummary.id).then(e => this._planXml.resolve(e.resultSubset.rows[0][0].displayValue)); + } } if (batchSet) { // Store the result set in the batch and emit that a result set has completed