Error string is mutable

This commit is contained in:
Blottiere Paul 2021-06-04 09:03:07 +02:00
parent eb7d465c42
commit 572995889a
3 changed files with 5 additions and 10 deletions

View File

@ -338,7 +338,7 @@ Saves the current database.
:return: ``True`` if everything is saved, ``False`` otherwise :return: ``True`` if everything is saved, ``False`` otherwise
%End %End
QgsAuxiliaryLayer *createAuxiliaryLayer( const QgsField &field, QgsVectorLayer *layer, QString *errorMessage /Out/ = 0 ) const /Factory/; QgsAuxiliaryLayer *createAuxiliaryLayer( const QgsField &field, QgsVectorLayer *layer ) const /Factory/;
%Docstring %Docstring
Creates an auxiliary layer for a vector layer. A new table is created if 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 necessary. The primary key to use to construct the auxiliary layer is

View File

@ -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; QgsAuxiliaryLayer *alayer = nullptr;
@ -623,13 +623,8 @@ QgsAuxiliaryLayer *QgsAuxiliaryStorage::createAuxiliaryLayer( const QgsField &fi
if ( !tableExists( table, database.get() ) ) if ( !tableExists( table, database.get() ) )
{ {
QString msg; if ( !createTable( field.typeName(), table, database.get(), mErrorString ) )
if ( !createTable( field.typeName(), table, database.get(), msg ) )
{ {
if ( errorMessage )
{
*errorMessage = msg;
}
return alayer; return alayer;
} }
} }

View File

@ -381,7 +381,7 @@ class CORE_EXPORT QgsAuxiliaryStorage
* *
* \returns A new auxiliary layer or NULLPTR if an error happened. * \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. * Removes a table from the auxiliary storage.
@ -437,7 +437,7 @@ class CORE_EXPORT QgsAuxiliaryStorage
QString mFileName; // original filename QString mFileName; // original filename
QString mTmpFileName; // temporary filename used in copy mode QString mTmpFileName; // temporary filename used in copy mode
bool mCopy = false; bool mCopy = false;
QString mErrorString; mutable QString mErrorString;
}; };
#endif #endif