Skip to content

Commit 7978248

Browse files
committed
Add job id to result set footer
Signed-off-by: worksofliam <[email protected]>
1 parent 3da0967 commit 7978248

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

src/connection/query.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ export class Query<T> {
152152
}
153153
}
154154

155+
public getHostJob(): SQLJob {
156+
return this.job;
157+
}
158+
155159
public getId(): string {
156160
return this.correlationId;
157161
}

src/views/results/html.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export function generateScroller(basicSelect: string, isCL: boolean): string {
5454
const basicSelect = ${JSON.stringify(basicSelect)};
5555
const htmlTableId = 'resultset';
5656
const statusId = 'status';
57+
const jobId = 'jobId';
5758
const messageSpanId = 'messageSpan';
5859
5960
let myQueryId = '';
@@ -96,10 +97,15 @@ export function generateScroller(basicSelect: string, isCL: boolean): string {
9697
appendRows(data.rows);
9798
}
9899
100+
if (data.jobId) {
101+
102+
}
103+
99104
if (data.rows === undefined && totalRows === 0) {
100105
document.getElementById(messageSpanId).innerText = 'Statement executed with no result set returned. Rows affected: ' + data.update_count;
101106
} else {
102-
document.getElementById(statusId).innerText = noMoreRows ? ('Loaded ' + totalRows + '. End of data') : ('Loaded ' + totalRows + '. More available.');
107+
document.getElementById(statusId).innerText = noMoreRows ? ('Loaded ' + totalRows + '. End of data.') : ('Loaded ' + totalRows + '. More available.');
108+
document.getElementById(jobId).innerText = data.jobId ? data.jobId : '';
103109
document.getElementById(messageSpanId).style.visibility = "hidden";
104110
}
105111
break;
@@ -135,10 +141,20 @@ export function generateScroller(basicSelect: string, isCL: boolean): string {
135141
// Initialize the footer
136142
var footer = document.getElementById(htmlTableId).getElementsByTagName('tfoot')[0];
137143
footer.innerHTML = '';
138-
var newCell = footer.insertRow().insertCell();
139-
newCell.colSpan = columns.length;
140-
newCell.id = statusId;
141-
newCell.appendChild(document.createTextNode(' '));
144+
const newRow = footer.insertRow();
145+
146+
const statusCell = newRow.insertCell();
147+
statusCell.id = statusId;
148+
statusCell.appendChild(document.createTextNode(' '));
149+
150+
const jobIdCell = newRow.insertCell();
151+
jobIdCell.id = jobId;
152+
jobIdCell.appendChild(document.createTextNode(' '));
153+
154+
if (columns.length > 2) {
155+
statusCell.colSpan = 2;
156+
jobIdCell.colSpan = columns.length - 2;
157+
}
142158
}
143159
144160
function appendRows(rows) {

src/views/results/resultSetPanelProvider.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ export class ResultSetPanelProvider implements WebviewViewProvider {
4141

4242
let queryResults = queryObject.getState() == QueryState.RUN_MORE_DATA_AVAILABLE ? await queryObject.fetchMore() : await queryObject.run();
4343

44+
const jobId = queryObject.getHostJob().id;
45+
4446
data = queryResults.data;
4547
this._view.webview.postMessage({
4648
command: `rows`,
49+
jobId,
4750
rows: queryResults.data,
4851
columnList: queryResults.metadata ? queryResults.metadata.columns.map(x => x.name) : undefined, // Query.fetchMore() doesn't return the metadata
4952
queryId: queryObject.getId(),

0 commit comments

Comments
 (0)