Skip to content
Permalink
Browse files

[bugfix] Issue #17387: MSSQL provider fails to load UNIQUEIDENTIFIER …

…fields (#5521)

* Fix #17387: MSSQL provider fails to load UNIQUEIDENTIFIER fields
  • Loading branch information
kthy authored and NathanW2 committed Nov 13, 2017
1 parent 150a64e commit 320bda01f40be5dae9b76a17390e3369b7d11211
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/providers/mssql/qgsmssqlprovider.cpp
@@ -417,7 +417,9 @@ void QgsMssqlProvider::loadFields()
}
if ( sqlType == QVariant::String )
{
int length = query.value( 7 ).toInt();
// Field length in chars is column 7 ("Length") of the sp_columns output,
// except for uniqueidentifiers which must use column 6 ("Precision").
int length = query.value( sqlTypeName.startsWith( QLatin1String( "uniqueidentifier" ), Qt::CaseInsensitive ) ? 6 : 7 ).toInt();
if ( sqlTypeName.startsWith( QLatin1String( "n" ) ) )
{
length = length / 2;

0 comments on commit 320bda0

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