System.Data.SQLite

Check-in [719a56624a]
Login

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

Overview
Comment:Add DefaultFlags_SQLiteConnection environment variable to enable customization of the default connection flags.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 719a56624a8129c7340fcb8cde98a76e69af6a2d
User & Date: mistachkin 2015-05-06 02:58:47.930
Context
2015-05-06
03:48
Update the example configuration file with the new environment variable. check-in: bea855da67 user: mistachkin tags: trunk
02:58
Add DefaultFlags_SQLiteConnection environment variable to enable customization of the default connection flags. check-in: 719a56624a user: mistachkin tags: trunk
2015-05-05
22:53
Update SQLite core library to the latest 3.8.10 pre-release. check-in: ee4b5ffd21 user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Doc/Extra/Provider/environment.html.
87
88
89
90
91
92
93







94
95
96
97
98
99
100
          (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 manifest
          token to be syntactically correct, the environment variable value
          [to be appended] must begin with a semicolon.</td>
        </tr>







        <tr valign="top">
          <td>Force_SQLiteLog</td>
          <td>If this environment variable is set [to anything], the SQLite
          logging subsystem may be initialized in a non-default application
          domain.  By default, this is not allowed due to the potential for
          application domain unloading issues.</td>
        </tr>







>
>
>
>
>
>
>







87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
          (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 manifest
          token to be syntactically correct, the environment variable value
          [to be appended] must begin with a semicolon.</td>
        </tr>
        <tr valign="top">
          <td>DefaultFlags_SQLiteConnection</td>
          <td>If this environment variable is set [to anything], it will be
          used by the System.Data.SQLite.SQLiteConnection class as the default
          flags for all opened connections (i.e. when they are not present in
          the connection string).</td>
        </tr>
        <tr valign="top">
          <td>Force_SQLiteLog</td>
          <td>If this environment variable is set [to anything], the SQLite
          logging subsystem may be initialized in a non-default application
          domain.  By default, this is not allowed due to the potential for
          application domain unloading issues.</td>
        </tr>
Changes to Doc/Extra/Provider/version.html.
47
48
49
50
51
52
53

54
55
56
57
58
59
60
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_8_10.html">SQLite 3.8.10</a>.</li>
      <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.3">Entity Framework 6.1.3</a>.</li>
      <li>Improve ADO.NET conformance of the SQLiteDataReader.RecordsAffected property. Fix for <a href="https://system.data.sqlite.org/index.html/info/74542e702e">[74542e702e]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Prevent the IDataReader.GetDataTypeName method from throwing &quot;No current row&quot; exceptions. Fix for <a href="https://system.data.sqlite.org/index.html/info/94252b9059">[94252b9059]</a>.</li>
      <li>When BinaryGUID handling is off, transform the LINQ parameter types as well. Fix for <a href="https://system.data.sqlite.org/index.html/info/a4d9c7ee94">[a4d9c7ee94]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The IDataReader.GetDataTypeName method should always return the declared type name.&nbsp;<b>** Potentially Incompatible Change **</b></li>

    </ul>
    <p><b>1.0.96.0 - March 5, 2015</b></p>
    <ul>
      <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for <a href="https://system.data.sqlite.org/index.html/info/2be4298631">[2be4298631]</a>, <a href="https://system.data.sqlite.org/index.html/info/abad7c577d">[abad7c577d]</a>, and <a href="https://system.data.sqlite.org/index.html/info/c28d7fe915">[c28d7fe915]</a>.</li>
      <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for <a href="https://system.data.sqlite.org/index.html/info/92dbf1229a">[92dbf1229a]</a>.</li>
    </ul>
    <p><b>1.0.95.0 - March 2, 2015</b></p>







>







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_8_10.html">SQLite 3.8.10</a>.</li>
      <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.3">Entity Framework 6.1.3</a>.</li>
      <li>Improve ADO.NET conformance of the SQLiteDataReader.RecordsAffected property. Fix for <a href="https://system.data.sqlite.org/index.html/info/74542e702e">[74542e702e]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Prevent the IDataReader.GetDataTypeName method from throwing &quot;No current row&quot; exceptions. Fix for <a href="https://system.data.sqlite.org/index.html/info/94252b9059">[94252b9059]</a>.</li>
      <li>When BinaryGUID handling is off, transform the LINQ parameter types as well. Fix for <a href="https://system.data.sqlite.org/index.html/info/a4d9c7ee94">[a4d9c7ee94]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The IDataReader.GetDataTypeName method should always return the declared type name.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add DefaultFlags_SQLiteConnection environment variable to enable customization of the default connection flags.</li>
    </ul>
    <p><b>1.0.96.0 - March 5, 2015</b></p>
    <ul>
      <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for <a href="https://system.data.sqlite.org/index.html/info/2be4298631">[2be4298631]</a>, <a href="https://system.data.sqlite.org/index.html/info/abad7c577d">[abad7c577d]</a>, and <a href="https://system.data.sqlite.org/index.html/info/c28d7fe915">[c28d7fe915]</a>.</li>
      <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for <a href="https://system.data.sqlite.org/index.html/info/92dbf1229a">[92dbf1229a]</a>.</li>
    </ul>
    <p><b>1.0.95.0 - March 2, 2015</b></p>
Changes to System.Data.SQLite/SQLiteConnection.cs.
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
    internal const string DefaultBaseSchemaName = "sqlite_default_schema";

    private const string MemoryFileName = ":memory:";

    internal const IsolationLevel DeferredIsolationLevel = IsolationLevel.ReadCommitted;
    internal const IsolationLevel ImmediateIsolationLevel = IsolationLevel.Serializable;

    private const SQLiteConnectionFlags DefaultFlags = SQLiteConnectionFlags.Default;
    private const SQLiteSynchronousEnum DefaultSynchronous = SQLiteSynchronousEnum.Default;
    private const SQLiteJournalModeEnum DefaultJournalMode = SQLiteJournalModeEnum.Default;
    private const IsolationLevel DefaultIsolationLevel = IsolationLevel.Serializable;
    internal const SQLiteDateFormats DefaultDateTimeFormat = SQLiteDateFormats.Default;
    internal const DateTimeKind DefaultDateTimeKind = DateTimeKind.Unspecified;
    internal const string DefaultDateTimeFormatString = null;
    private const string DefaultDataSource = null;







|







354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
    internal const string DefaultBaseSchemaName = "sqlite_default_schema";

    private const string MemoryFileName = ":memory:";

    internal const IsolationLevel DeferredIsolationLevel = IsolationLevel.ReadCommitted;
    internal const IsolationLevel ImmediateIsolationLevel = IsolationLevel.Serializable;

    private const SQLiteConnectionFlags FallbackDefaultFlags = SQLiteConnectionFlags.Default;
    private const SQLiteSynchronousEnum DefaultSynchronous = SQLiteSynchronousEnum.Default;
    private const SQLiteJournalModeEnum DefaultJournalMode = SQLiteJournalModeEnum.Default;
    private const IsolationLevel DefaultIsolationLevel = IsolationLevel.Serializable;
    internal const SQLiteDateFormats DefaultDateTimeFormat = SQLiteDateFormats.Default;
    internal const DateTimeKind DefaultDateTimeKind = DateTimeKind.Unspecified;
    internal const string DefaultDateTimeFormatString = null;
    private const string DefaultDataSource = null;
3220
3221
3222
3223
3224
3225
3226





















3227
3228
3229
3230
3231
3232
3233
            }
            else
            {
                return null;
            }
        }
    }






















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







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







