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

@@ -76,7 +76,7 @@ class ResultsView implements IPanelView {
this.panelViewlet.resizePanel(this.gridPanel, this.state.messagePanelSize);
}
this.panelViewlet.resizePanel(this.gridPanel, panelSize);
})
});
// once the user changes the sash we should stop trying to resize the grid
once(this.panelViewlet.onDidSashChange)(e => {
this.needsGridResize = false;
@@ -204,9 +204,11 @@ export class QueryResultsView {
this._panelView.pushTab(this.qpTab);
}
}
this.runnerDisposables.push(queryRunner.onResultSet(() => {
this.runnerDisposables.push(queryRunner.onQueryEnd(() => {
if (queryRunner.isQueryPlan) {
this.showPlan(queryRunner.planXml);
queryRunner.planXml.then(e => {
this.showPlan(e);
});
}
}));
if (this.input.state.activeTab) {

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