System.Data.SQLite

Check-in [e7d0d8c183]
Login

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

Overview
Comment:Merge updates from trunk.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | tkt-3c00ec5b52
Files: files | file ages | folders
SHA1: e7d0d8c183379689b92bbc776b28a9d453b5c169
User & Date: mistachkin 2014-05-27 05:34:36.346
Context
2014-05-27
05:56
Add DetectStringType connection flag. check-in: 229927cfce user: mistachkin tags: tkt-3c00ec5b52
05:34
Merge updates from trunk. check-in: e7d0d8c183 user: mistachkin tags: tkt-3c00ec5b52
05:33
Revise how the SQLiteLog class is used in the default debug builds (i.e. when INTEROP_LOG is enabled). check-in: 1affdac144 user: mistachkin tags: trunk
02:09
Merge updates from trunk. check-in: bf26c231c5 user: mistachkin tags: tkt-3c00ec5b52
Changes
Unified Diff Ignore Whitespace Patch
Changes to Setup/SQLite.iss.
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
;
; SQLite.iss --
;
; Written by Joe Mistachkin.
; Released to the public domain, use at your own risk!
;

#define BaseConfiguration StringChange(AppConfiguration, "NativeOnly", "")
#define GacProcessor StringChange(AppProcessor, "x64", "amd64")

#if Pos("NativeOnly", AppConfiguration) == 0
#define InstallerCondition "Application\Core\MSIL and Application\Designer and Application\Designer\Installer"
#define AppVersion GetStringFileInfo("..\bin\" + Year + "\" + AppPlatform + "\" + AppConfiguration + "\System.Data.SQLite.dll", PRODUCT_VERSION)
#define OutputConfiguration StringChange(StringChange(AppConfiguration, "Debug", "setup"), "Release", "setup") + "-bundle"
#else
#define InstallerCondition "Application\Core\MSIL and Application\Core\" + AppProcessor + " and Application\Designer and Application\Designer\Installer"
#define AppVersion GetStringFileInfo("..\bin\" + Year + "\" + BaseConfiguration + "\bin\System.Data.SQLite.dll", PRODUCT_VERSION)
#define OutputConfiguration StringChange(StringChange(BaseConfiguration, "Debug", "setup"), "Release", "setup")
#endif

[Setup]
AllowNoIcons=true

