39 if ( !createTransaction )
72 foreach (
const QString& layerId, layerIds )
85 : mConnString( connString ), mTransactionActive( false )
91 setLayerTransactionIds( 0 );
96 if ( mTransactionActive )
129 mLayers.
insert( layerId );
135 if ( mTransactionActive )
141 if ( !beginTransaction( errorMsg, statementTimeout ) )
146 setLayerTransactionIds(
this );
147 mTransactionActive =
true;
153 if ( !mTransactionActive )
158 foreach (
const QString& layerid, mLayers )
167 if ( !commitTransaction( errorMsg ) )
172 setLayerTransactionIds( 0 );
173 mTransactionActive =
false;
179 if ( !mTransactionActive )
184 foreach (
const QString& layerid, mLayers )
193 if ( !rollbackTransaction( errorMsg ) )
198 setLayerTransactionIds( 0 );
199 mTransactionActive =
false;
203 void QgsTransaction::setLayerTransactionIds(
QgsTransaction* transaction )
205 foreach (
const QString& layerid, mLayers )
virtual bool isEditable() const
True if the layer can be edited.
static QgsTransaction * create(const QString &connString, const QString &providerKey)
Creates a transaction for the specified connection string and provider.
Base class for all map layer types.
virtual ~QgsTransaction()
static QgsProviderRegistry * instance(QString pluginPath=QString::null)
means of accessing canonical single instance
virtual QgsTransaction * transaction() const
Returns the transaction this data provider is included in, if any.
QgsTransaction * createTransaction_t(const QString &connString)
const_iterator insert(const T &value)
virtual bool isEditable() const override
Returns true if the provider is in editing mode.
bool commit(QString &errorMsg)
Commit transaction.
virtual QString name() const =0
return a provider name
const QString & source() const
Returns the source for the layer.
bool addLayer(const QString &layerId)
Add layer to the transaction.
virtual int capabilities() const
Returns a bitmask containing the supported capabilities Note, some capabilities may change depending ...
Class for storing the component parts of a PostgreSQL/RDBMS datasource URI.
QLibrary * providerLibrary(const QString &providerKey) const
QgsTransaction(const QString &connString)
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
void * resolve(const char *symbol)
This class allows to include a set of layers in a database-side transaction, provided the layer data ...
QgsMapLayer * mapLayer(QString theLayerId)
Retrieve a pointer to a loaded layer by id.
bool rollback(QString &errorMsg)
Roll back transaction.
void(*)() cast_to_fptr(void *p)
QgsVectorDataProvider * dataProvider()
Returns the data provider.
Represents a vector layer which manages a vector based data sets.
bool begin(QString &errorMsg, int statementTimeout=20)
Begin transaction The statement timeout, in seconds, specifies how long an sql statement is allowed t...