Skip to content

Commit

Permalink
Clear supports enum values cache when attributes change
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Feb 20, 2019
1 parent 4f30a44 commit 7627fb2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -711,6 +711,10 @@ struct PGTypeInfo

bool QgsPostgresProvider::loadFields()
{

// Clear cached information about enum values support
mShared->clearSupportsEnumValuesCache();

if ( !mIsQuery )
{
QgsDebugMsg( QStringLiteral( "Loading fields for table %1" ).arg( mTableName ) );
Expand Down Expand Up @@ -5175,6 +5179,12 @@ void QgsPostgresSharedData::clear()
mFidCounter = 0;
}

void QgsPostgresSharedData::clearSupportsEnumValuesCache()
{
QMutexLocker locker( &mMutex );
mFieldSupportsEnumValues.clear();
}

bool QgsPostgresSharedData::fieldSupportsEnumValuesIsSet( int index )
{
QMutexLocker locker( &mMutex );
Expand Down
1 change: 1 addition & 0 deletions src/providers/postgres/qgspostgresprovider.h
Expand Up @@ -522,6 +522,7 @@ class QgsPostgresSharedData
QVariantList lookupKey( QgsFeatureId featureId );
void clear();

void clearSupportsEnumValuesCache( );
bool fieldSupportsEnumValuesIsSet( int index );
bool fieldSupportsEnumValues( int index );
void setFieldSupportsEnumValues( int index, bool isSupported );
Expand Down

0 comments on commit 7627fb2

Please sign in to comment.