Skip to content

Commit

Permalink
[MSSQL] Fix string length when using nchar, nvarchar, ntext
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Jul 5, 2017
1 parent 58878d0 commit 8731840
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/providers/mssql/qgsmssqlprovider.cpp
Expand Up @@ -410,11 +410,16 @@ void QgsMssqlProvider::loadFields()
}
if ( sqlType == QVariant::String )
{
int length = query.value( 7 ).toInt();
if ( sqlTypeName.startsWith( "n" ) )
{
length = length / 2;
}
mAttributeFields.append(
QgsField(
query.value( 3 ).toString(), sqlType,
sqlTypeName,
query.value( 7 ).toInt() ) );
length ) );
}
else if ( sqlType == QVariant::Double )
{
Expand Down

0 comments on commit 8731840

Please sign in to comment.