Skip to content

Commit

Permalink
Error string is mutable
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Jun 7, 2021
1 parent eb7d465 commit 5729958
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion python/core/auto_generated/qgsauxiliarystorage.sip.in
Expand Up @@ -338,7 +338,7 @@ Saves the current database.
:return: ``True`` if everything is saved, ``False`` otherwise
%End

QgsAuxiliaryLayer *createAuxiliaryLayer( const QgsField &field, QgsVectorLayer *layer, QString *errorMessage /Out/ = 0 ) const /Factory/;
QgsAuxiliaryLayer *createAuxiliaryLayer( const QgsField &field, QgsVectorLayer *layer ) const /Factory/;
%Docstring
Creates an auxiliary layer for a vector layer. A new table is created if
necessary. The primary key to use to construct the auxiliary layer is
Expand Down
9 changes: 2 additions & 7 deletions src/core/qgsauxiliarystorage.cpp
Expand Up @@ -611,7 +611,7 @@ bool QgsAuxiliaryStorage::save() const
}
}

QgsAuxiliaryLayer *QgsAuxiliaryStorage::createAuxiliaryLayer( const QgsField &field, QgsVectorLayer *layer, QString *errorMessage ) const
QgsAuxiliaryLayer *QgsAuxiliaryStorage::createAuxiliaryLayer( const QgsField &field, QgsVectorLayer *layer ) const
{
QgsAuxiliaryLayer *alayer = nullptr;

Expand All @@ -623,13 +623,8 @@ QgsAuxiliaryLayer *QgsAuxiliaryStorage::createAuxiliaryLayer( const QgsField &fi

if ( !tableExists( table, database.get() ) )
{
QString msg;
if ( !createTable( field.typeName(), table, database.get(), msg ) )
if ( !createTable( field.typeName(), table, database.get(), mErrorString ) )
{
if ( errorMessage )
{
*errorMessage = msg;
}
return alayer;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsauxiliarystorage.h
Expand Up @@ -381,7 +381,7 @@ class CORE_EXPORT QgsAuxiliaryStorage
*
* \returns A new auxiliary layer or NULLPTR if an error happened.
*/
QgsAuxiliaryLayer *createAuxiliaryLayer( const QgsField &field, QgsVectorLayer *layer, QString *errorMessage SIP_OUT = nullptr ) const SIP_FACTORY;
QgsAuxiliaryLayer *createAuxiliaryLayer( const QgsField &field, QgsVectorLayer *layer ) const SIP_FACTORY;

/**
* Removes a table from the auxiliary storage.
Expand Down Expand Up @@ -437,7 +437,7 @@ class CORE_EXPORT QgsAuxiliaryStorage
QString mFileName; // original filename
QString mTmpFileName; // temporary filename used in copy mode
bool mCopy = false;
QString mErrorString;
mutable QString mErrorString;
};

#endif

0 comments on commit 5729958

Please sign in to comment.