Skip to content
Permalink
Browse files

[spatialite] Don't skip default values

When inserting multiple features in a single prepared statement, the spatialite
provider would skip any default for individual features, even though they have
been specified in the field list, resulting in missing fields.
  • Loading branch information
m-kuhn committed Nov 11, 2016
1 parent 43ffd9e commit 526949b8139e8dbdff09d6256d44df6b2cee4338
Showing with 5 additions and 6 deletions.
  1. +5 −6 src/providers/spatialite/qgsspatialiteprovider.cpp
@@ -3653,9 +3653,6 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )

for ( int i = 0; i < attributevec.count(); ++i )
{
if ( !attributevec.at( i ).isValid() )
continue;

if ( i >= attributeFields.count() )
continue;

@@ -3711,8 +3708,6 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
for ( int i = 0; i < attributevec.count(); ++i )
{
QVariant v = attributevec.at( i );
if ( !v.isValid() )
continue;

// binding values for each attribute
if ( i >= attributeFields.count() )
@@ -3724,7 +3719,11 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )

QVariant::Type type = attributeFields.at( i ).type();

if ( v.isNull() )
if ( !v.isValid() )
{
++ia;
}
else if ( v.isNull() )
{
// binding a NULL value
sqlite3_bind_null( stmt, ++ia );

0 comments on commit 526949b

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