Ensure all result set names are loaded

When the extension loads a sorted result set, it takes a shortcut and
avoids loads a file with only the bqrs results for that sorted table.

However, it does not load the results for any other table. This causes
result set names to go away. This change ensures that if we are loading
a sorted table, we also load the result set names for all other tables
in that query.

Fixes #1005.
This commit is contained in:
Andrew Eisenberg
2021-11-17 09:37:42 -08:00
parent d579cd6541
commit 98312a72a7

View File

@@ -365,8 +365,7 @@ export class InterfaceManager extends DisposableObject {
const showButton = 'View Results';
const queryName = results.queryName;
const resultPromise = vscode.window.showInformationMessage(
`Finished running query ${
queryName.length > 0 ? ` "${queryName}"` : ''
`Finished running query ${queryName.length > 0 ? ` "${queryName}"` : ''
}.`,
showButton
);
@@ -502,7 +501,12 @@ export class InterfaceManager extends DisposableObject {
);
const resultSetSchemas = await this.getResultSetSchemas(results, sorted ? selectedTable : '');
const resultSetNames = resultSetSchemas.map(schema => schema.name);
// If there is a specific sorted table selected, a different bqrs file is loaded that doesn't have all the result set names.
// Make sure that we load all result set names here.
// See https://github.com/github/vscode-codeql/issues/1005
const allResultSetSchemas = sorted ? await this.getResultSetSchemas(results, '') : resultSetSchemas;
const resultSetNames = allResultSetSchemas.map(schema => schema.name);
const schema = resultSetSchemas.find(
(resultSet) => resultSet.name == selectedTable