Skip to content

Commit f677eaf

Browse files
eaglevisjef-n
authored andcommitted
consider middle geometry column when retrieving default values (fixes #16685)
1 parent 6326947 commit f677eaf

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎src/providers/spatialite/qgsspatialiteprovider.cpp‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,10 +729,15 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr
729729
int ret = sqlite3_get_table( mSqliteHandle, sql.toUtf8().constData(), &results, &rows, &columns, &errMsg );
730730
if ( ret == SQLITE_OK )
731731
{
732+
int realFieldIndex = 0;
732733
for ( int i = 1; i <= rows; i++ )
733734
{
734735
QString name = QString::fromUtf8( results[( i * columns ) + 1] );
735-
insertDefaultValue( i - 1, QString::fromUtf8( results[( i * columns ) + 4] ) );
736+
737+
if ( name.toLower() == mGeometryColumn )
738+
continue;
739+
740+
insertDefaultValue( realFieldIndex, QString::fromUtf8( results[( i * columns ) + 4] ) );
736741

737742
QString pk = results[( i * columns ) + 5];
738743
QString type = results[( i * columns ) + 2];
@@ -762,6 +767,7 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr
762767
else
763768
mPrimaryKey.clear();
764769
mPrimaryKeyAttrs << i - 1;
770+
realFieldIndex += 1;
765771
}
766772
}
767773

0 commit comments

Comments
 (0)