Skip to content

Commit

Permalink
Offline editing: Use layer id instead of layer name for table name
Browse files Browse the repository at this point in the history
Avoids table name collisions
  • Loading branch information
m-kuhn committed Jan 22, 2015
1 parent 0bdebed commit eea6eff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/qgsofflineediting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ QgsVectorLayer* QgsOfflineEditing::copyVectorLayer( QgsVectorLayer* layer, sqlit
return 0;
}

QString tableName = layer->name();
QString tableName = layer->id();

// create table
QString sql = QString( "CREATE TABLE '%1' (" ).arg( tableName );
Expand Down Expand Up @@ -547,7 +547,7 @@ QgsVectorLayer* QgsOfflineEditing::copyVectorLayer( QgsVectorLayer* layer, sqlit
QgsVectorLayer* newLayer = new QgsVectorLayer( QString( "dbname='%1' table='%2'%3 sql=" )
.arg( offlineDbPath )
.arg( tableName ).arg( layer->hasGeometryType() ? "(Geometry)" : "" ),
tableName + " (offline)", "spatialite" );
layer->name() + " (offline)", "spatialite" );
if ( newLayer->isValid() )
{
// mark as offline layer
Expand Down

0 comments on commit eea6eff

Please sign in to comment.