@@ -40,34 +40,24 @@ export class ConnectionUI {
40
40
const self = this ;
41
41
return new Promise < Interfaces . IConnectionCredentials > ( ( resolve , reject ) => {
42
42
// create a new connection to the master db using the current connection as a base
43
- const masterCredentials = < Interfaces . IConnectionCredentials > {
44
- connectionTimeout : currentCredentials . connectionTimeout ,
45
- database : 'master' ,
46
- options : currentCredentials . options ,
47
- password : currentCredentials . password ,
48
- requestTimeout : currentCredentials . connectionTimeout ,
49
- server : currentCredentials . server ,
50
- user : currentCredentials . user
51
- } ;
43
+ let masterCredentials : Interfaces . IConnectionCredentials = < any > { } ;
44
+ Object . assign < Interfaces . IConnectionCredentials , Interfaces . IConnectionCredentials > ( masterCredentials , currentCredentials ) ;
45
+ masterCredentials . database = 'master' ;
52
46
const masterConnection = new mssql . Connection ( masterCredentials ) ;
53
47
54
48
masterConnection . connect ( ) . then ( ( ) => {
55
49
// query sys.databases for a list of databases on the server
56
50
new mssql . Request ( masterConnection ) . query ( 'SELECT name FROM sys.databases' ) . then ( recordset => {
57
51
const pickListItems = recordset . map ( record => {
52
+ let newCredentials : Interfaces . IConnectionCredentials = < any > { } ;
53
+ Object . assign < Interfaces . IConnectionCredentials , Interfaces . IConnectionCredentials > ( newCredentials , currentCredentials ) ;
54
+ newCredentials . database = record . name ;
55
+
58
56
return < Interfaces . IConnectionCredentialsQuickPickItem > {
59
57
label : record . name ,
60
58
description : '' ,
61
59
detail : '' ,
62
- connectionCreds : < Interfaces . IConnectionCredentials > {
63
- connectionTimeout : currentCredentials . connectionTimeout ,
64
- database : record . name ,
65
- options : currentCredentials . options ,
66
- password : currentCredentials . password ,
67
- requestTimeout : currentCredentials . requestTimeout ,
68
- server : currentCredentials . server ,
69
- user : currentCredentials . user
70
- }
60
+ connectionCreds : newCredentials
71
61
} ;
72
62
} ) ;
73
63
0 commit comments