Skip to content

Commit

Permalink
Specify port 1433 for FreeTDS by default. Allow to specify server/dat…
Browse files Browse the repository at this point in the history
…abase/uid/password when the driver setting is present (fixes #6259, fixes #6263)
  • Loading branch information
szekerest committed Sep 3, 2012
1 parent 500c64a commit c322cd5
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/providers/mssql/qgsmssqlprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit c322cd5

Please sign in to comment.