Skip to content

Commit

Permalink
[Oracle] Fix edit connection forced port value
Browse files Browse the repository at this point in the history
User can set database without host and port, meaning he is using a service (tnsnames.ora)

The QGIS User Interface forced the port to not be empty even if the database is set and the host is empty.

It is an addition to #39131 _[Oracle] Fix new connection greyed ok button_ to fix
#38979 _Oracle - add/edit connection dialog forces hostname input - conflicts with Oracle Network Connection_
  • Loading branch information
rldhont authored and github-actions[bot] committed May 12, 2022
1 parent 0b4c0e6 commit 8520da2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/providers/oracle/qgsoraclenewconnection.cpp
Expand Up @@ -58,11 +58,17 @@ QgsOracleNewConnection::QgsOracleNewConnection( QWidget *parent, const QString &
txtDatabase->setText( settings.value( key + QStringLiteral( "/database" ) ).toString() );
txtHost->setText( settings.value( key + QStringLiteral( "/host" ) ).toString() );
QString port = settings.value( key + QStringLiteral( "/port" ) ).toString();
if ( port.length() == 0 )

// User can set database without host and port, meaning he is using a service (tnsnames.ora)
// if he sets host, port has to be set also (and vice versa)
// https://github.com/qgis/QGIS/issues/38979
if ( port.length() == 0
&& ( !txtHost->text().isEmpty() || txtDatabase->text().isEmpty() ) )
{
port = QStringLiteral( "1521" );
}
txtPort->setText( port );

txtOptions->setText( settings.value( key + QStringLiteral( "/dboptions" ) ).toString() );
txtWorkspace->setText( settings.value( key + QStringLiteral( "/dbworkspace" ) ).toString() );
txtSchema->setText( settings.value( key + QStringLiteral( "/schema" ) ).toString() );
Expand Down

0 comments on commit 8520da2

Please sign in to comment.