3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
            }
            else
            {
                return null;
            }
        }
    }

    /// <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
        {
            object enumValue;

            enumValue = TryParseEnum(typeof(SQLiteConnectionFlags),
                UnsafeNativeMethods.GetSettingValue(
                    "DefaultFlags_SQLiteConnection", null), 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; } }
Changes to Tests/basic.eagle.
17
18
19
20
21
22
23






































24
25
26
27
28
29
30

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

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







































runTest {test data-1.1 {unit tests from the 'test' project} -setup {
  cleanupFile [file join [file dirname $testExeFile] Test.db3]
  set fileName [file join [getDatabaseDirectory] data-1.1.db]
} -body {
  set output ""

  set code [catch {







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







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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

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

proc saveSQLiteConnectionEnvironment {} {
  foreach name [list \
      DefaultFlags_SQLiteConnection No_SQLiteConnectionNewParser] {
    #
    # NOTE: Does the live environment variable exist?  If so, save the value
    #       for later; otherwise, make sure the saved value does not exist
    #       either.  The live environment variables ARE NOT changed by this
    #       procedure.
    #
    if {[uplevel 1 [list info exists env($name)]]} then {
      uplevel 1 [list set savedEnv($name) [uplevel 1 [list set env($name)]]]
    } else {
      uplevel 1 [list unset -nocomplain savedEnv($name)]
    }
  }
}

proc restoreSQLiteConnectionEnvironment {} {
  foreach name [list \
      DefaultFlags_SQLiteConnection No_SQLiteConnectionNewParser] {
    #
    # NOTE: Does the saved environment variable exist?  If so, restore the
    #       saved value and then unset it; otherwise, make sure the live
    #       environment variable does not exist either (i.e. it was not set
    #       to begin with).  Both the saved and live environment variables
    #       ARE changed by this procedure.
    #
    if {[uplevel 1 [list info exists savedEnv($name)]]} then {
      uplevel 1 [list set env($name) [uplevel 1 [list set savedEnv($name)]]]
      uplevel 1 [list unset -nocomplain savedEnv($name)]
    } else {
      uplevel 1 [list unset -nocomplain env($name)]
    }
  }
}

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

runTest {test data-1.1 {unit tests from the 'test' project} -setup {
  cleanupFile [file join [file dirname $testExeFile] Test.db3]
  set fileName [file join [getDatabaseDirectory] data-1.1.db]
} -body {
  set output ""

  set code [catch {
3101
3102
3103
3104
3105
3106
3107




















































3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain result connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {Ok 32768}}





















































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

reportSQLiteResources $test_channel

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

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue







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










3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain result connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {Ok 32768}}

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

runTest {test data-1.68 {unset env(DefaultFlags_SQLiteConnection)} -setup {
  saveSQLiteConnectionEnvironment

  unset -nocomplain env(DefaultFlags_SQLiteConnection)

  setupDb [set fileName data-1.68.db]
} -body {
  set connection [getDbConnection]

  list [object invoke System.Data.SQLite.SQLiteConnection DefaultFlags] \
      [$connection Flags]
} -cleanup {
  cleanupDb $fileName
  restoreSQLiteConnectionEnvironment

  freeDbConnection

  unset -nocomplain connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {Default Default}}

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

runTest {test data-1.69 {set env(DefaultFlags_SQLiteConnection)} -setup {
  saveSQLiteConnectionEnvironment

  set env(DefaultFlags_SQLiteConnection) "DetectTextAffinity, DetectStringType"

  setupDb [set fileName data-1.69.db]
} -body {
  set connection [getDbConnection]

  list [object invoke System.Data.SQLite.SQLiteConnection DefaultFlags] \
      [$connection Flags]
} -cleanup {
  cleanupDb $fileName
  restoreSQLiteConnectionEnvironment

  freeDbConnection

  unset -nocomplain connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{DetectTextAffinity, DetectStringType}\
{DetectTextAffinity, DetectStringType}}}

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

rename restoreSQLiteConnectionEnvironment ""
rename saveSQLiteConnectionEnvironment ""

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

reportSQLiteResources $test_channel

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

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue
Changes to readme.htm.
214
215
216
217
218
219
220

221
222
223
224
225
226
227
<ul>
    <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_8_10.html">SQLite 3.8.10</a>.</li>
    <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.3">Entity Framework 6.1.3</a>.</li>
    <li>Improve ADO.NET conformance of the SQLiteDataReader.RecordsAffected property. Fix for [74542e702e].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent the IDataReader.GetDataTypeName method from throwing &quot;No current row&quot; exceptions. Fix for [94252b9059].</li>
    <li>When BinaryGUID handling is off, transform the LINQ parameter types as well. Fix for [a4d9c7ee94].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The IDataReader.GetDataTypeName method should always return the declared type name.&nbsp;<b>** Potentially Incompatible Change **</b></li>

</ul>
<p>
    <b>1.0.96.0 - March 5, 2015</b>
</p>
<ul>
    <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for [c28d7fe915].</li>
    <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for [92dbf1229a].</li>







>







214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<ul>
    <li>Updated to <a href="https://www.sqlite.org/draft/releaselog/3_8_10.html">SQLite 3.8.10</a>.</li>
    <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.3">Entity Framework 6.1.3</a>.</li>
    <li>Improve ADO.NET conformance of the SQLiteDataReader.RecordsAffected property. Fix for [74542e702e].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent the IDataReader.GetDataTypeName method from throwing &quot;No current row&quot; exceptions. Fix for [94252b9059].</li>
    <li>When BinaryGUID handling is off, transform the LINQ parameter types as well. Fix for [a4d9c7ee94].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The IDataReader.GetDataTypeName method should always return the declared type name.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add DefaultFlags_SQLiteConnection environment variable to enable customization of the default connection flags.</li>
</ul>
<p>
    <b>1.0.96.0 - March 5, 2015</b>
</p>
<ul>
    <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for [c28d7fe915].</li>
    <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for [92dbf1229a].</li>
Changes to www/news.wiki.
8
9
10
11
12
13
14

15
16
17
18
19
20
21
<ul>
    <li>Updated to [https://www.sqlite.org/draft/releaselog/3_8_10.html|SQLite 3.8.10].</li>
    <li>Updated to [https://www.nuget.org/packages/EntityFramework/6.1.3|Entity Framework 6.1.3].</li>
    <li>Improve ADO.NET conformance of the SQLiteDataReader.RecordsAffected property. Fix for [74542e702e].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent the IDataReader.GetDataTypeName method from throwing &quot;No current row&quot; exceptions. Fix for [94252b9059].</li>
    <li>When BinaryGUID handling is off, transform the LINQ parameter types as well. Fix for [a4d9c7ee94].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The IDataReader.GetDataTypeName method should always return the declared type name.&nbsp;<b>** Potentially Incompatible Change **</b></li>

</ul>
<p>
    <b>1.0.96.0 - March 5, 2015</b>
</p>
<ul>
    <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for [c28d7fe915].</li>
    <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for [92dbf1229a].</li>







>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<ul>
    <li>Updated to [https://www.sqlite.org/draft/releaselog/3_8_10.html|SQLite 3.8.10].</li>
    <li>Updated to [https://www.nuget.org/packages/EntityFramework/6.1.3|Entity Framework 6.1.3].</li>
    <li>Improve ADO.NET conformance of the SQLiteDataReader.RecordsAffected property. Fix for [74542e702e].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent the IDataReader.GetDataTypeName method from throwing &quot;No current row&quot; exceptions. Fix for [94252b9059].</li>
    <li>When BinaryGUID handling is off, transform the LINQ parameter types as well. Fix for [a4d9c7ee94].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The IDataReader.GetDataTypeName method should always return the declared type name.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add DefaultFlags_SQLiteConnection environment variable to enable customization of the default connection flags.</li>
</ul>
<p>
    <b>1.0.96.0 - March 5, 2015</b>
</p>
<ul>
    <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for [c28d7fe915].</li>
    <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for [92dbf1229a].</li>