Skip to content
Permalink
Browse files
oracle provider: fix connection settings
  • Loading branch information
jef-n committed Jan 22, 2013
1 parent 4923c30 commit ab9862ff37eb1854663ea5add7364d7f21adbe28
@@ -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() );

@@ -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" ) );
@@ -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();
@@ -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;
@@ -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;

@@ -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;
@@ -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; }

@@ -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() );

@@ -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" );

0 comments on commit ab9862f

Please sign in to comment.