System.Data.SQLite

Check-in [4555e3f885]
Login

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

Overview
Comment:Check-in [42b74232eb] did not go far enough. In the test suite, prefer the interop assembly when available; however, always attempt to choose the most appropriate library available, based on the managed assembly configuration.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4555e3f8854026dfe4e3e4e5899616262ed8a959
User & Date: mistachkin 2016-03-24 04:42:26.952
Context
2016-03-24
04:59
In the batch build tool, add support for per-configuration MSBuild properties. Use them to enable all the typical diagnostic features in the Mono debug builds. check-in: 4e85b70ca1 user: mistachkin tags: trunk
04:42
Check-in [42b74232eb] did not go far enough. In the test suite, prefer the interop assembly when available; however, always attempt to choose the most appropriate library available, based on the managed assembly configuration. check-in: 4555e3f885 user: mistachkin tags: trunk
03:50
Most of the 'vtab' tests appear to crash Mono 2.11. check-in: d8e91c6888 user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Externals/Eagle/lib/Eagle1.0/vendor.eagle.
333
334
335
336
337
338
339
340
341
342
343
344
345
346

347
348
349
350
351
352
353
354
    #
    # NOTE: Check for any overridden settings that may have been specified via
    #       the command line, etc.
    #
    checkForTestOverrides stdout [expr {[info exists test_overrides] ? \
        $test_overrides : [list binary_directory build_base_directory \
        build_directory common_directory connection_flags database_directory \
        datetime_format execute_on_setup interop_assembly_file_names \
        native_library_file_names release_version scratch_directory \
        temporary_directory test_clr test_clr_v2 test_clr_v4 \
        test_configuration test_configurations test_constraints test_machine \
        test_net_fx test_net_fx_2005 test_net_fx_2008 test_net_fx_2010 \
        test_net_fx_2012 test_net_fx_2013 test_net_fx_2015 test_overrides \
        test_platform test_suite test_year test_years test_year_clr_v2 \

        test_year_clr_v4 vendor_directory vendor_test_directory]}] false

    #
    # NOTE: Set the name of the running test suite, if necessary.
    #
    if {![info exists test_suite]} then {
      set test_suite "System.Data.SQLite Test Suite for Eagle"
    }







|
|
|
|
|
|
|
>
|







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
    #
    # NOTE: Check for any overridden settings that may have been specified via
    #       the command line, etc.
    #
    checkForTestOverrides stdout [expr {[info exists test_overrides] ? \
        $test_overrides : [list binary_directory build_base_directory \
        build_directory common_directory connection_flags database_directory \
        datetime_format define_constant_prefix execute_on_setup \
        interop_assembly_file_names native_library_file_names release_version \
        scratch_directory temporary_directory test_clr test_clr_v2 \
        test_clr_v4 test_configuration test_configurations test_constraints \
        test_machine test_net_fx test_net_fx_2005 test_net_fx_2008 \
        test_net_fx_2010 test_net_fx_2012 test_net_fx_2013 test_net_fx_2015 \
        test_overrides test_platform test_suite test_year test_years \
        test_year_clr_v2 test_year_clr_v4 vendor_directory \
        vendor_test_directory]}] false

    #
    # NOTE: Set the name of the running test suite, if necessary.
    #
    if {![info exists test_suite]} then {
      set test_suite "System.Data.SQLite Test Suite for Eagle"
    }
Changes to lib/System.Data.SQLite/common.eagle.
14
15
16
17
18
19
20
























