System.Data.SQLite

Check-in [e36ed56d66]
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-5cee5409f8
Files: files | file ages | folders
SHA1: e36ed56d66f8698a663dd8286bcebd3cc4ddb498
User & Date: mistachkin 2018-01-26 00:00:22.691
Context
2018-01-26
01:14
Merge updates from trunk. check-in: 611657ba5b user: mistachkin tags: tkt-5cee5409f8
00:00
Merge updates from trunk. check-in: e36ed56d66 user: mistachkin tags: tkt-5cee5409f8
2018-01-25
23:59
Remove trailing whitespace. check-in: 2435b29a4f user: mistachkin tags: trunk
21:44
Merge updates from trunk. check-in: a363e907fe user: mistachkin tags: tkt-5cee5409f8
Changes
Unified Diff Ignore Whitespace Patch
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Queries the read counts for the runtime configuration settings.
      /// These numbers are used for debugging and testing purposes only.
      /// </summary>
      /// <param name="viaFile">
      /// Non-zero if the specified setting is being read from the XML
      /// configuration file.
      /// </param>
      /// <returns>
      /// A copy of the statistics for the specified runtime configuration
      /// settings -OR- null if they are not available.
      /// </returns>
      public static object GetSettingReadCounts(







|







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Queries the read counts for the runtime configuration settings.
      /// These numbers are used for debugging and testing purposes only.
      /// </summary>
      /// <param name="viaFile">
      /// Non-zero if the specified settings were read from the XML
      /// configuration file.
      /// </param>
      /// <returns>
      /// A copy of the statistics for the specified runtime configuration
      /// settings -OR- null if they are not available.
      /// </returns>
      public static object GetSettingReadCounts(
169
170
171
172
173
174
175





























176
177
178
179
180
181
182
                  if (settingReadCounts == null)
                      return null;

                  return new Dictionary<string, int>(settingReadCounts);
              }
          }
      }






























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

      /// <summary>
      /// Increments the read count for the specified runtime configuration
      /// setting.  These numbers are used for debugging and testing purposes
      /// only.







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







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
                  if (settingReadCounts == null)
                      return null;

                  return new Dictionary<string, int>(settingReadCounts);
              }
          }
      }

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

      /// <summary>
      /// Clears the read counts for the runtime configuration settings.
      /// These numbers are used for debugging and testing purposes only.
      /// </summary>
      /// <param name="viaFile">
      /// Non-zero if the specified settings were read from the XML
      /// configuration file.
      /// </param>
      public static void ClearSettingReadCounts(
          bool viaFile
          )
      {
          lock (staticSyncRoot)
          {
              if (viaFile)
              {
                  if (settingFileReadCounts != null)
                      settingFileReadCounts.Clear();
              }
              else
              {
                  if (settingReadCounts != null)
                      settingReadCounts.Clear();
              }
          }
      }

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

      /// <summary>
      /// Increments the read count for the specified runtime configuration
      /// setting.  These numbers are used for debugging and testing purposes
      /// only.
220
221
222
223
224
225
226



































227
228
229
230
231
232
233
                          settingReadCounts[name] = count + 1;
                      else
                          settingReadCounts.Add(name, 1);
                  }
              }
          }
      }




































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

      /// <summary>
      /// Increments the specified counter.
      /// </summary>
      /// <param name="name">







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







249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
                          settingReadCounts[name] = count + 1;
                      else
                          settingReadCounts.Add(name, 1);
                  }
              }
          }
      }

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

      /// <summary>
      /// Queries the counters.  These numbers are used for debugging and
      /// testing purposes only.
      /// </summary>
      /// <returns>
      /// A copy of the counters -OR- null if they are not available.
      /// </returns>
      public static object GetOtherCounts()
      {
          lock (staticSyncRoot)
          {
              if (otherCounts == null)
                  return null;

              return new Dictionary<string, int>(otherCounts);
          }
      }

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

      /// <summary>
      /// Clears the counters.  These numbers are used for debugging and
      /// testing purposes only.
      /// </summary>
      public static void ClearOtherCounts()
      {
          lock (staticSyncRoot)
          {
              if (otherCounts != null)
                  otherCounts.Clear();
          }
      }

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

      /// <summary>
      /// Increments the specified counter.
      /// </summary>
      /// <param name="name">
