System.Data.SQLite
Check-in [21c1c04012]
Not logged in

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

Overview
Comment:By default, only attempt to initialize the logging subsystem once and add 'Initialize_SQLiteLog' setting to disable this behavior.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:21c1c0401276a603db27b758bed40cb5611ac36a
User & Date: mistachkin 2018-07-26 06:52:08
Context
2018-07-26
06:54
Add configuration suffix support to the test suite infrastructure. check-in: 7ffb245069 user: mistachkin tags: trunk
06:52
By default, only attempt to initialize the logging subsystem once and add 'Initialize_SQLiteLog' setting to disable this behavior. check-in: 21c1c04012 user: mistachkin tags: trunk
05:05
Simplify build scripts for Mono on POSIX. check-in: a76782cfe6 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

147
148
149
150
151
152
153






154
155
156
157
158
159
160
        <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>






        <tr valign="top">
          <td>No_PreLoadSQLite</td>
          <td>If this environment variable is set [to anything], the native
          library pre-loading code will be disabled.  By default, the native
          library pre-loading code will attempt to load the native SQLite
          library from architecture-specific (e.g. &quot;x86&quot;,
          &quot;amd64&quot;, &quot;x64&quot;) or platform-specific (e.g.







>
>
>
>
>
>







147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
        <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>
        <tr valign="top">
          <td>Initialize_SQLiteLog</td>
          <td>If this environment variable is set [to anything], the SQLite
          logging subsystem will attempt to perform initialization even when
          an attempt was previously made.</td>
        </tr>
        <tr valign="top">
          <td>No_PreLoadSQLite</td>
          <td>If this environment variable is set [to anything], the native
          library pre-loading code will be disabled.  By default, the native
          library pre-loading code will attempt to load the native SQLite
          library from architecture-specific (e.g. &quot;x86&quot;,
          &quot;amd64&quot;, &quot;x64&quot;) or platform-specific (e.g.

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

83
84
85
86
87
88
89









90
91
92
93
94
95
96
              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.
    -->
    <!--
    <add key="Force_SQLiteLog" value="1" />
    -->










    <!--
        NOTE: If this configuration variable is set [to anything], the native
              library pre-loading functionality will be disabled.  By default,
              the native library pre-loading will attempt to load the native
              SQLite library from architecture-specific (e.g. "x86", "amd64",
              "x64") or platform-specific (e.g. "Win32") directories that







>
>
>
>
>
>
>
>
>







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
              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.
    -->
    <!--
    <add key="Force_SQLiteLog" value="1" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], the SQLite
              logging subsystem will attempt to perform initialization even
              when an attempt was previously made.
    -->
    <!--
    <add key="Initialize_SQLiteLog" value="1" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], the native
              library pre-loading functionality will be disabled.  By default,
              the native library pre-loading will attempt to load the native
              SQLite library from architecture-specific (e.g. "x86", "amd64",
              "x64") or platform-specific (e.g. "Win32") directories that

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

7
8
9
10
11
12
13

14
15
16
17
18
19
20
...
117
118
119
120
121
122
123








124
125
126
127
128
129
130
131
132
133
134
135
























136
137
138
139
140
141
142

namespace System.Data.SQLite
{
    using System;
    using System.Data.Common;
    using System.Diagnostics;
    using System.Globalization;


    /// <summary>
    /// Event data for logging event handlers.
    /// </summary>
    public class LogEventArgs : EventArgs
    {
        /// <summary>
................................................................................
        /// The base SQLite object to interop with.
        /// </summary>
        private static SQLiteBase _sql;
#endif

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









        /// <summary>
        /// This will be non-zero if logging is currently enabled.
        /// </summary>
        private static bool _enabled;

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

        /// <summary>
        /// Initializes the SQLite logging facilities.
        /// </summary>
        public static void Initialize()
        {
























            //
            // BUFXIX: We cannot initialize the logging interface if the SQLite
            //         core library has already been initialized anywhere in
            //         the process (see ticket [2ce0870fad]).
            //
            if (SQLite3.StaticIsInitialized())
                return;







>







 







>
>
>
>
>
>
>
>












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







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175

namespace System.Data.SQLite
{
    using System;
    using System.Data.Common;
    using System.Diagnostics;
    using System.Globalization;
    using System.Threading;

    /// <summary>
    /// Event data for logging event handlers.
    /// </summary>
    public class LogEventArgs : EventArgs
    {
        /// <summary>
................................................................................
        /// The base SQLite object to interop with.
        /// </summary>
        private static SQLiteBase _sql;
#endif

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

        /// <summary>
        /// This will be non-zero if an attempt was already made to initialize
        /// the (managed) logging subsystem.
        /// </summary>
        private static int _attemptedInitialize;

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

        /// <summary>
        /// This will be non-zero if logging is currently enabled.
        /// </summary>
        private static bool _enabled;

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

        /// <summary>
        /// Initializes the SQLite logging facilities.
        /// </summary>
        public static void Initialize()
        {
            //
            // NOTE: First, check if the managed logging subsystem is always
            //       supposed to at least attempt to initialize itself.  In
            //       order to do this, several fairly complex steps must be
            //       taken, including calling a P/Invoke (interop) method;
            //       therefore, by default, attempt to perform these steps
            //       once.
            //
            if (UnsafeNativeMethods.GetSettingValue(
                    "Initialize_SQLiteLog", null) == null)
            {
                try
                {
                    if (Interlocked.Increment(ref _attemptedInitialize) > 0)
                    {
                        return;
                    }
                }
                finally
                {
                    Interlocked.Decrement(ref _attemptedInitialize);
                }
            }

            //
            // BUFXIX: We cannot initialize the logging interface if the SQLite
            //         core library has already been initialized anywhere in
            //         the process (see ticket [2ce0870fad]).
            //
            if (SQLite3.StaticIsInitialized())
                return;