System.Data.SQLite

Check-in [cee7126f56]
Login

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

Overview
Comment:Make sure the 'No_SQLiteConnectionNewParser' and 'DefaultFlags_SQLiteConnection' setting values end up being cached.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: cee7126f56f28d0e2c74ab6a6a45b7cce1a0921a
User & Date: mistachkin 2017-05-11 01:23:27.003
References
2017-05-11
15:43
Cherrypick of [cee7126f56f28d0e], fix caching of 'No_SQLiteConnectionNewParser' and 'DefaultFlags_SQLiteConnection'. check-in: 362b7933d5 user: mistachkin tags: branch-1.0.105
Context
2017-05-11
15:43
Cherrypick of [cee7126f56f28d0e], fix caching of 'No_SQLiteConnectionNewParser' and 'DefaultFlags_SQLiteConnection'. check-in: 362b7933d5 user: mistachkin tags: branch-1.0.105
01:30
Cache the assembly directory used by the configuration subsystem. check-in: 92f1a8d6b9 user: mistachkin tags: trunk
01:23
Make sure the 'No_SQLiteConnectionNewParser' and 'DefaultFlags_SQLiteConnection' setting values end up being cached. check-in: cee7126f56 user: mistachkin tags: trunk
2017-05-10
16:53
Bump version to 1.0.106.0. Update version history docs. Update SQLite core library to the latest trunk code. check-in: e552f5ffad user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Doc/Extra/Provider/version.html.
43
44
45
46
47
48
49

50
51
52
53
54
55
56
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.106.0 - June XX, 2017 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_19_0.html">SQLite 3.19.0</a>.</li>
      <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>

    </ul>
    <p><b>1.0.105.0 - April 9, 2017</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_18_0.html">SQLite 3.18.0</a>.</li>
      <li>Add experimental support for native sha1 extension.</li>
    </ul>
    <p><b>1.0.104.0 - December 16, 2016</b></p>







>







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.106.0 - June XX, 2017 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_19_0.html">SQLite 3.19.0</a>.</li>
      <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>
      <li>Make sure the &quot;No_SQLiteConnectionNewParser&quot; and &quot;DefaultFlags_SQLiteConnection&quot; setting values end up being cached.</li>
    </ul>
    <p><b>1.0.105.0 - April 9, 2017</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_18_0.html">SQLite 3.18.0</a>.</li>
      <li>Add experimental support for native sha1 extension.</li>
    </ul>
    <p><b>1.0.104.0 - December 16, 2016</b></p>
Changes to System.Data.SQLite/SQLiteConnection.cs.
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067







3068
3069
3070
3071
3072
3073
3074
    /// Non-zero if the legacy connection string parser should be used.
    /// </returns>
    private static bool ShouldUseLegacyConnectionStringParser(
        SQLiteConnection connection
        )
    {
        string name = "No_SQLiteConnectionNewParser";
        object value; /* NOT USED */

        if ((connection != null) &&
            connection.TryGetCachedSetting(name, null, out value))
        {
            return true;
        }

        if ((connection == null) &&
            TryGetLastCachedSetting(name, null, out value))
        {
            return true;
        }

        return (UnsafeNativeMethods.GetSettingValue(name, null) != null);







    }

    /// <summary>
    /// Parses a connection string into component parts using the custom
    /// connection string parser.  An exception may be thrown if the syntax
    /// of the connection string is incorrect.
    /// </summary>







|




|





|


|
>
>
>
>
>
>
>







3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
    /// Non-zero if the legacy connection string parser should be used.
    /// </returns>
    private static bool ShouldUseLegacyConnectionStringParser(
        SQLiteConnection connection
        )
    {
        string name = "No_SQLiteConnectionNewParser";
        object value;

        if ((connection != null) &&
            connection.TryGetCachedSetting(name, null, out value))
        {
            return (value != null);
        }

        if ((connection == null) &&
            TryGetLastCachedSetting(name, null, out value))
        {
            return (value != null);
        }

        value = UnsafeNativeMethods.GetSettingValue(name, null);

        if (connection != null)
            connection.SetCachedSetting(name, value);
        else
            SetLastCachedSetting(name, value);

        return (value != null);
    }

    /// <summary>
    /// Parses a connection string into component parts using the custom
    /// connection string parser.  An exception may be thrown if the syntax
    /// of the connection string is incorrect.
    /// </summary>
4557
4558
4559
4560
4561
4562
4563


4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
            else
            {
                return null;
            }
        }
    }



    /// <summary>
    /// Queries and returns the value of the specified setting, using the
    /// cached setting names and values for the last connection that used
    /// by the <see cref="SQLiteConnection.Open" /> method, when available.
    /// </summary>
    /// <param name="name">
    /// The name of the setting.
    /// </param>
    /// <param name="default">
    /// The value to be returned if the setting has not been set explicitly
    /// or cannot be determined.







>
>



|







4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
            else
            {
                return null;
            }
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Queries and returns the value of the specified setting, using the
    /// cached setting names and values for the last connection that used
    /// the <see cref="SQLiteConnection.Open" /> method, when available.
    /// </summary>
    /// <param name="name">
    /// The name of the setting.
    /// </param>
    /// <param name="default">
    /// The value to be returned if the setting has not been set explicitly
    /// or cannot be determined.
