System.Data.SQLite
Check-in [362b7933d5]
Not logged in

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

Overview
Comment:Cherrypick of [cee7126f56f28d0e], fix caching of 'No_SQLiteConnectionNewParser' and 'DefaultFlags_SQLiteConnection'.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-1.0.105
Files: files | file ages | folders
SHA1: 362b7933d58cc72ed77f7861dd7e8da4465e43e3
User & Date: mistachkin 2017-05-11 15:43:24
Context
2017-05-11
15:48
Cherrypick of [92f1a8d6b95e5c0d], [2621aa6f2e116d71], [060be3824767ba41], and [4fdd8dee13b40da2], cache the assembly directory and XML configuration file name. check-in: defe7832c2 user: mistachkin tags: branch-1.0.105
15:43
Cherrypick of [cee7126f56f28d0e], fix caching of 'No_SQLiteConnectionNewParser' and 'DefaultFlags_SQLiteConnection'. check-in: 362b7933d5 user: mistachkin tags: branch-1.0.105
15:37
Cherrypick of [2c31a6967460b852], test suite helper procedure fixes. check-in: 4578c9236b user: mistachkin tags: branch-1.0.105
01:23
Make sure the 'No_SQLiteConnectionNewParser' and 'DefaultFlags_SQLiteConnection' setting values end up being cached. check-in: cee7126f56 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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

    39     39             </td>
    40     40           </tr>
    41     41         </table>
    42     42       </div>
    43     43       <div id="mainSection">
    44     44       <div id="mainBody">
    45     45       <h1 class="heading">Version History</h1>
           46  +    <p><b>1.0.105.1 - May 15, 2017</b></p>
           47  +    <ul>
           48  +      <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>
           49  +      <li>Make sure the &quot;No_SQLiteConnectionNewParser&quot; and &quot;DefaultFlags_SQLiteConnection&quot; setting values end up being cached.</li>
           50  +    </ul>
    46     51       <p><b>1.0.105.0 - April 9, 2017</b></p>
    47     52       <ul>
    48     53         <li>Updated to <a href="https://www.sqlite.org/releaselog/3_18_0.html">SQLite 3.18.0</a>.</li>
    49     54         <li>Add experimental support for native sha1 extension.</li>
    50     55       </ul>
    51     56       <p><b>1.0.104.0 - December 16, 2016</b></p>
    52     57       <ul>

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

  3046   3046       /// Non-zero if the legacy connection string parser should be used.
  3047   3047       /// </returns>
  3048   3048       private static bool ShouldUseLegacyConnectionStringParser(
  3049   3049           SQLiteConnection connection
  3050   3050           )
  3051   3051       {
  3052   3052           string name = "No_SQLiteConnectionNewParser";
  3053         -        object value; /* NOT USED */
         3053  +        object value;
  3054   3054   
  3055   3055           if ((connection != null) &&
  3056   3056               connection.TryGetCachedSetting(name, null, out value))
  3057   3057           {
  3058         -            return true;
         3058  +            return (value != null);
  3059   3059           }
  3060   3060   
  3061   3061           if ((connection == null) &&
  3062   3062               TryGetLastCachedSetting(name, null, out value))
  3063   3063           {
  3064         -            return true;
         3064  +            return (value != null);
  3065   3065           }
  3066   3066   
  3067         -        return (UnsafeNativeMethods.GetSettingValue(name, null) != null);
         3067  +        value = UnsafeNativeMethods.GetSettingValue(name, null);
         3068  +
         3069  +        if (connection != null)
         3070  +            connection.SetCachedSetting(name, value);
         3071  +        else
         3072  +            SetLastCachedSetting(name, value);
         3073  +
         3074  +        return (value != null);
  3068   3075       }
  3069   3076   
  3070   3077       /// <summary>
  3071   3078       /// Parses a connection string into component parts using the custom
  3072   3079       /// connection string parser.  An exception may be thrown if the syntax
  3073   3080       /// of the connection string is incorrect.
  3074   3081       /// </summary>
................................................................................
  4557   4564               else
  4558   4565               {
  4559   4566                   return null;
  4560   4567               }
  4561   4568           }
  4562   4569       }
  4563   4570   
         4571  +    ///////////////////////////////////////////////////////////////////////////////////////////////
         4572  +
  4564   4573       /// <summary>
  4565   4574       /// Queries and returns the value of the specified setting, using the
  4566   4575       /// cached setting names and values for the last connection that used
  4567         -    /// by the <see cref="SQLiteConnection.Open" /> method, when available.
         4576  +    /// the <see cref="SQLiteConnection.Open" /> method, when available.
  4568   4577       /// </summary>
  4569   4578       /// <param name="name">
  4570   4579       /// The name of the setting.
  4571   4580       /// </param>
  4572   4581       /// <param name="default">
  4573   4582       /// The value to be returned if the setting has not been set explicitly
  4574   4583       /// or cannot be determined.
