Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
care for types of fid
- Loading branch information
Showing
with
7 additions
and
3 deletions.
-
+7
−3
src/core/qgsofflineediting.cpp
|
@@ -749,11 +749,15 @@ QgsVectorLayer *QgsOfflineEditing::copyVectorLayer( QgsVectorLayer *layer, sqlit |
|
|
// NOTE: SpatiaLite provider ignores position of geometry column |
|
|
// fill gap in QgsAttributeMap if geometry column is not last (WORKAROUND) |
|
|
QgsAttributes attrs = f.attributes(); |
|
|
|
|
|
int column = 0; |
|
|
//newAttrs have an additional attribute (fid), so we have to add a dummy |
|
|
if ( containerType == GPKG && layer->dataProvider()->fields().lookupField( "fid" ) >= 0 ) |
|
|
int indexOfFid = layer->dataProvider()->fields().lookupField( "fid" ); |
|
|
if ( containerType == GPKG && ( indexOfFid == -1 || ( layer->dataProvider()->fields().at( indexOfFid ).type() != QVariant::Int |
|
|
&& layer->dataProvider()->fields().at( indexOfFid ).type() != QVariant::LongLong ) ) ) |
|
|
{ |
|
|
// newAttrs (1) has an additional attribute (fid) that is (2) of the correct type |
|
|
// so we have to add a dummy because otherwise it messes up with the amount of attributes |
|
|
column++; |
|
|
} |
|
|
QgsAttributes newAttrs( attrs.count() + column ); |
|
|
for ( int it = 0; it < attrs.count(); ++it ) |
|
|
{ |
|
|
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.