#if AppProcessor != "x86"
ArchitecturesAllowed={#AppProcessor}













|



|







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
;
; SQLite.iss --
;
; Written by Joe Mistachkin.
; Released to the public domain, use at your own risk!
;

#define BaseConfiguration StringChange(AppConfiguration, "NativeOnly", "")
#define GacProcessor StringChange(AppProcessor, "x64", "amd64")

#if Pos("NativeOnly", AppConfiguration) == 0
#define InstallerCondition "Application\Core\MSIL and Application\Designer and Application\Designer\Installer"
#define AppVersion GetStringFileInfo("..\bin\" + Year + "\" + AppPlatform + "\" + AppConfiguration + "\System.Data.SQLite.dll", PRODUCT_VERSION)
#define OutputConfiguration StringChange(StringChange(AppConfiguration, "Debug", "setup-debug"), "Release", "setup") + "-bundle"
#else
#define InstallerCondition "Application\Core\MSIL and Application\Core\" + AppProcessor + " and Application\Designer and Application\Designer\Installer"
#define AppVersion GetStringFileInfo("..\bin\" + Year + "\" + BaseConfiguration + "\bin\System.Data.SQLite.dll", PRODUCT_VERSION)
#define OutputConfiguration StringChange(StringChange(BaseConfiguration, "Debug", "setup-debug"), "Release", "setup")
#endif

[Setup]
AllowNoIcons=true

#if AppProcessor != "x86"
ArchitecturesAllowed={#AppProcessor}
Changes to Setup/verify.eagle.
86
87
88
89
90
91
92







93
94
95
96
97
98
99
      #
      regexp -- {(\d+)\.(\d+)\.(\d+)\.(\d+)} $manifest dummy \
          major minor build revision

      regexp -- {(\d{4})-(\d{2})-(\d{2})-(\d{2})} $manifest \
          dummy year month day sequence








      #
      # HACK: Attempt to match and remove sub-strings from the
      #       manifest file name that look like a version number
      #       in the format "<major>.<minor>.<build>.<revision>"
      #       and/or a date/time string matching the format
      #       "YYYY-MM-DD-NN" (where the NN portion is a generic
      #       incrementing sequence number).







>
>
>
>
>
>
>







86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
      #
      regexp -- {(\d+)\.(\d+)\.(\d+)\.(\d+)} $manifest dummy \
          major minor build revision

      regexp -- {(\d{4})-(\d{2})-(\d{2})-(\d{2})} $manifest \
          dummy year month day sequence

      #
      # HACK: Attempt to match and remove sub-strings from the
      #       manifest file name that look like the name of a
      #       build configuration (e.g. "debug" or "release").
      #
      regsub -- {-debug-|-release-} $manifest {-} manifest

      #
      # HACK: Attempt to match and remove sub-strings from the
      #       manifest file name that look like a version number
      #       in the format "<major>.<minor>.<build>.<revision>"
      #       and/or a date/time string matching the format
      #       "YYYY-MM-DD-NN" (where the NN portion is a generic
      #       incrementing sequence number).
Changes to System.Data.SQLite/LINQ/SQLiteFactory_Linq.cs.
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61

#if INTEROP_LOG
        if (UnsafeNativeMethods.sqlite3_config_log_interop() == SQLiteErrorCode.Ok)
        {
            UnsafeNativeMethods.sqlite3_log(
                SQLiteErrorCode.Ok, SQLiteConvert.ToUTF8("logging initialized."));
        }
#else

        SQLiteLog.Initialize();
#endif

        string version =
#if NET_40 || NET_45 || NET_451
            "4.0.0.0";
#else
            "3.5.0.0";
#endif







|
>

<







45
46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61

#if INTEROP_LOG
        if (UnsafeNativeMethods.sqlite3_config_log_interop() == SQLiteErrorCode.Ok)
        {
            UnsafeNativeMethods.sqlite3_log(
                SQLiteErrorCode.Ok, SQLiteConvert.ToUTF8("logging initialized."));
        }
#endif

        SQLiteLog.Initialize();


        string version =
#if NET_40 || NET_45 || NET_451
            "4.0.0.0";
#else
            "3.5.0.0";
#endif
Changes to System.Data.SQLite/SQLiteBase.cs.
1112
1113
1114
1115
1116
1117
1118
1119





1120
1121
1122
1123
1124
1125
1126
      LogAll = LogPrepare | LogPreBind | LogBind |
               LogCallbackException | LogBackup | LogModuleError |
               LogModuleException,

      /// <summary>
      /// The default extra flags for new connections.
      /// </summary>
      Default = LogCallbackException | LogModuleException





  }

  // These are the options to the internal sqlite3_config call.
  internal enum SQLiteConfigOpsEnum
  {
    SQLITE_CONFIG_NONE = 0, // nil
    SQLITE_CONFIG_SINGLETHREAD = 1, // nil







|
>
>
>
>
>







1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
      LogAll = LogPrepare | LogPreBind | LogBind |
               LogCallbackException | LogBackup | LogModuleError |
               LogModuleException,

      /// <summary>
      /// The default extra flags for new connections.
      /// </summary>
      Default = LogCallbackException | LogModuleException,

      /// <summary>
      /// The default extra flags for new connections with all logging enabled.
      /// </summary>
      DefaultAndLogAll = Default | LogAll
  }

  // These are the options to the internal sqlite3_config call.
  internal enum SQLiteConfigOpsEnum
  {
    SQLITE_CONFIG_NONE = 0, // nil
    SQLITE_CONFIG_SINGLETHREAD = 1, // nil
Changes to System.Data.SQLite/SQLiteConnection.cs.
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
    /// </param>
    public SQLiteConnection(string connectionString, bool parseViaFramework)
    {
#if (SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK) && PRELOAD_NATIVE_LIBRARY
      UnsafeNativeMethods.Initialize();
#endif

#if !INTEROP_LOG
      SQLiteLog.Initialize();
#endif

#if !PLATFORM_COMPACTFRAMEWORK && !INTEROP_LEGACY_CLOSE && SQLITE_STANDARD
      //
      // NOTE: Check if the sqlite3_close_v2() native API should be available
      //       to use.  This must be done dynamically because the delegate set
      //       here is used by the SQLiteConnectionHandle class, which is a
      //       CriticalHandle derived class (i.e. protected by a constrained







<

<







587
588
589
590
591
592
593

594

595
596
597
598
599
600
601
    /// </param>
    public SQLiteConnection(string connectionString, bool parseViaFramework)
    {
#if (SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK) && PRELOAD_NATIVE_LIBRARY
      UnsafeNativeMethods.Initialize();
#endif


      SQLiteLog.Initialize();


#if !PLATFORM_COMPACTFRAMEWORK && !INTEROP_LEGACY_CLOSE && SQLITE_STANDARD
      //
      // NOTE: Check if the sqlite3_close_v2() native API should be available
      //       to use.  This must be done dynamically because the delegate set
      //       here is used by the SQLiteConnectionHandle class, which is a
      //       CriticalHandle derived class (i.e. protected by a constrained
Changes to System.Data.SQLite/SQLiteLog.cs.
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
115
116
117
118
119

120
121
122
123
124
125
126
        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Member variable to store the application log handler to call.
        /// </summary>
        private static event SQLiteLogEventHandler _handlers;


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

        /// <summary>
        /// The default log event handler.
        /// </summary>
        private static SQLiteLogEventHandler _defaultHandler;

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


        /// <summary>
        /// The log callback passed to native SQLite engine.  This must live
        /// as long as the SQLite library has a pointer to it.
        /// </summary>
        private static SQLiteLogCallback _callback;

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

        /// <summary>
        /// The base SQLite object to interop with.
        /// </summary>
        private static SQLiteBase _sql;


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

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







<









>












>







91
92
93
94
95
96
97

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Member variable to store the application log handler to call.
        /// </summary>
        private static event SQLiteLogEventHandler _handlers;


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

        /// <summary>
        /// The default log event handler.
        /// </summary>
        private static SQLiteLogEventHandler _defaultHandler;

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

#if !INTEROP_LOG
        /// <summary>
        /// The log callback passed to native SQLite engine.  This must live
        /// as long as the SQLite library has a pointer to it.
        /// </summary>
        private static SQLiteLogCallback _callback;

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

        /// <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;
173
174
175
176
177
178
179

180
181
182
183
184
185
186
                if (_domainUnload == null)
                {
                    _domainUnload = new EventHandler(DomainUnload);
                    AppDomain.CurrentDomain.DomainUnload += _domainUnload;
                }
#endif


                //
                // NOTE: Create an instance of the SQLite wrapper class.
                //
                if (_sql == null)
                {
                    _sql = new SQLite3(
                        SQLiteDateFormats.Default, DateTimeKind.Unspecified,







>







174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
                if (_domainUnload == null)
                {
                    _domainUnload = new EventHandler(DomainUnload);
                    AppDomain.CurrentDomain.DomainUnload += _domainUnload;
                }
#endif

#if !INTEROP_LOG
                //
                // NOTE: Create an instance of the SQLite wrapper class.
                //
                if (_sql == null)
                {
                    _sql = new SQLite3(
                        SQLiteDateFormats.Default, DateTimeKind.Unspecified,
199
200
201
202
203
204
205

206
207
208
209
210
211
212

                    SQLiteErrorCode rc = _sql.SetLogCallback(_callback);

                    if (rc != SQLiteErrorCode.Ok)
                        throw new SQLiteException(rc,
                            "Failed to initialize logging.");
                }


                //
                // NOTE: Logging is enabled by default.
                //
                _enabled = true;

                //







>







201
202
203
204
205
206
207
208
209
210
211
212
213
214
215

                    SQLiteErrorCode rc = _sql.SetLogCallback(_callback);

                    if (rc != SQLiteErrorCode.Ok)
                        throw new SQLiteException(rc,
                            "Failed to initialize logging.");
                }
#endif

                //
                // NOTE: Logging is enabled by default.
                //
                _enabled = true;

                //
238
239
240
241
242
243
244

245
246
247
248
249
250
251

                //
                // NOTE: Disable logging.  If necessary, it can be re-enabled
                //       later by the Initialize method.
                //
                _enabled = false;


                //
                // BUGBUG: This will cause serious problems if other AppDomains
                //         have any open SQLite connections; however, there is
                //         currently no way around this limitation.
                //
                if (_sql != null)
                {







>







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255

                //
                // NOTE: Disable logging.  If necessary, it can be re-enabled
                //       later by the Initialize method.
                //
                _enabled = false;

#if !INTEROP_LOG
                //
                // BUGBUG: This will cause serious problems if other AppDomains
                //         have any open SQLite connections; however, there is
                //         currently no way around this limitation.
                //
                if (_sql != null)
                {
269
270
271
272
273
274
275

276
277
278
279
280
281
282
                //         cannot allow native code to refer to a delegate that
                //         has been garbage collected.
                //
                if (_callback != null)
                {
                    _callback = null;
                }


                //
                // NOTE: Remove the event handler for the DomainUnload event
                //       that we added earlier.
                //
                if (_domainUnload != null)
                {







>







273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
                //         cannot allow native code to refer to a delegate that
                //         has been garbage collected.
                //
                if (_callback != null)
                {
                    _callback = null;
                }
#endif

                //
                // NOTE: Remove the event handler for the DomainUnload event
                //       that we added earlier.
                //
                if (_domainUnload != null)
                {