18 #ifndef QGSTRANSACTION_H
19 #define QGSTRANSACTION_H
27 #include "qgis_core.h"
93 bool begin( QString &errorMsg
SIP_OUT,
int statementTimeout = 20 );
98 bool commit( QString &errorMsg
SIP_OUT );
103 bool rollback( QString &errorMsg
SIP_OUT );
115 virtual bool executeSql(
const QString &sql, QString &error
SIP_OUT,
bool isDirty =
false,
const QString &name = QString() ) = 0;
128 QString createSavepoint( QString &error
SIP_OUT );
135 virtual QString createSavepoint(
const QString &savePointId, QString &error
SIP_OUT );
141 virtual bool rollbackToSavepoint(
const QString &name, QString &error
SIP_OUT );
147 void dirtyLastSavePoint();
153 QList< QString >
savePoints()
const {
return QList< QString >::fromVector( mSavepoints ); }
163 static QString connectionString(
const QString &layerUri )
SIP_SKIP;
176 void dirtied(
const QString &sql,
const QString &name );
187 void onLayerDeleted();
191 QSet<QgsVectorLayer *> mLayers;
195 static QString removeLayerIdOrName(
const QString &
str );
197 virtual bool beginTransaction( QString &error,
int statementTimeout ) = 0;
198 virtual bool commitTransaction( QString &error ) = 0;
199 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.