System.Data.SQLite
Check-in [fb22170bc8]
Not logged in

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

Overview
Comment:Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent superfluous error messages. Fix for ticket [72905c9a77].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fb22170bc8b5033bc85977f91f511c2466091e4e
User & Date: mistachkin 2012-02-28 15:07:56
References
2012-02-28
15:08 Ticket [72905c9a77] SQLite error (21): misuse at line 112492 of [ebd01a8def] status still Open with 2 other changes artifact: 33945d6ab6 user: mistachkin
Context
2012-02-28
17:35
Stop using the 'StringComparison.InvariantCulture*' values. check-in: 3137eacf49 user: mistachkin tags: trunk
15:07
Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent superfluous error messages. Fix for ticket [72905c9a77]. check-in: fb22170bc8 user: mistachkin tags: trunk
2012-02-24
16:10
Revise previous commit, add parenthesis to make the MSBuild conditional correct in all cases. check-in: 700ca65faa user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

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

20
21
22
23
24
25
26


27
28
29
30
31
32
33
....
1387
1388
1389
1390
1391
1392
1393






1394
1395
1396
1397
1398
1399
1400
....
1416
1417
1418
1419
1420
1421
1422

1423
1424
1425
1426
1427
1428
1429
  internal delegate void SQLiteLogCallback(IntPtr puser, int err_code, IntPtr message);

  /// <summary>
  /// This class implements SQLiteBase completely, and is the guts of the code that interop's SQLite with .NET
  /// </summary>
  internal class SQLite3 : SQLiteBase
  {


    //
    // NOTE: This is the public key for the System.Data.SQLite assembly.  If you change the
    //       SNK file, you will need to change this as well.
    //
    internal const string PublicKey =
        "002400000480000094000000060200000024000052534131000400000100010005a288de5687c4e1" +
        "b621ddff5d844727418956997f475eb829429e411aff3e93f97b70de698b972640925bdd44280df0" +
................................................................................
    /// </summary>
    /// <returns>
    /// A boolean indicating whether or not the SQLite core library has been
    /// initialized for the current process.
    /// </returns>
    internal static bool StaticIsInitialized()
    {






#if !PLATFORM_COMPACTFRAMEWORK
        //
        // NOTE: Save the state of the logging class and then restore it
        //       after we are done to avoid logging too many false errors.
        //
        bool savedEnabled = SQLiteLog.Enabled;
        SQLiteLog.Enabled = false;
................................................................................
        }
        finally
        {
            SQLiteLog.Enabled = savedEnabled;
        }
#endif
    }


    /// <summary>
    /// Helper function to retrieve a column of data from an active statement.
    /// </summary>
    /// <param name="stmt">The statement being step()'d through</param>
    /// <param name="index">The column index to retrieve</param>
    /// <param name="typ">The type of data contained in the column.  If Uninitialized, this function will retrieve the datatype information.</param>







>
>







 







>
>
>
>
>
>







 







>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
....
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
....
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
  internal delegate void SQLiteLogCallback(IntPtr puser, int err_code, IntPtr message);

  /// <summary>
  /// This class implements SQLiteBase completely, and is the guts of the code that interop's SQLite with .NET
  /// </summary>
  internal class SQLite3 : SQLiteBase
  {
    private static object syncRoot = new object();

    //
    // NOTE: This is the public key for the System.Data.SQLite assembly.  If you change the
    //       SNK file, you will need to change this as well.
    //
    internal const string PublicKey =
        "002400000480000094000000060200000024000052534131000400000100010005a288de5687c4e1" +
        "b621ddff5d844727418956997f475eb829429e411aff3e93f97b70de698b972640925bdd44280df0" +
................................................................................
    /// </summary>
    /// <returns>
    /// A boolean indicating whether or not the SQLite core library has been
    /// initialized for the current process.
    /// </returns>
    internal static bool StaticIsInitialized()
    {
        //
        // BUGFIX: Prevent races with other threads for this entire block, due
        //         to the try/finally semantics.  See ticket [72905c9a77].
        //
        lock (syncRoot)
        {
#if !PLATFORM_COMPACTFRAMEWORK
            //
            // NOTE: Save the state of the logging class and then restore it
            //       after we are done to avoid logging too many false errors.
            //
            bool savedEnabled = SQLiteLog.Enabled;
            SQLiteLog.Enabled = false;
................................................................................
            }
            finally
            {
                SQLiteLog.Enabled = savedEnabled;
            }
#endif
        }
    }

    /// <summary>
    /// Helper function to retrieve a column of data from an active statement.
    /// </summary>
    /// <param name="stmt">The statement being step()'d through</param>
    /// <param name="index">The column index to retrieve</param>
    /// <param name="typ">The type of data contained in the column.  If Uninitialized, this function will retrieve the datatype information.</param>