System.Data.SQLite

Check-in [6a9bb02b77]
Login

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

Overview
Comment:Rename the new configuration setting replacement tokens to include a 'PreLoad' prefix and add them to the documentation.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6a9bb02b7767d15121ebaa8b0ae7aa2aed141807
User & Date: mistachkin 2016-10-29 03:58:31.016
Context
2016-10-29
06:58
Add support for the '%PreLoadSQLite_TargetFramework%' configuration setting replacement token. Pursuant to [d4728aecb7]. check-in: 654d96246c user: mistachkin tags: trunk
03:58
Rename the new configuration setting replacement tokens to include a 'PreLoad' prefix and add them to the documentation. check-in: 6a9bb02b77 user: mistachkin tags: trunk
2016-10-28
23:58
Permit and replace the tokens '%SQLite_AssemblyDirectory%' and '%SQLite_XmlConfigDirectory%' to appear in the XML configuration file. Also, permit and replace the token '%SQLite_AssemblyDirectory%' to appear in environment variable values that are used by the settings subsystem. Pursuant to ticket [d4728aecb7]. check-in: 11cd3bd238 user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Doc/Extra/Provider/environment.html.
38
39
40
41
42
43
44
































45
46
47
48
49
50
51
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
































      <p>
        These environment variables are used to control several features of
        the System.Data.SQLite library.  All of these environment variables
        are optional.  If a particular environment variable is not present,
        the XML configuration file &quot;System.Data.SQLite.dll.config&quot;
        in the directory containing the currently executing assembly (i.e.
        the one containing all the managed components for System.Data.SQLite)







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







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <p>
        The following <b>special replacement tokens</b> may be recognized and
        replaced with their associated runtime value, depending on context,
        when setting values are being read by the native library pre-loading
        subsystem.  Unless otherwise stated explicitly, all of these tokens
        are <b>case-sensitive</b> and the percent characters <b>must be
        included</b> in order for them to be recognized.
      </p>
      <table width="80%" cellpadding="0" cellspacing="0">
        <tr valign="top">
          <th>Name</th>
          <th>Description</th>
        </tr>
        <tr valign="top">
          <td>%PreLoadSQLite_AssemblyDirectory%</td>
          <td>If this token (which is <b>case-sensitive</b> and <b>must include
          the percent characters</b>) is present within a setting value being
          returned, it will be replaced with the qualified name of the directory
          containing the System.Data.SQLite assembly.  If the name of the
          directory is not available, the token will not be replaced.</td>
        </tr>
        <tr valign="top">
          <td>%PreLoadSQLite_XmlConfigDirectory%</td>
          <td>If this token (which is <b>case-sensitive</b> and <b>must include
          the percent characters</b>) is present within a setting value
          being returned, it will be replaced with the qualified name of the
          directory containing the XML configuration file.  If the name of the
          directory is not available, the token will not be replaced.
          Generally, this token may only be used within the XML configuration
          file itself.</td>
        </tr>
      </table>
      <p>
        These environment variables are used to control several features of
        the System.Data.SQLite library.  All of these environment variables
        are optional.  If a particular environment variable is not present,
        the XML configuration file &quot;System.Data.SQLite.dll.config&quot;
        in the directory containing the currently executing assembly (i.e.
        the one containing all the managed components for System.Data.SQLite)
Changes to System.Data.SQLite/Configurations/System.Data.SQLite.dll.config.
1
2
3
4
5
6
7
8
9
10
11





























12
13
14
15
16
17
18
<?xml version="1.0"?>
<!--
 *
 * System.Data.SQLite.dll.config -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<configuration>
  <appSettings>





























    <!--
        NOTE: If this environment variable is set [to anything], it will be
              used by the System.Data.SQLite.Linq.SQLiteProviderManifest class
              (and the System.Data.SQLite.EF6.SQLiteProviderManifest class) to
              modify future provider manifest tokens by appending the value of
              the environment variable to the existing provider manifest token,
              if any.  Typically, in order for the constructed provider











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







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version="1.0"?>
<!--
 *
 * System.Data.SQLite.dll.config -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<configuration>
  <appSettings>
    <!--
    ****************************************************************************
    **                       Special Replacement Tokens                       **
    ****************************************************************************
    -->

    <!--
        NOTE: %PreLoadSQLite_AssemblyDirectory% - If this token (which is
              case-sensitive and must include the percent characters) is
              present within a setting value being returned, it will be
              replaced with the qualified name of the directory containing the
              System.Data.SQLite assembly.  If the name of the directory is not
              available, the token will not be replaced.

        NOTE: %PreLoadSQLite_XmlConfigDirectory% - If this token (which is
              case-sensitive and must include the percent characters) is
              present within a setting value being returned, it will be
              replaced with the qualified name of the directory containing the
              XML configuration file.  If the name of the directory is not
              available, the token will not be replaced.  Generally, this token
              may only be used within the XML configuration file itself.
    -->

    <!--
    ****************************************************************************
    **                         Configuration Settings                         **
    ****************************************************************************
    -->

    <!--
        NOTE: If this environment variable is set [to anything], it will be
              used by the System.Data.SQLite.Linq.SQLiteProviderManifest class
              (and the System.Data.SQLite.EF6.SQLiteProviderManifest class) to
              modify future provider manifest tokens by appending the value of
              the environment variable to the existing provider manifest token,
              if any.  Typically, in order for the constructed provider
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is the XML configuratrion file token that will be replaced with
      /// the qualified path to the directory containing the XML configuration
      /// file.
      /// </summary>
      private static readonly string XmlConfigDirectoryToken =
          "%SQLite_XmlConfigDirectory%";
      #endregion

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

      #region Private Constants (Desktop Framework Only)
