Skip to content
Permalink
Browse files

Improve the support for OGR/MSSQL driver

  • Loading branch information
szekerest committed Feb 5, 2012
1 parent 8496494 commit 876b8c7e465cef651ac04e13e6f24fa661ef7ec0
@@ -84,6 +84,31 @@ QString createDatabaseURI( QString connectionType, QString host, QString databas
uri += QString( ",password=%1" ).arg( password );
}
}
else if ( connectionType == "MSSQL" )
{
uri = "MSSQL:";

if ( !host.isEmpty() )
{
uri += QString( ";server=%1" ).arg( host );

if ( !port.isEmpty() )
uri += QString( ",%1" ).arg( port );
}

if ( !user.isEmpty() )
{
uri += QString( ";uid=%1" ).arg( user );

if ( !password.isEmpty() )
uri += QString( ";pwd=%1" ).arg( password );
}
else
uri += ";trusted_connection=yes";

if ( !database.isEmpty() )
uri += QString( ";database=%1" ).arg( database );
}
else if ( connectionType == "Oracle Spatial" )
{
uri = "OCI:" + user;
@@ -312,7 +312,10 @@ void QgsOpenVectorLayerDialog::accept()
bool makeConnection = false;
if ( pass.isEmpty() )
{
pass = QInputDialog::getText( this,
if ( cmbDatabaseTypes->currentText() == "MSSQL" )
makeConnection = true;
else
pass = QInputDialog::getText( this,
tr( "Password for " ) + user,
tr( "Please enter your password:" ),
QLineEdit::Password, QString::null,
@@ -1637,6 +1637,10 @@ QString createFilters( QString type )
{
myDatabaseDrivers += QObject::tr( "MySQL" ) + ",MySQL;";
}
else if ( driverName.startsWith( "MSSQL" ) )
{
myDatabaseDrivers += QObject::tr( "MSSQL" ) + ",MSSQL;";
}
else if ( driverName.startsWith( "OCI" ) )
{
myDatabaseDrivers += QObject::tr( "Oracle Spatial" ) + ",OCI;";

0 comments on commit 876b8c7

Please sign in to comment.
You can’t perform that action at this time.