Skip to content

Commit b5dc778

Browse files
committedFeb 27, 2013
Merge pull request #445 from szekerest/master
MSSQL: Fix for the problem with the length of the numeric fields (Fix #7249)
2 parents 84db88b + f5d81ae commit b5dc778

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed
 

‎src/providers/mssql/qgsmssqlprovider.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,21 @@ void QgsMssqlProvider::loadFields()
370370
{
371371
pkCandidates << query.value( 3 ).toString();
372372
}
373-
mAttributeFields.append(
374-
QgsField(
375-
query.value( 3 ).toString(), sqlType,
376-
sqlTypeName,
377-
query.value( 7 ).toInt(),
378-
query.value( 6 ).toInt() ) );
373+
if ( sqlType == QVariant::String )
374+
{
375+
mAttributeFields.append(
376+
QgsField(
377+
query.value( 3 ).toString(), sqlType,
378+
sqlTypeName,
379+
query.value( 7 ).toInt() ) );
380+
}
381+
else
382+
{
383+
mAttributeFields.append(
384+
QgsField(
385+
query.value( 3 ).toString(), sqlType,
386+
sqlTypeName ) );
387+
}
379388

380389
if ( !query.value( 12 ).isNull() )
381390
{

0 commit comments

Comments
 (0)
Please sign in to comment.