Skip to content
Permalink
Browse files
Improve the support for OGR/MSSQL driver
  • Loading branch information
szekerest authored and alexbruy committed Feb 11, 2012
1 parent b3807b7 commit 40623c59659ab919401143abb4a779ec85521bd2
@@ -85,6 +85,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;
@@ -313,7 +313,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,
@@ -1448,6 +1448,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 40623c5

Please sign in to comment.