1147
1148
1149
1150
1151
1152
1153











1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Attempts to initialize this class by pre-loading the native SQLite
      /// library for the processor architecture of the current process.
      /// </summary>
      internal static void Initialize()
      {











          //
          // NOTE: Check if a debugger needs to be attached before doing any
          //       real work.
          //
          HelperMethods.MaybeBreakIntoDebugger();

#if SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK
#if PRELOAD_NATIVE_LIBRARY
          //
          // NOTE: If the "No_PreLoadSQLite" environment variable is set (to
          //       anything), skip all of our special code and simply return.
          //
          if (GetSettingValue("No_PreLoadSQLite", null) != null)
              return;
#endif
#endif

          #region Debug Build Only
#if DEBUG
          //
          // NOTE: Create the lists of statistics that will contain
          //       various counts used in debugging, including the
          //       number of times each setting value has been read.
          //
          DebugData.Initialize();
#endif
          #endregion

          lock (staticSyncRoot)
          {
              //
              // TODO: Make sure this list is updated if the supported
              //       processor architecture names and/or platform names
              //       changes.
              //







>
>
>
>
>
>
>
>
>
>
>

















<
<
<
<
<
<
<
<
<
<
<







1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245











1246
1247
1248
1249
1250
1251
1252
      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Attempts to initialize this class by pre-loading the native SQLite
      /// library for the processor architecture of the current process.
      /// </summary>
      internal static void Initialize()
      {
          #region Debug Build Only
#if DEBUG
          //
          // NOTE: Create the lists of statistics that will contain
          //       various counts used in debugging, including the
          //       number of times each setting value has been read.
          //
          DebugData.Initialize();
#endif
          #endregion

          //
          // NOTE: Check if a debugger needs to be attached before doing any
          //       real work.
          //
          HelperMethods.MaybeBreakIntoDebugger();

#if SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK
#if PRELOAD_NATIVE_LIBRARY
          //
          // NOTE: If the "No_PreLoadSQLite" environment variable is set (to
          //       anything), skip all of our special code and simply return.
          //
          if (GetSettingValue("No_PreLoadSQLite", null) != null)
              return;
#endif
#endif












          lock (staticSyncRoot)
          {
              //
              // TODO: Make sure this list is updated if the supported
              //       processor architecture names and/or platform names
              //       changes.
              //
Changes to lib/System.Data.SQLite/common.eagle.
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
        }
      }
    }

    proc getSettingReadCount { name {viaFile false} } {
      if {[haveConstraint buildConfiguration.Debug] && [catch {
        object invoke -flags +NonPublic -alias \
            System.Data.SQLite.DebugData [expr {$viaFile ? \
            "settingFileReadCounts" : "settingReadCounts"}]
      } settingReadCounts] == 0} then {
        if {[string length $name] > 0} then {
          if {[$settingReadCounts TryGetValue $name value]} then {
            tputs $::test_channel [appendArgs \
                "---- setting \"" $name "\" was read " $value " times" \
                [expr {$viaFile ? " from the configuration file" : ""}] \n]








|
<







3579
3580
3581
3582
3583
3584
3585
3586

3587
3588
3589
3590
3591
3592
3593
        }
      }
    }

    proc getSettingReadCount { name {viaFile false} } {
      if {[haveConstraint buildConfiguration.Debug] && [catch {
        object invoke -flags +NonPublic -alias \
            System.Data.SQLite.DebugData GetSettingReadCounts $viaFile

      } settingReadCounts] == 0} then {
        if {[string length $name] > 0} then {
          if {[$settingReadCounts TryGetValue $name value]} then {
            tputs $::test_channel [appendArgs \
                "---- setting \"" $name "\" was read " $value " times" \
                [expr {$viaFile ? " from the configuration file" : ""}] \n]

3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637

      return -1
    }

    proc getOtherCount { name } {
      if {[haveConstraint buildConfiguration.Debug] && [catch {
        object invoke -flags +NonPublic -alias \
            System.Data.SQLite.DebugData otherCounts
      } otherCounts] == 0} then {
        if {[string length $name] > 0} then {
          if {[$otherCounts TryGetValue $name value]} then {
            tputs $::test_channel [appendArgs \
                "---- other counter \"" $name "\" has value " $value \n]

            return $value







|







3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636

      return -1
    }

    proc getOtherCount { name } {
      if {[haveConstraint buildConfiguration.Debug] && [catch {
        object invoke -flags +NonPublic -alias \
            System.Data.SQLite.DebugData GetOtherCounts
      } otherCounts] == 0} then {
        if {[string length $name] > 0} then {
          if {[$otherCounts TryGetValue $name value]} then {
            tputs $::test_channel [appendArgs \
                "---- other counter \"" $name "\" has value " $value \n]

            return $value
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728



3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763



3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801



3802
3803
3804
3805
3806
3807
3808
      # NOTE: If available, report on (and possibly reset) the runtime
      #       configuration statistics.
      #
      if {[haveSQLiteObjectCommand] && \
          [haveConstraint buildConfiguration.Debug]} then {
        if {[catch {
          object invoke -flags +NonPublic -alias \
              System.Data.SQLite.DebugData settingReadCounts
        } settingReadCounts] == 0} then {
          set nameCount [$settingReadCounts Count]
          set valueCount 0

          object foreach -alias pair $settingReadCounts {
            incr valueCount [$pair Value]

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- setting \"" [$pair Key] "\" was read " \
                  [$pair Value] " times\n"]
            }
          }

          if {$reset} then {



            if {[catch {$settingReadCounts Clear} error] == 0} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "---- reset setting statistics for the previous " \
                    $nameCount " names and " $valueCount " values read\n"]
              }
            } else {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: failed to reset setting statistics for " \
                    "the previous " $nameCount " names and " $valueCount \
                    " values read, error: " \n\t $error \n]
              }
            }
          }
        }

        if {[catch {
          object invoke -flags +NonPublic -alias \
              System.Data.SQLite.DebugData settingFileReadCounts
        } settingFileReadCounts] == 0} then {
          set nameCount [$settingFileReadCounts Count]
          set valueCount 0

          object foreach -alias pair $settingFileReadCounts {
            incr valueCount [$pair Value]

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- setting \"" [$pair Key] "\" was read " \
                  [$pair Value] " times from the configuration file\n"]
            }
          }

          if {$reset} then {



            if {[catch {$settingFileReadCounts Clear} error] == 0} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "---- reset setting statistics for the previous " \
                    $nameCount " names and " $valueCount " values read " \
                    "from the configuration file\n"]
              }
            } else {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: failed to reset setting statistics for " \
                    "the previous " $nameCount " names and " $valueCount \
                    " values read from the configuration file, error: " \n\t \
                    $error \n]
              }
            }
          }
        }

        if {[catch {
          object invoke -flags +NonPublic -alias \
              System.Data.SQLite.DebugData otherCounts
        } otherCounts] == 0} then {
          set nameCount [$otherCounts Count]
          set valueCount 0

          object foreach -alias pair $otherCounts {
            incr valueCount [$pair Value]

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- other counter \"" [$pair Key] "\" has value " \
                  [$pair Value] \n]
            }
          }

          if {$reset} then {
            if {[catch {$otherCounts Clear} error] == 0} then {



              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "---- reset other counters for the previous " \
                    $nameCount " names and " $valueCount " values\n"]
              }
            } else {
              if {!$quiet} then {







|















>
>
>
|


















|















>
>
>
|




















|















|
>
>
>







3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
      # NOTE: If available, report on (and possibly reset) the runtime
      #       configuration statistics.
      #
      if {[haveSQLiteObjectCommand] && \
          [haveConstraint buildConfiguration.Debug]} then {
        if {[catch {
          object invoke -flags +NonPublic -alias \
              System.Data.SQLite.DebugData GetSettingReadCounts false
        } settingReadCounts] == 0} then {
          set nameCount [$settingReadCounts Count]
          set valueCount 0

          object foreach -alias pair $settingReadCounts {
            incr valueCount [$pair Value]

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- setting \"" [$pair Key] "\" was read " \
                  [$pair Value] " times\n"]
            }
          }

          if {$reset} then {
            if {[catch {
              object invoke -flags +NonPublic -alias \
                  System.Data.SQLite.DebugData ClearSettingReadCounts false
            } error] == 0} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "---- reset setting statistics for the previous " \
                    $nameCount " names and " $valueCount " values read\n"]
              }
            } else {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: failed to reset setting statistics for " \
                    "the previous " $nameCount " names and " $valueCount \
                    " values read, error: " \n\t $error \n]
              }
            }
          }
        }

        if {[catch {
          object invoke -flags +NonPublic -alias \
              System.Data.SQLite.DebugData GetSettingReadCounts true
        } settingFileReadCounts] == 0} then {
          set nameCount [$settingFileReadCounts Count]
          set valueCount 0

          object foreach -alias pair $settingFileReadCounts {
            incr valueCount [$pair Value]

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- setting \"" [$pair Key] "\" was read " \
                  [$pair Value] " times from the configuration file\n"]
            }
          }

          if {$reset} then {
            if {[catch {
              object invoke -flags +NonPublic -alias \
                  System.Data.SQLite.DebugData ClearSettingReadCounts true
            } error] == 0} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "---- reset setting statistics for the previous " \
                    $nameCount " names and " $valueCount " values read " \
                    "from the configuration file\n"]
              }
            } else {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: failed to reset setting statistics for " \
                    "the previous " $nameCount " names and " $valueCount \
                    " values read from the configuration file, error: " \n\t \
                    $error \n]
              }
            }
          }
        }

        if {[catch {
          object invoke -flags +NonPublic -alias \
              System.Data.SQLite.DebugData GetOtherCounts
        } otherCounts] == 0} then {
          set nameCount [$otherCounts Count]
          set valueCount 0

          object foreach -alias pair $otherCounts {
            incr valueCount [$pair Value]

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- other counter \"" [$pair Key] "\" has value " \
                  [$pair Value] \n]
            }
          }

          if {$reset} then {
            if {[catch {
              object invoke -flags +NonPublic -alias \
                  System.Data.SQLite.DebugData ClearOtherCounts
            } error] == 0} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "---- reset other counters for the previous " \
                    $nameCount " names and " $valueCount " values\n"]
              }
            } else {
              if {!$quiet} then {
4711
4712
4713
4714
4715
4716
4717



















4718
4719
4720
4721
4722
4723
4724
              set sourceId null
            }
            tputs $::test_channel [appendArgs $sourceId \n]
          } else {
            tputs $::test_channel unknown\n
          }
        }




















        #
        # NOTE: Check the available builds (and "releases") of SQLite and
        #       System.Data.SQLite.
        #
        checkForSQLiteBuilds $::test_channel
        checkForSQLiteReleases $::test_channel







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







4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
              set sourceId null
            }
            tputs $::test_channel [appendArgs $sourceId \n]
          } else {
            tputs $::test_channel unknown\n
          }
        }

        #
        # NOTE: Reset cached "break into debugger" setting so that it can be
        #       used during the test file, if needed.
        #
        if {![info exists ::no(resetBreakIntoDebugger)] && \
            [haveSQLiteObjectCommand]} then {
          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.HelperMethods ResetBreakIntoDebugger
          } result] == 0} then {
            tputs $::test_channel [appendArgs \
                "---- call ResetBreakIntoDebugger()... ok\n"]
          } else {
            tputs $::test_channel [appendArgs \
                "---- call ResetBreakIntoDebugger()... error: " \
                \n\t $result \n]
          }
        }

        #
        # NOTE: Check the available builds (and "releases") of SQLite and
        #       System.Data.SQLite.
        #
        checkForSQLiteBuilds $::test_channel
        checkForSQLiteReleases $::test_channel