mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
change how query plan is handled (#2735)
This commit is contained in:
@@ -552,12 +552,6 @@ class GridTable<T> extends Disposable implements IView {
|
||||
|
||||
private loadData(offset: number, count: number): Thenable<T[]> {
|
||||
return this.runner.getQueryRows(offset, count, this.resultSet.batchId, this.resultSet.id).then(response => {
|
||||
if (this.runner.isQueryPlan) {
|
||||
// it's a show plan response
|
||||
if (response.resultSubset.rowCount === 1) {
|
||||
this.instantiationService.createInstance(ShowQueryPlanAction).run(response.resultSubset.rows[0][0].displayValue);
|
||||
}
|
||||
}
|
||||
return response.resultSubset.rows.map(r => {
|
||||
let dataWithSchema = {};
|
||||
// skip the first column since its a number column
|
||||
|
||||
@@ -203,6 +203,11 @@ export class QueryResultsView {
|
||||
if (!this._panelView.contains(this.qpTab)) {
|
||||
this._panelView.pushTab(this.qpTab);
|
||||
}
|
||||
} else if (queryRunner.isQueryPlan) {
|
||||
let disp = queryRunner.onResultSet(() => {
|
||||
this.showPlan(queryRunner.planXml);
|
||||
disp.dispose();
|
||||
});
|
||||
}
|
||||
if (this.input.state.activeTab) {
|
||||
this._panelView.showTab(this.input.state.activeTab);
|
||||
|
||||
@@ -72,6 +72,8 @@ export default class QueryRunner {
|
||||
private _isQueryPlan: boolean;
|
||||
|
||||
public get isQueryPlan(): boolean { return this._isQueryPlan; }
|
||||
private _planXml: string;
|
||||
public get planXml(): string { return this._planXml; }
|
||||
|
||||
private _onMessage = new Emitter<sqlops.IResultMessage>();
|
||||
private _debouncedMessage = debounceEvent<sqlops.IResultMessage, sqlops.IResultMessage[]>(this._onMessage.event, (l, e) => {
|
||||
@@ -338,6 +340,10 @@ export default class QueryRunner {
|
||||
} else {
|
||||
batchSet = this.batchSets[resultSet.batchId];
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
if (batchSet) {
|
||||
// Store the result set in the batch and emit that a result set has completed
|
||||
batchSet.resultSetSummaries[resultSet.id] = resultSet;
|
||||
|
||||
Reference in New Issue
Block a user