QGIS API Documentation
2.14.0-Essen
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
core
qgstransaction.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgstransaction.h
3
----------------
4
begin : May 5, 2014
5
copyright : (C) 2014 by Marco Hugentobler
6
email : marco dot hugentobler at sourcepole dot ch
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSTRANSACTION_H
19
#define QGSTRANSACTION_H
20
21
#include <QSet>
22
#include <QString>
23
#include <QObject>
24
25
class
QgsVectorDataProvider
;
26
class
QgsVectorLayer
;
27
49
class
CORE_EXPORT
QgsTransaction
:
public
QObject
50
{
51
Q_OBJECT
52
53
public
:
55
static
QgsTransaction
* create(
const
QString
& connString,
const
QString
& providerKey );
56
59
static
QgsTransaction
* create(
const
QStringList
& layerIds );
60
61
virtual
~
QgsTransaction
();
62
64
bool
addLayer(
const
QString
& layerId );
65
67
bool
addLayer(
QgsVectorLayer
* layer );
68
77
bool
begin(
QString
& errorMsg,
int
statementTimeout = 20 );
78
80
bool
commit(
QString
& errorMsg );
81
83
bool
rollback(
QString
& errorMsg );
84
86
virtual
bool
executeSql(
const
QString
& sql,
QString
& error ) = 0;
87
91
static
bool
supportsTransaction(
const
QgsVectorLayer
* layer );
92
93
signals:
97
void
afterRollback();
98
99
private
slots:
100
void
onLayersDeleted(
const
QStringList
& layerids );
101
102
protected
:
103
QgsTransaction
(
const
QString
& connString );
104
105
QString
mConnString
;
106
107
private
:
108
QgsTransaction
(
const
QgsTransaction
& other );
109
const
QgsTransaction
& operator=(
const
QgsTransaction
& other );
110
111
bool
mTransactionActive;
112
QSet<QgsVectorLayer*>
mLayers;
113
114
void
setLayerTransactionIds(
QgsTransaction
*transaction );
115
116
virtual
bool
beginTransaction(
QString
& error,
int
statementTimeout ) = 0;
117
virtual
bool
commitTransaction(
QString
& error ) = 0;
118
virtual
bool
rollbackTransaction(
QString
& error ) = 0;
119
};
120
121
#endif // QGSTRANSACTION_H
QgsTransaction::mConnString
QString mConnString
Definition:
qgstransaction.h:105
QObject
QSet< QgsVectorLayer * >
QString
QStringList
QgsTransaction
This class allows including a set of layers in a database-side transaction, provided the layer data p...
Definition:
qgstransaction.h:49
QgsVectorDataProvider
This is the base class for vector data providers.
Definition:
qgsvectordataprovider.h:49
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition:
qgsvectorlayer.h:386
Generated on Sat Feb 27 2016 18:33:25 for QGIS API Documentation by
1.8.11