Skip to content

Commit

Permalink
[spatialite] Add proper support for NULL values
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 13, 2013
1 parent f4ca526 commit 0f07804
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/providers/spatialite/qgsspatialiteprovider.cpp
Expand Up @@ -3640,12 +3640,17 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )

QVariant::Type type = attributeFields[i].type();

if ( type == QVariant::Int )
if ( v.isNull() )
{
// binding a NULL value
sqlite3_bind_null( stmt, ++ia );
}
else if ( type == QVariant::Int )
{
// binding an INTEGER value
sqlite3_bind_int( stmt, ++ia, v.toInt() );
}
if ( type == QVariant::LongLong )
else if ( type == QVariant::LongLong )
{
// binding a LONGLONG value
sqlite3_bind_int64( stmt, ++ia, v.toLongLong() );
Expand All @@ -3663,7 +3668,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
}
else
{
// binding a NULL value
// Unknown type: bind a NULL value
sqlite3_bind_null( stmt, ++ia );
}
}
Expand Down

0 comments on commit 0f07804

Please sign in to comment.