Skip to content

Commit

Permalink
spatialite provider:
Browse files Browse the repository at this point in the history
- fix #4569
- select newly added spatialite database
  • Loading branch information
jef-n committed Jul 4, 2012
1 parent fd2f341 commit 72d7a23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/providers/spatialite/qgsspatialiteprovider.cpp
Expand Up @@ -3600,13 +3600,6 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
values = QString( ") VALUES (" );
separator = "";

if ( !mPrimaryKey.isEmpty() )
{
sql += separator + quotedIdentifier( mPrimaryKey );
values += separator + "NULL";
separator = ",";
}

if ( !mGeometryColumn.isNull() )
{
sql += separator + quotedIdentifier( mGeometryColumn );
Expand All @@ -3621,11 +3614,12 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
continue;

QString fieldname = fit->name();
if ( fieldname.isEmpty() || fieldname == mGeometryColumn || fieldname == mPrimaryKey )
if ( fieldname.isEmpty() || fieldname == mGeometryColumn )
continue;

sql += separator + quotedIdentifier( fieldname );
values += separator + "?";
separator = ",";
}

sql += values;
Expand Down Expand Up @@ -3673,7 +3667,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
continue;

QString fieldname = fit->name();
if ( fieldname.isEmpty() || fieldname == mGeometryColumn || fieldname == mPrimaryKey )
if ( fieldname.isEmpty() || fieldname == mGeometryColumn )
continue;

QVariant::Type type = fit->type();
Expand Down
2 changes: 2 additions & 0 deletions src/providers/spatialite/qgsspatialitesourceselect.cpp
Expand Up @@ -493,6 +493,8 @@ void QgsSpatiaLiteSourceSelect::setConnectionListPosition()
// If possible, set the item currently displayed database
QString toSelect = settings.value( "/SpatiaLite/connections/selected" ).toString();

toSelect += "@" + settings.value( "/SpatiaLite/connections/" + toSelect + "/sqlitepath" ).toString();

cmbConnections->setCurrentIndex( cmbConnections->findText( toSelect ) );

if ( cmbConnections->currentIndex() < 0 )
Expand Down

0 comments on commit 72d7a23

Please sign in to comment.