Skip to content
Permalink
Browse files

Merge pull request #39924 from rouault/ogrprovider_httpfetchoverrider

[OGR provider] Add missing calls to QgsCPLHTTPFetchOverrider in public methods
  • Loading branch information
rouault committed Nov 10, 2020
2 parents 6711edb + a28eb21 commit b7ccbedef385bd8e1fc55d340178c25e9c9c6811
Showing with 22 additions and 0 deletions.
  1. +22 −0 src/core/providers/ogr/qgsogrprovider.cpp
@@ -964,6 +964,9 @@ QStringList QgsOgrProvider::subLayersWithoutFeatureCount() const

QStringList QgsOgrProvider::_subLayers( bool withFeatureCount ) const
{
QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg );
QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrProvider" ) );

if ( !mValid )
{
return QStringList();
@@ -1009,6 +1012,9 @@ QStringList QgsOgrProvider::_subLayers( bool withFeatureCount ) const

void QgsOgrProvider::setEncoding( const QString &e )
{
QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg );
QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrProvider" ) );

QgsSettings settings;

// if the layer has the OLCStringsAsUTF8 capability, we CANNOT override the
@@ -4038,6 +4044,8 @@ QSet<QVariant> QgsOgrProvider::uniqueValues( int index, int limit ) const
return uniqueValues; //not a provider field
}

QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg );
QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrProvider" ) );

QByteArray sql = "SELECT DISTINCT " + quotedIdentifier( textEncoding()->fromUnicode( fld.name() ) );

@@ -4096,6 +4104,9 @@ QStringList QgsOgrProvider::uniqueStringsMatching( int index, const QString &sub
return results; //not a provider field
}

QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg );
QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrProvider" ) );

QByteArray sql = "SELECT DISTINCT " + quotedIdentifier( textEncoding()->fromUnicode( fld.name() ) );
sql += " FROM " + quotedIdentifier( mOgrLayer->name() );

@@ -4131,6 +4142,9 @@ QStringList QgsOgrProvider::uniqueStringsMatching( int index, const QString &sub

QgsFeatureSource::SpatialIndexPresence QgsOgrProvider::hasSpatialIndex() const
{
QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg );
QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrProvider" ) );

if ( mOgrLayer && mOgrLayer->TestCapability( OLCFastSpatialFilter ) )
return QgsFeatureSource::SpatialIndexPresent;
else if ( mOgrLayer )
@@ -4145,6 +4159,10 @@ QVariant QgsOgrProvider::minimumValue( int index ) const
{
return QVariant();
}

QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg );
QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrProvider" ) );

const QgsField originalField = mAttributeFields.at( index );
QgsField fld = originalField;

@@ -4201,6 +4219,10 @@ QVariant QgsOgrProvider::maximumValue( int index ) const
{
return QVariant();
}

QgsCPLHTTPFetchOverrider oCPLHTTPFetcher( mAuthCfg );
QgsSetCPLHTTPFetchOverriderInitiatorClass( oCPLHTTPFetcher, QStringLiteral( "QgsOgrProvider" ) );

const QgsField originalField = mAttributeFields.at( index );
QgsField fld = originalField;

0 comments on commit b7ccbed

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