System.Data.SQLite

Check-in [1d3fab1dd9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More coding style changes.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1d3fab1dd904a4e3c20d44b38e00d0a5c3ef6c9b
User & Date: mistachkin 2016-11-04 00:15:01.094
Context
2016-11-04
00:17
Yet more coding style changes. check-in: 527eeeec4c user: mistachkin tags: trunk
00:15
More coding style changes. check-in: 1d3fab1dd9 user: mistachkin tags: trunk
00:13
Make whitespace uniform. check-in: 845fa69297 user: mistachkin tags: trunk
Changes
Side-by-Side Diff Show Whitespace Changes Patch
Changes to System.Data.SQLite/SQLiteTransaction.cs.
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
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







+
+









+
+
-
+
+
+
+
+
+
+

+
+







namespace System.Data.SQLite
{
    using System;
    using System.Data;
    using System.Data.Common;
    using System.Threading;

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// SQLite implementation of DbTransaction.
    /// </summary>
    public sealed class SQLiteTransaction : DbTransaction
    {
        /// <summary>
        /// The connection to which this transaction is bound
        /// </summary>
        internal SQLiteConnection _cnn;

        /// <summary>
        internal int _version; // Matches the version of the connection
        /// Matches the version of the connection.
        /// </summary>
        private int _version;

        /// <summary>
        /// The isolation level for this transaction.
        /// </summary>
        private IsolationLevel _level;

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs the transaction object, binding it to the supplied connection
        /// </summary>
        /// <param name="connection">The connection to open a transaction on</param>
        /// <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param>
        internal SQLiteTransaction(SQLiteConnection connection, bool deferredLock)
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
172


173
174
175
176
177
178
179
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201







+
+







+
+









+
+







+
+











+
+







                    cmd.ExecuteNonQuery();
                }
            }
            _cnn._transactionLevel--;
            _cnn = null;
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Returns the underlying connection to which this transaction applies.
        /// </summary>
        public new SQLiteConnection Connection
        {
            get { CheckDisposed(); return _cnn; }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Forwards to the local Connection property
        /// </summary>
        protected override DbConnection DbConnection
        {
            get { return Connection; }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets the isolation level of the transaction.  SQLite only supports Serializable transactions.
        /// </summary>
        public override IsolationLevel IsolationLevel
        {
            get { CheckDisposed(); return _level; }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Rolls back the active transaction.
        /// </summary>
        public override void Rollback()
        {
            CheckDisposed();
            SQLiteConnection.Check(_cnn);
            IsValid(true);
            IssueRollback(true);
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        internal void IssueRollback(bool throwError)
        {
            SQLiteConnection cnn = Interlocked.Exchange(ref _cnn, null);

            if (cnn != null)
            {
189
190
191
192
193
194
195


196
197
198
199
200
201
202
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226







+
+







                {
                    if (throwError)
                        throw;
                }
                cnn._transactionLevel = 0;
            }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        internal bool IsValid(bool throwError)
        {
            if (_cnn == null)
            {
                if (throwError == true) throw new ArgumentNullException("No connection associated with this transaction");
                else return false;