4592
4593
4594
4595
4596
4597
4598



























4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610

4611


4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625



4626
4627
4628
4629
4630
4631
4632
4633


4634
4635
4636
4637
4638
4639
4640
            return false;
        }

        return _lastConnectionInOpen.TryGetCachedSetting(
            name, @default, out value);
    }




























    /// <summary>
    /// The default connection flags to be used for all opened connections
    /// when they are not present in the connection string.
    /// </summary>
    public static SQLiteConnectionFlags DefaultFlags
    {
        get
        {
            string name = "DefaultFlags_SQLiteConnection";
            object value;

            if (!TryGetLastCachedSetting(name, null, out value))

                value = UnsafeNativeMethods.GetSettingValue(name, null);



            if (value == null)
                return FallbackDefaultFlags;

            object enumValue = TryParseEnum(
                typeof(SQLiteConnectionFlags), value.ToString(), true);

            if (enumValue is SQLiteConnectionFlags)
                return (SQLiteConnectionFlags)enumValue;

            return FallbackDefaultFlags;
        }
    }




    /// <summary>
    /// The extra connection flags to be used for all opened connections.
    /// </summary>
    public static SQLiteConnectionFlags SharedFlags
    {
        get { lock (_syncRoot) { return _sharedFlags; } }
        set { lock (_syncRoot) { _sharedFlags = value; } }
    }



    /// <summary>
    /// Returns the state of the connection.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>












>

>
>














>
>
>








>
>







4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
            return false;
        }

        return _lastConnectionInOpen.TryGetCachedSetting(
            name, @default, out value);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Adds or sets the cached setting specified by <paramref name="name" />
    /// to the value specified by <paramref name="value" /> using the cached
    /// setting names and values for the last connection that used the
    /// <see cref="SQLiteConnection.Open" /> method, when available.
    /// </summary>
    /// <param name="name">
    /// The name of the cached setting to add or replace.
    /// </param>
    /// <param name="value">
    /// The new value of the cached setting.
    /// </param>
    private static void SetLastCachedSetting(
        string name, /* in */
        object value /* in */
        )
    {
        if (_lastConnectionInOpen == null)
            return;

        _lastConnectionInOpen.SetCachedSetting(name, value);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// The default connection flags to be used for all opened connections
    /// when they are not present in the connection string.
    /// </summary>
    public static SQLiteConnectionFlags DefaultFlags
    {
        get
        {
            string name = "DefaultFlags_SQLiteConnection";
            object value;

            if (!TryGetLastCachedSetting(name, null, out value))
            {
                value = UnsafeNativeMethods.GetSettingValue(name, null);
                SetLastCachedSetting(name, value);
            }

            if (value == null)
                return FallbackDefaultFlags;

            object enumValue = TryParseEnum(
                typeof(SQLiteConnectionFlags), value.ToString(), true);

            if (enumValue is SQLiteConnectionFlags)
                return (SQLiteConnectionFlags)enumValue;

            return FallbackDefaultFlags;
        }
    }


    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// The extra connection flags to be used for all opened connections.
    /// </summary>
    public static SQLiteConnectionFlags SharedFlags
    {
        get { lock (_syncRoot) { return _sharedFlags; } }
        set { lock (_syncRoot) { _sharedFlags = value; } }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Returns the state of the connection.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
Changes to readme.htm.
209
210
211
212
213
214
215

216
217
218
219
220
221
222

<p>
    <b>1.0.106.0 - June XX, 2017 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_19_0.html">SQLite 3.19.0</a>.</li>
    <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>

</ul>
<p>
    <b>1.0.105.0 - April 9, 2017</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_18_0.html">SQLite 3.18.0</a>.</li>
    <li>Add experimental support for native sha1 extension.</li>







>







209
210
211
212
213
214
215
216
217
218
219
220
221
222
223

<p>
    <b>1.0.106.0 - June XX, 2017 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_19_0.html">SQLite 3.19.0</a>.</li>
    <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>
    <li>Make sure the &quot;No_SQLiteConnectionNewParser&quot; and &quot;DefaultFlags_SQLiteConnection&quot; setting values end up being cached.</li>
</ul>
<p>
    <b>1.0.105.0 - April 9, 2017</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_18_0.html">SQLite 3.18.0</a>.</li>
    <li>Add experimental support for native sha1 extension.</li>
Changes to www/news.wiki.
46
47
48
49
50
51
52

53
54
55
56
57
58
59

<p>
    <b>1.0.106.0 - June XX, 2017 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/draft/releaselog/3_19_0.html|SQLite 3.19.0].</li>
    <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>

</ul>
<p>
    <b>1.0.105.0 - April 9, 2017</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_18_0.html|SQLite 3.18.0].</li>
    <li>Add experimental support for native sha1 extension.</li>







>







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

<p>
    <b>1.0.106.0 - June XX, 2017 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/draft/releaselog/3_19_0.html|SQLite 3.19.0].</li>
    <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>
    <li>Make sure the &quot;No_SQLiteConnectionNewParser&quot; and &quot;DefaultFlags_SQLiteConnection&quot; setting values end up being cached.</li>
</ul>
<p>
    <b>1.0.105.0 - April 9, 2017</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_18_0.html|SQLite 3.18.0].</li>
    <li>Add experimental support for native sha1 extension.</li>