System.Data.SQLite
Check-in [45312da90e]
Not logged in

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

Overview
Comment:Fix extra single quotes around the formatted DateTime values in the LINQ assembly. Use GetSettingValue to access the new environment variables.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tkt-8d928c3e88
Files: files | file ages | folders
SHA1: 45312da90e224763e718532f9c715a5f2b7d9290
User & Date: mistachkin 2015-01-13 04:08:26
Context
2015-01-14
21:26
Address all the LINQ issues mentioned in ticket [8d928c3e88]. Make the storage schema (SSDL) files more consistent with their provider names. check-in: 9ff0f0adf0 user: mistachkin tags: trunk
2015-01-13
04:08
Fix extra single quotes around the formatted DateTime values in the LINQ assembly. Use GetSettingValue to access the new environment variables. Closed-Leaf check-in: 45312da90e user: mistachkin tags: tkt-8d928c3e88
03:39
In the LINQ assembly, when surrounding single quotes are required for a formatted DateTime value, be sure to escape contained single quotes. check-in: b999c9c818 user: mistachkin tags: tkt-8d928c3e88
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to System.Data.SQLite.Linq/SQL Generation/SqlGenerator.cs.

   891    891   
   892    892               string dateString = SQLiteConvert.ToString(
   893    893                   (System.DateTime)e.Value, _manifest._dateTimeFormat,
   894    894                   _manifest._dateTimeKind, _manifest._dateTimeFormatString);
   895    895   
   896    896               if (needQuotes)
   897    897               {
   898         -                result.Append("\'");
   899         -                result.Append(EscapeSingleQuote(dateString, false /* IsUnicode */));
   900         -                result.Append("\'");
          898  +                result.Append(EscapeSingleQuote(
          899  +                    dateString, false /* IsUnicode */));
   901    900               }
   902    901               else
   903    902               {
   904    903                   result.Append(dateString);
   905    904               }
   906    905               break;
   907    906   

Changes to System.Data.SQLite.Linq/SQLiteProviderManifest.cs.

    79     79       /// The effective provider manifest token.
    80     80       /// </returns>
    81     81       private static string GetProviderManifestToken(
    82     82           string manifestToken
    83     83           )
    84     84       {
    85     85   #if !PLATFORM_COMPACTFRAMEWORK
    86         -        string value = Environment.GetEnvironmentVariable(
    87         -            "AppendManifestToken_SQLiteProviderManifest");
           86  +        string value = UnsafeNativeMethods.GetSettingValue(
           87  +            "AppendManifestToken_SQLiteProviderManifest", null);
    88     88   
    89     89           if (String.IsNullOrEmpty(value))
    90     90               return manifestToken;
    91     91   
    92     92           int capacity = value.Length;
    93     93   
    94     94           if (manifestToken != null)

Changes to System.Data.SQLite/Configurations/System.Data.SQLite.dll.config.

     5      5    *
     6      6    * Written by Joe Mistachkin.
     7      7    * Released to the public domain, use at your own risk!
     8      8    *
     9      9   -->
    10     10   <configuration>
    11     11     <appSettings>
           12  +    <!--
           13  +        NOTE: If this environment variable is set [to anything], it will be
           14  +              used by the System.Data.SQLite.Linq.SQLiteProviderManifest class
           15  +              (and the System.Data.SQLite.EF6.SQLiteProviderManifest class) to
           16  +              modify future provider manifest tokens by appending the value of
           17  +              the environment variable to the existing provider manifest token,
           18  +              if any.  Typically, in order for the constructed provider
           19  +              manifest token to be syntactically correct, the environment
           20  +              variable value [to be appended] must begin with a semicolon.
           21  +    -->
           22  +    <!--
           23  +    <add key="AppendManifestToken_SQLiteProviderManifest" value="" />
           24  +    -->
           25  +
    12     26       <!--
    13     27           NOTE: If this configuration variable is set [to anything], the SQLite
    14     28                 logging subsystem may be initialized in a non-default application
    15     29                 domain.  By default, this is not allowed due to the potential
    16     30                 for application domain unloading issues.
    17     31       -->
    18     32       <!--
................................................................................
   103    117                 architecture of the current process (e.g. a 32-bit x86
   104    118                 application running on a 64-bit x64 operating system should have
   105    119                 the value "x86").
   106    120       -->
   107    121       <!--
   108    122       <add key="PROCESSOR_ARCHITECTURE" value="%PROCESSOR_ARCHITECTURE%" />
   109    123       -->
          124  +
          125  +    <!--
          126  +        NOTE: If this environment variable is set [to anything], all calls to
          127  +              prepare a SQL query will be logged, regardless of the flags for
          128  +              the associated connection.
          129  +    -->
          130  +    <!--
          131  +    <add key="SQLite_ForceLogPrepare" value="1" />
          132  +    -->
   110    133   
   111    134       <!--
   112    135           NOTE: If this environment variable is set [to anything], it will be
   113    136                 used by the System.Data.SQLite.SQLiteFactory class as the type
   114    137                 name containing the System.Data.Common.DbProviderServices
   115    138                 implementation that should be used.
   116    139       -->

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

   910    910       /// </returns>
   911    911       private static bool ForceLogPrepare()
   912    912       {
   913    913           lock (syncRoot)
   914    914           {
   915    915               if (forceLogPrepare == null)
   916    916               {
   917         -                if (Environment.GetEnvironmentVariable(
   918         -                        "SQLite_ForceLogPrepare") != null)
          917  +                if (UnsafeNativeMethods.GetSettingValue(
          918  +                        "SQLite_ForceLogPrepare", null) != null)
   919    919                   {
   920    920                       forceLogPrepare = true;
   921    921                   }
   922    922                   else
   923    923                   {
   924    924                       forceLogPrepare = false;
   925    925                   }