Skip to content

Commit 5133694

Browse files
committedFeb 4, 2016
Support writing LongLong types with GDAL 2
1 parent 163894d commit 5133694

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed
 

‎src/core/qgsvectorfilewriter.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,18 +1757,32 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
17571757

17581758
switch ( attrValue.type() )
17591759
{
1760+
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 2000000
17601761
case QVariant::Int:
1762+
case QVariant::UInt:
17611763
OGR_F_SetFieldInteger( poFeature, ogrField, attrValue.toInt() );
17621764
break;
1763-
case QVariant::Double:
1764-
OGR_F_SetFieldDouble( poFeature, ogrField, attrValue.toDouble() );
1765+
case QVariant::LongLong:
1766+
case QVariant::ULongLong:
1767+
OGR_F_SetFieldInteger64( poFeature, ogrField, attrValue.toLongLong() );
1768+
break;
1769+
case QVariant::String:
1770+
OGR_F_SetFieldString( poFeature, ogrField, mCodec->fromUnicode( attrValue.toString() ).data() );
1771+
break;
1772+
#else
1773+
case QVariant::Int:
1774+
OGR_F_SetFieldInteger( poFeature, ogrField, attrValue.toInt() );
17651775
break;
1776+
case QVariant::String:
17661777
case QVariant::LongLong:
17671778
case QVariant::UInt:
17681779
case QVariant::ULongLong:
1769-
case QVariant::String:
17701780
OGR_F_SetFieldString( poFeature, ogrField, mCodec->fromUnicode( attrValue.toString() ).data() );
17711781
break;
1782+
#endif
1783+
case QVariant::Double:
1784+
OGR_F_SetFieldDouble( poFeature, ogrField, attrValue.toDouble() );
1785+
break;
17721786
case QVariant::Date:
17731787
OGR_F_SetFieldDateTime( poFeature, ogrField,
17741788
attrValue.toDate().year(),

0 commit comments

Comments
 (0)
Please sign in to comment.