Skip to content
Permalink
Browse files

[mssql] Fix shifted attributes after importing layers via browser

drag and drop

Fixes #15305
  • Loading branch information
nyalldawson committed Oct 5, 2018
1 parent 10095ce commit b7f5a3c1ea1f158505db0ecf337dcbc63ee9ae95
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/providers/mssql/qgsmssqlprovider.cpp
@@ -1710,10 +1710,8 @@ QgsVectorLayerExporter::ExportError QgsMssqlProvider::createEmptyLayer( const QS
if ( wkbType != QgsWkbTypes::NoGeometry && geometryColumn.isEmpty() )
geometryColumn = QStringLiteral( "geom" );

if ( primaryKey.isEmpty() )
primaryKey = QStringLiteral( "qgs_fid" );

// get the pk's name and type
bool createdNewPk = false;

// if no pk name was passed, define the new pk field name
if ( primaryKey.isEmpty() )
@@ -1729,6 +1727,7 @@ QgsVectorLayerExporter::ExportError QgsMssqlProvider::createEmptyLayer( const QS
i = 0;
}
}
createdNewPk = true;
}
else
{
@@ -1879,7 +1878,8 @@ QgsVectorLayerExporter::ExportError QgsMssqlProvider::createEmptyLayer( const QS

if ( fields.size() > 0 )
{
int offset = 0;
// if we had to create a primary key column, we start the old columns from 1
int offset = createdNewPk ? 1 : 0;

// get the list of fields
QList<QgsField> flist;

0 comments on commit b7f5a3c

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