System.Data.SQLite

Check-in [a45597a38c]
Login

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

Overview
Comment:Modify transaction object disposal so that it can never cause an exception to be thrown.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a45597a38c7d50b4a6e900bf8e67aab8ae4b50ac
User & Date: mistachkin 2012-02-13 10:22:13.323
Context
2012-02-13
23:38
Add test for the transaction disposal exception handling behavior. check-in: b21d16dad9 user: mistachkin tags: trunk
10:22
Modify transaction object disposal so that it can never cause an exception to be thrown. check-in: a45597a38c user: mistachkin tags: trunk
2012-02-10
20:44
Regenerate package load key to support loading the designer package into Visual Studio 2008 without having the matching SDK installed. check-in: 67caeebd79 user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to System.Data.SQLite/SQLiteTransaction.cs.
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    if (IsValid(false))
                    {
                        IssueRollback();
                    }
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////








|







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    if (IsValid(false))
                    {
                        IssueRollback(false);
                    }
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

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
    /// <summary>
    /// Rolls back the active transaction.
    /// </summary>
    public override void Rollback()
    {
      CheckDisposed();
      IsValid(true);
      IssueRollback();
    }

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

      if (cnn != null)
      {


        using (SQLiteCommand cmd = cnn.CreateCommand())
        {
          cmd.CommandText = "ROLLBACK";
          cmd.ExecuteNonQuery();






        }
        cnn._transactionLevel = 0;
      }
    }

    internal bool IsValid(bool throwError)
    {







|


|





>
>
|
|
|
|
>
>
>
>
>
>







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
    /// <summary>
    /// Rolls back the active transaction.
    /// </summary>
    public override void Rollback()
    {
      CheckDisposed();
      IsValid(true);
      IssueRollback(true);
    }

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

      if (cnn != null)
      {
        try
        {
          using (SQLiteCommand cmd = cnn.CreateCommand())
          {
            cmd.CommandText = "ROLLBACK";
            cmd.ExecuteNonQuery();
          }
        }
        catch
        {
          if (throwError)
            throw;
        }
        cnn._transactionLevel = 0;
      }
    }

    internal bool IsValid(bool throwError)
    {