(type: azdata.queryeditor.QueryEvent, document: azdata.queryeditor.QueryDocument, args: any)
| 35 | // Issue #6374 created in ADS repository to track this ask |
| 36 | azdata.queryeditor.registerQueryEventListener({ |
| 37 | async onQueryEvent(type: azdata.queryeditor.QueryEvent, document: azdata.queryeditor.QueryDocument, args: any) { |
| 38 | if (type === 'visualize') { |
| 39 | const providerid = document.providerId; |
| 40 | const provider: azdata.QueryProvider = azdata.dataprotocol.getProvider(providerid, azdata.DataProviderType.QueryProvider); |
| 41 | const data = await provider.getQueryRows({ |
| 42 | ownerUri: document.uri, |
| 43 | batchIndex: args.batchId, |
| 44 | resultSetIndex: args.id, |
| 45 | rowsStartIndex: 0, |
| 46 | rowsCount: args.rowCount, |
| 47 | }); |
| 48 | |
| 49 | const rows = data.resultSubset.rows; |
| 50 | const columns = args.columnInfo; |
| 51 | const rowsCount = args.rowCount; |
| 52 | |
| 53 | // Create Json |
| 54 | const jsonArray: jsonType[] = []; |
| 55 | |
| 56 | interface jsonType { |
| 57 | [key: string]: any |
| 58 | } |
| 59 | |
| 60 | for (let row = 0; row < rowsCount; row++) { |
| 61 | const jsonObject: jsonType = {}; |
| 62 | for (let col = 0; col < columns.length; col++) { |
| 63 | if (!rows[row][col].isNull) { |
| 64 | jsonObject[columns[col].columnName] = rows[row][col].displayValue; |
| 65 | } |
| 66 | // If display value is null, don't do anything for now |
| 67 | } |
| 68 | jsonArray.push(jsonObject); |
| 69 | } |
| 70 | |
| 71 | viewInSandDance(() => { |
| 72 | return new Promise<string>(resolve => resolve(JSON.stringify(jsonArray))); |
| 73 | }, document.uri, 'json', context); |
| 74 | } |
| 75 | }, |
| 76 | }); |
| 77 | } |
| 78 |
nothing calls this directly
no test coverage detected