#if !PLATFORM_COMPACTFRAMEWORK
      /// <summary>
      /// This is the environment variable token that will be replaced with
      /// the qualified path to the directory containing this assembly.
      /// </summary>
      private static readonly string AssemblyDirectoryToken =
          "%SQLite_AssemblyDirectory%";
#endif
      #endregion

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

      #region Private Data
      /// <summary>







|











|







585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is the XML configuratrion file token that will be replaced with
      /// the qualified path to the directory containing the XML configuration
      /// file.
      /// </summary>
      private static readonly string XmlConfigDirectoryToken =
          "%PreLoadSQLite_XmlConfigDirectory%";
      #endregion

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

      #region Private Constants (Desktop Framework Only)
#if !PLATFORM_COMPACTFRAMEWORK
      /// <summary>
      /// This is the environment variable token that will be replaced with
      /// the qualified path to the directory containing this assembly.
      /// </summary>
      private static readonly string AssemblyDirectoryToken =
          "%PreLoadSQLite_AssemblyDirectory%";
#endif
      #endregion

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

      #region Private Data
      /// <summary>
Changes to Tests/tkt-d4728aecb7.eagle.
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

80

81
82
83
84
85
86
87
    [getAppDomainPreamble] -body {
  package require Eagle.Library
  package require Eagle.Test
  package require System.Data.SQLite.Test

  saveEnvironmentVariables [list d472_1 d472_2] savedEnv

  set env(d472_1) {prfx1/%SQLite_AssemblyDirectory%/sufx1}
  set env(d472_2) {prfx2/%SQLite_XmlConfigDirectory%/sufx2}

  object load -loadtype File [file join \
      [getBinaryDirectory] System.Data.SQLite.dll]

  set result [list]

  lappend result [string map [list \\ /] [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods GetSettingValue d472_1 null]]

  lappend result [string map [list \\ /] [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods GetSettingValue d472_2 null]]

  set result
} -cleanup {
  restoreEnvironmentVariables [list d472_1 d472_2] savedEnv

  unset -nocomplain result
} -isolationLevel AppDomain -constraints {eagle command.object\
compile.ISOLATED_INTERPRETERS System.Data.SQLite} -result [list [appendArgs \
prfx1/ $d472_binary_directory /sufx1] prfx2/%SQLite_XmlConfigDirectory%/sufx2]}


###############################################################################

runTest {test tkt-d4728aecb7-1.2 {tokens in XML configuration file} -setup \
    [getAppDomainPreamble] -body {
  package require Eagle.Library
  package require Eagle.Test
  package require System.Data.SQLite.Test

  moveSystemDataSQLiteDllConfig false

  set fileName [file join \
      [getBinaryDirectory] System.Data.SQLite.dll.config]

  writeFile $fileName [string trim {
    <?xml version="1.0"?>
    <configuration>
      <appSettings>
        <add key="d472_1" value="prfx1/%SQLite_AssemblyDirectory%/sufx1" />

        <add key="d472_2" value="prfx2/%SQLite_XmlConfigDirectory%/sufx2" />

      </appSettings>
    </configuration>
  }]

  object load -loadtype Bytes [base64 encode [readFile [file join \
      [getBinaryDirectory] System.Data.SQLite.dll]]]








|
|



















|
>


















|
>
|
>







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
    [getAppDomainPreamble] -body {
  package require Eagle.Library
  package require Eagle.Test
  package require System.Data.SQLite.Test

  saveEnvironmentVariables [list d472_1 d472_2] savedEnv

  set env(d472_1) {prfx1/%PreLoadSQLite_AssemblyDirectory%/sufx1}
  set env(d472_2) {prfx2/%PreLoadSQLite_XmlConfigDirectory%/sufx2}

  object load -loadtype File [file join \
      [getBinaryDirectory] System.Data.SQLite.dll]

  set result [list]

  lappend result [string map [list \\ /] [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods GetSettingValue d472_1 null]]

  lappend result [string map [list \\ /] [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods GetSettingValue d472_2 null]]

  set result
} -cleanup {
  restoreEnvironmentVariables [list d472_1 d472_2] savedEnv

  unset -nocomplain result
} -isolationLevel AppDomain -constraints {eagle command.object\
compile.ISOLATED_INTERPRETERS System.Data.SQLite} -result [list [appendArgs \
prfx1/ $d472_binary_directory /sufx1] \
prfx2/%PreLoadSQLite_XmlConfigDirectory%/sufx2]}

###############################################################################

runTest {test tkt-d4728aecb7-1.2 {tokens in XML configuration file} -setup \
    [getAppDomainPreamble] -body {
  package require Eagle.Library
  package require Eagle.Test
  package require System.Data.SQLite.Test

  moveSystemDataSQLiteDllConfig false

  set fileName [file join \
      [getBinaryDirectory] System.Data.SQLite.dll.config]

  writeFile $fileName [string trim {
    <?xml version="1.0"?>
    <configuration>
      <appSettings>
        <add key="d472_1"
             value="prfx1/%PreLoadSQLite_AssemblyDirectory%/sufx1" />
        <add key="d472_2"
             value="prfx2/%PreLoadSQLite_XmlConfigDirectory%/sufx2" />
      </appSettings>
    </configuration>
  }]

  object load -loadtype Bytes [base64 encode [readFile [file join \
      [getBinaryDirectory] System.Data.SQLite.dll]]]