Skip to content
Permalink
Browse files

Specify port 1433 for FreeTDS by default. Allow to specify server/dat…

…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 c322cd52cf82afeb10beefa6efa42da2bdcea46f
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 c322cd5

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