Skip to content
Permalink
Browse files

[spatialite] Represent NULL attributes as QVariant/NULL

Instead of QVariant/Invalid
  • Loading branch information
m-kuhn committed Aug 28, 2013
1 parent 52ab06e commit 425b8b67d7a272b4ca5f53d12bcc89a0d170b6bb
@@ -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 );

/**

0 comments on commit 425b8b6

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