Support writing LongLong types with GDAL 2

This commit is contained in:
Matthias Kuhn 2016-02-04 09:04:01 +01:00
parent 163894d055
commit 5133694e6d

View File

@ -1757,18 +1757,32 @@ OGRFeatureH QgsVectorFileWriter::createFeature( QgsFeature& feature )
switch ( attrValue.type() )
{
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 2000000
case QVariant::Int:
case QVariant::UInt:
OGR_F_SetFieldInteger( poFeature, ogrField, attrValue.toInt() );
break;
case QVariant::LongLong:
case QVariant::ULongLong:
OGR_F_SetFieldInteger64( poFeature, ogrField, attrValue.toLongLong() );
break;
case QVariant::String:
OGR_F_SetFieldString( poFeature, ogrField, mCodec->fromUnicode( attrValue.toString() ).data() );
break;
#else
case QVariant::Int:
OGR_F_SetFieldInteger( poFeature, ogrField, attrValue.toInt() );
break;
case QVariant::Double:
OGR_F_SetFieldDouble( poFeature, ogrField, attrValue.toDouble() );
break;
case QVariant::String:
case QVariant::LongLong:
case QVariant::UInt:
case QVariant::ULongLong:
case QVariant::String:
OGR_F_SetFieldString( poFeature, ogrField, mCodec->fromUnicode( attrValue.toString() ).data() );
break;
#endif
case QVariant::Double:
OGR_F_SetFieldDouble( poFeature, ogrField, attrValue.toDouble() );
break;
case QVariant::Date:
OGR_F_SetFieldDateTime( poFeature, ogrField,
attrValue.toDate().year(),