Skip to content
Permalink
Browse files

[spatialite] Add proper support for NULL values

  • Loading branch information
m-kuhn committed Oct 13, 2013
1 parent f4ca526 commit 0f078049f9508bf2d13e5ee567a9fb15bc1cec51
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/providers/spatialite/qgsspatialiteprovider.cpp
@@ -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() );
@@ -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 );
}
}

0 comments on commit 0f07804

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