File tree Expand file tree Collapse file tree 4 files changed +8
-50
lines changed Expand file tree Collapse file tree 4 files changed +8
-50
lines changed Original file line number Diff line number Diff line change 429
429
"category" : " Db2 for i" ,
430
430
"icon" : " $(output)"
431
431
},
432
- {
433
- "command" : " vscode-db2i.setCurrentSchema" ,
434
- "title" : " Set current schema" ,
435
- "category" : " Db2 for i"
436
- },
437
432
{
438
433
"command" : " vscode-db2i.setSchemaFilter" ,
439
434
"title" : " Set filter" ,
948
943
}
949
944
],
950
945
"view/item/context" : [
951
- {
952
- "command" : " vscode-db2i.setCurrentSchema" ,
953
- "when" : " viewItem == schema" ,
954
- "group" : " db2@1"
955
- },
956
946
{
957
947
"command" : " vscode-db2i.setSchemaFilter" ,
958
948
"when" : " viewItem == schema" ,
Original file line number Diff line number Diff line change @@ -19,7 +19,14 @@ export class OldSQLJob extends SQLJob {
19
19
return this . selfState ;
20
20
}
21
21
22
- getCurrentSchema ( ) : string {
22
+ async getCurrentSchema ( ) : Promise < string > {
23
+ if ( this . getNaming ( ) === `sql` ) {
24
+ const result = await this . execute < { '00001' : string } > ( `values (current schema)` ) ;
25
+ if ( result . success && result . data . length > 0 ) {
26
+ return result . data [ 0 ] [ '00001' ] ;
27
+ }
28
+ }
29
+
23
30
return this . options . libraries [ 0 ] || `QGPL` ;
24
31
}
25
32
@@ -178,19 +185,6 @@ export class OldSQLJob extends SQLJob {
178
185
throw e ;
179
186
}
180
187
}
181
-
182
- async setCurrentSchema ( schema : string ) : Promise < QueryResult < any > > {
183
- if ( schema ) {
184
- const upperSchema = Statement . delimName ( schema , true ) ;
185
- const result = await this . execute ( `set current schema = ?` , { parameters : [ upperSchema ] } ) ;
186
- if ( result . success ) {
187
- this . options . libraries [ 0 ] = upperSchema ;
188
- }
189
-
190
- return result ;
191
-
192
- }
193
- }
194
188
195
189
getJobLog ( ) : Promise < QueryResult < JobLogEntry > > {
196
190
return this . query < JobLogEntry > ( `select * from table(qsys2.joblog_info('*')) a` ) . execute ( ) ;
Original file line number Diff line number Diff line change 95
95
"category" : " Db2 for i" ,
96
96
"icon" : " $(output)"
97
97
},
98
- {
99
- "command" : " vscode-db2i.setCurrentSchema" ,
100
- "title" : " Set current schema" ,
101
- "category" : " Db2 for i"
102
- },
103
98
{
104
99
"command" : " vscode-db2i.setSchemaFilter" ,
105
100
"title" : " Set filter" ,
127
122
}
128
123
],
129
124
"view/item/context" : [
130
- {
131
- "command" : " vscode-db2i.setCurrentSchema" ,
132
- "when" : " viewItem == schema" ,
133
- "group" : " db2@1"
134
- },
135
125
{
136
126
"command" : " vscode-db2i.setSchemaFilter" ,
137
127
"when" : " viewItem == schema" ,
Original file line number Diff line number Diff line change @@ -350,22 +350,6 @@ export default class schemaBrowser {
350
350
}
351
351
} ) ,
352
352
353
- vscode . commands . registerCommand ( `vscode-db2i.setCurrentSchema` , async ( node : SchemaItem ) => {
354
- if ( node && node . contextValue === `schema` ) {
355
- const schema = node . schema . toUpperCase ( ) ;
356
-
357
- const config = getInstance ( ) . getConfig ( ) ;
358
- const currentLibrary = config . currentLibrary . toUpperCase ( ) ;
359
-
360
- if ( schema && schema !== currentLibrary ) {
361
- config . currentLibrary = schema ;
362
- await getInstance ( ) . setConfig ( config ) ;
363
- }
364
-
365
- vscode . window . showInformationMessage ( `Current schema set to ${ schema } .` ) ;
366
- }
367
- } ) ,
368
-
369
353
vscode . commands . registerCommand ( `vscode-db2i.setSchemaFilter` , async ( node : SchemaItem ) => {
370
354
if ( node ) {
371
355
const value = await vscode . window . showInputBox ( {
You can’t perform that action at this time.
0 commit comments