Skip to content
Permalink
Browse files

consider middle geometry column when retrieving default values (fixes #…

  • Loading branch information
eaglevis authored and jef-n committed Jun 9, 2017
1 parent 6326947 commit f677eaf04f73331b1ef5180b2f30018d5e1faa53
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/providers/spatialite/qgsspatialiteprovider.cpp
@@ -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];
@@ -762,6 +767,7 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr
else
mPrimaryKey.clear();
mPrimaryKeyAttrs << i - 1;
realFieldIndex += 1;
}
}

0 comments on commit f677eaf

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