Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
oracle provider: fix connection settings
  • Loading branch information
jef-n committed Jan 9, 2013
1 parent 090d145 commit d00bc7a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
8 changes: 6 additions & 2 deletions src/gui/qgsmanageconnectionsdialog.cpp
Expand Up @@ -480,8 +480,10 @@ QDomDocument QgsManageConnectionsDialog::saveOracleConnections( const QStringLis
el.setAttribute( "host", settings.value( path + "/host", "" ).toString() );
el.setAttribute( "port", settings.value( path + "/port", "" ).toString() );
el.setAttribute( "database", settings.value( path + "/database", "" ).toString() );
el.setAttribute( "sslmode", settings.value( path + "/sslmode", "1" ).toString() );
el.setAttribute( "estimatedMetadata", settings.value( path + "/estimatedMetadata", "0" ).toString() );
el.setAttribute( "userTablesOnly", settings.value( path + "/userTablesOnly", "0" ).toString() );
el.setAttribute( "geometryColumnsOnly", settings.value( path + "/geometryColumnsOnly", "0" ).toString() );
el.setAttribute( "allowGeometrylessTables", settings.value( path + "/allowGeometrylessTables", "0" ).toString() );

el.setAttribute( "saveUsername", settings.value( path + "/saveUsername", "false" ).toString() );

Expand Down Expand Up @@ -918,8 +920,10 @@ void QgsManageConnectionsDialog::loadOracleConnections( const QDomDocument &doc,
settings.setValue( "/host", child.attribute( "host" ) );
settings.setValue( "/port", child.attribute( "port" ) );
settings.setValue( "/database", child.attribute( "database" ) );
settings.setValue( "/sslmode", child.attribute( "sslmode" ) );
settings.setValue( "/estimatedMetadata", child.attribute( "estimatedMetadata" ) );
settings.setValue( "/userTablesOnly", child.attribute( "userTablesOnly" ) );
settings.setValue( "/geometryColumnsOnly", child.attribute( "geometryColumnsOnly" ) );
settings.setValue( "/allowGeometrylessTables", child.attribute( "allowGeometrylessTables" ) );
settings.setValue( "/saveUsername", child.attribute( "saveUsername" ) );
settings.setValue( "/username", child.attribute( "username" ) );
settings.setValue( "/savePassword", child.attribute( "savePassword" ) );
Expand Down
14 changes: 7 additions & 7 deletions src/providers/oracle/qgsoracleconn.cpp
Expand Up @@ -599,7 +599,7 @@ QgsDataSourceURI QgsOracleConn::connUri( QString theConnName )

QString key = "/Oracle/connections/" + theConnName;

QString service = settings.value( key + "/service" ).toString();
QString database = settings.value( key + "/database" ).toString();

QString host = settings.value( key + "/host" ).toString();
QString port = settings.value( key + "/port" ).toString();
Expand All @@ -623,7 +623,7 @@ QgsDataSourceURI QgsOracleConn::connUri( QString theConnName )
}

QgsDataSourceURI uri;
uri.setConnection( host, port, QString::null, username, password );
uri.setConnection( host, port, database, username, password );
uri.setUseEstimatedMetadata( useEstimatedMetadata );

return uri;
Expand All @@ -641,7 +641,7 @@ bool QgsOracleConn::allowGeometrylessTables( QString theConnName )
return settings.value( "/Oracle/connections/" + theConnName + "/allowGeometrylessTables", false ).toBool();
}

QString QgsOracleConn::databaseName( QString serviceName, QString host, QString port )
QString QgsOracleConn::databaseName( QString database, QString host, QString port )
{
QString db;

Expand All @@ -654,14 +654,14 @@ QString QgsOracleConn::databaseName( QString serviceName, QString host, QString
db += QString( ":%1" ).arg( port );
}

if ( !serviceName.isEmpty() )
if ( !database.isEmpty() )
{
db += "/" + serviceName;
db += "/" + database;
}
}
else if ( !serviceName.isEmpty() )
else if ( !database.isEmpty() )
{
db = serviceName;
db = database;
}

return db;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/oracle/qgsoracleconn.h
Expand Up @@ -149,7 +149,7 @@ class QgsOracleConn : public QThread
static bool userTablesOnly( QString theConnName );
static bool allowGeometrylessTables( QString theConnName );
static void deleteConnection( QString theConnName );
static QString databaseName( QString serviceName, QString host, QString port );
static QString databaseName( QString database, QString host, QString port );

operator QSqlDatabase() { return mDatabase; }

Expand Down
4 changes: 3 additions & 1 deletion src/providers/oracle/qgsoraclenewconnection.cpp
Expand Up @@ -45,6 +45,7 @@ QgsOracleNewConnection::QgsOracleNewConnection( QWidget *parent, const QString&
}
txtPort->setText( port );
cb_userTablesOnly->setChecked( settings.value( key + "/userTablesOnly", false ).toBool() );
cb_geometryColumnsOnly->setChecked( settings.value( key + "/geometryColumnsOnly", false ).toBool() );
cb_allowGeometrylessTables->setChecked( settings.value( key + "/allowGeometrylessTables", false ).toBool() );
cb_useEstimatedMetadata->setChecked( settings.value( key + "/estimatedMetadata", false ).toBool() );

Expand Down Expand Up @@ -117,10 +118,11 @@ void QgsOracleNewConnection::accept()
settings.setValue( baseKey + "/username", chkStoreUsername->isChecked() ? txtUsername->text() : "" );
settings.setValue( baseKey + "/password", chkStorePassword->isChecked() ? txtPassword->text() : "" );
settings.setValue( baseKey + "/userTablesOnly", cb_userTablesOnly->isChecked() );
settings.setValue( baseKey + "/geometryColumnsOnly", cb_geometryColumnsOnly->isChecked() );
settings.setValue( baseKey + "/allowGeometrylessTables", cb_allowGeometrylessTables->isChecked() );
settings.setValue( baseKey + "/estimatedMetadata", cb_useEstimatedMetadata->isChecked() ? "true" : "false" );
settings.setValue( baseKey + "/saveUsername", chkStoreUsername->isChecked() ? "true" : "false" );
settings.setValue( baseKey + "/savePassword", chkStorePassword->isChecked() ? "true" : "false" );
settings.setValue( baseKey + "/estimatedMetadata", cb_useEstimatedMetadata->isChecked() ? "true" : "false" );

// remove old save setting
settings.remove( baseKey + "/save" );
Expand Down

0 comments on commit d00bc7a

Please sign in to comment.