System.Data.SQLite
Check-in [ef146a4391]
Not logged in

 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 ... 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 ... 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 ... 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 ... 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 .... 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 .... 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 .... 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 .... 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189   # return "" } } proc getBuildConfiguration {} { # # NOTE: See if the "configuration" setting has been overridden by the user # (e.g. on the command line). This helps control exactly which set # of binaries we are testing (i.e. those built in the "Debug" or # "Release" build configurations). To override this value via the # command line, enter a command similar to one of the following (all # on one line): # # EagleShell.exe -preInitialize "set test_configuration Debug" # -file .\path\to\all.eagle # # EagleShell.exe -preInitialize "set test_configuration Release" # -file .\path\to\all.eagle # ................................................................................ # EagleShell.exe -file .\path\to\all.eagle -preTest # "unset -nocomplain test_configuration" # if {[info exists ::test_configuration] && \ [string length $::test_configuration] > 0} then { # # NOTE: Use the specified test configuration. The default value used # for this variable is "Release", as set by the test suite itself. # return$::test_configuration } else { # # NOTE: Normally, we will never hit this case because the value of the # test configuration variable is always set by the test suite # itself; however, it can be overridden using the unset command ................................................................................ # NOTE: No path is available, return an empty string. This point # should not be reached. # return "" } } proc joinBuildDirectory { path native year platform configuration } { # # NOTE: Figure out and then return the fully qualified path to the build # directory based on all the arguments provided by our caller. # if {$native} then { return [file join$path bin $year$platform $configuration] } else { ................................................................................ # the latest version of MSBuild available and the "test_year" may # need to be adjusted accordingly to actually run the test suite. # Refer to the comments in [getBuildYear] for more information on # how to set this variable. # set native [hasRuntimeOption native] return [joinBuildDirectory [getBuildBaseDirectory]$native \ [getBuildYear] [getBuildPlatform $native] [getBuildConfiguration]] } } proc getBuildFileName { fileName } { # # NOTE: Returns the specified file name as if it were located in the ................................................................................ foreach year [getBuildYears] { foreach configuration [getBuildConfigurations] { tputs$channel [appendArgs \ "---- checking for System.Data.SQLite build \"" [expr \ {$native ? "native/" : ""}]$year / $configuration "\"... "] set fileName [file nativename [file join [joinBuildDirectory \ [getBuildBaseDirectory]$native $year [getBuildPlatform \$native] $configuration] System.Data.SQLite.dll]] if {[file exists$fileName]} then { tputs $channel yes\n } else { tputs$channel no\n } ................................................................................ {temporary true} {varName db} } { # # NOTE: First, see if our caller has requested an in-memory database. # set isMemory [isMemoryDb $fileName] # # NOTE: For now, all test databases used by the test suite are placed into # the temporary directory. Each database used by a test should be # cleaned up by that test using the "cleanupDb" procedure, below. # if {!$isMemory && $qualify} then { set fileName [file join [getDatabaseDirectory] [file tail$fileName]] } # # NOTE: By default, delete any pre-existing database with the same file ................................................................................ set flags [combineFlags $flags$::connection_flags] tputs $::test_channel [appendArgs \ "---- combined connection flags are: "$flags \n] } # # NOTE: If our caller specified a SQLiteConnectionFlags, add the necessary # portion of the connection string now. # if {[string length $flags] > 0} then { append connection {;Flags=${flags}} } # # NOTE: If our caller specified an extra payload to the connection string, # append it now. # if {[string length $extra] > 0} then { append connection \;$extra } # # NOTE: Open the database connection now, placing the opaque handle value ................................................................................ # return $db } proc getDbConnection { {varName db} } { # # NOTE: Refer to the specified variable (e.g. "db") in the context of our # caller. The handle to the database previously opened by [setupDb] # should be stored there. # upvar 1$varName db # # NOTE: This returns the ADO.NET IDbConnection object instance for the # specified databse handle. Since getting this object relies upon # Eagle internals, great care should be taken to avoid disposing of ................................................................................ $db "\", error: " \n\t$result \n] } } } proc freeDbConnection { {varName connection} } { # # NOTE: Refer to the specified variable (e.g. "connection") in the context # of our caller. The opaque object handle for an ADO.NET connection # previously returned by [getDbConnection] should be stored there. # upvar 1 $varName connection # # NOTE: Attempt to remove the opaque object handle from the interpreter # now. This [object dispose] call will not actually dispose of the # underlying object because the +NoDispose flag was set on it during # creation of the opaque object handle. # if {[info exists connection] && \ [catch {object dispose$connection} error]} then { # # NOTE: We somehow failed to remove the handle, report why. # tputs $::test_channel [appendArgs \ ................................................................................ # if {$collect} then { collectGarbage $::test_channel } # # NOTE: Refer to the specified variable (e.g. "db") in the context of our # caller. The handle to the database previously opened by [setupDb] # should be stored there. # upvar 1$varName db # # NOTE: Close the connection to the database now. This should allow us to # delete the underlying database file. # if {[info exists db] && [catch {sql close $db} error]} then { # # NOTE: We somehow failed to close the database, report why. # tputs$::test_channel [appendArgs \ "==== WARNING: failed to close database \"" $db "\", error: " \   | | | | | | | > | | | | | > | | | | | | | | | | > | | | | | |  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 ... 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 ... 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 ... 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 ... 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 .... 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 .... 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 .... 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 .... 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192   # return "" } } proc getBuildConfiguration {} { # # NOTE: See if the "configuration" setting has been overridden by the # user (e.g. on the command line). This helps control exactly # which set of binaries we are testing (i.e. those built in the # "Debug" or "Release" build configurations). To override this # value via the command line, enter a command similar to one of # the following (all on one line): # # EagleShell.exe -preInitialize "set test_configuration Debug" # -file .\path\to\all.eagle # # EagleShell.exe -preInitialize "set test_configuration Release" # -file .\path\to\all.eagle # ................................................................................ # EagleShell.exe -file .\path\to\all.eagle -preTest # "unset -nocomplain test_configuration" # if {[info exists ::test_configuration] && \ [string length$::test_configuration] > 0} then { # # NOTE: Use the specified test configuration. The default value used # for this variable is typically "Release", as set by the test # suite itself. # return $::test_configuration } else { # # NOTE: Normally, we will never hit this case because the value of the # test configuration variable is always set by the test suite # itself; however, it can be overridden using the unset command ................................................................................ # NOTE: No path is available, return an empty string. This point # should not be reached. # return "" } } proc joinBuildDirectory { native path year platform configuration } { # # NOTE: Figure out and then return the fully qualified path to the build # directory based on all the arguments provided by our caller. # if {$native} then { return [file join $path bin$year $platform$configuration] } else { ................................................................................ # the latest version of MSBuild available and the "test_year" may # need to be adjusted accordingly to actually run the test suite. # Refer to the comments in [getBuildYear] for more information on # how to set this variable. # set native [hasRuntimeOption native] return [joinBuildDirectory $native [getBuildBaseDirectory] \ [getBuildYear] [getBuildPlatform$native] [getBuildConfiguration]] } } proc getBuildFileName { fileName } { # # NOTE: Returns the specified file name as if it were located in the ................................................................................ foreach year [getBuildYears] { foreach configuration [getBuildConfigurations] { tputs $channel [appendArgs \ "---- checking for System.Data.SQLite build \"" [expr \ {$native ? "native/" : ""}] $year /$configuration "\"... "] set fileName [file nativename [file join [joinBuildDirectory \ $native [getBuildBaseDirectory]$year [getBuildPlatform \ $native]$configuration] System.Data.SQLite.dll]] if {[file exists $fileName]} then { tputs$channel yes\n } else { tputs $channel no\n } ................................................................................ {temporary true} {varName db} } { # # NOTE: First, see if our caller has requested an in-memory database. # set isMemory [isMemoryDb$fileName] # # NOTE: For now, all test databases used by the test suite are placed # into the database directory. Each database and related files # used by a test should be cleaned up by that test using the # "cleanupDb" procedure, below. # if {!$isMemory &&$qualify} then { set fileName [file join [getDatabaseDirectory] [file tail $fileName]] } # # NOTE: By default, delete any pre-existing database with the same file ................................................................................ set flags [combineFlags$flags $::connection_flags] tputs$::test_channel [appendArgs \ "---- combined connection flags are: " $flags \n] } # # NOTE: If our caller specified some SQLiteConnectionFlags, add the # necessary portion of the connection string now. # if {[string length$flags] > 0} then { append connection {;Flags=${flags}} } # # NOTE: If our caller specified an extra payload to the connection # string, append it now. # if {[string length$extra] > 0} then { append connection \; $extra } # # NOTE: Open the database connection now, placing the opaque handle value ................................................................................ # return$db } proc getDbConnection { {varName db} } { # # NOTE: Refer to the specified variable (e.g. "db") in the context of our # caller. The handle to the database previously opened via the # [setupDb] procedure should be stored there. # upvar 1 $varName db # # NOTE: This returns the ADO.NET IDbConnection object instance for the # specified databse handle. Since getting this object relies upon # Eagle internals, great care should be taken to avoid disposing of ................................................................................$db "\", error: " \n\t $result \n] } } } proc freeDbConnection { {varName connection} } { # # NOTE: Refer to the specified variable (e.g. "connection") in the # context of our caller. The opaque object handle for an ADO.NET # connection previously returned by [getDbConnection] should be # stored there. # upvar 1$varName connection # # NOTE: Attempt to remove the opaque object handle from the interpreter # now. This [object dispose] call will not actually dispose of the # underlying object because the +NoDispose flag was set on it # during creation of the opaque object handle. # if {[info exists connection] && \ [catch {object dispose $connection} error]} then { # # NOTE: We somehow failed to remove the handle, report why. # tputs$::test_channel [appendArgs \ ................................................................................ # if {$collect} then { collectGarbage$::test_channel } # # NOTE: Refer to the specified variable (e.g. "db") in the context of our # caller. The handle to the database previously opened via the # [setupDb] procedure should be stored there. # upvar 1 $varName db # # NOTE: Close the connection to the database now. This should allow us # to delete the underlying database file. # if {[info exists db] && [catch {sql close$db} error]} then { # # NOTE: We somehow failed to close the database, report why. # tputs $::test_channel [appendArgs \ "==== WARNING: failed to close database \""$db "\", error: " \