-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrunQuery.ts
More file actions
19 lines (14 loc) · 810 Bytes
/
Copy pathrunQuery.ts
File metadata and controls
19 lines (14 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
context.subscriptions.push(vscode.commands.registerCommand('extension.getDown', async () => {
let connection = await azdata.connection.getCurrentConnection();
let connectId = connection.connectionId;
if (connection && connectId) {
let query = `SELECT MAX(DOWNVOTES) AS DOWNVOTES
FROM USERS`;
let connectionUri = await azdata.connection.getUriForConnection(connectId);
let queryProvider = azdata.dataprotocol.getProvider<azdata.QueryProvider>(connection.providerId,azdata.DataProviderType.QueryProvider);
let results = await queryProvider.runQueryAndReturn(connectionUri, query);
let cell = results.rows[0][0];
let downvotes = cell.displayValue;
vscode.window.showInformationMessage('The max downvotes is: '+downvotes);
}
}));