System.Data.SQLite
Check-in [301207ad6d]
Not logged in

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

Overview
Comment:Modify experimental WaitForEnlistmentReset method to require a nullable boolean parameter for the value to return when the connection is disposed.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 301207ad6da567a8501d398b1b391d62e5f5a733
User & Date: mistachkin 2018-02-27 17:04:51
Context
2018-02-27
17:24
Adjust the test constraints impacted by Mono 5.10. check-in: 2814aa20f8 user: mistachkin tags: trunk
17:04
Modify experimental WaitForEnlistmentReset method to require a nullable boolean parameter for the value to return when the connection is disposed. check-in: 301207ad6d user: mistachkin tags: trunk
16:32
Test constraint fixes. check-in: 5419324a5d user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Doc/Extra/Provider/version.html.

45
46
47
48
49
50
51

52
53
54
55
56
57
58
    <h1 class="heading">Version History</h1>
    <p><b>1.0.108.0 - March XX, 2018 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
      <li>Override System.Object members for the SQLiteException class to improve its ToString return value. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/53962f9eff">[53962f9eff]</a>.</li>
      <li>More database connection configuration options for the <a href="https://www.sqlite.org/c3ref/db_config.html">sqlite3_db_config()</a> interface.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Set HResult property of SQLiteException based on the SQLite core library error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>

    </ul>
    <p><b>1.0.107.0 - January 30, 2018</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_22_0.html">SQLite 3.22.0</a>.</li>
      <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>
      <li>Support asynchronous completion of distributed transactions. Fix for <a href="https://system.data.sqlite.org/index.html/info/5cee5409f8">[5cee5409f8]</a>.</li>
      <li>Add experimental WaitForEnlistmentReset method to the SQLiteConnection class. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/7e1dd697dc">[7e1dd697dc]</a>.</li>







>







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
    <h1 class="heading">Version History</h1>
    <p><b>1.0.108.0 - March XX, 2018 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
      <li>Override System.Object members for the SQLiteException class to improve its ToString return value. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/53962f9eff">[53962f9eff]</a>.</li>
      <li>More database connection configuration options for the <a href="https://www.sqlite.org/c3ref/db_config.html">sqlite3_db_config()</a> interface.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Set HResult property of SQLiteException based on the SQLite core library error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Modify experimental WaitForEnlistmentReset method to require a nullable boolean parameter for the value to return when the connection is disposed.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    </ul>
    <p><b>1.0.107.0 - January 30, 2018</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_22_0.html">SQLite 3.22.0</a>.</li>
      <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>
      <li>Support asynchronous completion of distributed transactions. Fix for <a href="https://system.data.sqlite.org/index.html/info/5cee5409f8">[5cee5409f8]</a>.</li>
      <li>Add experimental WaitForEnlistmentReset method to the SQLiteConnection class. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/7e1dd697dc">[7e1dd697dc]</a>.</li>

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

3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
....
3484
3485
3486
3487
3488
3489
3490





3491
3492
3493
3494
3495
3496
3497
....
3503
3504
3505
3506
3507
3508
3509





3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520

3521
3522

3523


