move event to better understand when things are happening (#4393)

This commit is contained in:
Anthony Dresser
2019-03-12 13:19:08 -07:00
committed by Karl Burtram
parent 2557d77ae3
commit 839a9b6cb8

View File

@@ -72,6 +72,7 @@ export default class QueryRunner extends Disposable {
private _batchSets: azdata.BatchSummary[] = [];
private _messages: azdata.IResultMessage[] = [];
private _eventEmitter = new EventEmitter();
private registered = false;
private _isQueryPlan: boolean;
public get isQueryPlan(): boolean { return this._isQueryPlan; }
@@ -207,6 +208,8 @@ export default class QueryRunner extends Disposable {
this._isQueryPlan = false;
}
this._onQueryStart.fire();
// Send the request to execute the query
return runCurrentStatement
? this._queryManagementService.runQueryStatement(this.uri, input.startLine, input.startColumn).then(() => this.handleSuccessRunQueryResult(), e => this.handleFailureRunQueryResult(e))
@@ -226,9 +229,11 @@ export default class QueryRunner extends Disposable {
// this isn't exact, but its the best we can do
this._queryStartTime = new Date();
// The query has started, so lets fire up the result pane
this._onQueryStart.fire();
this._eventEmitter.emit(EventType.START);
this._queryManagementService.registerRunner(this, this.uri);
if (!this.registered) {
this.registered = true;
this._queryManagementService.registerRunner(this, this.uri);
}
}
private handleFailureRunQueryResult(error: any) {