Skip to content
Browse files
[mssql] fix a bunch of strange bugs when connecting from linux
These include:
- fetching incomplete (corrupted) geometries
- fetching incomplete text data (e.g. WKT for CRS)

Also fixes a bug with empty attribute table for some ms sql layers
  • Loading branch information
wonder-sk committed Nov 3, 2018
1 parent eb5d487 commit 30e584d7c72d73f156d0d3e4ff2eb4a3a3d8980b
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/providers/mssql/qgsmssqlconnection.cpp
@@ -98,7 +98,12 @@ QSqlDatabase QgsMssqlConnection::getDatabase( const QString &service, const QStr
#ifdef Q_OS_WIN
connectionString = "driver={SQL Server}";
connectionString = QStringLiteral( "driver={FreeTDS};port=1433" );
// It seems that FreeTDS driver by default uses an ancient TDS protocol version (4.2) to communicate with MS SQL
// which was causing various data corruption errors, for example:
// - truncating data from varchar columns to 255 chars - failing to read WKT for CRS
// - truncating binary data to 4096 bytes (see @@TEXTSIZE) - failing to parse larger geometries
// The added "TDS_Version=auto" should negotiate more recent version (manually setting e.g. 7.2 worked fine too)
connectionString = QStringLiteral( "driver={FreeTDS};port=1433;TDS_Version=auto" );

0 comments on commit 30e584d

Please sign in to comment.