Skip to content

Commit 5a5681d

Browse files
author
alexet
committed
Store the current counter value and use it for the sorted results path.
This way they don't clash when switching between sorted queries.
1 parent 72023ab commit 5a5681d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

extensions/ql-vscode/src/queries.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,25 @@ export class QueryInfo {
4848
*/
4949
sortedResultsInfo: Map<string, SortedResultSetInfo>;
5050
dataset: vscode.Uri; // guarantee the existence of a well-defined dataset dir at this point
51-
51+
queryId: number;
5252
constructor(
5353
public program: messages.QlProgram,
5454
public dbItem: DatabaseItem,
5555
public queryDbscheme: string, // the dbscheme file the query expects, based on library path resolution
5656
public quickEvalPosition?: messages.Position,
5757
public metadata?: cli.QueryMetadata,
5858
) {
59-
this.compiledQueryPath = path.join(tmpDir.name, `compiledQuery${queryCounter}.qlo`);
59+
this.queryId = queryCounter++;
60+
this.compiledQueryPath = path.join(tmpDir.name, `compiledQuery${this.queryId}.qlo`);
6061
this.resultsInfo = {
61-
resultsPath: path.join(tmpDir.name, `results${queryCounter}.bqrs`),
62-
interpretedResultsPath: path.join(tmpDir.name, `interpretedResults${queryCounter}.sarif`)
62+
resultsPath: path.join(tmpDir.name, `results${this.queryId}.bqrs`),
63+
interpretedResultsPath: path.join(tmpDir.name, `interpretedResults${this.queryId}.sarif`)
6364
};
6465
this.sortedResultsInfo = new Map();
6566
if (dbItem.contents === undefined) {
6667
throw new Error('Can\'t run query on invalid database.');
6768
}
6869
this.dataset = dbItem.contents.datasetUri;
69-
queryCounter++;
7070
}
7171

7272
async run(
@@ -160,7 +160,7 @@ export class QueryInfo {
160160
}
161161

162162
const sortedResultSetInfo: SortedResultSetInfo = {
163-
resultsPath: path.join(tmpDir.name, `sortedResults${queryCounter}-${resultSetName}.bqrs`),
163+
resultsPath: path.join(tmpDir.name, `sortedResults${this.queryId}-${resultSetName}.bqrs`),
164164
sortState
165165
};
166166

0 commit comments

Comments
 (0)