File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -588,8 +588,23 @@ QgsAbstractFeatureSource* QgsSpatiaLiteProvider::featureSource() const
588
588
return new QgsSpatiaLiteFeatureSource ( this );
589
589
}
590
590
591
+ void QgsSpatiaLiteProvider::updatePrimaryKeyCapabilities ()
592
+ {
593
+ if ( mPrimaryKey .isEmpty () )
594
+ {
595
+ enabledCapabilities &= ~QgsVectorDataProvider::SelectAtId;
596
+ enabledCapabilities &= ~QgsVectorDataProvider::SelectGeometryAtId;
597
+ }
598
+ else
599
+ {
600
+ enabledCapabilities |= QgsVectorDataProvider::SelectAtId;
601
+ enabledCapabilities |= QgsVectorDataProvider::SelectGeometryAtId;
602
+ }
603
+ }
604
+
591
605
#ifdef SPATIALITE_VERSION_GE_4_0_0
592
606
// only if libspatialite version is >= 4.0.0
607
+
593
608
void QgsSpatiaLiteProvider::loadFieldsAbstractInterface ( gaiaVectorLayerPtr lyr )
594
609
{
595
610
if ( lyr == nullptr )
@@ -657,6 +672,9 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr
657
672
mPrimaryKeyAttrs << i - 1 ;
658
673
}
659
674
}
675
+
676
+ updatePrimaryKeyCapabilities ();
677
+
660
678
sqlite3_free_table ( results );
661
679
}
662
680
#endif
@@ -849,6 +867,8 @@ void QgsSpatiaLiteProvider::loadFields()
849
867
mPrimaryKey = pkName;
850
868
}
851
869
870
+ updatePrimaryKeyCapabilities ();
871
+
852
872
return ;
853
873
854
874
error:
Original file line number Diff line number Diff line change @@ -426,6 +426,8 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
426
426
static int computeMultiWKB3Dsize ( const unsigned char *p_in, int little_endian,
427
427
int endian_arch );
428
428
private:
429
+ void updatePrimaryKeyCapabilities ();
430
+
429
431
int computeSizeFromMultiWKB2D ( const unsigned char *p_in, int nDims,
430
432
int little_endian,
431
433
int endian_arch );
@@ -496,6 +498,7 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
496
498
QgsSqliteHandle *handle;
497
499
498
500
friend class QgsSpatiaLiteFeatureSource ;
501
+
499
502
};
500
503
501
504
#endif
You can’t perform that action at this time.
0 commit comments