Handle query plan flow problems (#2918)

* modify the query plan work flow to account for some errors

* formatting
This commit is contained in:
Anthony Dresser
2018-10-16 16:15:47 -07:00
committed by Karl Burtram
parent 425eecf692
commit bfa9e8c495
3 changed files with 63 additions and 62 deletions

View File

@@ -26,6 +26,7 @@ import { Emitter, Event } from 'vs/base/common/event';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ResultSerializer } from 'sql/parts/query/common/resultSerializer';
import { TPromise } from 'vs/base/common/winjs.base';
import { Deferred } from 'sql/base/common/promise';
export interface IEditSessionReadyEvent {
ownerUri: string;
@@ -69,11 +70,11 @@ export default class QueryRunner {
private _hasCompleted: boolean = false;
private _batchSets: sqlops.BatchSummary[] = [];
private _eventEmitter = new EventEmitter();
private _isQueryPlan: boolean;
private _isQueryPlan: boolean;
public get isQueryPlan(): boolean { return this._isQueryPlan; }
private _planXml: string;
public get planXml(): string { return this._planXml; }
private _planXml = new Deferred<string>();
public get planXml(): Thenable<string> { return this._planXml.promise; }
private _onMessage = new Emitter<sqlops.IResultMessage>();
private _debouncedMessage = debounceEvent<sqlops.IResultMessage, sqlops.IResultMessage[]>(this._onMessage.event, (l, e) => {
@@ -342,7 +343,7 @@ export default class QueryRunner {
}
// handle getting queryPlanxml if we need too
if (this.isQueryPlan) {
this.getQueryRows(0, 1, 0, 0).then(e => this._planXml = e.resultSubset.rows[0][0].displayValue);
this.getQueryRows(0, 1, 0, 0).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