21
22
23
24
25
26
27
#
namespace eval ::Eagle {
  if {[isEagle]} then {
    ###########################################################################
    ############################ BEGIN Eagle ONLY #############################
    ###########################################################################

























    proc getBuildYear {} {
      #
      # NOTE: See if the "year" setting has been overridden by the user (e.g.
      #       on the command line).  This helps control exactly which set of
      #       binaries we are testing, those produced using the Visual Studio
      #       2005, 2008, 2010, 2012, 2013, or 2015 build systems.  To override
      #       this value via the command line, enter a command similar to one







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







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
48
49
50
51
#
namespace eval ::Eagle {
  if {[isEagle]} then {
    ###########################################################################
    ############################ BEGIN Eagle ONLY #############################
    ###########################################################################

    proc getSQLiteDefineConstantPrefix {} {
      #
      # NOTE: See if the define constant prefix setting has been overridden
      #       by the user (e.g. on the command line).
      #
      if {[info exists ::define_constant_prefix] && \
          [string length $::define_constant_prefix] > 0} then {
        #
        # NOTE: Use the specified define constant prefix.
        #
        return $::define_constant_prefix
      } else {
        #
        # NOTE: Use the default define constant prefix.
        #
        return defineConstant.System.Data.SQLite.
      }
    }

    proc haveSQLiteDefineConstant { name } {
      return [haveConstraint \
          [appendArgs [getSQLiteDefineConstantPrefix] $name]]
    }

    proc getBuildYear {} {
      #
      # NOTE: See if the "year" setting has been overridden by the user (e.g.
      #       on the command line).  This helps control exactly which set of
      #       binaries we are testing, those produced using the Visual Studio
      #       2005, 2008, 2010, 2012, 2013, or 2015 build systems.  To override
      #       this value via the command line, enter a command similar to one
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857




858
859
860
861
862
863
864

865
866
867
868
869
870
871


872
873
874

875
876
877
878
879
880
881
882
883
884

885
886
887
888
889
890
891
892
893
894
895
896
897
898







































899
900
901






902
903
904
905
906
907
908
909
910
      #       binary directory, discarding any directory information present
      #       in the file name as provided by our caller.
      #
      return [file nativename \
          [file join [getBinaryDirectory] $platform [file tail $fileName]]]
    }

    proc getCoreBinaryFileName { {platform ""} {standard false} } {
      #
      # NOTE: Returns the full path for the file containing the SQLite core
      #       native library code for this platform.  First, check and see if
      #       the SQLite core native library has already been loaded.  Next,
      #       fallback to what the full path should be, based on whether the
      #       mixed-mode assembly is being used and the name of the current
      #       platform.
      #
      if {[catch {
        object invoke -flags +NonPublic \
            System.Data.SQLite.UnsafeNativeMethods _SQLiteNativeModuleFileName
      } fileName] == 0 && [string length $fileName] > 0} then {
        #
        # NOTE: The SQLite core native library has already been loaded via
        #       the native library pre-loader.  Return that file name now.
        #
        return $fileName
      }





      if {[hasRuntimeOption native]} then {
        #
        # NOTE: Return the mixed-mode assembly file name.
        #
        return [file nativename \
            [file join [getBinaryDirectory] $platform System.Data.SQLite.dll]]
      } elseif {$standard} then {

        #
        # NOTE: Attempt to determine the native-only standard SQLite library
        #       file name for this platform and then return it.
        #
        foreach fileNameOnly [getNativeLibraryFileNamesOnly] {
          set fileName [file nativename \
              [file join [getBinaryDirectory] $platform $fileNameOnly]]



          if {[file exists $fileName]} then {
            return $fileName

          }
        }

        #
        # NOTE: Fallback to returning the native-only standard SQLite library
        #       file name for Windows.
        #
        return [file nativename \
            [file join [getBinaryDirectory] $platform sqlite3.dll]]
      } else {

        #
        # NOTE: Attempt to determine the native-only interop assembly file
        #       name for this platform and then return it.
        #
        foreach fileNameOnly [getInteropAssemblyFileNamesOnly] {
          set fileName [file nativename \
              [file join [getBinaryDirectory] $platform $fileNameOnly]]

          if {[file exists $fileName]} then {
            return $fileName
          }
        }

        #







































        # NOTE: Fallback to returning the native-only interop assembly file
        #       name for Windows.
        #






        return [file nativename \
            [file join [getBinaryDirectory] $platform SQLite.Interop.dll]]
      }
    }

    proc getCommonDirectory {} {
      #
      # NOTE: This procedure returns the directory where the test scripts
      #       should be located.  By default, this just returns the Eagle







|



















>
>
>
>






<
>
|
<
<
|
<
<
<
>
>
|
<
<
>
|
<
|
<
|
|
|
<
<
<
>












|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|

>
>
>
>
>
>
|
|







855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891

892
893


894



895
896
897


898
899

900

901
902
903



904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
      #       binary directory, discarding any directory information present
      #       in the file name as provided by our caller.
      #
      return [file nativename \
          [file join [getBinaryDirectory] $platform [file tail $fileName]]]
    }

    proc getCoreBinaryFileName { {platform ""} {standard ""} } {
      #
      # NOTE: Returns the full path for the file containing the SQLite core
      #       native library code for this platform.  First, check and see if
      #       the SQLite core native library has already been loaded.  Next,
      #       fallback to what the full path should be, based on whether the
      #       mixed-mode assembly is being used and the name of the current
      #       platform.
      #
      if {[catch {
        object invoke -flags +NonPublic \
            System.Data.SQLite.UnsafeNativeMethods _SQLiteNativeModuleFileName
      } fileName] == 0 && [string length $fileName] > 0} then {
        #
        # NOTE: The SQLite core native library has already been loaded via
        #       the native library pre-loader.  Return that file name now.
        #
        return $fileName
      }

      #
      # NOTE: If the "native" runtime option has been set, always return the
      #       file name for the mixed-mode assembly.
      #
      if {[hasRuntimeOption native]} then {
        #
        # NOTE: Return the mixed-mode assembly file name.
        #
        return [file nativename \
            [file join [getBinaryDirectory] $platform System.Data.SQLite.dll]]

      }



      #



      # NOTE: Are we attempting to automatically detect whether or not the
      #       interop assembly should be used?
      #


      set automatic [expr {[string length $standard] == 0}]


      #

      # NOTE: First, in either "automatic" or "non-standard" modes, attempt
      #       to find the native-only interop assembly.
      #



      if {$automatic || !$standard} then {
        #
        # NOTE: Attempt to determine the native-only interop assembly file
        #       name for this platform and then return it.
        #
        foreach fileNameOnly [getInteropAssemblyFileNamesOnly] {
          set fileName [file nativename \
              [file join [getBinaryDirectory] $platform $fileNameOnly]]

          if {[file exists $fileName]} then {
            return $fileName
          }
        }
      }

      #
      # NOTE: Then, in either "automatic" or "standard" modes, attempt to
      #       find the standard SQLite library.
      #
      if {$automatic || $standard} then {
        #
        # NOTE: Attempt to determine the native-only standard SQLite library
        #       file name for this platform and then return it.
        #
        foreach fileNameOnly [getNativeLibraryFileNamesOnly] {
          set fileName [file nativename \
              [file join [getBinaryDirectory] $platform $fileNameOnly]]

          if {[file exists $fileName]} then {
            return $fileName
          }
        }
      }

      #
      # NOTE: Was the managed assembly compiled expecting to deal with the
      #       standard core library?
      #
      if {[haveSQLiteDefineConstant SQLITE_STANDARD] || \
          [haveSQLiteDefineConstant SQLITE_STANDARD_LIBRARY_NAME]} then {
        #
        # NOTE: Fallback to returning the native-only standard SQLite library
        #       file name for the platform.
        #
        set fileNamesOnly [getNativeLibraryFileNamesOnly]

        if {[llength $fileNamesOnly] == 0} then {
          return ""
        }

        return [file nativename [file join \
            [getBinaryDirectory] $platform [lindex $fileNamesOnly 0]]]
      } else {
        #
        # NOTE: Fallback to returning the native-only interop assembly file
        #       name for the platform.
        #
        set fileNamesOnly [getInteropAssemblyFileNamesOnly]

        if {[llength $fileNamesOnly] == 0} then {
          return ""
        }

        return [file nativename [file join \
            [getBinaryDirectory] $platform [lindex $fileNamesOnly 0]]]
      }
    }

    proc getCommonDirectory {} {
      #
      # NOTE: This procedure returns the directory where the test scripts
      #       should be located.  By default, this just returns the Eagle
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
          foreach defineConstant [list \
              INTEROP_EXTENSION_FUNCTIONS INTEROP_FTS5_EXTENSION \
              INTEROP_JSON1_EXTENSION INTEROP_PERCENTILE_EXTENSION \
              INTEROP_REGEXP_EXTENSION INTEROP_TEST_EXTENSION \
              INTEROP_TOTYPE_EXTENSION INTEROP_VIRTUAL_TABLE \
              USE_INTEROP_DLL] {
            addConstraint [appendArgs \
                defineConstant.System.Data.SQLite. $defineConstant]
          }
        }

        if {![info exists ::no(shimSQLiteVisualStudioConstraints)]} then {
          addConstraint [appendArgs visualStudio [getBuildYear]]
        }








|







1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
          foreach defineConstant [list \
              INTEROP_EXTENSION_FUNCTIONS INTEROP_FTS5_EXTENSION \
              INTEROP_JSON1_EXTENSION INTEROP_PERCENTILE_EXTENSION \
              INTEROP_REGEXP_EXTENSION INTEROP_TEST_EXTENSION \
              INTEROP_TOTYPE_EXTENSION INTEROP_VIRTUAL_TABLE \
              USE_INTEROP_DLL] {
            addConstraint [appendArgs \
                [getSQLiteDefineConstantPrefix] $defineConstant]
          }
        }

        if {![info exists ::no(shimSQLiteVisualStudioConstraints)]} then {
          addConstraint [appendArgs visualStudio [getBuildYear]]
        }

1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
            System.Data.SQLite.SQLite3 DefineConstants
      } defineConstants] == 0} then {
        if {[lsearch -exact -nocase $defineConstants $name] != -1} then {
          #
          # NOTE: Yes, this define constant was enabled when the managed
          #       assembly was compiled.
          #
          addConstraint [appendArgs defineConstant.System.Data.SQLite. $name]

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel error\n







|







1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
            System.Data.SQLite.SQLite3 DefineConstants
      } defineConstants] == 0} then {
        if {[lsearch -exact -nocase $defineConstants $name] != -1} then {
          #
          # NOTE: Yes, this define constant was enabled when the managed
          #       assembly was compiled.
          #
          addConstraint [appendArgs [getSQLiteDefineConstantPrefix] $name]

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel error\n
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
        }
      }
    }

    proc getSQLiteHandleCounts { channel {quiet false} } {
      set result [list]

      if {[haveSQLiteObjectCommand] && [haveConstraint \
              defineConstant.System.Data.SQLite.COUNT_HANDLE]} then {
        #
        # NOTE: Add each critical handle count to the resulting list.
        #
        foreach name [list connectionCount statementCount backupCount] {
          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.DebugData $name







|
|







3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
        }
      }
    }

    proc getSQLiteHandleCounts { channel {quiet false} } {
      set result [list]

      if {[haveSQLiteObjectCommand] && \
          [haveSQLiteDefineConstant COUNT_HANDLE]} then {
        #
        # NOTE: Add each critical handle count to the resulting list.
        #
        foreach name [list connectionCount statementCount backupCount] {
          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.DebugData $name
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
                "==== WARNING: failed to reset setting statistics for " \
                "the previous " $nameCount " names and " $valueCount \
                " values read, error: " \n\t $error \n]
          }
        }
      }

      if {[haveSQLiteObjectCommand] && [haveConstraint \
              defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE] && \
          [haveConstraint \
              defineConstant.System.Data.SQLite.TRACK_MEMORY_BYTES]} then {
        if {!$quiet} then {
          tputs $channel "---- current memory in use by SQLiteMemory... "
        }

        if {[catch {
          object invoke -flags +NonPublic \
              System.Data.SQLite.SQLiteMemory bytesAllocated







|
|
<
|







3170
3171
3172
3173
3174
3175
3176
3177
3178

3179
3180
3181
3182
3183
3184
3185
3186
                "==== WARNING: failed to reset setting statistics for " \
                "the previous " $nameCount " names and " $valueCount \
                " values read, error: " \n\t $error \n]
          }
        }
      }

      if {[haveSQLiteObjectCommand] && \
          [haveSQLiteDefineConstant INTEROP_VIRTUAL_TABLE] && \

          [haveSQLiteDefineConstant TRACK_MEMORY_BYTES]} then {
        if {!$quiet} then {
          tputs $channel "---- current memory in use by SQLiteMemory... "
        }

        if {[catch {
          object invoke -flags +NonPublic \
              System.Data.SQLite.SQLiteMemory bytesAllocated
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
          checkForSQLiteDefineConstant $::test_channel $defineConstant
        }

        #
        # NOTE: Check if the System.Data.SQLite provider was compiled with
        #       support for any encrypted databases.
        #
        if {[haveConstraint \
                defineConstant.System.Data.SQLite.INTEROP_CODEC] || \
            [haveConstraint \
                defineConstant.System.Data.SQLite.INTEROP_INCLUDE_SEE]} then {
          #
          # NOTE: Yes, add generic constraint for use by the test suite.
          #
          addConstraint System.Data.SQLite.Encryption
        }

        #







<
|
<
|







4013
4014
4015
4016
4017
4018
4019

4020

4021
4022
4023
4024
4025
4026
4027
4028
          checkForSQLiteDefineConstant $::test_channel $defineConstant
        }

        #
        # NOTE: Check if the System.Data.SQLite provider was compiled with
        #       support for any encrypted databases.
        #

        if {[haveSQLiteDefineConstant INTEROP_CODEC] || \

            [haveSQLiteDefineConstant INTEROP_INCLUDE_SEE]} then {
          #
          # NOTE: Yes, add generic constraint for use by the test suite.
          #
          addConstraint System.Data.SQLite.Encryption
        }

        #