18#ifndef QGSTRANSACTION_H
19#define QGSTRANSACTION_H
81 QString connectionString()
const;
90 bool addLayer(
QgsVectorLayer *layer,
bool addLayersInEditMode =
false );
102 bool begin( QString &errorMsg
SIP_OUT,
int statementTimeout = 20 );
107 bool commit( QString &errorMsg
SIP_OUT );
112 bool rollback( QString &errorMsg
SIP_OUT );
124 virtual bool executeSql(
const QString &sql, QString &error
SIP_OUT,
bool isDirty =
false,
const QString &name = QString() ) = 0;
137 QString createSavepoint( QString &error
SIP_OUT );
144 virtual QString createSavepoint(
const QString &savePointId, QString &error
SIP_OUT );
150 virtual bool rollbackToSavepoint(
const QString &name, QString &error
SIP_OUT );
156 void dirtyLastSavePoint();
162 QList< QString >
savePoints()
const {
return QList< QString >::fromVector( mSavepoints ); }
172 static QString connectionString(
const QString &layerUri )
SIP_SKIP;
185 void dirtied(
const QString &sql,
const QString &name );
196 void onLayerDeleted();
200 QSet<QgsVectorLayer *> mLayers;
204 static QString cleanupConnectionString(
const QString &
str );
206 virtual bool beginTransaction( QString &error,
int statementTimeout ) = 0;
207 virtual bool commitTransaction( QString &error ) = 0;
208 virtual bool rollbackTransaction( QString &error ) = 0;
This class allows including a set of layers in a database-side transaction, provided the layer data p...
QStack< QString > mSavepoints
bool mLastSavePointIsDirty
void afterRollback()
Emitted after a rollback.
QList< QString > savePoints() const
returns savepoints
virtual bool executeSql(const QString &sql, QString &error, bool isDirty=false, const QString &name=QString())=0
Execute the sql string.
bool lastSavePointIsDirty() const
returns the last created savepoint
void dirtied(const QString &sql, const QString &name)
Emitted if a sql query is executed and the underlying data is modified.
This is the base class for vector data providers.
Represents a vector layer which manages a vector based data sets.