................................................................................
  4592   4601               return false;
  4593   4602           }
  4594   4603   
  4595   4604           return _lastConnectionInOpen.TryGetCachedSetting(
  4596   4605               name, @default, out value);
  4597   4606       }
  4598   4607   
         4608  +    ///////////////////////////////////////////////////////////////////////////////////////////////
         4609  +
         4610  +    /// <summary>
         4611  +    /// Adds or sets the cached setting specified by <paramref name="name" />
         4612  +    /// to the value specified by <paramref name="value" /> using the cached
         4613  +    /// setting names and values for the last connection that used the
         4614  +    /// <see cref="SQLiteConnection.Open" /> method, when available.
         4615  +    /// </summary>
         4616  +    /// <param name="name">
         4617  +    /// The name of the cached setting to add or replace.
         4618  +    /// </param>
         4619  +    /// <param name="value">
         4620  +    /// The new value of the cached setting.
         4621  +    /// </param>
         4622  +    private static void SetLastCachedSetting(
         4623  +        string name, /* in */
         4624  +        object value /* in */
         4625  +        )
         4626  +    {
         4627  +        if (_lastConnectionInOpen == null)
         4628  +            return;
         4629  +
         4630  +        _lastConnectionInOpen.SetCachedSetting(name, value);
         4631  +    }
         4632  +
         4633  +    ///////////////////////////////////////////////////////////////////////////////////////////////
         4634  +
  4599   4635       /// <summary>
  4600   4636       /// The default connection flags to be used for all opened connections
  4601   4637       /// when they are not present in the connection string.
  4602   4638       /// </summary>
  4603   4639       public static SQLiteConnectionFlags DefaultFlags
  4604   4640       {
  4605   4641           get
  4606   4642           {
  4607   4643               string name = "DefaultFlags_SQLiteConnection";
  4608   4644               object value;
  4609   4645   
  4610   4646               if (!TryGetLastCachedSetting(name, null, out value))
         4647  +            {
  4611   4648                   value = UnsafeNativeMethods.GetSettingValue(name, null);
         4649  +                SetLastCachedSetting(name, value);
         4650  +            }
  4612   4651   
  4613   4652               if (value == null)
  4614   4653                   return FallbackDefaultFlags;
  4615   4654   
  4616   4655               object enumValue = TryParseEnum(
  4617   4656                   typeof(SQLiteConnectionFlags), value.ToString(), true);
  4618   4657   
................................................................................
  4619   4658               if (enumValue is SQLiteConnectionFlags)
  4620   4659                   return (SQLiteConnectionFlags)enumValue;
  4621   4660   
  4622   4661               return FallbackDefaultFlags;
  4623   4662           }
  4624   4663       }
  4625   4664   
         4665  +
         4666  +    ///////////////////////////////////////////////////////////////////////////////////////////////
         4667  +
  4626   4668       /// <summary>
  4627   4669       /// The extra connection flags to be used for all opened connections.
  4628   4670       /// </summary>
  4629   4671       public static SQLiteConnectionFlags SharedFlags
  4630   4672       {
  4631   4673           get { lock (_syncRoot) { return _sharedFlags; } }
  4632   4674           set { lock (_syncRoot) { _sharedFlags = value; } }
  4633   4675       }
         4676  +
         4677  +    ///////////////////////////////////////////////////////////////////////////////////////////////
  4634   4678   
  4635   4679       /// <summary>
  4636   4680       /// Returns the state of the connection.
  4637   4681       /// </summary>
  4638   4682   #if !PLATFORM_COMPACTFRAMEWORK
  4639   4683       [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  4640   4684   #endif

Changes to readme.htm.

   203    203   supported <a href="https://www.sqlite.org/compile.html">compile-time options</a>
   204    204   designed for robustness and maximum backward compatibility with previously
   205    205   released versions of System.Data.SQLite.
   206    206   </p>
   207    207   
   208    208   <h2><b>Version History</b></h2>
   209    209   
          210  +<p>
          211  +    <b>1.0.105.1 - May 15, 2017</b>
          212  +</p>
          213  +<ul>
          214  +    <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>
          215  +    <li>Make sure the &quot;No_SQLiteConnectionNewParser&quot; and &quot;DefaultFlags_SQLiteConnection&quot; setting values end up being cached.</li>
          216  +</ul>
   210    217   <p>
   211    218       <b>1.0.105.0 - April 9, 2017</b>
   212    219   </p>
   213    220   <ul>
   214    221       <li>Updated to <a href="https://www.sqlite.org/releaselog/3_18_0.html">SQLite 3.18.0</a>.</li>
   215    222       <li>Add experimental support for native sha1 extension.</li>
   216    223   </ul>

Changes to www/news.wiki.

    40     40     <li>
    41     41       Access to archived release packages will be granted on a case-by-case basis.
    42     42     </li>
    43     43   </ul>
    44     44   
    45     45   <div align="center"><h2><b>Version History</b></h2></div>
    46     46   
           47  +<p>
           48  +    <b>1.0.105.1 - May 15, 2017</b>
           49  +</p>
           50  +<ul>
           51  +    <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>
           52  +    <li>Make sure the &quot;No_SQLiteConnectionNewParser&quot; and &quot;DefaultFlags_SQLiteConnection&quot; setting values end up being cached.</li>
           53  +</ul>
    47     54   <p>
    48     55       <b>1.0.105.0 - April 9, 2017</b>
    49     56   </p>
    50     57   <ul>
    51     58       <li>Updated to [https://www.sqlite.org/releaselog/3_18_0.html|SQLite 3.18.0].</li>
    52     59       <li>Add experimental support for native sha1 extension.</li>
    53     60   </ul>