System.Data.SQLite

Check-in [87a9203693]
Login

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

Overview
Comment:Fixes to test infrastructure utility routines.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 87a9203693613d578b18efa43952a1dc57949a08
User & Date: mistachkin 2013-12-31 08:35:11.608
Context
2013-12-31
08:40
Add the ability for the test suite infrastructure to skip loading the 'implicit' (i.e. non-platform/architecture) assemblies. check-in: 123d84e4ef user: mistachkin tags: trunk
08:35
Fixes to test infrastructure utility routines. check-in: 87a9203693 user: mistachkin tags: trunk
07:50
Update version history docs. check-in: 65cfd24266 user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Tests/common.eagle.
123
124
125
126
127
128
129

130

131
132
133
134
135
136
137

138
139
140
141
142
143
144
      } elseif {[info exists ::test_machine] && \
          [string length $::test_machine] > 0} then {
        #
        # NOTE: For native builds, return the platform name corresponding to
        #       the test machine architecture; otherwise, return an empty
        #       string.
        #

        return [expr {$native ? [machineToPlatform $::test_machine] : ""}]

      } elseif {[info exists ::tcl_platform(machine)]} then {
        #
        # NOTE: For native builds, return the platform name corresponding to
        #       the machine architecture; otherwise, return an empty string.
        #
        return [expr {$native ? \
            [machineToPlatform $::tcl_platform(machine)] : ""}]

      } else {
        #
        # NOTE: No machine architecture is available, return an empty string.
        #
        return ""
      }
    }







>
|
>





|
|
>







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
      } elseif {[info exists ::test_machine] && \
          [string length $::test_machine] > 0} then {
        #
        # NOTE: For native builds, return the platform name corresponding to
        #       the test machine architecture; otherwise, return an empty
        #       string.
        #
        return [expr {
          $native ? [machineToPlatform $::test_machine] : ""
        }]
      } elseif {[info exists ::tcl_platform(machine)]} then {
        #
        # NOTE: For native builds, return the platform name corresponding to
        #       the machine architecture; otherwise, return an empty string.
        #
        return [expr {
          $native ? [machineToPlatform $::tcl_platform(machine)] : ""
        }]
      } else {
        #
        # NOTE: No machine architecture is available, return an empty string.
        #
        return ""
      }
    }
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
      #       should be called only after the [tryLoadAssembly] procedure has
      #       been called to probe for the System.Data.SQLite managed assembly
      #       and the [checkForSQLite] procedure has been called to probe for
      #       the SQLite native library; otherwise, this procedure will simply
      #       always return zero.
      #
      return [expr {
          [haveConstraint System.Data.SQLite] && [haveConstraint SQLite]
      }]
    }

    proc matchMachine { platform } {
      #
      # NOTE: An empty string for the platform means that the build is not
      #       [primarily] a native build; therefore, it always matches.







|







921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
      #       should be called only after the [tryLoadAssembly] procedure has
      #       been called to probe for the System.Data.SQLite managed assembly
      #       and the [checkForSQLite] procedure has been called to probe for
      #       the SQLite native library; otherwise, this procedure will simply
      #       always return zero.
      #
      return [expr {
        [haveConstraint System.Data.SQLite] && [haveConstraint SQLite]
      }]
    }

    proc matchMachine { platform } {
      #
      # NOTE: An empty string for the platform means that the build is not
      #       [primarily] a native build; therefore, it always matches.
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351






1352

1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363

1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
      #       caller.  It contains the database connection handle that will be
      #       used to execute the query used to determine if the named table is
      #       present in that database.
      #
      upvar 1 $varName db

      #
      # NOTE: Execute the SQL query against the sqlite_master table to check if
      #       the named table is present and return non-zero if it is.
      #
      return [expr {[sql execute -execute scalar $db \
          "SELECT COUNT(*) FROM sqlite_master WHERE type = 'table' AND name = ?;" \






          [list param1 String $name]] > 0}]

    }

    proc trimSql { sql } {
      return [regsub -all -- {\s+} [string trim $sql] " "]
    }

    proc executeSql { sql {execute none} {fileName ""} } {
      if {[string length $fileName] == 0} then {set fileName :memory:}
      setupDb $fileName "" "" "" "" "" false false false false memDb

      try {

        return [sql execute -execute $execute $memDb $sql]
      } finally {
        cleanupDb $fileName memDb false false
      }
    }

    proc setupDb {
            fileName {mode ""} {dateTimeFormat ""} {dateTimeKind ""} {flags ""}
            {extra ""} {qualify true} {delete true} {uri false}
            {temporary true} {varName db} } {







|
|

|
|
>
>
>
>
>
>
|
>






|

|


>
|

|







1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
      #       caller.  It contains the database connection handle that will be
      #       used to execute the query used to determine if the named table is
      #       present in that database.
      #
      upvar 1 $varName db

      #
      # NOTE: Use the sqlite_master table to determine if the named table is
      #       present in the database.
      #
      set sql {
        SELECT COUNT(*) FROM sqlite_master WHERE type = 'table' AND name = ?;
      }

      #
      # NOTE: Return non-zero if the named table is present.
      #
      return [expr {
        [sql execute -execute scalar $db $sql [list param1 String $name]] > 0
      }]
    }

    proc trimSql { sql } {
      return [regsub -all -- {\s+} [string trim $sql] " "]
    }

    proc executeSql { sql {execute none} {format none} {fileName ""} } {
      if {[string length $fileName] == 0} then {set fileName :memory:}
      setupDb $fileName "" "" "" "" "" false false false false

      try {
        return [uplevel 1 [list \
            sql execute -execute $execute -format $format $db $sql]]
      } finally {
        cleanupDb $fileName db false false false
      }
    }

    proc setupDb {
            fileName {mode ""} {dateTimeFormat ""} {dateTimeKind ""} {flags ""}
            {extra ""} {qualify true} {delete true} {uri false}
            {temporary true} {varName db} } {