Skip to content
Permalink
Browse files

Merge pull request #221 from szekerest/master

Specify port 1433 for FreeTDS by default. Allow to specify server/database/uid/password when the driver setting is present
  • Loading branch information
NathanW2 committed Sep 3, 2012
2 parents 70fc079 + c322cd5 commit 787060388ddc4a49c18fe27f4e1a03eb1bbf984b
Showing with 11 additions and 10 deletions.
  1. +11 −10 src/providers/mssql/qgsmssqlprovider.cpp
@@ -214,19 +214,20 @@ QSqlDatabase QgsMssqlProvider::GetDatabase( QString driver, QString host, QStrin
#ifdef WIN32
connectionString = "driver={SQL Server}";
#else
connectionString = "driver={FreeTDS}";
connectionString = "driver={FreeTDS};port=1433";
#endif
if ( !host.isEmpty() )
connectionString += ";server=" + host;
}

if ( !database.isEmpty() )
connectionString += ";database=" + database;
if ( !host.isEmpty() )
connectionString += ";server=" + host;

if ( password.isEmpty() )
connectionString += ";trusted_connection=yes";
else
connectionString += ";uid=" + username + ";pwd=" + password;
}
if ( !database.isEmpty() )
connectionString += ";database=" + database;

if ( password.isEmpty() )
connectionString += ";trusted_connection=yes";
else
connectionString += ";uid=" + username + ";pwd=" + password;

if ( !username.isEmpty() )
db.setUserName( username );

0 comments on commit 7870603

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