Skip to content

Commit 47f6faa

Browse files
committedJul 4, 2018
[postgres][db2] username and authcfg are not mutually exclusive (followup aae7a32)
1 parent 53a25c7 commit 47f6faa

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed
 

‎src/providers/db2/qgsdb2dataitems.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,21 @@ bool QgsDb2ConnectionItem::ConnInfoFromParameters(
8080
+ "dbname='" + database + "' ";
8181
}
8282

83+
if ( !username.isEmpty() )
84+
{
85+
connInfo += "user='" + username + "' ";
86+
}
87+
8388
if ( !authcfg.isEmpty() )
8489
{
8590
connInfo += "authcfg='" + authcfg + "' ";
8691
}
87-
else // include user and password if authcfg is empty
92+
else if ( !password.isEmpty() )
8893
{
89-
if ( !username.isEmpty() )
90-
{
91-
connInfo += "user='" + username + "' ";
92-
}
93-
94-
if ( !password.isEmpty() )
95-
{
96-
connInfo += "password='" + password + "' ";
97-
}
94+
// include user and password if authcfg is empty
95+
connInfo += "password='" + password + "' ";
9896
}
97+
9998
QgsDebugMsg( "connInfo: '" + connInfo + "'" );
10099
return true;
101100
}

‎src/providers/postgres/qgspostgresconn.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,6 @@ QgsDataSourceUri QgsPostgresConn::connUri( const QString &connName )
17901790

17911791
if ( !authcfg.isEmpty() )
17921792
{
1793-
username.clear();
17941793
password.clear();
17951794
}
17961795

0 commit comments

Comments
 (0)
Please sign in to comment.