Skip to content

Commit 054d430

Browse files
committedNov 11, 2016
[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.
1 parent 28d7cea commit 054d430

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed
 

‎src/providers/spatialite/qgsspatialiteprovider.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,9 +3764,6 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
37643764

37653765
for ( int i = 0; i < attributevec.count(); ++i )
37663766
{
3767-
if ( !attributevec.at( i ).isValid() )
3768-
continue;
3769-
37703767
if ( i >= mAttributeFields.count() )
37713768
continue;
37723769

@@ -3822,8 +3819,6 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
38223819
for ( int i = 0; i < attributevec.count(); ++i )
38233820
{
38243821
QVariant v = attributevec.at( i );
3825-
if ( !v.isValid() )
3826-
continue;
38273822

38283823
// binding values for each attribute
38293824
if ( i >= mAttributeFields.count() )
@@ -3835,7 +3830,11 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
38353830

38363831
QVariant::Type type = mAttributeFields.at( i ).type();
38373832

3838-
if ( v.isNull() )
3833+
if ( !v.isValid() )
3834+
{
3835+
++ia;
3836+
}
3837+
else if ( v.isNull() )
38393838
{
38403839
// binding a NULL value
38413840
sqlite3_bind_null( stmt, ++ia );

0 commit comments

Comments
 (0)
Please sign in to comment.