System.Data.SQLite

Check-in [06756ebc51]
Login

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

Overview
Comment:Merge updates from trunk.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | tkt-5cee5409f8
Files: files | file ages | folders
SHA1: 06756ebc51b06b0b1e6a729521107d506464441e
User & Date: mistachkin 2018-01-26 01:51:26.474
Context
2018-01-26
02:23
Merge updates from trunk. check-in: 596797845c user: mistachkin tags: tkt-5cee5409f8
01:51
Merge updates from trunk. check-in: 06756ebc51 user: mistachkin tags: tkt-5cee5409f8
01:47
Setup the '_debugString' field consistently, for the debug build configuration only. check-in: ac4cc4a86e user: mistachkin tags: trunk
01:28
Merge updates from trunk. check-in: 82138de582 user: mistachkin tags: tkt-5cee5409f8
Changes
Unified Diff Ignore Whitespace Patch
Changes to System.Data.SQLite/SQLiteConnection.cs.
1437
1438
1439
1440
1441
1442
1443

1444
1445
1446
1447
1448
1449
1450

1451
1452
1453
1454
1455
1456
1457
    private ConnectionState _connectionState;

    /// <summary>
    /// The connection string
    /// </summary>
    private string _connectionString;


    /// <summary>
    /// This string will contain enough information to identify this connection,
    /// e.g. the database file name, original thread, etc.  It is not currently
    /// exposed via the public interface as it is intended for use only when
    /// debugging this library.
    /// </summary>
    private string _debugString;


    /// <summary>
    /// Nesting level of the transactions open on the connection
    /// </summary>
    internal int _transactionLevel;

    /// <summary>







>







>







1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
    private ConnectionState _connectionState;

    /// <summary>
    /// The connection string
    /// </summary>
    private string _connectionString;

#if DEBUG
    /// <summary>
    /// This string will contain enough information to identify this connection,
    /// e.g. the database file name, original thread, etc.  It is not currently
    /// exposed via the public interface as it is intended for use only when
    /// debugging this library.
    /// </summary>
    private string _debugString;
#endif

    /// <summary>
    /// Nesting level of the transactions open on the connection
    /// </summary>
    internal int _transactionLevel;

    /// <summary>
1663
1664
1665
1666
1667
1668
1669







1670
1671
1672
1673
1674
1675
1676

        _flags = SQLiteConnectionFlags.None;

        _connectionState = (db != IntPtr.Zero) ?
            ConnectionState.Open : ConnectionState.Closed;

        _connectionString = null; /* unknown */







    }
#endif

    /// <summary>
    /// Initializes the connection with the specified connection string.
    /// </summary>
    /// <param name="connectionString">







>
>
>
>
>
>
>







1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685

        _flags = SQLiteConnectionFlags.None;

        _connectionState = (db != IntPtr.Zero) ?
            ConnectionState.Open : ConnectionState.Closed;

        _connectionString = null; /* unknown */

#if DEBUG
        _debugString = HelperMethods.StringFormat(
            CultureInfo.InvariantCulture,
            "db = {0}, fileName = {1}, ownHandle = {2}",
            db, fileName, ownHandle);
#endif
    }
#endif

    /// <summary>
    /// Initializes the connection with the specified connection string.
    /// </summary>
    /// <param name="connectionString">
1744
1745
1746
1747
1748
1749
1750




1751
1752
1753
1754
1755
1756
1757
    /// function will open its own connection, enumerate any attached databases of the original connection, and automatically
    /// attach to them.
    /// </summary>
    /// <param name="connection">The connection to copy the settings from.</param>
    public SQLiteConnection(SQLiteConnection connection)
      : this(connection.ConnectionString, connection.ParseViaFramework)
    {




      if (connection.State == ConnectionState.Open)
      {
        Open();

        // Reattach all attached databases from the existing connection
        using (DataTable tbl = connection.GetSchema("Catalogs"))
        {







>
>
>
>







1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
    /// function will open its own connection, enumerate any attached databases of the original connection, and automatically
    /// attach to them.
    /// </summary>
    /// <param name="connection">The connection to copy the settings from.</param>
    public SQLiteConnection(SQLiteConnection connection)
      : this(connection.ConnectionString, connection.ParseViaFramework)
    {
#if DEBUG
      _debugString = connection._debugString;
#endif

      if (connection.State == ConnectionState.Open)
      {
        Open();

        // Reattach all attached databases from the existing connection
        using (DataTable tbl = connection.GetSchema("Catalogs"))
        {
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
        if ((_flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning)
        {
            if (_noDispose)
            {
                System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "WARNING: Disposing of connection \"{0}\" with the no-dispose flag set.",
                    _debugString));
            }
        }
#endif

        _disposing = true;

        try







|







2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
        if ((_flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning)
        {
            if (_noDispose)
            {
                System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "WARNING: Disposing of connection \"{0}\" with the no-dispose flag set.",
                    _connectionString));
            }
        }
#endif

        _disposing = true;

        try
2920
2921
2922
2923
2924
2925
2926




2927
2928
2929
2930
2931
2932
2933

          if (enlistment != null)
          {
            // If the connection is enlisted in a transaction scope and the scope is still active,
            // we cannot truly shut down this connection until the scope has completed.  Therefore make a
            // hidden connection temporarily to hold open the connection until the scope has completed.
            SQLiteConnection cnn = new SQLiteConnection();





            cnn._sql = _sql;
            cnn._transactionLevel = _transactionLevel;
            cnn._transactionSequence = _transactionSequence;
            cnn._enlistment = enlistment;
            cnn._connectionState = _connectionState;
            cnn._version = _version;







>
>
>
>







2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950

          if (enlistment != null)
          {
            // If the connection is enlisted in a transaction scope and the scope is still active,
            // we cannot truly shut down this connection until the scope has completed.  Therefore make a
            // hidden connection temporarily to hold open the connection until the scope has completed.
            SQLiteConnection cnn = new SQLiteConnection();

#if DEBUG
            cnn._debugString = _debugString;
#endif

            cnn._sql = _sql;
            cnn._transactionLevel = _transactionLevel;
            cnn._transactionSequence = _transactionSequence;
            cnn._enlistment = enlistment;
            cnn._connectionState = _connectionState;
            cnn._version = _version;
4199
4200
4201
4202
4203
4204
4205

4206
4207
4208
4209

4210
4211
4212
4213
4214
4215
4216
          StateChangeEventArgs eventArgs = null;
          OnStateChange(ConnectionState.Open, ref eventArgs);

          OnChanged(this, new ConnectionEventArgs(
              SQLiteConnectionEventType.Opened, eventArgs, null, null, null,
              null, _connectionString, new object[] { opts }));


          _debugString = HelperMethods.StringFormat(
              CultureInfo.InvariantCulture,
              "threadId = {0}, connectionString = {1}",
              HelperMethods.GetThreadId(), _connectionString);

        }
        catch
        {
          _connectionState = oldstate;
          throw;
        }
      }







>




>







4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
          StateChangeEventArgs eventArgs = null;
          OnStateChange(ConnectionState.Open, ref eventArgs);

          OnChanged(this, new ConnectionEventArgs(
              SQLiteConnectionEventType.Opened, eventArgs, null, null, null,
              null, _connectionString, new object[] { opts }));

#if DEBUG
          _debugString = HelperMethods.StringFormat(
              CultureInfo.InvariantCulture,
              "threadId = {0}, connectionString = {1}",
              HelperMethods.GetThreadId(), _connectionString);
#endif
        }
        catch
        {
          _connectionState = oldstate;
          throw;
        }
      }