mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
[spatialite] Represent NULL attributes as QVariant/NULL
Instead of QVariant/Invalid
This commit is contained in:
parent
52ab06e295
commit
425b8b67d7
@ -325,14 +325,14 @@ bool QgsSpatiaLiteFeatureIterator::getFeature( sqlite3_stmt *stmt, QgsFeature &f
|
||||
else
|
||||
{
|
||||
int attrIndex = subsetAttributes ? mRequest.subsetOfAttributes()[ic-1] : ic - 1;
|
||||
feature.setAttribute( attrIndex, getFeatureAttribute( stmt, ic ) );
|
||||
feature.setAttribute( attrIndex, getFeatureAttribute( stmt, ic, P->attributeFields[attrIndex].type() ) );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant QgsSpatiaLiteFeatureIterator::getFeatureAttribute( sqlite3_stmt* stmt, int ic )
|
||||
QVariant QgsSpatiaLiteFeatureIterator::getFeatureAttribute( sqlite3_stmt* stmt, int ic, const QVariant::Type& type )
|
||||
{
|
||||
if ( sqlite3_column_type( stmt, ic ) == SQLITE_INTEGER )
|
||||
{
|
||||
@ -354,7 +354,7 @@ QVariant QgsSpatiaLiteFeatureIterator::getFeatureAttribute( sqlite3_stmt* stmt,
|
||||
}
|
||||
|
||||
// assuming NULL
|
||||
return QVariant();
|
||||
return QVariant( type );
|
||||
}
|
||||
|
||||
void QgsSpatiaLiteFeatureIterator::getFeatureGeometry( sqlite3_stmt* stmt, int ic, QgsFeature& feature )
|
||||
|
@ -51,7 +51,7 @@ class QgsSpatiaLiteFeatureIterator : public QgsAbstractFeatureIterator
|
||||
QString quotedPrimaryKey();
|
||||
bool getFeature( sqlite3_stmt *stmt, QgsFeature &feature );
|
||||
QString fieldName( const QgsField& fld );
|
||||
QVariant getFeatureAttribute( sqlite3_stmt* stmt, int ic );
|
||||
QVariant getFeatureAttribute( sqlite3_stmt* stmt, int ic, const QVariant::Type& type );
|
||||
void getFeatureGeometry( sqlite3_stmt* stmt, int ic, QgsFeature& feature );
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user