3524
3525
3526
3527
3528
3529
3530
                SQLiteConnectionFlags.WaitForEnlistmentReset);

            waitTimeout = _waitTimeout;
        }

        if (waitForEnlistmentReset)
            /* IGNORED */
            WaitForEnlistmentReset(waitTimeout);

        lock (_enlistmentSyncRoot) /* TRANSACTIONAL */
        {
            if (_enlistment != null && transaction == _enlistment._scope)
                return;
            else if (_enlistment != null)
                throw new ArgumentException("Already enlisted in a transaction");
................................................................................
    /// This method always throws <see cref="NotImplementedException" /> when
    /// running on the .NET Compact Framework.
    /// </summary>
    /// <param name="timeoutMilliseconds">
    /// The approximate maximum number of milliseconds to wait before timing
    /// out the wait operation.
    /// </param>





    /// <returns>
    /// Non-zero if the enlistment assciated with this connection was reset;
    /// otherwise, zero.  It should be noted that this method returning a
    /// non-zero value does not necessarily guarantee that the connection
    /// can enlist in a new transaction (i.e. due to potentical race with
    /// other threads); therefore, callers should generally use try/catch
    /// when calling the <see cref="EnlistTransaction" /> method.
................................................................................
    /// This method always throws <see cref="NotImplementedException" /> when
    /// running on the .NET Compact Framework.
    /// </summary>
    /// <param name="timeoutMilliseconds">
    /// The approximate maximum number of milliseconds to wait before timing
    /// out the wait operation.
    /// </param>





    /// <returns>
    /// Non-zero if the enlistment assciated with this connection was reset;
    /// otherwise, zero.  It should be noted that this method returning a
    /// non-zero value does not necessarily guarantee that the connection
    /// can enlist in a new transaction (i.e. due to potentical race with
    /// other threads); therefore, callers should generally use try/catch
    /// when calling the EnlistTransaction method.
    /// </returns>
#endif
    public bool WaitForEnlistmentReset(
        int timeoutMilliseconds

        )
    {

        CheckDisposed();



#if !PLATFORM_COMPACTFRAMEWORK
        if (timeoutMilliseconds < 0)
            throw new ArgumentException("timeout cannot be negative");

        const int defaultMilliseconds = 100;
        int sleepMilliseconds;







|







 







>
>
>
>
>







 







>
>
>
>
>










|
>


>
|
>
>







3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
....
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
....
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
                SQLiteConnectionFlags.WaitForEnlistmentReset);

            waitTimeout = _waitTimeout;
        }

        if (waitForEnlistmentReset)
            /* IGNORED */
            WaitForEnlistmentReset(waitTimeout, null);

        lock (_enlistmentSyncRoot) /* TRANSACTIONAL */
        {
            if (_enlistment != null && transaction == _enlistment._scope)
                return;
            else if (_enlistment != null)
                throw new ArgumentException("Already enlisted in a transaction");
................................................................................
    /// This method always throws <see cref="NotImplementedException" /> when
    /// running on the .NET Compact Framework.
    /// </summary>
    /// <param name="timeoutMilliseconds">
    /// The approximate maximum number of milliseconds to wait before timing
    /// out the wait operation.
    /// </param>
    /// <param name="returnOnDisposed">
    /// The return value to use if the connection has been disposed; if this
    /// value is null, <see cref="ObjectDisposedException" /> will be raised
    /// if the connection has been disposed.
    /// </param>
    /// <returns>
    /// Non-zero if the enlistment assciated with this connection was reset;
    /// otherwise, zero.  It should be noted that this method returning a
    /// non-zero value does not necessarily guarantee that the connection
    /// can enlist in a new transaction (i.e. due to potentical race with
    /// other threads); therefore, callers should generally use try/catch
    /// when calling the <see cref="EnlistTransaction" /> method.
................................................................................
    /// This method always throws <see cref="NotImplementedException" /> when
    /// running on the .NET Compact Framework.
    /// </summary>
    /// <param name="timeoutMilliseconds">
    /// The approximate maximum number of milliseconds to wait before timing
    /// out the wait operation.
    /// </param>
    /// <param name="returnOnDisposed">
    /// The return value to use if the connection has been disposed; if this
    /// value is null, <see cref="ObjectDisposedException" /> will be raised
    /// if the connection has been disposed.
    /// </param>
    /// <returns>
    /// Non-zero if the enlistment assciated with this connection was reset;
    /// otherwise, zero.  It should be noted that this method returning a
    /// non-zero value does not necessarily guarantee that the connection
    /// can enlist in a new transaction (i.e. due to potentical race with
    /// other threads); therefore, callers should generally use try/catch
    /// when calling the EnlistTransaction method.
    /// </returns>
#endif
    public bool WaitForEnlistmentReset(
        int timeoutMilliseconds,
        bool? returnOnDisposed
        )
    {
        if (returnOnDisposed == null)
            CheckDisposed();
        else if(disposed)
            return (bool)returnOnDisposed;

#if !PLATFORM_COMPACTFRAMEWORK
        if (timeoutMilliseconds < 0)
            throw new ArgumentException("timeout cannot be negative");

        const int defaultMilliseconds = 100;
        int sleepMilliseconds;

Changes to Tests/tkt-5cee5409f8.eagle.

152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
        private static void WaitOnEnlistments(object state)
        {
          SQLiteConnection connection = (SQLiteConnection)state;
          Random random = new Random();

          for (int iteration = 0; iteration < 1000; iteration++)
          {
            if (connection.WaitForEnlistmentReset(1))
              Interlocked.Increment(ref resetCount);
            else
              Interlocked.Increment(ref timeoutCount);

            Thread.Sleep(random.Next(100));
          }
        }







|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
        private static void WaitOnEnlistments(object state)
        {
          SQLiteConnection connection = (SQLiteConnection)state;
          Random random = new Random();

          for (int iteration = 0; iteration < 1000; iteration++)
          {
            if (connection.WaitForEnlistmentReset(1, false))
              Interlocked.Increment(ref resetCount);
            else
              Interlocked.Increment(ref timeoutCount);

            Thread.Sleep(random.Next(100));
          }
        }

Changes to readme.htm.

211
212
213
214
215
216
217

218
219
220
221
222
223
224
    <b>1.0.108.0 - March XX, 2018</b>
</p>
<ul>
    <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
    <li>Override System.Object members for the SQLiteException class to improve its ToString return value. Pursuant to [53962f9eff].</li>
    <li>More database connection configuration options for the <a href="https://www.sqlite.org/c3ref/db_config.html">sqlite3_db_config()</a> interface.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Set HResult property of SQLiteException based on the SQLite core library error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>

</ul>
<p>
    <b>1.0.107.0 - January 30, 2018</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_22_0.html">SQLite 3.22.0</a>.</li>
    <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>







>







211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
    <b>1.0.108.0 - March XX, 2018</b>
</p>
<ul>
    <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
    <li>Override System.Object members for the SQLiteException class to improve its ToString return value. Pursuant to [53962f9eff].</li>
    <li>More database connection configuration options for the <a href="https://www.sqlite.org/c3ref/db_config.html">sqlite3_db_config()</a> interface.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Set HResult property of SQLiteException based on the SQLite core library error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Modify experimental WaitForEnlistmentReset method to require a nullable boolean parameter for the value to return when the connection is disposed.&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.107.0 - January 30, 2018</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_22_0.html">SQLite 3.22.0</a>.</li>
    <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>

Changes to www/news.wiki.

48
49
50
51
52
53
54

55
56
57
58
59
60
61
    <b>1.0.108.0 - March XX, 2018 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
    <li>Override System.Object members for the SQLiteException class to improve its ToString return value. Pursuant to [53962f9eff].</li>
    <li>More database connection configuration options for the [https://www.sqlite.org/c3ref/db_config.html|sqlite3_db_config()] interface.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Set HResult property of SQLiteException based on the SQLite core library error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>

</ul>
<p>
    <b>1.0.107.0 - January 30, 2018</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_22_0.html|SQLite 3.22.0].</li>
    <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>







>







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
    <b>1.0.108.0 - March XX, 2018 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
    <li>Override System.Object members for the SQLiteException class to improve its ToString return value. Pursuant to [53962f9eff].</li>
    <li>More database connection configuration options for the [https://www.sqlite.org/c3ref/db_config.html|sqlite3_db_config()] interface.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Set HResult property of SQLiteException based on the SQLite core library error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Modify experimental WaitForEnlistmentReset method to require a nullable boolean parameter for the value to return when the connection is disposed.&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.107.0 - January 30, 2018</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_22_0.html|SQLite 3.22.0].</li>
    <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>