Skip to content

Commit aefcc55

Browse files
committedJul 4, 2018
[postgres][db2] username and authcfg are not mutually exclusive (followup 9ce55ca)
1 parent 7ee252e commit aefcc55

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed
 

‎src/providers/db2/qgsdb2dataitems.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,20 @@ bool QgsDb2ConnectionItem::ConnInfoFromParameters(
8181
+ "dbname='" + database + "' ";
8282
}
8383

84+
if ( !username.isEmpty() )
85+
{
86+
connInfo += "user='" + username + "' ";
87+
}
88+
8489
if ( !authcfg.isEmpty() )
8590
{
8691
connInfo += "authcfg='" + authcfg + "' ";
8792
}
88-
else // include user and password if authcfg is empty
93+
else if ( !password.isEmpty() )
8994
{
90-
if ( !username.isEmpty() )
91-
{
92-
connInfo += "user='" + username + "' ";
93-
}
94-
95-
if ( !password.isEmpty() )
96-
{
97-
connInfo += "password='" + password + "' ";
98-
}
95+
connInfo += "password='" + password + "' ";
9996
}
97+
10098
QgsDebugMsg( "connInfo: '" + connInfo + "'" );
10199
return true;
102100
}

‎src/providers/postgres/qgspostgresconn.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,6 @@ QgsDataSourceURI QgsPostgresConn::connUri( const QString& theConnName )
17281728

17291729
if ( !authcfg.isEmpty() )
17301730
{
1731-
username.clear();
17321731
password.clear();
17331732
}
17341733

0 commit comments

Comments
 (0)
Please sign in to comment.