Skip to content

Commit

Permalink
consider middle geometry column when retrieving default values (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
eaglevis authored and jef-n committed Jun 9, 2017
1 parent 6326947 commit f677eaf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/providers/spatialite/qgsspatialiteprovider.cpp
Expand Up @@ -729,10 +729,15 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr
int ret = sqlite3_get_table( mSqliteHandle, sql.toUtf8().constData(), &results, &rows, &columns, &errMsg );
if ( ret == SQLITE_OK )
{
int realFieldIndex = 0;
for ( int i = 1; i <= rows; i++ )
{
QString name = QString::fromUtf8( results[( i * columns ) + 1] );
insertDefaultValue( i - 1, QString::fromUtf8( results[( i * columns ) + 4] ) );

if ( name.toLower() == mGeometryColumn )
continue;

insertDefaultValue( realFieldIndex, QString::fromUtf8( results[( i * columns ) + 4] ) );

QString pk = results[( i * columns ) + 5];
QString type = results[( i * columns ) + 2];
Expand Down Expand Up @@ -762,6 +767,7 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr
else
mPrimaryKey.clear();
mPrimaryKeyAttrs << i - 1;
realFieldIndex += 1;
}
}

Expand Down

0 comments on commit f677eaf

Please sign in to comment.