System.Data.SQLite
Check-in [527eeeec4c]
Not logged in

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

Overview
Comment:Yet more coding style changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 527eeeec4c8a5aec1e7dde7ee3b0c9b73805ce08
User & Date: mistachkin 2016-11-04 00:17:51
Context
2016-11-04
00:20
Make the SQLiteTransaction.IssueRollback method private. check-in: d3ee02a73a user: mistachkin tags: trunk
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
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLiteTransaction.cs.

    53     53               if (_cnn._transactionLevel++ == 0)
    54     54               {
    55     55                   try
    56     56                   {
    57     57                       using (SQLiteCommand cmd = _cnn.CreateCommand())
    58     58                       {
    59     59                           if (!deferredLock)
    60         -                            cmd.CommandText = "BEGIN IMMEDIATE";
           60  +                            cmd.CommandText = "BEGIN IMMEDIATE;";
    61     61                           else
    62         -                            cmd.CommandText = "BEGIN";
           62  +                            cmd.CommandText = "BEGIN;";
    63     63   
    64     64                           cmd.ExecuteNonQuery();
    65     65                       }
    66     66                   }
    67     67                   catch (SQLiteException)
    68     68                   {
    69     69                       _cnn._transactionLevel--;
    70     70                       _cnn = null;
           71  +
    71     72                       throw;
    72     73                   }
    73     74               }
    74     75           }
    75     76   
    76     77           ///////////////////////////////////////////////////////////////////////////////////////////////
    77     78   
................................................................................
   136    137               SQLiteConnection.Check(_cnn);
   137    138               IsValid(true);
   138    139   
   139    140               if (_cnn._transactionLevel - 1 == 0)
   140    141               {
   141    142                   using (SQLiteCommand cmd = _cnn.CreateCommand())
   142    143                   {
   143         -                    cmd.CommandText = "COMMIT";
          144  +                    cmd.CommandText = "COMMIT;";
   144    145                       cmd.ExecuteNonQuery();
   145    146                   }
   146    147               }
   147    148               _cnn._transactionLevel--;
   148    149               _cnn = null;
   149    150           }
   150    151   
................................................................................
   189    190               SQLiteConnection.Check(_cnn);
   190    191               IsValid(true);
   191    192               IssueRollback(true);
   192    193           }
   193    194   
   194    195           ///////////////////////////////////////////////////////////////////////////////////////////////
   195    196   
          197  +        /// <summary>
          198  +        /// Issue a ROLLBACK command against the database connection,
          199  +        /// optionally re-throwing any caught exception.
          200  +        /// </summary>
          201  +        /// <param name="throwError">
          202  +        /// Non-zero to re-throw caught exceptions.
          203  +        /// </param>
   196    204           internal void IssueRollback(bool throwError)
   197    205           {
   198    206               SQLiteConnection cnn = Interlocked.Exchange(ref _cnn, null);
   199    207   
   200    208               if (cnn != null)
   201    209               {
   202    210                   try
   203    211                   {
   204    212                       using (SQLiteCommand cmd = cnn.CreateCommand())
   205    213                       {
   206         -                        cmd.CommandText = "ROLLBACK";
          214  +                        cmd.CommandText = "ROLLBACK;";
   207    215                           cmd.ExecuteNonQuery();
   208    216                       }
   209    217                   }
   210    218                   catch
   211    219                   {
   212    220                       if (throwError)
   213    221                           throw;
................................................................................
   214    222                   }
   215    223                   cnn._transactionLevel = 0;
   216    224               }
   217    225           }
   218    226   
   219    227           ///////////////////////////////////////////////////////////////////////////////////////////////
   220    228   
          229  +        /// <summary>
          230  +        /// Checks the state of this transaction, optionally throwing an exception if a state inconsistency is found.
          231  +        /// </summary>
          232  +        /// <param name="throwError">
          233  +        /// Non-zero to throw an exception if a state inconsistency is found.
          234  +        /// </param>
          235  +        /// <returns>
          236  +        /// Non-zero if this transaction is valid; otherwise, false.
          237  +        /// </returns>
   221    238           internal bool IsValid(bool throwError)
   222    239           {
   223    240               if (_cnn == null)
   224    241               {
   225    242                   if (throwError == true) throw new ArgumentNullException("No connection associated with this transaction");
   226    243                   else return false;
   227    244               }