Skip to content
Permalink
Browse files

[ogr] compatibility for 64 bit integers

GDAL 2 related
  • Loading branch information
m-kuhn committed Dec 10, 2015
1 parent aa4f288 commit e3a57a358d8cd68629a8d47e876907802cf3b946
Showing with 7 additions and 1 deletion.
  1. +1 −0 src/providers/ogr/qgsogrfeatureiterator.cpp
  2. +6 −1 src/providers/ogr/qgsogrprovider.cpp
@@ -279,6 +279,7 @@ void QgsOgrFeatureIterator::getFeatureAttribute( OGRFeatureH ogrFet, QgsFeature
{
case QVariant::String: value = QVariant( mSource->mEncoding->toUnicode( OGR_F_GetFieldAsString( ogrFet, attindex ) ) ); break;
case QVariant::Int: value = QVariant( OGR_F_GetFieldAsInteger( ogrFet, attindex ) ); break;
case QVariant::LongLong: value = QVariant( OGR_F_GetFieldAsInteger64( ogrFet, attindex ) ); break;
case QVariant::Double: value = QVariant( OGR_F_GetFieldAsDouble( ogrFet, attindex ) ); break;
case QVariant::Date:
case QVariant::DateTime:
@@ -89,7 +89,7 @@ bool QgsOgrProvider::convertField( QgsField &field, const QTextCodec &encoding )
switch ( field.type() )
{
case QVariant::LongLong:
ogrType = OFTString;
ogrType = OFTInteger64;
ogrWidth = ogrWidth > 0 && ogrWidth <= 21 ? ogrWidth : 21;
ogrPrecision = -1;
break;
@@ -439,6 +439,7 @@ QgsOgrProvider::QgsOgrProvider( QString const & uri )

mNativeTypes
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer)" ), "integer", QVariant::Int, 1, 10 )
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer 64 bit)" ), "integer64", QVariant::LongLong, 1, 10 )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (real)" ), "double", QVariant::Double, 1, 20, 0, 15 )
<< QgsVectorDataProvider::NativeType( tr( "Text (string)" ), "string", QVariant::String, 1, 255 )
<< QgsVectorDataProvider::NativeType( tr( "Date" ), "date", QVariant::Date, 8, 8 );
@@ -771,6 +772,7 @@ void QgsOgrProvider::loadFields()
switch ( ogrType )
{
case OFTInteger: varType = QVariant::Int; break;
case OFTInteger64: varType = QVariant::LongLong; break;
case OFTReal: varType = QVariant::Double; break;
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1400
case OFTDate: varType = QVariant::Date; break;
@@ -1131,6 +1133,9 @@ bool QgsOgrProvider::addAttributes( const QList<QgsField> &attributes )
case QVariant::Int:
type = OFTInteger;
break;
case QVariant::LongLong:
type = OFTInteger64;
break;
case QVariant::Double:
type = OFTReal;
break;

1 comment on commit e3a57a3

@m-kuhn

This comment has been minimized.

Copy link
Member Author

@m-kuhn m-kuhn commented on e3a57a3 Dec 10, 2015

Pushed by accident, will fix before lunch

Please sign in to comment.
You can’t perform that action at this time.