Update row count as updates are received (#6642)

This commit is contained in:
Matthew McCune
2019-08-13 18:31:34 -07:00
committed by Karl Burtram
parent f48b9e1b41
commit b5fdf8c2a7
4 changed files with 24 additions and 0 deletions

View File

@@ -68,6 +68,7 @@ export interface IQueryModelService {
showCommitError(error: string): void;
onRunQueryStart: Event<string>;
onRunQueryUpdate: Event<string>;
onRunQueryComplete: Event<string>;
onQueryEvent: Event<IQueryEvent>;

View File

@@ -58,12 +58,14 @@ export class QueryModelService implements IQueryModelService {
// MEMBER VARIABLES ////////////////////////////////////////////////////
private _queryInfoMap: Map<string, QueryInfo>;
private _onRunQueryStart: Emitter<string>;
private _onRunQueryUpdate: Emitter<string>;
private _onRunQueryComplete: Emitter<string>;
private _onQueryEvent: Emitter<IQueryEvent>;
private _onEditSessionReady: Emitter<azdata.EditSessionReadyParams>;
// EVENTS /////////////////////////////////////////////////////////////
public get onRunQueryStart(): Event<string> { return this._onRunQueryStart.event; }
public get onRunQueryUpdate(): Event<string> { return this._onRunQueryUpdate.event; }
public get onRunQueryComplete(): Event<string> { return this._onRunQueryComplete.event; }
public get onQueryEvent(): Event<IQueryEvent> { return this._onQueryEvent.event; }
public get onEditSessionReady(): Event<azdata.EditSessionReadyParams> { return this._onEditSessionReady.event; }
@@ -75,6 +77,7 @@ export class QueryModelService implements IQueryModelService {
) {
this._queryInfoMap = new Map<string, QueryInfo>();
this._onRunQueryStart = new Emitter<string>();
this._onRunQueryUpdate = new Emitter<string>();
this._onRunQueryComplete = new Emitter<string>();
this._onQueryEvent = new Emitter<IQueryEvent>();
this._onEditSessionReady = new Emitter<azdata.EditSessionReadyParams>();
@@ -299,6 +302,17 @@ export class QueryModelService implements IQueryModelService {
this._fireQueryEvent(uri, 'start');
});
queryRunner.onResultSetUpdate(() => {
this._onRunQueryUpdate.fire(uri);
let event: IQueryEvent = {
type: 'queryUpdate',
uri: uri
};
this._onQueryEvent.fire(event);
this._fireQueryEvent(uri, 'update');
});
queryRunner.onQueryPlanAvailable(planInfo => {
// fire extensibility API event