mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-23 00:05:43 -04:00
Explain why the workaround for GPKG/SQLite is necessary
I've talked to Even for this one
This commit is contained in:
parent
5d7a7ac973
commit
f454827397
@ -3622,6 +3622,9 @@ QSet<QVariant> QgsOgrProvider::uniqueValues( int index, int limit ) const
|
||||
QByteArray sql = "SELECT DISTINCT " + quotedIdentifier( textEncoding()->fromUnicode( fld.name() ) );
|
||||
|
||||
// GPKG/SQLite fid
|
||||
// For GPKG an SQLITE drivers PK fields are not exposed as real fields, (and OGR_F_GetFID only
|
||||
// works with GPKG), so we are adding an extra column that will become index 0
|
||||
// See https://issues.qgis.org/issues/21311
|
||||
if ( ( mGDALDriverName == QLatin1String( "GPKG" ) || mGDALDriverName == QLatin1String( "SQLite" ) )
|
||||
&& mFirstFieldIsFid && index == 0 )
|
||||
{
|
||||
@ -3649,7 +3652,6 @@ QSet<QVariant> QgsOgrProvider::uniqueValues( int index, int limit ) const
|
||||
while ( f.reset( l->GetNextFeature() ), f )
|
||||
{
|
||||
uniqueValues << ( OGR_F_IsFieldSetAndNotNull( f.get(), 0 ) ? convertValue( fld.type(), textEncoding()->toUnicode( OGR_F_GetFieldAsString( f.get(), 0 ) ) ) : QVariant( fld.type() ) );
|
||||
|
||||
if ( limit >= 0 && uniqueValues.size() >= limit )
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user