@@ -24,9 +24,7 @@ export class ResultSetPanelProvider implements WebviewViewProvider {
24
24
// We are assuming the job is the same here.
25
25
commands . executeCommand ( `vscode-db2i.statement.cancel` , hostJob . id ) ;
26
26
}
27
- this . currentQuery . close ( ) . then ( ( ) => {
28
- this . currentQuery = undefined ;
29
- } ) ;
27
+ this . currentQuery . close ( ) ;
30
28
}
31
29
}
32
30
@@ -63,28 +61,31 @@ export class ResultSetPanelProvider implements WebviewViewProvider {
63
61
}
64
62
65
63
try {
66
- setCancelButtonVisibility ( true ) ;
67
64
if ( this . currentQuery === undefined ) {
68
65
// We will need to revisit this if we ever allow multiple result tabs like ACS does
69
66
// Query.cleanup();
70
67
71
68
this . currentQuery = await JobManager . getPagingStatement ( message . query , { isClCommand : message . isCL , autoClose : true , isTerseResults : true } ) ;
72
69
}
73
70
74
- let queryResults = this . currentQuery . getState ( ) == QueryState . RUN_MORE_DATA_AVAILABLE ? await this . currentQuery . fetchMore ( ) : await this . currentQuery . run ( ) ;
75
-
76
- const jobId = this . currentQuery . getHostJob ( ) . id ;
77
-
78
- this . _view . webview . postMessage ( {
79
- command : `rows` ,
80
- jobId,
81
- rows : queryResults . data ,
82
- columnMetaData : queryResults . metadata ? queryResults . metadata . columns : undefined , // Query.fetchMore() doesn't return the metadata
83
- columnHeadings : Configuration . get ( `resultsets.columnHeadings` ) || 'Name' ,
84
- queryId : this . currentQuery . getId ( ) ,
85
- update_count : queryResults . update_count ,
86
- isDone : queryResults . is_done
87
- } ) ;
71
+ if ( this . currentQuery . getState ( ) !== QueryState . RUN_DONE ) {
72
+ setCancelButtonVisibility ( true ) ;
73
+
74
+ let queryResults = this . currentQuery . getState ( ) == QueryState . RUN_MORE_DATA_AVAILABLE ? await this . currentQuery . fetchMore ( ) : await this . currentQuery . run ( ) ;
75
+
76
+ const jobId = this . currentQuery . getHostJob ( ) . id ;
77
+
78
+ this . _view . webview . postMessage ( {
79
+ command : `rows` ,
80
+ jobId,
81
+ rows : queryResults . data ,
82
+ columnMetaData : queryResults . metadata ? queryResults . metadata . columns : undefined , // Query.fetchMore() doesn't return the metadata
83
+ columnHeadings : Configuration . get ( `resultsets.columnHeadings` ) || 'Name' ,
84
+ queryId : this . currentQuery . getId ( ) ,
85
+ update_count : queryResults . update_count ,
86
+ isDone : queryResults . is_done
87
+ } ) ;
88
+ }
88
89
89
90
} catch ( e ) {
90
91
this . setError ( e . message ) ;
0 commit comments