File: qgstransaction.sip.in

package info (click to toggle)
qgis 3.40.13%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 1,185,160 kB
  • sloc: cpp: 1,615,781; python: 372,865; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,829; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 155
file content (171 lines) | stat: -rw-r--r-- 5,335 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgstransaction.h                                            *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/







class QgsTransaction : QObject /Abstract/
{
%Docstring(signature="appended")
This class allows including a set of layers in a database-side
transaction, provided the layer data providers support transactions and
are compatible with each other.

Only layers which are not in edit mode can be included in a transaction,
and all layers need to be in read-only mode for a transaction to be
committed or rolled back.

Layers can only be included in one transaction at a time.

When editing layers which are part of a transaction group, all changes
are sent directly to the data provider (bypassing the undo/redo stack),
and the changes can either be committed or rolled back on the database
side via the :py:class:`QgsTransaction`.commit and
:py:class:`QgsTransaction`.rollback methods.

As long as the transaction is active, the state of all layer features
reflects the current state in the transaction.

Edits on features can get rejected if another conflicting transaction is
active.
%End

%TypeHeaderCode
#include "qgstransaction.h"
%End
  public:

    static QgsTransaction *create( const QString &connString, const QString &providerKey ) /Factory/;
%Docstring
Create a transaction for the specified connection string ``connString``
and provider with ``providerKey``.
%End

    static QgsTransaction *create( const QSet<QgsVectorLayer *> &layers ) /Factory/;
%Docstring
Create a transaction which includes the ``layers``. All layers are
expected to have the same connection string and data provider.
%End

    ~QgsTransaction();

    QString connectionString() const;
%Docstring
Returns the connection string of the transaction

.. versionadded:: 3.26
%End

    bool addLayer( QgsVectorLayer *layer, bool addLayersInEditMode = false );
%Docstring
Add the ``layer`` to the transaction. The connection string must match.

:param layer: that will be added to the transaction
:param addLayersInEditMode: if set layers that are already

.. versionadded:: 3.26
%End

    bool begin( QString &errorMsg /Out/, int statementTimeout = 20 );
%Docstring
Begin transaction The ``statementTimeout`` (in seconds) specifies how
long an sql statement is allowed to block QGIS before it is aborted.
Statements can block, if multiple transactions are active and a
statement would produce a conflicting state. In these cases, the
statements block until the conflicting transaction is committed or
rolled back. Some providers might not honour the statement timeout.
%End

    bool commit( QString &errorMsg /Out/ );
%Docstring
Commit transaction.
%End

    bool rollback( QString &errorMsg /Out/ );
%Docstring
Roll back transaction.
%End

    virtual bool executeSql( const QString &sql, QString &error /Out/, bool isDirty = false, const QString &name = QString() ) = 0;
%Docstring
Execute the ``sql`` string.

:param sql: The sql query to execute
:param isDirty: Flag to indicate if the underlying data will be modified
:param name: Name of the transaction ( only used if `isDirty` is
             ``True``)

:return: - ``True`` if everything is OK, ``False`` otherwise
         - error: The error message
%End

    static bool supportsTransaction( const QgsVectorLayer *layer );
%Docstring
Checks if the provider of a given ``layer`` supports transactions.
%End

    QString createSavepoint( QString &error /Out/ );
%Docstring
creates a save point returns empty string on error returns the last
created savepoint if it's not dirty
%End

    virtual QString createSavepoint( const QString &savePointId, QString &error /Out/ );
%Docstring
creates a save point returns empty string on error
%End

    virtual bool rollbackToSavepoint( const QString &name, QString &error /Out/ );
%Docstring
rollback to save point, the save point is maintained and is "undertied"
%End

    void dirtyLastSavePoint();
%Docstring
dirty save point such that next call to createSavepoint will create a
new one
%End

    QList< QString > savePoints() const;
%Docstring
returns savepoints
%End

    bool lastSavePointIsDirty() const;
%Docstring
returns the last created savepoint
%End


  signals:

    void afterRollback();
%Docstring
Emitted after a rollback
%End

    void dirtied( const QString &sql, const QString &name );
%Docstring
Emitted if a sql query is executed and the underlying data is modified
%End

  protected:


};

/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgstransaction.h                                            *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/