@@ -89,9 +89,14 @@ bool QgsOgrProvider::convertField( QgsField &field, const QTextCodec &encoding )
89
89
switch ( field.type() )
90
90
{
91
91
case QVariant::LongLong:
92
+ #if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 2000000
92
93
ogrType = OFTInteger64;
93
- ogrWidth = ogrWidth > 0 && ogrWidth <= 21 ? ogrWidth : 21;
94
+ ogrPrecision = 0;
95
+ #else
96
+ ogrType = OFTString;
94
97
ogrPrecision = -1;
98
+ #endif
99
+ ogrWidth = ogrWidth > 0 && ogrWidth <= 21 ? ogrWidth : 21;
95
100
break;
96
101
97
102
case QVariant::String:
@@ -439,7 +444,9 @@ QgsOgrProvider::QgsOgrProvider( QString const & uri )
439
444
440
445
mNativeTypes
441
446
<< QgsVectorDataProvider::NativeType( tr( " Whole number (integer)" ), "integer", QVariant::Int, 1, 10 )
447
+ #if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 2000000
442
448
<< QgsVectorDataProvider::NativeType( tr( " Whole number (integer 64 bit)" ), " integer64" , QVariant::LongLong, 1 , 10 )
449
+ #endif
443
450
<< QgsVectorDataProvider::NativeType( tr( " Decimal number (real)" ), " double" , QVariant::Double, 1 , 20 , 0 , 15 )
444
451
<< QgsVectorDataProvider::NativeType( tr( " Text (string)" ), " string" , QVariant::String, 1 , 255 )
445
452
<< QgsVectorDataProvider::NativeType( tr( " Date" ), " date" , QVariant::Date, 8 , 8 );
@@ -772,7 +779,9 @@ void QgsOgrProvider::loadFields()
772
779
switch ( ogrType )
773
780
{
774
781
case OFTInteger: varType = QVariant::Int; break ;
782
+ #if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 2000000
775
783
case OFTInteger64: varType = QVariant::LongLong; break ;
784
+ #endif
776
785
case OFTReal: varType = QVariant::Double; break ;
777
786
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1400
778
787
case OFTDate: varType = QVariant::Date; break ;
@@ -1133,9 +1142,11 @@ bool QgsOgrProvider::addAttributes( const QList<QgsField> &attributes )
1133
1142
case QVariant::Int:
1134
1143
type = OFTInteger;
1135
1144
break ;
1145
+ #if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 2000000
1136
1146
case QVariant::LongLong:
1137
1147
type = OFTInteger64;
1138
1148
break ;
1149
+ #endif
1139
1150
case QVariant::Double:
1140
1151
type = OFTReal;
1141
1152
break ;
0 commit comments