0000: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0010: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0020: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0030: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0040: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0d ###############.
0050: 0a 23 0d 0a 23 20 63 6f 6d 6d 6f 6e 2e 65 61 67 .#..# common.eag
0060: 6c 65 20 2d 2d 0d 0a 23 0d 0a 23 20 57 72 69 74 le --..#..# Writ
0070: 74 65 6e 20 62 79 20 4a 6f 65 20 4d 69 73 74 61 ten by Joe Mista
0080: 63 68 6b 69 6e 2e 0d 0a 23 20 52 65 6c 65 61 73 chkin...# Releas
0090: 65 64 20 74 6f 20 74 68 65 20 70 75 62 6c 69 63 ed to the public
00a0: 20 64 6f 6d 61 69 6e 2c 20 75 73 65 20 61 74 20 domain, use at
00b0: 79 6f 75 72 20 6f 77 6e 20 72 69 73 6b 21 0d 0a your own risk!..
00c0: 23 0d 0a 23 23 23 23 23 23 23 23 23 23 23 23 23 #..#############
00d0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
00e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
00f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0100: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0110: 23 23 0d 0a 0d 0a 23 0d 0a 23 20 4e 4f 54 45 3a ##....#..# NOTE:
0120: 20 55 73 65 20 6f 75 72 20 6f 77 6e 20 6e 61 6d Use our own nam
0130: 65 73 70 61 63 65 20 68 65 72 65 20 62 65 63 61 espace here beca
0140: 75 73 65 20 65 76 65 6e 20 74 68 6f 75 67 68 20 use even though
0150: 77 65 20 64 6f 20 6e 6f 74 20 64 69 72 65 63 74 we do not direct
0160: 6c 79 0d 0a 23 20 20 20 20 20 20 20 73 75 70 70 ly..# supp
0170: 6f 72 74 20 6e 61 6d 65 73 70 61 63 65 73 20 6f ort namespaces o
0180: 75 72 73 65 6c 76 65 73 2c 20 77 65 20 64 6f 20 urselves, we do
0190: 6e 6f 74 20 77 61 6e 74 20 74 6f 20 70 6f 6c 6c not want to poll
01a0: 75 74 65 20 74 68 65 20 67 6c 6f 62 61 6c 0d 0a ute the global..
01b0: 23 20 20 20 20 20 20 20 6e 61 6d 65 73 70 61 63 # namespac
01c0: 65 20 69 66 20 74 68 69 73 20 73 63 72 69 70 74 e if this script
01d0: 20 61 63 74 75 61 6c 6c 79 20 65 6e 64 73 20 75 actually ends u
01e0: 70 20 62 65 69 6e 67 20 65 76 61 6c 75 61 74 65 p being evaluate
01f0: 64 20 69 6e 20 54 63 6c 2e 0d 0a 23 0d 0a 6e 61 d in Tcl...#..na
0200: 6d 65 73 70 61 63 65 20 65 76 61 6c 20 3a 3a 45 mespace eval ::E
0210: 61 67 6c 65 20 7b 0d 0a 20 20 69 66 20 7b 5b 69 agle {.. if {[i
0220: 73 45 61 67 6c 65 5d 7d 20 74 68 65 6e 20 7b 0d sEagle]} then {.
0230: 0a 20 20 20 20 23 23 23 23 23 23 23 23 23 23 23 . ###########
0240: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0250: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0260: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0270: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0280: 0d 0a 20 20 20 20 23 23 23 23 23 23 23 23 23 23 .. ##########
0290: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
02a0: 23 23 20 42 45 47 49 4e 20 45 61 67 6c 65 20 4f ## BEGIN Eagle O
02b0: 4e 4c 59 20 23 23 23 23 23 23 23 23 23 23 23 23 NLY ############
02c0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
02d0: 23 0d 0a 20 20 20 20 23 23 23 23 23 23 23 23 23 #.. #########
02e0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
02f0: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0300: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0310: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
0320: 23 23 0d 0a 0d 0a 20 20 20 20 70 72 6f 63 20 67 ##.... proc g
0330: 65 74 42 75 69 6c 64 59 65 61 72 20 7b 7d 20 7b etBuildYear {} {
0340: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
0350: 20 23 20 4e 4f 54 45 3a 20 53 65 65 20 69 66 20 # NOTE: See if
0360: 74 68 65 20 22 79 65 61 72 22 20 73 65 74 74 69 the "year" setti
0370: 6e 67 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 ng has been over
0380: 72 69 64 64 65 6e 20 62 79 20 74 68 65 20 75 73 ridden by the us
0390: 65 72 20 28 65 2e 67 2e 0d 0a 20 20 20 20 20 20 er (e.g...
03a0: 23 20 20 20 20 20 20 20 6f 6e 20 74 68 65 20 63 # on the c
03b0: 6f 6d 6d 61 6e 64 20 6c 69 6e 65 29 2e 20 20 54 ommand line). T
03c0: 68 69 73 20 68 65 6c 70 73 20 63 6f 6e 74 72 6f his helps contro
03d0: 6c 20 65 78 61 63 74 6c 79 20 77 68 69 63 68 20 l exactly which
03e0: 73 65 74 20 6f 66 0d 0a 20 20 20 20 20 20 23 20 set of.. #
03f0: 20 20 20 20 20 20 62 69 6e 61 72 69 65 73 20 77 binaries w
0400: 65 20 61 72 65 20 74 65 73 74 69 6e 67 2c 20 74 e are testing, t
0410: 68 6f 73 65 20 70 72 6f 64 75 63 65 64 20 75 73 hose produced us
0420: 69 6e 67 20 74 68 65 20 56 69 73 75 61 6c 20 53 ing the Visual S
0430: 74 75 64 69 6f 0d 0a 20 20 20 20 20 20 23 20 20 tudio.. #
0440: 20 20 20 20 20 32 30 30 35 2c 20 32 30 30 38 2c 2005, 2008,
0450: 20 32 30 31 30 2c 20 32 30 31 32 2c 20 6f 72 20 2010, 2012, or
0460: 32 30 31 33 20 62 75 69 6c 64 20 73 79 73 74 65 2013 build syste
0470: 6d 73 2e 20 20 54 6f 20 6f 76 65 72 72 69 64 65 ms. To override
0480: 20 74 68 69 73 0d 0a 20 20 20 20 20 20 23 20 20 this.. #
0490: 20 20 20 20 20 76 61 6c 75 65 20 76 69 61 20 74 value via t
04a0: 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 2c he command line,
04b0: 20 65 6e 74 65 72 20 61 20 63 6f 6d 6d 61 6e 64 enter a command
04c0: 20 73 69 6d 69 6c 61 72 20 74 6f 20 6f 6e 65 20 similar to one
04d0: 6f 66 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 of.. #
04e0: 20 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 the following
04f0: 28 61 6c 6c 20 6f 6e 20 6f 6e 65 20 6c 69 6e 65 (all on one line
0500: 29 3a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 ):.. #..
0510: 20 20 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 # Eagle
0520: 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 49 6e Shell.exe -anyIn
0530: 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 74 65 itialize "set te
0540: 73 74 5f 79 65 61 72 20 32 30 30 35 22 0d 0a 20 st_year 2005"..
0550: 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 2d # -
0560: 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 file .\path\to\a
0570: 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 20 20 20 ll.eagle..
0580: 23 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 #.. #
0590: 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 20 EagleShell.exe
05a0: 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a 65 20 22 -anyInitialize "
05b0: 73 65 74 20 74 65 73 74 5f 79 65 61 72 20 32 30 set test_year 20
05c0: 30 38 22 0d 0a 20 20 20 20 20 20 23 20 20 20 20 08".. #
05d0: 20 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 -file .\pat
05e0: 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a h\to\all.eagle..
05f0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
0600: 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c EagleShel
0610: 6c 2e 65 78 65 20 2d 61 6e 79 49 6e 69 74 69 61 l.exe -anyInitia
0620: 6c 69 7a 65 20 22 73 65 74 20 74 65 73 74 5f 79 lize "set test_y
0630: 65 61 72 20 32 30 31 30 22 0d 0a 20 20 20 20 20 ear 2010"..
0640: 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 6c 65 # -file
0650: 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 .\path\to\all.e
0660: 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a 20 agle.. #..
0670: 20 20 20 20 20 23 20 20 20 20 20 20 20 45 61 67 # Eag
0680: 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 leShell.exe -any
0690: 49 6e 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 Initialize "set
06a0: 74 65 73 74 5f 79 65 61 72 20 32 30 31 32 22 0d test_year 2012".
06b0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 . #
06c0: 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 6f -file .\path\to
06d0: 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 20 \all.eagle..
06e0: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 20 #.. #
06f0: 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 EagleShell.ex
0700: 65 20 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a 65 e -anyInitialize
0710: 20 22 73 65 74 20 74 65 73 74 5f 79 65 61 72 20 "set test_year
0720: 32 30 31 33 22 0d 0a 20 20 20 20 20 20 23 20 20 2013".. #
0730: 20 20 20 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 -file .\p
0740: 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 ath\to\all.eagle
0750: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
0760: 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 # EagleSh
0770: 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 49 6e 69 74 ell.exe -anyInit
0780: 69 61 6c 69 7a 65 20 22 75 6e 73 65 74 20 2d 6e ialize "unset -n
0790: 6f 63 6f 6d 70 6c 61 69 6e 20 74 65 73 74 5f 79 ocomplain test_y
07a0: 65 61 72 22 0d 0a 20 20 20 20 20 20 23 20 20 20 ear".. #
07b0: 20 20 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 -file .\pa
07c0: 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d th\to\all.eagle.
07d0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
07e0: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
07f0: 20 3a 3a 74 65 73 74 5f 79 65 61 72 5d 20 26 26 ::test_year] &&
0800: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
0810: 24 3a 3a 74 65 73 74 5f 79 65 61 72 5d 20 3e 20 $::test_year] >
0820: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
0830: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
0840: 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 NOTE: Use the sp
0850: 65 63 69 66 69 65 64 20 74 65 73 74 20 79 65 61 ecified test yea
0860: 72 2e 20 20 49 66 20 74 68 69 73 20 76 61 72 69 r. If this vari
0870: 61 62 6c 65 20 69 73 20 6e 6f 74 20 73 65 74 2c able is not set,
0880: 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 the.. #
0890: 20 20 20 20 20 20 64 65 66 61 75 6c 74 20 76 61 default va
08a0: 6c 75 65 20 77 69 6c 6c 20 62 65 20 62 61 73 65 lue will be base
08b0: 64 20 6f 6e 20 77 68 65 74 68 65 72 20 6f 72 20 d on whether or
08c0: 6e 6f 74 20 45 61 67 6c 65 20 68 61 73 20 62 65 not Eagle has be
08d0: 65 6e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 en.. #
08e0: 20 20 20 20 63 6f 6d 70 69 6c 65 64 20 61 67 61 compiled aga
08f0: 69 6e 73 74 20 74 68 65 20 43 4c 52 20 76 32 2e inst the CLR v2.
0900: 30 20 6f 72 20 43 4c 52 20 76 34 2e 30 2e 0d 0a 0 or CLR v4.0...
0910: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
0920: 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 74 65 73 return $::tes
0930: 74 5f 79 65 61 72 0d 0a 20 20 20 20 20 20 7d 20 t_year.. }
0940: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
0950: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
0960: 45 3a 20 49 66 20 45 61 67 6c 65 20 68 61 73 20 E: If Eagle has
0970: 62 65 65 6e 20 63 6f 6d 70 69 6c 65 64 20 61 67 been compiled ag
0980: 61 69 6e 73 74 20 74 68 65 20 43 4c 52 20 76 34 ainst the CLR v4
0990: 2e 30 2c 20 75 73 65 20 22 32 30 31 30 22 20 62 .0, use "2010" b
09a0: 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 y.. #
09b0: 20 20 20 64 65 66 61 75 6c 74 20 28 77 65 20 63 default (we c
09c0: 6f 75 6c 64 20 75 73 65 20 22 32 30 31 32 22 20 ould use "2012"
09d0: 6f 72 20 22 32 30 31 33 22 20 69 6e 20 74 68 61 or "2013" in tha
09e0: 74 20 63 61 73 65 20 61 73 20 77 65 6c 6c 29 20 t case as well)
09f0: 61 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 as.. #
0a00: 20 20 20 20 74 68 65 20 74 65 73 74 20 79 65 61 the test yea
0a10: 72 3b 20 6f 74 68 65 72 77 69 73 65 2c 20 75 73 r; otherwise, us
0a20: 65 20 22 32 30 30 38 22 20 62 79 20 64 65 66 61 e "2008" by defa
0a30: 75 6c 74 20 28 77 65 20 63 6f 75 6c 64 20 75 73 ult (we could us
0a40: 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
0a50: 20 20 20 22 32 30 30 35 22 20 69 6e 20 74 68 61 "2005" in tha
0a60: 74 20 63 61 73 65 20 61 73 20 77 65 6c 6c 29 2e t case as well).
0a70: 20 20 49 66 20 61 6e 6f 74 68 65 72 20 6d 61 6a If another maj
0a80: 6f 72 20 5b 69 6e 63 6f 6d 70 61 74 69 62 6c 65 or [incompatible
0a90: 5d 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 ].. #
0aa0: 20 20 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 version of th
0ab0: 65 20 43 4c 52 20 69 73 20 72 65 6c 65 61 73 65 e CLR is release
0ac0: 64 2c 20 74 68 69 73 20 63 68 65 63 6b 20 77 69 d, this check wi
0ad0: 6c 6c 20 68 61 76 65 20 74 6f 20 62 65 0d 0a 20 ll have to be..
0ae0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 # c
0af0: 68 61 6e 67 65 64 2e 20 20 54 68 65 20 64 65 66 hanged. The def
0b00: 61 75 6c 74 20 74 65 73 74 20 79 65 61 72 20 74 ault test year t
0b10: 6f 20 75 73 65 20 66 6f 72 20 61 20 70 61 72 74 o use for a part
0b20: 69 63 75 6c 61 72 20 43 4c 52 0d 0a 20 20 20 20 icular CLR..
0b30: 20 20 20 20 23 20 20 20 20 20 20 20 76 65 72 73 # vers
0b40: 69 6f 6e 20 6d 61 79 20 62 65 20 6f 76 65 72 72 ion may be overr
0b50: 69 64 64 65 6e 20 62 79 20 73 65 74 74 69 6e 67 idden by setting
0b60: 20 74 68 65 20 67 6c 6f 62 61 6c 20 76 61 72 69 the global vari
0b70: 61 62 6c 65 0d 0a 20 20 20 20 20 20 20 20 23 20 able.. #
0b80: 20 20 20 20 20 20 22 74 65 73 74 5f 79 65 61 72 "test_year
0b90: 5f 63 6c 72 5f 76 24 58 22 2c 20 77 68 65 72 65 _clr_v$X", where
0ba0: 20 22 24 58 22 20 6d 61 79 20 5b 63 75 72 72 65 "$X" may [curre
0bb0: 6e 74 6c 79 5d 20 62 65 20 65 69 74 68 65 72 20 ntly] be either
0bc0: 22 32 22 0d 0a 20 20 20 20 20 20 20 20 23 20 20 "2".. #
0bd0: 20 20 20 20 20 6f 72 20 22 34 22 2e 0d 0a 20 20 or "4"...
0be0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
0bf0: 20 69 66 20 7b 5b 68 61 76 65 43 6f 6e 73 74 72 if {[haveConstr
0c00: 61 69 6e 74 20 69 6d 61 67 65 52 75 6e 74 69 6d aint imageRuntim
0c10: 65 34 30 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 e40]} then {..
0c20: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 if {[inf
0c30: 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 73 74 5f o exists ::test_
0c40: 79 65 61 72 5f 63 6c 72 5f 76 34 5d 20 26 26 20 year_clr_v4] &&
0c50: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
0c60: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
0c70: 24 3a 3a 74 65 73 74 5f 79 65 61 72 5f 63 6c 72 $::test_year_clr
0c80: 5f 76 34 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b _v4] > 0} then {
0c90: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d .. #.
0ca0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e . # N
0cb0: 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 OTE: Use the spe
0cc0: 63 69 66 69 65 64 20 74 65 73 74 20 79 65 61 72 cified test year
0cd0: 20 66 6f 72 20 74 68 65 20 43 4c 52 20 76 34 2e for the CLR v4.
0ce0: 30 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 0...
0cf0: 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 #.. r
0d00: 65 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f 79 65 eturn $::test_ye
0d10: 61 72 5f 63 6c 72 5f 76 34 0d 0a 20 20 20 20 20 ar_clr_v4..
0d20: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
0d30: 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
0d40: 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
0d50: 3a 20 55 73 65 20 74 68 65 20 64 65 66 61 75 6c : Use the defaul
0d60: 74 20 74 65 73 74 20 79 65 61 72 20 66 6f 72 20 t test year for
0d70: 74 68 65 20 43 4c 52 20 76 34 2e 30 2e 0d 0a 20 the CLR v4.0...
0d80: 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
0d90: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
0da0: 20 32 30 31 30 3b 20 23 20 54 4f 44 4f 3a 20 47 2010; # TODO: G
0db0: 6f 6f 64 20 22 66 61 6c 6c 62 61 63 6b 22 20 64 ood "fallback" d
0dc0: 65 66 61 75 6c 74 3f 0d 0a 20 20 20 20 20 20 20 efault?..
0dd0: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 }.. }
0de0: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
0df0: 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
0e00: 74 73 20 3a 3a 74 65 73 74 5f 79 65 61 72 5f 63 ts ::test_year_c
0e10: 6c 72 5f 76 32 5d 20 26 26 20 5c 0d 0a 20 20 20 lr_v2] && \..
0e20: 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 [stri
0e30: 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 ng length $::tes
0e40: 74 5f 79 65 61 72 5f 63 6c 72 5f 76 32 5d 20 3e t_year_clr_v2] >
0e50: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
0e60: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
0e70: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 # NOTE: U
0e80: 73 65 20 74 68 65 20 73 70 65 63 69 66 69 65 64 se the specified
0e90: 20 74 65 73 74 20 79 65 61 72 20 66 6f 72 20 74 test year for t
0ea0: 68 65 20 43 4c 52 20 76 32 2e 30 2e 0d 0a 20 20 he CLR v2.0...
0eb0: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
0ec0: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
0ed0: 24 3a 3a 74 65 73 74 5f 79 65 61 72 5f 63 6c 72 $::test_year_clr
0ee0: 5f 76 32 0d 0a 20 20 20 20 20 20 20 20 20 20 7d _v2.. }
0ef0: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
0f00: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
0f10: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
0f20: 74 68 65 20 64 65 66 61 75 6c 74 20 74 65 73 74 the default test
0f30: 20 79 65 61 72 20 66 6f 72 20 74 68 65 20 43 4c year for the CL
0f40: 52 20 76 32 2e 30 2e 0d 0a 20 20 20 20 20 20 20 R v2.0...
0f50: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
0f60: 20 20 20 20 72 65 74 75 72 6e 20 32 30 30 38 3b return 2008;
0f70: 20 23 20 54 4f 44 4f 3a 20 47 6f 6f 64 20 22 66 # TODO: Good "f
0f80: 61 6c 6c 62 61 63 6b 22 20 64 65 66 61 75 6c 74 allback" default
0f90: 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ?.. }..
0fa0: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
0fb0: 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
0fc0: 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 59 proc getBuildY
0fd0: 65 61 72 73 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 ears {} {..
0fe0: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
0ff0: 3a 20 53 65 65 20 69 66 20 74 68 65 20 6c 69 73 : See if the lis
1000: 74 20 6f 66 20 74 65 73 74 20 79 65 61 72 73 20 t of test years
1010: 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 has been overrid
1020: 64 65 6e 20 62 79 20 74 68 65 20 75 73 65 72 0d den by the user.
1030: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 28 . # (
1040: 65 2e 67 2e 20 6f 6e 20 74 68 65 20 63 6f 6d 6d e.g. on the comm
1050: 61 6e 64 20 6c 69 6e 65 29 2e 0d 0a 20 20 20 20 and line)...
1060: 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
1070: 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 info exists ::te
1080: 73 74 5f 79 65 61 72 73 5d 20 26 26 20 5b 6c 6c st_years] && [ll
1090: 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 79 65 ength $::test_ye
10a0: 61 72 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ars] > 0} then {
10b0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
10c0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 # NOTE: Use
10d0: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 6c the specified l
10e0: 69 73 74 20 6f 66 20 74 65 73 74 20 79 65 61 72 ist of test year
10f0: 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 s... #..
1100: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a return $:
1110: 3a 74 65 73 74 5f 79 65 61 72 73 0d 0a 20 20 20 :test_years..
1120: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
1130: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1140: 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 # NOTE: Use the
1150: 64 65 66 61 75 6c 74 20 6c 69 73 74 20 6f 66 20 default list of
1160: 74 65 73 74 20 79 65 61 72 73 20 28 69 2e 65 2e test years (i.e.
1170: 20 61 6c 6c 29 2e 0d 0a 20 20 20 20 20 20 20 20 all)...
1180: 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 #.. retur
1190: 6e 20 5b 6c 69 73 74 20 32 30 30 35 20 32 30 30 n [list 2005 200
11a0: 38 20 32 30 31 30 20 32 30 31 32 20 32 30 31 33 8 2010 2012 2013
11b0: 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 ].. }..
11c0: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 }..... proc g
11d0: 65 74 42 75 69 6c 64 4e 65 74 46 78 20 7b 7d 20 etBuildNetFx {}
11e0: 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
11f0: 20 20 23 20 4e 4f 54 45 3a 20 53 65 65 20 69 66 # NOTE: See if
1200: 20 74 68 65 20 74 65 73 74 20 2e 4e 45 54 20 46 the test .NET F
1210: 72 61 6d 65 77 6f 72 6b 20 73 65 74 74 69 6e 67 ramework setting
1220: 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 has been overri
1230: 64 64 65 6e 20 62 79 0d 0a 20 20 20 20 20 20 23 dden by.. #
1240: 20 20 20 20 20 20 20 74 68 65 20 75 73 65 72 20 the user
1250: 28 65 2e 67 2e 20 6f 6e 20 74 68 65 20 63 6f 6d (e.g. on the com
1260: 6d 61 6e 64 20 6c 69 6e 65 29 2e 0d 0a 20 20 20 mand line)...
1270: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
1280: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
1290: 65 73 74 5f 6e 65 74 5f 66 78 5d 20 26 26 20 5c est_net_fx] && \
12a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 .. [str
12b0: 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 65 ing length $::te
12c0: 73 74 5f 6e 65 74 5f 66 78 5d 20 3e 20 30 7d 20 st_net_fx] > 0}
12d0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
12e0: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
12f0: 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 69 E: Use the speci
1300: 66 69 65 64 20 74 65 73 74 20 2e 4e 45 54 20 46 fied test .NET F
1310: 72 61 6d 65 77 6f 72 6b 2e 0d 0a 20 20 20 20 20 ramework...
1320: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 #.. re
1330: 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f 6e 65 74 turn $::test_net
1340: 5f 66 78 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 _fx.. } els
1350: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 e {.. set
1360: 20 79 65 61 72 20 5b 67 65 74 42 75 69 6c 64 59 year [getBuildY
1370: 65 61 72 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ear]....
1380: 73 77 69 74 63 68 20 2d 65 78 61 63 74 20 2d 2d switch -exact --
1390: 20 24 79 65 61 72 20 7b 0d 0a 20 20 20 20 20 20 $year {..
13a0: 20 20 20 20 32 30 30 35 20 7b 0d 0a 20 20 20 20 2005 {..
13b0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e return n
13c0: 65 74 46 78 32 30 0d 0a 20 20 20 20 20 20 20 20 etFx20..
13d0: 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 32 }.. 2
13e0: 30 30 38 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 008 {..
13f0: 20 20 20 72 65 74 75 72 6e 20 6e 65 74 46 78 33 return netFx3
1400: 35 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 5.. }..
1410: 20 20 20 20 20 20 20 20 20 20 32 30 31 30 20 7b 2010 {
1420: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
1430: 74 75 72 6e 20 6e 65 74 46 78 34 30 0d 0a 20 20 turn netFx40..
1440: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1450: 20 20 20 20 20 32 30 31 32 20 7b 0d 0a 20 20 20 2012 {..
1460: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
1470: 6e 65 74 46 78 34 35 0d 0a 20 20 20 20 20 20 20 netFx45..
1480: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
1490: 32 30 31 33 20 7b 0d 0a 20 20 20 20 20 20 20 20 2013 {..
14a0: 20 20 20 20 72 65 74 75 72 6e 20 6e 65 74 46 78 return netFx
14b0: 34 35 31 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 451.. }
14c0: 0d 0a 20 20 20 20 20 20 20 20 20 20 64 65 66 61 .. defa
14d0: 75 6c 74 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 ult {..
14e0: 20 20 20 72 65 74 75 72 6e 20 6e 65 74 46 78 33 return netFx3
14f0: 35 3b 20 23 20 54 4f 44 4f 3a 20 47 6f 6f 64 20 5; # TODO: Good
1500: 22 66 61 6c 6c 62 61 63 6b 22 20 64 65 66 61 75 "fallback" defau
1510: 6c 74 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 7d lt?.. }
1520: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
1530: 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
1540: 20 20 20 20 23 0d 0a 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1550: 45 3a 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 E: This procedur
1560: 65 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 e should return
1570: 6e 6f 6e 2d 7a 65 72 6f 20 69 66 20 74 68 65 20 non-zero if the
1580: 63 6f 6e 66 69 67 75 72 65 64 20 74 65 73 74 0d configured test.
1590: 0a 20 20 20 20 23 20 20 20 20 20 20 20 70 6c 61 . # pla
15a0: 74 66 6f 72 6d 20 69 73 20 6d 6f 73 74 20 6c 69 tform is most li
15b0: 6b 65 6c 79 20 74 68 65 20 64 65 66 61 75 6c 74 kely the default
15c0: 20 66 6f 72 20 74 68 69 73 20 6d 61 63 68 69 6e for this machin
15d0: 65 2e 0d 0a 20 20 20 20 23 0d 0a 20 20 20 20 70 e... #.. p
15e0: 72 6f 63 20 69 73 44 65 66 61 75 6c 74 42 75 69 roc isDefaultBui
15f0: 6c 64 50 6c 61 74 66 6f 72 6d 20 7b 20 7b 76 65 ldPlatform { {ve
1600: 72 62 6f 73 65 20 66 61 6c 73 65 7d 20 7d 20 7b rbose false} } {
1610: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
1620: 20 23 20 4e 4f 54 45 3a 20 52 75 6e 6e 69 6e 67 # NOTE: Running
1630: 20 6f 6e 20 57 6f 57 36 34 20 69 73 20 6e 65 76 on WoW64 is nev
1640: 65 72 20 74 68 65 20 64 65 66 61 75 6c 74 20 70 er the default p
1650: 6c 61 74 66 6f 72 6d 2e 0d 0a 20 20 20 20 20 20 latform...
1660: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 73 #.. if {[is
1670: 52 75 6e 6e 69 6e 67 57 6f 57 36 34 5d 7d 20 74 RunningWoW64]} t
1680: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 hen {.. i
1690: 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 f {$verbose} the
16a0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 n {.. t
16b0: 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
16c0: 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 nnel \..
16d0: 20 20 20 20 20 20 22 2d 2d 2d 2d 20 64 65 74 65 "---- dete
16e0: 63 74 65 64 20 6e 6f 6e 2d 64 65 66 61 75 6c 74 cted non-default
16f0: 20 70 6c 61 74 66 6f 72 6d 20 28 57 6f 57 36 34 platform (WoW64
1700: 29 5c 6e 22 0d 0a 20 20 20 20 20 20 20 20 7d 0d )\n".. }.
1710: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
1720: 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 7d 0d 0a false.. }..
1730: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
1740: 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 68 61 # NOTE: This ha
1750: 73 20 61 20 67 6f 6f 64 20 63 68 61 6e 63 65 20 s a good chance
1760: 6f 66 20 62 65 69 6e 67 20 74 68 65 20 64 65 66 of being the def
1770: 61 75 6c 74 20 70 6c 61 74 66 6f 72 6d 2e 0d 0a ault platform...
1780: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
1790: 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 f {$verbose} the
17a0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 n {.. tpu
17b0: 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
17c0: 65 6c 20 22 2d 2d 2d 2d 20 64 65 74 65 63 74 65 el "---- detecte
17d0: 64 20 64 65 66 61 75 6c 74 20 70 6c 61 74 66 6f d default platfo
17e0: 72 6d 5c 6e 22 0d 0a 20 20 20 20 20 20 7d 0d 0a rm\n".. }..
17f0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
1800: 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 e.. }.....
1810: 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 50 6c proc getBuildPl
1820: 61 74 66 6f 72 6d 20 7b 20 6e 61 74 69 76 65 20 atform { native
1830: 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b } {.. if {[
1840: 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 info exists ::te
1850: 73 74 5f 70 6c 61 74 66 6f 72 6d 5d 20 26 26 20 st_platform] &&
1860: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 \.. [st
1870: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 ring length $::t
1880: 65 73 74 5f 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 est_platform] >
1890: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
18a0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
18b0: 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 NOTE: Use the sp
18c0: 65 63 69 66 69 65 64 20 74 65 73 74 20 70 6c 61 ecified test pla
18d0: 74 66 6f 72 6d 2e 20 20 49 66 20 74 68 69 73 20 tform. If this
18e0: 76 61 72 69 61 62 6c 65 20 69 73 20 6e 6f 74 20 variable is not
18f0: 73 65 74 2c 0d 0a 20 20 20 20 20 20 20 20 23 20 set,.. #
1900: 20 20 20 20 20 20 74 68 65 20 64 65 66 61 75 6c the defaul
1910: 74 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 65 20 t value will be
1920: 62 61 73 65 64 20 6f 6e 20 74 68 65 20 6d 61 63 based on the mac
1930: 68 69 6e 65 20 61 72 63 68 69 74 65 63 74 75 72 hine architectur
1940: 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 e... #..
1950: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 65 return [e
1960: 78 70 72 20 7b 24 6e 61 74 69 76 65 20 3f 20 24 xpr {$native ? $
1970: 3a 3a 74 65 73 74 5f 70 6c 61 74 66 6f 72 6d 20 ::test_platform
1980: 3a 20 22 22 7d 5d 0d 0a 20 20 20 20 20 20 7d 20 : ""}].. }
1990: 65 6c 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 elseif {[info ex
19a0: 69 73 74 73 20 3a 3a 74 65 73 74 5f 6d 61 63 68 ists ::test_mach
19b0: 69 6e 65 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 ine] && \..
19c0: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
19d0: 67 74 68 20 24 3a 3a 74 65 73 74 5f 6d 61 63 68 gth $::test_mach
19e0: 69 6e 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ine] > 0} then {
19f0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1a00: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 6f 72 # NOTE: For
1a10: 20 6e 61 74 69 76 65 20 62 75 69 6c 64 73 2c 20 native builds,
1a20: 72 65 74 75 72 6e 20 74 68 65 20 70 6c 61 74 66 return the platf
1a30: 6f 72 6d 20 6e 61 6d 65 20 63 6f 72 72 65 73 70 orm name corresp
1a40: 6f 6e 64 69 6e 67 20 74 6f 0d 0a 20 20 20 20 20 onding to..
1a50: 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 74 # the t
1a60: 65 73 74 20 6d 61 63 68 69 6e 65 20 61 72 63 68 est machine arch
1a70: 69 74 65 63 74 75 72 65 3b 20 6f 74 68 65 72 77 itecture; otherw
1a80: 69 73 65 2c 20 72 65 74 75 72 6e 20 61 6e 20 65 ise, return an e
1a90: 6d 70 74 79 0d 0a 20 20 20 20 20 20 20 20 23 20 mpty.. #
1aa0: 20 20 20 20 20 20 73 74 72 69 6e 67 2e 0d 0a 20 string...
1ab0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1ac0: 20 20 72 65 74 75 72 6e 20 5b 65 78 70 72 20 7b return [expr {
1ad0: 0d 0a 20 20 20 20 20 20 20 20 20 20 24 6e 61 74 .. $nat
1ae0: 69 76 65 20 3f 20 5b 6d 61 63 68 69 6e 65 54 6f ive ? [machineTo
1af0: 50 6c 61 74 66 6f 72 6d 20 24 3a 3a 74 65 73 74 Platform $::test
1b00: 5f 6d 61 63 68 69 6e 65 5d 20 3a 20 22 22 0d 0a _machine] : ""..
1b10: 20 20 20 20 20 20 20 20 7d 5d 0d 0a 20 20 20 20 }]..
1b20: 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 } elseif {[inf
1b30: 6f 20 65 78 69 73 74 73 20 3a 3a 74 63 6c 5f 70 o exists ::tcl_p
1b40: 6c 61 74 66 6f 72 6d 28 6d 61 63 68 69 6e 65 29 latform(machine)
1b50: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1b60: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
1b70: 4e 4f 54 45 3a 20 46 6f 72 20 6e 61 74 69 76 65 NOTE: For native
1b80: 20 62 75 69 6c 64 73 2c 20 72 65 74 75 72 6e 20 builds, return
1b90: 74 68 65 20 70 6c 61 74 66 6f 72 6d 20 6e 61 6d the platform nam
1ba0: 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 e corresponding
1bb0: 74 6f 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 to.. #
1bc0: 20 20 20 20 74 68 65 20 6d 61 63 68 69 6e 65 20 the machine
1bd0: 61 72 63 68 69 74 65 63 74 75 72 65 3b 20 6f 74 architecture; ot
1be0: 68 65 72 77 69 73 65 2c 20 72 65 74 75 72 6e 20 herwise, return
1bf0: 61 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2e an empty string.
1c00: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1c10: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 65 78 70 return [exp
1c20: 72 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 24 r {.. $
1c30: 6e 61 74 69 76 65 20 3f 20 5b 6d 61 63 68 69 6e native ? [machin
1c40: 65 54 6f 50 6c 61 74 66 6f 72 6d 20 24 3a 3a 74 eToPlatform $::t
1c50: 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 6d 61 63 68 cl_platform(mach
1c60: 69 6e 65 29 5d 20 3a 20 22 22 0d 0a 20 20 20 20 ine)] : ""..
1c70: 20 20 20 20 7d 5d 0d 0a 20 20 20 20 20 20 7d 20 }].. }
1c80: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
1c90: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1ca0: 45 3a 20 4e 6f 20 6d 61 63 68 69 6e 65 20 61 72 E: No machine ar
1cb0: 63 68 69 74 65 63 74 75 72 65 20 69 73 20 61 76 chitecture is av
1cc0: 61 69 6c 61 62 6c 65 2c 20 72 65 74 75 72 6e 20 ailable, return
1cd0: 61 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2e an empty string.
1ce0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
1cf0: 20 20 49 74 20 69 73 20 69 6d 70 6f 72 74 61 6e It is importan
1d00: 74 20 74 6f 20 72 65 74 75 72 6e 20 61 6e 20 65 t to return an e
1d10: 6d 70 74 79 20 73 74 72 69 6e 67 20 68 65 72 65 mpty string here
1d20: 20 62 65 63 61 75 73 65 20 74 68 65 0d 0a 20 20 because the..
1d30: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 # re
1d40: 73 75 6c 74 20 6f 66 20 74 68 69 73 20 70 72 6f sult of this pro
1d50: 63 65 64 75 72 65 20 6d 61 79 20 62 65 20 75 73 cedure may be us
1d60: 65 64 20 77 69 74 68 20 5b 66 69 6c 65 20 6a 6f ed with [file jo
1d70: 69 6e 5d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d in]... #.
1d80: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
1d90: 22 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 "".. }..
1da0: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
1db0: 67 65 74 42 75 69 6c 64 43 6f 6e 66 69 67 75 72 getBuildConfigur
1dc0: 61 74 69 6f 6e 20 7b 7d 20 7b 0d 0a 20 20 20 20 ation {} {..
1dd0: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1de0: 45 3a 20 53 65 65 20 69 66 20 74 68 65 20 22 63 E: See if the "c
1df0: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 22 20 73 65 onfiguration" se
1e00: 74 74 69 6e 67 20 68 61 73 20 62 65 65 6e 20 6f tting has been o
1e10: 76 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 65 verridden by the
1e20: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
1e30: 75 73 65 72 20 28 65 2e 67 2e 20 6f 6e 20 74 68 user (e.g. on th
1e40: 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 29 2e e command line).
1e50: 20 20 54 68 69 73 20 68 65 6c 70 73 20 63 6f 6e This helps con
1e60: 74 72 6f 6c 20 65 78 61 63 74 6c 79 0d 0a 20 20 trol exactly..
1e70: 20 20 20 20 23 20 20 20 20 20 20 20 77 68 69 63 # whic
1e80: 68 20 73 65 74 20 6f 66 20 62 69 6e 61 72 69 65 h set of binarie
1e90: 73 20 77 65 20 61 72 65 20 74 65 73 74 69 6e 67 s we are testing
1ea0: 20 28 69 2e 65 2e 20 74 68 6f 73 65 20 62 75 69 (i.e. those bui
1eb0: 6c 74 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 lt in the..
1ec0: 20 23 20 20 20 20 20 20 20 22 44 65 62 75 67 22 # "Debug"
1ed0: 20 6f 72 20 22 52 65 6c 65 61 73 65 22 20 62 75 or "Release" bu
1ee0: 69 6c 64 20 63 6f 6e 66 69 67 75 72 61 74 69 6f ild configuratio
1ef0: 6e 73 29 2e 20 20 54 6f 20 6f 76 65 72 72 69 64 ns). To overrid
1f00: 65 20 74 68 69 73 0d 0a 20 20 20 20 20 20 23 20 e this.. #
1f10: 20 20 20 20 20 20 76 61 6c 75 65 20 76 69 61 20 value via
1f20: 74 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 the command line
1f30: 2c 20 65 6e 74 65 72 20 61 20 63 6f 6d 6d 61 6e , enter a comman
1f40: 64 20 73 69 6d 69 6c 61 72 20 74 6f 20 6f 6e 65 d similar to one
1f50: 20 6f 66 0d 0a 20 20 20 20 20 20 23 20 20 20 20 of.. #
1f60: 20 20 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 the following
1f70: 20 28 61 6c 6c 20 6f 6e 20 6f 6e 65 20 6c 69 6e (all on one lin
1f80: 65 29 3a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 e):.. #..
1f90: 20 20 20 20 23 20 20 20 20 20 20 20 45 61 67 6c # Eagl
1fa0: 65 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 49 eShell.exe -anyI
1fb0: 6e 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 74 nitialize "set t
1fc0: 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f est_configuratio
1fd0: 6e 20 44 65 62 75 67 22 0d 0a 20 20 20 20 20 20 n Debug"..
1fe0: 23 20 20 20 20 20 20 20 20 20 2d 66 69 6c 65 20 # -file
1ff0: 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 .\path\to\all.ea
2000: 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 gle.. #..
2010: 20 20 20 20 23 20 20 20 20 20 20 20 45 61 67 6c # Eagl
2020: 65 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 49 eShell.exe -anyI
2030: 6e 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 74 nitialize "set t
2040: 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f est_configuratio
2050: 6e 20 52 65 6c 65 61 73 65 22 0d 0a 20 20 20 20 n Release"..
2060: 20 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 6c # -fil
2070: 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e e .\path\to\all.
2080: 65 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a eagle.. #..
2090: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 45 61 # Ea
20a0: 67 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d 66 69 gleShell.exe -fi
20b0: 6c 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c le .\path\to\all
20c0: 2e 65 61 67 6c 65 20 2d 70 72 65 54 65 73 74 0d .eagle -preTest.
20d0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 . #
20e0: 20 22 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c "unset -nocompl
20f0: 61 69 6e 20 74 65 73 74 5f 63 6f 6e 66 69 67 75 ain test_configu
2100: 72 61 74 69 6f 6e 22 0d 0a 20 20 20 20 20 20 23 ration".. #
2110: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 .. if {[inf
2120: 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 73 74 5f o exists ::test_
2130: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5d 20 26 configuration] &
2140: 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b & \.. [
2150: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a string length $:
2160: 3a 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 :test_configurat
2170: 69 6f 6e 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ion] > 0} then {
2180: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
2190: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 # NOTE: Use
21a0: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 74 the specified t
21b0: 65 73 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f est configuratio
21c0: 6e 2e 20 20 54 68 65 20 64 65 66 61 75 6c 74 20 n. The default
21d0: 76 61 6c 75 65 20 75 73 65 64 0d 0a 20 20 20 20 value used..
21e0: 20 20 20 20 23 20 20 20 20 20 20 20 66 6f 72 20 # for
21f0: 74 68 69 73 20 76 61 72 69 61 62 6c 65 20 69 73 this variable is
2200: 20 74 79 70 69 63 61 6c 6c 79 20 22 52 65 6c 65 typically "Rele
2210: 61 73 65 22 2c 20 61 73 20 73 65 74 20 62 79 20 ase", as set by
2220: 74 68 65 20 74 65 73 74 0d 0a 20 20 20 20 20 20 the test..
2230: 20 20 23 20 20 20 20 20 20 20 73 75 69 74 65 20 # suite
2240: 69 74 73 65 6c 66 2e 0d 0a 20 20 20 20 20 20 20 itself...
2250: 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 #.. retu
2260: 72 6e 20 24 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 rn $::test_confi
2270: 67 75 72 61 74 69 6f 6e 0d 0a 20 20 20 20 20 20 guration..
2280: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
2290: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
22a0: 4f 54 45 3a 20 4e 6f 72 6d 61 6c 6c 79 2c 20 77 OTE: Normally, w
22b0: 65 20 77 69 6c 6c 20 6e 65 76 65 72 20 68 69 74 e will never hit
22c0: 20 74 68 69 73 20 63 61 73 65 20 62 65 63 61 75 this case becau
22d0: 73 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 se the value of
22e0: 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 the.. #
22f0: 20 20 20 20 20 74 65 73 74 20 63 6f 6e 66 69 67 test config
2300: 75 72 61 74 69 6f 6e 20 76 61 72 69 61 62 6c 65 uration variable
2310: 20 69 73 20 61 6c 77 61 79 73 20 73 65 74 20 62 is always set b
2320: 79 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 y the test suite
2330: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
2340: 20 20 69 74 73 65 6c 66 3b 20 68 6f 77 65 76 65 itself; howeve
2350: 72 2c 20 69 74 20 63 61 6e 20 62 65 20 6f 76 65 r, it can be ove
2360: 72 72 69 64 64 65 6e 20 75 73 69 6e 67 20 74 68 rridden using th
2370: 65 20 75 6e 73 65 74 20 63 6f 6d 6d 61 6e 64 0d e unset command.
2380: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
2390: 20 66 72 6f 6d 20 74 68 65 20 2d 70 72 65 54 65 from the -preTe
23a0: 73 74 20 6f 70 74 69 6f 6e 20 74 6f 20 74 68 65 st option to the
23b0: 20 74 65 73 74 20 73 75 69 74 65 2e 0d 0a 20 20 test suite...
23c0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
23d0: 20 72 65 74 75 72 6e 20 24 3a 3a 65 61 67 6c 65 return $::eagle
23e0: 5f 70 6c 61 74 66 6f 72 6d 28 63 6f 6e 66 69 67 _platform(config
23f0: 75 72 61 74 69 6f 6e 29 0d 0a 20 20 20 20 20 20 uration)..
2400: 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
2410: 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 43 6f proc getBuildCo
2420: 6e 66 69 67 75 72 61 74 69 6f 6e 73 20 7b 7d 20 nfigurations {}
2430: 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
2440: 20 20 23 20 4e 4f 54 45 3a 20 53 65 65 20 69 66 # NOTE: See if
2450: 20 74 68 65 20 6c 69 73 74 20 6f 66 20 74 65 73 the list of tes
2460: 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 73 t configurations
2470: 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 has been overri
2480: 64 64 65 6e 20 62 79 0d 0a 20 20 20 20 20 20 23 dden by.. #
2490: 20 20 20 20 20 20 20 74 68 65 20 75 73 65 72 20 the user
24a0: 28 65 2e 67 2e 20 6f 6e 20 74 68 65 20 63 6f 6d (e.g. on the com
24b0: 6d 61 6e 64 20 6c 69 6e 65 29 2e 0d 0a 20 20 20 mand line)...
24c0: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
24d0: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
24e0: 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f est_configuratio
24f0: 6e 73 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 ns] && \..
2500: 20 20 20 20 5b 6c 6c 65 6e 67 74 68 20 24 3a 3a [llength $::
2510: 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 test_configurati
2520: 6f 6e 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ons] > 0} then {
2530: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
2540: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 # NOTE: Use
2550: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 6c the specified l
2560: 69 73 74 20 6f 66 20 74 65 73 74 20 63 6f 6e 66 ist of test conf
2570: 69 67 75 72 61 74 69 6f 6e 73 2e 0d 0a 20 20 20 igurations...
2580: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
2590: 72 65 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f 63 return $::test_c
25a0: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 73 0d 0a 20 onfigurations..
25b0: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
25c0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
25d0: 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 # NOTE: Use th
25e0: 65 20 64 65 66 61 75 6c 74 20 6c 69 73 74 20 6f e default list o
25f0: 66 20 74 65 73 74 20 63 6f 6e 66 69 67 75 72 61 f test configura
2600: 74 69 6f 6e 73 2e 0d 0a 20 20 20 20 20 20 20 20 tions...
2610: 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 #.. retur
2620: 6e 20 5b 6c 69 73 74 20 44 65 62 75 67 20 52 65 n [list Debug Re
2630: 6c 65 61 73 65 5d 0d 0a 20 20 20 20 20 20 7d 0d lease].. }.
2640: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
2650: 72 6f 63 20 67 65 74 42 75 69 6c 64 42 61 73 65 roc getBuildBase
2660: 44 69 72 65 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a Directory {} {..
2670: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
2680: 20 4e 4f 54 45 3a 20 46 69 67 75 72 65 20 6f 75 NOTE: Figure ou
2690: 74 20 74 68 65 20 62 61 73 65 20 64 69 72 65 63 t the base direc
26a0: 74 6f 72 79 20 77 68 65 72 65 20 61 6c 6c 20 74 tory where all t
26b0: 68 65 20 62 75 69 6c 64 73 20 73 68 6f 75 6c 64 he builds should
26c0: 20 62 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 be.. #
26d0: 20 20 20 6c 6f 63 61 74 65 64 2e 20 20 54 68 69 located. Thi
26e0: 73 20 77 69 6c 6c 20 62 65 20 74 68 65 20 64 69 s will be the di
26f0: 72 65 63 74 6f 72 79 20 74 68 61 74 20 63 6f 6e rectory that con
2700: 74 61 69 6e 73 20 74 68 65 20 61 63 74 75 61 6c tains the actual
2710: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
2720: 62 75 69 6c 64 20 6f 75 74 70 75 74 20 64 69 72 build output dir
2730: 65 63 74 6f 72 79 20 28 65 2e 67 2e 20 70 61 72 ectory (e.g. par
2740: 65 6e 74 20 6f 66 20 22 62 69 6e 22 29 2e 0d 0a ent of "bin")...
2750: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
2760: 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
2770: 3a 3a 62 75 69 6c 64 5f 62 61 73 65 5f 64 69 72 ::build_base_dir
2780: 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a 20 20 ectory] && \..
2790: 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
27a0: 6c 65 6e 67 74 68 20 24 3a 3a 62 75 69 6c 64 5f length $::build_
27b0: 62 61 73 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 base_directory]
27c0: 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
27d0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
27e0: 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 # NOTE: The loca
27f0: 74 69 6f 6e 20 6f 66 20 74 68 65 20 62 75 69 6c tion of the buil
2800: 64 20 62 61 73 65 20 64 69 72 65 63 74 6f 72 79 d base directory
2810: 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 has been overri
2820: 64 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 dden;.. #
2830: 20 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 therefore
2840: 2c 20 75 73 65 20 69 74 20 76 65 72 62 61 74 69 , use it verbati
2850: 6d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 m... #..
2860: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a return $:
2870: 3a 62 75 69 6c 64 5f 62 61 73 65 5f 64 69 72 65 :build_base_dire
2880: 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 ctory.. } e
2890: 6c 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 lseif {[info exi
28a0: 73 74 73 20 3a 3a 63 6f 6d 6d 6f 6e 5f 64 69 72 sts ::common_dir
28b0: 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a 20 20 ectory] && \..
28c0: 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
28d0: 6c 65 6e 67 74 68 20 24 3a 3a 63 6f 6d 6d 6f 6e length $::common
28e0: 5f 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 30 7d _directory] > 0}
28f0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
2900: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
2910: 54 45 3a 20 4e 65 78 74 2c 20 66 61 6c 6c 62 61 TE: Next, fallba
2920: 63 6b 20 74 6f 20 74 68 65 20 70 61 72 65 6e 74 ck to the parent
2930: 20 64 69 72 65 63 74 6f 72 79 20 6f 66 20 74 68 directory of th
2940: 65 20 6f 6e 65 20 63 6f 6e 74 61 69 6e 69 6e 67 e one containing
2950: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
2960: 20 20 74 68 69 73 20 66 69 6c 65 20 28 69 2e 65 this file (i.e
2970: 2e 20 22 63 6f 6d 6d 6f 6e 2e 65 61 67 6c 65 22 . "common.eagle"
2980: 29 2c 20 69 66 20 61 76 61 69 6c 61 62 6c 65 2e ), if available.
2990: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
29a0: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c return [fil
29b0: 65 20 64 69 72 6e 61 6d 65 20 24 3a 3a 63 6f 6d e dirname $::com
29c0: 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 5d 0d 0a mon_directory]..
29d0: 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b } elseif {
29e0: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 70 [info exists ::p
29f0: 61 74 68 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 ath] && \..
2a00: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
2a10: 67 74 68 20 24 3a 3a 70 61 74 68 5d 20 3e 20 30 gth $::path] > 0
2a20: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
2a30: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
2a40: 4f 54 45 3a 20 46 69 6e 61 6c 6c 79 2c 20 66 61 OTE: Finally, fa
2a50: 6c 6c 62 61 63 6b 20 74 6f 20 74 68 65 20 70 61 llback to the pa
2a60: 72 65 6e 74 20 64 69 72 65 63 74 6f 72 79 20 6f rent directory o
2a70: 66 20 74 68 65 20 45 61 67 6c 65 54 65 73 74 0d f the EagleTest.
2a80: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
2a90: 20 70 61 74 68 2e 20 20 54 68 65 20 45 61 67 6c path. The Eagl
2aa0: 65 54 65 73 74 20 70 61 63 6b 61 67 65 20 67 75 eTest package gu
2ab0: 61 72 61 6e 74 65 65 73 20 74 68 61 74 20 74 68 arantees that th
2ac0: 69 73 20 76 61 72 69 61 62 6c 65 0d 0a 20 20 20 is variable..
2ad0: 20 20 20 20 20 23 20 20 20 20 20 20 20 77 69 6c # wil
2ae0: 6c 20 62 65 20 73 65 74 20 74 6f 20 74 68 65 20 l be set to the
2af0: 64 69 72 65 63 74 6f 72 79 20 63 6f 6e 74 61 69 directory contai
2b00: 6e 69 6e 67 20 74 68 65 20 66 69 72 73 74 20 66 ning the first f
2b10: 69 6c 65 20 74 6f 0d 0a 20 20 20 20 20 20 20 20 ile to..
2b20: 23 20 20 20 20 20 20 20 65 78 65 63 75 74 65 20 # execute
2b30: 74 68 65 20 5b 72 75 6e 54 65 73 74 50 72 6f 6c the [runTestProl
2b40: 6f 67 75 65 5d 20 73 63 72 69 70 74 20 6c 69 62 ogue] script lib
2b50: 72 61 72 79 20 70 72 6f 63 65 64 75 72 65 2e 0d rary procedure..
2b60: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
2b70: 20 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 return [file
2b80: 20 64 69 72 6e 61 6d 65 20 24 3a 3a 70 61 74 68 dirname $::path
2b90: 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 ].. } else
2ba0: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
2bb0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4e 6f # NOTE: No
2bc0: 20 70 61 74 68 20 69 73 20 61 76 61 69 6c 61 62 path is availab
2bd0: 6c 65 2c 20 72 65 74 75 72 6e 20 61 6e 20 65 6d le, return an em
2be0: 70 74 79 20 73 74 72 69 6e 67 2e 20 20 54 68 69 pty string. Thi
2bf0: 73 20 70 6f 69 6e 74 0d 0a 20 20 20 20 20 20 20 s point..
2c00: 20 23 20 20 20 20 20 20 20 73 68 6f 75 6c 64 20 # should
2c10: 6e 6f 74 20 62 65 20 72 65 61 63 68 65 64 2e 0d not be reached..
2c20: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
2c30: 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 return ""..
2c40: 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
2c50: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 53 51 .. proc getSQ
2c60: 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 74 68 LiteTestDataPath
2c70: 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a {} {.. #..
2c80: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 # NOTE: Fi
2c90: 67 75 72 65 20 6f 75 74 20 74 68 65 20 64 69 72 gure out the dir
2ca0: 65 63 74 6f 72 79 20 77 68 65 72 65 20 61 6c 6c ectory where all
2cb0: 20 74 68 65 20 74 65 73 74 20 64 61 74 61 20 66 the test data f
2cc0: 69 6c 65 73 20 73 68 6f 75 6c 64 0d 0a 20 20 20 iles should..
2cd0: 20 20 20 23 20 20 20 20 20 20 20 62 65 20 6c 6f # be lo
2ce0: 63 61 74 65 64 2e 20 20 54 68 69 73 20 73 68 6f cated. This sho
2cf0: 75 6c 64 20 62 65 20 74 68 65 20 22 64 61 74 61 uld be the "data
2d00: 22 20 64 69 72 65 63 74 6f 72 79 20 62 65 6e 65 " directory bene
2d10: 61 74 68 20 74 68 65 0d 0a 20 20 20 20 20 20 23 ath the.. #
2d20: 20 20 20 20 20 20 20 64 69 72 65 63 74 6f 72 79 directory
2d30: 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 containing the
2d40: 61 63 74 75 61 6c 20 74 65 73 74 20 73 63 72 69 actual test scri
2d50: 70 74 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 pts... #..
2d60: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c return [fil
2d70: 65 20 6a 6f 69 6e 20 24 3a 3a 70 61 74 68 20 64 e join $::path d
2d80: 61 74 61 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a ata].. }.....
2d90: 20 20 20 20 70 72 6f 63 20 69 73 52 75 6e 6e 69 proc isRunni
2da0: 6e 67 57 6f 57 36 34 20 7b 7d 20 7b 0d 0a 20 20 ngWoW64 {} {..
2db0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
2dc0: 4f 54 45 3a 20 46 6f 72 20 6e 6f 77 2c 20 6a 75 OTE: For now, ju
2dd0: 73 74 20 75 73 65 20 74 68 65 20 65 78 69 73 74 st use the exist
2de0: 69 6e 67 20 74 65 73 74 20 63 6f 6e 73 74 72 61 ing test constra
2df0: 69 6e 74 20 66 6f 72 20 64 65 74 65 63 74 69 6e int for detectin
2e00: 67 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 g.. #
2e10: 20 61 20 57 6f 57 36 34 20 70 72 6f 63 65 73 73 a WoW64 process
2e20: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
2e30: 20 20 72 65 74 75 72 6e 20 5b 68 61 76 65 43 6f return [haveCo
2e40: 6e 73 74 72 61 69 6e 74 20 77 6f 77 36 34 5d 0d nstraint wow64].
2e50: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
2e60: 72 6f 63 20 69 73 4d 69 78 65 64 4d 6f 64 65 41 roc isMixedModeA
2e70: 73 73 65 6d 62 6c 79 20 7b 20 66 69 6c 65 4e 61 ssembly { fileNa
2e80: 6d 65 20 7b 76 61 72 4e 61 6d 65 20 22 22 7d 20 me {varName ""}
2e90: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
2ea0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 72 73 # NOTE: Firs
2eb0: 74 2c 20 6d 61 6b 65 20 73 75 72 65 20 74 68 65 t, make sure the
2ec0: 20 74 65 73 74 20 73 75 69 74 65 20 69 6e 66 72 test suite infr
2ed0: 61 73 74 72 75 63 74 75 72 65 20 69 73 20 61 6c astructure is al
2ee0: 6c 6f 77 65 64 20 74 6f 0d 0a 20 20 20 20 20 20 lowed to..
2ef0: 23 20 20 20 20 20 20 20 75 73 65 20 74 68 65 20 # use the
2f00: 5b 65 78 65 63 5d 20 63 6f 6d 6d 61 6e 64 2e 0d [exec] command..
2f10: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
2f20: 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
2f30: 73 20 3a 3a 6e 6f 28 65 78 65 63 29 5d 20 26 26 s ::no(exec)] &&
2f40: 20 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a ![info exists :
2f50: 3a 6e 6f 28 63 6f 72 46 6c 61 67 73 29 5d 7d 20 :no(corFlags)]}
2f60: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2f70: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
2f80: 45 3a 20 49 66 20 74 68 65 20 6c 6f 63 61 74 69 E: If the locati
2f90: 6f 6e 20 6f 66 20 43 6f 72 46 6c 61 67 73 20 69 on of CorFlags i
2fa0: 73 20 70 72 65 73 65 6e 74 20 69 6e 20 74 68 65 s present in the
2fb0: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 0d 0a 20 environment,..
2fc0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 75 # u
2fd0: 73 65 20 69 74 3b 20 6f 74 68 65 72 77 69 73 65 se it; otherwise
2fe0: 20 61 73 73 75 6d 65 20 69 74 20 69 73 20 69 6e assume it is in
2ff0: 20 74 68 65 20 50 41 54 48 2e 0d 0a 20 20 20 20 the PATH...
3000: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 #.. s
3010: 65 74 20 63 6f 72 46 6c 61 67 73 20 5b 65 78 70 et corFlags [exp
3020: 72 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 5b r {.. [
3030: 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 65 6e info exists ::en
3040: 76 28 43 6f 72 46 6c 61 67 73 29 5d 20 3f 20 24 v(CorFlags)] ? $
3050: 3a 3a 65 6e 76 28 43 6f 72 46 6c 61 67 73 29 20 ::env(CorFlags)
3060: 3a 20 22 43 6f 72 46 6c 61 67 73 22 0d 0a 20 20 : "CorFlags"..
3070: 20 20 20 20 20 20 7d 5d 0d 0a 0d 0a 20 20 20 20 }]....
3080: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
3090: 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 NOTE: Attempt t
30a0: 6f 20 65 78 65 63 75 74 65 20 43 6f 72 46 6c 61 o execute CorFla
30b0: 67 73 20 6f 6e 20 74 68 65 20 73 70 65 63 69 66 gs on the specif
30c0: 69 65 64 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 ied file...
30d0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 #.. if
30e0: 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
30f0: 20 20 20 20 20 20 65 78 65 63 20 2d 2d 20 24 63 exec -- $c
3100: 6f 72 46 6c 61 67 73 20 5b 66 69 6c 65 20 6e 61 orFlags [file na
3110: 74 69 76 65 6e 61 6d 65 20 24 66 69 6c 65 4e 61 tivename $fileNa
3120: 6d 65 5d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 me].. } e
3130: 78 65 63 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 xec] == 0} then
3140: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a {.. #..
3150: 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
3160: 3a 20 49 66 20 72 65 71 75 65 73 74 65 64 20 62 : If requested b
3170: 79 20 6f 75 72 20 63 61 6c 6c 65 72 2c 20 61 74 y our caller, at
3180: 74 65 6d 70 74 20 74 6f 20 64 65 74 65 72 6d 69 tempt to determi
3190: 6e 65 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 ne the..
31a0: 20 20 23 20 20 20 20 20 20 20 70 6c 61 74 66 6f # platfo
31b0: 72 6d 20 66 6f 72 20 74 68 65 20 73 70 65 63 69 rm for the speci
31c0: 66 69 65 64 20 66 69 6c 65 20 61 73 20 77 65 6c fied file as wel
31d0: 6c 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d l... #.
31e0: 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
31f0: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 string length $v
3200: 61 72 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 arName] > 0} the
3210: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
3220: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
3230: 23 20 4e 4f 54 45 3a 20 53 74 6f 72 65 20 74 68 # NOTE: Store th
3240: 65 20 70 6c 61 74 66 6f 72 6d 20 69 6e 20 74 68 e platform in th
3250: 65 20 6e 61 6d 65 64 20 76 61 72 69 61 62 6c 65 e named variable
3260: 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 20 in the..
3270: 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e # con
3280: 74 65 78 74 20 6f 66 20 6f 75 72 20 63 61 6c 6c text of our call
3290: 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 er...
32a0: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
32b0: 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 upvar 1 $varName
32c0: 20 70 6c 61 74 66 6f 72 6d 0d 0a 0d 0a 20 20 20 platform....
32d0: 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
32e0: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
32f0: 41 74 74 65 6d 70 74 20 74 6f 20 65 78 74 72 61 Attempt to extra
3300: 63 74 20 74 68 65 20 50 45 20 6c 69 6e 65 20 66 ct the PE line f
3310: 72 6f 6d 20 74 68 65 20 63 61 70 74 75 72 65 64 rom the captured
3320: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 .. #
3330: 20 20 20 20 20 20 6f 75 74 70 75 74 2e 20 20 49 output. I
3340: 66 20 74 68 69 73 20 76 61 6c 75 65 20 69 73 20 f this value is
3350: 22 50 45 33 32 22 20 6f 72 20 22 50 45 33 32 2b "PE32" or "PE32+
3360: 22 2c 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 ", the..
3370: 20 20 20 20 23 20 20 20 20 20 20 20 61 73 73 65 # asse
3380: 6d 62 6c 79 20 66 69 6c 65 20 69 73 20 33 32 2d mbly file is 32-
3390: 62 69 74 20 6f 72 20 36 34 2d 62 69 74 2c 20 72 bit or 64-bit, r
33a0: 65 73 70 65 63 74 69 76 65 6c 79 3b 0d 0a 20 20 espectively;..
33b0: 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
33c0: 20 20 6f 74 68 65 72 77 69 73 65 2c 20 69 74 73 otherwise, its
33d0: 20 74 79 70 65 20 69 73 20 75 6e 6b 6e 6f 77 6e type is unknown
33e0: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 ... #
33f0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 .. se
3400: 74 20 70 61 74 74 65 72 6e 20 7b 5e 50 45 20 20 t pattern {^PE
3410: 20 20 20 20 20 20 3a 20 28 50 45 33 32 7c 50 45 : (PE32|PE
3420: 33 32 5c 2b 29 5c 73 2b 24 7d 0d 0a 0d 0a 20 20 32\+)\s+$}....
3430: 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 72 if {[r
3440: 65 67 65 78 70 20 2d 6c 69 6e 65 20 2d 2d 20 24 egexp -line -- $
3450: 70 61 74 74 65 72 6e 20 24 65 78 65 63 20 64 75 pattern $exec du
3460: 6d 6d 79 20 70 65 33 32 5d 7d 20 74 68 65 6e 20 mmy pe32]} then
3470: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
3480: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
3490: 20 20 23 20 48 41 43 4b 3a 20 54 68 69 73 20 5b # HACK: This [
34a0: 73 77 69 74 63 68 5d 20 61 73 73 75 6d 65 73 20 switch] assumes
34b0: 74 68 61 74 20 33 32 2d 62 69 74 20 65 78 65 63 that 32-bit exec
34c0: 75 74 61 62 6c 65 73 20 61 72 65 0d 0a 20 20 20 utables are..
34d0: 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 #
34e0: 20 20 20 61 6c 77 61 79 73 20 78 38 36 20 61 6e always x86 an
34f0: 64 20 74 68 61 74 20 36 34 2d 62 69 74 20 65 78 d that 64-bit ex
3500: 65 63 75 74 61 62 6c 65 73 20 61 72 65 20 61 6c ecutables are al
3510: 77 61 79 73 0d 0a 20 20 20 20 20 20 20 20 20 20 ways..
3520: 20 20 20 20 23 20 20 20 20 20 20 20 78 36 34 2e # x64.
3530: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
3540: 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 #..
3550: 20 73 77 69 74 63 68 20 2d 65 78 61 63 74 20 2d switch -exact -
3560: 2d 20 24 70 65 33 32 20 7b 0d 0a 20 20 20 20 20 - $pe32 {..
3570: 20 20 20 20 20 20 20 20 20 20 20 50 45 33 32 20 PE32
3580: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
3590: 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 set platfor
35a0: 6d 20 57 69 6e 33 32 0d 0a 20 20 20 20 20 20 20 m Win32..
35b0: 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
35c0: 20 20 20 20 20 20 20 20 20 20 20 20 50 45 33 32 PE32
35d0: 2b 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 + {..
35e0: 20 20 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 set platf
35f0: 6f 72 6d 20 78 36 34 0d 0a 20 20 20 20 20 20 20 orm x64..
3600: 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
3610: 20 20 20 20 20 20 20 20 20 20 20 20 64 65 66 61 defa
3620: 75 6c 74 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 ult {..
3630: 20 20 20 20 20 20 20 20 20 73 65 74 20 70 6c 61 set pla
3640: 74 66 6f 72 6d 20 22 22 0d 0a 20 20 20 20 20 20 tform ""..
3650: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
3660: 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
3670: 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 } else
3680: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
3690: 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 22 set platform "
36a0: 22 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ".. }
36b0: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d .. }...
36c0: 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
36d0: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
36e0: 41 74 74 65 6d 70 74 20 74 6f 20 65 78 74 72 61 Attempt to extra
36f0: 63 74 20 74 68 65 20 49 4c 4f 4e 4c 59 20 6c 69 ct the ILONLY li
3700: 6e 65 20 66 72 6f 6d 20 74 68 65 20 63 61 70 74 ne from the capt
3710: 75 72 65 64 0d 0a 20 20 20 20 20 20 20 20 20 20 ured..
3720: 23 20 20 20 20 20 20 20 6f 75 74 70 75 74 2e 20 # output.
3730: 20 49 66 20 74 68 69 73 20 76 61 6c 75 65 20 69 If this value i
3740: 73 20 7a 65 72 6f 2c 20 74 68 65 20 73 70 65 63 s zero, the spec
3750: 69 66 69 65 64 20 66 69 6c 65 20 6d 75 73 74 0d ified file must.
3760: 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
3770: 20 20 20 62 65 20 61 20 6d 69 78 65 64 2d 6d 6f be a mixed-mo
3780: 64 65 20 61 73 73 65 6d 62 6c 79 3b 20 6f 74 68 de assembly; oth
3790: 65 72 77 69 73 65 2c 20 69 74 20 63 6f 6e 74 61 erwise, it conta
37a0: 69 6e 73 20 6f 6e 6c 79 0d 0a 20 20 20 20 20 20 ins only..
37b0: 20 20 20 20 23 20 20 20 20 20 20 20 6d 61 6e 61 # mana
37c0: 67 65 64 20 63 6f 6d 70 6f 6e 65 6e 74 73 2e 0d ged components..
37d0: 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
37e0: 20 20 20 20 20 20 20 20 73 65 74 20 70 61 74 74 set patt
37f0: 65 72 6e 20 7b 5e 49 4c 4f 4e 4c 59 20 20 20 20 ern {^ILONLY
3800: 3a 20 28 30 7c 31 29 5c 73 2b 24 7d 0d 0a 0d 0a : (0|1)\s+$}....
3810: 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
3820: 72 65 67 65 78 70 20 2d 6c 69 6e 65 20 2d 2d 20 regexp -line --
3830: 24 70 61 74 74 65 72 6e 20 24 65 78 65 63 20 64 $pattern $exec d
3840: 75 6d 6d 79 20 69 6c 4f 6e 6c 79 5d 7d 20 74 68 ummy ilOnly]} th
3850: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
3860: 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a return false..
3870: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
3880: 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 69 if {!$i
3890: 6c 4f 6e 6c 79 7d 20 74 68 65 6e 20 7b 0d 0a 20 lOnly} then {..
38a0: 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 retur
38b0: 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 20 20 n true..
38c0: 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
38d0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
38e0: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
38f0: 3a 20 49 66 20 74 68 65 20 74 65 73 74 20 73 75 : If the test su
3900: 69 74 65 20 63 61 6e 6e 6f 74 20 75 73 65 20 5b ite cannot use [
3910: 65 78 65 63 5d 20 6f 72 20 65 78 65 63 75 74 69 exec] or executi
3920: 6f 6e 20 6f 66 20 43 6f 72 46 6c 61 67 73 0d 0a on of CorFlags..
3930: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 66 61 # fa
3940: 69 6c 65 64 2c 20 72 65 74 75 72 6e 20 66 61 6c iled, return fal
3950: 73 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 se... #..
3960: 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 return false
3970: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
3980: 70 72 6f 63 20 69 73 42 75 69 6c 64 41 76 61 69 proc isBuildAvai
3990: 6c 61 62 6c 65 20 7b 20 6e 61 74 69 76 65 20 64 lable { native d
39a0: 69 72 65 63 74 6f 72 79 20 7b 76 61 72 4e 61 6d irectory {varNam
39b0: 65 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 e ""} } {..
39c0: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
39d0: 3a 20 42 75 69 6c 64 20 74 68 65 20 66 75 6c 6c : Build the full
39e0: 79 20 71 75 61 6c 69 66 69 65 64 20 66 69 6c 65 y qualified file
39f0: 20 6e 61 6d 65 20 66 6f 72 20 74 68 65 20 70 72 name for the pr
3a00: 69 6d 61 72 79 20 61 73 73 65 6d 62 6c 79 0d 0a imary assembly..
3a10: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
3a20: 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 53 79 73 ntaining the Sys
3a30: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
3a40: 6d 61 6e 61 67 65 64 20 63 6f 6d 70 6f 6e 65 6e managed componen
3a50: 74 73 2e 20 20 49 74 0d 0a 20 20 20 20 20 20 23 ts. It.. #
3a60: 20 20 20 20 20 20 20 73 68 6f 75 6c 64 20 62 65 should be
3a70: 20 6e 6f 74 65 64 20 74 68 61 74 20 74 68 69 73 noted that this
3a80: 20 61 73 73 65 6d 62 6c 79 20 66 69 6c 65 20 6d assembly file m
3a90: 61 79 20 61 6c 73 6f 20 63 6f 6e 74 61 69 6e 20 ay also contain
3aa0: 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 the.. #
3ab0: 20 20 20 6e 61 74 69 76 65 20 63 6f 6d 70 6f 6e native compon
3ac0: 65 6e 74 73 2c 20 69 66 20 61 20 6e 61 74 69 76 ents, if a nativ
3ad0: 65 20 62 75 69 6c 64 20 69 73 20 69 6e 20 75 73 e build is in us
3ae0: 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e... #..
3af0: 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 set fileName
3b00: 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
3b10: 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 [file join $dir
3b20: 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 ectory \..
3b30: 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e System.Data.
3b40: 53 51 4c 69 74 65 2e 64 6c 6c 5d 5d 0d 0a 0d 0a SQLite.dll]]....
3b50: 20 20 20 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 if {![file
3b60: 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d exists $fileNam
3b70: 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
3b80: 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 return false
3b90: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
3ba0: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
3bb0: 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 61 TE: Attempt to a
3bc0: 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 64 65 74 utomatically det
3bd0: 65 63 74 20 69 66 20 74 68 65 20 70 72 69 6d 61 ect if the prima
3be0: 72 79 20 61 73 73 65 6d 62 6c 79 0d 0a 20 20 20 ry assembly..
3bf0: 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 74 61 # conta
3c00: 69 6e 73 20 61 6e 79 20 6e 61 74 69 76 65 20 63 ins any native c
3c10: 6f 6d 70 6f 6e 65 6e 74 73 2c 20 69 66 20 6e 65 omponents, if ne
3c20: 63 65 73 73 61 72 79 2e 0d 0a 20 20 20 20 20 20 cessary...
3c30: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 #.. if {[st
3c40: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e 61 74 ring length $nat
3c50: 69 76 65 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ive] == 0} then
3c60: 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b {.. if {[
3c70: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 string length $v
3c80: 61 72 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 arName] > 0} the
3c90: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 75 n {.. u
3ca0: 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 pvar 1 $varName
3cb0: 24 76 61 72 4e 61 6d 65 0d 0a 20 20 20 20 20 20 $varName..
3cc0: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 }.... s
3cd0: 65 74 20 6e 61 74 69 76 65 20 5b 69 73 4d 69 78 et native [isMix
3ce0: 65 64 4d 6f 64 65 41 73 73 65 6d 62 6c 79 20 24 edModeAssembly $
3cf0: 66 69 6c 65 4e 61 6d 65 20 24 76 61 72 4e 61 6d fileName $varNam
3d00: 65 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 e].. }....
3d10: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
3d20: 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 70 72 69 NOTE: If the pri
3d30: 6d 61 72 79 20 61 73 73 65 6d 62 6c 79 20 61 6c mary assembly al
3d40: 73 6f 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 so contains the
3d50: 6e 61 74 69 76 65 20 63 6f 6d 70 6f 6e 65 6e 74 native component
3d60: 73 2c 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 s,.. #
3d70: 20 20 77 65 20 68 61 76 65 20 65 76 65 72 79 74 we have everyt
3d80: 68 69 6e 67 20 77 65 20 6e 65 65 64 2e 0d 0a 20 hing we need...
3d90: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
3da0: 20 7b 24 6e 61 74 69 76 65 7d 20 74 68 65 6e 20 {$native} then
3db0: 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 {.. retur
3dc0: 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d n true.. }.
3dd0: 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
3de0: 20 20 23 20 4e 4f 54 45 3a 20 57 68 61 74 20 69 # NOTE: What i
3df0: 73 20 74 68 65 20 70 6c 61 74 66 6f 72 6d 20 66 s the platform f
3e00: 6f 72 20 74 68 69 73 20 6d 61 63 68 69 6e 65 3f or this machine?
3e10: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
3e20: 20 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 5b 6d set platform [m
3e30: 61 63 68 69 6e 65 54 6f 50 6c 61 74 66 6f 72 6d achineToPlatform
3e40: 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d $::tcl_platform
3e50: 28 6d 61 63 68 69 6e 65 29 5d 0d 0a 0d 0a 20 20 (machine)]....
3e60: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
3e70: 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 20 66 OTE: Build the f
3e80: 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 20 66 ully qualified f
3e90: 69 6c 65 20 6e 61 6d 65 20 66 6f 72 20 74 68 65 ile name for the
3ea0: 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c interop assembl
3eb0: 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 y.. #
3ec0: 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 containing the
3ed0: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
3ee0: 74 65 20 6e 61 74 69 76 65 20 63 6f 6d 70 6f 6e te native compon
3ef0: 65 6e 74 73 2e 20 20 49 66 20 74 68 69 73 0d 0a ents. If this..
3f00: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 66 69 # fi
3f10: 6c 65 20 65 78 69 73 74 73 2c 20 77 65 20 73 68 le exists, we sh
3f20: 6f 75 6c 64 20 68 61 76 65 20 65 76 65 72 79 74 ould have everyt
3f30: 68 69 6e 67 20 77 65 20 6e 65 65 64 2e 0d 0a 20 hing we need...
3f40: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 #.. se
3f50: 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 t fileName [file
3f60: 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c nativename [fil
3f70: 65 20 6a 6f 69 6e 20 24 64 69 72 65 63 74 6f 72 e join $director
3f80: 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 24 y \.. $
3f90: 70 6c 61 74 66 6f 72 6d 20 53 51 4c 69 74 65 2e platform SQLite.
3fa0: 49 6e 74 65 72 6f 70 2e 64 6c 6c 5d 5d 0d 0a 0d Interop.dll]]...
3fb0: 0a 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 . if {[file
3fc0: 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d exists $fileNam
3fd0: 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
3fe0: 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d return true.
3ff0: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
4000: 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b set fileName [
4010: 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 file nativename
4020: 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 65 [file join $dire
4030: 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 20 ctory \..
4040: 20 20 20 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f SQLite.Intero
4050: 70 2e 64 6c 6c 5d 5d 0d 0a 0d 0a 20 20 20 20 20 p.dll]]....
4060: 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 if {[file exist
4070: 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 s $fileName]} th
4080: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 en {.. re
4090: 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 turn true..
40a0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
40b0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 # NOTE: Bui
40c0: 6c 64 20 74 68 65 20 66 75 6c 6c 79 20 71 75 61 ld the fully qua
40d0: 6c 69 66 69 65 64 20 66 69 6c 65 20 6e 61 6d 65 lified file name
40e0: 20 66 6f 72 20 74 68 65 20 53 51 4c 69 74 65 20 for the SQLite
40f0: 63 6f 72 65 0d 0a 20 20 20 20 20 20 23 20 20 20 core.. #
4100: 20 20 20 20 6c 69 62 72 61 72 79 2e 20 20 49 66 library. If
4110: 20 74 68 69 73 20 66 69 6c 65 20 65 78 69 73 74 this file exist
4120: 73 2c 20 77 65 20 73 68 6f 75 6c 64 20 68 61 76 s, we should hav
4130: 65 20 65 76 65 72 79 74 68 69 6e 67 20 77 65 0d e everything we.
4140: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6e . # n
4150: 65 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 eed... #..
4160: 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d set fileNam
4170: 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 e [file nativena
4180: 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 me [file join $d
4190: 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 irectory \..
41a0: 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 6d 20 $platform
41b0: 73 71 6c 69 74 65 33 2e 64 6c 6c 5d 5d 0d 0a 0d sqlite3.dll]]...
41c0: 0a 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 . if {[file
41d0: 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d exists $fileNam
41e0: 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
41f0: 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d return true.
4200: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
4210: 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b set fileName [
4220: 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 file nativename
4230: 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 65 [file join $dire
4240: 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 20 ctory \..
4250: 20 20 20 73 71 6c 69 74 65 33 2e 64 6c 6c 5d 5d sqlite3.dll]]
4260: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 66 .... if {[f
4270: 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 ile exists $file
4280: 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 Name]} then {..
4290: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
42a0: 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 ue.. }....
42b0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
42c0: 4e 4f 54 45 3a 20 4f 6e 65 20 6f 72 20 6d 6f 72 NOTE: One or mor
42d0: 65 20 6e 61 74 69 76 65 20 63 6f 6d 70 6f 6e 65 e native compone
42e0: 6e 74 73 20 6e 65 65 64 65 64 20 62 79 20 53 79 nts needed by Sy
42f0: 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
4300: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
4310: 61 72 65 20 6d 69 73 73 69 6e 67 2e 0d 0a 20 20 are missing...
4320: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 #.. ret
4330: 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 7d urn false.. }
4340: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 69 73 ..... proc is
4350: 52 65 6c 65 61 73 65 41 76 61 69 6c 61 62 6c 65 ReleaseAvailable
4360: 20 7b 20 64 69 72 65 63 74 6f 72 79 20 7b 76 61 { directory {va
4370: 72 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d 0a 20 rName ""} } {..
4380: 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
4390: 20 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 6d 65 length $varName
43a0: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
43b0: 20 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 upvar 1 $
43c0: 76 61 72 4e 61 6d 65 20 24 76 61 72 4e 61 6d 65 varName $varName
43d0: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
43e0: 20 20 20 72 65 74 75 72 6e 20 5b 69 73 42 75 69 return [isBui
43f0: 6c 64 41 76 61 69 6c 61 62 6c 65 20 22 22 20 24 ldAvailable "" $
4400: 64 69 72 65 63 74 6f 72 79 20 24 76 61 72 4e 61 directory $varNa
4410: 6d 65 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 me].. }.....
4420: 20 20 20 70 72 6f 63 20 6a 6f 69 6e 42 75 69 6c proc joinBuil
4430: 64 44 69 72 65 63 74 6f 72 79 20 7b 20 6e 61 74 dDirectory { nat
4440: 69 76 65 20 70 61 74 68 20 79 65 61 72 20 70 6c ive path year pl
4450: 61 74 66 6f 72 6d 20 63 6f 6e 66 69 67 75 72 61 atform configura
4460: 74 69 6f 6e 20 7d 20 7b 0d 0a 20 20 20 20 20 20 tion } {..
4470: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
4480: 20 46 69 67 75 72 65 20 6f 75 74 20 61 6e 64 20 Figure out and
4490: 74 68 65 6e 20 72 65 74 75 72 6e 20 74 68 65 20 then return the
44a0: 66 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 20 fully qualified
44b0: 70 61 74 68 20 74 6f 20 74 68 65 20 62 75 69 6c path to the buil
44c0: 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 d.. #
44d0: 20 64 69 72 65 63 74 6f 72 79 20 62 61 73 65 64 directory based
44e0: 20 6f 6e 20 61 6c 6c 20 74 68 65 20 61 72 67 75 on all the argu
44f0: 6d 65 6e 74 73 20 70 72 6f 76 69 64 65 64 20 62 ments provided b
4500: 79 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d 0a 20 y our caller...
4510: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
4520: 20 7b 24 6e 61 74 69 76 65 7d 20 74 68 65 6e 20 {$native} then
4530: 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 {.. retur
4540: 6e 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 70 61 n [file join $pa
4550: 74 68 20 62 69 6e 20 24 79 65 61 72 20 24 70 6c th bin $year $pl
4560: 61 74 66 6f 72 6d 20 24 63 6f 6e 66 69 67 75 72 atform $configur
4570: 61 74 69 6f 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 ation].. }
4580: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
4590: 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 6a 6f 69 return [file joi
45a0: 6e 20 24 70 61 74 68 20 62 69 6e 20 24 79 65 61 n $path bin $yea
45b0: 72 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e r $configuration
45c0: 20 62 69 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a bin].. }..
45d0: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
45e0: 6f 63 20 67 65 74 42 75 69 6c 64 44 69 72 65 63 oc getBuildDirec
45f0: 74 6f 72 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 tory {} {..
4600: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
4610: 3a 20 53 65 65 20 69 66 20 74 68 65 20 22 6e 61 : See if the "na
4620: 74 69 76 65 22 20 72 75 6e 74 69 6d 65 20 6f 70 tive" runtime op
4630: 74 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 73 65 tion has been se
4640: 74 2e 20 20 49 66 20 73 6f 2c 20 75 73 65 20 74 t. If so, use t
4650: 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 he.. #
4660: 20 20 64 69 72 65 63 74 6f 72 79 20 66 6f 72 20 directory for
4670: 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 the mixed-mode a
4680: 73 73 65 6d 62 6c 79 20 28 61 2e 6b 2e 61 2e 20 ssembly (a.k.a.
4690: 74 68 65 20 6e 61 74 69 76 65 20 69 6e 74 65 72 the native inter
46a0: 6f 70 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 op.. #
46b0: 20 20 61 73 73 65 6d 62 6c 79 29 2e 20 20 54 6f assembly). To
46c0: 20 65 6e 61 62 6c 65 20 74 68 69 73 20 6f 70 74 enable this opt
46d0: 69 6f 6e 20 76 69 61 20 74 68 65 20 63 6f 6d 6d ion via the comm
46e0: 61 6e 64 20 6c 69 6e 65 2c 20 65 6e 74 65 72 20 and line, enter
46f0: 61 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 a.. #
4700: 20 63 6f 6d 6d 61 6e 64 20 73 69 6d 69 6c 61 72 command similar
4710: 20 74 6f 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 to one of the f
4720: 6f 6c 6c 6f 77 69 6e 67 20 28 61 6c 6c 20 6f 6e ollowing (all on
4730: 20 6f 6e 65 20 6c 69 6e 65 29 3a 0d 0a 20 20 20 one line):..
4740: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 #.. #
4750: 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 EagleShell.e
4760: 78 65 20 2d 69 6e 69 74 69 61 6c 69 7a 65 20 2d xe -initialize -
4770: 72 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 runtimeOption na
4780: 74 69 76 65 0d 0a 20 20 20 20 20 20 23 20 20 20 tive.. #
4790: 20 20 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 -file .\pa
47a0: 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d th\to\all.eagle.
47b0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
47c0: 23 20 20 20 20 20 20 20 54 6f 20 65 6e 61 62 6c # To enabl
47d0: 65 20 74 68 69 73 20 6f 70 74 69 6f 6e 20 76 69 e this option vi
47e0: 61 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 a the command li
47f0: 6e 65 20 70 72 69 6f 72 20 74 6f 20 74 68 65 20 ne prior to the
4800: 22 62 65 74 61 20 31 36 22 0d 0a 20 20 20 20 20 "beta 16"..
4810: 20 23 20 20 20 20 20 20 20 72 65 6c 65 61 73 65 # release
4820: 20 6f 66 20 45 61 67 6c 65 2c 20 74 68 65 20 66 of Eagle, the f
4830: 6f 6c 6c 6f 77 69 6e 67 20 63 6f 6d 6d 61 6e 64 ollowing command
4840: 20 6d 75 73 74 20 62 65 20 75 73 65 64 20 69 6e must be used in
4850: 73 74 65 61 64 0d 0a 20 20 20 20 20 20 23 20 20 stead.. #
4860: 20 20 20 20 20 28 61 6c 73 6f 20 61 6c 6c 20 6f (also all o
4870: 6e 20 6f 6e 65 20 6c 69 6e 65 29 3a 0d 0a 20 20 n one line):..
4880: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 #.. #
4890: 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e EagleShell.
48a0: 65 78 65 20 2d 69 6e 69 74 69 61 6c 69 7a 65 20 exe -initialize
48b0: 2d 70 6f 73 74 49 6e 69 74 69 61 6c 69 7a 65 0d -postInitialize.
48c0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 . #
48d0: 20 22 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 "object invoke
48e0: 49 6e 74 65 72 70 72 65 74 65 72 2e 47 65 74 41 Interpreter.GetA
48f0: 63 74 69 76 65 20 41 64 64 52 75 6e 74 69 6d 65 ctive AddRuntime
4900: 4f 70 74 69 6f 6e 20 6e 61 74 69 76 65 22 0d 0a Option native"..
4910: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 #
4920: 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 6f 5c -file .\path\to\
4930: 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 20 20 all.eagle..
4940: 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 #.. if {[i
4950: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 62 75 69 nfo exists ::bui
4960: 6c 64 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 26 ld_directory] &&
4970: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 \.. [s
4980: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a tring length $::
4990: 62 75 69 6c 64 5f 64 69 72 65 63 74 6f 72 79 5d build_directory]
49a0: 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
49b0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
49c0: 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 # NOTE: The loc
49d0: 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 62 75 69 ation of the bui
49e0: 6c 64 20 64 69 72 65 63 74 6f 72 79 20 68 61 73 ld directory has
49f0: 20 62 65 65 6e 20 6f 76 65 72 72 69 64 64 65 6e been overridden
4a00: 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 ;.. #
4a10: 20 20 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 therefore, us
4a20: 65 20 69 74 20 76 65 72 62 61 74 69 6d 2e 0d 0a e it verbatim...
4a30: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
4a40: 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 62 75 69 return $::bui
4a50: 6c 64 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 ld_directory..
4a60: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
4a70: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
4a80: 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 # NOTE: If the
4a90: 22 6e 61 74 69 76 65 22 20 72 75 6e 74 69 6d 65 "native" runtime
4aa0: 20 6f 70 74 69 6f 6e 20 69 73 20 73 65 74 2c 20 option is set,
4ab0: 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 the mixed-mode a
4ac0: 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 20 20 ssembly..
4ad0: 20 23 20 20 20 20 20 20 20 69 73 20 62 65 69 6e # is bein
4ae0: 67 20 74 65 73 74 65 64 2e 20 20 49 6e 20 74 68 g tested. In th
4af0: 61 74 20 63 61 73 65 2c 20 74 68 65 20 70 61 74 at case, the pat
4b00: 68 20 74 6f 20 74 68 65 20 62 75 69 6c 64 20 64 h to the build d
4b10: 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 irectory..
4b20: 20 20 23 20 20 20 20 20 20 20 77 69 6c 6c 20 63 # will c
4b30: 6f 6e 74 61 69 6e 20 74 68 65 20 70 6c 61 74 66 ontain the platf
4b40: 6f 72 6d 20 6e 61 6d 65 20 61 6e 64 20 61 6c 6c orm name and all
4b50: 20 74 68 65 20 62 69 6e 61 72 69 65 73 20 75 6e the binaries un
4b60: 64 65 72 20 74 65 73 74 0d 0a 20 20 20 20 20 20 der test..
4b70: 20 20 23 20 20 20 20 20 20 20 73 68 6f 75 6c 64 # should
4b80: 20 62 65 20 70 72 65 73 65 6e 74 20 69 6e 20 74 be present in t
4b90: 68 61 74 20 64 69 72 65 63 74 6f 72 79 2e 20 20 hat directory.
4ba0: 49 66 20 74 68 65 20 22 6e 61 74 69 76 65 22 20 If the "native"
4bb0: 72 75 6e 74 69 6d 65 0d 0a 20 20 20 20 20 20 20 runtime..
4bc0: 20 23 20 20 20 20 20 20 20 6f 70 74 69 6f 6e 20 # option
4bd0: 69 73 20 6e 6f 74 20 73 65 74 2c 20 74 68 65 20 is not set, the
4be0: 62 75 69 6c 64 20 64 69 72 65 63 74 6f 72 79 20 build directory
4bf0: 77 69 6c 6c 20 62 65 20 63 6f 6e 73 69 64 65 72 will be consider
4c00: 65 64 20 74 6f 20 62 65 0d 0a 20 20 20 20 20 20 ed to be..
4c10: 20 20 23 20 20 20 20 20 20 20 22 70 6c 61 74 66 # "platf
4c20: 6f 72 6d 2d 6e 65 75 74 72 61 6c 22 2c 20 77 69 orm-neutral", wi
4c30: 74 68 20 74 68 65 20 6e 6f 74 61 62 6c 65 20 65 th the notable e
4c40: 78 63 65 70 74 69 6f 6e 20 6f 66 20 61 6e 79 20 xception of any
4c50: 6e 61 74 69 76 65 0d 0a 20 20 20 20 20 20 20 20 native..
4c60: 23 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c 79 # assembly
4c70: 20 28 65 2e 67 2e 20 22 53 51 4c 69 74 65 2e 49 (e.g. "SQLite.I
4c80: 6e 74 65 72 6f 70 2e 64 6c 6c 22 29 20 63 6f 70 nterop.dll") cop
4c90: 69 65 64 20 74 68 65 72 65 20 64 75 72 69 6e 67 ied there during
4ca0: 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 the.. #
4cb0: 20 20 20 20 20 20 62 75 69 6c 64 20 70 72 6f 63 build proc
4cc0: 65 73 73 20 69 74 73 65 6c 66 2e 20 20 49 66 20 ess itself. If
4cd0: 74 68 65 20 62 75 69 6c 64 20 70 72 6f 63 65 73 the build proces
4ce0: 73 20 73 6f 6d 65 68 6f 77 20 64 6f 65 73 20 6e s somehow does n
4cf0: 6f 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ot.. #
4d00: 20 20 20 20 63 6f 70 79 20 74 68 65 20 6e 61 74 copy the nat
4d10: 69 76 65 20 61 73 73 65 6d 62 6c 79 20 66 6f 72 ive assembly for
4d20: 20 74 68 69 73 20 70 6c 61 74 66 6f 72 6d 2c 20 this platform,
4d30: 6d 6f 73 74 20 6f 66 20 74 68 65 20 74 65 73 74 most of the test
4d40: 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 s.. #
4d50: 20 20 20 69 6e 20 74 68 65 20 73 75 69 74 65 20 in the suite
4d60: 77 69 6c 6c 20 73 69 6d 70 6c 79 20 62 65 20 73 will simply be s
4d70: 6b 69 70 70 65 64 2e 20 20 47 65 6e 65 72 61 6c kipped. General
4d80: 6c 79 20 73 70 65 61 6b 69 6e 67 2c 20 74 68 65 ly speaking, the
4d90: 72 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 re.. #
4da0: 20 20 20 20 61 72 65 20 74 77 6f 20 77 61 79 73 are two ways
4db0: 20 74 6f 20 62 75 69 6c 64 20 74 68 65 20 62 69 to build the bi
4dc0: 6e 61 72 69 65 73 20 77 68 65 6e 20 70 72 65 70 naries when prep
4dd0: 61 72 69 6e 67 20 74 6f 20 72 75 6e 20 74 68 65 aring to run the
4de0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
4df0: 20 20 74 65 73 74 20 73 75 69 74 65 3a 0d 0a 20 test suite:..
4e00: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
4e10: 20 20 23 20 20 20 20 20 20 20 31 2e 20 42 75 69 # 1. Bui
4e20: 6c 64 20 74 68 65 20 73 65 70 61 72 61 74 65 20 ld the separate
4e30: 6d 61 6e 61 67 65 64 20 61 6e 64 20 6e 61 74 69 managed and nati
4e40: 76 65 20 61 73 73 65 6d 62 6c 69 65 73 20 75 73 ve assemblies us
4e50: 69 6e 67 20 73 6f 6d 65 0d 0a 20 20 20 20 20 20 ing some..
4e60: 20 20 23 20 20 20 20 20 20 20 20 20 20 63 6f 6d # com
4e70: 6d 61 6e 64 73 20 73 69 6d 69 6c 61 72 20 74 6f mands similar to
4e80: 3a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 :.. #..
4e90: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 #
4ea0: 20 62 75 69 6c 64 2e 62 61 74 20 24 7b 43 6f 6e build.bat ${Con
4eb0: 66 69 67 75 72 61 74 69 6f 6e 7d 4d 61 6e 61 67 figuration}Manag
4ec0: 65 64 4f 6e 6c 79 20 24 7b 50 6c 61 74 66 6f 72 edOnly ${Platfor
4ed0: 6d 7d 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 m}.. #
4ee0: 20 20 20 20 20 20 20 62 75 69 6c 64 2e 62 61 74 build.bat
4ef0: 20 24 7b 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e ${Configuration
4f00: 7d 4e 61 74 69 76 65 4f 6e 6c 79 20 24 7b 50 6c }NativeOnly ${Pl
4f10: 61 74 66 6f 72 6d 7d 0d 0a 20 20 20 20 20 20 20 atform}..
4f20: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 #.. #
4f30: 20 20 20 20 20 20 20 57 68 65 72 65 20 24 7b 43 Where ${C
4f40: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 7d 20 69 73 onfiguration} is
4f50: 20 65 69 74 68 65 72 20 22 44 65 62 75 67 22 20 either "Debug"
4f60: 6f 72 20 22 52 65 6c 65 61 73 65 22 20 61 6e 64 or "Release" and
4f70: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
4f80: 20 20 20 20 20 24 7b 50 6c 61 74 66 6f 72 6d 7d ${Platform}
4f90: 20 69 73 20 65 69 74 68 65 72 20 22 57 69 6e 33 is either "Win3
4fa0: 32 22 20 6f 72 20 22 78 36 34 22 2e 0d 0a 20 20 2" or "x64"...
4fb0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
4fc0: 20 23 20 20 20 20 20 20 20 32 2e 20 42 75 69 6c # 2. Buil
4fd0: 64 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 d the mixed-mode
4fe0: 20 61 73 73 65 6d 62 6c 79 20 75 73 69 6e 67 20 assembly using
4ff0: 61 20 63 6f 6d 6d 61 6e 64 20 73 69 6d 69 6c 61 a command simila
5000: 72 20 74 6f 3a 0d 0a 20 20 20 20 20 20 20 20 23 r to:.. #
5010: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
5020: 20 20 20 20 20 62 75 69 6c 64 2e 62 61 74 20 24 build.bat $
5030: 7b 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 7d 20 {Configuration}
5040: 24 7b 50 6c 61 74 66 6f 72 6d 7d 0d 0a 20 20 20 ${Platform}..
5050: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
5060: 23 20 20 20 20 20 20 20 20 20 20 57 68 65 72 65 # Where
5070: 20 24 7b 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e ${Configuration
5080: 7d 20 69 73 20 65 69 74 68 65 72 20 22 44 65 62 } is either "Deb
5090: 75 67 22 20 6f 72 20 22 52 65 6c 65 61 73 65 22 ug" or "Release"
50a0: 20 61 6e 64 0d 0a 20 20 20 20 20 20 20 20 23 20 and.. #
50b0: 20 20 20 20 20 20 20 20 20 24 7b 50 6c 61 74 66 ${Platf
50c0: 6f 72 6d 7d 20 69 73 20 65 69 74 68 65 72 20 22 orm} is either "
50d0: 57 69 6e 33 32 22 20 6f 72 20 22 78 36 34 22 2e Win32" or "x64".
50e0: 20 20 49 66 20 74 68 69 73 20 63 6f 6d 6d 61 6e If this comman
50f0: 64 20 69 73 0d 0a 20 20 20 20 20 20 20 20 23 20 d is.. #
5100: 20 20 20 20 20 20 20 20 20 75 73 65 64 2c 20 76 used, v
5110: 61 72 69 6f 75 73 20 74 65 73 74 73 20 74 68 61 arious tests tha
5120: 74 20 72 65 71 75 69 72 65 20 73 75 70 70 6c 65 t require supple
5130: 6d 65 6e 74 61 72 79 20 6d 61 6e 61 67 65 64 0d mentary managed.
5140: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
5150: 20 20 20 20 61 73 73 65 6d 62 6c 69 65 73 20 28 assemblies (
5160: 65 2e 67 2e 20 4c 49 4e 51 29 20 6d 61 79 20 62 e.g. LINQ) may b
5170: 65 20 73 6b 69 70 70 65 64 20 75 6e 6c 65 73 73 e skipped unless
5180: 20 74 68 6f 73 65 20 62 69 6e 61 72 69 65 73 0d those binaries.
5190: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
51a0: 20 20 20 20 61 72 65 20 73 75 62 73 65 71 75 65 are subseque
51b0: 6e 74 6c 79 20 63 6f 70 69 65 64 20 69 6e 74 6f ntly copied into
51c0: 20 74 68 65 20 63 6f 72 72 65 63 74 20 64 69 72 the correct dir
51d0: 65 63 74 6f 72 79 20 28 69 2e 65 2e 20 62 79 0d ectory (i.e. by.
51e0: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
51f0: 20 20 20 20 22 74 65 73 74 5f 61 6c 6c 2e 62 61 "test_all.ba
5200: 74 22 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d t")... #.
5210: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
5220: 20 4e 6f 74 65 20 74 68 61 74 20 61 6c 6c 20 6f Note that all o
5230: 66 20 74 68 65 20 62 75 69 6c 64 20 63 6f 6d 6d f the build comm
5240: 61 6e 64 73 20 61 62 6f 76 65 20 77 69 6c 6c 20 ands above will
5250: 64 65 66 61 75 6c 74 20 74 6f 20 75 73 69 6e 67 default to using
5260: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
5270: 20 20 74 68 65 20 6c 61 74 65 73 74 20 76 65 72 the latest ver
5280: 73 69 6f 6e 20 6f 66 20 4d 53 42 75 69 6c 64 20 sion of MSBuild
5290: 61 76 61 69 6c 61 62 6c 65 20 61 6e 64 20 74 68 available and th
52a0: 65 20 22 74 65 73 74 5f 79 65 61 72 22 20 6d 61 e "test_year" ma
52b0: 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 y.. #
52c0: 20 20 20 6e 65 65 64 20 74 6f 20 62 65 20 61 64 need to be ad
52d0: 6a 75 73 74 65 64 20 61 63 63 6f 72 64 69 6e 67 justed according
52e0: 6c 79 20 74 6f 20 61 63 74 75 61 6c 6c 79 20 72 ly to actually r
52f0: 75 6e 20 74 68 65 20 74 65 73 74 20 73 75 69 74 un the test suit
5300: 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 e... #
5310: 20 20 20 20 52 65 66 65 72 20 74 6f 20 74 68 65 Refer to the
5320: 20 63 6f 6d 6d 65 6e 74 73 20 69 6e 20 5b 67 65 comments in [ge
5330: 74 42 75 69 6c 64 59 65 61 72 5d 20 66 6f 72 20 tBuildYear] for
5340: 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e more information
5350: 20 6f 6e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 on.. #
5360: 20 20 20 20 20 68 6f 77 20 74 6f 20 73 65 74 20 how to set
5370: 74 68 69 73 20 76 61 72 69 61 62 6c 65 2e 0d 0a this variable...
5380: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
5390: 20 20 20 73 65 74 20 6e 61 74 69 76 65 20 5b 68 set native [h
53a0: 61 73 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 asRuntimeOption
53b0: 6e 61 74 69 76 65 5d 0d 0a 0d 0a 20 20 20 20 20 native]....
53c0: 20 20 20 72 65 74 75 72 6e 20 5b 6a 6f 69 6e 42 return [joinB
53d0: 75 69 6c 64 44 69 72 65 63 74 6f 72 79 20 24 6e uildDirectory $n
53e0: 61 74 69 76 65 20 5b 67 65 74 42 75 69 6c 64 42 ative [getBuildB
53f0: 61 73 65 44 69 72 65 63 74 6f 72 79 5d 20 5c 0d aseDirectory] \.
5400: 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 . [ge
5410: 74 42 75 69 6c 64 59 65 61 72 5d 20 5b 67 65 74 tBuildYear] [get
5420: 42 75 69 6c 64 50 6c 61 74 66 6f 72 6d 20 24 6e BuildPlatform $n
5430: 61 74 69 76 65 5d 20 5b 67 65 74 42 75 69 6c 64 ative] [getBuild
5440: 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5d 5d 0d Configuration]].
5450: 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d . }.. }.
5460: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 .... proc get
5470: 52 65 6c 65 61 73 65 56 65 72 73 69 6f 6e 20 7b ReleaseVersion {
5480: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
5490: 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 67 75 # NOTE: Figu
54a0: 72 65 20 6f 75 74 20 74 68 65 20 72 65 6c 65 61 re out the relea
54b0: 73 65 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 75 se version for u
54c0: 73 65 20 77 69 74 68 20 74 68 65 20 62 75 69 6c se with the buil
54d0: 64 20 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 d directory..
54e0: 20 20 20 23 20 20 20 20 20 20 20 77 68 65 6e 20 # when
54f0: 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 61 76 61 checking for ava
5500: 69 6c 61 62 6c 65 20 72 65 6c 65 61 73 65 73 2e ilable releases.
5510: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
5520: 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
5530: 73 20 3a 3a 72 65 6c 65 61 73 65 5f 76 65 72 73 s ::release_vers
5540: 69 6f 6e 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 ion] && \..
5550: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
5560: 67 74 68 20 24 3a 3a 72 65 6c 65 61 73 65 5f 76 gth $::release_v
5570: 65 72 73 69 6f 6e 5d 20 3e 20 30 7d 20 74 68 65 ersion] > 0} the
5580: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
5590: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
55a0: 54 68 65 20 72 65 6c 65 61 73 65 20 76 65 72 73 The release vers
55b0: 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 6f 76 65 ion has been ove
55c0: 72 72 69 64 64 65 6e 3b 20 74 68 65 72 65 66 6f rridden; therefo
55d0: 72 65 2c 20 75 73 65 20 69 74 0d 0a 20 20 20 20 re, use it..
55e0: 20 20 20 20 23 20 20 20 20 20 20 20 76 65 72 62 # verb
55f0: 61 74 69 6d 2e 0d 0a 20 20 20 20 20 20 20 20 23 atim... #
5600: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
5610: 20 24 3a 3a 72 65 6c 65 61 73 65 5f 76 65 72 73 $::release_vers
5620: 69 6f 6e 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 ion.. } els
5630: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a e {.. #..
5640: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
5650: 4e 6f 20 72 65 6c 65 61 73 65 20 76 65 72 73 69 No release versi
5660: 6f 6e 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2c on is available,
5670: 20 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 return an empty
5680: 20 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 string...
5690: 20 20 23 20 20 20 20 20 20 20 49 74 20 69 73 20 # It is
56a0: 69 6d 70 6f 72 74 61 6e 74 20 74 6f 20 72 65 74 important to ret
56b0: 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 73 74 72 urn an empty str
56c0: 69 6e 67 20 68 65 72 65 20 62 65 63 61 75 73 65 ing here because
56d0: 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 the.. #
56e0: 20 20 20 20 20 20 72 65 73 75 6c 74 20 6f 66 20 result of
56f0: 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 6d this procedure m
5700: 61 79 20 62 65 20 75 73 65 64 20 77 69 74 68 20 ay be used with
5710: 5b 66 69 6c 65 20 6a 6f 69 6e 5d 2e 0d 0a 20 20 [file join]...
5720: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
5730: 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 return ""..
5740: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
5750: 20 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 proc getBuild
5760: 46 69 6c 65 4e 61 6d 65 20 7b 20 66 69 6c 65 4e FileName { fileN
5770: 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 ame {platform ""
5780: 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a } } {.. #..
5790: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 # NOTE: Re
57a0: 74 75 72 6e 73 20 74 68 65 20 73 70 65 63 69 66 turns the specif
57b0: 69 65 64 20 66 69 6c 65 20 6e 61 6d 65 20 61 73 ied file name as
57c0: 20 69 66 20 69 74 20 77 65 72 65 20 6c 6f 63 61 if it were loca
57d0: 74 65 64 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 ted in the..
57e0: 20 20 23 20 20 20 20 20 20 20 62 75 69 6c 64 20 # build
57f0: 64 69 72 65 63 74 6f 72 79 2c 20 64 69 73 63 61 directory, disca
5800: 72 64 69 6e 67 20 61 6e 79 20 64 69 72 65 63 74 rding any direct
5810: 6f 72 79 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 ory information
5820: 70 72 65 73 65 6e 74 0d 0a 20 20 20 20 20 20 23 present.. #
5830: 20 20 20 20 20 20 20 69 6e 20 74 68 65 20 66 69 in the fi
5840: 6c 65 20 6e 61 6d 65 20 61 73 20 70 72 6f 76 69 le name as provi
5850: 64 65 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 ded by our calle
5860: 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 r... #..
5870: 20 20 20 73 65 74 20 72 65 73 75 6c 74 20 5b 66 set result [f
5880: 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5c ile nativename \
5890: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c .. [fil
58a0: 65 20 6a 6f 69 6e 20 5b 67 65 74 42 75 69 6c 64 e join [getBuild
58b0: 44 69 72 65 63 74 6f 72 79 5d 20 24 70 6c 61 74 Directory] $plat
58c0: 66 6f 72 6d 20 5b 66 69 6c 65 20 74 61 69 6c 20 form [file tail
58d0: 24 66 69 6c 65 4e 61 6d 65 5d 5d 5d 0d 0a 0d 0a $fileName]]]....
58e0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
58f0: 20 48 41 43 4b 3a 20 57 68 65 6e 20 72 75 6e 6e HACK: When runn
5900: 69 6e 67 20 6f 6e 20 57 6f 57 36 34 2c 20 61 73 ing on WoW64, as
5910: 73 75 6d 65 20 74 68 65 20 74 65 73 74 20 65 78 sume the test ex
5920: 65 63 75 74 61 62 6c 65 73 20 61 72 65 20 70 72 ecutables are pr
5930: 65 73 65 6e 74 0d 0a 20 20 20 20 20 20 23 20 20 esent.. #
5940: 20 20 20 20 20 77 69 74 68 20 74 68 65 20 22 33 with the "3
5950: 32 22 20 73 75 66 66 69 78 20 6f 6e 20 74 68 65 2" suffix on the
5960: 6d 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 m... #..
5970: 20 20 20 69 66 20 7b 5b 69 73 52 75 6e 6e 69 6e if {[isRunnin
5980: 67 57 6f 57 36 34 5d 20 26 26 20 5b 66 69 6c 65 gWoW64] && [file
5990: 20 65 78 74 65 6e 73 69 6f 6e 20 24 72 65 73 75 extension $resu
59a0: 6c 74 5d 20 65 71 20 22 2e 65 78 65 22 7d 20 74 lt] eq ".exe"} t
59b0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 hen {.. s
59c0: 65 74 20 72 65 73 75 6c 74 20 5b 61 70 70 65 6e et result [appen
59d0: 64 41 72 67 73 20 5b 66 69 6c 65 20 72 6f 6f 74 dArgs [file root
59e0: 6e 61 6d 65 20 24 72 65 73 75 6c 74 5d 20 33 32 name $result] 32
59f0: 2e 65 78 65 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a .exe].. }..
5a00: 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 .. return $
5a10: 72 65 73 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c result.. }...
5a20: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 45 78 .. proc getEx
5a30: 74 65 72 6e 61 6c 44 69 72 65 63 74 6f 72 79 20 ternalDirectory
5a40: 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 {} {.. #..
5a50: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 # NOTE: Thi
5a60: 73 20 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 s procedure retu
5a70: 72 6e 73 20 74 68 65 20 64 69 72 65 63 74 6f 72 rns the director
5a80: 79 20 77 68 65 72 65 20 74 68 65 20 65 78 74 65 y where the exte
5a90: 72 6e 61 6c 20 62 69 6e 61 72 79 0d 0a 20 20 20 rnal binary..
5aa0: 20 20 20 23 20 20 20 20 20 20 20 66 69 6c 65 73 # files
5ab0: 20 61 72 65 20 6c 6f 63 61 74 65 64 2e 0d 0a 20 are located...
5ac0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 #.. re
5ad0: 74 75 72 6e 20 5b 66 69 6c 65 20 6e 61 74 69 76 turn [file nativ
5ae0: 65 6e 61 6d 65 20 5b 66 69 6c 65 20 64 69 72 6e ename [file dirn
5af0: 61 6d 65 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d ame [file dirnam
5b00: 65 20 5b 69 6e 66 6f 20 62 69 6e 61 72 79 5d 5d e [info binary]]
5b10: 5d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 ]].. }.....
5b20: 20 20 70 72 6f 63 20 67 65 74 42 69 6e 61 72 79 proc getBinary
5b30: 44 69 72 65 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a Directory {} {..
5b40: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
5b50: 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f 63 NOTE: This proc
5b60: 65 64 75 72 65 20 72 65 74 75 72 6e 73 20 74 68 edure returns th
5b70: 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 e directory wher
5b80: 65 20 74 68 65 20 74 65 73 74 20 61 70 70 6c 69 e the test appli
5b90: 63 61 74 69 6f 6e 0d 0a 20 20 20 20 20 20 23 20 cation.. #
5ba0: 20 20 20 20 20 20 69 74 73 65 6c 66 20 28 69 2e itself (i.
5bb0: 65 2e 20 74 68 65 20 45 61 67 6c 65 20 73 68 65 e. the Eagle she
5bc0: 6c 6c 29 20 69 73 20 6c 6f 63 61 74 65 64 2e 20 ll) is located.
5bd0: 20 54 68 69 73 20 77 69 6c 6c 20 62 65 20 75 73 This will be us
5be0: 65 64 20 61 73 0d 0a 20 20 20 20 20 20 23 20 20 ed as.. #
5bf0: 20 20 20 20 20 74 68 65 20 64 65 73 74 69 6e 61 the destina
5c00: 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 63 6f 70 tion for the cop
5c10: 69 65 64 20 53 79 73 74 65 6d 2e 44 61 74 61 2e ied System.Data.
5c20: 53 51 4c 69 74 65 20 6e 61 74 69 76 65 20 61 6e SQLite native an
5c30: 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 d.. #
5c40: 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c managed assembl
5c50: 69 65 73 20 28 69 2e 65 2e 20 62 65 63 61 75 73 ies (i.e. becaus
5c60: 65 20 74 68 69 73 20 69 73 20 6f 6e 65 20 6f 66 e this is one of
5c70: 20 74 68 65 20 66 65 77 20 70 6c 61 63 65 73 0d the few places.
5c80: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 77 . # w
5c90: 68 65 72 65 20 74 68 65 20 43 4c 52 20 77 69 6c here the CLR wil
5ca0: 6c 20 61 63 74 75 61 6c 6c 79 20 66 69 6e 64 20 l actually find
5cb0: 61 6e 64 20 6c 6f 61 64 20 74 68 65 6d 20 70 72 and load them pr
5cc0: 6f 70 65 72 6c 79 29 2e 0d 0a 20 20 20 20 20 20 operly)...
5cd0: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e #.. if {[in
5ce0: 66 6f 20 65 78 69 73 74 73 20 3a 3a 62 69 6e 61 fo exists ::bina
5cf0: 72 79 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 26 ry_directory] &&
5d00: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 \.. [s
5d10: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a tring length $::
5d20: 62 69 6e 61 72 79 5f 64 69 72 65 63 74 6f 72 79 binary_directory
5d30: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
5d40: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
5d50: 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f # NOTE: The lo
5d60: 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 62 69 cation of the bi
5d70: 6e 61 72 79 20 64 69 72 65 63 74 6f 72 79 20 68 nary directory h
5d80: 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 64 as been overridd
5d90: 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 20 en;.. #
5da0: 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c 20 therefore,
5db0: 75 73 65 20 69 74 20 76 65 72 62 61 74 69 6d 2e use it verbatim.
5dc0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
5dd0: 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 62 return $::b
5de0: 69 6e 61 72 79 5f 64 69 72 65 63 74 6f 72 79 0d inary_directory.
5df0: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
5e00: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
5e10: 5b 69 6e 66 6f 20 62 69 6e 61 72 79 5d 0d 0a 20 [info binary]..
5e20: 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
5e30: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 45 78 .. proc getEx
5e40: 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 20 7b ternalFileName {
5e50: 20 66 69 6c 65 4e 61 6d 65 20 7d 20 7b 0d 0a 20 fileName } {..
5e60: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
5e70: 4e 4f 54 45 3a 20 52 65 74 75 72 6e 73 20 74 68 NOTE: Returns th
5e80: 65 20 73 70 65 63 69 66 69 65 64 20 66 69 6c 65 e specified file
5e90: 20 6e 61 6d 65 20 61 73 20 69 66 20 69 74 20 77 name as if it w
5ea0: 65 72 65 20 6c 6f 63 61 74 65 64 20 69 6e 20 74 ere located in t
5eb0: 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 he.. #
5ec0: 20 20 64 69 72 65 63 74 6f 72 79 20 63 6f 6e 74 directory cont
5ed0: 61 69 6e 69 6e 67 20 74 68 65 20 65 78 74 65 72 aining the exter
5ee0: 6e 61 6c 20 62 69 6e 61 72 69 65 73 2e 0d 0a 20 nal binaries...
5ef0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 #.. re
5f00: 74 75 72 6e 20 5b 66 69 6c 65 20 6e 61 74 69 76 turn [file nativ
5f10: 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
5f20: 20 5b 67 65 74 45 78 74 65 72 6e 61 6c 44 69 72 [getExternalDir
5f30: 65 63 74 6f 72 79 5d 20 24 66 69 6c 65 4e 61 6d ectory] $fileNam
5f40: 65 5d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 e]].. }.....
5f50: 20 20 20 70 72 6f 63 20 67 65 74 42 69 6e 61 72 proc getBinar
5f60: 79 46 69 6c 65 4e 61 6d 65 20 7b 20 66 69 6c 65 yFileName { file
5f70: 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 Name {platform "
5f80: 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d "} } {.. #.
5f90: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 . # NOTE: R
5fa0: 65 74 75 72 6e 73 20 74 68 65 20 73 70 65 63 69 eturns the speci
5fb0: 66 69 65 64 20 66 69 6c 65 20 6e 61 6d 65 20 61 fied file name a
5fc0: 73 20 69 66 20 69 74 20 77 65 72 65 20 6c 6f 63 s if it were loc
5fd0: 61 74 65 64 20 69 6e 20 74 68 65 0d 0a 20 20 20 ated in the..
5fe0: 20 20 20 23 20 20 20 20 20 20 20 62 69 6e 61 72 # binar
5ff0: 79 20 64 69 72 65 63 74 6f 72 79 2c 20 64 69 73 y directory, dis
6000: 63 61 72 64 69 6e 67 20 61 6e 79 20 64 69 72 65 carding any dire
6010: 63 74 6f 72 79 20 69 6e 66 6f 72 6d 61 74 69 6f ctory informatio
6020: 6e 20 70 72 65 73 65 6e 74 0d 0a 20 20 20 20 20 n present..
6030: 20 23 20 20 20 20 20 20 20 69 6e 20 74 68 65 20 # in the
6040: 66 69 6c 65 20 6e 61 6d 65 20 61 73 20 70 72 6f file name as pro
6050: 76 69 64 65 64 20 62 79 20 6f 75 72 20 63 61 6c vided by our cal
6060: 6c 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ler... #..
6070: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c return [fil
6080: 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5c 0d 0a e nativename \..
6090: 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
60a0: 6a 6f 69 6e 20 5b 67 65 74 42 69 6e 61 72 79 44 join [getBinaryD
60b0: 69 72 65 63 74 6f 72 79 5d 20 24 70 6c 61 74 66 irectory] $platf
60c0: 6f 72 6d 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 orm [file tail $
60d0: 66 69 6c 65 4e 61 6d 65 5d 5d 5d 0d 0a 20 20 20 fileName]]]..
60e0: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
60f0: 67 65 74 43 6f 72 65 42 69 6e 61 72 79 46 69 6c getCoreBinaryFil
6100: 65 4e 61 6d 65 20 7b 20 7b 70 6c 61 74 66 6f 72 eName { {platfor
6110: 6d 20 22 22 7d 20 7b 73 74 61 6e 64 61 72 64 20 m ""} {standard
6120: 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 false} } {..
6130: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
6140: 45 3a 20 52 65 74 75 72 6e 73 20 74 68 65 20 66 E: Returns the f
6150: 75 6c 6c 20 70 61 74 68 20 66 6f 72 20 74 68 65 ull path for the
6160: 20 66 69 6c 65 20 63 6f 6e 74 61 69 6e 69 6e 67 file containing
6170: 20 74 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 the SQLite core
6180: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
6190: 6e 61 74 69 76 65 20 6c 69 62 72 61 72 79 20 63 native library c
61a0: 6f 64 65 20 66 6f 72 20 74 68 69 73 20 70 6c 61 ode for this pla
61b0: 74 66 6f 72 6d 2e 20 20 46 69 72 73 74 2c 20 63 tform. First, c
61c0: 68 65 63 6b 20 61 6e 64 20 73 65 65 20 69 66 0d heck and see if.
61d0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 . # t
61e0: 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 20 6e he SQLite core n
61f0: 61 74 69 76 65 20 6c 69 62 72 61 72 79 20 68 61 ative library ha
6200: 73 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 6c s already been l
6210: 6f 61 64 65 64 2e 20 20 4e 65 78 74 2c 0d 0a 20 oaded. Next,..
6220: 20 20 20 20 20 23 20 20 20 20 20 20 20 66 61 6c # fal
6230: 6c 62 61 63 6b 20 74 6f 20 77 68 61 74 20 74 68 lback to what th
6240: 65 20 66 75 6c 6c 20 70 61 74 68 20 73 68 6f 75 e full path shou
6250: 6c 64 20 62 65 2c 20 62 61 73 65 64 20 6f 6e 20 ld be, based on
6260: 77 68 65 74 68 65 72 20 74 68 65 0d 0a 20 20 20 whether the..
6270: 20 20 20 23 20 20 20 20 20 20 20 6d 69 78 65 64 # mixed
6280: 2d 6d 6f 64 65 20 61 73 73 65 6d 62 6c 79 20 69 -mode assembly i
6290: 73 20 62 65 69 6e 67 20 75 73 65 64 20 61 6e 64 s being used and
62a0: 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 the name of the
62b0: 20 63 75 72 72 65 6e 74 0d 0a 20 20 20 20 20 20 current..
62c0: 23 20 20 20 20 20 20 20 70 6c 61 74 66 6f 72 6d # platform
62d0: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
62e0: 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
62f0: 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 object i
6300: 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f nvoke -flags +No
6310: 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 nPublic \..
6320: 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 System.Da
6330: 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 ta.SQLite.Unsafe
6340: 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 20 5f 53 NativeMethods _S
6350: 51 4c 69 74 65 4e 61 74 69 76 65 4d 6f 64 75 6c QLiteNativeModul
6360: 65 46 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 eFileName..
6370: 20 7d 20 66 69 6c 65 4e 61 6d 65 5d 20 3d 3d 20 } fileName] ==
6380: 30 20 26 26 20 5b 73 74 72 69 6e 67 20 6c 65 6e 0 && [string len
6390: 67 74 68 20 24 66 69 6c 65 4e 61 6d 65 5d 20 3e gth $fileName] >
63a0: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
63b0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
63c0: 20 4e 4f 54 45 3a 20 54 68 65 20 53 51 4c 69 74 NOTE: The SQLit
63d0: 65 20 63 6f 72 65 20 6e 61 74 69 76 65 20 6c 69 e core native li
63e0: 62 72 61 72 79 20 68 61 73 20 61 6c 72 65 61 64 brary has alread
63f0: 79 20 62 65 65 6e 20 6c 6f 61 64 65 64 20 76 69 y been loaded vi
6400: 61 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 a.. #
6410: 20 20 20 74 68 65 20 6e 61 74 69 76 65 20 6c 69 the native li
6420: 62 72 61 72 79 20 70 72 65 2d 6c 6f 61 64 65 72 brary pre-loader
6430: 2e 20 20 52 65 74 75 72 6e 20 74 68 61 74 20 66 . Return that f
6440: 69 6c 65 20 6e 61 6d 65 20 6e 6f 77 2e 0d 0a 20 ile name now...
6450: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
6460: 20 20 72 65 74 75 72 6e 20 24 66 69 6c 65 4e 61 return $fileNa
6470: 6d 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 me.. }....
6480: 20 20 20 20 20 69 66 20 7b 5b 68 61 73 52 75 6e if {[hasRun
6490: 74 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 69 76 timeOption nativ
64a0: 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
64b0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
64c0: 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 74 68 NOTE: Return th
64d0: 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 e mixed-mode ass
64e0: 65 6d 62 6c 79 20 66 69 6c 65 20 6e 61 6d 65 2e embly file name.
64f0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
6500: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c return [fil
6510: 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5c 0d 0a e nativename \..
6520: 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c [fil
6530: 65 20 6a 6f 69 6e 20 5b 67 65 74 42 69 6e 61 72 e join [getBinar
6540: 79 44 69 72 65 63 74 6f 72 79 5d 20 24 70 6c 61 yDirectory] $pla
6550: 74 66 6f 72 6d 20 53 79 73 74 65 6d 2e 44 61 74 tform System.Dat
6560: 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5d 5d 0d 0a a.SQLite.dll]]..
6570: 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b } elseif {
6580: 24 73 74 61 6e 64 61 72 64 7d 20 74 68 65 6e 20 $standard} then
6590: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
65a0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 # NOTE: Re
65b0: 74 75 72 6e 20 74 68 65 20 6e 61 74 69 76 65 2d turn the native-
65c0: 6f 6e 6c 79 20 73 74 61 6e 64 61 72 64 20 53 51 only standard SQ
65d0: 4c 69 74 65 20 6c 69 62 72 61 72 79 20 66 69 6c Lite library fil
65e0: 65 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 20 20 e name...
65f0: 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 #.. retu
6600: 72 6e 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e rn [file nativen
6610: 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ame \..
6620: 20 20 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 [file join [g
6630: 65 74 42 69 6e 61 72 79 44 69 72 65 63 74 6f 72 etBinaryDirector
6640: 79 5d 20 24 70 6c 61 74 66 6f 72 6d 20 73 71 6c y] $platform sql
6650: 69 74 65 33 2e 64 6c 6c 5d 5d 0d 0a 20 20 20 20 ite3.dll]]..
6660: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
6670: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
6680: 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 74 68 NOTE: Return th
6690: 65 20 6e 61 74 69 76 65 2d 6f 6e 6c 79 20 69 6e e native-only in
66a0: 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 66 terop assembly f
66b0: 69 6c 65 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 ile name...
66c0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 #.. re
66d0: 74 75 72 6e 20 5b 66 69 6c 65 20 6e 61 74 69 76 turn [file nativ
66e0: 65 6e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 ename \..
66f0: 20 20 20 20 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 [file join
6700: 5b 67 65 74 42 69 6e 61 72 79 44 69 72 65 63 74 [getBinaryDirect
6710: 6f 72 79 5d 20 24 70 6c 61 74 66 6f 72 6d 20 53 ory] $platform S
6720: 51 4c 69 74 65 2e 49 6e 74 65 72 6f 70 2e 64 6c QLite.Interop.dl
6730: 6c 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 l]].. }..
6740: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
6750: 20 67 65 74 43 6f 6d 6d 6f 6e 44 69 72 65 63 74 getCommonDirect
6760: 6f 72 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 ory {} {..
6770: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
6780: 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 This procedure
6790: 72 65 74 75 72 6e 73 20 74 68 65 20 64 69 72 65 returns the dire
67a0: 63 74 6f 72 79 20 77 68 65 72 65 20 74 68 65 20 ctory where the
67b0: 74 65 73 74 20 73 63 72 69 70 74 73 0d 0a 20 20 test scripts..
67c0: 20 20 20 20 23 20 20 20 20 20 20 20 73 68 6f 75 # shou
67d0: 6c 64 20 62 65 20 6c 6f 63 61 74 65 64 2e 20 20 ld be located.
67e0: 42 79 20 64 65 66 61 75 6c 74 2c 20 74 68 69 73 By default, this
67f0: 20 6a 75 73 74 20 72 65 74 75 72 6e 73 20 74 68 just returns th
6800: 65 20 45 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 e Eagle.. #
6810: 20 20 20 20 20 20 20 62 69 6e 61 72 79 20 64 69 binary di
6820: 72 65 63 74 6f 72 79 2e 0d 0a 20 20 20 20 20 20 rectory...
6830: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e #.. if {[in
6840: 66 6f 20 65 78 69 73 74 73 20 3a 3a 63 6f 6d 6d fo exists ::comm
6850: 6f 6e 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 26 on_directory] &&
6860: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 \.. [s
6870: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a tring length $::
6880: 63 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 common_directory
6890: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
68a0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
68b0: 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f # NOTE: The lo
68c0: 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 6f cation of the co
68d0: 6d 6d 6f 6e 20 64 69 72 65 63 74 6f 72 79 20 68 mmon directory h
68e0: 61 73 20 62 65 65 6e 20 73 65 74 3b 0d 0a 20 20 as been set;..
68f0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 # th
6900: 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 2e erefore, use it.
6910: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
6920: 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 63 return $::c
6930: 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 0d ommon_directory.
6940: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 . } elseif
6950: 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a {[info exists ::
6960: 76 65 6e 64 6f 72 5f 64 69 72 65 63 74 6f 72 79 vendor_directory
6970: 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] && \..
6980: 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
6990: 20 24 3a 3a 76 65 6e 64 6f 72 5f 64 69 72 65 63 $::vendor_direc
69a0: 74 6f 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 tory] > 0} then
69b0: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
69c0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 # NOTE: Th
69d0: 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 e location of th
69e0: 65 20 76 65 6e 64 6f 72 20 64 69 72 65 63 74 6f e vendor directo
69f0: 72 79 20 68 61 73 20 62 65 65 6e 20 73 65 74 3b ry has been set;
6a00: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
6a10: 20 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 therefore, use
6a20: 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d it... #.
6a30: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
6a40: 24 3a 3a 76 65 6e 64 6f 72 5f 64 69 72 65 63 74 $::vendor_direct
6a50: 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 ory.. } els
6a60: 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 eif {[info exist
6a70: 73 20 3a 3a 74 63 6c 5f 6c 69 62 72 61 72 79 5d s ::tcl_library]
6a80: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
6a90: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
6aa0: 24 3a 3a 74 63 6c 5f 6c 69 62 72 61 72 79 5d 20 $::tcl_library]
6ab0: 3e 20 30 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 > 0 && \..
6ac0: 20 20 20 20 5b 66 69 6c 65 20 69 73 64 69 72 65 [file isdire
6ad0: 63 74 6f 72 79 20 24 3a 3a 74 63 6c 5f 6c 69 62 ctory $::tcl_lib
6ae0: 72 61 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 rary]} then {..
6af0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
6b00: 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 76 61 # NOTE: The va
6b10: 72 69 61 62 6c 65 20 77 69 74 68 20 74 68 65 20 riable with the
6b20: 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 location of the
6b30: 73 63 72 69 70 74 20 6c 69 62 72 61 72 79 20 69 script library i
6b40: 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 s.. #
6b50: 20 20 20 73 65 74 20 61 6e 64 20 61 70 70 65 61 set and appea
6b60: 72 73 20 74 6f 20 62 65 20 61 20 72 65 61 6c 20 rs to be a real
6b70: 64 69 72 65 63 74 6f 72 79 20 28 69 2e 65 2e 20 directory (i.e.
6b80: 6e 6f 74 20 65 6d 62 65 64 64 65 64 0d 0a 20 20 not embedded..
6b90: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 77 69 # wi
6ba0: 74 68 69 6e 20 61 20 66 69 6c 65 29 3b 20 74 68 thin a file); th
6bb0: 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 2e erefore, use it.
6bc0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
6bd0: 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 74 return $::t
6be0: 63 6c 5f 6c 69 62 72 61 72 79 0d 0a 20 20 20 20 cl_library..
6bf0: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
6c00: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
6c10: 20 4e 4f 54 45 3a 20 46 61 6c 6c 62 61 63 6b 20 NOTE: Fallback
6c20: 74 6f 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 to the directory
6c30: 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 containing the
6c40: 65 78 65 63 75 74 61 62 6c 65 2e 0d 0a 20 20 20 executable...
6c50: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
6c60: 72 65 74 75 72 6e 20 5b 69 6e 66 6f 20 62 69 6e return [info bin
6c70: 61 72 79 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 ary].. }..
6c80: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
6c90: 63 20 67 65 74 44 61 74 61 62 61 73 65 44 69 72 c getDatabaseDir
6ca0: 65 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a 20 20 20 ectory {} {..
6cb0: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
6cc0: 54 45 3a 20 54 68 69 73 20 70 72 6f 63 65 64 75 TE: This procedu
6cd0: 72 65 20 72 65 74 75 72 6e 73 20 74 68 65 20 64 re returns the d
6ce0: 69 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 irectory where t
6cf0: 68 65 20 74 65 73 74 20 64 61 74 61 62 61 73 65 he test database
6d00: 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 s.. #
6d10: 20 73 68 6f 75 6c 64 20 62 65 20 6c 6f 63 61 74 should be locat
6d20: 65 64 2e 20 20 42 79 20 64 65 66 61 75 6c 74 2c ed. By default,
6d30: 20 74 68 69 73 20 6a 75 73 74 20 75 73 65 73 20 this just uses
6d40: 74 68 65 20 74 65 6d 70 6f 72 61 72 79 0d 0a 20 the temporary..
6d50: 20 20 20 20 20 23 20 20 20 20 20 20 20 64 69 72 # dir
6d60: 65 63 74 6f 72 79 20 63 6f 6e 66 69 67 75 72 65 ectory configure
6d70: 64 20 66 6f 72 20 74 68 69 73 20 73 79 73 74 65 d for this syste
6d80: 6d 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 m... #..
6d90: 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 if {[info exi
6da0: 73 74 73 20 3a 3a 64 61 74 61 62 61 73 65 5f 64 sts ::database_d
6db0: 69 72 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a irectory] && \..
6dc0: 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
6dd0: 67 20 6c 65 6e 67 74 68 20 24 3a 3a 64 61 74 61 g length $::data
6de0: 62 61 73 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 base_directory]
6df0: 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
6e00: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
6e10: 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 # NOTE: The loca
6e20: 74 69 6f 6e 20 6f 66 20 74 68 65 20 64 61 74 61 tion of the data
6e30: 62 61 73 65 20 64 69 72 65 63 74 6f 72 79 20 68 base directory h
6e40: 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 64 as been overridd
6e50: 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 20 en;.. #
6e60: 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c 20 therefore,
6e70: 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 use it...
6e80: 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 #.. retu
6e90: 72 6e 20 24 3a 3a 64 61 74 61 62 61 73 65 5f 64 rn $::database_d
6ea0: 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 irectory..
6eb0: 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 6f 20 } elseif {[info
6ec0: 65 78 69 73 74 73 20 3a 3a 73 63 72 61 74 63 68 exists ::scratch
6ed0: 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 26 20 5c _directory] && \
6ee0: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 .. [str
6ef0: 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 73 63 ing length $::sc
6f00: 72 61 74 63 68 5f 64 69 72 65 63 74 6f 72 79 5d ratch_directory]
6f10: 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
6f20: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
6f30: 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 # NOTE: The loc
6f40: 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 63 72 ation of the scr
6f50: 61 74 63 68 20 64 69 72 65 63 74 6f 72 79 20 68 atch directory h
6f60: 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 64 as been overridd
6f70: 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 20 en;.. #
6f80: 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c 20 therefore,
6f90: 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 use it...
6fa0: 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 #.. retu
6fb0: 72 6e 20 24 3a 3a 73 63 72 61 74 63 68 5f 64 69 rn $::scratch_di
6fc0: 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d rectory.. }
6fd0: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
6fe0: 20 72 65 74 75 72 6e 20 5b 67 65 74 54 65 6d 70 return [getTemp
6ff0: 6f 72 61 72 79 50 61 74 68 5d 0d 0a 20 20 20 20 oraryPath]..
7000: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
7010: 20 20 20 70 72 6f 63 20 67 65 74 54 65 6d 70 6f proc getTempo
7020: 72 61 72 79 44 69 72 65 63 74 6f 72 79 20 7b 7d raryDirectory {}
7030: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
7040: 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 # NOTE: This
7050: 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 72 6e procedure return
7060: 73 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 s the directory
7070: 77 68 65 72 65 20 74 68 65 20 74 65 6d 70 6f 72 where the tempor
7080: 61 72 79 20 66 69 6c 65 73 0d 0a 20 20 20 20 20 ary files..
7090: 20 23 20 20 20 20 20 20 20 73 68 6f 75 6c 64 20 # should
70a0: 62 65 20 6c 6f 63 61 74 65 64 2e 20 20 42 79 20 be located. By
70b0: 64 65 66 61 75 6c 74 2c 20 74 68 69 73 20 6a 75 default, this ju
70c0: 73 74 20 75 73 65 73 20 74 68 65 20 74 65 6d 70 st uses the temp
70d0: 6f 72 61 72 79 0d 0a 20 20 20 20 20 20 23 20 20 orary.. #
70e0: 20 20 20 20 20 64 69 72 65 63 74 6f 72 79 20 63 directory c
70f0: 6f 6e 66 69 67 75 72 65 64 20 66 6f 72 20 74 68 onfigured for th
7100: 69 73 20 73 79 73 74 65 6d 2e 0d 0a 20 20 20 20 is system...
7110: 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
7120: 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 info exists ::te
7130: 6d 70 6f 72 61 72 79 5f 64 69 72 65 63 74 6f 72 mporary_director
7140: 79 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 y] && \..
7150: 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 [string lengt
7160: 68 20 24 3a 3a 74 65 6d 70 6f 72 61 72 79 5f 64 h $::temporary_d
7170: 69 72 65 63 74 6f 72 79 5d 20 3e 20 30 7d 20 74 irectory] > 0} t
7180: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
7190: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
71a0: 3a 20 54 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f : The location o
71b0: 66 20 74 68 65 20 74 65 6d 70 6f 72 61 72 79 20 f the temporary
71c0: 64 69 72 65 63 74 6f 72 79 20 68 61 73 20 62 65 directory has be
71d0: 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d 0a en overridden;..
71e0: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
71f0: 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 therefore, use i
7200: 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 t... #..
7210: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a return $:
7220: 3a 74 65 6d 70 6f 72 61 72 79 5f 64 69 72 65 63 :temporary_direc
7230: 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c tory.. } el
7240: 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 seif {[info exis
7250: 74 73 20 3a 3a 73 63 72 61 74 63 68 5f 64 69 72 ts ::scratch_dir
7260: 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a 20 20 ectory] && \..
7270: 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
7280: 6c 65 6e 67 74 68 20 24 3a 3a 73 63 72 61 74 63 length $::scratc
7290: 68 5f 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 30 h_directory] > 0
72a0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
72b0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
72c0: 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 74 69 6f OTE: The locatio
72d0: 6e 20 6f 66 20 74 68 65 20 73 63 72 61 74 63 68 n of the scratch
72e0: 20 64 69 72 65 63 74 6f 72 79 20 68 61 73 20 62 directory has b
72f0: 65 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d een overridden;.
7300: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
7310: 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 therefore, use
7320: 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a it... #..
7330: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
7340: 3a 3a 73 63 72 61 74 63 68 5f 64 69 72 65 63 74 ::scratch_direct
7350: 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 ory.. } els
7360: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 e {.. ret
7370: 75 72 6e 20 5b 67 65 74 54 65 6d 70 6f 72 61 72 urn [getTemporar
7380: 79 50 61 74 68 5d 0d 0a 20 20 20 20 20 20 7d 0d yPath].. }.
7390: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
73a0: 72 6f 63 20 67 65 74 45 78 65 63 75 74 65 4f 6e roc getExecuteOn
73b0: 53 65 74 75 70 20 7b 7d 20 7b 0d 0a 20 20 20 20 Setup {} {..
73c0: 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
73d0: 74 73 20 3a 3a 65 78 65 63 75 74 65 5f 6f 6e 5f ts ::execute_on_
73e0: 73 65 74 75 70 5d 20 26 26 20 5c 0d 0a 20 20 20 setup] && \..
73f0: 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c [string l
7400: 65 6e 67 74 68 20 24 3a 3a 65 78 65 63 75 74 65 ength $::execute
7410: 5f 6f 6e 5f 73 65 74 75 70 5d 20 3e 20 30 7d 20 _on_setup] > 0}
7420: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
7430: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
7440: 45 3a 20 52 65 74 75 72 6e 20 74 68 65 20 63 6f E: Return the co
7450: 6e 66 69 67 75 72 65 64 20 53 51 4c 20 74 6f 20 nfigured SQL to
7460: 65 78 65 63 75 74 65 20 64 75 72 69 6e 67 20 74 execute during t
7470: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 0d 0a 20 he connection..
7480: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 # s
7490: 65 74 75 70 20 70 72 6f 63 65 64 75 72 65 20 28 etup procedure (
74a0: 69 2e 65 2e 20 66 6f 72 20 65 76 65 72 79 20 74 i.e. for every t
74b0: 65 73 74 20 64 61 74 61 62 61 73 65 20 63 6f 6e est database con
74c0: 6e 65 63 74 69 6f 6e 29 2e 0d 0a 20 20 20 20 20 nection)...
74d0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 #.. re
74e0: 74 75 72 6e 20 24 3a 3a 65 78 65 63 75 74 65 5f turn $::execute_
74f0: 6f 6e 5f 73 65 74 75 70 0d 0a 20 20 20 20 20 20 on_setup..
7500: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
7510: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
7520: 4f 54 45 3a 20 42 79 20 64 65 66 61 75 6c 74 2c OTE: By default,
7530: 20 74 68 65 72 65 20 69 73 20 6e 6f 20 53 51 4c there is no SQL
7540: 20 74 6f 20 65 78 65 63 75 74 65 20 64 75 72 69 to execute duri
7550: 6e 67 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f ng the connectio
7560: 6e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 n.. #
7570: 20 20 20 73 65 74 75 70 20 70 72 6f 63 65 64 75 setup procedu
7580: 72 65 20 28 69 2e 65 2e 20 66 6f 72 20 65 76 65 re (i.e. for eve
7590: 72 79 20 74 65 73 74 20 64 61 74 61 62 61 73 65 ry test database
75a0: 20 63 6f 6e 6e 65 63 74 69 6f 6e 29 2e 0d 0a 20 connection)...
75b0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
75c0: 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 return ""..
75d0: 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
75e0: 20 20 20 20 70 72 6f 63 20 67 65 74 54 65 73 74 proc getTest
75f0: 4f 76 65 72 72 69 64 65 73 50 72 65 61 6d 62 6c OverridesPreambl
7600: 65 20 7b 20 7b 65 78 74 72 61 56 61 72 4e 61 6d e { {extraVarNam
7610: 65 73 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 es ""} } {..
7620: 20 20 73 65 74 20 76 61 72 4e 61 6d 65 73 20 5b set varNames [
7630: 6c 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 list].... #
7640: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
7650: 49 66 20 61 76 61 69 6c 61 62 6c 65 2c 20 73 74 If available, st
7660: 61 72 74 20 77 69 74 68 20 74 68 65 20 6d 61 73 art with the mas
7670: 74 65 72 20 6c 69 73 74 20 6f 66 20 74 65 73 74 ter list of test
7680: 20 6f 76 65 72 72 69 64 65 0d 0a 20 20 20 20 20 override..
7690: 20 23 20 20 20 20 20 20 20 76 61 72 69 61 62 6c # variabl
76a0: 65 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 es... #..
76b0: 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
76c0: 69 73 74 73 20 3a 3a 74 65 73 74 5f 6f 76 65 72 ists ::test_over
76d0: 72 69 64 65 73 5d 20 26 26 20 5c 0d 0a 20 20 20 rides] && \..
76e0: 20 20 20 20 20 20 20 5b 6c 6c 65 6e 67 74 68 20 [llength
76f0: 24 3a 3a 74 65 73 74 5f 6f 76 65 72 72 69 64 65 $::test_override
7700: 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a s] > 0} then {..
7710: 20 20 20 20 20 20 20 20 65 76 61 6c 20 6c 61 70 eval lap
7720: 70 65 6e 64 20 76 61 72 4e 61 6d 65 73 20 24 3a pend varNames $:
7730: 3a 74 65 73 74 5f 6f 76 65 72 72 69 64 65 73 0d :test_overrides.
7740: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
7750: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
7760: 45 3a 20 49 66 20 72 65 71 75 65 73 74 65 64 20 E: If requested
7770: 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 2c 20 61 by our caller, a
7780: 64 64 20 61 6e 79 20 61 64 64 69 74 69 6f 6e 61 dd any additiona
7790: 6c 20 76 61 72 69 61 62 6c 65 0d 0a 20 20 20 20 l variable..
77a0: 20 20 23 20 20 20 20 20 20 20 6e 61 6d 65 73 20 # names
77b0: 74 6f 20 63 6f 70 79 20 6e 6f 77 2e 0d 0a 20 20 to copy now...
77c0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
77d0: 7b 5b 6c 6c 65 6e 67 74 68 20 24 65 78 74 72 61 {[llength $extra
77e0: 56 61 72 4e 61 6d 65 73 5d 20 3e 20 30 7d 20 74 VarNames] > 0} t
77f0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 65 hen {.. e
7800: 76 61 6c 20 6c 61 70 70 65 6e 64 20 76 61 72 4e val lappend varN
7810: 61 6d 65 73 20 24 65 78 74 72 61 56 61 72 4e 61 ames $extraVarNa
7820: 6d 65 73 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a mes.. }....
7830: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
7840: 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 NOTE: Build the
7850: 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 script fragment
7860: 20 74 6f 20 62 65 20 72 65 74 75 72 6e 65 64 20 to be returned
7870: 62 79 20 70 72 6f 63 65 73 73 69 6e 67 20 65 61 by processing ea
7880: 63 68 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ch.. #
7890: 20 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 20 variable name
78a0: 61 6e 64 20 61 64 64 69 6e 67 20 74 68 65 20 6e and adding the n
78b0: 65 63 65 63 65 73 73 61 72 79 20 73 63 72 69 70 ececessary scrip
78c0: 74 20 66 72 61 67 6d 65 6e 74 73 20 66 6f 72 0d t fragments for.
78d0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 65 . # e
78e0: 61 63 68 20 6f 6e 65 2e 0d 0a 20 20 20 20 20 20 ach one...
78f0: 23 0d 0a 20 20 20 20 20 20 73 65 74 20 72 65 73 #.. set res
7900: 75 6c 74 20 22 22 0d 0a 0d 0a 20 20 20 20 20 20 ult ""....
7910: 66 6f 72 65 61 63 68 20 76 61 72 4e 61 6d 65 20 foreach varName
7920: 24 76 61 72 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 $varNames {..
7930: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
7940: 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 # NOTE: Build th
7950: 65 20 71 75 61 6c 69 66 69 65 64 20 67 6c 6f 62 e qualified glob
7960: 61 6c 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 al variable name
7970: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
7980: 20 20 20 20 20 20 73 65 74 20 66 75 6c 6c 56 61 set fullVa
7990: 72 4e 61 6d 65 20 5b 61 70 70 65 6e 64 41 72 67 rName [appendArg
79a0: 73 20 3a 3a 20 24 76 61 72 4e 61 6d 65 5d 0d 0a s :: $varName]..
79b0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
79c0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 6f 65 # NOTE: Doe
79d0: 73 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 65 s the variable e
79e0: 78 69 73 74 20 69 6e 20 74 68 69 73 20 69 6e 74 xist in this int
79f0: 65 72 70 72 65 74 65 72 20 63 6f 6e 74 65 78 74 erpreter context
7a00: 3f 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ?.. #..
7a10: 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 if {[info
7a20: 65 78 69 73 74 73 20 24 66 75 6c 6c 56 61 72 4e exists $fullVarN
7a30: 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ame]} then {..
7a40: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
7a50: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 70 70 # NOTE: App
7a60: 65 6e 64 20 61 20 73 63 72 69 70 74 20 66 72 61 end a script fra
7a70: 67 6d 65 6e 74 20 74 6f 20 74 68 65 20 72 65 73 gment to the res
7a80: 75 6c 74 20 74 68 61 74 20 77 69 6c 6c 20 63 6f ult that will co
7a90: 72 72 65 63 74 6c 79 0d 0a 20 20 20 20 20 20 20 rrectly..
7aa0: 20 20 20 23 20 20 20 20 20 20 20 63 6f 70 79 20 # copy
7ab0: 61 6e 79 20 63 6f 6e 74 61 69 6e 65 64 20 76 61 any contained va
7ac0: 6c 75 65 20 74 6f 20 61 6e 6f 74 68 65 72 20 69 lue to another i
7ad0: 6e 74 65 72 70 72 65 74 65 72 20 63 6f 6e 74 65 nterpreter conte
7ae0: 78 74 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 xt... #
7af0: 0d 0a 20 20 20 20 20 20 20 20 20 20 61 70 70 65 .. appe
7b00: 6e 64 20 72 65 73 75 6c 74 20 5c 6e 20 22 73 65 nd result \n "se
7b10: 74 20 22 20 24 66 75 6c 6c 56 61 72 4e 61 6d 65 t " $fullVarName
7b20: 20 22 20 5c 7b 22 20 5b 73 65 74 20 24 66 75 6c " \{" [set $ful
7b30: 6c 56 61 72 4e 61 6d 65 5d 20 5c 7d 0d 0a 20 20 lVarName] \}..
7b40: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
7b50: 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
7b60: 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 # NOTE: If th
7b70: 65 20 72 65 73 75 6c 74 20 63 6f 6e 74 61 69 6e e result contain
7b80: 73 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 73 63 s one or more sc
7b90: 72 69 70 74 20 66 72 61 67 6d 65 6e 74 73 2c 20 ript fragments,
7ba0: 61 70 70 65 6e 64 20 61 0d 0a 20 20 20 20 20 20 append a..
7bb0: 23 20 20 20 20 20 20 20 6e 65 77 6c 69 6e 65 2e # newline.
7bc0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
7bd0: 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
7be0: 67 74 68 20 24 72 65 73 75 6c 74 5d 20 3e 20 30 gth $result] > 0
7bf0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
7c00: 20 20 61 70 70 65 6e 64 20 72 65 73 75 6c 74 20 append result
7c10: 5c 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 \n.. }....
7c20: 20 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 return $res
7c30: 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 ult.. }.....
7c40: 20 20 20 70 72 6f 63 20 67 65 74 41 70 70 44 6f proc getAppDo
7c50: 6d 61 69 6e 50 72 65 61 6d 62 6c 65 20 7b 20 7b mainPreamble { {
7c60: 70 72 65 66 69 78 20 22 22 7d 20 7b 73 75 66 66 prefix ""} {suff
7c70: 69 78 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 ix ""} } {..
7c80: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
7c90: 45 3a 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 E: This procedur
7ca0: 65 20 72 65 74 75 72 6e 73 20 61 20 74 65 73 74 e returns a test
7cb0: 20 73 65 74 75 70 20 73 63 72 69 70 74 20 66 72 setup script fr
7cc0: 61 67 6d 65 6e 74 20 73 75 69 74 61 62 6c 65 20 agment suitable
7cd0: 66 6f 72 0d 0a 20 20 20 20 20 20 23 20 20 20 20 for.. #
7ce0: 20 20 20 65 76 61 6c 75 61 74 69 6f 6e 20 62 79 evaluation by
7cf0: 20 61 6e 20 69 6e 74 65 72 70 72 65 74 65 72 20 an interpreter
7d00: 63 72 65 61 74 65 64 20 69 6e 20 61 6e 20 69 73 created in an is
7d10: 6f 6c 61 74 65 64 20 61 70 70 6c 69 63 61 74 69 olated applicati
7d20: 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 on.. #
7d30: 20 20 64 6f 6d 61 69 6e 2e 20 20 54 68 65 20 73 domain. The s
7d40: 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 20 62 cript fragment b
7d50: 65 69 6e 67 20 72 65 74 75 72 6e 65 64 20 77 69 eing returned wi
7d60: 6c 6c 20 62 65 20 73 75 72 72 6f 75 6e 64 65 64 ll be surrounded
7d70: 20 62 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 by.. #
7d80: 20 20 20 74 68 65 20 70 72 65 66 69 78 20 61 6e the prefix an
7d90: 64 20 73 75 66 66 69 78 20 22 73 63 72 69 70 74 d suffix "script
7da0: 20 66 72 61 67 6d 65 6e 74 73 22 20 73 70 65 63 fragments" spec
7db0: 69 66 69 65 64 20 62 79 20 6f 75 72 20 63 61 6c ified by our cal
7dc0: 6c 65 72 2c 0d 0a 20 20 20 20 20 20 23 20 20 20 ler,.. #
7dd0: 20 20 20 20 69 66 20 61 6e 79 2e 20 20 54 68 65 if any. The
7de0: 20 65 6e 74 69 72 65 20 73 63 72 69 70 74 20 62 entire script b
7df0: 65 69 6e 67 20 72 65 74 75 72 6e 65 64 20 77 69 eing returned wi
7e00: 6c 6c 20 62 65 20 73 75 62 73 74 69 74 75 74 65 ll be substitute
7e10: 64 20 76 69 61 0d 0a 20 20 20 20 20 20 23 20 20 d via.. #
7e20: 20 20 20 20 20 5b 73 75 62 73 74 5d 2c 20 69 6e [subst], in
7e30: 20 74 68 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 the context of
7e40: 6f 75 72 20 63 61 6c 6c 65 72 2c 20 62 65 66 6f our caller, befo
7e50: 72 65 20 62 65 69 6e 67 20 72 65 74 75 72 6e 65 re being returne
7e60: 64 2e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 d... #
7e70: 20 20 54 68 69 73 20 73 74 65 70 20 69 73 20 6e This step is n
7e80: 65 63 65 73 73 61 72 79 20 73 6f 20 74 68 61 74 ecessary so that
7e90: 20 73 6f 6d 65 20 6c 69 6d 69 74 65 64 20 63 6f some limited co
7ea0: 6e 74 65 78 74 20 69 6e 66 6f 72 6d 61 74 69 6f ntext informatio
7eb0: 6e 2c 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 n,.. #
7ec0: 20 20 70 72 69 6d 61 72 69 6c 79 20 72 65 6c 61 primarily rela
7ed0: 74 65 64 20 74 6f 20 74 68 65 20 74 65 73 74 69 ted to the testi
7ee0: 6e 67 20 64 69 72 65 63 74 6f 72 69 65 73 2c 20 ng directories,
7ef0: 63 61 6e 20 62 65 20 74 72 61 6e 73 66 65 72 72 can be transferr
7f00: 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ed.. #
7f10: 20 20 74 6f 20 74 68 65 20 69 6e 74 65 72 70 72 to the interpr
7f20: 65 74 65 72 20 69 6e 20 74 68 65 20 69 73 6f 6c eter in the isol
7f30: 61 74 65 64 20 61 70 70 6c 69 63 61 74 69 6f 6e ated application
7f40: 20 64 6f 6d 61 69 6e 2c 20 6d 61 6b 69 6e 67 20 domain, making
7f50: 69 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 it.. #
7f60: 20 20 61 62 6c 65 20 74 6f 20 73 75 63 63 65 73 able to succes
7f70: 73 66 75 6c 6c 79 20 72 75 6e 20 74 65 73 74 73 sfully run tests
7f80: 20 74 68 61 74 20 72 65 71 75 69 72 65 20 6f 6e that require on
7f90: 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 e or more of the
7fa0: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
7fb0: 66 69 6c 65 73 20 69 6e 20 6f 6e 65 20 6f 66 20 files in one of
7fc0: 74 68 65 20 74 65 73 74 69 6e 67 20 64 69 72 65 the testing dire
7fd0: 63 74 6f 72 69 65 73 2e 20 20 43 61 6c 6c 65 72 ctories. Caller
7fe0: 73 20 73 68 6f 75 6c 64 20 6b 65 65 70 20 69 6e s should keep in
7ff0: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
8000: 6d 69 6e 64 20 74 68 61 74 20 74 68 65 20 74 65 mind that the te
8010: 73 74 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 st script fragme
8020: 6e 74 20 62 65 69 6e 67 20 72 65 74 75 72 6e 65 nt being returne
8030: 64 20 63 61 6e 6e 6f 74 20 72 65 6c 79 20 6f 6e d cannot rely on
8040: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
8050: 61 6e 79 20 73 63 72 69 70 74 20 6c 69 62 72 61 any script libra
8060: 72 79 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 ry procedures th
8070: 61 74 20 61 72 65 20 6e 6f 74 20 70 72 6f 76 69 at are not provi
8080: 64 65 64 20 62 79 20 74 68 65 20 45 61 67 6c 65 ded by the Eagle
8090: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
80a0: 6c 69 62 72 61 72 79 20 70 61 63 6b 61 67 65 20 library package
80b0: 28 69 2e 65 2e 20 22 69 6e 69 74 2e 65 61 67 6c (i.e. "init.eagl
80c0: 65 22 29 2c 20 69 6e 63 6c 75 64 69 6e 67 20 74 e"), including t
80d0: 68 6f 73 65 20 70 72 6f 76 69 64 65 64 20 62 79 hose provided by
80e0: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
80f0: 74 68 65 20 45 61 67 6c 65 20 74 65 73 74 20 70 the Eagle test p
8100: 61 63 6b 61 67 65 2c 20 75 6e 6c 65 73 73 20 74 ackage, unless t
8110: 68 65 20 66 69 6c 65 20 63 6f 6e 74 61 69 6e 69 he file containi
8120: 6e 67 20 74 68 65 6d 20 69 73 20 6c 6f 61 64 65 ng them is loade
8130: 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 d.. #
8140: 20 6d 61 6e 75 61 6c 6c 79 20 76 69 61 20 73 6f manually via so
8150: 6d 65 20 6f 74 68 65 72 20 6d 65 63 68 61 6e 69 me other mechani
8160: 73 6d 20 28 65 2e 67 2e 20 62 79 20 69 6e 63 6c sm (e.g. by incl
8170: 75 64 69 6e 67 20 61 70 70 72 6f 70 72 69 61 74 uding appropriat
8180: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
8190: 20 5b 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 [package requir
81a0: 65 5d 20 6f 72 20 5b 73 6f 75 72 63 65 5d 20 63 e] or [source] c
81b0: 6f 6d 6d 61 6e 64 73 20 69 6e 20 74 68 65 20 70 ommands in the p
81c0: 72 65 66 69 78 20 6f 72 20 73 75 66 66 69 78 0d refix or suffix.
81d0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 . # s
81e0: 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 73 29 cript fragments)
81f0: 2e 20 20 41 6c 73 6f 2c 20 61 6c 6c 20 76 61 72 . Also, all var
8200: 69 61 62 6c 65 20 72 65 66 65 72 65 6e 63 65 73 iable references
8210: 20 61 6e 64 20 61 6c 6c 20 6e 65 73 74 65 64 0d and all nested.
8220: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 . # c
8230: 6f 6d 6d 61 6e 64 73 20 28 69 2e 65 2e 20 74 68 ommands (i.e. th
8240: 6f 73 65 20 69 6e 20 73 71 75 61 72 65 20 62 72 ose in square br
8250: 61 63 6b 65 74 73 29 20 63 6f 6e 74 61 69 6e 65 ackets) containe
8260: 64 20 69 6e 20 74 68 65 20 66 69 6e 61 6c 0d 0a d in the final..
8270: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 63 # sc
8280: 72 69 70 74 20 66 72 61 67 6d 65 6e 74 20 77 69 ript fragment wi
8290: 6c 6c 20 65 6e 64 20 75 70 20 62 65 69 6e 67 20 ll end up being
82a0: 65 76 61 6c 75 61 74 65 64 20 69 6e 20 74 68 65 evaluated in the
82b0: 20 63 6f 6e 74 65 78 74 20 6f 66 20 74 68 65 0d context of the.
82c0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 . # c
82d0: 61 6c 6c 69 6e 67 20 69 6e 74 65 72 70 72 65 74 alling interpret
82e0: 65 72 20 61 6e 64 20 6e 6f 74 20 74 68 65 20 74 er and not the t
82f0: 61 72 67 65 74 20 69 6e 74 65 72 70 72 65 74 65 arget interprete
8300: 72 20 63 72 65 61 74 65 64 20 69 6e 20 74 68 65 r created in the
8310: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
8320: 69 73 6f 6c 61 74 65 64 20 61 70 70 6c 69 63 61 isolated applica
8330: 74 69 6f 6e 20 64 6f 6d 61 69 6e 20 75 6e 6c 65 tion domain unle
8340: 73 73 20 74 68 65 20 64 6f 6c 6c 61 72 20 73 69 ss the dollar si
8350: 67 6e 73 20 61 6e 64 2f 6f 72 20 73 71 75 61 72 gns and/or squar
8360: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
8370: 20 62 72 61 63 6b 65 74 73 20 61 72 65 20 73 70 brackets are sp
8380: 65 63 69 61 6c 6c 79 20 71 75 6f 74 65 64 20 77 ecially quoted w
8390: 69 74 68 20 62 61 63 6b 73 6c 61 73 68 65 73 2e ith backslashes.
83a0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
83b0: 20 72 65 74 75 72 6e 20 5b 75 70 6c 65 76 65 6c return [uplevel
83c0: 20 31 20 5b 6c 69 73 74 20 73 75 62 73 74 20 5b 1 [list subst [
83d0: 61 70 70 65 6e 64 41 72 67 73 20 24 70 72 65 66 appendArgs $pref
83e0: 69 78 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 ix {.. if
83f0: 20 7b 5b 68 61 73 52 75 6e 74 69 6d 65 4f 70 74 {[hasRuntimeOpt
8400: 69 6f 6e 20 6e 61 74 69 76 65 5d 7d 20 74 68 65 ion native]} the
8410: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f n {.. o
8420: 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 49 6e 74 bject invoke Int
8430: 65 72 70 72 65 74 65 72 2e 47 65 74 41 63 74 69 erpreter.GetActi
8440: 76 65 20 41 64 64 52 75 6e 74 69 6d 65 4f 70 74 ve AddRuntimeOpt
8450: 69 6f 6e 20 6e 61 74 69 76 65 0d 0a 20 20 20 20 ion native..
8460: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 5b }.. } [
8470: 67 65 74 54 65 73 74 4f 76 65 72 72 69 64 65 73 getTestOverrides
8480: 50 72 65 61 6d 62 6c 65 20 5b 6c 69 73 74 20 70 Preamble [list p
8490: 61 74 68 20 74 65 73 74 5f 63 68 61 6e 6e 65 6c ath test_channel
84a0: 5d 5d 20 24 73 75 66 66 69 78 5d 5d 5d 0d 0a 20 ]] $suffix]]]..
84b0: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
84c0: 63 20 74 72 79 43 6f 70 79 45 78 74 65 72 6e 61 c tryCopyExterna
84d0: 6c 46 69 6c 65 20 7b 0d 0a 20 20 20 20 20 20 20 lFile {..
84e0: 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 7b 70 fileName {p
84f0: 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7b 6e 65 77 latform ""} {new
8500: 46 69 6c 65 4e 61 6d 65 20 22 22 7d 20 7b 76 65 FileName ""} {ve
8510: 72 62 6f 73 65 20 66 61 6c 73 65 7d 20 7d 20 7b rbose false} } {
8520: 0d 0a 20 20 20 20 20 20 73 65 74 20 73 6f 75 72 .. set sour
8530: 63 65 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 45 ceFileName [getE
8540: 78 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 20 xternalFileName
8550: 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 $fileName]....
8560: 20 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 if {![file e
8570: 78 69 73 74 73 20 24 73 6f 75 72 63 65 46 69 6c xists $sourceFil
8580: 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a eName]} then {..
8590: 20 20 20 20 20 20 20 20 69 66 20 7b 24 76 65 72 if {$ver
85a0: 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 bose} then {..
85b0: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
85c0: 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
85d0: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
85e0: 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
85f0: 20 73 6b 69 70 70 65 64 20 63 6f 70 79 69 6e 67 skipped copying
8600: 20 65 78 74 65 72 6e 61 6c 20 66 69 6c 65 20 5c external file \
8610: 22 22 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 "" $sourceFileNa
8620: 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 me \..
8630: 20 20 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 "\", it does
8640: 20 6e 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a not exist\n"]..
8650: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
8660: 20 20 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 return..
8670: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b }.... if {
8680: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
8690: 6e 65 77 46 69 6c 65 4e 61 6d 65 5d 20 3e 20 30 newFileName] > 0
86a0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
86b0: 20 20 73 65 74 20 74 61 72 67 65 74 46 69 6c 65 set targetFile
86c0: 4e 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 46 Name [getBinaryF
86d0: 69 6c 65 4e 61 6d 65 20 24 6e 65 77 46 69 6c 65 ileName $newFile
86e0: 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d Name $platform].
86f0: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
8700: 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 61 72 . set tar
8710: 67 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 getFileName [get
8720: 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 BinaryFileName $
8730: 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f fileName $platfo
8740: 72 6d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a rm].. }....
8750: 20 20 20 20 20 20 73 65 74 20 74 61 72 67 65 74 set target
8760: 44 69 72 65 63 74 6f 72 79 20 5b 66 69 6c 65 20 Directory [file
8770: 64 69 72 6e 61 6d 65 20 24 74 61 72 67 65 74 46 dirname $targetF
8780: 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 ileName]....
8790: 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
87a0: 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 66 69 if {![fi
87b0: 6c 65 20 65 78 69 73 74 73 20 24 74 61 72 67 65 le exists $targe
87c0: 74 44 69 72 65 63 74 6f 72 79 5d 7d 20 74 68 65 tDirectory]} the
87d0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 n {.. f
87e0: 69 6c 65 20 6d 6b 64 69 72 20 24 74 61 72 67 65 ile mkdir $targe
87f0: 74 44 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 tDirectory..
8800: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 66 }.. f
8810: 69 6c 65 20 63 6f 70 79 20 2d 66 6f 72 63 65 20 ile copy -force
8820: 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 $sourceFileName
8830: 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 0d $targetFileName.
8840: 0a 20 20 20 20 20 20 7d 5d 20 3d 3d 20 30 7d 20 . }] == 0}
8850: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
8860: 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
8870: 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
8880: 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
8890: 20 22 2d 2d 2d 2d 20 63 6f 70 69 65 64 20 65 78 "---- copied ex
88a0: 74 65 72 6e 61 6c 20 66 69 6c 65 20 66 72 6f 6d ternal file from
88b0: 20 5c 22 22 20 24 73 6f 75 72 63 65 46 69 6c 65 \"" $sourceFile
88c0: 4e 61 6d 65 20 22 5c 22 20 74 6f 20 5c 22 22 20 Name "\" to \""
88d0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 \.. $
88e0: 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5c targetFileName \
88f0: 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c "\n].. } el
8900: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 se {.. tp
8910: 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
8920: 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
8930: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
8940: 2d 2d 2d 2d 20 66 61 69 6c 65 64 20 74 6f 20 63 ---- failed to c
8950: 6f 70 79 20 65 78 74 65 72 6e 61 6c 20 66 69 6c opy external fil
8960: 65 20 66 72 6f 6d 20 5c 22 22 20 24 73 6f 75 72 e from \"" $sour
8970: 63 65 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 ceFileName \..
8980: 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 74 6f "\" to
8990: 20 5c 22 22 20 24 74 61 72 67 65 74 46 69 6c 65 \"" $targetFile
89a0: 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 Name \"\n]..
89b0: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
89c0: 20 20 20 70 72 6f 63 20 74 72 79 43 6f 70 79 42 proc tryCopyB
89d0: 69 6e 61 72 79 46 69 6c 65 20 7b 0d 0a 20 20 20 inaryFile {..
89e0: 20 20 20 20 20 20 20 20 20 66 69 6c 65 4e 61 6d fileNam
89f0: 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d 20 e {platform ""}
8a00: 7b 6e 65 77 46 69 6c 65 4e 61 6d 65 20 22 22 7d {newFileName ""}
8a10: 20 7b 76 65 72 62 6f 73 65 20 66 61 6c 73 65 7d {verbose false}
8a20: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 } {.. set
8a30: 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 5b sourceFileName [
8a40: 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d getBinaryFileNam
8a50: 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 e $fileName $pla
8a60: 74 66 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 20 20 tform]....
8a70: 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 if {![file exist
8a80: 73 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d s $sourceFileNam
8a90: 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
8aa0: 20 20 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 if {$verbose
8ab0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
8ac0: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
8ad0: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
8ae0: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
8af0: 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 "---- ski
8b00: 70 70 65 64 20 63 6f 70 79 69 6e 67 20 62 69 6e pped copying bin
8b10: 61 72 79 20 66 69 6c 65 20 5c 22 22 20 24 73 6f ary file \"" $so
8b20: 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a urceFileName \..
8b30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c "\
8b40: 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 ", it does not e
8b50: 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 xist\n"]..
8b60: 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 72 65 74 }.. ret
8b70: 75 72 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a urn.. }....
8b80: 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
8b90: 67 20 6c 65 6e 67 74 68 20 24 6e 65 77 46 69 6c g length $newFil
8ba0: 65 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e eName] > 0} then
8bb0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 {.. set
8bc0: 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5b targetFileName [
8bd0: 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 getBuildFileName
8be0: 20 24 6e 65 77 46 69 6c 65 4e 61 6d 65 20 24 70 $newFileName $p
8bf0: 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 20 20 20 20 latform]..
8c00: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
8c10: 20 20 73 65 74 20 74 61 72 67 65 74 46 69 6c 65 set targetFile
8c20: 4e 61 6d 65 20 5b 67 65 74 42 75 69 6c 64 46 69 Name [getBuildFi
8c30: 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 leName $fileName
8c40: 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 20 $platform]..
8c50: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 65 }.... se
8c60: 74 20 74 61 72 67 65 74 44 69 72 65 63 74 6f 72 t targetDirector
8c70: 79 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 y [file dirname
8c80: 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 5d $targetFileName]
8c90: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 .... if {[c
8ca0: 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
8cb0: 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 if {![file exist
8cc0: 73 20 24 74 61 72 67 65 74 44 69 72 65 63 74 6f s $targetDirecto
8cd0: 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ry]} then {..
8ce0: 20 20 20 20 20 20 20 66 69 6c 65 20 6d 6b 64 69 file mkdi
8cf0: 72 20 24 74 61 72 67 65 74 44 69 72 65 63 74 6f r $targetDirecto
8d00: 72 79 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 ry.. }..
8d10: 20 20 20 20 20 20 20 66 69 6c 65 20 63 6f 70 79 file copy
8d20: 20 2d 66 6f 72 63 65 20 24 73 6f 75 72 63 65 46 -force $sourceF
8d30: 69 6c 65 4e 61 6d 65 20 24 74 61 72 67 65 74 46 ileName $targetF
8d40: 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 7d ileName.. }
8d50: 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
8d60: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
8d70: 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
8d80: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
8d90: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 "---- c
8da0: 6f 70 69 65 64 20 62 69 6e 61 72 79 20 66 69 6c opied binary fil
8db0: 65 20 66 72 6f 6d 20 5c 22 22 20 24 73 6f 75 72 e from \"" $sour
8dc0: 63 65 46 69 6c 65 4e 61 6d 65 20 22 5c 22 20 74 ceFileName "\" t
8dd0: 6f 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 o \"" \..
8de0: 20 20 20 20 20 24 74 61 72 67 65 74 46 69 6c 65 $targetFile
8df0: 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 Name \"\n]..
8e00: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
8e10: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
8e20: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
8e30: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
8e40: 20 20 20 20 20 22 2d 2d 2d 2d 20 66 61 69 6c 65 "---- faile
8e50: 64 20 74 6f 20 63 6f 70 79 20 62 69 6e 61 72 79 d to copy binary
8e60: 20 66 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 file from \"" $
8e70: 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 5c sourceFileName \
8e80: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 5c .. "\
8e90: 22 20 74 6f 20 5c 22 22 20 24 74 61 72 67 65 74 " to \"" $target
8ea0: 46 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a FileName \"\n]..
8eb0: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
8ec0: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 79 43 ... proc tryC
8ed0: 6f 70 79 42 75 69 6c 64 46 69 6c 65 20 7b 0d 0a opyBuildFile {..
8ee0: 20 20 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 file
8ef0: 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 Name {platform "
8f00: 22 7d 20 7b 6e 65 77 46 69 6c 65 4e 61 6d 65 20 "} {newFileName
8f10: 22 22 7d 20 7b 76 65 72 62 6f 73 65 20 66 61 6c ""} {verbose fal
8f20: 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 se} } {.. s
8f30: 65 74 20 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d et sourceFileNam
8f40: 65 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e e [getBuildFileN
8f50: 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 ame $fileName $p
8f60: 6c 61 74 66 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 latform]....
8f70: 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 if {![file exi
8f80: 73 74 73 20 24 73 6f 75 72 63 65 46 69 6c 65 4e sts $sourceFileN
8f90: 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ame]} then {..
8fa0: 20 20 20 20 20 20 69 66 20 7b 24 76 65 72 62 6f if {$verbo
8fb0: 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 se} then {..
8fc0: 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
8fd0: 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
8fe0: 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
8ff0: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
9000: 6b 69 70 70 65 64 20 63 6f 70 79 69 6e 67 20 62 kipped copying b
9010: 75 69 6c 64 20 66 69 6c 65 20 5c 22 22 20 24 73 uild file \"" $s
9020: 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 5c 0d ourceFileName \.
9030: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
9040: 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 \", it does not
9050: 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 exist\n"]..
9060: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 72 65 }.. re
9070: 74 75 72 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d turn.. }...
9080: 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 . if {[stri
9090: 6e 67 20 6c 65 6e 67 74 68 20 24 6e 65 77 46 69 ng length $newFi
90a0: 6c 65 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 leName] > 0} the
90b0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 n {.. set
90c0: 20 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 targetFileName
90d0: 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 [getBinaryFileNa
90e0: 6d 65 20 24 6e 65 77 46 69 6c 65 4e 61 6d 65 20 me $newFileName
90f0: 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 20 20 $platform]..
9100: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
9110: 20 20 20 20 73 65 74 20 74 61 72 67 65 74 46 69 set targetFi
9120: 6c 65 4e 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 leName [getBinar
9130: 79 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e yFileName $fileN
9140: 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a ame $platform]..
9150: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
9160: 20 73 65 74 20 74 61 72 67 65 74 44 69 72 65 63 set targetDirec
9170: 74 6f 72 79 20 5b 66 69 6c 65 20 64 69 72 6e 61 tory [file dirna
9180: 6d 65 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 me $targetFileNa
9190: 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 me].... if
91a0: 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
91b0: 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 if {![file ex
91c0: 69 73 74 73 20 24 74 61 72 67 65 74 44 69 72 65 ists $targetDire
91d0: 63 74 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a ctory]} then {..
91e0: 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 20 6d file m
91f0: 6b 64 69 72 20 24 74 61 72 67 65 74 44 69 72 65 kdir $targetDire
9200: 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 20 20 7d ctory.. }
9210: 0d 0a 20 20 20 20 20 20 20 20 66 69 6c 65 20 63 .. file c
9220: 6f 70 79 20 2d 66 6f 72 63 65 20 24 73 6f 75 72 opy -force $sour
9230: 63 65 46 69 6c 65 4e 61 6d 65 20 24 74 61 72 67 ceFileName $targ
9240: 65 74 46 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 etFileName..
9250: 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 }] == 0} then
9260: 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
9270: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
9280: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
9290: 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
92a0: 2d 20 63 6f 70 69 65 64 20 62 75 69 6c 64 20 66 - copied build f
92b0: 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 73 6f ile from \"" $so
92c0: 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 22 5c 22 urceFileName "\"
92d0: 20 74 6f 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 to \"" \..
92e0: 20 20 20 20 20 20 20 24 74 61 72 67 65 74 46 69 $targetFi
92f0: 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 leName \"\n]..
9300: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
9310: 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
9320: 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
9330: 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
9340: 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 61 69 "---- fai
9350: 6c 65 64 20 74 6f 20 63 6f 70 79 20 62 75 69 6c led to copy buil
9360: 64 20 66 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 d file from \""
9370: 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 $sourceFileName
9380: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
9390: 5c 22 20 74 6f 20 5c 22 22 20 24 74 61 72 67 65 \" to \"" $targe
93a0: 74 46 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d tFileName \"\n].
93b0: 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d . }.. }.
93c0: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 79 .... proc try
93d0: 44 65 6c 65 74 65 42 69 6e 61 72 79 46 69 6c 65 DeleteBinaryFile
93e0: 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 { fileName {pla
93f0: 74 66 6f 72 6d 20 22 22 7d 20 7b 76 65 72 62 6f tform ""} {verbo
9400: 73 65 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 se false} } {..
9410: 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d set fileNam
9420: 65 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 e [getBinaryFile
9430: 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 Name $fileName $
9440: 70 6c 61 74 66 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 platform]....
9450: 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 if {![file ex
9460: 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d ists $fileName]}
9470: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
9480: 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 if {$verbose} t
9490: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
94a0: 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
94b0: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
94c0: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
94d0: 20 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 "---- skippe
94e0: 64 20 64 65 6c 65 74 69 6e 67 20 62 69 6e 61 72 d deleting binar
94f0: 79 20 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 y file \"" $file
9500: 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 Name \..
9510: 20 20 20 20 20 20 22 5c 22 2c 20 69 74 20 64 6f "\", it do
9520: 65 73 20 6e 6f 74 20 65 78 69 73 74 5c 6e 22 5d es not exist\n"]
9530: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
9540: 20 20 20 20 20 72 65 74 75 72 6e 0d 0a 20 20 20 return..
9550: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 }.... if
9560: 20 7b 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 64 {[catch {file d
9570: 65 6c 65 74 65 20 24 66 69 6c 65 4e 61 6d 65 7d elete $fileName}
9580: 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
9590: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
95a0: 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
95b0: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
95c0: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 64 "---- d
95d0: 65 6c 65 74 65 64 20 62 69 6e 61 72 79 20 66 69 eleted binary fi
95e0: 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 le \"" $fileName
95f0: 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 \"\n].. }
9600: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
9610: 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
9620: 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
9630: 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
9640: 20 22 2d 2d 2d 2d 20 66 61 69 6c 65 64 20 74 6f "---- failed to
9650: 20 64 65 6c 65 74 65 20 62 69 6e 61 72 79 20 66 delete binary f
9660: 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d ile \"" $fileNam
9670: 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d e \"\n].. }
9680: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
9690: 70 72 6f 63 20 74 72 79 44 65 6c 65 74 65 42 75 proc tryDeleteBu
96a0: 69 6c 64 46 69 6c 65 20 7b 20 66 69 6c 65 4e 61 ildFile { fileNa
96b0: 6d 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d me {platform ""}
96c0: 20 7b 76 65 72 62 6f 73 65 20 66 61 6c 73 65 7d {verbose false}
96d0: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 } {.. set
96e0: 66 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 75 69 fileName [getBui
96f0: 6c 64 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 ldFileName $file
9700: 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d Name $platform].
9710: 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 66 ... if {![f
9720: 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 ile exists $file
9730: 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 Name]} then {..
9740: 20 20 20 20 20 20 20 69 66 20 7b 24 76 65 72 62 if {$verb
9750: 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ose} then {..
9760: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
9770: 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
9780: 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
9790: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
97a0: 73 6b 69 70 70 65 64 20 64 65 6c 65 74 69 6e 67 skipped deleting
97b0: 20 62 75 69 6c 64 20 66 69 6c 65 20 5c 22 22 20 build file \""
97c0: 24 66 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 $fileName \..
97d0: 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 "\",
97e0: 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 it does not exis
97f0: 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d t\n"].. }
9800: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
9810: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
9820: 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 66 if {[catch {f
9830: 69 6c 65 20 64 65 6c 65 74 65 20 24 66 69 6c 65 ile delete $file
9840: 4e 61 6d 65 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 Name}] == 0} the
9850: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 n {.. tpu
9860: 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
9870: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
9880: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d .. "-
9890: 2d 2d 2d 20 64 65 6c 65 74 65 64 20 62 75 69 6c --- deleted buil
98a0: 64 20 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 d file \"" $file
98b0: 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 Name \"\n]..
98c0: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
98d0: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
98e0: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
98f0: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
9900: 20 20 20 20 20 22 2d 2d 2d 2d 20 66 61 69 6c 65 "---- faile
9910: 64 20 74 6f 20 64 65 6c 65 74 65 20 62 75 69 6c d to delete buil
9920: 64 20 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 d file \"" $file
9930: 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 Name \"\n]..
9940: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
9950: 20 20 20 70 72 6f 63 20 74 72 79 43 6f 70 79 41 proc tryCopyA
9960: 73 73 65 6d 62 6c 79 20 7b 0d 0a 20 20 20 20 20 ssembly {..
9970: 20 20 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 fileName
9980: 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7b 70 {platform ""} {p
9990: 64 62 20 74 72 75 65 7d 20 7b 76 65 72 62 6f 73 db true} {verbos
99a0: 65 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 e false} } {..
99b0: 20 20 20 20 74 72 79 43 6f 70 79 42 75 69 6c 64 tryCopyBuild
99c0: 46 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 File $fileName $
99d0: 70 6c 61 74 66 6f 72 6d 20 22 22 20 24 76 65 72 platform "" $ver
99e0: 62 6f 73 65 0d 0a 0d 0a 20 20 20 20 20 20 69 66 bose.... if
99f0: 20 7b 24 70 64 62 7d 20 74 68 65 6e 20 7b 0d 0a {$pdb} then {..
9a00: 20 20 20 20 20 20 20 20 74 72 79 43 6f 70 79 42 tryCopyB
9a10: 75 69 6c 64 46 69 6c 65 20 5b 61 70 70 65 6e 64 uildFile [append
9a20: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
9a30: 20 20 20 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 [file rootna
9a40: 6d 65 20 24 66 69 6c 65 4e 61 6d 65 5d 20 2e 70 me $fileName] .p
9a50: 64 62 5d 20 24 70 6c 61 74 66 6f 72 6d 20 22 22 db] $platform ""
9a60: 20 24 76 65 72 62 6f 73 65 0d 0a 20 20 20 20 20 $verbose..
9a70: 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
9a80: 20 20 70 72 6f 63 20 74 72 79 44 65 6c 65 74 65 proc tryDelete
9a90: 41 73 73 65 6d 62 6c 79 20 7b 0d 0a 20 20 20 20 Assembly {..
9aa0: 20 20 20 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 fileName
9ab0: 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7b {platform ""} {
9ac0: 70 64 62 20 74 72 75 65 7d 20 7b 76 65 72 62 6f pdb true} {verbo
9ad0: 73 65 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 se false} } {..
9ae0: 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 42 69 tryDeleteBi
9af0: 6e 61 72 79 46 69 6c 65 20 24 66 69 6c 65 4e 61 naryFile $fileNa
9b00: 6d 65 20 24 70 6c 61 74 66 6f 72 6d 20 24 76 65 me $platform $ve
9b10: 72 62 6f 73 65 0d 0a 0d 0a 20 20 20 20 20 20 69 rbose.... i
9b20: 66 20 7b 24 70 64 62 7d 20 74 68 65 6e 20 7b 0d f {$pdb} then {.
9b30: 0a 20 20 20 20 20 20 20 20 74 72 79 44 65 6c 65 . tryDele
9b40: 74 65 42 69 6e 61 72 79 46 69 6c 65 20 5b 61 70 teBinaryFile [ap
9b50: 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
9b60: 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 72 6f [file ro
9b70: 6f 74 6e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 otname $fileName
9b80: 5d 20 2e 70 64 62 5d 20 24 70 6c 61 74 66 6f 72 ] .pdb] $platfor
9b90: 6d 20 24 76 65 72 62 6f 73 65 0d 0a 20 20 20 20 m $verbose..
9ba0: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
9bb0: 20 20 20 70 72 6f 63 20 74 72 79 4c 6f 61 64 41 proc tryLoadA
9bc0: 73 73 65 6d 62 6c 79 20 7b 20 66 69 6c 65 4e 61 ssembly { fileNa
9bd0: 6d 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d me {platform ""}
9be0: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 } {.. set
9bf0: 66 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 69 6e fileName [getBin
9c00: 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c aryFileName $fil
9c10: 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d eName $platform]
9c20: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 .... if {[c
9c30: 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
9c40: 73 65 74 20 61 73 73 65 6d 62 6c 79 20 5b 6f 62 set assembly [ob
9c50: 6a 65 63 74 20 6c 6f 61 64 20 2d 6c 6f 61 64 74 ject load -loadt
9c60: 79 70 65 20 46 69 6c 65 20 2d 61 6c 69 61 73 20 ype File -alias
9c70: 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 $fileName]..
9c80: 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 }] == 0} then
9c90: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
9ca0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4e 6f # NOTE: No
9cb0: 77 2c 20 61 64 64 20 74 68 65 20 6e 65 63 65 73 w, add the neces
9cc0: 73 61 72 79 20 74 65 73 74 20 63 6f 6e 73 74 72 sary test constr
9cd0: 61 69 6e 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 aint... #
9ce0: 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e .. addCon
9cf0: 73 74 72 61 69 6e 74 20 5b 66 69 6c 65 20 72 6f straint [file ro
9d00: 6f 74 6e 61 6d 65 20 5b 66 69 6c 65 20 74 61 69 otname [file tai
9d10: 6c 20 24 66 69 6c 65 4e 61 6d 65 5d 5d 0d 0a 0d l $fileName]]...
9d20: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
9d30: 20 20 20 20 23 20 4e 4f 54 45 3a 20 47 72 61 62 # NOTE: Grab
9d40: 20 74 68 65 20 69 6d 61 67 65 20 72 75 6e 74 69 the image runti
9d50: 6d 65 20 76 65 72 73 69 6f 6e 20 66 72 6f 6d 20 me version from
9d60: 74 68 65 20 61 73 73 65 6d 62 6c 79 20 62 65 63 the assembly bec
9d70: 61 75 73 65 0d 0a 20 20 20 20 20 20 20 20 23 20 ause.. #
9d80: 20 20 20 20 20 20 73 65 76 65 72 61 6c 20 74 65 several te
9d90: 73 74 73 20 72 65 6c 79 20 6f 6e 20 69 74 20 68 sts rely on it h
9da0: 61 76 69 6e 67 20 61 20 63 65 72 74 61 69 6e 20 aving a certain
9db0: 76 61 6c 75 65 2e 0d 0a 20 20 20 20 20 20 20 20 value...
9dc0: 23 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f #.. addCo
9dd0: 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
9de0: 41 72 67 73 20 5b 66 69 6c 65 20 74 61 69 6c 20 Args [file tail
9df0: 24 66 69 6c 65 4e 61 6d 65 5d 20 5f 20 5c 0d 0a $fileName] _ \..
9e00: 20 20 20 20 20 20 20 20 20 20 20 20 5b 24 61 73 [$as
9e10: 73 65 6d 62 6c 79 20 49 6d 61 67 65 52 75 6e 74 sembly ImageRunt
9e20: 69 6d 65 56 65 72 73 69 6f 6e 5d 5d 0d 0a 0d 0a imeVersion]]....
9e30: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
9e40: 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 # NOTE: Retur
9e50: 6e 20 74 68 65 20 66 75 6c 6c 20 70 61 74 68 20 n the full path
9e60: 6f 66 20 74 68 65 20 6c 6f 61 64 65 64 20 66 69 of the loaded fi
9e70: 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a le... #..
9e80: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
9e90: 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 fileName..
9ea0: 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 }.... retur
9eb0: 6e 20 22 22 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a n "".. }.....
9ec0: 20 20 20 20 70 72 6f 63 20 69 73 53 51 4c 69 74 proc isSQLit
9ed0: 65 52 65 61 64 79 20 7b 7d 20 7b 0d 0a 20 20 20 eReady {} {..
9ee0: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
9ef0: 54 45 3a 20 54 68 69 73 20 70 72 6f 63 65 64 75 TE: This procedu
9f00: 72 65 20 6d 75 73 74 20 72 65 74 75 72 6e 20 6e re must return n
9f10: 6f 6e 2d 7a 65 72 6f 20 6f 6e 6c 79 20 69 66 20 on-zero only if
9f20: 74 68 65 20 53 51 4c 69 74 65 20 6e 61 74 69 76 the SQLite nativ
9f30: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
9f40: 20 6c 69 62 72 61 72 79 20 61 6e 64 20 74 68 65 library and the
9f50: 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
9f60: 69 74 65 20 6d 61 6e 61 67 65 64 20 61 73 73 65 ite managed asse
9f70: 6d 62 6c 79 20 61 72 65 20 6c 6f 61 64 65 64 0d mbly are loaded.
9f80: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 . # a
9f90: 6e 64 20 72 65 61 64 79 20 66 6f 72 20 75 73 65 nd ready for use
9fa0: 20 62 79 20 74 68 65 20 74 65 73 74 20 73 75 69 by the test sui
9fb0: 74 65 2e 20 20 43 75 72 72 65 6e 74 6c 79 2c 20 te. Currently,
9fc0: 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 0d 0a this procedure..
9fd0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 68 # sh
9fe0: 6f 75 6c 64 20 62 65 20 63 61 6c 6c 65 64 20 6f ould be called o
9ff0: 6e 6c 79 20 61 66 74 65 72 20 74 68 65 20 5b 74 nly after the [t
a000: 72 79 4c 6f 61 64 41 73 73 65 6d 62 6c 79 5d 20 ryLoadAssembly]
a010: 70 72 6f 63 65 64 75 72 65 20 68 61 73 0d 0a 20 procedure has..
a020: 20 20 20 20 20 23 20 20 20 20 20 20 20 62 65 65 # bee
a030: 6e 20 63 61 6c 6c 65 64 20 74 6f 20 70 72 6f 62 n called to prob
a040: 65 20 66 6f 72 20 74 68 65 20 53 79 73 74 65 6d e for the System
a050: 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 6d 61 6e .Data.SQLite man
a060: 61 67 65 64 20 61 73 73 65 6d 62 6c 79 0d 0a 20 aged assembly..
a070: 20 20 20 20 20 23 20 20 20 20 20 20 20 61 6e 64 # and
a080: 20 74 68 65 20 5b 63 68 65 63 6b 46 6f 72 53 51 the [checkForSQ
a090: 4c 69 74 65 5d 20 70 72 6f 63 65 64 75 72 65 20 Lite] procedure
a0a0: 68 61 73 20 62 65 65 6e 20 63 61 6c 6c 65 64 20 has been called
a0b0: 74 6f 20 70 72 6f 62 65 20 66 6f 72 0d 0a 20 20 to probe for..
a0c0: 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 # the
a0d0: 53 51 4c 69 74 65 20 6e 61 74 69 76 65 20 6c 69 SQLite native li
a0e0: 62 72 61 72 79 3b 20 6f 74 68 65 72 77 69 73 65 brary; otherwise
a0f0: 2c 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 , this procedure
a100: 20 77 69 6c 6c 20 73 69 6d 70 6c 79 0d 0a 20 20 will simply..
a110: 20 20 20 20 23 20 20 20 20 20 20 20 61 6c 77 61 # alwa
a120: 79 73 20 72 65 74 75 72 6e 20 7a 65 72 6f 2e 0d ys return zero..
a130: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
a140: 72 65 74 75 72 6e 20 5b 65 78 70 72 20 7b 0d 0a return [expr {..
a150: 20 20 20 20 20 20 20 20 5b 68 61 76 65 43 6f 6e [haveCon
a160: 73 74 72 61 69 6e 74 20 53 79 73 74 65 6d 2e 44 straint System.D
a170: 61 74 61 2e 53 51 4c 69 74 65 5d 20 26 26 20 5b ata.SQLite] && [
a180: 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 53 haveConstraint S
a190: 51 4c 69 74 65 5d 0d 0a 20 20 20 20 20 20 7d 5d QLite].. }]
a1a0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
a1b0: 70 72 6f 63 20 6d 61 74 63 68 4d 61 63 68 69 6e proc matchMachin
a1c0: 65 20 7b 20 70 6c 61 74 66 6f 72 6d 20 7d 20 7b e { platform } {
a1d0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
a1e0: 20 23 20 4e 4f 54 45 3a 20 41 6e 20 65 6d 70 74 # NOTE: An empt
a1f0: 79 20 73 74 72 69 6e 67 20 66 6f 72 20 74 68 65 y string for the
a200: 20 70 6c 61 74 66 6f 72 6d 20 6d 65 61 6e 73 20 platform means
a210: 74 68 61 74 20 74 68 65 20 62 75 69 6c 64 20 69 that the build i
a220: 73 20 6e 6f 74 0d 0a 20 20 20 20 20 20 23 20 20 s not.. #
a230: 20 20 20 20 20 5b 70 72 69 6d 61 72 69 6c 79 5d [primarily]
a240: 20 61 20 6e 61 74 69 76 65 20 62 75 69 6c 64 3b a native build;
a250: 20 74 68 65 72 65 66 6f 72 65 2c 20 69 74 20 61 therefore, it a
a260: 6c 77 61 79 73 20 6d 61 74 63 68 65 73 2e 0d 0a lways matches...
a270: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
a280: 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 f {[string lengt
a290: 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3d 3d 20 h $platform] ==
a2a0: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
a2b0: 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a return true..
a2c0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
a2d0: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
a2e0: 3a 20 44 6f 65 73 20 74 68 65 20 73 70 65 63 69 : Does the speci
a2f0: 66 69 65 64 20 70 6c 61 74 66 6f 72 6d 20 6d 61 fied platform ma
a300: 74 63 68 20 75 70 20 74 6f 20 74 68 65 20 63 75 tch up to the cu
a310: 72 72 65 6e 74 20 70 72 6f 63 65 73 73 3f 0d 0a rrent process?..
a320: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
a330: 66 20 7b 24 70 6c 61 74 66 6f 72 6d 20 65 71 20 f {$platform eq
a340: 5b 6d 61 63 68 69 6e 65 54 6f 50 6c 61 74 66 6f [machineToPlatfo
a350: 72 6d 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f rm $::tcl_platfo
a360: 72 6d 28 6d 61 63 68 69 6e 65 29 5d 7d 20 74 68 rm(machine)]} th
a370: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 en {.. re
a380: 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 turn true..
a390: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
a3a0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 # NOTE: The
a3b0: 20 73 70 65 63 69 66 69 65 64 20 70 6c 61 74 66 specified platf
a3c0: 6f 72 6d 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 orm does not mat
a3d0: 63 68 20 75 70 20 77 69 74 68 20 74 68 65 20 70 ch up with the p
a3e0: 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 20 20 20 23 latform.. #
a3f0: 20 20 20 20 20 20 20 66 6f 72 20 74 68 65 20 63 for the c
a400: 75 72 72 65 6e 74 20 70 72 6f 63 65 73 73 2e 0d urrent process..
a410: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
a420: 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 return false..
a430: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
a440: 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 42 checkForSQLiteB
a450: 75 69 6c 64 73 20 7b 20 63 68 61 6e 6e 65 6c 20 uilds { channel
a460: 7b 73 65 6c 65 63 74 20 66 61 6c 73 65 7d 20 7d {select false} }
a470: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
a480: 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b # NOTE: Check
a490: 20 66 6f 72 20 65 76 65 72 79 20 70 6f 73 73 69 for every possi
a4a0: 62 6c 65 20 76 61 6c 69 64 20 63 6f 6d 62 69 6e ble valid combin
a4b0: 61 74 69 6f 6e 20 6f 66 20 76 61 6c 75 65 73 20 ation of values
a4c0: 75 73 65 64 20 77 68 65 6e 0d 0a 20 20 20 20 20 used when..
a4d0: 20 23 20 20 20 20 20 20 20 6c 6f 63 61 74 69 6e # locatin
a4e0: 67 20 6f 75 74 20 74 68 65 20 62 75 69 6c 64 20 g out the build
a4f0: 6f 75 74 70 75 74 20 64 69 72 65 63 74 6f 72 79 output directory
a500: 2c 20 73 68 6f 77 69 6e 67 20 65 61 63 68 20 61 , showing each a
a510: 76 61 69 6c 61 62 6c 65 0d 0a 20 20 20 20 20 20 vailable..
a520: 23 20 20 20 20 20 20 20 62 75 69 6c 64 20 76 61 # build va
a530: 72 69 61 74 69 6f 6e 20 61 6c 6f 6e 67 20 74 68 riation along th
a540: 65 20 77 61 79 2e 0d 0a 20 20 20 20 20 20 23 0d e way... #.
a550: 0a 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 6e . foreach n
a560: 61 74 69 76 65 20 5b 6c 69 73 74 20 66 61 6c 73 ative [list fals
a570: 65 20 74 72 75 65 5d 20 7b 0d 0a 20 20 20 20 20 e true] {..
a580: 20 20 20 66 6f 72 65 61 63 68 20 79 65 61 72 20 foreach year
a590: 5b 67 65 74 42 75 69 6c 64 59 65 61 72 73 5d 20 [getBuildYears]
a5a0: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 {.. for
a5b0: 65 61 63 68 20 63 6f 6e 66 69 67 75 72 61 74 69 each configurati
a5c0: 6f 6e 20 5b 67 65 74 42 75 69 6c 64 43 6f 6e 66 on [getBuildConf
a5d0: 69 67 75 72 61 74 69 6f 6e 73 5d 20 7b 0d 0a 20 igurations] {..
a5e0: 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
a5f0: 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
a600: 3a 20 46 69 67 75 72 65 20 6f 75 74 20 74 68 65 : Figure out the
a610: 20 65 66 66 65 63 74 69 76 65 20 62 75 69 6c 64 effective build
a620: 20 70 6c 61 74 66 6f 72 6d 2e 20 20 54 68 69 73 platform. This
a630: 20 69 73 0d 0a 20 20 20 20 20 20 20 20 20 20 20 is..
a640: 20 23 20 20 20 20 20 20 20 62 61 73 65 64 20 6f # based o
a650: 6e 20 77 68 65 74 68 65 72 20 6f 72 20 6e 6f 74 n whether or not
a660: 20 61 20 5b 70 72 69 6d 61 72 69 6c 79 5d 20 6e a [primarily] n
a670: 61 74 69 76 65 20 62 75 69 6c 64 0d 0a 20 20 20 ative build..
a680: 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
a690: 20 69 73 20 62 65 69 6e 67 20 75 73 65 64 2e 20 is being used.
a6a0: 20 46 6f 72 20 5b 70 72 69 6d 61 72 69 6c 79 5d For [primarily]
a6b0: 20 6e 6f 6e 2d 6e 61 74 69 76 65 20 62 75 69 6c non-native buil
a6c0: 64 73 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ds,..
a6d0: 20 23 20 20 20 20 20 20 20 74 68 69 73 20 77 69 # this wi
a6e0: 6c 6c 20 62 65 20 61 6e 20 65 6d 70 74 79 20 73 ll be an empty s
a6f0: 74 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 20 20 tring...
a700: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
a710: 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 set platform
a720: 5b 67 65 74 42 75 69 6c 64 50 6c 61 74 66 6f 72 [getBuildPlatfor
a730: 6d 20 24 6e 61 74 69 76 65 5d 0d 0a 0d 0a 20 20 m $native]....
a740: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
a750: 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
a760: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
a770: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 "---- ch
a780: 65 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 74 65 ecking for Syste
a790: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 62 75 m.Data.SQLite bu
a7a0: 69 6c 64 20 5c 22 22 20 5b 65 78 70 72 20 5c 0d ild \"" [expr \.
a7b0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
a7c0: 20 7b 24 6e 61 74 69 76 65 20 3f 20 22 6e 61 74 {$native ? "nat
a7d0: 69 76 65 2f 22 20 3a 20 22 22 7d 5d 20 5b 65 78 ive/" : ""}] [ex
a7e0: 70 72 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 pr {[string leng
a7f0: 74 68 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 th \..
a800: 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 6d 5d $platform]
a810: 20 3e 20 30 20 3f 20 5b 61 70 70 65 6e 64 41 72 > 0 ? [appendAr
a820: 67 73 20 24 70 6c 61 74 66 6f 72 6d 20 2f 5d 20 gs $platform /]
a830: 3a 20 22 22 7d 5d 20 24 79 65 61 72 20 5c 0d 0a : ""}] $year \..
a840: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
a850: 2f 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e / $configuration
a860: 20 22 5c 22 2e 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 "\"... "]....
a870: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
a880: 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
a890: 20 42 75 69 6c 64 20 74 68 65 20 66 75 6c 6c 79 Build the fully
a8a0: 20 71 75 61 6c 69 66 69 65 64 20 64 69 72 65 63 qualified direc
a8b0: 74 6f 72 79 20 77 68 65 72 65 20 74 68 65 20 6e tory where the n
a8c0: 65 63 65 73 73 61 72 79 0d 0a 20 20 20 20 20 20 ecessary..
a8d0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
a8e0: 6d 70 6f 6e 65 6e 74 73 20 66 6f 72 20 53 79 73 mponents for Sys
a8f0: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
a900: 73 68 6f 75 6c 64 20 62 65 20 66 6f 75 6e 64 2e should be found.
a910: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d .. #.
a920: 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 . set
a930: 20 64 69 72 65 63 74 6f 72 79 20 5b 6a 6f 69 6e directory [join
a940: 42 75 69 6c 64 44 69 72 65 63 74 6f 72 79 20 24 BuildDirectory $
a950: 6e 61 74 69 76 65 20 5c 0d 0a 20 20 20 20 20 20 native \..
a960: 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 75 [getBu
a970: 69 6c 64 42 61 73 65 44 69 72 65 63 74 6f 72 79 ildBaseDirectory
a980: 5d 20 24 79 65 61 72 20 24 70 6c 61 74 66 6f 72 ] $year $platfor
a990: 6d 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e m $configuration
a9a0: 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ]....
a9b0: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
a9c0: 23 20 4e 4f 54 45 3a 20 44 6f 20 74 68 65 20 6e # NOTE: Do the n
a9d0: 65 63 65 73 73 61 72 79 20 66 69 6c 65 73 20 65 ecessary files e
a9e0: 78 69 73 74 3f 20 20 43 75 72 72 65 6e 74 6c 79 xist? Currently
a9f0: 2c 20 6e 6f 20 6f 74 68 65 72 20 73 74 65 70 73 , no other steps
aa00: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 .. #
aa10: 20 20 20 20 20 20 61 72 65 20 74 61 6b 65 6e 20 are taken
aa20: 74 6f 20 76 65 72 69 66 79 20 74 68 69 73 20 62 to verify this b
aa30: 75 69 6c 64 20 69 73 20 61 63 74 75 61 6c 6c 79 uild is actually
aa40: 20 76 69 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 viable...
aa50: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
aa60: 20 20 20 20 20 69 66 20 7b 5b 69 73 42 75 69 6c if {[isBuil
aa70: 64 41 76 61 69 6c 61 62 6c 65 20 24 6e 61 74 69 dAvailable $nati
aa80: 76 65 20 24 64 69 72 65 63 74 6f 72 79 5d 7d 20 ve $directory]}
aa90: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
aaa0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
aab0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 # NOTE: W
aac0: 68 65 6e 20 69 6e 20 22 73 65 6c 65 63 74 22 20 hen in "select"
aad0: 6d 6f 64 65 2c 20 61 75 74 6f 6d 61 74 69 63 61 mode, automatica
aae0: 6c 6c 79 20 73 65 6c 65 63 74 20 74 68 65 20 66 lly select the f
aaf0: 69 72 73 74 0d 0a 20 20 20 20 20 20 20 20 20 20 irst..
ab00: 20 20 20 20 23 20 20 20 20 20 20 20 61 76 61 69 # avai
ab10: 6c 61 62 6c 65 20 62 75 69 6c 64 20 6f 66 20 53 lable build of S
ab20: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
ab30: 65 20 61 6e 64 20 74 68 65 6e 20 72 65 74 75 72 e and then retur
ab40: 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 n..
ab50: 20 23 20 20 20 20 20 20 20 69 6d 6d 65 64 69 61 # immedia
ab60: 74 65 6c 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 tely...
ab70: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
ab80: 20 20 20 20 20 20 69 66 20 7b 24 73 65 6c 65 63 if {$selec
ab90: 74 20 26 26 20 5b 6d 61 74 63 68 4d 61 63 68 69 t && [matchMachi
aba0: 6e 65 20 24 70 6c 61 74 66 6f 72 6d 5d 7d 20 74 ne $platform]} t
abb0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
abc0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
abd0: 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
abe0: 3a 20 4d 61 6e 75 61 6c 6c 79 20 6f 76 65 72 72 : Manually overr
abf0: 69 64 65 20 61 6c 6c 20 74 68 65 20 62 75 69 6c ide all the buil
ac00: 64 20 64 69 72 65 63 74 6f 72 79 20 73 65 6c 65 d directory sele
ac10: 63 74 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 20 ction..
ac20: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 # r
ac30: 65 6c 61 74 65 64 20 74 65 73 74 20 73 65 74 74 elated test sett
ac40: 69 6e 67 73 20 69 6e 20 6f 72 64 65 72 20 74 6f ings in order to
ac50: 20 66 6f 72 63 65 20 74 68 69 73 20 62 75 69 6c force this buil
ac60: 64 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 d..
ac70: 20 20 20 23 20 20 20 20 20 20 20 6f 66 20 53 79 # of Sy
ac80: 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
ac90: 20 74 6f 20 62 65 20 75 73 65 64 2e 0d 0a 20 20 to be used...
aca0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
acb0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
acc0: 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 49 object invoke I
acd0: 6e 74 65 72 70 72 65 74 65 72 2e 47 65 74 41 63 nterpreter.GetAc
ace0: 74 69 76 65 20 5b 65 78 70 72 20 7b 24 6e 61 74 tive [expr {$nat
acf0: 69 76 65 20 3f 20 5c 0d 0a 20 20 20 20 20 20 20 ive ? \..
ad00: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 41 64 "Ad
ad10: 64 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 22 20 dRuntimeOption"
ad20: 3a 20 22 52 65 6d 6f 76 65 52 75 6e 74 69 6d 65 : "RemoveRuntime
ad30: 4f 70 74 69 6f 6e 22 7d 5d 20 6e 61 74 69 76 65 Option"}] native
ad40: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
ad50: 20 20 20 20 73 65 74 20 3a 3a 74 65 73 74 5f 79 set ::test_y
ad60: 65 61 72 20 24 79 65 61 72 0d 0a 20 20 20 20 20 ear $year..
ad70: 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 3a set :
ad80: 3a 74 65 73 74 5f 70 6c 61 74 66 6f 72 6d 20 24 :test_platform $
ad90: 70 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 20 20 20 platform..
ada0: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a set ::
adb0: 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 test_configurati
adc0: 6f 6e 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f on $configuratio
add0: 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n....
ade0: 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
adf0: 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
ae00: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
ae10: 20 20 20 20 20 20 20 22 79 65 73 2c 20 73 65 6c "yes, sel
ae20: 65 63 74 65 64 20 28 22 20 5b 65 78 70 72 20 7b ected (" [expr {
ae30: 24 6e 61 74 69 76 65 20 3f 20 22 6e 61 74 69 76 $native ? "nativ
ae40: 65 2f 22 20 3a 20 22 22 7d 5d 20 5c 0d 0a 20 20 e/" : ""}] \..
ae50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
ae60: 20 20 5b 65 78 70 72 20 7b 5b 73 74 72 69 6e 67 [expr {[string
ae70: 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 length $platfor
ae80: 6d 5d 20 3e 20 30 20 3f 20 5b 61 70 70 65 6e 64 m] > 0 ? [append
ae90: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
aea0: 20 20 20 20 20 20 20 20 20 20 20 20 24 70 6c 61 $pla
aeb0: 74 66 6f 72 6d 20 2f 5d 20 3a 20 22 22 7d 5d 20 tform /] : ""}]
aec0: 24 79 65 61 72 20 2f 20 24 63 6f 6e 66 69 67 75 $year / $configu
aed0: 72 61 74 69 6f 6e 20 22 29 5c 6e 22 5d 0d 0a 0d ration ")\n"]...
aee0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
aef0: 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 return true..
af00: 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c } el
af10: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
af20: 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
af30: 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a 20 20 20 20 nnel yes\n..
af40: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
af50: 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 } else
af60: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
af70: 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
af80: 6e 6f 5c 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 no\n..
af90: 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
afa0: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
afb0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 }.... re
afc0: 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 turn false..
afd0: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 }..... proc c
afe0: 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 52 65 6c heckForSQLiteRel
aff0: 65 61 73 65 73 20 7b 20 63 68 61 6e 6e 65 6c 20 eases { channel
b000: 7b 73 65 6c 65 63 74 20 66 61 6c 73 65 7d 20 7d {select false} }
b010: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
b020: 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b # NOTE: Check
b030: 20 66 6f 72 20 70 61 73 74 20 72 65 6c 65 61 73 for past releas
b040: 65 73 20 6f 66 20 53 79 73 74 65 6d 2e 44 61 74 es of System.Dat
b050: 61 2e 53 51 4c 69 74 65 20 69 6e 20 74 68 65 20 a.SQLite in the
b060: 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 directory..
b070: 20 23 20 20 20 20 20 20 20 63 6f 6e 74 61 69 6e # contain
b080: 65 64 20 69 6e 20 74 68 65 20 22 53 79 73 74 65 ed in the "Syste
b090: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 22 20 65 m.Data.SQLite" e
b0a0: 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 nvironment varia
b0b0: 62 6c 65 2c 20 69 66 0d 0a 20 20 20 20 20 20 23 ble, if.. #
b0c0: 20 20 20 20 20 20 20 70 72 65 73 65 6e 74 2e 0d present..
b0d0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
b0e0: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
b0f0: 20 3a 3a 65 6e 76 28 53 79 73 74 65 6d 2e 44 61 ::env(System.Da
b100: 74 61 2e 53 51 4c 69 74 65 29 5d 20 26 26 20 5c ta.SQLite)] && \
b110: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 .. [str
b120: 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 65 6e ing length $::en
b130: 76 28 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 v(System.Data.SQ
b140: 4c 69 74 65 29 5d 20 3e 20 30 7d 20 74 68 65 6e Lite)] > 0} then
b150: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
b160: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 # NOTE: B
b170: 75 69 6c 64 20 74 68 65 20 66 75 6c 6c 79 20 71 uild the fully q
b180: 75 61 6c 69 66 69 65 64 20 64 69 72 65 63 74 6f ualified directo
b190: 72 79 20 77 68 65 72 65 20 74 68 65 20 6e 65 63 ry where the nec
b1a0: 65 73 73 61 72 79 0d 0a 20 20 20 20 20 20 20 20 essary..
b1b0: 23 20 20 20 20 20 20 20 63 6f 6d 70 6f 6e 65 6e # componen
b1c0: 74 73 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 61 ts for System.Da
b1d0: 74 61 2e 53 51 4c 69 74 65 20 73 68 6f 75 6c 64 ta.SQLite should
b1e0: 20 62 65 20 66 6f 75 6e 64 2e 0d 0a 20 20 20 20 be found...
b1f0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 #.. s
b200: 65 74 20 64 69 72 65 63 74 6f 72 79 20 5b 66 69 et directory [fi
b210: 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 le nativename [f
b220: 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 ile join \..
b230: 20 20 20 20 20 20 20 20 24 3a 3a 65 6e 76 28 53 $::env(S
b240: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
b250: 65 29 20 5b 67 65 74 52 65 6c 65 61 73 65 56 65 e) [getReleaseVe
b260: 72 73 69 6f 6e 5d 5d 5d 0d 0a 0d 0a 20 20 20 20 rsion]]]....
b270: 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
b280: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
b290: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d .. "-
b2a0: 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 --- checking for
b2b0: 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
b2c0: 69 74 65 20 72 65 6c 65 61 73 65 20 5c 22 22 20 ite release \""
b2d0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 \.. $
b2e0: 64 69 72 65 63 74 6f 72 79 20 22 5c 22 2e 2e 2e directory "\"...
b2f0: 20 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 "].... i
b300: 66 20 7b 5b 69 73 52 65 6c 65 61 73 65 41 76 61 f {[isReleaseAva
b310: 69 6c 61 62 6c 65 20 24 64 69 72 65 63 74 6f 72 ilable $director
b320: 79 20 70 6c 61 74 66 6f 72 6d 5d 7d 20 74 68 65 y platform]} the
b330: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 n {.. i
b340: 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 f {[string lengt
b350: 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3d 3d 20 h $platform] ==
b360: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
b370: 20 20 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 set platf
b380: 6f 72 6d 20 75 6e 6b 6e 6f 77 6e 0d 0a 20 20 20 orm unknown..
b390: 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
b3a0: 20 20 20 20 20 20 69 66 20 7b 24 73 65 6c 65 63 if {$selec
b3b0: 74 20 26 26 20 5b 6d 61 74 63 68 4d 61 63 68 69 t && [matchMachi
b3c0: 6e 65 20 24 70 6c 61 74 66 6f 72 6d 5d 7d 20 74 ne $platform]} t
b3d0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
b3e0: 20 20 20 73 65 74 20 3a 3a 62 75 69 6c 64 5f 64 set ::build_d
b3f0: 69 72 65 63 74 6f 72 79 20 24 64 69 72 65 63 74 irectory $direct
b400: 6f 72 79 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 ory....
b410: 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
b420: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 79 l [appendArgs "y
b430: 65 73 2c 20 73 65 6c 65 63 74 65 64 20 28 22 20 es, selected ("
b440: 24 70 6c 61 74 66 6f 72 6d 20 22 29 5c 6e 22 5d $platform ")\n"]
b450: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
b460: 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 return true..
b470: 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
b480: 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
b490: 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
b4a0: 65 6e 64 41 72 67 73 20 22 79 65 73 20 28 22 20 endArgs "yes ("
b4b0: 24 70 6c 61 74 66 6f 72 6d 20 22 29 5c 6e 22 5d $platform ")\n"]
b4c0: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
b4d0: 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
b4e0: 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
b4f0: 20 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a $channel no\n..
b500: 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 .. fore
b510: 61 63 68 20 70 61 74 68 20 5b 6c 73 6f 72 74 20 ach path [lsort
b520: 2d 64 65 63 72 65 61 73 69 6e 67 20 5b 66 69 6c -decreasing [fil
b530: 65 20 6c 69 73 74 20 24 64 69 72 65 63 74 6f 72 e list $director
b540: 79 20 2a 5d 5d 20 7b 0d 0a 20 20 20 20 20 20 20 y *]] {..
b550: 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 if {[file e
b560: 78 69 73 74 73 20 24 70 61 74 68 5d 20 26 26 20 xists $path] &&
b570: 5b 66 69 6c 65 20 69 73 64 69 72 65 63 74 6f 72 [file isdirector
b580: 79 20 24 70 61 74 68 5d 7d 20 74 68 65 6e 20 7b y $path]} then {
b590: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
b5a0: 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
b5b0: 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
b5c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
b5d0: 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 "---- checking f
b5e0: 6f 72 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 or System.Data.S
b5f0: 51 4c 69 74 65 20 72 65 6c 65 61 73 65 20 5c 22 QLite release \"
b600: 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
b610: 20 20 20 20 20 20 20 24 70 61 74 68 20 22 5c 22 $path "\"
b620: 2e 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 ... "]....
b630: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 73 52 if {[isR
b640: 65 6c 65 61 73 65 41 76 61 69 6c 61 62 6c 65 20 eleaseAvailable
b650: 24 70 61 74 68 20 70 6c 61 74 66 6f 72 6d 5d 7d $path platform]}
b660: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
b670: 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 if {[st
b680: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 ring length $pla
b690: 74 66 6f 72 6d 5d 20 3d 3d 20 30 7d 20 74 68 65 tform] == 0} the
b6a0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
b6b0: 20 20 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 set platf
b6c0: 6f 72 6d 20 75 6e 6b 6e 6f 77 6e 0d 0a 20 20 20 orm unknown..
b6d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
b6e0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
b6f0: 20 20 69 66 20 7b 24 73 65 6c 65 63 74 20 26 26 if {$select &&
b700: 20 5b 6d 61 74 63 68 4d 61 63 68 69 6e 65 20 24 [matchMachine $
b710: 70 6c 61 74 66 6f 72 6d 5d 7d 20 74 68 65 6e 20 platform]} then
b720: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
b730: 20 20 20 20 20 73 65 74 20 3a 3a 62 75 69 6c 64 set ::build
b740: 5f 64 69 72 65 63 74 6f 72 79 20 24 70 61 74 68 _directory $path
b750: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
b760: 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
b770: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
b780: 20 22 79 65 73 2c 20 73 65 6c 65 63 74 65 64 20 "yes, selected
b790: 28 22 20 24 70 6c 61 74 66 6f 72 6d 20 22 29 5c (" $platform ")\
b7a0: 6e 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 n"]....
b7b0: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
b7c0: 74 72 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 true..
b7d0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
b7e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
b7f0: 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
b800: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 79 65 [appendArgs "ye
b810: 73 20 28 22 20 24 70 6c 61 74 66 6f 72 6d 20 22 s (" $platform "
b820: 29 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 )\n"]..
b830: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
b840: 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
b850: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
b860: 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
b870: 20 6e 6f 5c 6e 0d 0a 20 20 20 20 20 20 20 20 20 no\n..
b880: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
b890: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
b8a0: 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
b8b0: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
b8c0: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
b8d0: 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
b8e0: 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
b8f0: 20 22 2d 2d 2d 2d 20 65 6e 76 69 72 6f 6e 6d 65 "---- environme
b900: 6e 74 20 76 61 72 69 61 62 6c 65 20 5c 22 53 79 nt variable \"Sy
b910: 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
b920: 5c 22 20 69 73 20 6e 6f 74 20 22 20 5c 0d 0a 20 \" is not " \..
b930: 20 20 20 20 20 20 20 20 20 20 20 22 73 65 74 2c "set,
b940: 20 73 6b 69 70 70 69 6e 67 20 63 68 65 63 6b 20 skipping check
b950: 66 6f 72 20 72 65 6c 65 61 73 65 73 2e 2e 2e 5c for releases...\
b960: 6e 22 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a n"].. }....
b970: 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c return fal
b980: 73 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 se.. }.....
b990: 20 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 proc checkForS
b9a0: 51 4c 69 74 65 4c 69 62 72 61 72 79 20 7b 20 63 QLiteLibrary { c
b9b0: 68 61 6e 6e 65 6c 20 7d 20 7b 0d 0a 20 20 20 20 hannel } {..
b9c0: 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
b9d0: 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 "---- checking
b9e0: 66 6f 72 20 53 51 4c 69 74 65 20 63 6f 72 65 20 for SQLite core
b9f0: 6c 69 62 72 61 72 79 2e 2e 2e 20 22 0d 0a 0d 0a library... "....
ba00: 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
ba10: 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 {.. obje
ba20: 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
ba30: 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 +NonPublic \..
ba40: 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 Syste
ba50: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 m.Data.SQLite.SQ
ba60: 4c 69 74 65 33 20 53 51 4c 69 74 65 56 65 72 73 Lite3 SQLiteVers
ba70: 69 6f 6e 0d 0a 20 20 20 20 20 20 7d 20 76 65 72 ion.. } ver
ba80: 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 6e sion] == 0} then
ba90: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
baa0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 # NOTE: C
bab0: 68 65 63 6b 20 69 66 20 74 68 65 20 72 65 74 75 heck if the retu
bac0: 72 6e 65 64 20 76 65 72 73 69 6f 6e 20 77 61 73 rned version was
bad0: 20 6e 75 6c 6c 2e 20 20 49 66 20 73 6f 2c 20 6d null. If so, m
bae0: 61 6b 65 20 69 74 20 65 61 73 79 0d 0a 20 20 20 ake it easy..
baf0: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 # to
bb00: 73 70 6f 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 spot... #
bb10: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 .. if {[s
bb20: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 65 tring length $ve
bb30: 72 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 rsion] == 0} the
bb40: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 n {.. s
bb50: 65 74 20 76 65 72 73 69 6f 6e 20 6e 75 6c 6c 0d et version null.
bb60: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
bb70: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
bb80: 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 # NOTE: Attempt
bb90: 20 74 6f 20 71 75 65 72 79 20 74 68 65 20 46 6f to query the Fo
bba0: 73 73 69 6c 20 73 6f 75 72 63 65 20 69 64 65 6e ssil source iden
bbb0: 74 69 66 69 65 72 20 66 6f 72 20 74 68 65 20 53 tifier for the S
bbc0: 51 4c 69 74 65 0d 0a 20 20 20 20 20 20 20 20 23 QLite.. #
bbd0: 20 20 20 20 20 20 20 63 6f 72 65 20 6c 69 62 72 core libr
bbe0: 61 72 79 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ary... #.
bbf0: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 . if {[ca
bc00: 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
bc10: 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
bc20: 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
bc30: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
bc40: 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
bc50: 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 53 51 4c Lite.SQLite3 SQL
bc60: 69 74 65 53 6f 75 72 63 65 49 64 0d 0a 20 20 20 iteSourceId..
bc70: 20 20 20 20 20 7d 20 73 6f 75 72 63 65 49 64 5d } sourceId]
bc80: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
bc90: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
bca0: 20 23 20 4e 4f 54 45 3a 20 57 65 20 66 61 69 6c # NOTE: We fail
bcb0: 65 64 20 74 6f 20 71 75 65 72 79 20 74 68 65 20 ed to query the
bcc0: 46 6f 73 73 69 6c 20 73 6f 75 72 63 65 20 69 64 Fossil source id
bcd0: 65 6e 74 69 66 69 65 72 2e 0d 0a 20 20 20 20 20 entifier...
bce0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
bcf0: 20 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 75 set sourceId u
bd00: 6e 6b 6e 6f 77 6e 0d 0a 20 20 20 20 20 20 20 20 nknown..
bd10: 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a }.... #..
bd20: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
bd30: 43 68 65 63 6b 20 69 66 20 74 68 65 20 72 65 74 Check if the ret
bd40: 75 72 6e 65 64 20 46 6f 73 73 69 6c 20 73 6f 75 urned Fossil sou
bd50: 72 63 65 20 69 64 65 6e 74 69 66 69 65 72 20 77 rce identifier w
bd60: 61 73 20 6e 75 6c 6c 2e 20 20 49 66 0d 0a 20 20 as null. If..
bd70: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 6f # so
bd80: 2c 20 6d 61 6b 65 20 69 74 20 65 61 73 79 20 74 , make it easy t
bd90: 6f 20 73 70 6f 74 2e 0d 0a 20 20 20 20 20 20 20 o spot...
bda0: 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b #.. if {
bdb0: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
bdc0: 73 6f 75 72 63 65 49 64 5d 20 3d 3d 20 30 7d 20 sourceId] == 0}
bdd0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
bde0: 20 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 6e set sourceId n
bdf0: 75 6c 6c 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a ull.. }..
be00: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
be10: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 65 73 # NOTE: Yes
be20: 2c 20 74 68 65 20 53 51 4c 69 74 65 20 63 6f 72 , the SQLite cor
be30: 65 20 6c 69 62 72 61 72 79 20 61 70 70 65 61 72 e library appear
be40: 73 20 74 6f 20 62 65 20 61 76 61 69 6c 61 62 6c s to be availabl
be50: 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 e... #..
be60: 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 addConstr
be70: 61 69 6e 74 20 53 51 4c 69 74 65 0d 0a 0d 0a 20 aint SQLite....
be80: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
be90: 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
bea0: 73 20 22 79 65 73 20 28 22 20 24 76 65 72 73 69 s "yes (" $versi
beb0: 6f 6e 20 22 20 22 20 24 73 6f 75 72 63 65 49 64 on " " $sourceId
bec0: 20 22 29 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 7d ")\n"].. }
bed0: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
bee0: 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
bef0: 6e 6f 5c 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 no\n.. }..
bf00: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
bf10: 63 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 c checkForSQLite
bf20: 49 6e 74 65 72 6f 70 20 7b 20 63 68 61 6e 6e 65 Interop { channe
bf30: 6c 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 70 75 l } {.. tpu
bf40: 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d ts $channel "---
bf50: 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 - checking for S
bf60: 51 4c 69 74 65 20 69 6e 74 65 72 6f 70 20 61 73 QLite interop as
bf70: 73 65 6d 62 6c 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 sembly... "....
bf80: 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
bf90: 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 {.. objec
bfa0: 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 t invoke -flags
bfb0: 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 +NonPublic \..
bfc0: 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
bfd0: 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c .Data.SQLite.SQL
bfe0: 69 74 65 33 20 49 6e 74 65 72 6f 70 56 65 72 73 ite3 InteropVers
bff0: 69 6f 6e 0d 0a 20 20 20 20 20 20 7d 20 76 65 72 ion.. } ver
c000: 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 6e sion] == 0} then
c010: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
c020: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 # NOTE: C
c030: 68 65 63 6b 20 69 66 20 74 68 65 20 72 65 74 75 heck if the retu
c040: 72 6e 65 64 20 76 65 72 73 69 6f 6e 20 77 61 73 rned version was
c050: 20 6e 75 6c 6c 2e 20 20 49 66 20 73 6f 2c 20 6d null. If so, m
c060: 61 6b 65 20 69 74 20 65 61 73 79 0d 0a 20 20 20 ake it easy..
c070: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 # to
c080: 73 70 6f 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 spot... #
c090: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 .. if {[s
c0a0: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 65 tring length $ve
c0b0: 72 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 rsion] == 0} the
c0c0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 n {.. s
c0d0: 65 74 20 76 65 72 73 69 6f 6e 20 6e 75 6c 6c 0d et version null.
c0e0: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
c0f0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
c100: 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 # NOTE: Attempt
c110: 20 74 6f 20 71 75 65 72 79 20 74 68 65 20 46 6f to query the Fo
c120: 73 73 69 6c 20 73 6f 75 72 63 65 20 69 64 65 6e ssil source iden
c130: 74 69 66 69 65 72 20 66 6f 72 20 74 68 65 20 53 tifier for the S
c140: 51 4c 69 74 65 0d 0a 20 20 20 20 20 20 20 20 23 QLite.. #
c150: 20 20 20 20 20 20 20 63 6f 72 65 20 6c 69 62 72 core libr
c160: 61 72 79 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ary... #.
c170: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 . if {[ca
c180: 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
c190: 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
c1a0: 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
c1b0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
c1c0: 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
c1d0: 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 49 6e 74 Lite.SQLite3 Int
c1e0: 65 72 6f 70 53 6f 75 72 63 65 49 64 0d 0a 20 20 eropSourceId..
c1f0: 20 20 20 20 20 20 7d 20 73 6f 75 72 63 65 49 64 } sourceId
c200: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
c210: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
c220: 20 20 23 20 4e 4f 54 45 3a 20 57 65 20 66 61 69 # NOTE: We fai
c230: 6c 65 64 20 74 6f 20 71 75 65 72 79 20 74 68 65 led to query the
c240: 20 46 6f 73 73 69 6c 20 73 6f 75 72 63 65 20 69 Fossil source i
c250: 64 65 6e 74 69 66 69 65 72 2e 0d 0a 20 20 20 20 dentifier...
c260: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
c270: 20 20 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 set sourceId
c280: 75 6e 6b 6e 6f 77 6e 0d 0a 20 20 20 20 20 20 20 unknown..
c290: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d }.... #.
c2a0: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
c2b0: 20 43 68 65 63 6b 20 69 66 20 74 68 65 20 72 65 Check if the re
c2c0: 74 75 72 6e 65 64 20 46 6f 73 73 69 6c 20 73 6f turned Fossil so
c2d0: 75 72 63 65 20 69 64 65 6e 74 69 66 69 65 72 20 urce identifier
c2e0: 77 61 73 20 6e 75 6c 6c 2e 20 20 49 66 0d 0a 20 was null. If..
c2f0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 # s
c300: 6f 2c 20 6d 61 6b 65 20 69 74 20 65 61 73 79 20 o, make it easy
c310: 74 6f 20 73 70 6f 74 2e 0d 0a 20 20 20 20 20 20 to spot...
c320: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 #.. if
c330: 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
c340: 24 73 6f 75 72 63 65 49 64 5d 20 3d 3d 20 30 7d $sourceId] == 0}
c350: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
c360: 20 20 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 set sourceId
c370: 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 20 20 7d 0d null.. }.
c380: 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
c390: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 65 # NOTE: Ye
c3a0: 73 2c 20 74 68 65 20 53 51 4c 69 74 65 20 69 6e s, the SQLite in
c3b0: 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 61 terop assembly a
c3c0: 70 70 65 61 72 73 20 74 6f 20 62 65 20 61 76 61 ppears to be ava
c3d0: 69 6c 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 20 ilable...
c3e0: 20 23 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 #.. addC
c3f0: 6f 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 74 65 onstraint SQLite
c400: 49 6e 74 65 72 6f 70 0d 0a 0d 0a 20 20 20 20 20 Interop....
c410: 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
c420: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 79 l [appendArgs "y
c430: 65 73 20 28 22 20 24 76 65 72 73 69 6f 6e 20 22 es (" $version "
c440: 20 22 20 24 73 6f 75 72 63 65 49 64 20 22 29 5c " $sourceId ")\
c450: 6e 22 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 n"].. } els
c460: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 e {.. tpu
c470: 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e ts $channel no\n
c480: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
c490: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 68 ..... proc ch
c4a0: 65 63 6b 46 6f 72 53 51 4c 69 74 65 44 65 66 69 eckForSQLiteDefi
c4b0: 6e 65 43 6f 6e 73 74 61 6e 74 20 7b 20 63 68 61 neConstant { cha
c4c0: 6e 6e 65 6c 20 6e 61 6d 65 20 7d 20 7b 0d 0a 20 nnel name } {..
c4d0: 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
c4e0: 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
c4f0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 22 2d 2d \.. "--
c500: 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 -- checking for
c510: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
c520: 74 65 20 64 65 66 69 6e 65 20 63 6f 6e 73 74 61 te define consta
c530: 6e 74 20 5c 22 22 20 24 6e 61 6d 65 20 5c 0d 0a nt \"" $name \..
c540: 20 20 20 20 20 20 20 20 20 20 22 5c 22 2e 2e 2e "\"...
c550: 20 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 "].... if
c560: 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
c570: 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
c580: 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c -flags +NonPubl
c590: 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ic \..
c5a0: 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
c5b0: 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 44 65 66 Lite.SQLite3 Def
c5c0: 69 6e 65 43 6f 6e 73 74 61 6e 74 73 0d 0a 20 20 ineConstants..
c5d0: 20 20 20 20 7d 20 64 65 66 69 6e 65 43 6f 6e 73 } defineCons
c5e0: 74 61 6e 74 73 5d 20 3d 3d 20 30 7d 20 74 68 65 tants] == 0} the
c5f0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
c600: 7b 5b 6c 73 65 61 72 63 68 20 2d 65 78 61 63 74 {[lsearch -exact
c610: 20 2d 6e 6f 63 61 73 65 20 24 64 65 66 69 6e 65 -nocase $define
c620: 43 6f 6e 73 74 61 6e 74 73 20 24 6e 61 6d 65 5d Constants $name]
c630: 20 21 3d 20 2d 31 7d 20 74 68 65 6e 20 7b 0d 0a != -1} then {..
c640: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
c650: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 # NOTE: Y
c660: 65 73 2c 20 74 68 69 73 20 64 65 66 69 6e 65 20 es, this define
c670: 63 6f 6e 73 74 61 6e 74 20 77 61 73 20 65 6e 61 constant was ena
c680: 62 6c 65 64 20 77 68 65 6e 20 74 68 65 20 6d 61 bled when the ma
c690: 6e 61 67 65 64 0d 0a 20 20 20 20 20 20 20 20 20 naged..
c6a0: 20 23 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c # assembl
c6b0: 79 20 77 61 73 20 63 6f 6d 70 69 6c 65 64 2e 0d y was compiled..
c6c0: 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
c6d0: 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 addConst
c6e0: 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
c6f0: 73 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 s defineConstant
c700: 2e 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c .System.Data.SQL
c710: 69 74 65 2e 20 24 6e 61 6d 65 5d 0d 0a 0d 0a 20 ite. $name]....
c720: 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
c730: 63 68 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a 20 channel yes\n..
c740: 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
c750: 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
c760: 20 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a $channel no\n..
c770: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
c780: 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
c790: 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
c7a0: 6c 20 65 72 72 6f 72 5c 6e 0d 0a 20 20 20 20 20 l error\n..
c7b0: 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
c7c0: 20 20 70 72 6f 63 20 67 65 74 44 61 74 65 54 69 proc getDateTi
c7d0: 6d 65 46 6f 72 6d 61 74 20 7b 7d 20 7b 0d 0a 20 meFormat {} {..
c7e0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
c7f0: 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f 63 65 NOTE: This proce
c800: 64 75 72 65 20 73 69 6d 70 6c 79 20 72 65 74 75 dure simply retu
c810: 72 6e 73 20 74 68 65 20 22 64 65 66 61 75 6c 74 rns the "default
c820: 22 20 44 61 74 65 54 69 6d 65 20 66 6f 72 6d 61 " DateTime forma
c830: 74 20 75 73 65 64 0d 0a 20 20 20 20 20 20 23 20 t used.. #
c840: 20 20 20 20 20 20 62 79 20 74 68 65 20 74 65 73 by the tes
c850: 74 20 73 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 t suite...
c860: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e #.. if {[in
c870: 66 6f 20 65 78 69 73 74 73 20 3a 3a 64 61 74 65 fo exists ::date
c880: 74 69 6d 65 5f 66 6f 72 6d 61 74 5d 20 26 26 20 time_format] &&
c890: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 \.. [st
c8a0: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 64 ring length $::d
c8b0: 61 74 65 74 69 6d 65 5f 66 6f 72 6d 61 74 5d 20 atetime_format]
c8c0: 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
c8d0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
c8e0: 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 74 # NOTE: Return t
c8f0: 68 65 20 6d 61 6e 75 61 6c 6c 79 20 6f 76 65 72 he manually over
c900: 72 69 64 64 65 6e 20 76 61 6c 75 65 20 66 6f 72 ridden value for
c910: 20 74 68 65 20 44 61 74 65 54 69 6d 65 20 66 6f the DateTime fo
c920: 72 6d 61 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 rmat... #
c930: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
c940: 20 24 3a 3a 64 61 74 65 74 69 6d 65 5f 66 6f 72 $::datetime_for
c950: 6d 61 74 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 mat.. } els
c960: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a e {.. #..
c970: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
c980: 52 65 74 75 72 6e 20 61 6e 20 49 53 4f 38 36 30 Return an ISO860
c990: 31 20 44 61 74 65 54 69 6d 65 20 66 6f 72 6d 61 1 DateTime forma
c9a0: 74 20 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74 t compatible wit
c9b0: 68 20 53 51 4c 69 74 65 2c 0d 0a 20 20 20 20 20 h SQLite,..
c9c0: 20 20 20 23 20 20 20 20 20 20 20 53 79 73 74 65 # Syste
c9d0: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2c 20 61 m.Data.SQLite, a
c9e0: 6e 64 20 73 75 69 74 61 62 6c 65 20 66 6f 72 20 nd suitable for
c9f0: 72 6f 75 6e 64 2d 74 72 69 70 70 69 6e 67 20 77 round-tripping w
ca00: 69 74 68 20 74 68 65 0d 0a 20 20 20 20 20 20 20 ith the..
ca10: 20 23 20 20 20 20 20 20 20 44 61 74 65 54 69 6d # DateTim
ca20: 65 20 63 6c 61 73 73 20 6f 66 20 74 68 65 20 66 e class of the f
ca30: 72 61 6d 65 77 6f 72 6b 2e 20 20 49 66 20 74 68 ramework. If th
ca40: 69 73 20 76 61 6c 75 65 20 69 73 20 63 68 61 6e is value is chan
ca50: 67 65 64 2c 0d 0a 20 20 20 20 20 20 20 20 23 20 ged,.. #
ca60: 20 20 20 20 20 20 76 61 72 69 6f 75 73 20 74 65 various te
ca70: 73 74 73 20 6d 61 79 20 66 61 69 6c 2e 0d 0a 20 sts may fail...
ca80: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
ca90: 20 20 72 65 74 75 72 6e 20 22 79 79 79 79 2d 4d return "yyyy-M
caa0: 4d 2d 64 64 20 48 48 3a 6d 6d 3a 73 73 2e 46 46 M-dd HH:mm:ss.FF
cab0: 46 46 46 46 46 4b 22 0d 0a 20 20 20 20 20 20 7d FFFFFK".. }
cac0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
cad0: 70 72 6f 63 20 65 6e 75 6d 65 72 61 62 6c 65 54 proc enumerableT
cae0: 6f 4c 69 73 74 20 7b 20 65 6e 75 6d 65 72 61 62 oList { enumerab
caf0: 6c 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 le } {.. se
cb00: 74 20 72 65 73 75 6c 74 20 5b 6c 69 73 74 5d 0d t result [list].
cb10: 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 ... if {[st
cb20: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 65 6e 75 ring length $enu
cb30: 6d 65 72 61 62 6c 65 5d 20 3d 3d 20 30 20 7c 7c merable] == 0 ||
cb40: 20 24 65 6e 75 6d 65 72 61 62 6c 65 20 65 71 20 $enumerable eq
cb50: 22 6e 75 6c 6c 22 7d 20 74 68 65 6e 20 7b 0d 0a "null"} then {..
cb60: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
cb70: 72 65 73 75 6c 74 0d 0a 20 20 20 20 20 20 7d 0d result.. }.
cb80: 0a 0d 0a 20 20 20 20 20 20 6f 62 6a 65 63 74 20 ... object
cb90: 66 6f 72 65 61 63 68 20 2d 61 6c 69 61 73 20 69 foreach -alias i
cba0: 74 65 6d 20 24 65 6e 75 6d 65 72 61 62 6c 65 20 tem $enumerable
cbb0: 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b {.. if {[
cbc0: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 69 string length $i
cbd0: 74 65 6d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b tem] > 0} then {
cbe0: 0d 0a 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 .. lapp
cbf0: 65 6e 64 20 72 65 73 75 6c 74 20 5b 24 69 74 65 end result [$ite
cc00: 6d 20 54 6f 53 74 72 69 6e 67 5d 0d 0a 20 20 20 m ToString]..
cc10: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d }.. }.
cc20: 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 ... return
cc30: 24 72 65 73 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a $result.. }..
cc40: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 61 74 63 ... proc catc
cc50: 68 41 6e 64 52 65 74 75 72 6e 20 7b 20 73 63 72 hAndReturn { scr
cc60: 69 70 74 20 7b 73 74 61 63 6b 54 72 61 63 65 20 ipt {stackTrace
cc70: 66 61 6c 73 65 7d 20 7b 73 74 72 69 63 74 20 74 false} {strict t
cc80: 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 rue} } {..
cc90: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
cca0: 20 45 76 61 6c 75 61 74 65 20 74 68 65 20 73 63 Evaluate the sc
ccb0: 72 69 70 74 20 70 72 6f 76 69 64 65 64 20 62 79 ript provided by
ccc0: 20 6f 75 72 20 63 61 6c 6c 65 72 20 69 6e 20 74 our caller in t
ccd0: 68 65 69 72 20 63 6f 6e 74 65 78 74 2c 0d 0a 20 heir context,..
cce0: 20 20 20 20 20 23 20 20 20 20 20 20 20 63 61 70 # cap
ccf0: 74 75 72 69 6e 67 20 62 6f 74 68 20 74 68 65 20 turing both the
cd00: 72 65 73 75 6c 74 20 61 6e 64 20 74 68 65 20 72 result and the r
cd10: 65 74 75 72 6e 20 63 6f 64 65 2e 0d 0a 20 20 20 eturn code...
cd20: 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 #.. set
cd30: 63 6f 64 65 20 5b 63 61 74 63 68 20 7b 75 70 6c code [catch {upl
cd40: 65 76 65 6c 20 31 20 24 73 63 72 69 70 74 7d 20 evel 1 $script}
cd50: 72 65 73 75 6c 74 5d 0d 0a 0d 0a 20 20 20 20 20 result]....
cd60: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
cd70: 3a 20 44 69 64 20 74 68 65 20 73 63 72 69 70 74 : Did the script
cd80: 20 70 72 6f 76 69 64 65 64 20 62 79 20 6f 75 72 provided by our
cd90: 20 63 61 6c 6c 65 72 20 4e 4f 54 20 72 61 69 73 caller NOT rais
cda0: 65 20 61 6e 20 65 72 72 6f 72 3f 0d 0a 20 20 20 e an error?..
cdb0: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
cdc0: 24 73 74 72 69 63 74 20 26 26 20 24 63 6f 64 65 $strict && $code
cdd0: 20 3d 3d 20 30 20 7c 7c 20 21 24 73 74 72 69 63 == 0 || !$stric
cde0: 74 20 26 26 20 24 63 6f 64 65 20 21 3d 20 31 7d t && $code != 1}
cdf0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
ce00: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
ce10: 54 45 3a 20 53 75 63 63 65 73 73 2e 20 20 52 65 TE: Success. Re
ce20: 74 75 72 6e 20 61 20 6c 69 73 74 20 77 69 74 68 turn a list with
ce30: 20 74 68 65 20 72 65 74 75 72 6e 20 63 6f 64 65 the return code
ce40: 20 61 6e 64 20 74 68 65 20 72 65 73 75 6c 74 2e and the result.
ce50: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
ce60: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 return [lis
ce70: 74 20 24 63 6f 64 65 20 24 72 65 73 75 6c 74 5d t $code $result]
ce80: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 .. } elseif
ce90: 20 7b 24 73 74 61 63 6b 54 72 61 63 65 7d 20 74 {$stackTrace} t
cea0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
ceb0: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
cec0: 3a 20 46 61 69 6c 75 72 65 2e 20 20 4f 75 72 20 : Failure. Our
ced0: 63 61 6c 6c 65 72 20 77 61 6e 74 73 20 61 20 66 caller wants a f
cee0: 75 6c 6c 20 73 74 61 63 6b 20 74 72 61 63 65 20 ull stack trace
cef0: 28 69 66 20 61 70 70 6c 69 63 61 62 6c 65 29 2c (if applicable),
cf00: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
cf10: 20 20 72 65 74 75 72 6e 20 61 20 6c 69 73 74 20 return a list
cf20: 77 69 74 68 20 74 68 65 20 72 65 74 75 72 6e 20 with the return
cf30: 63 6f 64 65 20 61 6e 64 20 74 68 65 20 72 65 73 code and the res
cf40: 75 6c 74 20 76 65 72 62 61 74 69 6d 2e 0d 0a 20 ult verbatim...
cf50: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
cf60: 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 24 return [list $
cf70: 63 6f 64 65 20 24 72 65 73 75 6c 74 5d 0d 0a 20 code $result]..
cf80: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
cf90: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
cfa0: 20 20 23 20 4e 4f 54 45 3a 20 46 61 69 6c 75 72 # NOTE: Failur
cfb0: 65 2e 20 20 4f 75 72 20 63 61 6c 6c 65 72 20 64 e. Our caller d
cfc0: 6f 65 73 20 6e 6f 74 20 77 61 6e 74 20 61 20 66 oes not want a f
cfd0: 75 6c 6c 20 73 74 61 63 6b 20 74 72 61 63 65 20 ull stack trace
cfe0: 28 69 66 0d 0a 20 20 20 20 20 20 20 20 23 20 20 (if.. #
cff0: 20 20 20 20 20 61 70 70 6c 69 63 61 62 6c 65 29 applicable)
d000: 2c 20 72 65 74 75 72 6e 20 61 20 6c 69 73 74 20 , return a list
d010: 77 69 74 68 20 74 68 65 20 72 65 74 75 72 6e 20 with the return
d020: 63 6f 64 65 2c 20 74 68 65 20 65 72 72 6f 72 0d code, the error.
d030: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
d040: 20 63 6f 64 65 20 66 6f 72 20 74 68 65 20 69 6e code for the in
d050: 74 65 72 70 72 65 74 65 72 2c 20 61 6e 64 20 74 terpreter, and t
d060: 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65 he error message
d070: 20 75 70 20 74 6f 20 74 68 65 0d 0a 20 20 20 20 up to the..
d080: 20 20 20 20 23 20 20 20 20 20 20 20 70 6f 69 6e # poin
d090: 74 20 77 68 65 72 65 20 74 68 65 20 73 74 61 63 t where the stac
d0a0: 6b 20 74 72 61 63 65 20 73 68 6f 75 6c 64 20 73 k trace should s
d0b0: 74 61 72 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 tart... #
d0c0: 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 69 6e .. set in
d0d0: 64 65 78 20 5b 73 74 72 69 6e 67 20 66 69 72 73 dex [string firs
d0e0: 74 20 22 20 20 20 61 74 20 22 20 24 72 65 73 75 t " at " $resu
d0f0: 6c 74 5d 3b 20 23 20 48 41 43 4b 3a 20 52 65 6c lt]; # HACK: Rel
d100: 69 61 62 6c 65 3f 0d 0a 0d 0a 20 20 20 20 20 20 iable?....
d110: 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 24 return [list $
d120: 63 6f 64 65 20 24 3a 3a 65 72 72 6f 72 43 6f 64 code $::errorCod
d130: 65 20 5b 65 78 70 72 20 7b 24 69 6e 64 65 78 20 e [expr {$index
d140: 21 3d 20 2d 31 20 3f 20 5c 0d 0a 20 20 20 20 20 != -1 ? \..
d150: 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 74 [string t
d160: 72 69 6d 20 5b 73 74 72 69 6e 67 20 72 61 6e 67 rim [string rang
d170: 65 20 24 72 65 73 75 6c 74 20 30 20 24 69 6e 64 e $result 0 $ind
d180: 65 78 5d 5d 20 3a 20 24 72 65 73 75 6c 74 7d 5d ex]] : $result}]
d190: 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 ].. }..
d1a0: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 }..... proc c
d1b0: 6f 6d 70 69 6c 65 43 53 68 61 72 70 57 69 74 68 ompileCSharpWith
d1c0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
d1d0: 74 65 78 74 20 6d 65 6d 6f 72 79 20 73 79 6d 62 text memory symb
d1e0: 6f 6c 73 20 73 74 72 69 63 74 20 72 65 73 75 6c ols strict resul
d1f0: 74 73 56 61 72 4e 61 6d 65 20 65 72 72 6f 72 73 tsVarName errors
d200: 56 61 72 4e 61 6d 65 20 66 69 6c 65 4e 61 6d 65 VarName fileName
d210: 73 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 61 s.. a
d220: 72 67 73 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 rgs } {.. #
d230: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
d240: 53 69 6e 63 65 20 77 65 20 61 72 65 20 67 6f 69 Since we are goi
d250: 6e 67 20 74 6f 20 75 73 65 20 74 68 69 73 20 6d ng to use this m
d260: 65 74 68 6f 64 20 6e 61 6d 65 20 61 20 6c 6f 74 ethod name a lot
d270: 2c 20 61 73 73 69 67 6e 20 69 74 20 74 6f 20 61 , assign it to a
d280: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
d290: 76 61 72 69 61 62 6c 65 20 66 69 72 73 74 2e 0d variable first..
d2a0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
d2b0: 73 65 74 20 61 64 64 20 52 65 66 65 72 65 6e 63 set add Referenc
d2c0: 65 64 41 73 73 65 6d 62 6c 69 65 73 2e 41 64 64 edAssemblies.Add
d2d0: 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
d2e0: 20 20 20 23 20 4e 4f 54 45 3a 20 43 72 65 61 74 # NOTE: Creat
d2f0: 65 20 74 68 65 20 62 61 73 65 20 63 6f 6d 6d 61 e the base comma
d300: 6e 64 20 74 6f 20 65 76 61 6c 75 61 74 65 20 61 nd to evaluate a
d310: 6e 64 20 61 64 64 20 74 68 65 20 70 72 6f 70 65 nd add the prope
d320: 72 74 79 20 73 65 74 74 69 6e 67 73 0d 0a 20 20 rty settings..
d330: 20 20 20 20 23 20 20 20 20 20 20 20 74 68 61 74 # that
d340: 20 61 72 65 20 61 6c 6d 6f 73 74 20 61 6c 77 61 are almost alwa
d350: 79 73 20 6e 65 65 64 65 64 20 62 79 20 6f 75 72 ys needed by our
d360: 20 75 6e 69 74 20 74 65 73 74 73 20 28 69 2e 65 unit tests (i.e
d370: 2e 20 74 68 65 20 53 79 73 74 65 6d 0d 0a 20 20 . the System..
d380: 20 20 20 20 23 20 20 20 20 20 20 20 61 6e 64 20 # and
d390: 53 79 73 74 65 6d 2e 44 61 74 61 20 61 73 73 65 System.Data asse
d3a0: 6d 62 6c 79 20 72 65 66 65 72 65 6e 63 65 73 29 mbly references)
d3b0: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
d3c0: 20 20 73 65 74 20 63 6f 6d 6d 61 6e 64 20 5b 6c set command [l
d3d0: 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ist \..
d3e0: 20 63 6f 6d 70 69 6c 65 43 53 68 61 72 70 20 24 compileCSharp $
d3f0: 74 65 78 74 20 24 6d 65 6d 6f 72 79 20 24 73 79 text $memory $sy
d400: 6d 62 6f 6c 73 20 24 73 74 72 69 63 74 20 72 65 mbols $strict re
d410: 73 75 6c 74 73 20 65 72 72 6f 72 73 20 5c 0d 0a sults errors \..
d420: 20 20 20 20 20 20 20 20 20 20 24 61 64 64 20 53 $add S
d430: 79 73 74 65 6d 2e 64 6c 6c 20 24 61 64 64 20 53 ystem.dll $add S
d440: 79 73 74 65 6d 2e 44 61 74 61 2e 64 6c 6c 20 24 ystem.Data.dll $
d450: 61 64 64 20 53 79 73 74 65 6d 2e 54 72 61 6e 73 add System.Trans
d460: 61 63 74 69 6f 6e 73 2e 64 6c 6c 20 5c 0d 0a 20 actions.dll \..
d470: 20 20 20 20 20 20 20 20 20 24 61 64 64 20 53 79 $add Sy
d480: 73 74 65 6d 2e 58 6d 6c 2e 64 6c 6c 5d 0d 0a 0d stem.Xml.dll]...
d490: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
d4a0: 23 20 4e 4f 54 45 3a 20 41 64 64 20 61 6c 6c 20 # NOTE: Add all
d4b0: 74 68 65 20 70 72 6f 76 69 64 65 64 20 66 69 6c the provided fil
d4c0: 65 20 6e 61 6d 65 73 20 61 73 20 61 73 73 65 6d e names as assem
d4d0: 62 6c 79 20 72 65 66 65 72 65 6e 63 65 73 2e 0d bly references..
d4e0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
d4f0: 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 foreach fileName
d500: 20 24 66 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 $fileNames {..
d510: 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 63 lappend c
d520: 6f 6d 6d 61 6e 64 20 24 61 64 64 20 5b 67 65 74 ommand $add [get
d530: 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 BinaryFileName $
d540: 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 fileName]..
d550: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
d560: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 64 64 # NOTE: Add
d570: 20 74 68 65 20 65 78 74 72 61 20 61 72 67 75 6d the extra argum
d580: 65 6e 74 73 2c 20 69 66 20 61 6e 79 2c 20 74 6f ents, if any, to
d590: 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 the command to
d5a0: 65 76 61 6c 75 61 74 65 2e 0d 0a 20 20 20 20 20 evaluate...
d5b0: 20 23 0d 0a 20 20 20 20 20 20 65 76 61 6c 20 6c #.. eval l
d5c0: 61 70 70 65 6e 64 20 63 6f 6d 6d 61 6e 64 20 24 append command $
d5d0: 61 72 67 73 0d 0a 0d 0a 20 20 20 20 20 20 23 0d args.... #.
d5e0: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 . # NOTE: A
d5f0: 6c 69 61 73 20 74 68 65 20 63 6f 6d 70 69 6c 65 lias the compile
d600: 72 20 6c 6f 63 61 6c 20 72 65 73 75 6c 74 73 20 r local results
d610: 61 6e 64 20 65 72 72 6f 72 73 20 76 61 72 69 61 and errors varia
d620: 62 6c 65 73 20 74 6f 20 74 68 65 0d 0a 20 20 20 bles to the..
d630: 20 20 20 23 20 20 20 20 20 20 20 76 61 72 69 61 # varia
d640: 62 6c 65 20 6e 61 6d 65 73 20 70 72 6f 76 69 64 ble names provid
d650: 65 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 ed by our caller
d660: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
d670: 20 20 75 70 76 61 72 20 31 20 24 72 65 73 75 6c upvar 1 $resul
d680: 74 73 56 61 72 4e 61 6d 65 20 72 65 73 75 6c 74 tsVarName result
d690: 73 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 s.. upvar 1
d6a0: 20 24 65 72 72 6f 72 73 56 61 72 4e 61 6d 65 20 $errorsVarName
d6b0: 65 72 72 6f 72 73 0d 0a 0d 0a 20 20 20 20 20 20 errors....
d6c0: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
d6d0: 20 45 76 61 6c 75 61 74 65 20 74 68 65 20 63 6f Evaluate the co
d6e0: 6e 73 74 72 75 63 74 65 64 20 5b 63 6f 6d 70 69 nstructed [compi
d6f0: 6c 65 43 53 68 61 72 70 5d 20 63 6f 6d 6d 61 6e leCSharp] comman
d700: 64 20 61 6e 64 20 72 65 74 75 72 6e 20 74 68 65 d and return the
d710: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
d720: 72 65 73 75 6c 74 2e 0d 0a 20 20 20 20 20 20 23 result... #
d730: 0d 0a 20 20 20 20 20 20 65 76 61 6c 20 24 63 6f .. eval $co
d740: 6d 6d 61 6e 64 0d 0a 20 20 20 20 7d 0d 0a 0c 0d mmand.. }....
d750: 0a 20 20 20 20 70 72 6f 63 20 69 73 4d 65 6d 6f . proc isMemo
d760: 72 79 44 62 20 7b 20 66 69 6c 65 4e 61 6d 65 20 ryDb { fileName
d770: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
d780: 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 73 20 74 # NOTE: Is t
d790: 68 65 20 73 70 65 63 69 66 69 65 64 20 64 61 74 he specified dat
d7a0: 61 62 61 73 65 20 66 69 6c 65 20 6e 61 6d 65 20 abase file name
d7b0: 72 65 61 6c 6c 79 20 61 6e 20 69 6e 2d 6d 65 6d really an in-mem
d7c0: 6f 72 79 20 64 61 74 61 62 61 73 65 3f 0d 0a 20 ory database?..
d7d0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 #.. re
d7e0: 74 75 72 6e 20 5b 65 78 70 72 20 7b 24 66 69 6c turn [expr {$fil
d7f0: 65 4e 61 6d 65 20 65 71 20 22 3a 6d 65 6d 6f 72 eName eq ":memor
d800: 79 3a 22 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 y:" || \..
d810: 20 20 20 20 5b 73 74 72 69 6e 67 20 72 61 6e 67 [string rang
d820: 65 20 24 66 69 6c 65 4e 61 6d 65 20 30 20 31 32 e $fileName 0 12
d830: 5d 20 65 71 20 22 66 69 6c 65 3a 3a 6d 65 6d 6f ] eq "file::memo
d840: 72 79 3a 22 7d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c ry:"}].. }...
d850: 0d 0a 20 20 20 20 70 72 6f 63 20 69 73 54 61 62 .. proc isTab
d860: 6c 65 49 6e 44 62 20 7b 20 6e 61 6d 65 20 7b 76 leInDb { name {v
d870: 61 72 4e 61 6d 65 20 64 62 7d 20 7d 20 7b 0d 0a arName db} } {..
d880: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
d890: 20 4e 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 NOTE: Refer to
d8a0: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 76 61 the specified va
d8b0: 72 69 61 62 6c 65 20 28 65 2e 67 2e 20 22 64 62 riable (e.g. "db
d8c0: 22 29 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 ") in the contex
d8d0: 74 20 6f 66 20 6f 75 72 0d 0a 20 20 20 20 20 20 t of our..
d8e0: 23 20 20 20 20 20 20 20 63 61 6c 6c 65 72 2e 20 # caller.
d8f0: 20 49 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 It contains the
d900: 20 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 database connec
d910: 74 69 6f 6e 20 68 61 6e 64 6c 65 20 74 68 61 74 tion handle that
d920: 20 77 69 6c 6c 20 62 65 0d 0a 20 20 20 20 20 20 will be..
d930: 23 20 20 20 20 20 20 20 75 73 65 64 20 74 6f 20 # used to
d940: 65 78 65 63 75 74 65 20 74 68 65 20 71 75 65 72 execute the quer
d950: 79 20 75 73 65 64 20 74 6f 20 64 65 74 65 72 6d y used to determ
d960: 69 6e 65 20 69 66 20 74 68 65 20 6e 61 6d 65 64 ine if the named
d970: 20 74 61 62 6c 65 20 69 73 0d 0a 20 20 20 20 20 table is..
d980: 20 23 20 20 20 20 20 20 20 70 72 65 73 65 6e 74 # present
d990: 20 69 6e 20 74 68 61 74 20 64 61 74 61 62 61 73 in that databas
d9a0: 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e... #..
d9b0: 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 4e upvar 1 $varN
d9c0: 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 20 20 20 20 ame db....
d9d0: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
d9e0: 20 55 73 65 20 74 68 65 20 73 71 6c 69 74 65 5f Use the sqlite_
d9f0: 6d 61 73 74 65 72 20 74 61 62 6c 65 20 74 6f 20 master table to
da00: 64 65 74 65 72 6d 69 6e 65 20 69 66 20 74 68 65 determine if the
da10: 20 6e 61 6d 65 64 20 74 61 62 6c 65 20 69 73 0d named table is.
da20: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 70 . # p
da30: 72 65 73 65 6e 74 20 69 6e 20 74 68 65 20 64 61 resent in the da
da40: 74 61 62 61 73 65 2e 0d 0a 20 20 20 20 20 20 23 tabase... #
da50: 0d 0a 20 20 20 20 20 20 73 65 74 20 73 71 6c 20 .. set sql
da60: 7b 0d 0a 20 20 20 20 20 20 20 20 53 45 4c 45 43 {.. SELEC
da70: 54 20 43 4f 55 4e 54 28 2a 29 20 46 52 4f 4d 20 T COUNT(*) FROM
da80: 73 71 6c 69 74 65 5f 6d 61 73 74 65 72 20 57 48 sqlite_master WH
da90: 45 52 45 20 74 79 70 65 20 3d 20 27 74 61 62 6c ERE type = 'tabl
daa0: 65 27 20 41 4e 44 20 6e 61 6d 65 20 3d 20 3f 3b e' AND name = ?;
dab0: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
dac0: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
dad0: 54 45 3a 20 52 65 74 75 72 6e 20 6e 6f 6e 2d 7a TE: Return non-z
dae0: 65 72 6f 20 69 66 20 74 68 65 20 6e 61 6d 65 64 ero if the named
daf0: 20 74 61 62 6c 65 20 69 73 20 70 72 65 73 65 6e table is presen
db00: 74 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 t... #..
db10: 20 20 20 72 65 74 75 72 6e 20 5b 65 78 70 72 20 return [expr
db20: 7b 0d 0a 20 20 20 20 20 20 20 20 5b 73 71 6c 20 {.. [sql
db30: 65 78 65 63 75 74 65 20 2d 65 78 65 63 75 74 65 execute -execute
db40: 20 73 63 61 6c 61 72 20 24 64 62 20 24 73 71 6c scalar $db $sql
db50: 20 5b 6c 69 73 74 20 70 61 72 61 6d 31 20 53 74 [list param1 St
db60: 72 69 6e 67 20 24 6e 61 6d 65 5d 5d 20 3e 20 30 ring $name]] > 0
db70: 0d 0a 20 20 20 20 20 20 7d 5d 0d 0a 20 20 20 20 .. }]..
db80: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 }..... proc t
db90: 72 69 6d 53 71 6c 20 7b 20 73 71 6c 20 7d 20 7b rimSql { sql } {
dba0: 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b .. return [
dbb0: 72 65 67 73 75 62 20 2d 61 6c 6c 20 2d 2d 20 7b regsub -all -- {
dbc0: 5c 73 2b 7d 20 5b 73 74 72 69 6e 67 20 74 72 69 \s+} [string tri
dbd0: 6d 20 24 73 71 6c 5d 20 22 20 22 5d 0d 0a 20 20 m $sql] " "]..
dbe0: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
dbf0: 20 65 78 65 63 75 74 65 53 71 6c 20 7b 20 73 71 executeSql { sq
dc00: 6c 20 7b 65 78 65 63 75 74 65 20 6e 6f 6e 65 7d l {execute none}
dc10: 20 7b 66 6f 72 6d 61 74 20 6e 6f 6e 65 7d 20 7b {format none} {
dc20: 66 69 6c 65 4e 61 6d 65 20 22 22 7d 20 7d 20 7b fileName ""} } {
dc30: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
dc40: 69 6e 67 20 6c 65 6e 67 74 68 20 24 66 69 6c 65 ing length $file
dc50: 4e 61 6d 65 5d 20 3d 3d 20 30 7d 20 74 68 65 6e Name] == 0} then
dc60: 20 7b 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 3a {set fileName :
dc70: 6d 65 6d 6f 72 79 3a 7d 0d 0a 20 20 20 20 20 20 memory:}..
dc80: 73 65 74 75 70 44 62 20 24 66 69 6c 65 4e 61 6d setupDb $fileNam
dc90: 65 20 22 22 20 22 22 20 22 22 20 22 22 20 22 22 e "" "" "" "" ""
dca0: 20 66 61 6c 73 65 20 66 61 6c 73 65 20 66 61 6c false false fal
dcb0: 73 65 20 66 61 6c 73 65 20 64 62 20 74 72 75 65 se false db true
dcc0: 0d 0a 0d 0a 20 20 20 20 20 20 74 72 79 20 7b 0d .... try {.
dcd0: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
dce0: 5b 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 [uplevel 1 [list
dcf0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
dd00: 73 71 6c 20 65 78 65 63 75 74 65 20 2d 65 78 65 sql execute -exe
dd10: 63 75 74 65 20 24 65 78 65 63 75 74 65 20 2d 66 cute $execute -f
dd20: 6f 72 6d 61 74 20 24 66 6f 72 6d 61 74 20 24 64 ormat $format $d
dd30: 62 20 24 73 71 6c 5d 5d 0d 0a 20 20 20 20 20 20 b $sql]]..
dd40: 7d 20 66 69 6e 61 6c 6c 79 20 7b 0d 0a 20 20 20 } finally {..
dd50: 20 20 20 20 20 63 6c 65 61 6e 75 70 44 62 20 24 cleanupDb $
dd60: 66 69 6c 65 4e 61 6d 65 20 64 62 20 66 61 6c 73 fileName db fals
dd70: 65 20 66 61 6c 73 65 20 66 61 6c 73 65 0d 0a 20 e false false..
dd80: 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
dd90: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 43 6f .. proc getCo
dda0: 6e 6e 65 63 74 69 6f 6e 46 6c 61 67 73 20 7b 20 nnectionFlags {
ddb0: 66 69 6c 65 4e 61 6d 65 20 66 6c 61 67 73 20 7b fileName flags {
ddc0: 71 75 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b quiet false} } {
ddd0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
dde0: 20 23 20 4e 4f 54 45 3a 20 46 69 67 75 72 65 20 # NOTE: Figure
ddf0: 6f 75 74 20 77 68 69 63 68 20 64 61 74 61 62 61 out which databa
de00: 73 65 20 66 69 6c 65 20 6e 61 6d 65 20 6f 72 20 se file name or
de10: 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e connection strin
de20: 67 20 74 68 65 73 65 0d 0a 20 20 20 20 20 20 23 g these.. #
de30: 20 20 20 20 20 20 20 63 6f 6e 6e 65 63 74 69 6f connectio
de40: 6e 20 66 6c 61 67 73 20 77 69 6c 6c 20 61 63 74 n flags will act
de50: 75 61 6c 6c 79 20 61 70 70 6c 79 20 74 6f 2e 20 ually apply to.
de60: 20 54 68 69 73 20 69 73 20 6e 6f 74 20 6e 65 63 This is not nec
de70: 65 73 73 61 72 79 0d 0a 20 20 20 20 20 20 23 20 essary.. #
de80: 20 20 20 20 20 20 69 6e 20 71 75 69 65 74 20 6d in quiet m
de90: 6f 64 65 20 62 65 63 61 75 73 65 20 74 68 69 73 ode because this
dea0: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 information is
deb0: 6f 6e 6c 79 20 75 73 65 64 20 66 6f 72 20 6c 6f only used for lo
dec0: 67 67 69 6e 67 0d 0a 20 20 20 20 20 20 23 20 20 gging.. #
ded0: 20 20 20 20 20 61 6e 64 20 72 65 70 6f 72 74 69 and reporti
dee0: 6e 67 20 70 75 72 70 6f 73 65 73 2e 0d 0a 20 20 ng purposes...
def0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
df00: 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
df10: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 .. if {[s
df20: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 66 69 tring length $fi
df30: 6c 65 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 leName] > 0} the
df40: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 n {.. s
df50: 65 74 20 64 61 74 61 62 61 73 65 20 5b 61 70 70 et database [app
df60: 65 6e 64 41 72 67 73 20 22 66 69 6c 65 20 6e 61 endArgs "file na
df70: 6d 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 me \"" $fileName
df80: 20 5c 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d 20 \"].. }
df90: 65 6c 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 elseif {[info ex
dfa0: 69 73 74 73 20 3a 3a 64 61 74 61 53 6f 75 72 63 ists ::dataSourc
dfb0: 65 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 e] && \..
dfc0: 20 20 20 20 20 21 5b 61 72 72 61 79 20 65 78 69 ![array exi
dfd0: 73 74 73 20 3a 3a 64 61 74 61 53 6f 75 72 63 65 sts ::dataSource
dfe0: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
dff0: 20 20 20 20 20 73 65 74 20 64 61 74 61 62 61 73 set databas
e000: 65 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 64 e [appendArgs "d
e010: 61 74 61 20 73 6f 75 72 63 65 20 5c 22 22 20 24 ata source \"" $
e020: 3a 3a 64 61 74 61 53 6f 75 72 63 65 20 5c 22 5d ::dataSource \"]
e030: 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
e040: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 {.. se
e050: 74 20 64 61 74 61 62 61 73 65 20 3c 75 6e 6b 6e t database <unkn
e060: 6f 77 6e 3e 0d 0a 20 20 20 20 20 20 20 20 7d 0d own>.. }.
e070: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
e080: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
e090: 45 3a 20 53 68 6f 77 20 28 61 6e 64 20 6c 6f 67 E: Show (and log
e0a0: 29 20 74 68 65 20 6c 6f 63 61 6c 20 63 6f 6e 6e ) the local conn
e0b0: 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 61 6e 64 ection flags and
e0c0: 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 0d the associated.
e0d0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 . # d
e0e0: 61 74 61 20 73 6f 75 72 63 65 20 6f 72 20 66 69 ata source or fi
e0f0: 6c 65 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 20 le name...
e100: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 24 71 #.. if {!$q
e110: 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
e120: 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
e130: 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
e140: 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
e150: 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6c 6f 63 "---- loc
e160: 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c al connection fl
e170: 61 67 73 20 66 6f 72 20 22 20 24 64 61 74 61 62 ags for " $datab
e180: 61 73 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ase \..
e190: 20 20 20 22 20 61 72 65 3a 20 22 20 5b 65 78 70 " are: " [exp
e1a0: 72 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 r {[string lengt
e1b0: 68 20 24 66 6c 61 67 73 5d 20 3e 20 30 20 3f 20 h $flags] > 0 ?
e1c0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
e1d0: 61 70 70 65 6e 64 41 72 67 73 20 5c 22 20 24 66 appendArgs \" $f
e1e0: 6c 61 67 73 20 5c 22 5d 20 3a 20 22 3c 6e 6f 6e lags \"] : "<non
e1f0: 65 3e 22 7d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 e>"}] \n]..
e200: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
e210: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f # NOTE: Sho
e220: 77 20 28 61 6e 64 20 6c 6f 67 29 20 74 68 65 20 w (and log) the
e230: 73 68 61 72 65 64 20 63 6f 6e 6e 65 63 74 69 6f shared connectio
e240: 6e 20 66 6c 61 67 73 2e 0d 0a 20 20 20 20 20 20 n flags...
e250: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 24 71 #.. if {!$q
e260: 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
e270: 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
e280: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 {.. ob
e290: 6a 65 63 74 20 69 6e 76 6f 6b 65 20 53 79 73 74 ject invoke Syst
e2a0: 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 em.Data.SQLite.S
e2b0: 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 20 QLiteConnection
e2c0: 53 68 61 72 65 64 46 6c 61 67 73 0d 0a 20 20 20 SharedFlags..
e2d0: 20 20 20 20 20 7d 20 73 68 61 72 65 64 46 6c 61 } sharedFla
e2e0: 67 73 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b gs] == 0} then {
e2f0: 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
e300: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
e310: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
e320: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
e330: 2d 2d 2d 2d 20 73 68 61 72 65 64 20 63 6f 6e 6e ---- shared conn
e340: 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 66 6f 72 ection flags for
e350: 20 22 20 24 64 61 74 61 62 61 73 65 20 5c 0d 0a " $database \..
e360: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 20 "
e370: 61 72 65 3a 20 22 20 5b 65 78 70 72 20 7b 5b 73 are: " [expr {[s
e380: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 73 68 tring length $sh
e390: 61 72 65 64 46 6c 61 67 73 5d 20 3e 20 30 20 26 aredFlags] > 0 &
e3a0: 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 & \..
e3b0: 20 20 20 24 73 68 61 72 65 64 46 6c 61 67 73 20 $sharedFlags
e3c0: 6e 65 20 22 4e 6f 6e 65 22 20 3f 20 5c 0d 0a 20 ne "None" ? \..
e3d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 61 70 [ap
e3e0: 70 65 6e 64 41 72 67 73 20 5c 22 20 24 73 68 61 pendArgs \" $sha
e3f0: 72 65 64 46 6c 61 67 73 20 5c 22 5d 20 3a 20 22 redFlags \"] : "
e400: 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c 6e 5d 0d 0a 20 <none>"}] \n]..
e410: 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
e420: 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
e430: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
e440: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
e450: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
e460: 2d 2d 2d 20 73 68 61 72 65 64 20 63 6f 6e 6e 65 --- shared conne
e470: 63 74 69 6f 6e 20 66 6c 61 67 73 20 66 6f 72 20 ction flags for
e480: 22 20 24 64 61 74 61 62 61 73 65 20 5c 0d 0a 20 " $database \..
e490: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 20 61 " a
e4a0: 72 65 3a 20 3c 75 6e 61 76 61 69 6c 61 62 6c 65 re: <unavailable
e4b0: 3e 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d >\n"].. }
e4c0: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
e4d0: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
e4e0: 54 45 3a 20 49 66 20 74 68 65 72 65 20 61 72 65 TE: If there are
e4f0: 20 61 6e 79 20 67 6c 6f 62 61 6c 20 28 70 65 72 any global (per
e500: 20 74 65 73 74 20 72 75 6e 29 20 63 6f 6e 6e 65 test run) conne
e510: 63 74 69 6f 6e 20 66 6c 61 67 73 20 63 75 72 72 ction flags curr
e520: 65 6e 74 6c 79 0d 0a 20 20 20 20 20 20 23 20 20 ently.. #
e530: 20 20 20 20 20 73 65 74 2c 20 75 73 65 20 74 68 set, use th
e540: 65 6d 20 6e 6f 77 20 28 69 2e 65 2e 20 62 79 20 em now (i.e. by
e550: 63 6f 6d 62 69 6e 69 6e 67 20 74 68 65 6d 20 77 combining them w
e560: 69 74 68 20 74 68 65 20 6f 6e 65 73 20 66 6f 72 ith the ones for
e570: 20 74 68 69 73 0d 0a 20 20 20 20 20 20 23 20 20 this.. #
e580: 20 20 20 20 20 63 6f 6e 6e 65 63 74 69 6f 6e 29 connection)
e590: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
e5a0: 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
e5b0: 74 73 20 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f ts ::connection_
e5c0: 66 6c 61 67 73 5d 20 26 26 20 5c 0d 0a 20 20 20 flags] && \..
e5d0: 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c [string l
e5e0: 65 6e 67 74 68 20 24 3a 3a 63 6f 6e 6e 65 63 74 ength $::connect
e5f0: 69 6f 6e 5f 66 6c 61 67 73 5d 20 3e 20 30 7d 20 ion_flags] > 0}
e600: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
e610: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
e620: 45 3a 20 53 68 6f 77 20 28 61 6e 64 20 6c 6f 67 E: Show (and log
e630: 29 20 74 68 65 20 64 65 74 65 63 74 65 64 20 67 ) the detected g
e640: 6c 6f 62 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e lobal connection
e650: 20 66 6c 61 67 73 2e 0d 0a 20 20 20 20 20 20 20 flags...
e660: 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b #.. if {
e670: 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
e680: 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
e690: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
e6a0: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
e6b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
e6c0: 2d 2d 2d 20 67 6c 6f 62 61 6c 20 63 6f 6e 6e 65 --- global conne
e6d0: 63 74 69 6f 6e 20 66 6c 61 67 73 20 64 65 74 65 ction flags dete
e6e0: 63 74 65 64 3a 20 22 20 5c 0d 0a 20 20 20 20 20 cted: " \..
e6f0: 20 20 20 20 20 20 20 20 20 5b 65 78 70 72 20 7b [expr {
e700: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 63 [info exists ::c
e710: 6f 6e 6e 65 63 74 69 6f 6e 5f 66 6c 61 67 73 5d onnection_flags]
e720: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
e730: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
e740: 67 74 68 20 24 3a 3a 63 6f 6e 6e 65 63 74 69 6f gth $::connectio
e750: 6e 5f 66 6c 61 67 73 5d 20 3e 20 30 20 3f 20 5c n_flags] > 0 ? \
e760: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
e770: 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 22 20 24 [appendArgs \" $
e780: 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 6c 61 ::connection_fla
e790: 67 73 20 5c 22 5d 20 3a 20 22 3c 6e 6f 6e 65 3e gs \"] : "<none>
e7a0: 22 7d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 "}] \n]..
e7b0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d }.... #.
e7c0: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
e7d0: 20 43 6f 6d 62 69 6e 65 20 61 6e 64 2f 6f 72 20 Combine and/or
e7e0: 72 65 70 6c 61 63 65 20 74 68 65 20 63 6f 6e 6e replace the conn
e7f0: 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 61 6e 64 ection flags and
e800: 20 74 68 65 6e 20 73 68 6f 77 20 74 68 65 0d 0a then show the..
e810: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
e820: 6e 65 77 20 76 61 6c 75 65 2e 0d 0a 20 20 20 20 new value...
e830: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 #.. s
e840: 65 74 20 66 6c 61 67 73 20 5b 63 6f 6d 62 69 6e et flags [combin
e850: 65 46 6c 61 67 73 20 24 66 6c 61 67 73 20 24 3a eFlags $flags $:
e860: 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 6c 61 67 :connection_flag
e870: 73 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d s].... #.
e880: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
e890: 20 53 68 6f 77 20 28 61 6e 64 20 6c 6f 67 29 20 Show (and log)
e8a0: 74 68 65 20 6e 65 77 20 65 66 66 65 63 74 69 76 the new effectiv
e8b0: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 e connection fla
e8c0: 67 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a gs... #..
e8d0: 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
e8e0: 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
e8f0: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
e900: 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
e910: 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
e920: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
e930: 63 6f 6d 62 69 6e 65 64 20 63 6f 6e 6e 65 63 74 combined connect
e940: 69 6f 6e 20 66 6c 61 67 73 20 66 6f 72 20 22 20 ion flags for "
e950: 24 64 61 74 61 62 61 73 65 20 5c 0d 0a 20 20 20 $database \..
e960: 20 20 20 20 20 20 20 20 20 20 20 22 20 61 72 65 " are
e970: 3a 20 22 20 5b 65 78 70 72 20 7b 5b 73 74 72 69 : " [expr {[stri
e980: 6e 67 20 6c 65 6e 67 74 68 20 24 66 6c 61 67 73 ng length $flags
e990: 5d 20 3e 20 30 20 3f 20 5c 0d 0a 20 20 20 20 20 ] > 0 ? \..
e9a0: 20 20 20 20 20 20 20 20 20 5b 61 70 70 65 6e 64 [append
e9b0: 41 72 67 73 20 5c 22 20 24 66 6c 61 67 73 20 5c Args \" $flags \
e9c0: 22 5d 20 3a 20 22 3c 6e 6f 6e 65 3e 22 7d 5d 20 "] : "<none>"}]
e9d0: 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a \n].. }..
e9e0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
e9f0: 20 72 65 74 75 72 6e 20 24 66 6c 61 67 73 0d 0a return $flags..
ea00: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
ea10: 6f 63 20 67 65 74 46 6c 61 67 73 50 72 6f 70 65 oc getFlagsPrope
ea20: 72 74 79 20 7b 20 7b 66 6c 61 67 73 20 22 22 7d rty { {flags ""}
ea30: 20 7b 71 75 69 65 74 20 66 61 6c 73 65 7d 20 7d {quiet false} }
ea40: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
ea50: 20 20 20 23 20 4e 4f 54 45 3a 20 44 65 74 65 72 # NOTE: Deter
ea60: 6d 69 6e 65 20 77 68 61 74 20 74 68 65 20 63 6f mine what the co
ea70: 6d 62 69 6e 65 64 20 28 67 6c 6f 62 61 6c 20 61 mbined (global a
ea80: 6e 64 20 6c 6f 63 61 6c 29 20 63 6f 6e 6e 65 63 nd local) connec
ea90: 74 69 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 tion.. #
eaa0: 20 20 20 20 66 6c 61 67 73 20 73 68 6f 75 6c 64 flags should
eab0: 20 62 65 2c 20 70 6f 73 73 69 62 6c 79 20 71 75 be, possibly qu
eac0: 69 65 74 6c 79 2e 0d 0a 20 20 20 20 20 20 23 0d ietly... #.
ead0: 0a 20 20 20 20 20 20 73 65 74 20 66 6c 61 67 73 . set flags
eae0: 20 5b 67 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 46 [getConnectionF
eaf0: 6c 61 67 73 20 22 22 20 24 66 6c 61 67 73 20 24 lags "" $flags $
eb00: 71 75 69 65 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 quiet]....
eb10: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
eb20: 20 49 66 20 6e 6f 20 67 6c 6f 62 61 6c 20 6f 72 If no global or
eb30: 20 6c 6f 63 61 6c 20 63 6f 6e 6e 65 63 74 69 6f local connectio
eb40: 6e 20 66 6c 61 67 73 20 77 65 72 65 20 73 70 65 n flags were spe
eb50: 63 69 66 69 65 64 2c 20 74 68 65 0d 0a 20 20 20 cified, the..
eb60: 20 20 20 23 20 20 20 20 20 20 20 64 65 66 61 75 # defau
eb70: 6c 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c lt connection fl
eb80: 61 67 73 20 73 68 6f 75 6c 64 20 62 65 20 75 73 ags should be us
eb90: 65 64 3b 20 74 68 65 72 65 66 6f 72 65 2c 20 72 ed; therefore, r
eba0: 65 74 75 72 6e 0d 0a 20 20 20 20 20 20 23 20 20 eturn.. #
ebb0: 20 20 20 20 20 61 6e 20 65 6d 70 74 79 20 73 74 an empty st
ebc0: 72 69 6e 67 20 69 6e 20 74 68 61 74 20 63 61 73 ring in that cas
ebd0: 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e... #..
ebe0: 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c if {[string l
ebf0: 65 6e 67 74 68 20 24 66 6c 61 67 73 5d 20 3d 3d ength $flags] ==
ec00: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
ec10: 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 return ""..
ec20: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
ec30: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
ec40: 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 63 68 65 In order to che
ec50: 63 6b 20 69 66 20 74 68 65 20 64 65 66 61 75 6c ck if the defaul
ec60: 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 t connection fla
ec70: 67 73 20 61 72 65 20 62 65 69 6e 67 20 75 73 65 gs are being use
ec80: 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 d.. #
ec90: 20 69 74 20 69 73 20 6e 65 63 65 73 73 61 72 79 it is necessary
eca0: 20 74 6f 20 61 74 74 65 6d 70 74 20 61 20 63 6f to attempt a co
ecb0: 6e 76 65 72 73 69 6f 6e 20 74 6f 20 74 68 65 20 nversion to the
ecc0: 61 63 74 75 61 6c 20 65 6e 75 6d 65 72 61 74 65 actual enumerate
ecd0: 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 d.. #
ece0: 20 74 79 70 65 2e 20 20 46 61 69 6c 69 6e 67 20 type. Failing
ecf0: 74 68 61 74 2c 20 74 68 65 20 63 68 65 63 6b 20 that, the check
ed00: 61 67 61 69 6e 73 74 20 74 68 65 20 64 65 66 61 against the defa
ed10: 75 6c 74 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 ult value will b
ed20: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
ed30: 20 73 6b 69 70 70 65 64 2e 0d 0a 20 20 20 20 20 skipped...
ed40: 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 65 72 #.. set er
ed50: 72 6f 72 20 6e 75 6c 6c 3b 20 23 20 49 47 4e 4f ror null; # IGNO
ed60: 52 45 44 0d 0a 20 20 20 20 20 20 73 65 74 20 76 RED.. set v
ed70: 61 6c 75 65 20 5b 6f 62 6a 65 63 74 20 69 6e 76 alue [object inv
ed80: 6f 6b 65 20 55 74 69 6c 69 74 79 20 54 72 79 50 oke Utility TryP
ed90: 61 72 73 65 46 6c 61 67 73 45 6e 75 6d 20 22 22 arseFlagsEnum ""
eda0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 53 79 \.. Sy
edb0: 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
edc0: 2e 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f .SQLiteConnectio
edd0: 6e 46 6c 61 67 73 20 22 22 20 24 66 6c 61 67 73 nFlags "" $flags
ede0: 20 6e 75 6c 6c 20 74 72 75 65 20 5c 0d 0a 20 20 null true \..
edf0: 20 20 20 20 20 20 20 20 74 72 75 65 20 65 72 72 true err
ee00: 6f 72 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a or].... #..
ee10: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 # NOTE: If
ee20: 20 74 68 65 20 63 6f 6d 62 69 6e 65 64 20 66 6c the combined fl
ee30: 61 67 73 20 73 74 72 69 6e 67 20 63 6f 75 6c 64 ags string could
ee40: 20 6e 6f 74 20 61 63 74 75 61 6c 6c 79 20 62 65 not actually be
ee50: 20 63 6f 6e 76 65 72 74 65 64 0d 0a 20 20 20 20 converted..
ee60: 20 20 23 20 20 20 20 20 20 20 74 6f 20 74 68 65 # to the
ee70: 20 65 6e 75 6d 65 72 61 74 65 64 20 74 79 70 65 enumerated type
ee80: 20 69 74 20 69 73 20 74 68 65 20 64 65 66 61 75 it is the defau
ee90: 6c 74 20 76 61 6c 75 65 2c 20 74 68 65 6e 20 6a lt value, then j
eea0: 75 73 74 20 75 73 65 0d 0a 20 20 20 20 20 20 23 ust use.. #
eeb0: 20 20 20 20 20 20 20 69 74 20 76 65 72 62 61 74 it verbat
eec0: 69 6d 3b 20 6f 74 68 65 72 77 69 73 65 2c 20 6a im; otherwise, j
eed0: 75 73 74 20 72 65 74 75 72 6e 20 61 6e 20 65 6d ust return an em
eee0: 70 74 79 20 73 74 72 69 6e 67 2e 20 20 49 6e 20 pty string. In
eef0: 74 68 61 74 0d 0a 20 20 20 20 20 20 23 20 20 20 that.. #
ef00: 20 20 20 20 63 61 73 65 2c 20 74 68 65 20 64 65 case, the de
ef10: 66 61 75 6c 74 20 63 6f 6e 6e 65 63 74 69 6f 6e fault connection
ef20: 20 66 6c 61 67 73 20 77 69 6c 6c 20 62 65 20 75 flags will be u
ef30: 73 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 sed... #..
ef40: 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
ef50: 20 6c 65 6e 67 74 68 20 24 76 61 6c 75 65 5d 20 length $value]
ef60: 3d 3d 20 30 20 7c 7c 20 24 76 61 6c 75 65 20 6e == 0 || $value n
ef70: 65 20 22 44 65 66 61 75 6c 74 22 7d 20 74 68 65 e "Default"} the
ef80: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
ef90: 20 20 20 20 20 20 20 20 23 20 57 41 52 4e 49 4e # WARNIN
efa0: 47 3a 20 54 68 69 73 20 72 65 74 75 72 6e 73 20 G: This returns
efb0: 74 68 65 20 73 74 72 69 6e 67 20 76 61 6c 75 65 the string value
efc0: 20 6f 66 20 74 68 65 20 63 6f 6d 62 69 6e 65 64 of the combined
efd0: 20 66 6c 61 67 73 2c 20 6e 6f 74 0d 0a 20 20 20 flags, not..
efe0: 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 #
eff0: 74 68 65 20 65 6e 75 6d 65 72 61 74 65 64 20 76 the enumerated v
f000: 61 6c 75 65 2e 20 20 54 68 69 73 20 69 73 20 62 alue. This is b
f010: 79 20 64 65 73 69 67 6e 20 61 6e 64 20 73 68 6f y design and sho
f020: 75 6c 64 20 6e 6f 74 0d 0a 20 20 20 20 20 20 20 uld not..
f030: 20 23 20 20 20 20 20 20 20 20 20 20 62 65 20 63 # be c
f040: 68 61 6e 67 65 64 20 77 69 74 68 6f 75 74 20 63 hanged without c
f050: 61 72 65 66 75 6c 20 63 6f 6e 73 69 64 65 72 61 areful considera
f060: 74 69 6f 6e 20 28 65 2e 67 2e 20 69 74 20 77 6f tion (e.g. it wo
f070: 75 6c 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 uld.. #
f080: 20 20 20 20 20 20 20 20 70 72 65 76 65 6e 74 20 prevent
f090: 74 68 65 20 53 51 4c 69 74 65 43 6f 6e 6e 65 63 the SQLiteConnec
f0a0: 74 69 6f 6e 20 63 6c 61 73 73 20 66 72 6f 6d 20 tion class from
f0b0: 61 6c 6c 6f 77 69 6e 67 20 69 6e 76 61 6c 69 64 allowing invalid
f0c0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
f0d0: 20 20 20 20 20 5b 22 6d 61 67 69 63 61 6c 22 5d ["magical"]
f0e0: 20 6d 65 74 61 2d 66 6c 61 67 73 29 2e 0d 0a 20 meta-flags)...
f0f0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
f100: 20 20 72 65 74 75 72 6e 20 5b 61 70 70 65 6e 64 return [append
f110: 41 72 67 73 20 22 46 6c 61 67 73 3d 22 20 24 66 Args "Flags=" $f
f120: 6c 61 67 73 20 5c 3b 5d 0d 0a 20 20 20 20 20 20 lags \;]..
f130: 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 }.... retur
f140: 6e 20 22 22 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a n "".. }.....
f150: 20 20 20 20 70 72 6f 63 20 65 6e 61 62 6c 65 53 proc enableS
f160: 68 61 72 65 64 43 61 63 68 65 20 7b 20 63 68 61 haredCache { cha
f170: 6e 6e 65 6c 20 65 6e 61 62 6c 65 20 7b 71 75 69 nnel enable {qui
f180: 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 et false} } {..
f190: 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
f1a0: 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 {.. objec
f1b0: 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 t invoke -flags
f1c0: 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 +NonPublic \..
f1d0: 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
f1e0: 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 .Data.SQLite.Uns
f1f0: 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 afeNativeMethods
f200: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
f210: 73 71 6c 69 74 65 33 5f 65 6e 61 62 6c 65 5f 73 sqlite3_enable_s
f220: 68 61 72 65 64 5f 63 61 63 68 65 20 5b 65 78 70 hared_cache [exp
f230: 72 20 69 6e 74 28 24 65 6e 61 62 6c 65 29 5d 0d r int($enable)].
f240: 0a 20 20 20 20 20 20 7d 20 72 65 73 75 6c 74 5d . } result]
f250: 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
f260: 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
f270: 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
f280: 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
f290: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
f2a0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
f2b0: 20 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c "---- call sql
f2c0: 69 74 65 33 5f 65 6e 61 62 6c 65 5f 73 68 61 72 ite3_enable_shar
f2d0: 65 64 5f 63 61 63 68 65 28 22 20 24 65 6e 61 62 ed_cache(" $enab
f2e0: 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 le \..
f2f0: 20 20 20 20 22 29 2e 2e 2e 20 6f 6b 3a 20 22 20 ")... ok: "
f300: 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 $result \n]..
f310: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 }.. }
f320: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
f330: 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
f340: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 n {.. t
f350: 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
f360: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
f370: 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
f380: 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 5f 65 6e call sqlite3_en
f390: 61 62 6c 65 5f 73 68 61 72 65 64 5f 63 61 63 68 able_shared_cach
f3a0: 65 28 22 20 24 65 6e 61 62 6c 65 20 5c 0d 0a 20 e(" $enable \..
f3b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 29 2e ").
f3c0: 2e 2e 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 .. error: " \n\t
f3d0: 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 $result \n]..
f3e0: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
f3f0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
f400: 70 72 6f 63 20 73 65 74 75 70 44 62 20 7b 0d 0a proc setupDb {..
f410: 20 20 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 file
f420: 4e 61 6d 65 20 7b 6d 6f 64 65 20 22 22 7d 20 7b Name {mode ""} {
f430: 64 61 74 65 54 69 6d 65 46 6f 72 6d 61 74 20 22 dateTimeFormat "
f440: 22 7d 20 7b 64 61 74 65 54 69 6d 65 4b 69 6e 64 "} {dateTimeKind
f450: 20 22 22 7d 20 7b 66 6c 61 67 73 20 22 22 7d 0d ""} {flags ""}.
f460: 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 65 78 . {ex
f470: 74 72 61 20 22 22 7d 20 7b 71 75 61 6c 69 66 79 tra ""} {qualify
f480: 20 74 72 75 65 7d 20 7b 64 65 6c 65 74 65 20 74 true} {delete t
f490: 72 75 65 7d 20 7b 75 72 69 20 66 61 6c 73 65 7d rue} {uri false}
f4a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 74 .. {t
f4b0: 65 6d 70 6f 72 61 72 79 20 74 72 75 65 7d 20 7b emporary true} {
f4c0: 76 61 72 4e 61 6d 65 20 64 62 7d 20 7b 71 75 69 varName db} {qui
f4d0: 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 et false} } {..
f4e0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
f4f0: 4e 4f 54 45 3a 20 46 69 72 73 74 2c 20 73 65 65 NOTE: First, see
f500: 20 69 66 20 6f 75 72 20 63 61 6c 6c 65 72 20 68 if our caller h
f510: 61 73 20 72 65 71 75 65 73 74 65 64 20 61 6e 20 as requested an
f520: 69 6e 2d 6d 65 6d 6f 72 79 20 64 61 74 61 62 61 in-memory databa
f530: 73 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 se... #..
f540: 20 20 20 20 73 65 74 20 69 73 4d 65 6d 6f 72 79 set isMemory
f550: 20 5b 69 73 4d 65 6d 6f 72 79 44 62 20 24 66 69 [isMemoryDb $fi
f560: 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 leName]....
f570: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
f580: 3a 20 46 6f 72 20 6e 6f 77 2c 20 61 6c 6c 20 74 : For now, all t
f590: 65 73 74 20 64 61 74 61 62 61 73 65 73 20 75 73 est databases us
f5a0: 65 64 20 62 79 20 74 68 65 20 74 65 73 74 20 73 ed by the test s
f5b0: 75 69 74 65 20 61 72 65 20 70 6c 61 63 65 64 0d uite are placed.
f5c0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 69 . # i
f5d0: 6e 74 6f 20 74 68 65 20 64 61 74 61 62 61 73 65 nto the database
f5e0: 20 64 69 72 65 63 74 6f 72 79 2e 20 20 45 61 63 directory. Eac
f5f0: 68 20 64 61 74 61 62 61 73 65 20 61 6e 64 20 72 h database and r
f600: 65 6c 61 74 65 64 20 66 69 6c 65 73 0d 0a 20 20 elated files..
f610: 20 20 20 20 23 20 20 20 20 20 20 20 75 73 65 64 # used
f620: 20 62 79 20 61 20 74 65 73 74 20 73 68 6f 75 6c by a test shoul
f630: 64 20 62 65 20 63 6c 65 61 6e 65 64 20 75 70 20 d be cleaned up
f640: 62 79 20 74 68 61 74 20 74 65 73 74 20 75 73 69 by that test usi
f650: 6e 67 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 ng the.. #
f660: 20 20 20 20 20 20 22 63 6c 65 61 6e 75 70 44 62 "cleanupDb
f670: 22 20 70 72 6f 63 65 64 75 72 65 2c 20 62 65 6c " procedure, bel
f680: 6f 77 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ow... #..
f690: 20 20 20 20 69 66 20 7b 21 24 69 73 4d 65 6d 6f if {!$isMemo
f6a0: 72 79 20 26 26 20 24 71 75 61 6c 69 66 79 7d 20 ry && $qualify}
f6b0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
f6c0: 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 set fileName [fi
f6d0: 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 44 61 74 61 le join [getData
f6e0: 62 61 73 65 44 69 72 65 63 74 6f 72 79 5d 20 5b baseDirectory] [
f6f0: 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 4e file tail $fileN
f700: 61 6d 65 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a ame]].. }..
f710: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
f720: 20 23 20 4e 4f 54 45 3a 20 42 79 20 64 65 66 61 # NOTE: By defa
f730: 75 6c 74 2c 20 64 65 6c 65 74 65 20 61 6e 79 20 ult, delete any
f740: 70 72 65 2d 65 78 69 73 74 69 6e 67 20 64 61 74 pre-existing dat
f750: 61 62 61 73 65 20 77 69 74 68 20 74 68 65 20 73 abase with the s
f760: 61 6d 65 20 66 69 6c 65 0d 0a 20 20 20 20 20 20 ame file..
f770: 23 20 20 20 20 20 20 20 6e 61 6d 65 20 69 66 20 # name if
f780: 69 74 20 63 75 72 72 65 6e 74 6c 79 20 65 78 69 it currently exi
f790: 73 74 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 sts... #..
f7a0: 20 20 20 20 20 69 66 20 7b 21 24 69 73 4d 65 6d if {!$isMem
f7b0: 6f 72 79 20 26 26 20 24 64 65 6c 65 74 65 20 26 ory && $delete &
f7c0: 26 20 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 & [file exists $
f7d0: 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 fileName]} then
f7e0: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
f7f0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 # NOTE: At
f800: 74 65 6d 70 74 20 74 6f 20 64 65 6c 65 74 65 20 tempt to delete
f810: 61 6e 79 20 70 72 65 2d 65 78 69 73 74 69 6e 67 any pre-existing
f820: 20 64 61 74 61 62 61 73 65 20 77 69 74 68 20 74 database with t
f830: 68 65 20 73 61 6d 65 20 66 69 6c 65 0d 0a 20 20 he same file..
f840: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6e 61 # na
f850: 6d 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a me... #..
f860: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
f870: 63 68 20 7b 66 69 6c 65 20 64 65 6c 65 74 65 20 ch {file delete
f880: 24 66 69 6c 65 4e 61 6d 65 7d 20 65 72 72 6f 72 $fileName} error
f890: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
f8a0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
f8b0: 20 20 23 20 4e 4f 54 45 3a 20 57 65 20 73 6f 6d # NOTE: We som
f8c0: 65 68 6f 77 20 66 61 69 6c 65 64 20 74 6f 20 64 ehow failed to d
f8d0: 65 6c 65 74 65 20 74 68 65 20 66 69 6c 65 2c 20 elete the file,
f8e0: 72 65 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 20 report why...
f8f0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
f900: 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
f910: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
f920: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
f930: 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
f940: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
f950: 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
f960: 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
f970: 74 6f 20 64 65 6c 65 74 65 20 64 61 74 61 62 61 to delete databa
f980: 73 65 20 66 69 6c 65 20 5c 22 22 20 24 66 69 6c se file \"" $fil
f990: 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 eName \..
f9a0: 20 20 20 20 20 20 20 20 20 22 5c 22 20 64 75 72 "\" dur
f9b0: 69 6e 67 20 73 65 74 75 70 2c 20 65 72 72 6f 72 ing setup, error
f9c0: 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 : " \n\t $error
f9d0: 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
f9e0: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
f9f0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
fa00: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 . # NOTE: R
fa10: 65 66 65 72 20 74 6f 20 74 68 65 20 73 70 65 63 efer to the spec
fa20: 69 66 69 65 64 20 76 61 72 69 61 62 6c 65 20 28 ified variable (
fa30: 65 2e 67 2e 20 22 64 62 22 29 20 69 6e 20 74 68 e.g. "db") in th
fa40: 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 e context of our
fa50: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
fa60: 63 61 6c 6c 65 72 2e 20 20 54 68 65 20 68 61 6e caller. The han
fa70: 64 6c 65 20 74 6f 20 74 68 65 20 6f 70 65 6e 65 dle to the opene
fa80: 64 20 64 61 74 61 62 61 73 65 20 77 69 6c 6c 20 d database will
fa90: 62 65 20 73 74 6f 72 65 64 20 74 68 65 72 65 2e be stored there.
faa0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
fab0: 20 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d upvar 1 $varNam
fac0: 65 20 64 62 0d 0a 0d 0a 20 20 20 20 20 20 23 0d e db.... #.
fad0: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 . # NOTE: S
fae0: 74 61 72 74 20 62 75 69 6c 64 69 6e 67 20 74 68 tart building th
faf0: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 e connection str
fb00: 69 6e 67 2e 20 20 54 68 65 20 6f 6e 6c 79 20 72 ing. The only r
fb10: 65 71 75 69 72 65 64 20 70 6f 72 74 69 6f 6e 0d equired portion.
fb20: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6f . # o
fb30: 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e f the connection
fb40: 20 73 74 72 69 6e 67 20 69 73 20 74 68 65 20 64 string is the d
fb50: 61 74 61 20 73 6f 75 72 63 65 2c 20 77 68 69 63 ata source, whic
fb60: 68 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 0d 0a h contains the..
fb70: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 61 # da
fb80: 74 61 62 61 73 65 20 66 69 6c 65 20 6e 61 6d 65 tabase file name
fb90: 20 69 74 73 65 6c 66 2e 20 20 49 66 20 6f 75 72 itself. If our
fba0: 20 63 61 6c 6c 65 72 20 77 61 6e 74 73 20 74 6f caller wants to
fbb0: 20 75 73 65 20 61 20 55 52 49 20 61 73 0d 0a 20 use a URI as..
fbc0: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 # the
fbd0: 20 64 61 74 61 20 73 6f 75 72 63 65 2c 20 75 73 data source, us
fbe0: 65 20 74 68 65 20 46 75 6c 6c 55 72 69 20 63 6f e the FullUri co
fbf0: 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 20 nnection string
fc00: 70 72 6f 70 65 72 74 79 20 74 6f 0d 0a 20 20 20 property to..
fc10: 20 20 20 23 20 20 20 20 20 20 20 70 72 65 76 65 # preve
fc20: 6e 74 20 74 68 65 20 64 61 74 61 20 73 6f 75 72 nt the data sour
fc30: 63 65 20 73 74 72 69 6e 67 20 66 72 6f 6d 20 62 ce string from b
fc40: 65 69 6e 67 20 6d 61 6e 67 6c 65 64 2e 0d 0a 20 eing mangled...
fc50: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
fc60: 20 7b 24 75 72 69 7d 20 74 68 65 6e 20 7b 0d 0a {$uri} then {..
fc70: 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 6e 6e set conn
fc80: 65 63 74 69 6f 6e 20 7b 46 75 6c 6c 55 72 69 3d ection {FullUri=
fc90: 24 7b 66 69 6c 65 4e 61 6d 65 7d 7d 0d 0a 20 20 ${fileName}}..
fca0: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
fcb0: 20 20 20 20 20 20 73 65 74 20 63 6f 6e 6e 65 63 set connec
fcc0: 74 69 6f 6e 20 7b 44 61 74 61 20 53 6f 75 72 63 tion {Data Sourc
fcd0: 65 3d 24 7b 66 69 6c 65 4e 61 6d 65 7d 7d 0d 0a e=${fileName}}..
fce0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
fcf0: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
fd00: 3a 20 53 69 6e 63 65 20 74 68 69 73 20 70 72 6f : Since this pro
fd10: 63 65 64 75 72 65 20 68 61 73 20 6e 6f 20 73 70 cedure has no sp
fd20: 65 63 69 61 6c 20 6b 6e 6f 77 6c 65 64 67 65 20 ecial knowledge
fd30: 6f 66 20 77 68 61 74 20 74 68 65 20 64 65 66 61 of what the defa
fd40: 75 6c 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ult.. #
fd50: 20 20 20 73 65 74 74 69 6e 67 20 69 73 20 66 6f setting is fo
fd60: 72 20 74 68 65 20 54 6f 46 75 6c 6c 50 61 74 68 r the ToFullPath
fd70: 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 connection stri
fd80: 6e 67 20 70 72 6f 70 65 72 79 2c 20 61 6c 77 61 ng propery, alwa
fd90: 79 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ys.. #
fda0: 20 20 61 64 64 20 74 68 65 20 76 61 6c 75 65 20 add the value
fdb0: 77 65 20 6b 6e 6f 77 20 61 62 6f 75 74 20 74 6f we know about to
fdc0: 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 the connection
fdd0: 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 23 string... #
fde0: 0d 0a 20 20 20 20 20 20 61 70 70 65 6e 64 20 63 .. append c
fdf0: 6f 6e 6e 65 63 74 69 6f 6e 20 7b 3b 54 6f 46 75 onnection {;ToFu
fe00: 6c 6c 50 61 74 68 3d 24 7b 71 75 61 6c 69 66 79 llPath=${qualify
fe10: 7d 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }}.... #..
fe20: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 # NOTE: If
fe30: 6f 75 72 20 63 61 6c 6c 65 72 20 73 70 65 63 69 our caller speci
fe40: 66 69 65 64 20 61 20 6a 6f 75 72 6e 61 6c 20 6d fied a journal m
fe50: 6f 64 65 2c 20 61 64 64 20 74 68 65 20 6e 65 63 ode, add the nec
fe60: 65 73 73 61 72 79 20 70 6f 72 74 69 6f 6e 0d 0a essary portion..
fe70: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 66 # of
fe80: 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 the connection
fe90: 73 74 72 69 6e 67 20 6e 6f 77 2e 0d 0a 20 20 20 string now...
fea0: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
feb0: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
fec0: 6d 6f 64 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 mode] > 0} then
fed0: 7b 0d 0a 20 20 20 20 20 20 20 20 61 70 70 65 6e {.. appen
fee0: 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 7b 3b 4a d connection {;J
fef0: 6f 75 72 6e 61 6c 20 4d 6f 64 65 3d 24 7b 6d 6f ournal Mode=${mo
ff00: 64 65 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d de}}.. }...
ff10: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
ff20: 23 20 4e 4f 54 45 3a 20 49 66 20 6f 75 72 20 63 # NOTE: If our c
ff30: 61 6c 6c 65 72 20 73 70 65 63 69 66 69 65 64 20 aller specified
ff40: 61 20 44 61 74 65 54 69 6d 65 20 66 6f 72 6d 61 a DateTime forma
ff50: 74 2c 20 61 64 64 20 74 68 65 20 6e 65 63 65 73 t, add the neces
ff60: 73 61 72 79 0d 0a 20 20 20 20 20 20 23 20 20 20 sary.. #
ff70: 20 20 20 20 70 6f 72 74 69 6f 6e 20 6f 66 20 74 portion of t
ff80: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 he connection st
ff90: 72 69 6e 67 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 ring now...
ffa0: 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 #.. if {[s
ffb0: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 64 61 tring length $da
ffc0: 74 65 54 69 6d 65 46 6f 72 6d 61 74 5d 20 3e 20 teTimeFormat] >
ffd0: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
ffe0: 20 20 20 61 70 70 65 6e 64 20 63 6f 6e 6e 65 63 append connec
fff0: 74 69 6f 6e 20 7b 3b 44 61 74 65 54 69 6d 65 46 tion {;DateTimeF
10000 6f 72 6d 61 74 3d 24 7b 64 61 74 65 54 69 6d 65 ormat=${dateTime
10010 46 6f 72 6d 61 74 7d 7d 0d 0a 20 20 20 20 20 20 Format}}..
10020 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
10030 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 6f # NOTE: If o
10040 75 72 20 63 61 6c 6c 65 72 20 73 70 65 63 69 66 ur caller specif
10050 69 65 64 20 61 20 44 61 74 65 54 69 6d 65 4b 69 ied a DateTimeKi
10060 6e 64 2c 20 61 64 64 20 74 68 65 20 6e 65 63 65 nd, add the nece
10070 73 73 61 72 79 20 70 6f 72 74 69 6f 6e 0d 0a 20 ssary portion..
10080 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 66 20 # of
10090 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 the connection s
100a0 74 72 69 6e 67 20 6e 6f 77 2e 0d 0a 20 20 20 20 tring now...
100b0 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
100c0 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 64 string length $d
100d0 61 74 65 54 69 6d 65 4b 69 6e 64 5d 20 3e 20 30 ateTimeKind] > 0
100e0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
100f0 20 20 61 70 70 65 6e 64 20 63 6f 6e 6e 65 63 74 append connect
10100 69 6f 6e 20 7b 3b 44 61 74 65 54 69 6d 65 4b 69 ion {;DateTimeKi
10110 6e 64 3d 24 7b 64 61 74 65 54 69 6d 65 4b 69 6e nd=${dateTimeKin
10120 64 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a d}}.. }....
10130 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
10140 20 4e 4f 54 45 3a 20 46 69 67 75 72 65 20 6f 75 NOTE: Figure ou
10150 74 20 77 68 61 74 20 74 68 65 20 66 69 6e 61 6c t what the final
10160 20 66 6c 61 67 73 20 66 6f 72 20 74 68 69 73 20 flags for this
10170 63 6f 6e 6e 65 63 74 69 6f 6e 20 6e 65 65 64 20 connection need
10180 74 6f 20 62 65 2e 0d 0a 20 20 20 20 20 20 23 0d to be... #.
10190 0a 20 20 20 20 20 20 73 65 74 20 66 6c 61 67 73 . set flags
101a0 20 5b 67 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 46 [getConnectionF
101b0 6c 61 67 73 20 24 66 69 6c 65 4e 61 6d 65 20 24 lags $fileName $
101c0 66 6c 61 67 73 20 24 71 75 69 65 74 5d 0d 0a 0d flags $quiet]...
101d0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
101e0 23 20 4e 4f 54 45 3a 20 49 66 20 6f 75 72 20 63 # NOTE: If our c
101f0 61 6c 6c 65 72 20 73 70 65 63 69 66 69 65 64 20 aller specified
10200 73 6f 6d 65 20 53 51 4c 69 74 65 43 6f 6e 6e 65 some SQLiteConne
10210 63 74 69 6f 6e 46 6c 61 67 73 2c 20 61 64 64 20 ctionFlags, add
10220 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 the.. #
10230 20 20 20 6e 65 63 65 73 73 61 72 79 20 70 6f 72 necessary por
10240 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 6f 6e 6e tion of the conn
10250 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 20 6e 6f ection string no
10260 77 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 w... #..
10270 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c if {[string l
10280 65 6e 67 74 68 20 24 66 6c 61 67 73 5d 20 3e 20 ength $flags] >
10290 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
102a0 20 20 20 61 70 70 65 6e 64 20 63 6f 6e 6e 65 63 append connec
102b0 74 69 6f 6e 20 7b 3b 46 6c 61 67 73 3d 24 7b 66 tion {;Flags=${f
102c0 6c 61 67 73 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d lags}}.. }.
102d0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
102e0 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 6f 75 72 # NOTE: If our
102f0 20 63 61 6c 6c 65 72 20 73 70 65 63 69 66 69 65 caller specifie
10300 64 20 61 6e 20 65 78 74 72 61 20 70 61 79 6c 6f d an extra paylo
10310 61 64 20 74 6f 20 74 68 65 20 63 6f 6e 6e 65 63 ad to the connec
10320 74 69 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 tion.. #
10330 20 20 20 20 73 74 72 69 6e 67 2c 20 61 70 70 65 string, appe
10340 6e 64 20 69 74 20 6e 6f 77 2e 0d 0a 20 20 20 20 nd it now...
10350 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
10360 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 65 string length $e
10370 78 74 72 61 5d 20 3e 20 30 7d 20 74 68 65 6e 20 xtra] > 0} then
10380 7b 0d 0a 20 20 20 20 20 20 20 20 61 70 70 65 6e {.. appen
10390 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 5c 3b 20 d connection \;
103a0 24 65 78 74 72 61 0d 0a 20 20 20 20 20 20 7d 0d $extra.. }.
103b0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
103c0 20 20 23 20 4e 4f 54 45 3a 20 4f 70 65 6e 20 74 # NOTE: Open t
103d0 68 65 20 64 61 74 61 62 61 73 65 20 63 6f 6e 6e he database conn
103e0 65 63 74 69 6f 6e 20 6e 6f 77 2c 20 70 6c 61 63 ection now, plac
103f0 69 6e 67 20 74 68 65 20 6f 70 61 71 75 65 20 68 ing the opaque h
10400 61 6e 64 6c 65 20 76 61 6c 75 65 0d 0a 20 20 20 andle value..
10410 20 20 20 23 20 20 20 20 20 20 20 69 6e 74 6f 20 # into
10420 74 68 65 20 76 61 72 69 61 62 6c 65 20 73 70 65 the variable spe
10430 63 69 66 69 65 64 20 62 79 20 6f 75 72 20 63 61 cified by our ca
10440 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a ller... #..
10450 20 20 20 20 20 20 73 65 74 20 64 62 20 5b 73 71 set db [sq
10460 6c 20 6f 70 65 6e 20 2d 74 79 70 65 20 53 51 4c l open -type SQL
10470 69 74 65 20 5b 73 75 62 73 74 20 24 63 6f 6e 6e ite [subst $conn
10480 65 63 74 69 6f 6e 5d 5d 0d 0a 0d 0a 20 20 20 20 ection]]....
10490 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
104a0 45 3a 20 43 6f 6e 66 69 67 75 72 65 20 74 68 65 E: Configure the
104b0 20 74 65 6d 70 6f 72 61 72 79 20 64 69 72 65 63 temporary direc
104c0 74 6f 72 79 20 66 6f 72 20 74 68 65 20 6e 65 77 tory for the new
104d0 6c 79 20 6f 70 65 6e 65 64 20 64 61 74 61 62 61 ly opened databa
104e0 73 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 se.. #
104f0 20 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 6e 6f 77 connection now
10500 20 75 6e 6c 65 73 73 20 6f 75 72 20 63 61 6c 6c unless our call
10510 65 72 20 66 6f 72 62 69 64 73 20 69 74 2e 0d 0a er forbids it...
10520 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
10530 66 20 7b 24 74 65 6d 70 6f 72 61 72 79 20 26 26 f {$temporary &&
10540 20 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a ![info exists :
10550 3a 6e 6f 28 73 65 74 54 65 6d 70 6f 72 61 72 79 :no(setTemporary
10560 44 69 72 65 63 74 6f 72 79 29 5d 7d 20 74 68 65 Directory)]} the
10570 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 71 6c n {.. sql
10580 20 65 78 65 63 75 74 65 20 24 64 62 20 5b 61 70 execute $db [ap
10590 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
105a0 20 20 20 20 20 20 20 20 22 50 52 41 47 4d 41 20 "PRAGMA
105b0 74 65 6d 70 5f 73 74 6f 72 65 5f 64 69 72 65 63 temp_store_direc
105c0 74 6f 72 79 20 3d 20 5c 22 22 20 5b 67 65 74 54 tory = \"" [getT
105d0 65 6d 70 6f 72 61 72 79 44 69 72 65 63 74 6f 72 emporaryDirector
105e0 79 5d 20 5c 22 5c 3b 5d 0d 0a 20 20 20 20 20 20 y] \"\;]..
105f0 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
10600 20 20 20 20 23 20 4e 4f 54 45 3a 20 50 65 72 66 # NOTE: Perf
10610 6f 72 6d 20 61 6e 79 20 65 78 74 72 61 20 70 65 orm any extra pe
10620 72 2d 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 65 74 r-connection set
10630 75 70 20 66 6f 72 20 74 68 65 20 6e 65 77 6c 79 up for the newly
10640 20 6f 70 65 6e 65 64 0d 0a 20 20 20 20 20 20 23 opened.. #
10650 20 20 20 20 20 20 20 64 61 74 61 62 61 73 65 20 database
10660 6e 6f 77 20 75 6e 6c 65 73 73 20 6f 75 72 20 63 now unless our c
10670 61 6c 6c 65 72 20 66 6f 72 62 69 64 73 20 69 74 aller forbids it
10680 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
10690 20 20 73 65 74 20 65 78 65 63 75 74 65 4f 6e 53 set executeOnS
106a0 65 74 75 70 20 5b 67 65 74 45 78 65 63 75 74 65 etup [getExecute
106b0 4f 6e 53 65 74 75 70 5d 0d 0a 0d 0a 20 20 20 20 OnSetup]....
106c0 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
106d0 6e 67 74 68 20 24 65 78 65 63 75 74 65 4f 6e 53 ngth $executeOnS
106e0 65 74 75 70 5d 20 3e 20 30 20 26 26 20 5c 0d 0a etup] > 0 && \..
106f0 20 20 20 20 20 20 20 20 20 20 21 5b 69 6e 66 6f ![info
10700 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 78 65 exists ::no(exe
10710 63 75 74 65 4f 6e 53 65 74 75 70 29 5d 7d 20 74 cuteOnSetup)]} t
10720 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
10730 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
10740 3a 20 54 68 69 73 20 63 6f 6d 6d 61 6e 64 20 6d : This command m
10750 61 79 20 72 61 69 73 65 20 61 6e 20 65 72 72 6f ay raise an erro
10760 72 3b 20 69 66 20 73 6f 2c 20 74 68 61 74 20 69 r; if so, that i
10770 73 20 66 69 6e 65 2c 20 61 73 0d 0a 20 20 20 20 s fine, as..
10780 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 # the
10790 65 6e 63 6c 6f 73 69 6e 67 20 74 65 73 74 20 77 enclosing test w
107a0 69 6c 6c 20 74 68 65 6e 20 66 61 69 6c 2e 20 20 ill then fail.
107b0 54 68 65 20 5b 73 75 62 73 74 5d 20 63 6f 6d 6d The [subst] comm
107c0 61 6e 64 20 69 73 0d 0a 20 20 20 20 20 20 20 20 and is..
107d0 23 20 20 20 20 20 20 20 75 73 65 64 20 6f 6e 20 # used on
107e0 74 68 65 20 53 51 4c 20 69 6e 20 63 61 73 65 20 the SQL in case
107f0 69 74 20 6e 65 65 64 73 20 74 6f 20 72 65 66 65 it needs to refe
10800 72 20 74 6f 20 73 74 61 74 65 20 69 6e 20 6f 75 r to state in ou
10810 72 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 r.. #
10820 20 20 20 63 6f 6e 74 65 78 74 2e 0d 0a 20 20 20 context...
10830 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
10840 73 71 6c 20 65 78 65 63 75 74 65 20 24 64 62 20 sql execute $db
10850 5b 73 75 62 73 74 20 24 65 78 65 63 75 74 65 4f [subst $executeO
10860 6e 53 65 74 75 70 5d 0d 0a 20 20 20 20 20 20 7d nSetup].. }
10870 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
10880 20 20 20 23 20 4e 4f 54 45 3a 20 41 6c 77 61 79 # NOTE: Alway
10890 73 20 72 65 74 75 72 6e 20 74 68 65 20 63 6f 6e s return the con
108a0 6e 65 63 74 69 6f 6e 20 68 61 6e 64 6c 65 20 75 nection handle u
108b0 70 6f 6e 20 73 75 63 63 65 73 73 2e 0d 0a 20 20 pon success...
108c0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 #.. ret
108d0 75 72 6e 20 24 64 62 0d 0a 20 20 20 20 7d 0d 0a urn $db.. }..
108e0 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 44 ... proc getD
108f0 62 43 6f 6e 6e 65 63 74 69 6f 6e 20 7b 20 7b 76 bConnection { {v
10900 61 72 4e 61 6d 65 20 64 62 7d 20 7d 20 7b 0d 0a arName db} } {..
10910 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
10920 20 4e 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 NOTE: Refer to
10930 74 68 65 20 73 70 65 63 69 66 69 65 64 20 76 61 the specified va
10940 72 69 61 62 6c 65 20 28 65 2e 67 2e 20 22 64 62 riable (e.g. "db
10950 22 29 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 ") in the contex
10960 74 20 6f 66 20 6f 75 72 0d 0a 20 20 20 20 20 20 t of our..
10970 23 20 20 20 20 20 20 20 63 61 6c 6c 65 72 2e 20 # caller.
10980 20 54 68 65 20 68 61 6e 64 6c 65 20 74 6f 20 74 The handle to t
10990 68 65 20 64 61 74 61 62 61 73 65 20 70 72 65 76 he database prev
109a0 69 6f 75 73 6c 79 20 6f 70 65 6e 65 64 20 76 69 iously opened vi
109b0 61 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 a the.. #
109c0 20 20 20 20 20 5b 73 65 74 75 70 44 62 5d 20 70 [setupDb] p
109d0 72 6f 63 65 64 75 72 65 20 73 68 6f 75 6c 64 20 rocedure should
109e0 62 65 20 73 74 6f 72 65 64 20 74 68 65 72 65 2e be stored there.
109f0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
10a00 20 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d upvar 1 $varNam
10a10 65 20 64 62 0d 0a 0d 0a 20 20 20 20 20 20 23 0d e db.... #.
10a20 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 . # NOTE: T
10a30 68 69 73 20 72 65 74 75 72 6e 73 20 74 68 65 20 his returns the
10a40 41 44 4f 2e 4e 45 54 20 49 44 62 43 6f 6e 6e 65 ADO.NET IDbConne
10a50 63 74 69 6f 6e 20 6f 62 6a 65 63 74 20 69 6e 73 ction object ins
10a60 74 61 6e 63 65 20 66 6f 72 20 74 68 65 0d 0a 20 tance for the..
10a70 20 20 20 20 20 23 20 20 20 20 20 20 20 73 70 65 # spe
10a80 63 69 66 69 65 64 20 64 61 74 61 62 73 65 20 68 cified databse h
10a90 61 6e 64 6c 65 2e 20 20 53 69 6e 63 65 20 67 65 andle. Since ge
10aa0 74 74 69 6e 67 20 74 68 69 73 20 6f 62 6a 65 63 tting this objec
10ab0 74 20 72 65 6c 69 65 73 20 75 70 6f 6e 0d 0a 20 t relies upon..
10ac0 20 20 20 20 20 23 20 20 20 20 20 20 20 45 61 67 # Eag
10ad0 6c 65 20 69 6e 74 65 72 6e 61 6c 73 2c 20 67 72 le internals, gr
10ae0 65 61 74 20 63 61 72 65 20 73 68 6f 75 6c 64 20 eat care should
10af0 62 65 20 74 61 6b 65 6e 20 74 6f 20 61 76 6f 69 be taken to avoi
10b00 64 20 64 69 73 70 6f 73 69 6e 67 20 6f 66 0d 0a d disposing of..
10b10 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 # th
10b20 69 73 20 6f 62 6a 65 63 74 20 6f 72 20 6f 74 68 is object or oth
10b30 65 72 77 69 73 65 20 70 75 74 74 69 6e 67 20 69 erwise putting i
10b40 74 20 69 6e 74 6f 20 61 6e 20 69 6e 76 61 6c 69 t into an invali
10b50 64 20 73 74 61 74 65 2e 0d 0a 20 20 20 20 20 20 d state...
10b60 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e #.. if {[in
10b70 66 6f 20 65 78 69 73 74 73 20 64 62 5d 7d 20 74 fo exists db]} t
10b80 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 hen {.. i
10b90 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
10ba0 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
10bb0 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e voke -flags +Non
10bc0 50 75 62 6c 69 63 20 2d 6f 62 6a 65 63 74 66 6c Public -objectfl
10bd0 61 67 73 20 2b 4e 6f 44 69 73 70 6f 73 65 20 2d ags +NoDispose -
10be0 61 6c 69 61 73 20 5c 0d 0a 20 20 20 20 20 20 20 alias \..
10bf0 20 20 20 20 20 20 20 49 6e 74 65 72 70 72 65 74 Interpret
10c00 65 72 2e 47 65 74 41 63 74 69 76 65 2e 63 6f 6e er.GetActive.con
10c10 6e 65 63 74 69 6f 6e 73 20 49 74 65 6d 20 24 64 nections Item $d
10c20 62 0d 0a 20 20 20 20 20 20 20 20 7d 20 72 65 73 b.. } res
10c30 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ult] == 0} then
10c40 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a {.. #..
10c50 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
10c60 3a 20 53 75 63 63 65 73 73 2c 20 72 65 74 75 72 : Success, retur
10c70 6e 20 74 68 65 20 6f 70 61 71 75 65 20 6f 62 6a n the opaque obj
10c80 65 63 74 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 20 ect handle...
10c90 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
10ca0 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 return $resu
10cb0 6c 74 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c lt.. } el
10cc0 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
10cd0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
10ce0 4f 54 45 3a 20 46 61 69 6c 75 72 65 2c 20 72 65 OTE: Failure, re
10cf0 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 port why...
10d00 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
10d10 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
10d20 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
10d30 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
10d40 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 "==== WARNI
10d50 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 67 65 NG: failed to ge
10d60 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 68 61 6e t connection han
10d70 64 6c 65 20 66 6f 72 20 64 61 74 61 62 61 73 65 dle for database
10d80 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 \"" \..
10d90 20 20 20 20 20 20 24 64 62 20 22 5c 22 2c 20 65 $db "\", e
10da0 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 72 65 rror: " \n\t $re
10db0 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 sult \n]..
10dc0 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
10dd0 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
10de0 20 66 72 65 65 44 62 43 6f 6e 6e 65 63 74 69 6f freeDbConnectio
10df0 6e 20 7b 20 7b 76 61 72 4e 61 6d 65 20 63 6f 6e n { {varName con
10e00 6e 65 63 74 69 6f 6e 7d 20 7d 20 7b 0d 0a 20 20 nection} } {..
10e10 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
10e20 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 74 68 OTE: Refer to th
10e30 65 20 73 70 65 63 69 66 69 65 64 20 76 61 72 69 e specified vari
10e40 61 62 6c 65 20 28 65 2e 67 2e 20 22 63 6f 6e 6e able (e.g. "conn
10e50 65 63 74 69 6f 6e 22 29 20 69 6e 20 74 68 65 0d ection") in the.
10e60 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 . # c
10e70 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 20 63 61 ontext of our ca
10e80 6c 6c 65 72 2e 20 20 54 68 65 20 6f 70 61 71 75 ller. The opaqu
10e90 65 20 6f 62 6a 65 63 74 20 68 61 6e 64 6c 65 20 e object handle
10ea0 66 6f 72 20 61 6e 20 41 44 4f 2e 4e 45 54 0d 0a for an ADO.NET..
10eb0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
10ec0 6e 6e 65 63 74 69 6f 6e 20 70 72 65 76 69 6f 75 nnection previou
10ed0 73 6c 79 20 72 65 74 75 72 6e 65 64 20 62 79 20 sly returned by
10ee0 5b 67 65 74 44 62 43 6f 6e 6e 65 63 74 69 6f 6e [getDbConnection
10ef0 5d 20 73 68 6f 75 6c 64 20 62 65 0d 0a 20 20 20 ] should be..
10f00 20 20 20 23 20 20 20 20 20 20 20 73 74 6f 72 65 # store
10f10 64 20 74 68 65 72 65 2e 0d 0a 20 20 20 20 20 20 d there...
10f20 23 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 #.. upvar 1
10f30 20 24 76 61 72 4e 61 6d 65 20 63 6f 6e 6e 65 63 $varName connec
10f40 74 69 6f 6e 0d 0a 0d 0a 20 20 20 20 20 20 23 0d tion.... #.
10f50 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 . # NOTE: A
10f60 74 74 65 6d 70 74 20 74 6f 20 72 65 6d 6f 76 65 ttempt to remove
10f70 20 74 68 65 20 6f 70 61 71 75 65 20 6f 62 6a 65 the opaque obje
10f80 63 74 20 68 61 6e 64 6c 65 20 66 72 6f 6d 20 74 ct handle from t
10f90 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 0d 0a he interpreter..
10fa0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6e 6f # no
10fb0 77 2e 20 20 54 68 69 73 20 5b 6f 62 6a 65 63 74 w. This [object
10fc0 20 64 69 73 70 6f 73 65 5d 20 63 61 6c 6c 20 77 dispose] call w
10fd0 69 6c 6c 20 6e 6f 74 20 61 63 74 75 61 6c 6c 79 ill not actually
10fe0 20 64 69 73 70 6f 73 65 20 6f 66 20 74 68 65 0d dispose of the.
10ff0 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 75 . # u
11000 6e 64 65 72 6c 79 69 6e 67 20 6f 62 6a 65 63 74 nderlying object
11010 20 62 65 63 61 75 73 65 20 74 68 65 20 2b 4e 6f because the +No
11020 44 69 73 70 6f 73 65 20 66 6c 61 67 20 77 61 73 Dispose flag was
11030 20 73 65 74 20 6f 6e 20 69 74 0d 0a 20 20 20 20 set on it..
11040 20 20 23 20 20 20 20 20 20 20 64 75 72 69 6e 67 # during
11050 20 63 72 65 61 74 69 6f 6e 20 6f 66 20 74 68 65 creation of the
11060 20 6f 70 61 71 75 65 20 6f 62 6a 65 63 74 20 68 opaque object h
11070 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 20 23 0d andle... #.
11080 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f . if {[info
11090 20 65 78 69 73 74 73 20 63 6f 6e 6e 65 63 74 69 exists connecti
110a0 6f 6e 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 on] && \..
110b0 20 20 20 20 5b 63 61 74 63 68 20 7b 6f 62 6a 65 [catch {obje
110c0 63 74 20 64 69 73 70 6f 73 65 20 24 63 6f 6e 6e ct dispose $conn
110d0 65 63 74 69 6f 6e 7d 20 65 72 72 6f 72 5d 7d 20 ection} error]}
110e0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
110f0 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
11100 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 20 66 61 E: We somehow fa
11110 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 74 iled to remove t
11120 68 65 20 68 61 6e 64 6c 65 2c 20 72 65 70 6f 72 he handle, repor
11130 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 20 t why...
11140 23 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 #.. tputs
11150 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
11160 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
11170 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d "===
11180 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 = WARNING: faile
11190 64 20 74 6f 20 72 65 6d 6f 76 65 20 63 6f 6e 6e d to remove conn
111a0 65 63 74 69 6f 6e 20 68 61 6e 64 6c 65 20 5c 22 ection handle \"
111b0 22 20 24 63 6f 6e 6e 65 63 74 69 6f 6e 20 5c 0d " $connection \.
111c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 . "\"
111d0 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 , error: " \n\t
111e0 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 $error \n]..
111f0 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
11200 20 20 20 70 72 6f 63 20 61 64 64 44 62 43 6f 6e proc addDbCon
11210 6e 65 63 74 69 6f 6e 20 7b 20 63 6f 6e 6e 65 63 nection { connec
11220 74 69 6f 6e 20 7b 76 61 72 4e 61 6d 65 20 64 62 tion {varName db
11230 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a } } {.. #..
11240 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 # NOTE: Re
11250 66 65 72 20 74 6f 20 74 68 65 20 73 70 65 63 69 fer to the speci
11260 66 69 65 64 20 76 61 72 69 61 62 6c 65 20 28 65 fied variable (e
11270 2e 67 2e 20 22 64 62 22 29 20 69 6e 20 74 68 65 .g. "db") in the
11280 20 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 0d context of our.
11290 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 . # c
112a0 61 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d aller... #.
112b0 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 . upvar 1 $
112c0 76 61 72 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 varName db....
112d0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
112e0 4f 54 45 3a 20 43 72 65 61 74 65 20 61 20 63 6f OTE: Create a co
112f0 72 72 65 63 74 6c 79 20 66 6f 72 6d 61 74 74 65 rrectly formatte
11300 64 20 6e 61 6d 65 20 66 6f 72 20 74 68 65 20 64 d name for the d
11310 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 atabase connecti
11320 6f 6e 20 74 6f 0d 0a 20 20 20 20 20 20 23 20 20 on to.. #
11330 20 20 20 20 20 62 65 20 61 64 64 65 64 20 74 6f be added to
11340 20 74 68 65 20 6c 69 73 74 20 6d 61 6e 61 67 65 the list manage
11350 64 20 62 79 20 74 68 65 20 45 61 67 6c 65 20 69 d by the Eagle i
11360 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 nterpreter...
11370 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 #.. set
11380 64 62 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b db [object invok
11390 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 e -flags +NonPub
113a0 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 lic \..
113b0 20 45 61 67 6c 65 2e 5f 43 6f 6d 70 6f 6e 65 6e Eagle._Componen
113c0 74 73 2e 50 72 69 76 61 74 65 2e 46 6f 72 6d 61 ts.Private.Forma
113d0 74 4f 70 73 20 44 61 74 61 62 61 73 65 4f 62 6a tOps DatabaseObj
113e0 65 63 74 4e 61 6d 65 20 24 63 6f 6e 6e 65 63 74 ectName $connect
113f0 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ion \..
11400 20 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f SQLiteConnectio
11410 6e 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 n [object invoke
11420 20 49 6e 74 65 72 70 72 65 74 65 72 2e 47 65 74 Interpreter.Get
11430 41 63 74 69 76 65 20 4e 65 78 74 49 64 5d 5d 0d Active NextId]].
11440 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
11450 20 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 74 68 # NOTE: Add th
11460 65 20 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 e database conne
11470 63 74 69 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 ction provided b
11480 79 20 6f 75 72 20 63 61 6c 6c 65 72 20 74 6f 20 y our caller to
11490 74 68 65 20 6c 69 73 74 0d 0a 20 20 20 20 20 20 the list..
114a0 23 20 20 20 20 20 20 20 6f 66 20 74 68 6f 73 65 # of those
114b0 20 6b 6e 6f 77 6e 20 74 6f 20 74 68 65 20 45 61 known to the Ea
114c0 67 6c 65 20 69 6e 74 65 72 70 72 65 74 65 72 2e gle interpreter.
114d0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
114e0 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
114f0 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
11500 20 49 6e 74 65 72 70 72 65 74 65 72 2e 47 65 74 Interpreter.Get
11510 41 63 74 69 76 65 2e 63 6f 6e 6e 65 63 74 69 6f Active.connectio
11520 6e 73 20 41 64 64 20 5c 0d 0a 20 20 20 20 20 20 ns Add \..
11530 20 20 20 20 24 64 62 20 24 63 6f 6e 6e 65 63 74 $db $connect
11540 69 6f 6e 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 ion.. }.....
11550 20 20 20 70 72 6f 63 20 67 65 74 52 6f 77 73 46 proc getRowsF
11560 72 6f 6d 44 61 74 61 54 61 62 6c 65 20 7b 20 64 romDataTable { d
11570 61 74 61 54 61 62 6c 65 20 7d 20 7b 0d 0a 20 20 ataTable } {..
11580 20 20 20 20 73 65 74 20 72 6f 77 73 20 5b 6c 69 set rows [li
11590 73 74 5d 0d 0a 20 20 20 20 20 20 73 65 74 20 63 st].. set c
115a0 6f 75 6e 74 20 5b 24 64 61 74 61 54 61 62 6c 65 ount [$dataTable
115b0 20 43 6f 6c 75 6d 6e 73 2e 43 6f 75 6e 74 5d 0d Columns.Count].
115c0 0a 0d 0a 20 20 20 20 20 20 66 6f 72 20 7b 73 65 ... for {se
115d0 74 20 69 6e 64 65 78 20 30 7d 20 7b 24 69 6e 64 t index 0} {$ind
115e0 65 78 20 3c 20 24 63 6f 75 6e 74 7d 20 7b 69 6e ex < $count} {in
115f0 63 72 20 69 6e 64 65 78 7d 20 7b 0d 0a 20 20 20 cr index} {..
11600 20 20 20 20 20 73 65 74 20 64 61 74 61 43 6f 6c set dataCol
11610 75 6d 6e 20 5b 24 64 61 74 61 54 61 62 6c 65 20 umn [$dataTable
11620 2d 61 6c 69 61 73 20 43 6f 6c 75 6d 6e 73 2e 67 -alias Columns.g
11630 65 74 5f 49 74 65 6d 20 24 69 6e 64 65 78 5d 0d et_Item $index].
11640 0a 20 20 20 20 20 20 20 20 73 65 74 20 6e 61 6d . set nam
11650 65 73 28 24 69 6e 64 65 78 29 20 5b 24 64 61 74 es($index) [$dat
11660 61 43 6f 6c 75 6d 6e 20 43 6f 6c 75 6d 6e 4e 61 aColumn ColumnNa
11670 6d 65 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a me].. }....
11680 20 20 20 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 object for
11690 65 61 63 68 20 2d 61 6c 69 61 73 20 64 61 74 61 each -alias data
116a0 52 6f 77 20 5b 73 65 74 20 64 61 74 61 52 6f 77 Row [set dataRow
116b0 73 20 5b 24 64 61 74 61 54 61 62 6c 65 20 52 6f s [$dataTable Ro
116c0 77 73 5d 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 ws]] {..
116d0 73 65 74 20 72 6f 77 20 5b 6c 69 73 74 5d 0d 0a set row [list]..
116e0 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 20 7b 73 .. for {s
116f0 65 74 20 69 6e 64 65 78 20 30 7d 20 7b 24 69 6e et index 0} {$in
11700 64 65 78 20 3c 20 24 63 6f 75 6e 74 7d 20 7b 69 dex < $count} {i
11710 6e 63 72 20 69 6e 64 65 78 7d 20 7b 0d 0a 20 20 ncr index} {..
11720 20 20 20 20 20 20 20 20 73 65 74 20 76 61 6c 75 set valu
11730 65 20 5b 24 64 61 74 61 52 6f 77 20 2d 63 72 65 e [$dataRow -cre
11740 61 74 65 20 2d 61 6c 69 61 73 20 67 65 74 5f 49 ate -alias get_I
11750 74 65 6d 20 24 69 6e 64 65 78 5d 0d 0a 0d 0a 20 tem $index]....
11760 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 if {[st
11770 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 6c ring length $val
11780 75 65 5d 20 3e 20 30 20 26 26 20 5c 0d 0a 20 20 ue] > 0 && \..
11790 20 20 20 20 20 20 20 20 20 20 20 20 21 5b 6f 62 ![ob
117a0 6a 65 63 74 20 69 6e 76 6f 6b 65 20 43 6f 6e 76 ject invoke Conv
117b0 65 72 74 20 49 73 44 42 4e 75 6c 6c 20 24 76 61 ert IsDBNull $va
117c0 6c 75 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 lue]} then {..
117d0 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e lappen
117e0 64 20 72 6f 77 20 5b 6c 69 73 74 20 24 6e 61 6d d row [list $nam
117f0 65 73 28 24 69 6e 64 65 78 29 20 5b 24 76 61 6c es($index) [$val
11800 75 65 20 54 6f 53 74 72 69 6e 67 5d 5d 0d 0a 20 ue ToString]]..
11810 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 } else
11820 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c {.. l
11830 61 70 70 65 6e 64 20 72 6f 77 20 5b 6c 69 73 74 append row [list
11840 20 24 6e 61 6d 65 73 28 24 69 6e 64 65 78 29 5d $names($index)]
11850 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
11860 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
11870 20 20 20 20 6c 61 70 70 65 6e 64 20 72 6f 77 73 lappend rows
11880 20 24 72 6f 77 0d 0a 20 20 20 20 20 20 7d 0d 0a $row.. }..
11890 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 .. return $
118a0 72 6f 77 73 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a rows.. }.....
118b0 20 20 20 20 70 72 6f 63 20 64 75 6d 70 52 6f 77 proc dumpRow
118c0 73 46 72 6f 6d 44 61 74 61 54 61 62 6c 65 20 7b sFromDataTable {
118d0 20 63 68 61 6e 6e 65 6c 20 72 6f 77 73 20 7d 20 channel rows }
118e0 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 73 65 71 {.. set seq
118f0 75 65 6e 63 65 20 31 0d 0a 0d 0a 20 20 20 20 20 uence 1....
11900 20 66 6f 72 65 61 63 68 20 72 6f 77 20 24 72 6f foreach row $ro
11910 77 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 ws {.. tp
11920 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
11930 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
11940 20 20 20 20 20 20 20 20 5b 65 78 70 72 20 7b 24 [expr {$
11950 73 65 71 75 65 6e 63 65 20 3e 20 31 20 3f 20 22 sequence > 1 ? "
11960 5c 6e 22 20 3a 20 22 22 7d 5d 20 22 2d 2d 2d 2d \n" : ""}] "----
11970 20 52 4f 57 20 23 22 20 24 73 65 71 75 65 6e 63 ROW #" $sequenc
11980 65 20 3a 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 e :\n]....
11990 20 20 66 6f 72 65 61 63 68 20 70 61 69 72 20 24 foreach pair $
119a0 72 6f 77 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 row {..
119b0 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 70 if {[llength $p
119c0 61 69 72 5d 20 3e 3d 20 32 7d 20 74 68 65 6e 20 air] >= 2} then
119d0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
119e0 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
119f0 70 70 65 6e 64 41 72 67 73 20 5c 74 20 5c 0d 0a ppendArgs \t \..
11a00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
11a10 5b 6c 69 73 74 20 5b 6c 69 6e 64 65 78 20 24 70 [list [lindex $p
11a20 61 69 72 20 30 5d 5d 20 22 3a 20 22 20 5b 6c 69 air 0]] ": " [li
11a30 73 74 20 5b 6c 69 6e 64 65 78 20 24 70 61 69 72 st [lindex $pair
11a40 20 31 5d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 1]] \n]..
11a50 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 6c } elseif {[l
11a60 6c 65 6e 67 74 68 20 24 70 61 69 72 5d 20 3d 3d length $pair] ==
11a70 20 31 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 1} then {..
11a80 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
11a90 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
11aa0 67 73 20 5c 74 20 5c 0d 0a 20 20 20 20 20 20 20 gs \t \..
11ab0 20 20 20 20 20 20 20 20 20 5b 6c 69 73 74 20 5b [list [
11ac0 6c 69 6e 64 65 78 20 24 70 61 69 72 20 30 5d 5d lindex $pair 0]]
11ad0 20 22 3a 20 3c 6e 75 6c 6c 3e 5c 6e 22 5d 0d 0a ": <null>\n"]..
11ae0 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 } else
11af0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
11b00 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5c tputs $channel \
11b10 74 3c 65 6d 70 74 79 3e 5c 6e 3b 20 23 20 4e 4f t<empty>\n; # NO
11b20 54 45 3a 20 4e 6f 20 64 61 74 61 3f 0d 0a 20 20 TE: No data?..
11b30 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
11b40 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
11b50 69 6e 63 72 20 73 65 71 75 65 6e 63 65 0d 0a 20 incr sequence..
11b60 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
11b70 0d 0a 20 20 20 20 70 72 6f 63 20 63 6c 65 61 6e .. proc clean
11b80 75 70 44 62 20 7b 20 66 69 6c 65 4e 61 6d 65 20 upDb { fileName
11b90 7b 76 61 72 4e 61 6d 65 20 64 62 7d 20 7b 63 6f {varName db} {co
11ba0 6c 6c 65 63 74 20 74 72 75 65 7d 20 7b 71 75 61 llect true} {qua
11bb0 6c 69 66 79 20 74 72 75 65 7d 0d 0a 20 20 20 20 lify true}..
11bc0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
11bd0 20 7b 64 65 6c 65 74 65 20 74 72 75 65 7d 20 7d {delete true} }
11be0 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
11bf0 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d # NOTE: Attem
11c00 70 74 20 74 6f 20 66 6f 72 63 65 20 61 6c 6c 20 pt to force all
11c10 70 65 6e 64 69 6e 67 20 22 67 61 72 62 61 67 65 pending "garbage
11c20 22 20 6f 62 6a 65 63 74 73 20 74 6f 20 62 65 20 " objects to be
11c30 63 6f 6c 6c 65 63 74 65 64 2c 0d 0a 20 20 20 20 collected,..
11c40 20 20 23 20 20 20 20 20 20 20 69 6e 63 6c 75 64 # includ
11c50 69 6e 67 20 53 51 4c 69 74 65 20 73 74 61 74 65 ing SQLite state
11c60 6d 65 6e 74 73 20 61 6e 64 20 62 61 63 6b 75 70 ments and backup
11c70 20 6f 62 6a 65 63 74 73 3b 20 74 68 69 73 20 73 objects; this s
11c80 68 6f 75 6c 64 20 61 6c 6c 6f 77 0d 0a 20 20 20 hould allow..
11c90 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 75 # the u
11ca0 6e 64 65 72 6c 79 69 6e 67 20 64 61 74 61 62 61 nderlying databa
11cb0 73 65 20 66 69 6c 65 20 74 6f 20 62 65 20 64 65 se file to be de
11cc0 6c 65 74 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d leted... #.
11cd0 0a 20 20 20 20 20 20 69 66 20 7b 24 63 6f 6c 6c . if {$coll
11ce0 65 63 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ect} then {..
11cf0 20 20 20 20 20 63 6f 6c 6c 65 63 74 47 61 72 62 collectGarb
11d00 61 67 65 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e age $::test_chan
11d10 6e 65 6c 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a nel.. }....
11d20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
11d30 20 4e 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 NOTE: Refer to
11d40 74 68 65 20 73 70 65 63 69 66 69 65 64 20 76 61 the specified va
11d50 72 69 61 62 6c 65 20 28 65 2e 67 2e 20 22 64 62 riable (e.g. "db
11d60 22 29 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 ") in the contex
11d70 74 20 6f 66 20 6f 75 72 0d 0a 20 20 20 20 20 20 t of our..
11d80 23 20 20 20 20 20 20 20 63 61 6c 6c 65 72 2e 20 # caller.
11d90 20 54 68 65 20 68 61 6e 64 6c 65 20 74 6f 20 74 The handle to t
11da0 68 65 20 64 61 74 61 62 61 73 65 20 70 72 65 76 he database prev
11db0 69 6f 75 73 6c 79 20 6f 70 65 6e 65 64 20 76 69 iously opened vi
11dc0 61 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 a the.. #
11dd0 20 20 20 20 20 5b 73 65 74 75 70 44 62 5d 20 70 [setupDb] p
11de0 72 6f 63 65 64 75 72 65 20 73 68 6f 75 6c 64 20 rocedure should
11df0 62 65 20 73 74 6f 72 65 64 20 74 68 65 72 65 2e be stored there.
11e00 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
11e10 20 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d upvar 1 $varNam
11e20 65 20 64 62 0d 0a 0d 0a 20 20 20 20 20 20 23 0d e db.... #.
11e30 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 . # NOTE: C
11e40 6c 6f 73 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 lose the connect
11e50 69 6f 6e 20 74 6f 20 74 68 65 20 64 61 74 61 62 ion to the datab
11e60 61 73 65 20 6e 6f 77 2e 20 20 54 68 69 73 20 73 ase now. This s
11e70 68 6f 75 6c 64 20 61 6c 6c 6f 77 20 75 73 0d 0a hould allow us..
11e80 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 6f # to
11e90 20 64 65 6c 65 74 65 20 74 68 65 20 75 6e 64 65 delete the unde
11ea0 72 6c 79 69 6e 67 20 64 61 74 61 62 61 73 65 20 rlying database
11eb0 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a file... #..
11ec0 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 if {[info
11ed0 65 78 69 73 74 73 20 64 62 5d 20 26 26 20 5b 63 exists db] && [c
11ee0 61 74 63 68 20 7b 73 71 6c 20 63 6c 6f 73 65 20 atch {sql close
11ef0 24 64 62 7d 20 65 72 72 6f 72 5d 7d 20 74 68 65 $db} error]} the
11f00 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
11f10 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
11f20 57 65 20 73 6f 6d 65 68 6f 77 20 66 61 69 6c 65 We somehow faile
11f30 64 20 74 6f 20 63 6c 6f 73 65 20 74 68 65 20 64 d to close the d
11f40 61 74 61 62 61 73 65 2c 20 72 65 70 6f 72 74 20 atabase, report
11f50 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d why... #.
11f60 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
11f70 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
11f80 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
11f90 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
11fa0 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
11fb0 74 6f 20 63 6c 6f 73 65 20 64 61 74 61 62 61 73 to close databas
11fc0 65 20 5c 22 22 20 24 64 62 20 22 5c 22 2c 20 65 e \"" $db "\", e
11fd0 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 rror: " \..
11fe0 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 65 72 72 \n\t $err
11ff0 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d or \n].. }.
12000 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
12010 20 20 23 20 4e 4f 54 45 3a 20 46 69 72 73 74 2c # NOTE: First,
12020 20 73 65 65 20 69 66 20 6f 75 72 20 63 61 6c 6c see if our call
12030 65 72 20 68 61 73 20 72 65 71 75 65 73 74 65 64 er has requested
12040 20 61 6e 20 69 6e 2d 6d 65 6d 6f 72 79 20 64 61 an in-memory da
12050 74 61 62 61 73 65 2e 0d 0a 20 20 20 20 20 20 23 tabase... #
12060 0d 0a 20 20 20 20 20 20 73 65 74 20 69 73 4d 65 .. set isMe
12070 6d 6f 72 79 20 5b 69 73 4d 65 6d 6f 72 79 44 62 mory [isMemoryDb
12080 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 $fileName]....
12090 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
120a0 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 20 NOTE: Build the
120b0 66 75 6c 6c 20 70 61 74 68 20 74 6f 20 74 68 65 full path to the
120c0 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 6e database file n
120d0 61 6d 65 2e 20 20 46 6f 72 20 6e 6f 77 2c 20 61 ame. For now, a
120e0 6c 6c 20 74 65 73 74 0d 0a 20 20 20 20 20 20 23 ll test.. #
120f0 20 20 20 20 20 20 20 64 61 74 61 62 61 73 65 20 database
12100 66 69 6c 65 73 20 61 72 65 20 73 74 6f 72 65 64 files are stored
12110 20 69 6e 20 74 68 65 20 74 65 6d 70 6f 72 61 72 in the temporar
12120 79 20 64 69 72 65 63 74 6f 72 79 2e 0d 0a 20 20 y directory...
12130 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
12140 7b 21 24 69 73 4d 65 6d 6f 72 79 20 26 26 20 24 {!$isMemory && $
12150 71 75 61 6c 69 66 79 7d 20 74 68 65 6e 20 7b 0d qualify} then {.
12160 0a 20 20 20 20 20 20 20 20 73 65 74 20 66 69 6c . set fil
12170 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e eName [file join
12180 20 5b 67 65 74 44 61 74 61 62 61 73 65 44 69 72 [getDatabaseDir
12190 65 63 74 6f 72 79 5d 20 5b 66 69 6c 65 20 74 61 ectory] [file ta
121a0 69 6c 20 24 66 69 6c 65 4e 61 6d 65 5d 5d 0d 0a il $fileName]]..
121b0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
121c0 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
121d0 3a 20 43 68 65 63 6b 20 69 66 20 74 68 65 20 66 : Check if the f
121e0 69 6c 65 20 73 74 69 6c 6c 20 65 78 69 73 74 73 ile still exists
121f0 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
12200 20 20 69 66 20 7b 21 24 69 73 4d 65 6d 6f 72 79 if {!$isMemory
12210 20 26 26 20 24 64 65 6c 65 74 65 20 26 26 20 5b && $delete && [
12220 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c file exists $fil
12230 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a eName]} then {..
12240 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
12250 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 # NOTE: Skip
12260 64 65 6c 65 74 69 6e 67 20 64 61 74 61 62 61 73 deleting databas
12270 65 20 66 69 6c 65 73 20 69 66 20 73 6f 6d 65 62 e files if someb
12280 6f 64 79 20 73 65 74 73 20 74 68 65 20 67 6c 6f ody sets the glo
12290 62 61 6c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 bal.. #
122a0 20 20 20 20 20 76 61 72 69 61 62 6c 65 20 74 6f variable to
122b0 20 70 72 65 76 65 6e 74 20 69 74 2e 0d 0a 20 20 prevent it...
122c0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
122d0 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
122e0 74 73 20 3a 3a 6e 6f 28 63 6c 65 61 6e 75 70 44 ts ::no(cleanupD
122f0 62 46 69 6c 65 29 5d 7d 20 74 68 65 6e 20 7b 0d bFile)]} then {.
12300 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
12310 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
12320 41 74 74 65 6d 70 74 20 74 6f 20 64 65 6c 65 74 Attempt to delet
12330 65 20 74 68 65 20 74 65 73 74 20 64 61 74 61 62 e the test datab
12340 61 73 65 20 66 69 6c 65 20 6e 6f 77 2e 0d 0a 20 ase file now...
12350 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
12360 20 20 20 20 20 20 69 66 20 7b 5b 73 65 74 20 63 if {[set c
12370 6f 64 65 20 5b 63 61 74 63 68 20 7b 66 69 6c 65 ode [catch {file
12380 20 64 65 6c 65 74 65 20 24 66 69 6c 65 4e 61 6d delete $fileNam
12390 65 7d 20 65 72 72 6f 72 5d 5d 7d 20 74 68 65 6e e} error]]} then
123a0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
123b0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 #.. #
123c0 20 4e 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f NOTE: We someho
123d0 77 20 66 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 w failed to dele
123e0 74 65 20 74 68 65 20 66 69 6c 65 2c 20 72 65 70 te the file, rep
123f0 6f 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 ort why...
12400 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
12410 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
12420 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
12430 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
12440 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
12450 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
12460 74 6f 20 64 65 6c 65 74 65 20 64 61 74 61 62 61 to delete databa
12470 73 65 20 66 69 6c 65 20 5c 22 22 20 24 66 69 6c se file \"" $fil
12480 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 eName \..
12490 20 20 20 20 20 20 20 20 20 22 5c 22 20 64 75 72 "\" dur
124a0 69 6e 67 20 63 6c 65 61 6e 75 70 2c 20 65 72 72 ing cleanup, err
124b0 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f or: " \n\t $erro
124c0 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 r \n]..
124d0 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c }.. } el
124e0 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
124f0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
12500 4f 54 45 3a 20 53 68 6f 77 20 74 68 61 74 20 77 OTE: Show that w
12510 65 20 73 6b 69 70 70 65 64 20 64 65 6c 65 74 69 e skipped deleti
12520 6e 67 20 74 68 65 20 66 69 6c 65 2e 0d 0a 20 20 ng the file...
12530 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
12540 20 20 20 20 20 73 65 74 20 63 6f 64 65 20 30 0d set code 0.
12550 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 ... tpu
12560 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
12570 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
12580 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
12590 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 73 "==== WARNING: s
125a0 6b 69 70 70 65 64 20 64 65 6c 65 74 69 6e 67 20 kipped deleting
125b0 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 5c 22 database file \"
125c0 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 " $fileName \..
125d0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 "\"
125e0 20 64 75 72 69 6e 67 20 63 6c 65 61 6e 75 70 5c during cleanup\
125f0 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a n"].. }..
12600 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
12610 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
12620 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 66 # NOTE: The f
12630 69 6c 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 ile does not exi
12640 73 74 2c 20 73 75 63 63 65 73 73 21 0d 0a 20 20 st, success!..
12650 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
12660 20 73 65 74 20 63 6f 64 65 20 30 0d 0a 20 20 20 set code 0..
12670 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 }.... re
12680 74 75 72 6e 20 24 63 6f 64 65 0d 0a 20 20 20 20 turn $code..
12690 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 73 }..... proc s
126a0 65 74 75 70 44 62 49 6e 74 65 72 72 75 70 74 43 etupDbInterruptC
126b0 61 6c 6c 62 61 63 6b 20 7b 20 63 68 61 6e 6e 65 allback { channe
126c0 6c 20 6c 6f 67 20 7d 20 7b 0d 0a 20 20 20 20 20 l log } {..
126d0 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
126e0 22 2d 2d 2d 2d 20 73 65 74 74 69 6e 67 20 75 70 "---- setting up
126f0 20 64 65 62 75 67 67 65 72 20 69 6e 74 65 72 72 debugger interr
12700 75 70 74 20 63 61 6c 6c 62 61 63 6b 2e 2e 2e 20 upt callback...
12710 22 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b ".... if {[
12720 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
12730 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
12740 54 45 3a 20 4d 61 6b 65 20 73 75 72 65 20 74 68 TE: Make sure th
12750 65 20 73 63 72 69 70 74 20 64 65 62 75 67 67 65 e script debugge
12760 72 20 61 6e 64 20 74 68 65 20 69 73 6f 6c 61 74 r and the isolat
12770 65 64 20 69 6e 74 65 72 70 72 65 74 65 72 20 61 ed interpreter a
12780 72 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 re.. #
12790 20 20 20 20 73 65 74 75 70 20 61 6e 64 20 72 65 setup and re
127a0 61 64 79 20 66 6f 72 20 75 73 65 2e 0d 0a 20 20 ady for use...
127b0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
127c0 20 64 65 62 75 67 20 73 65 74 75 70 20 74 72 75 debug setup tru
127d0 65 20 74 72 75 65 0d 0a 0d 0a 20 20 20 20 20 20 e true....
127e0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
127f0 4f 54 45 3a 20 4c 6f 61 64 20 74 68 65 20 6e 65 OTE: Load the ne
12800 63 65 73 73 61 72 79 20 70 61 63 6b 61 67 65 73 cessary packages
12810 20 69 6e 74 6f 20 74 68 65 20 69 73 6f 6c 61 74 into the isolat
12820 65 64 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0d ed interpreter..
12830 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
12840 20 20 20 20 64 65 62 75 67 20 65 76 61 6c 20 7b debug eval {
12850 0d 0a 20 20 20 20 20 20 20 20 20 20 70 61 63 6b .. pack
12860 61 67 65 20 72 65 71 75 69 72 65 20 45 61 67 6c age require Eagl
12870 65 0d 0a 20 20 20 20 20 20 20 20 20 20 70 61 63 e.. pac
12880 6b 61 67 65 20 72 65 71 75 69 72 65 20 45 61 67 kage require Eag
12890 6c 65 2e 4c 69 62 72 61 72 79 0d 0a 20 20 20 20 le.Library..
128a0 20 20 20 20 20 20 70 61 63 6b 61 67 65 20 72 65 package re
128b0 71 75 69 72 65 20 45 61 67 6c 65 2e 54 65 73 74 quire Eagle.Test
128c0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
128d0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
128e0 20 20 23 20 4e 4f 54 45 3a 20 43 6f 70 79 20 74 # NOTE: Copy t
128f0 68 65 20 6e 65 63 65 73 73 61 72 79 20 76 61 72 he necessary var
12900 69 61 62 6c 65 73 20 69 6e 74 6f 20 74 68 65 20 iables into the
12910 69 73 6f 6c 61 74 65 64 20 69 6e 74 65 72 70 72 isolated interpr
12920 65 74 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 23 eter... #
12930 0d 0a 20 20 20 20 20 20 20 20 64 65 62 75 67 20 .. debug
12940 69 6e 76 6f 6b 65 20 30 20 73 65 74 20 3a 3a 74 invoke 0 set ::t
12950 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 63 68 61 est_channel $cha
12960 6e 6e 65 6c 3b 20 23 20 4e 4f 54 45 3a 20 46 6f nnel; # NOTE: Fo
12970 72 20 5b 74 70 75 74 73 5d 2e 0d 0a 20 20 20 20 r [tputs]...
12980 20 20 20 20 64 65 62 75 67 20 69 6e 76 6f 6b 65 debug invoke
12990 20 30 20 73 65 74 20 3a 3a 74 65 73 74 5f 6c 6f 0 set ::test_lo
129a0 67 20 24 6c 6f 67 3b 20 23 20 4e 4f 54 45 3a 20 g $log; # NOTE:
129b0 46 6f 72 20 5b 74 6c 6f 67 5d 2e 0d 0a 0d 0a 20 For [tlog].....
129c0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
129d0 20 20 23 20 4e 4f 54 45 3a 20 49 6e 73 74 61 6c # NOTE: Instal
129e0 6c 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 l the callback s
129f0 63 72 69 70 74 20 74 6f 20 62 65 20 65 76 61 6c cript to be eval
12a00 75 61 74 65 64 20 69 6e 20 74 68 65 20 69 73 6f uated in the iso
12a10 6c 61 74 65 64 0d 0a 20 20 20 20 20 20 20 20 23 lated.. #
12a20 20 20 20 20 20 20 20 69 6e 74 65 72 70 72 65 74 interpret
12a30 65 72 20 77 68 65 6e 20 74 68 69 73 20 69 6e 74 er when this int
12a40 65 72 70 72 65 74 65 72 20 69 73 20 69 6e 74 65 erpreter is inte
12a50 72 72 75 70 74 65 64 20 62 79 20 73 63 72 69 70 rrupted by scrip
12a60 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 t.. #
12a70 20 20 20 63 61 6e 63 65 6c 6c 61 74 69 6f 6e 2c cancellation,
12a80 20 65 74 63 2e 0d 0a 20 20 20 20 20 20 20 20 23 etc... #
12a90 0d 0a 20 20 20 20 20 20 20 20 64 65 62 75 67 20 .. debug
12aa0 63 61 6c 6c 62 61 63 6b 20 61 70 70 6c 79 20 7b callback apply {
12ab0 7b 73 65 6e 64 65 72 20 65 7d 20 7b 0d 0a 20 20 {sender e} {..
12ac0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
12ad0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 # NOTE: Che
12ae0 63 6b 20 69 66 20 74 68 69 73 20 63 61 6c 6c 62 ck if this callb
12af0 61 63 6b 20 69 73 20 6f 6e 65 20 74 68 61 74 20 ack is one that
12b00 77 65 20 63 61 72 65 20 61 62 6f 75 74 2e 0d 0a we care about...
12b10 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
12b20 20 20 20 20 20 20 20 69 66 20 7b 22 43 61 6e 63 if {"Canc
12b30 65 6c 65 64 22 20 69 6e 20 5b 73 70 6c 69 74 20 eled" in [split
12b40 5b 24 65 20 49 6e 74 65 72 72 75 70 74 54 79 70 [$e InterruptTyp
12b50 65 5d 20 22 2c 20 22 5d 7d 20 74 68 65 6e 20 7b e] ", "]} then {
12b60 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d .. #.
12b70 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e . # N
12b80 4f 54 45 3a 20 49 74 65 72 61 74 65 20 74 68 72 OTE: Iterate thr
12b90 6f 75 67 68 20 61 6c 6c 20 64 61 74 61 62 61 73 ough all databas
12ba0 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 20 6b 6e e connections kn
12bb0 6f 77 6e 20 74 6f 20 74 68 65 0d 0a 20 20 20 20 own to the..
12bc0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
12bd0 70 61 72 65 6e 74 20 69 6e 74 65 72 70 72 65 74 parent interpret
12be0 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 er...
12bf0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
12c00 6f 62 6a 65 63 74 20 66 6f 72 65 61 63 68 20 2d object foreach -
12c10 61 6c 69 61 73 20 70 61 69 72 20 5c 0d 0a 20 20 alias pair \..
12c20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 6f [o
12c30 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c bject invoke -fl
12c40 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 24 ags +NonPublic $
12c50 65 20 49 6e 74 65 72 70 72 65 74 65 72 2e 63 6f e Interpreter.co
12c60 6e 6e 65 63 74 69 6f 6e 73 5d 20 7b 0d 0a 20 20 nnections] {..
12c70 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
12c80 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e # N
12c90 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 OTE: Attempt to
12ca0 63 61 6e 63 65 6c 20 61 6e 79 20 53 51 4c 20 71 cancel any SQL q
12cb0 75 65 72 69 65 73 20 69 6e 20 70 72 6f 67 72 65 ueries in progre
12cc0 73 73 20 6f 6e 20 74 68 69 73 0d 0a 20 20 20 20 ss on this..
12cd0 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
12ce0 20 20 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 database conne
12cf0 63 74 69 6f 6e 2e 0d 0a 20 20 20 20 20 20 20 20 ction...
12d00 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
12d10 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
12d20 68 20 7b 24 70 61 69 72 20 56 61 6c 75 65 2e 43 h {$pair Value.C
12d30 61 6e 63 65 6c 7d 20 65 72 72 6f 72 5d 7d 20 74 ancel} error]} t
12d40 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
12d50 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
12d60 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
12d70 70 65 6e 64 41 72 67 73 20 5c 6e 20 5c 0d 0a 20 pendArgs \n \..
12d80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
12d90 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 "==== WARNING
12da0 3a 20 66 61 69 6c 65 64 20 74 6f 20 63 61 6e 63 : failed to canc
12db0 65 6c 20 71 75 65 72 79 20 66 6f 72 20 63 6f 6e el query for con
12dc0 6e 65 63 74 69 6f 6e 20 5c 22 22 20 5c 0d 0a 20 nection \"" \..
12dd0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
12de0 20 20 20 5b 24 70 61 69 72 20 4b 65 79 5d 20 22 [$pair Key] "
12df0 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c \", error: " \n\
12e00 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 t $error \n]..
12e10 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
12e20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
12e30 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
12e40 20 20 20 7d 7d 0d 0a 20 20 20 20 20 20 7d 20 65 }}.. } e
12e50 72 72 6f 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e rror] == 0} then
12e60 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 {.. addC
12e70 6f 6e 73 74 72 61 69 6e 74 20 69 6e 74 65 72 72 onstraint interr
12e80 75 70 74 43 61 6c 6c 62 61 63 6b 2e 73 71 6c 69 uptCallback.sqli
12e90 74 65 33 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 te3.... t
12ea0 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 79 65 puts $channel ye
12eb0 73 5c 6e 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 s\n.. } els
12ec0 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 e {.. tpu
12ed0 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
12ee0 65 6e 64 41 72 67 73 20 22 6e 6f 2c 20 65 72 72 endArgs "no, err
12ef0 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f or: " \n\t $erro
12f00 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a r \n].. }..
12f10 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
12f20 6f 63 20 63 6c 65 61 6e 75 70 46 69 6c 65 20 7b oc cleanupFile {
12f30 20 66 69 6c 65 4e 61 6d 65 20 7b 63 6f 6c 6c 65 fileName {colle
12f40 63 74 20 74 72 75 65 7d 20 7b 66 6f 72 63 65 20 ct true} {force
12f50 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 false} } {..
12f60 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
12f70 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 66 6f E: Attempt to fo
12f80 72 63 65 20 61 6c 6c 20 70 65 6e 64 69 6e 67 20 rce all pending
12f90 22 67 61 72 62 61 67 65 22 20 6f 62 6a 65 63 74 "garbage" object
12fa0 73 20 74 6f 20 62 65 20 63 6f 6c 6c 65 63 74 65 s to be collecte
12fb0 64 2c 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 d,.. #
12fc0 20 20 69 6e 63 6c 75 64 69 6e 67 20 53 51 4c 69 including SQLi
12fd0 74 65 20 73 74 61 74 65 6d 65 6e 74 73 20 61 6e te statements an
12fe0 64 20 62 61 63 6b 75 70 20 6f 62 6a 65 63 74 73 d backup objects
12ff0 3b 20 74 68 69 73 20 73 68 6f 75 6c 64 20 61 6c ; this should al
13000 6c 6f 77 0d 0a 20 20 20 20 20 20 23 20 20 20 20 low.. #
13010 20 20 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e the underlyin
13020 67 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 g database file
13030 74 6f 20 62 65 20 64 65 6c 65 74 65 64 2e 0d 0a to be deleted...
13040 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
13050 66 20 7b 24 63 6f 6c 6c 65 63 74 7d 20 74 68 65 f {$collect} the
13060 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 63 6f 6c n {.. col
13070 6c 65 63 74 47 61 72 62 61 67 65 20 24 3a 3a 74 lectGarbage $::t
13080 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 20 20 20 est_channel..
13090 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
130a0 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 . # NOTE: C
130b0 68 65 63 6b 20 69 66 20 74 68 65 20 66 69 6c 65 heck if the file
130c0 20 73 74 69 6c 6c 20 65 78 69 73 74 73 2e 0d 0a still exists...
130d0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
130e0 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 f {[file exists
130f0 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e $fileName]} then
13100 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
13110 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 # NOTE: S
13120 6b 69 70 20 64 65 6c 65 74 69 6e 67 20 74 65 73 kip deleting tes
13130 74 20 66 69 6c 65 73 20 69 66 20 73 6f 6d 65 62 t files if someb
13140 6f 64 79 20 73 65 74 73 20 74 68 65 20 67 6c 6f ody sets the glo
13150 62 61 6c 20 76 61 72 69 61 62 6c 65 0d 0a 20 20 bal variable..
13160 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 6f # to
13170 20 70 72 65 76 65 6e 74 20 69 74 2e 0d 0a 20 20 prevent it...
13180 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
13190 20 69 66 20 7b 24 66 6f 72 63 65 20 7c 7c 20 21 if {$force || !
131a0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
131b0 6f 28 63 6c 65 61 6e 75 70 46 69 6c 65 29 5d 7d o(cleanupFile)]}
131c0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
131d0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
131e0 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
131f0 74 6f 20 64 65 6c 65 74 65 20 74 68 65 20 74 65 to delete the te
13200 73 74 20 66 69 6c 65 20 6e 6f 77 2e 0d 0a 20 20 st file now...
13210 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
13220 20 20 20 20 20 69 66 20 7b 5b 73 65 74 20 63 6f if {[set co
13230 64 65 20 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 de [catch {file
13240 64 65 6c 65 74 65 20 24 66 69 6c 65 4e 61 6d 65 delete $fileName
13250 7d 20 65 72 72 6f 72 5d 5d 7d 20 74 68 65 6e 20 } error]]} then
13260 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 {.. #
13270 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 .. #
13280 4e 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 NOTE: We somehow
13290 20 66 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 failed to delet
132a0 65 20 74 68 65 20 66 69 6c 65 2c 20 72 65 70 6f e the file, repo
132b0 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 rt why...
132c0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
132d0 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
132e0 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
132f0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
13300 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 "==== W
13310 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 ARNING: failed t
13320 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20 66 69 o delete test fi
13330 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 le \"" $fileName
13340 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
13350 20 20 20 20 22 5c 22 20 64 75 72 69 6e 67 20 63 "\" during c
13360 6c 65 61 6e 75 70 2c 20 65 72 72 6f 72 3a 20 22 leanup, error: "
13370 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d \n\t $error \n]
13380 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
13390 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
133a0 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
133b0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
133c0 53 68 6f 77 20 74 68 61 74 20 77 65 20 73 6b 69 Show that we ski
133d0 70 70 65 64 20 64 65 6c 65 74 69 6e 67 20 74 68 pped deleting th
133e0 65 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 20 e file...
133f0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
13400 73 65 74 20 63 6f 64 65 20 30 0d 0a 0d 0a 20 20 set code 0....
13410 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
13420 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
13430 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
13440 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d "====
13450 20 57 41 52 4e 49 4e 47 3a 20 73 6b 69 70 70 65 WARNING: skippe
13460 64 20 64 65 6c 65 74 69 6e 67 20 74 65 73 74 20 d deleting test
13470 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 file \"" $fileNa
13480 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 me \..
13490 20 20 20 20 22 5c 22 20 64 75 72 69 6e 67 20 63 "\" during c
134a0 6c 65 61 6e 75 70 5c 6e 22 5d 0d 0a 20 20 20 20 leanup\n"]..
134b0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 }.. } e
134c0 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 lse {.. #
134d0 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
134e0 3a 20 54 68 65 20 66 69 6c 65 20 64 6f 65 73 20 : The file does
134f0 6e 6f 74 20 65 78 69 73 74 2c 20 73 75 63 63 65 not exist, succe
13500 73 73 21 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ss!.. #..
13510 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 64 65 set code
13520 20 30 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 0.. }....
13530 20 20 20 20 20 72 65 74 75 72 6e 20 24 63 6f 64 return $cod
13540 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 e.. }.....
13550 20 70 72 6f 63 20 63 6f 6c 6c 65 63 74 47 61 72 proc collectGar
13560 62 61 67 65 20 7b 20 63 68 61 6e 6e 65 6c 20 7b bage { channel {
13570 6d 69 6c 6c 69 73 65 63 6f 6e 64 73 20 31 30 30 milliseconds 100
13580 30 7d 20 7b 71 75 69 65 74 20 74 72 75 65 7d 20 0} {quiet true}
13590 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b } {.. if {[
135a0 63 61 74 63 68 20 7b 6f 62 6a 65 63 74 20 69 6e catch {object in
135b0 76 6f 6b 65 20 47 43 20 47 65 74 54 6f 74 61 6c voke GC GetTotal
135c0 4d 65 6d 6f 72 79 20 66 61 6c 73 65 7d 20 72 65 Memory false} re
135d0 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e sult] == 0} then
135e0 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
135f0 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
13600 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
13610 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
13620 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
13630 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6d 65 6d "---- mem
13640 6f 72 79 20 69 6e 20 75 73 65 20 62 79 20 74 68 ory in use by th
13650 65 20 43 4c 52 20 62 65 66 6f 72 65 20 63 6f 6c e CLR before col
13660 6c 65 63 74 69 6f 6e 2e 2e 2e 20 22 20 5c 0d 0a lection... " \..
13670 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 72 $r
13680 65 73 75 6c 74 20 22 20 62 79 74 65 73 5c 6e 22 esult " bytes\n"
13690 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 ].. }..
136a0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
136b0 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
136c0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
136d0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
136e0 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 "==== WARNING: f
136f0 61 69 6c 65 64 20 74 6f 20 67 65 74 20 43 4c 52 ailed to get CLR
13700 20 6d 65 6d 6f 72 79 20 75 73 61 67 65 2c 20 65 memory usage, e
13710 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 rror: " \..
13720 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 72 65 73 \n\t $res
13730 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d ult \n].. }
13740 0d 0a 0d 0a 20 20 20 20 20 20 23 23 23 23 23 23 .... ######
13750 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
13760 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
13770 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
13780 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
13790 23 23 23 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a ###.... #..
137a0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 # NOTE: Re
137b0 70 65 61 74 65 64 6c 79 20 61 74 74 65 6d 70 74 peatedly attempt
137c0 20 74 6f 20 63 6f 6c 6c 65 63 74 20 67 61 72 62 to collect garb
137d0 61 67 65 20 75 6e 74 69 6c 20 74 68 65 20 61 6c age until the al
137e0 6c 6f 74 74 65 64 20 6e 75 6d 62 65 72 0d 0a 20 lotted number..
137f0 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 66 20 # of
13800 6d 69 6c 6c 69 73 65 63 6f 6e 64 73 20 68 61 73 milliseconds has
13810 20 65 6c 61 70 73 65 64 2e 20 20 41 6c 77 61 79 elapsed. Alway
13820 73 20 61 74 74 65 6d 70 74 20 74 6f 20 63 6f 6c s attempt to col
13830 6c 65 63 74 20 67 61 72 62 61 67 65 0d 0a 20 20 lect garbage..
13840 20 20 20 20 23 20 20 20 20 20 20 20 61 74 20 6c # at l
13850 65 61 73 74 20 6f 6e 63 65 2e 0d 0a 20 20 20 20 east once...
13860 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 73 #.. set s
13870 74 61 72 74 20 5b 63 6c 6f 63 6b 20 73 65 63 6f tart [clock seco
13880 6e 64 73 5d 0d 0a 20 20 20 20 20 20 73 65 74 20 nds].. set
13890 73 74 6f 70 20 5b 65 78 70 72 20 7b 24 73 74 61 stop [expr {$sta
138a0 72 74 20 2b 20 28 24 6d 69 6c 6c 69 73 65 63 6f rt + ($milliseco
138b0 6e 64 73 20 2f 20 31 30 30 30 29 7d 5d 0d 0a 0d nds / 1000)}]...
138c0 0a 20 20 20 20 20 20 64 6f 20 7b 0d 0a 20 20 20 . do {..
138d0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
138e0 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
138f0 74 6f 20 66 6f 72 63 65 20 61 20 66 75 6c 6c 20 to force a full
13900 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 garbage collecti
13910 6f 6e 20 6e 6f 77 2e 20 20 52 65 70 6f 72 74 20 on now. Report
13920 61 6e 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 any.. #
13930 20 20 20 20 20 65 72 72 6f 72 20 74 68 61 74 20 error that
13940 69 73 20 65 6e 63 6f 75 6e 74 65 72 65 64 20 69 is encountered i
13950 66 20 77 65 20 66 61 69 6c 2e 0d 0a 20 20 20 20 f we fail...
13960 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 #.. i
13970 66 20 7b 5b 63 61 74 63 68 20 7b 6f 62 6a 65 63 f {[catch {objec
13980 74 20 69 6e 76 6f 6b 65 20 47 43 20 47 65 74 54 t invoke GC GetT
13990 6f 74 61 6c 4d 65 6d 6f 72 79 20 74 72 75 65 7d otalMemory true}
139a0 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d error]} then {.
139b0 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
139c0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
139d0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
139e0 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 "==== WAR
139f0 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 66 75 6c NING: failed ful
13a00 6c 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 l garbage collec
13a10 74 69 6f 6e 2c 20 65 72 72 6f 72 3a 20 22 20 5c tion, error: " \
13a20 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
13a30 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d \n\t $error \n].
13a40 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
13a50 20 20 20 20 20 20 73 65 74 20 6e 6f 77 20 5b 63 set now [c
13a60 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d 0d 0a 20 lock seconds]..
13a70 20 20 20 20 20 7d 20 77 68 69 6c 65 20 7b 24 73 } while {$s
13a80 74 61 72 74 20 3c 3d 20 24 6e 6f 77 20 26 26 20 tart <= $now &&
13a90 24 6e 6f 77 20 3c 20 24 73 74 6f 70 7d 0d 0a 0d $now < $stop}...
13aa0 0a 20 20 20 20 20 20 23 23 23 23 23 23 23 23 23 . #########
13ab0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
13ac0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
13ad0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
13ae0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
13af0 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 .... if {[c
13b00 61 74 63 68 20 7b 6f 62 6a 65 63 74 20 69 6e 76 atch {object inv
13b10 6f 6b 65 20 47 43 20 47 65 74 54 6f 74 61 6c 4d oke GC GetTotalM
13b20 65 6d 6f 72 79 20 66 61 6c 73 65 7d 20 72 65 73 emory false} res
13b30 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ult] == 0} then
13b40 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 {.. if {!
13b50 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
13b60 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
13b70 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
13b80 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
13b90 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6d 65 6d 6f "---- memo
13ba0 72 79 20 69 6e 20 75 73 65 20 62 79 20 74 68 65 ry in use by the
13bb0 20 43 4c 52 20 61 66 74 65 72 20 63 6f 6c 6c 65 CLR after colle
13bc0 63 74 69 6f 6e 2e 2e 2e 20 22 20 5c 0d 0a 20 20 ction... " \..
13bd0 20 20 20 20 20 20 20 20 20 20 20 20 24 72 65 73 $res
13be0 75 6c 74 20 22 20 62 79 74 65 73 5c 6e 22 5d 0d ult " bytes\n"].
13bf0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
13c00 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
13c10 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
13c20 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
13c30 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 3d .. "=
13c40 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 === WARNING: fai
13c50 6c 65 64 20 74 6f 20 67 65 74 20 43 4c 52 20 6d led to get CLR m
13c60 65 6d 6f 72 79 20 75 73 61 67 65 2c 20 65 72 72 emory usage, err
13c70 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 or: " \..
13c80 20 20 20 20 20 5c 6e 5c 74 20 24 72 65 73 75 6c \n\t $resul
13c90 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a t \n].. }..
13ca0 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
13cb0 6f 63 20 67 65 74 53 51 4c 69 74 65 48 61 6e 64 oc getSQLiteHand
13cc0 6c 65 43 6f 75 6e 74 73 20 7b 20 63 68 61 6e 6e leCounts { chann
13cd0 65 6c 20 7b 71 75 69 65 74 20 66 61 6c 73 65 7d el {quiet false}
13ce0 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 } {.. set
13cf0 72 65 73 75 6c 74 20 5b 6c 69 73 74 5d 0d 0a 0d result [list]...
13d00 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 . if {[have
13d10 43 6f 6e 73 74 72 61 69 6e 74 20 5c 0d 0a 20 20 Constraint \..
13d20 20 20 20 20 20 20 20 20 20 20 20 20 64 65 66 69 defi
13d30 6e 65 43 6f 6e 73 74 61 6e 74 2e 53 79 73 74 65 neConstant.Syste
13d40 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 43 4f m.Data.SQLite.CO
13d50 55 4e 54 5f 48 41 4e 44 4c 45 5d 7d 20 74 68 65 UNT_HANDLE]} the
13d60 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
13d70 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
13d80 41 64 64 20 65 61 63 68 20 63 72 69 74 69 63 61 Add each critica
13d90 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 20 74 l handle count t
13da0 6f 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 o the resulting
13db0 6c 69 73 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 list... #
13dc0 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 .. foreac
13dd0 68 20 6e 61 6d 65 20 5b 6c 69 73 74 20 63 6f 6e h name [list con
13de0 6e 65 63 74 69 6f 6e 43 6f 75 6e 74 20 73 74 61 nectionCount sta
13df0 74 65 6d 65 6e 74 43 6f 75 6e 74 20 62 61 63 6b tementCount back
13e00 75 70 43 6f 75 6e 74 5d 20 7b 0d 0a 20 20 20 20 upCount] {..
13e10 20 20 20 20 20 20 73 65 74 20 76 61 6c 75 65 20 set value
13e20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d [object invoke -
13e30 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
13e40 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
13e50 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
13e60 4c 69 74 65 2e 55 6e 73 61 66 65 4e 61 74 69 76 Lite.UnsafeNativ
13e70 65 4d 65 74 68 6f 64 73 20 24 6e 61 6d 65 5d 0d eMethods $name].
13e80 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 ... if
13e90 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
13ea0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
13eb0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
13ec0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
13ed0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
13ee0 2d 20 63 72 69 74 69 63 61 6c 20 68 61 6e 64 6c - critical handl
13ef0 65 20 63 6f 75 6e 74 20 5c 22 22 20 24 6e 61 6d e count \"" $nam
13f00 65 20 22 5c 22 20 69 73 20 22 20 24 76 61 6c 75 e "\" is " $valu
13f10 65 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 e \n]..
13f20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
13f30 6c 61 70 70 65 6e 64 20 72 65 73 75 6c 74 20 24 lappend result $
13f40 76 61 6c 75 65 0d 0a 20 20 20 20 20 20 20 20 7d value.. }
13f50 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 .. } elseif
13f60 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
13f70 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
13f80 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 # NOTE: Th
13f90 65 20 61 63 74 75 61 6c 20 68 61 6e 64 6c 65 20 e actual handle
13fa0 63 6f 75 6e 74 73 20 61 72 65 20 6e 6f 74 20 61 counts are not a
13fb0 76 61 69 6c 61 62 6c 65 3b 20 74 68 65 72 65 66 vailable; theref
13fc0 6f 72 65 2c 20 6a 75 73 74 0d 0a 20 20 20 20 20 ore, just..
13fd0 20 20 20 23 20 20 20 20 20 20 20 72 65 74 75 72 # retur
13fe0 6e 20 61 6e 20 65 6d 70 74 79 20 6c 69 73 74 2e n an empty list.
13ff0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
14000 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
14010 6e 65 6c 20 22 2d 2d 2d 2d 20 63 72 69 74 69 63 nel "---- critic
14020 61 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 73 al handle counts
14030 20 75 6e 61 76 61 69 6c 61 62 6c 65 5c 6e 22 0d unavailable\n".
14040 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
14050 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 6c 74 return $result
14060 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
14070 70 72 6f 63 20 73 68 75 74 64 6f 77 6e 53 51 4c proc shutdownSQL
14080 69 74 65 20 7b 20 63 68 61 6e 6e 65 6c 20 7b 66 ite { channel {f
14090 6f 72 63 65 20 66 61 6c 73 65 7d 20 7b 71 75 69 orce false} {qui
140a0 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 et false} } {..
140b0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
140c0 4e 4f 54 45 3a 20 4d 61 6b 65 20 73 75 72 65 20 NOTE: Make sure
140d0 74 68 61 74 20 53 51 4c 69 74 65 20 63 6f 72 65 that SQLite core
140e0 20 6c 69 62 72 61 72 79 20 69 73 20 63 6f 6d 70 library is comp
140f0 6c 65 74 65 6c 79 20 73 68 75 74 64 6f 77 6e 2e letely shutdown.
14100 20 20 54 68 69 73 0d 0a 20 20 20 20 20 20 23 20 This.. #
14110 20 20 20 20 20 20 69 73 20 75 73 65 64 20 62 79 is used by
14120 20 74 65 73 74 73 20 74 68 61 74 20 63 68 61 6e tests that chan
14130 67 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e ge configuration
14140 20 6f 70 74 69 6f 6e 73 20 61 6e 64 2f 6f 72 20 options and/or
14150 74 68 6f 73 65 0d 0a 20 20 20 20 20 20 23 20 20 those.. #
14160 20 20 20 20 20 74 68 61 74 20 6e 65 65 64 20 74 that need t
14170 6f 20 6d 61 6b 65 20 73 75 72 65 20 6c 6f 67 67 o make sure logg
14180 69 6e 67 20 69 73 20 69 6e 69 74 69 61 6c 69 7a ing is initializ
14190 65 64 20 28 69 2e 65 2e 20 6a 75 73 74 20 69 6e ed (i.e. just in
141a0 20 63 61 73 65 0d 0a 20 20 20 20 20 20 23 20 20 case.. #
141b0 20 20 20 20 20 74 68 65 20 53 51 4c 69 74 65 20 the SQLite
141c0 63 6f 72 65 20 6c 69 62 72 61 72 79 20 77 61 73 core library was
141d0 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 69 6e 20 initialized in
141e0 74 68 65 20 70 72 6f 63 65 73 73 20 70 72 69 6f the process prio
141f0 72 20 74 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 r to.. #
14200 20 20 20 20 74 68 65 20 53 51 4c 69 74 65 4c 6f the SQLiteLo
14210 67 20 63 6c 61 73 73 20 62 65 69 6e 67 20 61 62 g class being ab
14220 6c 65 20 74 6f 20 73 65 74 75 70 20 69 74 73 20 le to setup its
14230 6c 6f 67 67 69 6e 67 20 63 61 6c 6c 62 61 63 6b logging callback
14240 29 2e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 )... #
14250 20 20 4e 6f 72 6d 61 6c 6c 79 2c 20 74 68 69 73 Normally, this
14260 20 73 68 6f 75 6c 64 20 6f 6e 6c 79 20 62 65 20 should only be
14270 70 65 72 66 6f 72 6d 65 64 20 69 66 20 53 51 4c performed if SQL
14280 69 74 65 20 69 73 20 6c 6f 61 64 65 64 20 61 6e ite is loaded an
14290 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 d.. #
142a0 20 72 65 61 64 79 20 66 6f 72 20 75 73 65 20 62 ready for use b
142b0 79 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 y the test suite
142c0 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
142d0 20 20 69 66 20 7b 24 66 6f 72 63 65 20 7c 7c 20 if {$force ||
142e0 5b 69 73 53 51 4c 69 74 65 52 65 61 64 79 5d 7d [isSQLiteReady]}
142f0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
14300 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 42 55 #.. # BU
14310 47 46 49 58 3a 20 4d 61 6b 65 20 73 75 72 65 20 GFIX: Make sure
14320 74 68 61 74 20 61 6e 79 20 22 6c 65 61 6b 65 64 that any "leaked
14330 22 20 74 72 61 6e 73 61 63 74 69 6f 6e 73 20 61 " transactions a
14340 6e 64 2f 6f 72 20 63 6f 6e 6e 65 63 74 69 6f 6e nd/or connection
14350 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 s.. #
14360 20 20 20 20 20 61 72 65 20 63 6c 65 61 6e 65 64 are cleaned
14370 20 75 70 20 62 65 66 6f 72 65 20 63 61 6c 6c 69 up before calli
14380 6e 67 20 74 68 65 20 6e 61 74 69 76 65 20 73 68 ng the native sh
14390 75 74 64 6f 77 6e 20 66 75 6e 63 74 69 6f 6e 2e utdown function.
143a0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
143b0 20 20 20 20 20 66 6f 72 65 61 63 68 20 74 72 61 foreach tra
143c0 6e 73 61 63 74 69 6f 6e 20 5b 69 6e 66 6f 20 74 nsaction [info t
143d0 72 61 6e 73 61 63 74 69 6f 6e 73 5d 20 7b 0d 0a ransactions] {..
143e0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 if {[s
143f0 74 72 69 6e 67 20 6d 61 74 63 68 20 5c 0d 0a 20 tring match \..
14400 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 Sys
14410 74 65 6d 23 44 61 74 61 23 53 51 4c 69 74 65 23 tem#Data#SQLite#
14420 53 51 4c 69 74 65 54 72 61 6e 73 61 63 74 69 6f SQLiteTransactio
14430 6e 23 2a 20 24 74 72 61 6e 73 61 63 74 69 6f 6e n#* $transaction
14440 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
14450 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
14460 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 h {..
14470 20 20 20 73 71 6c 20 74 72 61 6e 73 61 63 74 69 sql transacti
14480 6f 6e 20 72 6f 6c 6c 62 61 63 6b 20 24 74 72 61 on rollback $tra
14490 6e 73 61 63 74 69 6f 6e 0d 0a 20 20 20 20 20 20 nsaction..
144a0 20 20 20 20 20 20 7d 20 65 72 72 6f 72 5d 20 3d } error] =
144b0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
144c0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
144d0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
144e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
144f0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
14500 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
14510 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
14520 20 20 22 2d 2d 2d 2d 20 72 6f 6c 6c 65 64 20 62 "---- rolled b
14530 61 63 6b 20 6c 65 61 6b 65 64 20 74 72 61 6e 73 ack leaked trans
14540 61 63 74 69 6f 6e 20 5c 22 22 20 5c 0d 0a 20 20 action \"" \..
14550 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
14560 20 20 24 74 72 61 6e 73 61 63 74 69 6f 6e 20 5c $transaction \
14570 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 "\n]..
14580 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
14590 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
145a0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
145b0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
145c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
145d0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
145e0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
145f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
14600 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a "==== WARNING:
14610 20 66 61 69 6c 65 64 20 74 6f 20 72 6f 6c 6c 62 failed to rollb
14620 61 63 6b 20 6c 65 61 6b 65 64 20 74 72 61 6e 73 ack leaked trans
14630 61 63 74 69 6f 6e 20 5c 22 22 20 5c 0d 0a 20 20 action \"" \..
14640 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
14650 20 20 24 74 72 61 6e 73 61 63 74 69 6f 6e 20 22 $transaction "
14660 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c \", error: " \n\
14670 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 t $error \n]..
14680 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
14690 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
146a0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
146b0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
146c0 66 6f 72 65 61 63 68 20 64 62 20 5b 69 6e 66 6f foreach db [info
146d0 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 5d 20 7b 0d connections] {.
146e0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
146f0 73 74 72 69 6e 67 20 6d 61 74 63 68 20 5c 0d 0a string match \..
14700 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 Sy
14710 73 74 65 6d 23 44 61 74 61 23 53 51 4c 69 74 65 stem#Data#SQLite
14720 23 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f #SQLiteConnectio
14730 6e 23 2a 20 24 64 62 5d 7d 20 74 68 65 6e 20 7b n#* $db]} then {
14740 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
14750 20 7b 5b 63 61 74 63 68 20 7b 73 71 6c 20 63 6c {[catch {sql cl
14760 6f 73 65 20 24 64 62 7d 20 65 72 72 6f 72 5d 20 ose $db} error]
14770 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
14780 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
14790 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
147a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
147b0 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
147c0 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
147d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
147e0 20 20 20 22 2d 2d 2d 2d 20 63 6c 6f 73 65 64 20 "---- closed
147f0 6c 65 61 6b 65 64 20 64 61 74 61 62 61 73 65 20 leaked database
14800 5c 22 22 20 24 64 62 20 5c 22 5c 6e 5d 0d 0a 20 \"" $db \"\n]..
14810 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
14820 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c } el
14830 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
14840 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
14850 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
14860 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
14870 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
14880 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
14890 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d "====
148a0 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 WARNING: failed
148b0 20 74 6f 20 63 6c 6f 73 65 20 6c 65 61 6b 65 64 to close leaked
148c0 20 64 61 74 61 62 61 73 65 20 5c 22 22 20 5c 0d database \"" \.
148d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
148e0 20 20 20 20 20 24 64 62 20 22 5c 22 2c 20 65 72 $db "\", er
148f0 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 ror: " \n\t $err
14900 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 or \n]..
14910 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
14920 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
14930 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
14940 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
14950 20 20 20 20 20 23 20 42 55 47 46 49 58 3a 20 42 # BUGFIX: B
14960 65 66 6f 72 65 20 63 61 6c 6c 69 6e 67 20 74 68 efore calling th
14970 65 20 6e 61 74 69 76 65 20 73 68 75 74 64 6f 77 e native shutdow
14980 6e 20 66 75 6e 63 74 69 6f 6e 2c 20 6d 61 6b 65 n function, make
14990 20 73 75 72 65 20 62 6f 74 68 0d 0a 20 20 20 20 sure both..
149a0 20 20 20 20 23 20 20 20 20 20 20 20 20 20 6f 66 # of
149b0 20 74 68 65 20 50 52 41 47 4d 41 20 72 65 6c 61 the PRAGMA rela
149c0 74 65 64 20 64 69 72 65 63 74 6f 72 79 20 6e 61 ted directory na
149d0 6d 65 73 20 61 72 65 20 66 72 65 65 64 2e 0d 0a mes are freed...
149e0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
149f0 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 checkForSQLit
14a00 65 44 69 72 65 63 74 6f 72 69 65 73 20 24 63 68 eDirectories $ch
14a10 61 6e 6e 65 6c 20 74 72 75 65 0d 0a 0d 0a 20 20 annel true....
14a20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
14a30 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 {.. ob
14a40 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 ject invoke -fla
14a50 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d gs +NonPublic \.
14a60 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 . S
14a70 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
14a80 65 2e 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 e.UnsafeNativeMe
14a90 74 68 6f 64 73 20 73 71 6c 69 74 65 33 5f 73 68 thods sqlite3_sh
14aa0 75 74 64 6f 77 6e 0d 0a 20 20 20 20 20 20 20 20 utdown..
14ab0 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 } result] == 0}
14ac0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
14ad0 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
14ae0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
14af0 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
14b00 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
14b10 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
14b20 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 "---- call sqli
14b30 74 65 33 5f 73 68 75 74 64 6f 77 6e 28 29 2e 2e te3_shutdown()..
14b40 2e 20 6f 6b 3a 20 22 20 24 72 65 73 75 6c 74 20 . ok: " $result
14b50 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
14b60 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
14b70 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 {.. if
14b80 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
14b90 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
14ba0 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
14bb0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
14bc0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
14bd0 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 5f -- call sqlite3_
14be0 73 68 75 74 64 6f 77 6e 28 29 2e 2e 2e 20 65 72 shutdown()... er
14bf0 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 72 65 73 ror: " \n\t $res
14c00 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ult \n]..
14c10 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
14c20 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d . }.. }.
14c30 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 65 70 .... proc rep
14c40 6f 72 74 53 51 4c 69 74 65 52 65 73 6f 75 72 63 ortSQLiteResourc
14c50 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
14c60 20 20 63 68 61 6e 6e 65 6c 20 7b 71 75 69 65 74 channel {quiet
14c70 20 66 61 6c 73 65 7d 20 7b 72 65 73 65 74 20 74 false} {reset t
14c80 72 75 65 7d 20 7b 63 6f 6c 6c 65 63 74 20 74 72 rue} {collect tr
14c90 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ue} } {.. #
14ca0 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
14cb0 49 66 20 61 76 61 69 6c 61 62 6c 65 2c 20 72 65 If available, re
14cc0 70 6f 72 74 20 6f 6e 20 28 61 6e 64 20 70 6f 73 port on (and pos
14cd0 73 69 62 6c 79 20 72 65 73 65 74 29 20 74 68 65 sibly reset) the
14ce0 20 72 75 6e 74 69 6d 65 0d 0a 20 20 20 20 20 20 runtime..
14cf0 23 20 20 20 20 20 20 20 63 6f 6e 66 69 67 75 72 # configur
14d00 61 74 69 6f 6e 20 73 74 61 74 69 73 74 69 63 73 ation statistics
14d10 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
14d20 20 20 69 66 20 7b 5b 68 61 76 65 43 6f 6e 73 74 if {[haveConst
14d30 72 61 69 6e 74 20 62 75 69 6c 64 43 6f 6e 66 69 raint buildConfi
14d40 67 75 72 61 74 69 6f 6e 2e 44 65 62 75 67 5d 20 guration.Debug]
14d50 26 26 20 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 && [catch {..
14d60 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
14d70 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
14d80 62 6c 69 63 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 blic -alias \..
14d90 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 Syste
14da0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e m.Data.SQLite.Un
14db0 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 safeNativeMethod
14dc0 73 20 73 65 74 74 69 6e 67 52 65 61 64 43 6f 75 s settingReadCou
14dd0 6e 74 73 0d 0a 20 20 20 20 20 20 7d 20 73 65 74 nts.. } set
14de0 74 69 6e 67 52 65 61 64 43 6f 75 6e 74 73 5d 20 tingReadCounts]
14df0 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
14e00 20 20 20 20 20 20 73 65 74 20 6e 61 6d 65 43 6f set nameCo
14e10 75 6e 74 20 5b 24 73 65 74 74 69 6e 67 52 65 61 unt [$settingRea
14e20 64 43 6f 75 6e 74 73 20 43 6f 75 6e 74 5d 0d 0a dCounts Count]..
14e30 20 20 20 20 20 20 20 20 73 65 74 20 76 61 6c 75 set valu
14e40 65 43 6f 75 6e 74 20 30 0d 0a 0d 0a 20 20 20 20 eCount 0....
14e50 20 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 61 object forea
14e60 63 68 20 2d 61 6c 69 61 73 20 70 61 69 72 20 24 ch -alias pair $
14e70 73 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e 74 settingReadCount
14e80 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 s {.. i
14e90 6e 63 72 20 76 61 6c 75 65 43 6f 75 6e 74 20 5b ncr valueCount [
14ea0 24 70 61 69 72 20 56 61 6c 75 65 5d 0d 0a 0d 0a $pair Value]....
14eb0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
14ec0 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
14ed0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
14ee0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
14ef0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
14f00 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
14f10 65 74 74 69 6e 67 20 5c 22 22 20 5b 24 70 61 69 etting \"" [$pai
14f20 72 20 4b 65 79 5d 20 22 5c 22 20 77 61 73 20 72 r Key] "\" was r
14f30 65 61 64 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 ead " \..
14f40 20 20 20 20 20 20 20 20 20 5b 24 70 61 69 72 20 [$pair
14f50 56 61 6c 75 65 5d 20 22 20 74 69 6d 65 73 5c 6e Value] " times\n
14f60 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d "].. }.
14f70 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
14f80 20 20 20 20 20 20 69 66 20 7b 24 72 65 73 65 74 if {$reset
14f90 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
14fa0 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
14fb0 24 73 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e $settingReadCoun
14fc0 74 73 20 43 6c 65 61 72 7d 20 65 72 72 6f 72 5d ts Clear} error]
14fd0 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
14fe0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
14ff0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
15000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
15010 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
15020 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
15030 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
15040 2d 2d 2d 20 72 65 73 65 74 20 73 65 74 74 69 6e --- reset settin
15050 67 20 73 74 61 74 69 73 74 69 63 73 20 66 6f 72 g statistics for
15060 20 74 68 65 20 70 72 65 76 69 6f 75 73 20 22 20 the previous "
15070 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
15080 20 20 20 20 20 24 6e 61 6d 65 43 6f 75 6e 74 20 $nameCount
15090 22 20 6e 61 6d 65 73 20 61 6e 64 20 22 20 24 76 " names and " $v
150a0 61 6c 75 65 43 6f 75 6e 74 20 22 20 76 61 6c 75 alueCount " valu
150b0 65 73 20 72 65 61 64 5c 6e 22 5d 0d 0a 20 20 20 es read\n"]..
150c0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
150d0 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
150e0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
150f0 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
15100 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
15110 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
15120 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
15130 74 6f 20 72 65 73 65 74 20 73 65 74 74 69 6e 67 to reset setting
15140 20 73 74 61 74 69 73 74 69 63 73 20 66 6f 72 20 statistics for
15150 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
15160 20 20 20 20 20 22 74 68 65 20 70 72 65 76 69 6f "the previo
15170 75 73 20 22 20 24 6e 61 6d 65 43 6f 75 6e 74 20 us " $nameCount
15180 22 20 6e 61 6d 65 73 20 61 6e 64 20 22 20 24 76 " names and " $v
15190 61 6c 75 65 43 6f 75 6e 74 20 5c 0d 0a 20 20 20 alueCount \..
151a0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 20 76 " v
151b0 61 6c 75 65 73 20 72 65 61 64 2c 20 65 72 72 6f alues read, erro
151c0 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 r: " \n\t $error
151d0 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
151e0 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
151f0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 }.... i
15200 66 20 7b 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 f {[haveConstrai
15210 6e 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 nt \..
15220 20 20 20 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 defineConsta
15230 6e 74 2e 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 nt.System.Data.S
15240 51 4c 69 74 65 2e 49 4e 54 45 52 4f 50 5f 56 49 QLite.INTEROP_VI
15250 52 54 55 41 4c 5f 54 41 42 4c 45 5d 20 26 26 20 RTUAL_TABLE] &&
15260 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 68 61 \.. [ha
15270 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5c 0d 0a veConstraint \..
15280 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 65 de
15290 66 69 6e 65 43 6f 6e 73 74 61 6e 74 2e 53 79 73 fineConstant.Sys
152a0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
152b0 54 52 41 43 4b 5f 4d 45 4d 4f 52 59 5f 42 59 54 TRACK_MEMORY_BYT
152c0 45 53 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ES]} then {..
152d0 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
152e0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
152f0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
15300 65 6c 20 22 2d 2d 2d 2d 20 63 75 72 72 65 6e 74 el "---- current
15310 20 6d 65 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 memory in use b
15320 79 20 53 51 4c 69 74 65 4d 65 6d 6f 72 79 2e 2e y SQLiteMemory..
15330 2e 20 22 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a . ".. }..
15340 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 .. if {[c
15350 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
15360 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
15370 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
15380 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
15390 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 System.Data.S
153a0 51 4c 69 74 65 2e 53 51 4c 69 74 65 4d 65 6d 6f QLite.SQLiteMemo
153b0 72 79 20 62 79 74 65 73 41 6c 6c 6f 63 61 74 65 ry bytesAllocate
153c0 64 0d 0a 20 20 20 20 20 20 20 20 7d 20 6d 65 6d d.. } mem
153d0 6f 72 79 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ory] == 0} then
153e0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 {.. if
153f0 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
15400 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
15410 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
15420 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 pendArgs $memory
15430 20 22 20 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 " bytes\n"]..
15440 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
15450 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
15460 20 20 20 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 set memor
15470 79 20 75 6e 6b 6e 6f 77 6e 0d 0a 0d 0a 20 20 20 y unknown....
15480 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
15490 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
154a0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
154b0 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
154c0 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a gs $memory \n]..
154d0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
154e0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
154f0 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
15500 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
15510 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
15520 22 2d 2d 2d 2d 20 6d 61 78 69 6d 75 6d 20 6d 65 "---- maximum me
15530 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 79 20 53 mory in use by S
15540 51 4c 69 74 65 4d 65 6d 6f 72 79 2e 2e 2e 20 22 QLiteMemory... "
15550 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
15560 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
15570 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f h {.. o
15580 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c bject invoke -fl
15590 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c ags +NonPublic \
155a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
155b0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
155c0 74 65 2e 53 51 4c 69 74 65 4d 65 6d 6f 72 79 20 te.SQLiteMemory
155d0 6d 61 78 69 6d 75 6d 42 79 74 65 73 41 6c 6c 6f maximumBytesAllo
155e0 63 61 74 65 64 0d 0a 20 20 20 20 20 20 20 20 7d cated.. }
155f0 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 30 7d 20 74 memory] == 0} t
15600 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
15610 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
15620 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
15630 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
15640 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 [appendArgs $me
15650 6d 6f 72 79 20 22 20 62 79 74 65 73 5c 6e 22 5d mory " bytes\n"]
15660 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
15670 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
15680 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 6d . set m
15690 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e 0d 0a 0d emory unknown...
156a0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 . if {!
156b0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
156c0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
156d0 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
156e0 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c ndArgs $memory \
156f0 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d n].. }.
15700 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
15710 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 }.... if
15720 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
15730 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
15740 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 $channel "---- c
15750 75 72 72 65 6e 74 20 6d 65 6d 6f 72 79 20 69 6e urrent memory in
15760 20 75 73 65 20 62 79 20 53 51 4c 69 74 65 2e 2e use by SQLite..
15770 2e 20 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a . ".. }....
15780 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
15790 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 {.. obje
157a0 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
157b0 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 +NonPublic \..
157c0 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 Syste
157d0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e m.Data.SQLite.Un
157e0 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 safeNativeMethod
157f0 73 20 73 71 6c 69 74 65 33 5f 6d 65 6d 6f 72 79 s sqlite3_memory
15800 5f 75 73 65 64 0d 0a 20 20 20 20 20 20 7d 20 6d _used.. } m
15810 65 6d 6f 72 79 5d 20 3d 3d 20 30 7d 20 74 68 65 emory] == 0} the
15820 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
15830 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
15840 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
15850 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
15860 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 22 ndArgs $memory "
15870 20 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 bytes\n"]..
15880 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 }.. } e
15890 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 lse {.. #
158a0 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
158b0 3a 20 4d 61 79 62 65 20 74 68 65 20 53 51 4c 69 : Maybe the SQLi
158c0 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 20 te core library
158d0 69 73 20 75 6e 61 76 61 69 6c 61 62 6c 65 3f 0d is unavailable?.
158e0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
158f0 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 set memory u
15900 6e 6b 6e 6f 77 6e 0d 0a 0d 0a 20 20 20 20 20 20 nknown....
15910 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
15920 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
15930 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
15940 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 6d [appendArgs $mem
15950 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ory \n]..
15960 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }.. }....
15970 20 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 20 set result
15980 24 6d 65 6d 6f 72 79 3b 20 23 20 4e 4f 54 45 3a $memory; # NOTE:
15990 20 52 65 74 75 72 6e 20 6d 65 6d 6f 72 79 20 69 Return memory i
159a0 6e 2d 75 73 65 20 74 6f 20 6f 75 72 20 63 61 6c n-use to our cal
159b0 6c 65 72 2e 0d 0a 0d 0a 20 20 20 20 20 20 69 66 ler..... if
159c0 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
159d0 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
159e0 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 $channel "----
159f0 6d 61 78 69 6d 75 6d 20 6d 65 6d 6f 72 79 20 69 maximum memory i
15a00 6e 20 75 73 65 20 62 79 20 53 51 4c 69 74 65 2e n use by SQLite.
15a10 2e 2e 20 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d .. ".. }...
15a20 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 . if {[catc
15a30 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a h {.. obj
15a40 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 ect invoke -flag
15a50 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a s +NonPublic \..
15a60 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
15a70 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 em.Data.SQLite.U
15a80 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f nsafeNativeMetho
15a90 64 73 20 73 71 6c 69 74 65 33 5f 6d 65 6d 6f 72 ds sqlite3_memor
15aa0 79 5f 68 69 67 68 77 61 74 65 72 20 30 0d 0a 20 y_highwater 0..
15ab0 20 20 20 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d } memory] =
15ac0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
15ad0 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
15ae0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
15af0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
15b00 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 el [appendArgs $
15b10 6d 65 6d 6f 72 79 20 22 20 62 79 74 65 73 5c 6e memory " bytes\n
15b20 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 "].. }..
15b30 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
15b40 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
15b50 20 20 23 20 4e 4f 54 45 3a 20 4d 61 79 62 65 20 # NOTE: Maybe
15b60 74 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 20 the SQLite core
15b70 6c 69 62 72 61 72 79 20 69 73 20 75 6e 61 76 61 library is unava
15b80 69 6c 61 62 6c 65 3f 0d 0a 20 20 20 20 20 20 20 ilable?..
15b90 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 #.. set
15ba0 6d 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e 0d 0a memory unknown..
15bb0 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 .. if {!$
15bc0 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
15bd0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
15be0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
15bf0 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d rgs $memory \n].
15c00 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
15c10 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 }.... if
15c20 7b 24 63 6f 6c 6c 65 63 74 7d 20 74 68 65 6e 20 {$collect} then
15c30 7b 0d 0a 20 20 20 20 20 20 20 20 63 6f 6c 6c 65 {.. colle
15c40 63 74 47 61 72 62 61 67 65 20 24 63 68 61 6e 6e ctGarbage $chann
15c50 65 6c 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 el.. }....
15c60 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
15c70 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
15c80 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
15c90 20 22 2d 2d 2d 2d 20 63 75 72 72 65 6e 74 20 6d "---- current m
15ca0 65 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 79 20 emory in use by
15cb0 74 68 65 20 43 4c 52 2e 2e 2e 20 22 0d 0a 20 20 the CLR... "..
15cc0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 }.... i
15cd0 66 20 7b 5b 63 61 74 63 68 20 7b 6f 62 6a 65 63 f {[catch {objec
15ce0 74 20 69 6e 76 6f 6b 65 20 47 43 20 47 65 74 54 t invoke GC GetT
15cf0 6f 74 61 6c 4d 65 6d 6f 72 79 20 66 61 6c 73 65 otalMemory false
15d00 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 30 7d 20 } memory] == 0}
15d10 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
15d20 69 66 20 7b 5b 73 74 72 69 6e 67 20 69 73 20 69 if {[string is i
15d30 6e 74 65 67 65 72 20 2d 73 74 72 69 63 74 20 24 nteger -strict $
15d40 6d 65 6d 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d memory]} then {.
15d50 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 . if {!
15d60 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
15d70 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
15d80 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
15d90 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 22 ndArgs $memory "
15da0 20 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 bytes\n"]..
15db0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
15dc0 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
15dd0 20 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 set memory
15de0 69 6e 76 61 6c 69 64 0d 0a 0d 0a 20 20 20 20 20 invalid....
15df0 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
15e00 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
15e10 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
15e20 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
15e30 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 $memory \n]..
15e40 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
15e50 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c }.. } el
15e60 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 se {.. se
15e70 74 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e t memory unknown
15e80 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
15e90 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
15ea0 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
15eb0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
15ec0 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e dArgs $memory \n
15ed0 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 ].. }..
15ee0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 }.... r
15ef0 65 74 75 72 6e 20 24 72 65 73 75 6c 74 0d 0a 20 eturn $result..
15f00 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
15f10 63 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 c checkForSQLite
15f20 44 69 72 65 63 74 6f 72 69 65 73 20 7b 20 63 68 Directories { ch
15f30 61 6e 6e 65 6c 20 7b 72 65 73 65 74 20 66 61 6c annel {reset fal
15f40 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 se} } {.. #
15f50 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
15f60 43 68 65 63 6b 20 69 66 20 74 68 65 20 73 71 6c Check if the sql
15f70 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 ite3_win32_set_d
15f80 69 72 65 63 74 6f 72 79 20 66 75 6e 63 74 69 6f irectory functio
15f90 6e 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2e 0d n is available..
15fa0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
15fb0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5c tputs $channel \
15fc0 0d 0a 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d .. "---
15fd0 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 66 - checking for f
15fe0 75 6e 63 74 69 6f 6e 20 73 71 6c 69 74 65 33 5f unction sqlite3_
15ff0 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 win32_set_direct
16000 6f 72 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 ory... "....
16010 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
16020 45 3a 20 54 68 69 73 20 63 61 6c 6c 20 74 6f 20 E: This call to
16030 74 68 65 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 the sqlite3_win3
16040 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 20 2_set_directory
16050 66 75 6e 63 74 69 6f 6e 20 75 73 65 73 20 74 68 function uses th
16060 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
16070 20 69 6e 76 61 6c 69 64 20 76 61 6c 75 65 20 30 invalid value 0
16080 20 66 6f 72 20 74 68 65 20 66 69 72 73 74 20 61 for the first a
16090 72 67 75 6d 65 6e 74 2e 20 20 54 68 69 73 20 63 rgument. This c
160a0 6f 64 65 20 69 73 20 64 65 73 69 67 6e 65 64 0d ode is designed.
160b0 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 . # t
160c0 6f 20 63 68 65 63 6b 20 69 66 20 63 61 6c 6c 69 o check if calli
160d0 6e 67 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 ng the function
160e0 77 69 6c 6c 20 72 61 69 73 65 20 61 6e 20 65 78 will raise an ex
160f0 63 65 70 74 69 6f 6e 20 28 69 2e 65 2e 0d 0a 20 ception (i.e...
16100 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 # the
16110 20 61 63 74 75 61 6c 20 72 65 73 75 6c 74 20 6f actual result o
16120 66 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 64 f the function d
16130 6f 65 73 20 6e 6f 74 20 6d 61 74 74 65 72 20 61 oes not matter a
16140 73 20 6c 6f 6e 67 20 61 73 20 6e 6f 0d 0a 20 20 s long as no..
16150 20 20 20 20 23 20 20 20 20 20 20 20 64 69 72 65 # dire
16160 63 74 6f 72 79 20 69 73 20 63 68 61 6e 67 65 64 ctory is changed
16170 29 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 )... #..
16180 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
16190 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 . object
161a0 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
161b0 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
161c0 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
161d0 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 ata.SQLite.Unsaf
161e0 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 20 5c eNativeMethods \
161f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 71 .. sq
16200 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f lite3_win32_set_
16210 64 69 72 65 63 74 6f 72 79 20 30 20 6e 75 6c 6c directory 0 null
16220 0d 0a 20 20 20 20 20 20 7d 5d 20 3d 3d 20 30 7d .. }] == 0}
16230 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
16240 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
16250 54 45 3a 20 43 61 6c 6c 69 6e 67 20 74 68 65 20 TE: Calling the
16260 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 sqlite3_win32_se
16270 74 5f 64 69 72 65 63 74 6f 72 79 20 66 75 6e 63 t_directory func
16280 74 69 6f 6e 20 64 6f 65 73 20 6e 6f 74 0d 0a 20 tion does not..
16290 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 # c
162a0 61 75 73 65 20 61 6e 20 65 78 63 65 70 74 69 6f ause an exceptio
162b0 6e 3b 20 74 68 65 72 65 66 6f 72 65 2c 20 69 74 n; therefore, it
162c0 20 6d 75 73 74 20 62 65 20 61 76 61 69 6c 61 62 must be availab
162d0 6c 65 20 28 69 2e 65 2e 0d 0a 20 20 20 20 20 20 le (i.e...
162e0 20 20 23 20 20 20 20 20 20 20 65 76 65 6e 20 74 # even t
162f0 68 6f 75 67 68 20 69 74 20 73 68 6f 75 6c 64 20 hough it should
16300 72 65 74 75 72 6e 20 61 20 66 61 69 6c 75 72 65 return a failure
16310 20 72 65 74 75 72 6e 20 63 6f 64 65 20 69 6e 20 return code in
16320 74 68 69 73 0d 0a 20 20 20 20 20 20 20 20 23 20 this.. #
16330 20 20 20 20 20 20 63 61 73 65 29 2e 0d 0a 20 20 case)...
16340 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
16350 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 73 addConstraint s
16360 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 qlite3_win32_set
16370 5f 64 69 72 65 63 74 6f 72 79 0d 0a 0d 0a 20 20 _directory....
16380 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
16390 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a 0d 0a 20 20 nnel yes\n....
163a0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
163b0 20 23 20 4e 4f 54 45 3a 20 44 6f 65 73 20 6f 75 # NOTE: Does ou
163c0 72 20 63 61 6c 6c 65 72 20 77 61 6e 74 20 74 6f r caller want to
163d0 20 72 65 73 65 74 20 74 68 65 20 64 69 72 65 63 reset the direc
163e0 74 6f 72 69 65 73 3f 0d 0a 20 20 20 20 20 20 20 tories?..
163f0 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b #.. if {
16400 24 72 65 73 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $reset} then {..
16410 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
16420 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4e # NOTE: N
16430 6f 77 20 6d 61 6b 65 20 73 75 72 65 20 74 68 65 ow make sure the
16440 20 64 61 74 61 62 61 73 65 20 61 6e 64 20 74 65 database and te
16450 6d 70 6f 72 61 72 79 20 64 69 72 65 63 74 6f 72 mporary director
16460 69 65 73 20 61 72 65 0d 0a 20 20 20 20 20 20 20 ies are..
16470 20 20 20 23 20 20 20 20 20 20 20 72 65 73 65 74 # reset
16480 20 74 68 65 69 72 20 64 65 66 61 75 6c 74 20 76 their default v
16490 61 6c 75 65 73 2c 20 77 68 69 63 68 20 73 68 6f alues, which sho
164a0 75 6c 64 20 62 65 20 6e 75 6c 6c 20 66 6f 72 20 uld be null for
164b0 62 6f 74 68 2e 0d 0a 20 20 20 20 20 20 20 20 20 both...
164c0 20 23 20 20 20 20 20 20 20 53 69 6e 63 65 20 74 # Since t
164d0 68 65 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 he sqlite3_win32
164e0 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 20 66 _set_directory f
164f0 75 6e 63 74 69 6f 6e 20 69 73 20 61 76 61 69 6c unction is avail
16500 61 62 6c 65 2c 0d 0a 20 20 20 20 20 20 20 20 20 able,..
16510 20 23 20 20 20 20 20 20 20 75 73 65 20 69 74 2e # use it.
16520 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
16530 20 20 20 20 20 20 20 20 20 66 6f 72 20 7b 73 65 for {se
16540 74 20 69 6e 64 65 78 20 31 7d 20 7b 24 69 6e 64 t index 1} {$ind
16550 65 78 20 3c 20 33 7d 20 7b 69 6e 63 72 20 69 6e ex < 3} {incr in
16560 64 65 78 7d 20 7b 0d 0a 20 20 20 20 20 20 20 20 dex} {..
16570 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
16580 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
16590 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 object invoke -f
165a0 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 lags +NonPublic
165b0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
165c0 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
165d0 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e 61 .SQLite.UnsafeNa
165e0 74 69 76 65 4d 65 74 68 6f 64 73 20 5c 0d 0a 20 tiveMethods \..
165f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
16600 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 sqlite3_win32_s
16610 65 74 5f 64 69 72 65 63 74 6f 72 79 20 24 69 6e et_directory $in
16620 64 65 78 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 dex null..
16630 20 20 20 20 20 20 7d 20 72 65 73 75 6c 74 5d 20 } result]
16640 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
16650 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
16660 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
16670 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
16680 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
16690 2d 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 5f 77 - call sqlite3_w
166a0 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f in32_set_directo
166b0 72 79 28 22 20 24 69 6e 64 65 78 20 5c 0d 0a 20 ry(" $index \..
166c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
166d0 20 22 2c 20 6e 75 6c 6c 29 2e 2e 2e 20 6f 6b 3a ", null)... ok:
166e0 20 22 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a " $result \n]..
166f0 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c } el
16700 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
16710 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
16720 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
16730 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
16740 20 20 20 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 "---- call s
16750 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 qlite3_win32_set
16760 5f 64 69 72 65 63 74 6f 72 79 28 22 20 24 69 6e _directory(" $in
16770 64 65 78 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 dex \..
16780 20 20 20 20 20 20 20 20 20 22 2c 20 6e 75 6c 6c ", null
16790 29 2e 2e 2e 20 65 72 72 6f 72 3a 20 22 20 5c 6e )... error: " \n
167a0 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a \t $result \n]..
167b0 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
167c0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
167d0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 }.. } e
167e0 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 lse {.. t
167f0 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e 6f puts $channel no
16800 5c 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d \n.... #.
16810 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
16820 20 44 6f 65 73 20 6f 75 72 20 63 61 6c 6c 65 72 Does our caller
16830 20 77 61 6e 74 20 74 6f 20 72 65 73 65 74 20 74 want to reset t
16840 68 65 20 64 69 72 65 63 74 6f 72 69 65 73 3f 20 he directories?
16850 20 54 68 69 73 20 63 61 6e 20 6f 6e 6c 79 0d 0a This can only..
16860 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
16870 62 65 20 70 65 72 66 6f 72 6d 65 64 20 69 66 20 be performed if
16880 53 51 4c 69 74 65 20 69 73 20 6c 6f 61 64 65 64 SQLite is loaded
16890 20 61 6e 64 20 72 65 61 64 79 20 66 6f 72 20 75 and ready for u
168a0 73 65 20 62 79 20 74 68 65 20 74 65 73 74 0d 0a se by the test..
168b0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
168c0 73 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 20 20 suite...
168d0 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 24 #.. if {$
168e0 72 65 73 65 74 20 26 26 20 5b 69 73 53 51 4c 69 reset && [isSQLi
168f0 74 65 52 65 61 64 79 5d 7d 20 74 68 65 6e 20 7b teReady]} then {
16900 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
16910 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
16920 20 4e 6f 77 20 6d 61 6b 65 20 73 75 72 65 20 74 Now make sure t
16930 68 65 20 64 61 74 61 62 61 73 65 20 61 6e 64 20 he database and
16940 74 65 6d 70 6f 72 61 72 79 20 64 69 72 65 63 74 temporary direct
16950 6f 72 69 65 73 20 61 72 65 0d 0a 20 20 20 20 20 ories are..
16960 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 73 # res
16970 65 74 20 74 68 65 69 72 20 64 65 66 61 75 6c 74 et their default
16980 20 76 61 6c 75 65 73 2c 20 77 68 69 63 68 20 73 values, which s
16990 68 6f 75 6c 64 20 62 65 20 6e 75 6c 6c 20 66 6f hould be null fo
169a0 72 20 62 6f 74 68 2e 0d 0a 20 20 20 20 20 20 20 r both...
169b0 20 20 20 23 20 20 20 20 20 20 20 53 69 6e 63 65 # Since
169c0 20 74 68 65 20 73 71 6c 69 74 65 33 5f 77 69 6e the sqlite3_win
169d0 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 32_set_directory
169e0 20 66 75 6e 63 74 69 6f 6e 20 64 6f 65 73 20 6e function does n
169f0 6f 74 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 ot.. #
16a00 20 20 20 20 20 20 61 70 70 65 61 72 20 74 6f 20 appear to
16a10 62 65 20 61 76 61 69 6c 61 62 6c 65 2c 20 75 73 be available, us
16a20 65 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 e the associated
16a30 20 50 52 41 47 4d 41 20 63 6f 6d 6d 61 6e 64 73 PRAGMA commands
16a40 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 .. #
16a50 20 20 20 20 69 6e 73 74 65 61 64 2e 0d 0a 20 20 instead...
16a60 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
16a70 20 20 20 20 20 66 6f 72 65 61 63 68 20 64 69 72 foreach dir
16a80 65 63 74 6f 72 79 20 5b 6c 69 73 74 20 64 61 74 ectory [list dat
16a90 61 5f 73 74 6f 72 65 5f 64 69 72 65 63 74 6f 72 a_store_director
16aa0 79 20 74 65 6d 70 5f 73 74 6f 72 65 5f 64 69 72 y temp_store_dir
16ab0 65 63 74 6f 72 79 5d 20 7b 0d 0a 20 20 20 20 20 ectory] {..
16ac0 20 20 20 20 20 20 20 73 65 74 20 73 71 6c 20 5b set sql [
16ad0 61 70 70 65 6e 64 41 72 67 73 20 22 50 52 41 47 appendArgs "PRAG
16ae0 4d 41 20 22 20 24 64 69 72 65 63 74 6f 72 79 20 MA " $directory
16af0 22 20 3d 20 5c 22 5c 22 3b 22 5d 0d 0a 0d 0a 20 " = \"\";"]....
16b00 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b if {[
16b10 63 61 74 63 68 20 7b 65 78 65 63 75 74 65 53 71 catch {executeSq
16b20 6c 20 24 73 71 6c 7d 20 72 65 73 75 6c 74 5d 20 l $sql} result]
16b30 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
16b40 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
16b50 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
16b60 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
16b70 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
16b80 2d 20 65 78 65 63 75 74 65 20 50 52 41 47 4d 41 - execute PRAGMA
16b90 20 22 20 24 64 69 72 65 63 74 6f 72 79 20 22 2e " $directory ".
16ba0 2e 2e 20 6f 6b 3a 20 5c 22 22 20 5c 0d 0a 20 20 .. ok: \"" \..
16bb0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
16bc0 24 72 65 73 75 6c 74 20 5c 22 5c 6e 5d 0d 0a 20 $result \"\n]..
16bd0 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 } els
16be0 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
16bf0 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
16c00 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
16c10 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
16c20 20 20 20 22 2d 2d 2d 2d 20 65 78 65 63 75 74 65 "---- execute
16c30 20 50 52 41 47 4d 41 20 22 20 24 64 69 72 65 63 PRAGMA " $direc
16c40 74 6f 72 79 20 22 2e 2e 2e 20 65 72 72 6f 72 3a tory "... error:
16c50 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 " \..
16c60 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 72 65 \n\t $re
16c70 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 sult \n]..
16c80 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
16c90 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
16ca0 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
16cb0 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
16cc0 45 3a 20 46 69 6e 61 6c 6c 79 2c 20 73 68 6f 77 E: Finally, show
16cd0 20 74 68 65 20 63 75 72 72 65 6e 74 20 76 61 6c the current val
16ce0 75 65 20 6f 66 20 74 68 65 20 64 61 74 61 62 61 ue of the databa
16cf0 73 65 20 61 6e 64 20 74 65 6d 70 6f 72 61 72 79 se and temporary
16d00 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
16d10 64 69 72 65 63 74 6f 72 69 65 73 2e 20 20 54 68 directories. Th
16d20 69 73 20 63 61 6e 20 6f 6e 6c 79 20 62 65 20 70 is can only be p
16d30 65 72 66 6f 72 6d 65 64 20 69 66 20 53 51 4c 69 erformed if SQLi
16d40 74 65 20 69 73 20 6c 6f 61 64 65 64 0d 0a 20 20 te is loaded..
16d50 20 20 20 20 23 20 20 20 20 20 20 20 61 6e 64 20 # and
16d60 72 65 61 64 79 20 66 6f 72 20 75 73 65 20 62 79 ready for use by
16d70 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 2e the test suite.
16d80 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
16d90 20 69 66 20 7b 5b 69 73 53 51 4c 69 74 65 52 65 if {[isSQLiteRe
16da0 61 64 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ady]} then {..
16db0 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 64 69 foreach di
16dc0 72 65 63 74 6f 72 79 20 5b 6c 69 73 74 20 64 61 rectory [list da
16dd0 74 61 5f 73 74 6f 72 65 5f 64 69 72 65 63 74 6f ta_store_directo
16de0 72 79 20 74 65 6d 70 5f 73 74 6f 72 65 5f 64 69 ry temp_store_di
16df0 72 65 63 74 6f 72 79 5d 20 7b 0d 0a 20 20 20 20 rectory] {..
16e00 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
16e10 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
16e20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 "---- checking
16e30 22 20 24 64 69 72 65 63 74 6f 72 79 20 22 2e 2e " $directory "..
16e40 2e 20 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 . "]....
16e50 20 20 73 65 74 20 73 71 6c 20 5b 61 70 70 65 6e set sql [appen
16e60 64 41 72 67 73 20 22 50 52 41 47 4d 41 20 22 20 dArgs "PRAGMA "
16e70 24 64 69 72 65 63 74 6f 72 79 20 5c 3b 5d 0d 0a $directory \;]..
16e80 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
16e90 5b 63 61 74 63 68 20 7b 65 78 65 63 75 74 65 53 [catch {executeS
16ea0 71 6c 20 24 73 71 6c 20 73 63 61 6c 61 72 7d 20 ql $sql scalar}
16eb0 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 result] == 0} th
16ec0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
16ed0 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
16ee0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 6f 6b [appendArgs "ok
16ef0 3a 20 5c 22 22 20 24 72 65 73 75 6c 74 20 5c 22 : \"" $result \"
16f00 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
16f10 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
16f20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
16f30 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
16f40 22 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 "error: " \n\t $
16f50 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 result \n]..
16f60 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
16f70 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 }.. }..
16f80 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
16f90 6c 6f 61 64 53 51 4c 69 74 65 54 65 73 74 53 65 loadSQLiteTestSe
16fa0 74 74 69 6e 67 73 20 7b 20 63 68 61 6e 6e 65 6c ttings { channel
16fb0 20 7b 73 75 66 66 69 78 20 22 22 7d 20 7b 71 75 {suffix ""} {qu
16fc0 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a iet false} } {..
16fd0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
16fe0 20 4e 4f 54 45 3a 20 53 6b 69 70 20 6c 6f 61 64 NOTE: Skip load
16ff0 69 6e 67 20 74 68 65 20 73 65 74 74 69 6e 67 73 ing the settings
17000 20 69 66 20 74 68 65 69 72 20 75 73 61 67 65 20 if their usage
17010 68 61 73 20 62 65 65 6e 20 64 69 73 61 62 6c 65 has been disable
17020 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 d... #..
17030 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
17040 69 73 74 73 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 ists ::no(sqlite
17050 54 65 73 74 53 65 74 74 69 6e 67 73 29 5d 7d 20 TestSettings)]}
17060 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
17070 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
17080 45 3a 20 4c 6f 61 64 20 63 75 73 74 6f 6d 20 70 E: Load custom p
17090 65 72 2d 75 73 65 72 20 61 6e 64 2f 6f 72 20 70 er-user and/or p
170a0 65 72 2d 68 6f 73 74 20 74 65 73 74 20 73 65 74 er-host test set
170b0 74 69 6e 67 73 20 6e 6f 77 2e 0d 0a 20 20 20 20 tings now...
170c0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 #.. i
170d0 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
170e0 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 75 ::tcl_platform(u
170f0 73 65 72 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 ser)]} then {..
17100 20 20 20 20 20 20 20 20 20 73 65 74 20 75 73 65 set use
17110 72 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d rSettingsFileNam
17120 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 e [file join [ge
17130 74 43 6f 6d 6d 6f 6e 44 69 72 65 63 74 6f 72 79 tCommonDirectory
17140 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ] \..
17150 20 20 20 5b 61 70 70 65 6e 64 41 72 67 73 20 73 [appendArgs s
17160 65 74 74 69 6e 67 73 20 24 73 75 66 66 69 78 20 ettings $suffix
17170 2e 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 . $::tcl_platfor
17180 6d 28 75 73 65 72 29 20 2e 65 61 67 6c 65 5d 5d m(user) .eagle]]
17190 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 .... if
171a0 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {[file exists $
171b0 75 73 65 72 53 65 74 74 69 6e 67 73 46 69 6c 65 userSettingsFile
171c0 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 Name]} then {..
171d0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
171e0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
171f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
17200 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
17210 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
17220 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
17230 2d 2d 2d 20 6c 6f 61 64 69 6e 67 20 70 65 72 2d --- loading per-
17240 75 73 65 72 20 74 65 73 74 20 73 65 74 74 69 6e user test settin
17250 67 73 20 66 69 6c 65 20 5c 22 22 20 5c 0d 0a 20 gs file \"" \..
17260 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
17270 20 24 75 73 65 72 53 65 74 74 69 6e 67 73 46 69 $userSettingsFi
17280 6c 65 4e 61 6d 65 20 5c 22 2e 2e 2e 5c 6e 5d 0d leName \"...\n].
17290 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
172a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
172b0 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
172c0 20 20 20 20 20 20 20 20 20 20 75 70 6c 65 76 65 upleve
172d0 6c 20 31 20 5b 6c 69 73 74 20 73 6f 75 72 63 65 l 1 [list source
172e0 20 24 75 73 65 72 53 65 74 74 69 6e 67 73 46 69 $userSettingsFi
172f0 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 20 leName]..
17300 20 20 20 20 20 7d 20 65 72 72 6f 72 5d 7d 20 74 } error]} t
17310 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
17320 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
17330 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
17340 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
17350 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
17360 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
17370 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d "===
17380 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 = WARNING: faile
17390 64 20 74 6f 20 6c 6f 61 64 20 70 65 72 2d 75 73 d to load per-us
173a0 65 72 20 73 65 74 74 69 6e 67 73 20 66 69 6c 65 er settings file
173b0 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 \"" \..
173c0 20 20 20 20 20 20 20 20 20 20 20 20 24 75 73 65 $use
173d0 72 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d rSettingsFileNam
173e0 65 20 22 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 e "\", error: "
173f0 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d \n\t $error \n].
17400 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
17410 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
17420 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 . } els
17430 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
17440 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
17450 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
17460 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
17470 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
17480 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
17490 20 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 "---- skippe
174a0 64 20 6c 6f 61 64 69 6e 67 20 70 65 72 2d 75 73 d loading per-us
174b0 65 72 20 74 65 73 74 20 73 65 74 74 69 6e 67 73 er test settings
174c0 20 66 69 6c 65 20 5c 22 22 20 5c 0d 0a 20 20 20 file \"" \..
174d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 $
174e0 75 73 65 72 53 65 74 74 69 6e 67 73 46 69 6c 65 userSettingsFile
174f0 4e 61 6d 65 20 22 5c 22 2c 20 69 74 20 64 6f 65 Name "\", it doe
17500 73 20 6e 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d s not exist\n"].
17510 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
17520 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
17530 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
17540 20 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ##############
17550 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
17560 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
17570 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
17580 23 23 23 23 23 23 23 23 23 0d 0a 0d 0a 20 20 20 #########....
17590 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 if {[info e
175a0 78 69 73 74 73 20 3a 3a 74 63 6c 5f 70 6c 61 74 xists ::tcl_plat
175b0 66 6f 72 6d 28 68 6f 73 74 29 5d 7d 20 74 68 65 form(host)]} the
175c0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 n {.. s
175d0 65 74 20 68 6f 73 74 53 65 74 74 69 6e 67 73 46 et hostSettingsF
175e0 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f ileName [file jo
175f0 69 6e 20 5b 67 65 74 43 6f 6d 6d 6f 6e 44 69 72 in [getCommonDir
17600 65 63 74 6f 72 79 5d 20 5c 0d 0a 20 20 20 20 20 ectory] \..
17610 20 20 20 20 20 20 20 20 20 5b 61 70 70 65 6e 64 [append
17620 41 72 67 73 20 73 65 74 74 69 6e 67 73 20 24 73 Args settings $s
17630 75 66 66 69 78 20 2e 20 24 3a 3a 74 63 6c 5f 70 uffix . $::tcl_p
17640 6c 61 74 66 6f 72 6d 28 68 6f 73 74 29 20 2e 65 latform(host) .e
17650 61 67 6c 65 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 agle]]....
17660 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 if {[file ex
17670 69 73 74 73 20 24 68 6f 73 74 53 65 74 74 69 6e ists $hostSettin
17680 67 73 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 gsFileName]} the
17690 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
176a0 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
176b0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
176c0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
176d0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
176e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
176f0 20 20 20 20 22 2d 2d 2d 2d 20 6c 6f 61 64 69 6e "---- loadin
17700 67 20 70 65 72 2d 68 6f 73 74 20 74 65 73 74 20 g per-host test
17710 73 65 74 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 settings file \"
17720 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
17730 20 20 20 20 20 20 20 24 68 6f 73 74 53 65 74 74 $hostSett
17740 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 5c 22 2e ingsFileName \".
17750 2e 2e 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 ..\n]..
17760 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
17770 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
17780 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
17790 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 uplevel 1 [list
177a0 73 6f 75 72 63 65 20 24 68 6f 73 74 53 65 74 74 source $hostSett
177b0 69 6e 67 73 46 69 6c 65 4e 61 6d 65 5d 0d 0a 20 ingsFileName]..
177c0 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 72 72 } err
177d0 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 or]} then {..
177e0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
177f0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
17800 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
17810 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
17820 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
17830 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
17840 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a "==== WARNING:
17850 20 66 61 69 6c 65 64 20 74 6f 20 6c 6f 61 64 20 failed to load
17860 70 65 72 2d 68 6f 73 74 20 73 65 74 74 69 6e 67 per-host setting
17870 73 20 66 69 6c 65 20 5c 22 22 20 5c 0d 0a 20 20 s file \"" \..
17880 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
17890 20 20 24 68 6f 73 74 53 65 74 74 69 6e 67 73 46 $hostSettingsF
178a0 69 6c 65 4e 61 6d 65 20 22 5c 22 2c 20 65 72 72 ileName "\", err
178b0 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f or: " \n\t $erro
178c0 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 r \n]..
178d0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
178e0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
178f0 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
17900 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
17910 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
17920 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
17930 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
17940 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
17950 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
17960 73 6b 69 70 70 65 64 20 6c 6f 61 64 69 6e 67 20 skipped loading
17970 70 65 72 2d 68 6f 73 74 20 74 65 73 74 20 73 65 per-host test se
17980 74 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 22 20 ttings file \""
17990 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
179a0 20 20 20 20 20 24 68 6f 73 74 53 65 74 74 69 6e $hostSettin
179b0 67 73 46 69 6c 65 4e 61 6d 65 20 22 5c 22 2c 20 gsFileName "\",
179c0 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 it does not exis
179d0 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 t\n"]..
179e0 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
179f0 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
17a00 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
17a10 0a 20 20 20 20 70 72 6f 63 20 72 75 6e 53 51 4c . proc runSQL
17a20 69 74 65 54 65 73 74 50 72 6f 6c 6f 67 75 65 20 iteTestPrologue
17a30 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 {} {.. #..
17a40 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 # NOTE: Ski
17a50 70 20 72 75 6e 6e 69 6e 67 20 6f 75 72 20 63 75 p running our cu
17a60 73 74 6f 6d 20 70 72 6f 6c 6f 67 75 65 20 69 66 stom prologue if
17a70 20 74 68 65 20 6d 61 69 6e 20 6f 6e 65 20 68 61 the main one ha
17a80 73 20 62 65 65 6e 0d 0a 20 20 20 20 20 20 23 20 s been.. #
17a90 20 20 20 20 20 20 73 6b 69 70 70 65 64 2e 0d 0a skipped...
17aa0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
17ab0 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
17ac0 20 3a 3a 6e 6f 28 70 72 6f 6c 6f 67 75 65 2e 65 ::no(prologue.e
17ad0 61 67 6c 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a agle)]} then {..
17ae0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
17af0 20 20 20 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 20 # NOTE: Load
17b00 74 68 65 20 22 62 65 66 6f 72 65 2d 63 6f 6e 73 the "before-cons
17b10 74 72 61 69 6e 74 73 22 20 63 75 73 74 6f 6d 20 traints" custom
17b20 70 65 72 2d 75 73 65 72 20 61 6e 64 2f 6f 72 20 per-user and/or
17b30 70 65 72 2d 68 6f 73 74 0d 0a 20 20 20 20 20 20 per-host..
17b40 20 20 23 20 20 20 20 20 20 20 74 65 73 74 20 73 # test s
17b50 65 74 74 69 6e 67 73 20 6e 6f 77 2e 0d 0a 20 20 ettings now...
17b60 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
17b70 20 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 uplevel 1 [list
17b80 20 6c 6f 61 64 53 51 4c 69 74 65 54 65 73 74 53 loadSQLiteTestS
17b90 65 74 74 69 6e 67 73 20 24 3a 3a 74 65 73 74 5f ettings $::test_
17ba0 63 68 61 6e 6e 65 6c 20 2e 62 65 66 6f 72 65 5d channel .before]
17bb0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
17bc0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 # NOTE: D
17bd0 65 74 65 72 6d 69 6e 65 20 74 68 65 20 6e 61 6d etermine the nam
17be0 65 73 20 6f 66 20 74 68 65 20 6e 61 74 69 76 65 es of the native
17bf0 20 70 6c 61 74 66 6f 72 6d 20 61 6e 64 20 61 72 platform and ar
17c00 63 68 69 74 65 63 74 75 72 65 2e 0d 0a 20 20 20 chitecture...
17c10 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
17c20 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 5b 67 65 set platform [ge
17c30 74 42 75 69 6c 64 50 6c 61 74 66 6f 72 6d 20 74 tBuildPlatform t
17c40 72 75 65 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 rue].. se
17c50 74 20 61 72 63 68 69 74 65 63 74 75 72 65 20 5b t architecture [
17c60 61 72 63 68 69 74 65 63 74 75 72 65 46 6f 72 50 architectureForP
17c70 6c 61 74 66 6f 72 6d 20 24 70 6c 61 74 66 6f 72 latform $platfor
17c80 6d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d m].... #.
17c90 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
17ca0 20 53 68 6f 77 20 74 68 65 20 70 6c 61 74 66 6f Show the platfo
17cb0 72 6d 20 61 6e 64 20 61 72 63 68 69 74 65 63 74 rm and architect
17cc0 75 72 65 20 75 73 65 64 20 74 6f 20 68 65 6c 70 ure used to help
17cd0 20 6c 6f 63 61 74 65 20 74 68 65 0d 0a 20 20 20 locate the..
17ce0 20 20 20 20 20 23 20 20 20 20 20 20 20 6e 61 74 # nat
17cf0 69 76 65 20 62 75 69 6c 64 20 66 69 6c 65 73 2e ive build files.
17d00 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
17d10 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
17d20 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
17d30 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
17d40 20 20 20 20 20 20 22 2d 2d 2d 2d 20 70 6c 61 74 "---- plat
17d50 66 6f 72 6d 20 66 6f 72 20 6c 6f 63 61 74 69 6e form for locatin
17d60 67 20 6e 61 74 69 76 65 20 62 75 69 6c 64 20 66 g native build f
17d70 69 6c 65 73 20 69 73 20 5c 22 22 20 5c 0d 0a 20 iles is \"" \..
17d80 20 20 20 20 20 20 20 20 20 20 20 24 70 6c 61 74 $plat
17d90 66 6f 72 6d 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 form \"\n]....
17da0 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
17db0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
17dc0 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
17dd0 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 61 72 63 "---- arc
17de0 68 69 74 65 63 74 75 72 65 20 66 6f 72 20 6c 6f hitecture for lo
17df0 63 61 74 69 6e 67 20 6e 61 74 69 76 65 20 62 75 cating native bu
17e00 69 6c 64 20 66 69 6c 65 73 20 69 73 20 5c 22 22 ild files is \""
17e10 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
17e20 24 61 72 63 68 69 74 65 63 74 75 72 65 20 5c 22 $architecture \"
17e30 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 \n].... #
17e40 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
17e50 3a 20 42 75 69 6c 64 20 61 20 6c 69 73 74 20 6f : Build a list o
17e60 66 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 f configuration
17e70 66 69 6c 65 73 20 74 68 61 74 20 77 65 20 68 61 files that we ha
17e80 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 ndle... #
17e90 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 63 6f .. set co
17ea0 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 5b 6c nfigFileNames [l
17eb0 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ist \..
17ec0 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 System.Data.S
17ed0 51 4c 69 74 65 2e 64 6c 6c 2e 63 6f 6e 66 69 67 QLite.dll.config
17ee0 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ].... #..
17ef0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
17f00 42 75 69 6c 64 20 61 20 6c 69 73 74 20 6f 66 20 Build a list of
17f10 61 75 78 69 6c 69 61 72 79 20 4d 61 6e 61 67 65 auxiliary Manage
17f20 64 20 44 65 62 75 67 67 69 6e 67 20 41 73 73 69 d Debugging Assi
17f30 73 74 61 6e 74 73 20 28 4d 44 41 29 0d 0a 20 20 stants (MDA)..
17f40 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
17f50 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 69 6c 65 nfiguration file
17f60 73 20 74 68 61 74 20 77 65 20 68 61 6e 64 6c 65 s that we handle
17f70 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
17f80 20 20 20 20 20 20 73 65 74 20 6d 64 61 43 6f 6e set mdaCon
17f90 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 figFileNames [li
17fa0 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 st \..
17fb0 20 20 45 61 67 6c 65 53 68 65 6c 6c 33 32 2e 65 EagleShell32.e
17fc0 78 65 2e 6d 64 61 2e 63 6f 6e 66 69 67 20 49 6e xe.mda.config In
17fd0 73 74 61 6c 6c 65 72 2e 65 78 65 2e 6d 64 61 2e staller.exe.mda.
17fe0 63 6f 6e 66 69 67 20 5c 0d 0a 20 20 20 20 20 20 config \..
17ff0 20 20 20 20 20 20 74 65 73 74 2e 65 78 65 2e 6d test.exe.m
18000 64 61 2e 63 6f 6e 66 69 67 20 74 65 73 74 6c 69 da.config testli
18010 6e 71 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 69 nq.exe.mda.confi
18020 67 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 g \..
18030 20 74 65 73 74 65 66 36 2e 65 78 65 2e 6d 64 61 testef6.exe.mda
18040 2e 63 6f 6e 66 69 67 5d 0d 0a 0d 0a 20 20 20 20 .config]....
18050 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
18060 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 NOTE: Build the
18070 20 6c 69 73 74 20 6f 66 20 65 78 74 65 72 6e 61 list of externa
18080 6c 20 66 69 6c 65 73 20 74 68 61 74 20 77 65 20 l files that we
18090 68 61 6e 64 6c 65 2e 20 20 53 6f 6d 65 20 6f 66 handle. Some of
180a0 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
180b0 20 20 74 68 65 73 65 20 66 69 6c 65 73 20 6d 61 these files ma
180c0 79 20 62 65 20 6e 61 74 69 76 65 20 61 6e 64 2f y be native and/
180d0 6f 72 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d or managed assem
180e0 62 6c 69 65 73 20 74 68 61 74 20 61 72 65 0d 0a blies that are..
180f0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
18100 72 65 71 75 69 72 65 64 20 74 6f 20 70 65 72 66 required to perf
18110 6f 72 6d 20 76 61 72 69 6f 75 73 20 74 65 73 74 orm various test
18120 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 s... #..
18130 20 20 20 20 20 20 20 73 65 74 20 65 78 74 65 72 set exter
18140 6e 61 6c 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 nalFileNames [li
18150 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 st \..
18160 20 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 45 6e 74 [file join Ent
18170 69 74 79 46 72 61 6d 65 77 6f 72 6b 20 6c 69 62 ityFramework lib
18180 20 5b 73 74 72 69 6e 67 20 6d 61 70 20 5b 6c 69 [string map [li
18190 73 74 20 46 78 20 22 22 5d 20 5b 73 74 72 69 6e st Fx ""] [strin
181a0 67 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 g \..
181b0 20 6d 61 70 20 5b 6c 69 73 74 20 6e 65 74 46 78 map [list netFx
181c0 34 35 31 20 6e 65 74 46 78 34 35 5d 20 5b 67 65 451 netFx45] [ge
181d0 74 42 75 69 6c 64 4e 65 74 46 78 5d 5d 5d 20 45 tBuildNetFx]]] E
181e0 6e 74 69 74 79 46 72 61 6d 65 77 6f 72 6b 2e 64 ntityFramework.d
181f0 6c 6c 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ll]]....
18200 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
18210 45 3a 20 42 75 69 6c 64 20 74 68 65 20 6c 69 73 E: Build the lis
18220 74 20 6f 66 20 6e 61 74 69 76 65 20 61 73 73 65 t of native asse
18230 6d 62 6c 79 20 66 69 6c 65 73 20 74 68 61 74 20 mbly files that
18240 77 65 20 68 61 6e 64 6c 65 2e 20 20 54 68 65 0d we handle. The.
18250 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
18260 20 72 65 61 73 6f 6e 20 74 68 65 20 22 53 79 73 reason the "Sys
18270 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
18280 64 6c 6c 22 20 66 69 6c 65 20 69 73 20 69 6e 63 dll" file is inc
18290 6c 75 64 65 64 20 68 65 72 65 20 69 73 0d 0a 20 luded here is..
182a0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 # b
182b0 65 63 61 75 73 65 20 69 74 20 63 6f 75 6c 64 20 ecause it could
182c0 62 65 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 be the mixed-mod
182d0 65 20 61 73 73 65 6d 62 6c 79 2e 0d 0a 20 20 20 e assembly...
182e0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
182f0 73 65 74 20 6e 61 74 69 76 65 46 69 6c 65 4e 61 set nativeFileNa
18300 6d 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 mes [list \..
18310 20 20 20 20 20 20 20 20 20 73 71 6c 69 74 65 33 sqlite3
18320 2e 64 6c 6c 20 53 51 4c 69 74 65 2e 49 6e 74 65 .dll SQLite.Inte
18330 72 6f 70 2e 64 6c 6c 20 53 79 73 74 65 6d 2e 44 rop.dll System.D
18340 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5d 0d ata.SQLite.dll].
18350 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
18360 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 # NOTE: Bu
18370 69 6c 64 20 74 68 65 20 6c 69 73 74 20 6f 66 20 ild the list of
18380 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 79 managed assembly
18390 20 66 69 6c 65 73 20 74 68 61 74 20 77 65 20 68 files that we h
183a0 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 andle...
183b0 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 6d #.. set m
183c0 61 6e 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 20 anagedFileNames
183d0 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 [list \..
183e0 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
183f0 2e 53 51 4c 69 74 65 2e 64 6c 6c 20 53 79 73 74 .SQLite.dll Syst
18400 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 4c em.Data.SQLite.L
18410 69 6e 71 2e 64 6c 6c 20 5c 0d 0a 20 20 20 20 20 inq.dll \..
18420 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 System.Da
18430 74 61 2e 53 51 4c 69 74 65 2e 45 46 36 2e 64 6c ta.SQLite.EF6.dl
18440 6c 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d l].... #.
18450 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
18460 20 52 65 6d 6f 76 65 20 61 6e 79 20 74 65 73 74 Remove any test
18470 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 74 68 61 constraints tha
18480 74 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 6e t refer to the n
18490 61 74 69 76 65 20 61 6e 64 2f 6f 72 0d 0a 20 20 ative and/or..
184a0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6d 61 # ma
184b0 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 79 20 66 naged assembly f
184c0 69 6c 65 73 20 74 68 61 74 20 77 65 20 68 61 6e iles that we han
184d0 64 6c 65 20 75 6e 6c 65 73 73 20 66 6f 72 62 69 dle unless forbi
184e0 64 64 65 6e 20 66 72 6f 6d 0d 0a 20 20 20 20 20 dden from..
184f0 20 20 20 23 20 20 20 20 20 20 20 64 6f 69 6e 67 # doing
18500 20 73 6f 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d so... #.
18510 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 . if {![i
18520 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
18530 73 71 6c 69 74 65 52 65 6d 6f 76 65 43 6f 6e 73 sqliteRemoveCons
18540 74 72 61 69 6e 74 73 29 5d 7d 20 74 68 65 6e 20 traints)]} then
18550 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 {.. for
18560 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 63 each fileName $c
18570 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b onfigFileNames {
18580 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
18590 6d 6f 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b moveConstraint [
185a0 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
185b0 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 $fileName]..
185c0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
185d0 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 foreach fi
185e0 6c 65 4e 61 6d 65 20 24 6d 64 61 43 6f 6e 66 69 leName $mdaConfi
185f0 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 gFileNames {..
18600 20 20 20 20 20 20 20 20 20 20 72 65 6d 6f 76 65 remove
18610 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
18620 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 24 66 69 ndArgs file_ $fi
18630 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 20 leName]..
18640 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
18650 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
18660 6d 65 20 24 65 78 74 65 72 6e 61 6c 46 69 6c 65 me $externalFile
18670 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 Names {..
18680 20 20 20 20 20 72 65 6d 6f 76 65 43 6f 6e 73 74 removeConst
18690 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
186a0 73 20 66 69 6c 65 5f 20 5b 66 69 6c 65 20 74 61 s file_ [file ta
186b0 69 6c 20 24 66 69 6c 65 4e 61 6d 65 5d 5d 0d 0a il $fileName]]..
186c0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
186d0 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 foreach
186e0 20 66 69 6c 65 4e 61 6d 65 20 24 6e 61 74 69 76 fileName $nativ
186f0 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 eFileNames {..
18700 20 20 20 20 20 20 20 20 20 20 72 65 6d 6f 76 65 remove
18710 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
18720 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 24 66 69 ndArgs file_ $fi
18730 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 20 leName]..
18740 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
18750 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
18760 6d 65 20 24 6d 61 6e 61 67 65 64 46 69 6c 65 4e me $managedFileN
18770 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 ames {..
18780 20 20 20 20 72 65 6d 6f 76 65 43 6f 6e 73 74 72 removeConstr
18790 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
187a0 20 66 69 6c 65 5f 20 24 66 69 6c 65 4e 61 6d 65 file_ $fileName
187b0 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
187c0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
187d0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
187e0 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 61 6c 6c # NOTE: Skip all
187f0 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
18800 69 74 65 20 72 65 6c 61 74 65 64 20 66 69 6c 65 ite related file
18810 20 68 61 6e 64 6c 69 6e 67 20 28 64 65 6c 65 74 handling (delet
18820 69 6e 67 2c 0d 0a 20 20 20 20 20 20 20 20 23 20 ing,.. #
18830 20 20 20 20 20 20 63 6f 70 79 69 6e 67 2c 20 61 copying, a
18840 6e 64 20 6c 6f 61 64 69 6e 67 29 20 69 66 20 69 nd loading) if i
18850 6e 73 74 72 75 63 74 65 64 2e 0d 0a 20 20 20 20 nstructed...
18860 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 #.. i
18870 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
18880 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 46 69 6c 65 ::no(sqliteFile
18890 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
188a0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
188b0 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 # NOTE: Skip
188c0 20 74 72 79 69 6e 67 20 74 6f 20 64 65 6c 65 74 trying to delet
188d0 65 20 61 6e 79 20 66 69 6c 65 73 20 69 66 20 69 e any files if i
188e0 6e 73 74 72 75 63 74 65 64 2e 0d 0a 20 20 20 20 nstructed...
188f0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
18900 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
18910 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 ists ::no(delete
18920 53 71 6c 69 74 65 46 69 6c 65 73 29 5d 7d 20 74 SqliteFiles)]} t
18930 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
18940 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
18950 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 ists ::no(delete
18960 53 71 6c 69 74 65 43 6f 6e 66 69 67 46 69 6c 65 SqliteConfigFile
18970 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
18980 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 forea
18990 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 63 6f 6e ch fileName $con
189a0 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a figFileNames {..
189b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
189c0 74 72 79 44 65 6c 65 74 65 42 69 6e 61 72 79 46 tryDeleteBinaryF
189d0 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 ile $fileName..
189e0 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
189f0 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d }...
18a00 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
18a10 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
18a20 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 65 :no(deleteSqlite
18a30 45 78 74 65 72 6e 61 6c 46 69 6c 65 73 29 5d 7d ExternalFiles)]}
18a40 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
18a50 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
18a60 69 6c 65 4e 61 6d 65 20 24 6d 64 61 43 6f 6e 66 ileName $mdaConf
18a70 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 igFileNames {..
18a80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
18a90 72 79 44 65 6c 65 74 65 42 75 69 6c 64 46 69 6c ryDeleteBuildFil
18aa0 65 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 e $fileName..
18ab0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
18ac0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
18ad0 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
18ae0 65 78 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 externalFileName
18af0 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
18b00 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 42 69 tryDeleteBi
18b10 6e 61 72 79 46 69 6c 65 20 24 66 69 6c 65 4e 61 naryFile $fileNa
18b20 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 me..
18b30 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
18b40 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
18b50 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
18b60 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 sts ::no(deleteS
18b70 71 6c 69 74 65 4e 61 74 69 76 65 46 69 6c 65 73 qliteNativeFiles
18b80 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 )]} then {..
18b90 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
18ba0 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
18bb0 28 64 65 6c 65 74 65 53 71 6c 69 74 65 49 6d 70 (deleteSqliteImp
18bc0 6c 69 63 69 74 46 69 6c 65 73 29 5d 7d 20 74 68 licitFiles)]} th
18bd0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
18be0 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 foreach fi
18bf0 6c 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 46 69 leName $nativeFi
18c00 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
18c10 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 try
18c20 44 65 6c 65 74 65 41 73 73 65 6d 62 6c 79 20 24 DeleteAssembly $
18c30 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 fileName..
18c40 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
18c50 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
18c60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
18c70 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
18c80 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 ::no(deleteSqlit
18c90 65 4e 6f 6e 49 6d 70 6c 69 63 69 74 46 69 6c 65 eNonImplicitFile
18ca0 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
18cb0 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
18cc0 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
18cd0 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 65 :no(deleteSqlite
18ce0 50 6c 61 74 66 6f 72 6d 46 69 6c 65 73 29 5d 20 PlatformFiles)]
18cf0 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
18d00 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
18d10 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 6f g length $platfo
18d20 72 6d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d rm] > 0} then {.
18d30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
18d40 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e foreach fileN
18d50 61 6d 65 20 24 6e 61 74 69 76 65 46 69 6c 65 4e ame $nativeFileN
18d60 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 ames {..
18d70 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 44 tryD
18d80 65 6c 65 74 65 41 73 73 65 6d 62 6c 79 20 24 66 eleteAssembly $f
18d90 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 ileName $platfor
18da0 6d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 m..
18db0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
18dc0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
18dd0 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
18de0 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
18df0 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 65 :no(deleteSqlite
18e00 41 72 63 68 69 74 65 63 74 75 72 65 46 69 6c 65 ArchitectureFile
18e10 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 s)] && \..
18e20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 73 [s
18e30 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 61 72 tring length $ar
18e40 63 68 69 74 65 63 74 75 72 65 5d 20 3e 20 30 7d chitecture] > 0}
18e50 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
18e60 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 forea
18e70 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6e 61 74 ch fileName $nat
18e80 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a iveFileNames {..
18e90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18ea0 20 20 20 20 74 72 79 44 65 6c 65 74 65 41 73 73 tryDeleteAss
18eb0 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 embly $fileName
18ec0 24 61 72 63 68 69 74 65 63 74 75 72 65 0d 0a 20 $architecture..
18ed0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18ee0 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
18ef0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
18f00 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
18f10 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
18f20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
18f30 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 exists ::no(dele
18f40 74 65 53 71 6c 69 74 65 4d 61 6e 61 67 65 64 46 teSqliteManagedF
18f50 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
18f60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
18f70 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
18f80 6d 61 6e 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 managedFileNames
18f90 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
18fa0 20 20 20 20 74 72 79 44 65 6c 65 74 65 41 73 73 tryDeleteAss
18fb0 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 0d embly $fileName.
18fc0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
18fd0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
18fe0 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a . }....
18ff0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
19000 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 # NOTE: C
19010 68 65 63 6b 20 66 6f 72 20 74 68 65 20 22 61 75 heck for the "au
19020 74 6f 53 65 6c 65 63 74 22 20 72 75 6e 74 69 6d toSelect" runtim
19030 65 20 6f 70 74 69 6f 6e 2e 20 20 49 66 20 70 72 e option. If pr
19040 65 73 65 6e 74 2c 0d 0a 20 20 20 20 20 20 20 20 esent,..
19050 20 20 23 20 20 20 20 20 20 20 61 74 74 65 6d 70 # attemp
19060 74 20 74 6f 20 61 75 74 6f 6d 61 74 69 63 61 6c t to automatical
19070 6c 79 20 73 65 6c 65 63 74 20 74 68 65 20 66 69 ly select the fi
19080 72 73 74 20 61 76 61 69 6c 61 62 6c 65 0d 0a 20 rst available..
19090 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
190a0 20 62 75 69 6c 64 20 28 6f 72 20 22 72 65 6c 65 build (or "rele
190b0 61 73 65 22 29 20 6f 66 20 53 51 4c 69 74 65 20 ase") of SQLite
190c0 61 6e 64 20 53 79 73 74 65 6d 2e 44 61 74 61 2e and System.Data.
190d0 53 51 4c 69 74 65 0d 0a 20 20 20 20 20 20 20 20 SQLite..
190e0 20 20 23 20 20 20 20 20 20 20 66 6f 72 20 75 73 # for us
190f0 65 20 77 69 74 68 20 74 68 65 20 74 65 73 74 20 e with the test
19100 73 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 20 20 suite...
19110 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 #.. i
19120 66 20 7b 5b 68 61 73 52 75 6e 74 69 6d 65 4f 70 f {[hasRuntimeOp
19130 74 69 6f 6e 20 61 75 74 6f 53 65 6c 65 63 74 5d tion autoSelect]
19140 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
19150 20 20 20 20 20 20 69 66 20 7b 21 5b 63 68 65 63 if {![chec
19160 6b 46 6f 72 53 51 4c 69 74 65 42 75 69 6c 64 73 kForSQLiteBuilds
19170 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
19180 20 74 72 75 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a true]} then {..
19190 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 68 ch
191a0 65 63 6b 46 6f 72 53 51 4c 69 74 65 52 65 6c 65 eckForSQLiteRele
191b0 61 73 65 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 ases $::test_cha
191c0 6e 6e 65 6c 20 74 72 75 65 0d 0a 20 20 20 20 20 nnel true..
191d0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
191e0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
191f0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
19200 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 74 72 79 # NOTE: Skip try
19210 69 6e 67 20 74 6f 20 76 65 72 69 66 79 20 74 68 ing to verify th
19220 65 20 62 75 69 6c 64 20 64 69 72 65 63 74 6f 72 e build director
19230 79 20 69 66 20 69 6e 73 74 72 75 63 74 65 64 3b y if instructed;
19240 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 .. #
19250 20 20 20 20 6f 74 68 65 72 77 69 73 65 2c 20 6d otherwise, m
19260 61 6b 65 20 73 75 72 65 20 69 74 20 61 63 74 75 ake sure it actu
19270 61 6c 6c 79 20 65 78 69 73 74 73 20 6f 72 20 68 ally exists or h
19280 61 6c 74 20 74 68 65 20 65 6e 74 69 72 65 0d 0a alt the entire..
19290 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
192a0 20 20 74 65 73 74 69 6e 67 20 70 72 6f 63 65 73 testing proces
192b0 73 20 69 66 20 69 74 20 64 6f 65 73 20 6e 6f 74 s if it does not
192c0 20 65 78 69 73 74 2e 0d 0a 20 20 20 20 20 20 20 exist...
192d0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
192e0 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
192f0 73 20 3a 3a 6e 6f 28 76 65 72 69 66 79 42 75 69 s ::no(verifyBui
19300 6c 64 44 69 72 65 63 74 6f 72 79 29 5d 7d 20 74 ldDirectory)]} t
19310 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
19320 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
19330 20 20 23 20 4e 4f 54 45 3a 20 41 74 20 74 68 69 # NOTE: At thi
19340 73 20 70 6f 69 6e 74 2c 20 74 68 65 20 62 75 69 s point, the bui
19350 6c 64 20 64 69 72 65 63 74 6f 72 79 20 4d 55 53 ld directory MUS
19360 54 20 65 78 69 73 74 20 61 73 20 61 0d 0a 20 20 T exist as a..
19370 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
19380 20 20 76 61 6c 69 64 20 64 69 72 65 63 74 6f 72 valid director
19390 79 20 66 6f 72 20 74 68 65 20 74 65 73 74 69 6e y for the testin
193a0 67 20 70 72 6f 63 65 73 73 20 74 6f 20 63 6f 6e g process to con
193b0 74 69 6e 75 65 2e 0d 0a 20 20 20 20 20 20 20 20 tinue...
193c0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
193d0 20 20 20 73 65 74 20 64 69 72 65 63 74 6f 72 79 set directory
193e0 20 5b 67 65 74 42 75 69 6c 64 44 69 72 65 63 74 [getBuildDirect
193f0 6f 72 79 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ory]....
19400 20 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 if {![file e
19410 78 69 73 74 73 20 24 64 69 72 65 63 74 6f 72 79 xists $directory
19420 5d 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] || \..
19430 20 20 20 20 20 20 20 20 21 5b 66 69 6c 65 20 69 ![file i
19440 73 64 69 72 65 63 74 6f 72 79 20 24 64 69 72 65 sdirectory $dire
19450 63 74 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a ctory]} then {..
19460 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
19470 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
19480 20 4e 4f 54 45 3a 20 4a 75 73 74 20 70 72 69 6f NOTE: Just prio
19490 72 20 74 6f 20 61 63 74 75 61 6c 6c 79 20 68 61 r to actually ha
194a0 6c 74 69 6e 67 20 74 68 65 20 74 65 73 74 69 6e lting the testin
194b0 67 20 70 72 6f 63 65 73 73 2c 0d 0a 20 20 20 20 g process,..
194c0 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
194d0 20 20 61 64 64 20 61 6e 20 65 72 72 6f 72 20 74 add an error t
194e0 6f 20 74 68 65 20 74 65 73 74 20 6c 6f 67 20 66 o the test log f
194f0 69 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ile...
19500 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
19510 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
19520 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
19530 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
19540 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
19550 2d 20 63 6f 75 6c 64 20 6e 6f 74 20 76 65 72 69 - could not veri
19560 66 79 20 62 75 69 6c 64 20 64 69 72 65 63 74 6f fy build directo
19570 72 79 20 5c 22 22 20 24 64 69 72 65 63 74 6f 72 ry \"" $director
19580 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 y \..
19590 20 20 20 20 20 20 20 22 5c 22 2c 20 61 6c 6c 20 "\", all
195a0 74 65 73 74 69 6e 67 20 68 61 6c 74 65 64 5c 6e testing halted\n
195b0 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 "]....
195c0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
195d0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 61 69 # NOTE: Rai
195e0 73 69 6e 67 20 61 20 73 63 72 69 70 74 20 65 72 sing a script er
195f0 72 6f 72 20 66 72 6f 6d 20 74 68 69 73 20 70 6f ror from this po
19600 69 6e 74 20 73 68 6f 75 6c 64 20 68 61 6c 74 0d int should halt.
19610 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
19620 20 20 20 20 20 20 20 74 68 65 20 74 65 73 74 69 the testi
19630 6e 67 20 70 72 6f 63 65 73 73 2e 0d 0a 20 20 20 ng process...
19640 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
19650 20 20 20 20 20 20 20 20 20 20 20 20 65 72 72 6f erro
19660 72 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d r [appendArgs \.
19670 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
19680 20 20 20 22 63 6f 75 6c 64 20 6e 6f 74 20 76 65 "could not ve
19690 72 69 66 79 20 62 75 69 6c 64 20 64 69 72 65 63 rify build direc
196a0 74 6f 72 79 20 5c 22 22 20 24 64 69 72 65 63 74 tory \"" $direct
196b0 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ory \..
196c0 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 61 6c "\", al
196d0 6c 20 74 65 73 74 69 6e 67 20 68 61 6c 74 65 64 l testing halted
196e0 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 "]..
196f0 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
19700 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
19710 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
19720 20 53 6b 69 70 20 74 72 79 69 6e 67 20 74 6f 20 Skip trying to
19730 63 6f 70 79 20 61 6e 79 20 66 69 6c 65 73 20 69 copy any files i
19740 66 20 69 6e 73 74 72 75 63 74 65 64 2e 0d 0a 20 f instructed...
19750 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
19760 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
19770 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 exists ::no(cop
19780 79 53 71 6c 69 74 65 46 69 6c 65 73 29 5d 7d 20 ySqliteFiles)]}
19790 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
197a0 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
197b0 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 xists ::no(copyS
197c0 71 6c 69 74 65 43 6f 6e 66 69 67 46 69 6c 65 73 qliteConfigFiles
197d0 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 )]} then {..
197e0 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 foreac
197f0 68 20 66 69 6c 65 4e 61 6d 65 20 24 63 6f 6e 66 h fileName $conf
19800 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 igFileNames {..
19810 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
19820 72 79 43 6f 70 79 42 75 69 6c 64 46 69 6c 65 20 ryCopyBuildFile
19830 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 $fileName..
19840 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
19850 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
19860 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
19870 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
19880 63 6f 70 79 53 71 6c 69 74 65 45 78 74 65 72 6e copySqliteExtern
19890 61 6c 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 alFiles)]} then
198a0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
198b0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
198c0 20 20 23 20 4e 4f 54 45 3a 20 43 6f 70 79 20 74 # NOTE: Copy t
198d0 68 65 20 4d 61 6e 61 67 65 64 20 44 65 62 75 67 he Managed Debug
198e0 67 69 6e 67 20 41 73 73 69 73 74 61 6e 74 73 20 ging Assistants
198f0 28 4d 44 41 29 20 63 6f 6e 66 69 67 75 72 61 74 (MDA) configurat
19900 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ion..
19910 20 20 20 23 20 20 20 20 20 20 20 66 69 6c 65 20 # file
19920 66 6f 72 20 74 68 65 20 45 61 67 6c 65 20 73 68 for the Eagle sh
19930 65 6c 6c 20 74 6f 20 74 68 65 20 62 75 69 6c 64 ell to the build
19940 20 6f 75 74 70 75 74 20 64 69 72 65 63 74 6f 72 output director
19950 79 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 y,..
19960 20 20 23 20 20 20 20 20 20 20 77 68 69 6c 65 20 # while
19970 75 73 69 6e 67 20 65 61 63 68 20 6f 66 20 74 68 using each of th
19980 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 20 76 e names of the v
19990 61 72 69 6f 75 73 20 6c 65 67 61 63 79 20 74 65 arious legacy te
199a0 73 74 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 st..
199b0 20 20 23 20 20 20 20 20 20 20 65 78 65 63 75 74 # execut
199c0 61 62 6c 65 73 2e 20 20 54 68 69 73 20 77 69 6c ables. This wil
199d0 6c 20 68 65 6c 70 20 74 6f 20 6d 61 6b 65 20 73 l help to make s
199e0 75 72 65 20 74 68 61 74 20 61 6c 6c 20 74 68 65 ure that all the
199f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
19a00 23 20 20 20 20 20 20 20 6c 65 67 61 63 79 20 74 # legacy t
19a10 65 73 74 73 20 72 75 6e 20 77 69 74 68 20 65 78 ests run with ex
19a20 61 63 74 6c 79 20 74 68 65 20 73 61 6d 65 20 73 actly the same s
19a30 65 74 20 6f 66 20 4d 61 6e 61 67 65 64 0d 0a 20 et of Managed..
19a40 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 #
19a50 20 20 20 20 20 44 65 62 75 67 67 69 6e 67 20 41 Debugging A
19a60 73 73 69 73 74 61 6e 74 73 20 63 6f 6e 66 69 67 ssistants config
19a70 75 72 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 ured...
19a80 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
19a90 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 foreach fi
19aa0 6c 65 4e 61 6d 65 20 24 6d 64 61 43 6f 6e 66 69 leName $mdaConfi
19ab0 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 gFileNames {..
19ac0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 tr
19ad0 79 43 6f 70 79 42 69 6e 61 72 79 46 69 6c 65 20 yCopyBinaryFile
19ae0 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 2e 6d EagleShell.exe.m
19af0 64 61 2e 63 6f 6e 66 69 67 20 22 22 20 24 66 69 da.config "" $fi
19b00 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 leName..
19b10 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
19b20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
19b30 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
19b40 3a 20 43 6f 70 79 20 74 68 65 20 65 78 74 65 72 : Copy the exter
19b50 6e 61 6c 20 62 69 6e 61 72 69 65 73 2c 20 69 66 nal binaries, if
19b60 20 61 6e 79 2c 20 74 6f 20 74 68 65 20 64 69 72 any, to the dir
19b70 65 63 74 6f 72 79 20 74 68 61 74 0d 0a 20 20 20 ectory that..
19b80 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 #
19b90 20 20 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 contains the
19ba0 45 61 67 6c 65 20 73 68 65 6c 6c 2e 20 20 54 68 Eagle shell. Th
19bb0 69 73 20 69 73 20 74 79 70 69 63 61 6c 6c 79 20 is is typically
19bc0 75 73 65 64 20 74 6f 20 6d 61 6b 65 0d 0a 20 20 used to make..
19bd0 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 #
19be0 20 20 20 20 73 75 72 65 20 61 73 73 65 6d 62 6c sure assembl
19bf0 69 65 73 20 72 65 66 65 72 65 6e 63 65 64 20 62 ies referenced b
19c00 79 20 74 68 65 20 6f 6e 65 73 20 62 65 69 6e 67 y the ones being
19c10 20 74 65 73 74 65 64 20 61 72 65 0d 0a 20 20 20 tested are..
19c20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 #
19c30 20 20 20 61 76 61 69 6c 61 62 6c 65 20 64 75 72 available dur
19c40 69 6e 67 20 74 68 65 20 74 65 73 74 69 6e 67 20 ing the testing
19c50 70 72 6f 63 65 73 73 2e 0d 0a 20 20 20 20 20 20 process...
19c60 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
19c70 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 foreach
19c80 20 66 69 6c 65 4e 61 6d 65 20 24 65 78 74 65 72 fileName $exter
19c90 6e 61 6c 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a nalFileNames {..
19ca0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19cb0 74 72 79 43 6f 70 79 45 78 74 65 72 6e 61 6c 46 tryCopyExternalF
19cc0 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 ile $fileName..
19cd0 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
19ce0 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d }...
19cf0 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
19d00 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
19d10 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 4e 61 :no(copySqliteNa
19d20 74 69 76 65 46 69 6c 65 73 29 5d 7d 20 74 68 65 tiveFiles)]} the
19d30 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
19d40 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
19d50 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 # NOTE: If t
19d60 68 65 20 74 65 73 74 20 70 6c 61 74 66 6f 72 6d he test platform
19d70 20 69 73 20 6c 69 6b 65 6c 79 20 74 68 65 20 64 is likely the d
19d80 65 66 61 75 6c 74 20 66 6f 72 20 74 68 69 73 0d efault for this.
19d90 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
19da0 20 20 20 20 20 20 20 6d 61 63 68 69 6e 65 2c 20 machine,
19db0 61 6c 73 6f 20 74 72 79 20 74 6f 20 63 6f 70 79 also try to copy
19dc0 20 74 68 65 20 6e 61 74 69 76 65 20 66 69 6c 65 the native file
19dd0 73 20 74 6f 20 74 68 65 0d 0a 20 20 20 20 20 20 s to the..
19de0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
19df0 62 69 6e 61 72 79 20 6c 6f 63 61 74 69 6f 6e 2e binary location.
19e00 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
19e10 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 #..
19e20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
19e30 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 ts ::no(copySqli
19e40 74 65 49 6d 70 6c 69 63 69 74 46 69 6c 65 73 29 teImplicitFiles)
19e50 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] && \..
19e60 20 20 20 20 20 20 20 20 20 20 5b 69 73 44 65 66 [isDef
19e70 61 75 6c 74 42 75 69 6c 64 50 6c 61 74 66 6f 72 aultBuildPlatfor
19e80 6d 20 74 72 75 65 5d 7d 20 74 68 65 6e 20 7b 0d m true]} then {.
19e90 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
19ea0 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d foreach fileNam
19eb0 65 20 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d e $nativeFileNam
19ec0 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
19ed0 20 20 20 20 20 20 20 20 74 72 79 43 6f 70 79 41 tryCopyA
19ee0 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d ssembly $fileNam
19ef0 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e..
19f00 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
19f10 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
19f20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
19f30 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f o exists ::no(co
19f40 70 79 53 71 6c 69 74 65 4e 6f 6e 49 6d 70 6c 69 pySqliteNonImpli
19f50 63 69 74 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e citFiles)]} then
19f60 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
19f70 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
19f80 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 xists ::no(copyS
19f90 71 6c 69 74 65 50 6c 61 74 66 6f 72 6d 46 69 6c qlitePlatformFil
19fa0 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 es)] && \..
19fb0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b [
19fc0 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 string length $p
19fd0 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 latform] > 0} th
19fe0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
19ff0 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
1a000 66 69 6c 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 fileName $native
1a010 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 FileNames {..
1a020 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a030 20 74 72 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 tryCopyAssembly
1a040 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 $fileName $plat
1a050 66 6f 72 6d 0d 0a 20 20 20 20 20 20 20 20 20 20 form..
1a060 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1a070 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
1a080 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a090 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
1a0a0 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 s ::no(copySqlit
1a0b0 65 41 72 63 68 69 74 65 63 74 75 72 65 46 69 6c eArchitectureFil
1a0c0 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 es)] && \..
1a0d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b [
1a0e0 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 61 string length $a
1a0f0 72 63 68 69 74 65 63 74 75 72 65 5d 20 3e 20 30 rchitecture] > 0
1a100 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1a110 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 fore
1a120 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6e 61 ach fileName $na
1a130 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d tiveFileNames {.
1a140 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1a150 20 20 20 20 20 74 72 79 43 6f 70 79 41 73 73 65 tryCopyAsse
1a160 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 24 mbly $fileName $
1a170 61 72 63 68 69 74 65 63 74 75 72 65 0d 0a 20 20 architecture..
1a180 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a190 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 }..
1a1a0 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
1a1b0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
1a1c0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1a1d0 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
1a1e0 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 xists ::no(copyS
1a1f0 71 6c 69 74 65 4d 61 6e 61 67 65 64 46 69 6c 65 qliteManagedFile
1a200 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
1a210 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 forea
1a220 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d 61 6e ch fileName $man
1a230 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d agedFileNames {.
1a240 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1a250 20 74 72 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 tryCopyAssembly
1a260 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 $fileName..
1a270 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1a280 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1a290 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1a2a0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1a2b0 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 74 # NOTE: Skip t
1a2c0 72 79 69 6e 67 20 74 6f 20 6c 6f 61 64 20 61 6e rying to load an
1a2d0 79 20 66 69 6c 65 73 20 69 66 20 69 6e 73 74 72 y files if instr
1a2e0 75 63 74 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 ucted...
1a2f0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 #.. i
1a300 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
1a310 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 65 ::no(loadSqlite
1a320 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d Files)]} then {.
1a330 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
1a340 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
1a350 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 65 49 6d :no(loadSqliteIm
1a360 70 6c 69 63 69 74 46 69 6c 65 73 29 5d 7d 20 74 plicitFiles)]} t
1a370 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1a380 20 20 20 20 20 74 72 79 4c 6f 61 64 41 73 73 65 tryLoadAsse
1a390 6d 62 6c 79 20 53 79 73 74 65 6d 2e 44 61 74 61 mbly System.Data
1a3a0 2e 53 51 4c 69 74 65 2e 64 6c 6c 0d 0a 20 20 20 .SQLite.dll..
1a3b0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
1a3c0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
1a3d0 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
1a3e0 28 6c 6f 61 64 53 71 6c 69 74 65 4c 69 6e 71 46 (loadSqliteLinqF
1a3f0 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
1a400 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 tr
1a410 79 4c 6f 61 64 41 73 73 65 6d 62 6c 79 20 53 79 yLoadAssembly Sy
1a420 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
1a430 2e 4c 69 6e 71 2e 64 6c 6c 0d 0a 20 20 20 20 20 .Linq.dll..
1a440 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1a450 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
1a460 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 6c fo exists ::no(l
1a470 6f 61 64 53 71 6c 69 74 65 45 66 36 46 69 6c 65 oadSqliteEf6File
1a480 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
1a490 20 20 20 20 20 20 20 20 20 20 20 74 72 79 4c 6f tryLo
1a4a0 61 64 41 73 73 65 6d 62 6c 79 20 53 79 73 74 65 adAssembly Syste
1a4b0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 45 46 m.Data.SQLite.EF
1a4c0 36 2e 64 6c 6c 0d 0a 20 20 20 20 20 20 20 20 20 6.dll..
1a4d0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1a4e0 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
1a4f0 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 xists ::no(loadS
1a500 71 6c 69 74 65 4e 6f 6e 49 6d 70 6c 69 63 69 74 qliteNonImplicit
1a510 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d Files)]} then {.
1a520 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 . i
1a530 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
1a540 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 65 ::no(loadSqlite
1a550 50 6c 61 74 66 6f 72 6d 46 69 6c 65 73 29 5d 20 PlatformFiles)]
1a560 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
1a570 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
1a580 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 6d length $platform
1a590 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
1a5a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
1a5b0 72 79 4c 6f 61 64 41 73 73 65 6d 62 6c 79 20 53 ryLoadAssembly S
1a5c0 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1a5d0 65 2e 64 6c 6c 20 24 70 6c 61 74 66 6f 72 6d 0d e.dll $platform.
1a5e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
1a5f0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
1a600 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
1a610 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c sts ::no(loadSql
1a620 69 74 65 41 72 63 68 69 74 65 63 74 75 72 65 46 iteArchitectureF
1a630 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 iles)] && \..
1a640 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b [
1a650 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 61 string length $a
1a660 72 63 68 69 74 65 63 74 75 72 65 5d 20 3e 20 30 rchitecture] > 0
1a670 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1a680 20 20 20 20 20 20 20 20 20 20 74 72 79 4c 6f 61 tryLoa
1a690 64 41 73 73 65 6d 62 6c 79 20 53 79 73 74 65 6d dAssembly System
1a6a0 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c .Data.SQLite.dll
1a6b0 20 24 61 72 63 68 69 74 65 63 74 75 72 65 0d 0a $architecture..
1a6c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
1a6d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
1a6e0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1a6f0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1a700 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 catch {..
1a710 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1a720 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
1a730 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1a740 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 "---- fi
1a750 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 le version of \"
1a760 73 71 6c 69 74 65 33 2e 64 6c 6c 5c 22 2e 2e 2e sqlite3.dll\"...
1a770 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 " \..
1a780 20 20 20 20 5b 66 69 6c 65 20 76 65 72 73 69 6f [file versio
1a790 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 n [getBinaryFile
1a7a0 4e 61 6d 65 20 73 71 6c 69 74 65 33 2e 64 6c 6c Name sqlite3.dll
1a7b0 5d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 ]] \n]..
1a7c0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 63 61 74 }.... cat
1a7d0 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
1a7e0 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
1a7f0 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
1a800 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
1a810 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 "---- file ve
1a820 72 73 69 6f 6e 20 6f 66 20 5c 22 53 51 4c 69 74 rsion of \"SQLit
1a830 65 2e 49 6e 74 65 72 6f 70 2e 64 6c 6c 5c 22 2e e.Interop.dll\".
1a840 2e 2e 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 .. " \..
1a850 20 20 20 20 20 20 5b 66 69 6c 65 20 76 65 72 73 [file vers
1a860 69 6f 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 69 ion [getBinaryFi
1a870 6c 65 4e 61 6d 65 20 53 51 4c 69 74 65 2e 49 6e leName SQLite.In
1a880 74 65 72 6f 70 2e 64 6c 6c 5d 5d 20 5c 6e 5d 0d terop.dll]] \n].
1a890 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
1a8a0 20 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 catch {..
1a8b0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1a8c0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
1a8d0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1a8e0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
1a8f0 2d 20 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f - file version o
1a900 66 20 5c 22 53 79 73 74 65 6d 2e 44 61 74 61 2e f \"System.Data.
1a910 53 51 4c 69 74 65 2e 64 6c 6c 5c 22 2e 2e 2e 20 SQLite.dll\"...
1a920 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
1a930 20 20 20 5b 66 69 6c 65 20 76 65 72 73 69 6f 6e [file version
1a940 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e [getBinaryFileN
1a950 61 6d 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e ame System.Data.
1a960 53 51 4c 69 74 65 2e 64 6c 6c 5d 5d 20 5c 6e 5d SQLite.dll]] \n]
1a970 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
1a980 20 20 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a catch {..
1a990 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
1a9a0 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
1a9b0 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
1a9c0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
1a9d0 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 -- file version
1a9e0 6f 66 20 5c 22 53 79 73 74 65 6d 2e 44 61 74 61 of \"System.Data
1a9f0 2e 53 51 4c 69 74 65 2e 4c 69 6e 71 2e 64 6c 6c .SQLite.Linq.dll
1aa00 5c 22 2e 2e 2e 20 22 20 5c 0d 0a 20 20 20 20 20 \"... " \..
1aa10 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 76 [file v
1aa20 65 72 73 69 6f 6e 20 5b 67 65 74 42 69 6e 61 72 ersion [getBinar
1aa30 79 46 69 6c 65 4e 61 6d 65 20 53 79 73 74 65 6d yFileName System
1aa40 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 4c 69 6e .Data.SQLite.Lin
1aa50 71 2e 64 6c 6c 5d 5d 20 5c 6e 5d 0d 0a 20 20 20 q.dll]] \n]..
1aa60 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1aa70 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 catch {..
1aa80 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1aa90 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
1aaa0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1aab0 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 "---- fi
1aac0 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 le version of \"
1aad0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
1aae0 74 65 2e 45 46 36 2e 64 6c 6c 5c 22 2e 2e 2e 20 te.EF6.dll\"...
1aaf0 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
1ab00 20 20 20 5b 66 69 6c 65 20 76 65 72 73 69 6f 6e [file version
1ab10 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e [getBinaryFileN
1ab20 61 6d 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e ame System.Data.
1ab30 53 51 4c 69 74 65 2e 45 46 36 2e 64 6c 6c 5d 5d SQLite.EF6.dll]]
1ab40 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d \n].. }.
1ab50 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b ... if {[
1ab60 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 string length $p
1ab70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 latform] > 0} th
1ab80 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1ab90 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
1aba0 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1abb0 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
1abc0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1abd0 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1abe0 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 file version of
1abf0 5c 22 22 20 24 70 6c 61 74 66 6f 72 6d 20 5c 0d \"" $platform \.
1ac00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1ac10 20 22 2f 73 71 6c 69 74 65 33 2e 64 6c 6c 5c 22 "/sqlite3.dll\"
1ac20 2e 2e 2e 20 22 20 5b 66 69 6c 65 20 76 65 72 73 ... " [file vers
1ac30 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ion \..
1ac40 20 20 20 20 20 20 20 5b 67 65 74 42 69 6e 61 72 [getBinar
1ac50 79 46 69 6c 65 4e 61 6d 65 20 73 71 6c 69 74 65 yFileName sqlite
1ac60 33 2e 64 6c 6c 20 24 70 6c 61 74 66 6f 72 6d 5d 3.dll $platform]
1ac70 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 ] \n]..
1ac80 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
1ac90 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
1aca0 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1acb0 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
1acc0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1acd0 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1ace0 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 file version of
1acf0 5c 22 22 20 24 70 6c 61 74 66 6f 72 6d 20 5c 0d \"" $platform \.
1ad00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1ad10 20 22 2f 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f "/SQLite.Intero
1ad20 70 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 20 5b 66 69 p.dll\"... " [fi
1ad30 6c 65 20 76 65 72 73 69 6f 6e 20 5c 0d 0a 20 20 le version \..
1ad40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 [g
1ad50 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 etBinaryFileName
1ad60 20 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f 70 2e SQLite.Interop.
1ad70 64 6c 6c 20 24 70 6c 61 74 66 6f 72 6d 5d 5d 20 dll $platform]]
1ad80 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
1ad90 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 63 61 .... ca
1ada0 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
1adb0 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
1adc0 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
1add0 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1ade0 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 "---- fi
1adf0 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 le version of \"
1ae00 22 20 24 70 6c 61 74 66 6f 72 6d 20 5c 0d 0a 20 " $platform \..
1ae10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1ae20 2f 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c /System.Data.SQL
1ae30 69 74 65 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 20 5b ite.dll\"... " [
1ae40 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 5c 0d 0a file version \..
1ae50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ae60 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 [getBinaryFileNa
1ae70 6d 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 me System.Data.S
1ae80 51 4c 69 74 65 2e 64 6c 6c 20 24 70 6c 61 74 66 QLite.dll $platf
1ae90 6f 72 6d 5d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 orm]] \n]..
1aea0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1aeb0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 }.... if
1aec0 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
1aed0 24 61 72 63 68 69 74 65 63 74 75 72 65 5d 20 3e $architecture] >
1aee0 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
1aef0 20 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 catch {..
1af00 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
1af10 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
1af20 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1af30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1af40 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 "---- file versi
1af50 6f 6e 20 6f 66 20 5c 22 22 20 24 61 72 63 68 69 on of \"" $archi
1af60 74 65 63 74 75 72 65 20 5c 0d 0a 20 20 20 20 20 tecture \..
1af70 20 20 20 20 20 20 20 20 20 20 20 22 2f 73 71 6c "/sql
1af80 69 74 65 33 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 20 ite3.dll\"... "
1af90 5b 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 5c 0d [file version \.
1afa0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1afb0 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e [getBinaryFileN
1afc0 61 6d 65 20 73 71 6c 69 74 65 33 2e 64 6c 6c 20 ame sqlite3.dll
1afd0 24 61 72 63 68 69 74 65 63 74 75 72 65 5d 5d 20 $architecture]]
1afe0 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
1aff0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 63 61 .... ca
1b000 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
1b010 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
1b020 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
1b030 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1b040 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 "---- fi
1b050 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 le version of \"
1b060 22 20 24 61 72 63 68 69 74 65 63 74 75 72 65 20 " $architecture
1b070 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1b080 20 20 20 22 2f 53 51 4c 69 74 65 2e 49 6e 74 65 "/SQLite.Inte
1b090 72 6f 70 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 20 5b rop.dll\"... " [
1b0a0 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 5c 0d 0a file version \..
1b0b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b0c0 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 [getBinaryFileNa
1b0d0 6d 65 20 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f me SQLite.Intero
1b0e0 70 2e 64 6c 6c 20 24 61 72 63 68 69 74 65 63 74 p.dll $architect
1b0f0 75 72 65 5d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 ure]] \n]..
1b100 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1b110 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 catch {..
1b120 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1b130 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
1b140 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1b150 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
1b160 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 6f 6e --- file version
1b170 20 6f 66 20 5c 22 22 20 24 61 72 63 68 69 74 65 of \"" $archite
1b180 63 74 75 72 65 20 5c 0d 0a 20 20 20 20 20 20 20 cture \..
1b190 20 20 20 20 20 20 20 20 20 22 2f 53 79 73 74 65 "/Syste
1b1a0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c m.Data.SQLite.dl
1b1b0 6c 5c 22 2e 2e 2e 20 22 20 5b 66 69 6c 65 20 76 l\"... " [file v
1b1c0 65 72 73 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 ersion \..
1b1d0 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 69 [getBi
1b1e0 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 53 79 73 naryFileName Sys
1b1f0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
1b200 64 6c 6c 20 24 61 72 63 68 69 74 65 63 74 75 72 dll $architectur
1b210 65 5d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 e]] \n]..
1b220 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
1b230 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
1b240 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 47 72 # NOTE: Gr
1b250 61 62 20 74 68 65 20 6c 69 73 74 20 6f 66 20 6d ab the list of m
1b260 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 69 65 anaged assemblie
1b270 73 20 66 6f 72 20 74 68 65 20 63 75 72 72 65 6e s for the curren
1b280 74 20 70 72 6f 63 65 73 73 0d 0a 20 20 20 20 20 t process..
1b290 20 20 20 23 20 20 20 20 20 20 20 61 6e 64 20 72 # and r
1b2a0 65 70 6f 72 74 20 6f 6e 20 74 68 65 20 53 79 73 eport on the Sys
1b2b0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
1b2c0 72 65 6c 61 74 65 64 20 6f 6e 65 73 2e 0d 0a 20 related ones...
1b2d0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1b2e0 20 20 73 65 74 20 61 73 73 65 6d 62 6c 69 65 73 set assemblies
1b2f0 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 [object invoke
1b300 41 70 70 44 6f 6d 61 69 6e 2e 43 75 72 72 65 6e AppDomain.Curren
1b310 74 44 6f 6d 61 69 6e 20 47 65 74 41 73 73 65 6d tDomain GetAssem
1b320 62 6c 69 65 73 5d 0d 0a 0d 0a 20 20 20 20 20 20 blies]....
1b330 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 61 63 68 object foreach
1b340 20 61 73 73 65 6d 62 6c 79 20 24 61 73 73 65 6d assembly $assem
1b350 62 6c 69 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 blies {..
1b360 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6d if {[string m
1b370 61 74 63 68 20 5c 7b 53 79 73 74 65 6d 2e 44 61 atch \{System.Da
1b380 74 61 2e 53 51 4c 69 74 65 2a 20 24 61 73 73 65 ta.SQLite* $asse
1b390 6d 62 6c 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 mbly]} then {..
1b3a0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
1b3b0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
1b3c0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1b3d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b3e0 22 2d 2d 2d 2d 20 66 6f 75 6e 64 20 6c 6f 61 64 "---- found load
1b3f0 65 64 20 61 73 73 65 6d 62 6c 79 3a 20 22 20 24 ed assembly: " $
1b400 61 73 73 65 6d 62 6c 79 20 5c 6e 5d 0d 0a 20 20 assembly \n]..
1b410 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1b420 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1b430 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
1b440 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
1b450 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 _channel \..
1b460 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1b470 64 65 66 69 6e 65 20 63 6f 6e 73 74 61 6e 74 73 define constants
1b480 20 66 6f 72 20 5c 22 53 79 73 74 65 6d 2e 44 61 for \"System.Da
1b490 74 61 2e 53 51 4c 69 74 65 5c 22 2e 2e 2e 20 22 ta.SQLite\"... "
1b4a0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 .... if
1b4b0 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
1b4c0 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 object i
1b4d0 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f nvoke -flags +No
1b4e0 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 nPublic \..
1b4f0 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 Syste
1b500 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 m.Data.SQLite.SQ
1b510 4c 69 74 65 33 20 44 65 66 69 6e 65 43 6f 6e 73 Lite3 DefineCons
1b520 74 61 6e 74 73 0d 0a 20 20 20 20 20 20 20 20 20 tants..
1b530 20 7d 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e } defineConstan
1b540 74 73 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b ts] == 0} then {
1b550 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
1b560 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
1b570 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1b580 5b 66 6f 72 6d 61 74 4c 69 73 74 20 5b 6c 73 6f [formatList [lso
1b590 72 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 rt \..
1b5a0 20 20 20 20 20 20 24 64 65 66 69 6e 65 43 6f 6e $defineCon
1b5b0 73 74 61 6e 74 73 5d 20 3c 6e 6f 6e 65 3e 5d 20 stants] <none>]
1b5c0 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
1b5d0 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
1b5e0 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1b5f0 73 74 5f 63 68 61 6e 6e 65 6c 20 75 6e 6b 6e 6f st_channel unkno
1b600 77 6e 5c 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 wn\n..
1b610 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
1b620 20 20 20 20 20 20 20 20 63 61 74 63 68 20 7b 0d catch {.
1b630 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
1b640 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
1b650 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1b660 20 20 22 2d 2d 2d 2d 20 73 6f 75 72 63 65 20 76 "---- source v
1b670 65 72 73 69 6f 6e 20 6f 66 20 5c 22 53 79 73 74 ersion of \"Syst
1b680 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 em.Data.SQLite.d
1b690 6c 6c 5c 22 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 ll\"... "....
1b6a0 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
1b6b0 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 h {..
1b6c0 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
1b6d0 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
1b6e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1b6f0 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e System.Data.
1b700 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 43 6f 6e SQLite.SQLiteCon
1b710 6e 65 63 74 69 6f 6e 20 50 72 6f 76 69 64 65 72 nection Provider
1b720 56 65 72 73 69 6f 6e 0d 0a 20 20 20 20 20 20 20 Version..
1b730 20 20 20 7d 20 76 65 72 73 69 6f 6e 5d 20 3d 3d } version] ==
1b740 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
1b750 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 if {[str
1b760 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 65 72 73 ing length $vers
1b770 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ion] == 0} then
1b780 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1b790 20 73 65 74 20 76 65 72 73 69 6f 6e 20 6e 75 6c set version nul
1b7a0 6c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d l.. }
1b7b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
1b7c0 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
1b7d0 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1b7e0 24 76 65 72 73 69 6f 6e 20 5c 6e 5d 0d 0a 20 20 $version \n]..
1b7f0 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
1b800 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
1b810 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
1b820 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d 0a 20 nel unknown\n..
1b830 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1b840 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
1b850 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 catch {..
1b860 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
1b870 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 t_channel \..
1b880 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
1b890 20 73 6f 75 72 63 65 20 63 68 65 63 6b 6f 75 74 source checkout
1b8a0 20 6f 66 20 5c 22 53 79 73 74 65 6d 2e 44 61 74 of \"System.Dat
1b8b0 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5c 22 2e 2e a.SQLite.dll\"..
1b8c0 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 . "....
1b8d0 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
1b8e0 20 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 objec
1b8f0 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 t invoke -flags
1b900 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 +NonPublic \..
1b910 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 Sy
1b920 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
1b930 2e 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f .SQLiteConnectio
1b940 6e 20 50 72 6f 76 69 64 65 72 53 6f 75 72 63 65 n ProviderSource
1b950 49 64 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 Id.. }
1b960 73 6f 75 72 63 65 49 64 5d 20 3d 3d 20 30 7d 20 sourceId] == 0}
1b970 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1b980 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
1b990 6c 65 6e 67 74 68 20 24 73 6f 75 72 63 65 49 64 length $sourceId
1b9a0 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
1b9b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 se
1b9c0 74 20 73 6f 75 72 63 65 49 64 20 6e 75 6c 6c 0d t sourceId null.
1b9d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
1b9e0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1b9f0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
1ba00 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 73 l [appendArgs $s
1ba10 6f 75 72 63 65 49 64 20 5c 6e 5d 0d 0a 20 20 20 ourceId \n]..
1ba20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
1ba30 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
1ba40 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
1ba50 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d 0a 20 20 el unknown\n..
1ba60 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1ba70 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1ba80 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1ba90 45 3a 20 43 68 65 63 6b 20 74 68 65 20 61 76 61 E: Check the ava
1baa0 69 6c 61 62 6c 65 20 62 75 69 6c 64 73 20 28 61 ilable builds (a
1bab0 6e 64 20 22 72 65 6c 65 61 73 65 73 22 29 20 6f nd "releases") o
1bac0 66 20 53 51 4c 69 74 65 20 61 6e 64 0d 0a 20 20 f SQLite and..
1bad0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 53 79 # Sy
1bae0 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
1baf0 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
1bb00 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 53 51 checkForSQ
1bb10 4c 69 74 65 42 75 69 6c 64 73 20 24 3a 3a 74 65 LiteBuilds $::te
1bb20 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 20 20 20 20 st_channel..
1bb30 20 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 checkForSQLi
1bb40 74 65 52 65 6c 65 61 73 65 73 20 24 3a 3a 74 65 teReleases $::te
1bb50 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 st_channel....
1bb60 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1bb70 20 23 20 4e 4f 54 45 3a 20 4e 6f 77 2c 20 77 65 # NOTE: Now, we
1bb80 20 6e 65 65 64 20 74 6f 20 6b 6e 6f 77 20 69 66 need to know if
1bb90 20 74 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 the SQLite core
1bba0 20 6c 69 62 72 61 72 79 20 69 73 20 61 76 61 69 library is avai
1bbb0 6c 61 62 6c 65 0d 0a 20 20 20 20 20 20 20 20 23 lable.. #
1bbc0 20 20 20 20 20 20 20 28 69 2e 65 2e 20 62 65 63 (i.e. bec
1bbd0 61 75 73 65 20 74 68 65 20 6d 61 6e 61 67 65 64 ause the managed
1bbe0 2d 6f 6e 6c 79 20 53 79 73 74 65 6d 2e 44 61 74 -only System.Dat
1bbf0 61 2e 53 51 4c 69 74 65 20 61 73 73 65 6d 62 6c a.SQLite assembl
1bc00 79 20 63 61 6e 0d 0a 20 20 20 20 20 20 20 20 23 y can.. #
1bc10 20 20 20 20 20 20 20 6c 6f 61 64 20 77 69 74 68 load with
1bc20 6f 75 74 20 69 74 3b 20 68 6f 77 65 76 65 72 2c out it; however,
1bc30 20 69 74 20 63 61 6e 6e 6f 74 20 64 6f 20 61 6e it cannot do an
1bc40 79 74 68 69 6e 67 20 75 73 65 66 75 6c 20 77 69 ything useful wi
1bc50 74 68 6f 75 74 0d 0a 20 20 20 20 20 20 20 20 23 thout.. #
1bc60 20 20 20 20 20 20 20 69 74 29 2e 20 20 49 66 20 it). If
1bc70 77 65 20 61 72 65 20 75 73 69 6e 67 20 74 68 65 we are using the
1bc80 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 65 mixed-mode asse
1bc90 6d 62 6c 79 20 61 6e 64 20 77 65 20 61 6c 72 65 mbly and we alre
1bca0 61 64 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ady.. #
1bcb0 20 20 20 20 20 66 6f 75 6e 64 20 69 74 20 28 61 found it (a
1bcc0 62 6f 76 65 29 2c 20 74 68 69 73 20 73 68 6f 75 bove), this shou
1bcd0 6c 64 20 61 6c 77 61 79 73 20 73 75 63 63 65 65 ld always succee
1bce0 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 d... #..
1bcf0 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 53 checkForS
1bd00 51 4c 69 74 65 4c 69 62 72 61 72 79 20 24 3a 3a QLiteLibrary $::
1bd10 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a test_channel....
1bd20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1bd30 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b # NOTE: Check
1bd40 20 69 66 20 74 68 65 20 53 51 4c 69 74 65 20 69 if the SQLite i
1bd50 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 nterop assembly
1bd60 69 73 20 61 76 61 69 6c 61 62 6c 65 2e 0d 0a 20 is available...
1bd70 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1bd80 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 checkForSQLite
1bd90 49 6e 74 65 72 6f 70 20 24 3a 3a 74 65 73 74 5f Interop $::test_
1bda0 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 channel....
1bdb0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
1bdc0 4e 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 65 20 NOTE: Check the
1bdd0 53 51 4c 69 74 65 20 64 61 74 61 62 61 73 65 20 SQLite database
1bde0 61 6e 64 20 74 65 6d 70 6f 72 61 72 79 20 64 69 and temporary di
1bdf0 72 65 63 74 6f 72 69 65 73 2e 0d 0a 20 20 20 20 rectories...
1be00 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 63 #.. c
1be10 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 44 69 72 heckForSQLiteDir
1be20 65 63 74 6f 72 69 65 73 20 24 3a 3a 74 65 73 74 ectories $::test
1be30 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 _channel....
1be40 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
1be50 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 NOTE: Attempt t
1be60 6f 20 64 65 74 65 72 6d 69 6e 65 20 69 66 20 76 o determine if v
1be70 61 72 69 6f 75 73 20 63 6f 6d 70 69 6c 65 2d 74 arious compile-t
1be80 69 6d 65 20 6f 70 74 69 6f 6e 73 20 6e 65 65 64 ime options need
1be90 65 64 20 66 6f 72 0d 0a 20 20 20 20 20 20 20 20 ed for..
1bea0 23 20 20 20 20 20 20 20 74 65 73 74 20 63 6f 6e # test con
1beb0 73 74 72 61 69 6e 74 73 20 77 65 72 65 20 65 6e straints were en
1bec0 61 62 6c 65 64 20 66 6f 72 20 74 68 65 20 6d 61 abled for the ma
1bed0 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 79 2e 20 naged assembly.
1bee0 20 54 68 65 72 65 0d 0a 20 20 20 20 20 20 20 20 There..
1bef0 23 20 20 20 20 20 20 20 61 72 65 20 73 6f 6d 65 # are some
1bf00 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 6f 70 compile-time op
1bf10 74 69 6f 6e 73 20 74 68 61 74 20 6d 75 73 74 20 tions that must
1bf20 61 6c 73 6f 20 68 61 76 65 20 62 65 65 6e 20 65 also have been e
1bf30 6e 61 62 6c 65 64 0d 0a 20 20 20 20 20 20 20 20 nabled..
1bf40 23 20 20 20 20 20 20 20 66 6f 72 20 74 68 65 20 # for the
1bf50 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 interop assembly
1bf60 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 62 65 20 in order to be
1bf70 65 66 66 65 63 74 69 76 65 2e 20 20 46 6f 72 20 effective. For
1bf80 74 68 6f 73 65 0d 0a 20 20 20 20 20 20 20 20 23 those.. #
1bf90 20 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2c 20 options,
1bfa0 69 74 20 77 69 6c 6c 20 62 65 20 61 73 73 75 6d it will be assum
1bfb0 65 64 20 74 68 61 74 20 69 74 20 77 61 73 20 65 ed that it was e
1bfc0 6e 61 62 6c 65 64 20 66 6f 72 20 74 68 65 20 69 nabled for the i
1bfd0 6e 74 65 72 6f 70 0d 0a 20 20 20 20 20 20 20 20 nterop..
1bfe0 23 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c 79 # assembly
1bff0 20 69 66 20 69 74 20 77 61 73 20 65 6e 61 62 6c if it was enabl
1c000 65 64 20 66 6f 72 20 74 68 65 20 6d 61 6e 61 67 ed for the manag
1c010 65 64 20 61 73 73 65 6d 62 6c 79 2e 0d 0a 20 20 ed assembly...
1c020 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1c030 20 66 6f 72 65 61 63 68 20 64 65 66 69 6e 65 43 foreach defineC
1c040 6f 6e 73 74 61 6e 74 20 5b 6c 69 73 74 20 5c 0d onstant [list \.
1c050 0a 20 20 20 20 20 20 20 20 20 20 20 20 43 48 45 . CHE
1c060 43 4b 5f 53 54 41 54 45 20 43 4f 55 4e 54 5f 48 CK_STATE COUNT_H
1c070 41 4e 44 4c 45 20 44 45 42 55 47 20 49 4e 54 45 ANDLE DEBUG INTE
1c080 52 4f 50 5f 43 4f 44 45 43 20 49 4e 54 45 52 4f ROP_CODEC INTERO
1c090 50 5f 44 45 42 55 47 20 5c 0d 0a 20 20 20 20 20 P_DEBUG \..
1c0a0 20 20 20 20 20 20 20 49 4e 54 45 52 4f 50 5f 45 INTEROP_E
1c0b0 58 54 45 4e 53 49 4f 4e 5f 46 55 4e 43 54 49 4f XTENSION_FUNCTIO
1c0c0 4e 53 20 49 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 NS INTEROP_INCLU
1c0d0 44 45 5f 43 45 52 4f 44 20 5c 0d 0a 20 20 20 20 DE_CEROD \..
1c0e0 20 20 20 20 20 20 20 20 49 4e 54 45 52 4f 50 5f INTEROP_
1c0f0 49 4e 43 4c 55 44 45 5f 45 58 54 52 41 20 49 4e INCLUDE_EXTRA IN
1c100 54 45 52 4f 50 5f 49 4e 43 4c 55 44 45 5f 53 45 TEROP_INCLUDE_SE
1c110 45 20 49 4e 54 45 52 4f 50 5f 4c 45 47 41 43 59 E INTEROP_LEGACY
1c120 5f 43 4c 4f 53 45 20 5c 0d 0a 20 20 20 20 20 20 _CLOSE \..
1c130 20 20 20 20 20 20 49 4e 54 45 52 4f 50 5f 4c 4f INTEROP_LO
1c140 47 20 49 4e 54 45 52 4f 50 5f 54 45 53 54 5f 45 G INTEROP_TEST_E
1c150 58 54 45 4e 53 49 4f 4e 20 49 4e 54 45 52 4f 50 XTENSION INTEROP
1c160 5f 56 49 52 54 55 41 4c 5f 54 41 42 4c 45 20 4e _VIRTUAL_TABLE N
1c170 45 54 5f 32 30 20 5c 0d 0a 20 20 20 20 20 20 20 ET_20 \..
1c180 20 20 20 20 20 4e 45 54 5f 33 35 20 4e 45 54 5f NET_35 NET_
1c190 34 30 20 4e 45 54 5f 34 35 20 4e 45 54 5f 34 35 40 NET_45 NET_45
1c1a0 31 20 4e 45 54 5f 43 4f 4d 50 41 43 54 5f 32 30 1 NET_COMPACT_20
1c1b0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1c1c0 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 43 54 PLATFORM_COMPACT
1c1d0 46 52 41 4d 45 57 4f 52 4b 20 50 52 45 4c 4f 41 FRAMEWORK PRELOA
1c1e0 44 5f 4e 41 54 49 56 45 5f 4c 49 42 52 41 52 59 D_NATIVE_LIBRARY
1c1f0 20 52 45 54 41 52 47 45 54 41 42 4c 45 20 5c 0d RETARGETABLE \.
1c200 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 51 4c . SQL
1c210 49 54 45 5f 53 54 41 4e 44 41 52 44 20 54 48 52 ITE_STANDARD THR
1c220 4f 57 5f 4f 4e 5f 44 49 53 50 4f 53 45 44 20 54 OW_ON_DISPOSED T
1c230 52 41 43 45 20 54 52 41 43 45 5f 43 4f 4e 4e 45 RACE TRACE_CONNE
1c240 43 54 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 20 CTION \..
1c250 20 20 20 20 20 54 52 41 43 45 5f 44 45 54 45 43 TRACE_DETEC
1c260 54 49 4f 4e 20 54 52 41 43 45 5f 48 41 4e 44 4c TION TRACE_HANDL
1c270 45 20 54 52 41 43 45 5f 50 52 45 4c 4f 41 44 20 E TRACE_PRELOAD
1c280 54 52 41 43 45 5f 53 48 41 52 45 44 20 5c 0d 0a TRACE_SHARED \..
1c290 20 20 20 20 20 20 20 20 20 20 20 20 54 52 41 43 TRAC
1c2a0 45 5f 53 54 41 54 45 4d 45 4e 54 20 54 52 41 43 E_STATEMENT TRAC
1c2b0 45 5f 57 41 52 4e 49 4e 47 20 54 52 41 43 4b 5f E_WARNING TRACK_
1c2c0 4d 45 4d 4f 52 59 5f 42 59 54 45 53 20 5c 0d 0a MEMORY_BYTES \..
1c2d0 20 20 20 20 20 20 20 20 20 20 20 20 55 53 45 5f USE_
1c2e0 45 4e 54 49 54 59 5f 46 52 41 4d 45 57 4f 52 4b ENTITY_FRAMEWORK
1c2f0 5f 36 20 55 53 45 5f 49 4e 54 45 52 4f 50 5f 44 _6 USE_INTEROP_D
1c300 4c 4c 20 55 53 45 5f 50 52 45 50 41 52 45 5f 56 LL USE_PREPARE_V
1c310 32 20 57 49 4e 44 4f 57 53 5d 20 7b 0d 0a 20 20 2 WINDOWS] {..
1c320 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1c330 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 # NOTE: Che
1c340 63 6b 20 69 66 20 74 68 65 20 63 6f 6d 70 69 6c ck if the compil
1c350 65 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 20 69 73 e-time option is
1c360 20 6c 69 73 74 65 64 20 69 6e 20 74 68 65 20 6c listed in the l
1c370 69 73 74 20 6f 66 0d 0a 20 20 20 20 20 20 20 20 ist of..
1c380 20 20 23 20 20 20 20 20 20 20 22 64 65 66 69 6e # "defin
1c390 65 20 63 6f 6e 73 74 61 6e 74 73 22 20 6b 65 70 e constants" kep
1c3a0 74 20 74 72 61 63 6b 20 6f 66 20 62 79 20 74 68 t track of by th
1c3b0 65 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 e managed assemb
1c3c0 6c 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 ly... #
1c3d0 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
1c3e0 6b 46 6f 72 53 51 4c 69 74 65 44 65 66 69 6e 65 kForSQLiteDefine
1c3f0 43 6f 6e 73 74 61 6e 74 20 24 3a 3a 74 65 73 74 Constant $::test
1c400 5f 63 68 61 6e 6e 65 6c 20 24 64 65 66 69 6e 65 _channel $define
1c410 43 6f 6e 73 74 61 6e 74 0d 0a 20 20 20 20 20 20 Constant..
1c420 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 }.... #
1c430 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
1c440 3a 20 43 68 65 63 6b 20 69 66 20 74 68 65 20 53 : Check if the S
1c450 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1c460 65 20 70 72 6f 76 69 64 65 72 20 77 61 73 20 63 e provider was c
1c470 6f 6d 70 69 6c 65 64 20 77 69 74 68 0d 0a 20 20 ompiled with..
1c480 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 75 # su
1c490 70 70 6f 72 74 20 66 6f 72 20 61 6e 79 20 65 6e pport for any en
1c4a0 63 72 79 70 74 65 64 20 64 61 74 61 62 61 73 65 crypted database
1c4b0 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 s... #..
1c4c0 20 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 if {[have
1c4d0 43 6f 6e 73 74 72 61 69 6e 74 20 5c 0d 0a 20 20 Constraint \..
1c4e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 65 de
1c4f0 66 69 6e 65 43 6f 6e 73 74 61 6e 74 2e 53 79 73 fineConstant.Sys
1c500 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
1c510 49 4e 54 45 52 4f 50 5f 43 4f 44 45 43 5d 20 7c INTEROP_CODEC] |
1c520 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 | \..
1c530 20 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 [haveConstraint
1c540 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1c550 20 20 20 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 defineConsta
1c560 6e 74 2e 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 nt.System.Data.S
1c570 51 4c 69 74 65 2e 49 4e 54 45 52 4f 50 5f 49 4e QLite.INTEROP_IN
1c580 43 4c 55 44 45 5f 53 45 45 5d 7d 20 74 68 65 6e CLUDE_SEE]} then
1c590 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d {.. #.
1c5a0 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 . # NOT
1c5b0 45 3a 20 59 65 73 2c 20 61 64 64 20 67 65 6e 65 E: Yes, add gene
1c5c0 72 69 63 20 63 6f 6e 73 74 72 61 69 6e 74 20 66 ric constraint f
1c5d0 6f 72 20 75 73 65 20 62 79 20 74 68 65 20 74 65 or use by the te
1c5e0 73 74 20 73 75 69 74 65 2e 0d 0a 20 20 20 20 20 st suite...
1c5f0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1c600 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 addConstraint
1c610 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
1c620 74 65 2e 45 6e 63 72 79 70 74 69 6f 6e 0d 0a 20 te.Encryption..
1c630 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1c640 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
1c650 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 65 NOTE: Check the
1c660 20 63 75 72 72 65 6e 74 20 62 75 69 6c 64 20 79 current build y
1c670 65 61 72 2e 20 20 42 61 73 69 63 61 6c 6c 79 2c ear. Basically,
1c680 20 74 68 69 73 20 69 6e 64 69 63 61 74 65 73 0d this indicates.
1c690 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
1c6a0 20 77 68 69 63 68 20 76 65 72 73 69 6f 6e 20 6f which version o
1c6b0 66 20 4d 53 42 75 69 6c 64 20 61 6e 64 2f 6f 72 f MSBuild and/or
1c6c0 20 56 69 73 75 61 6c 20 53 74 75 64 69 6f 20 77 Visual Studio w
1c6d0 61 73 20 75 73 65 64 20 74 6f 0d 0a 20 20 20 20 as used to..
1c6e0 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6d 70 # comp
1c6f0 69 6c 65 20 74 68 65 20 61 73 73 65 6d 62 6c 79 ile the assembly
1c700 20 62 69 6e 61 72 69 65 73 20 75 6e 64 65 72 20 binaries under
1c710 74 65 73 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 test... #
1c720 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
1c730 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
1c740 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
1c750 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f ---- checking fo
1c760 72 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 r System.Data.SQ
1c770 4c 69 74 65 20 62 75 69 6c 64 20 79 65 61 72 2e Lite build year.
1c780 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 .. "....
1c790 73 65 74 20 79 65 61 72 20 5b 67 65 74 42 75 69 set year [getBui
1c7a0 6c 64 59 65 61 72 5d 0d 0a 20 20 20 20 20 20 20 ldYear]..
1c7b0 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 5b addConstraint [
1c7c0 61 70 70 65 6e 64 41 72 67 73 20 62 75 69 6c 64 appendArgs build
1c7d0 59 65 61 72 2e 20 24 79 65 61 72 5d 0d 0a 20 20 Year. $year]..
1c7e0 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
1c7f0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
1c800 65 6e 64 41 72 67 73 20 5c 22 20 24 79 65 61 72 endArgs \" $year
1c810 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 \"\n]....
1c820 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
1c830 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 65 20 63 OTE: Check the c
1c840 75 72 72 65 6e 74 20 62 75 69 6c 64 20 2e 4e 45 urrent build .NE
1c850 54 20 46 72 61 6d 65 77 6f 72 6b 2e 20 20 42 61 T Framework. Ba
1c860 73 69 63 61 6c 6c 79 2c 20 74 68 69 73 0d 0a 20 sically, this..
1c870 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 69 # i
1c880 6e 64 69 63 61 74 65 73 20 77 68 69 63 68 20 76 ndicates which v
1c890 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 2e 4e ersion of the .N
1c8a0 45 54 20 46 72 61 6d 65 77 6f 72 6b 20 69 73 20 ET Framework is
1c8b0 62 65 69 6e 67 0d 0a 20 20 20 20 20 20 20 20 23 being.. #
1c8c0 20 20 20 20 20 20 20 75 73 65 64 20 62 79 20 74 used by t
1c8d0 68 65 20 61 73 73 65 6d 62 6c 79 20 62 69 6e 61 he assembly bina
1c8e0 72 69 65 73 20 75 6e 64 65 72 20 74 65 73 74 2e ries under test.
1c8f0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1c900 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1c910 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 st_channel \..
1c920 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1c930 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 checking for Sys
1c940 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
1c950 62 75 69 6c 64 20 2e 4e 45 54 20 46 72 61 6d 65 build .NET Frame
1c960 77 6f 72 6b 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 work... "....
1c970 20 20 20 20 20 73 65 74 20 6e 65 74 46 78 20 5b set netFx [
1c980 67 65 74 42 75 69 6c 64 4e 65 74 46 78 5d 0d 0a getBuildNetFx]..
1c990 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 addConst
1c9a0 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
1c9b0 73 20 62 75 69 6c 64 46 72 61 6d 65 77 6f 72 6b s buildFramework
1c9c0 2e 20 24 6e 65 74 46 78 5d 0d 0a 20 20 20 20 20 . $netFx]..
1c9d0 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
1c9e0 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
1c9f0 41 72 67 73 20 5c 22 20 24 6e 65 74 46 78 20 5c Args \" $netFx \
1ca00 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 "\n]....
1ca10 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1ca20 45 3a 20 43 68 65 63 6b 20 74 68 65 20 63 75 72 E: Check the cur
1ca30 72 65 6e 74 20 62 75 69 6c 64 20 63 6f 6e 66 69 rent build confi
1ca40 67 75 72 61 74 69 6f 6e 2e 20 20 54 68 69 73 20 guration. This
1ca50 73 68 6f 75 6c 64 20 6e 6f 72 6d 61 6c 6c 79 0d should normally.
1ca60 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
1ca70 20 62 65 20 65 69 74 68 65 72 20 22 44 65 62 75 be either "Debu
1ca80 67 22 20 6f 72 20 22 52 65 6c 65 61 73 65 22 2e g" or "Release".
1ca90 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1caa0 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1cab0 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 st_channel \..
1cac0 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1cad0 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 checking for Sys
1cae0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
1caf0 62 75 69 6c 64 20 63 6f 6e 66 69 67 75 72 61 74 build configurat
1cb00 69 6f 6e 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 ion... "....
1cb10 20 20 20 20 73 65 74 20 63 6f 6e 66 69 67 75 72 set configur
1cb20 61 74 69 6f 6e 20 5b 67 65 74 42 75 69 6c 64 43 ation [getBuildC
1cb30 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5d 0d 0a 20 onfiguration]..
1cb40 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 addConstr
1cb50 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
1cb60 20 62 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 74 buildConfigurat
1cb70 69 6f 6e 2e 20 24 63 6f 6e 66 69 67 75 72 61 74 ion. $configurat
1cb80 69 6f 6e 5d 0d 0a 20 20 20 20 20 20 20 20 74 70 ion].. tp
1cb90 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
1cba0 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1cbb0 5c 22 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f \" $configuratio
1cbc0 6e 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 n \"\n]....
1cbd0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
1cbe0 4e 4f 54 45 3a 20 54 72 79 20 74 6f 20 73 65 74 NOTE: Try to set
1cbf0 75 70 20 61 6e 20 69 6e 74 65 72 72 75 70 74 20 up an interrupt
1cc00 63 61 6c 6c 62 61 63 6b 20 75 73 69 6e 67 20 74 callback using t
1cc10 68 65 20 73 63 72 69 70 74 20 64 65 62 75 67 67 he script debugg
1cc20 65 72 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 er.. #
1cc30 20 20 20 20 74 68 61 74 20 77 69 6c 6c 20 63 61 that will ca
1cc40 6e 63 65 6c 20 61 6c 6c 20 53 51 4c 20 71 75 65 ncel all SQL que
1cc50 72 69 65 73 20 69 6e 20 70 72 6f 67 72 65 73 73 ries in progress
1cc60 20 66 6f 72 20 61 6c 6c 20 64 61 74 61 62 61 73 for all databas
1cc70 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
1cc80 20 20 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 20 6b connections k
1cc90 6e 6f 77 6e 20 74 6f 20 74 68 69 73 20 69 6e 74 nown to this int
1cca0 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 20 20 erpreter...
1ccb0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 #.. if
1ccc0 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
1ccd0 3a 3a 6e 6f 28 73 71 6c 69 74 65 49 6e 74 65 72 ::no(sqliteInter
1cce0 72 75 70 74 43 61 6c 6c 62 61 63 6b 29 5d 7d 20 ruptCallback)]}
1ccf0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1cd00 20 20 73 65 74 75 70 44 62 49 6e 74 65 72 72 75 setupDbInterru
1cd10 70 74 43 61 6c 6c 62 61 63 6b 20 24 3a 3a 74 65 ptCallback $::te
1cd20 73 74 5f 63 68 61 6e 6e 65 6c 20 24 3a 3a 74 65 st_channel $::te
1cd30 73 74 5f 6c 6f 67 0d 0a 20 20 20 20 20 20 20 20 st_log..
1cd40 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a }.... #..
1cd50 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1cd60 43 68 65 63 6b 20 66 6f 72 20 74 68 65 20 6e 61 Check for the na
1cd70 74 69 76 65 20 72 75 6e 74 69 6d 65 20 6f 70 74 tive runtime opt
1cd80 69 6f 6e 2c 20 77 68 69 63 68 20 77 6f 75 6c 64 ion, which would
1cd90 20 6d 65 61 6e 20 77 65 20 61 72 65 0d 0a 20 20 mean we are..
1cda0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 75 73 # us
1cdb0 69 6e 67 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f ing the mixed-mo
1cdc0 64 65 20 61 73 73 65 6d 62 6c 79 2e 0d 0a 20 20 de assembly...
1cdd0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1cde0 20 63 68 65 63 6b 46 6f 72 52 75 6e 74 69 6d 65 checkForRuntime
1cdf0 4f 70 74 69 6f 6e 20 24 3a 3a 74 65 73 74 5f 63 Option $::test_c
1ce00 68 61 6e 6e 65 6c 20 6e 61 74 69 76 65 0d 0a 0d hannel native...
1ce10 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1ce20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 # NOTE: Chec
1ce30 6b 20 69 66 20 74 68 65 20 74 65 73 74 20 73 75 k if the test su
1ce40 69 74 65 20 73 68 6f 75 6c 64 20 63 6f 75 6e 74 ite should count
1ce50 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 63 the number of c
1ce60 6f 6e 6e 65 63 74 69 6f 6e 73 0d 0a 20 20 20 20 onnections..
1ce70 20 20 20 20 23 20 20 20 20 20 20 20 22 6f 70 65 # "ope
1ce80 6e 65 64 22 20 61 6e 64 20 22 63 6c 6f 73 65 64 ned" and "closed
1ce90 22 20 66 72 6f 6d 20 74 68 65 20 70 6f 6f 6c 20 " from the pool
1cea0 77 68 65 6e 20 64 65 74 65 72 6d 69 6e 69 6e 67 when determining
1ceb0 20 69 66 20 61 20 74 65 73 74 0d 0a 20 20 20 20 if a test..
1cec0 20 20 20 20 23 20 20 20 20 20 20 20 70 61 73 73 # pass
1ced0 65 64 2e 20 20 44 69 73 61 62 6c 69 6e 67 20 74 ed. Disabling t
1cee0 68 69 73 20 62 65 68 61 76 69 6f 72 20 69 73 20 his behavior is
1cef0 73 6f 6d 65 74 69 6d 65 73 20 6e 65 63 65 73 73 sometimes necess
1cf00 61 72 79 20 28 65 2e 67 2e 0d 0a 20 20 20 20 20 ary (e.g...
1cf10 20 20 20 23 20 20 20 20 20 20 20 64 75 72 69 6e # durin
1cf20 67 20 74 68 65 20 72 65 6c 65 61 73 65 20 74 65 g the release te
1cf30 73 74 69 6e 67 20 70 72 6f 63 65 73 73 29 20 62 sting process) b
1cf40 65 63 61 75 73 65 20 74 68 65 72 65 20 61 72 65 ecause there are
1cf50 20 73 65 76 65 72 61 6c 0d 0a 20 20 20 20 20 20 several..
1cf60 20 20 23 20 20 20 20 20 20 20 74 65 73 74 73 20 # tests
1cf70 74 68 61 74 20 72 65 6c 79 20 6f 6e 20 74 68 65 that rely on the
1cf80 20 22 6f 70 65 6e 65 64 20 66 72 6f 6d 20 70 6f "opened from po
1cf90 6f 6c 22 20 63 6f 75 6e 74 20 62 65 69 6e 67 20 ol" count being
1cfa0 67 72 65 61 74 65 72 0d 0a 20 20 20 20 20 20 20 greater..
1cfb0 20 23 20 20 20 20 20 20 20 74 68 61 6e 20 7a 65 # than ze
1cfc0 72 6f 2e 20 20 54 68 65 73 65 20 74 65 73 74 73 ro. These tests
1cfd0 20 6d 61 79 20 66 61 69 6c 20 64 75 65 20 74 6f may fail due to
1cfe0 20 74 68 65 20 6e 6f 6e 2d 64 65 74 65 72 6d 69 the non-determi
1cff0 6e 69 73 74 69 63 0d 0a 20 20 20 20 20 20 20 20 nistic..
1d000 23 20 20 20 20 20 20 20 62 65 68 61 76 69 6f 72 # behavior
1d010 20 6f 66 20 74 68 65 20 43 4c 52 20 47 43 2c 20 of the CLR GC,
1d020 65 76 65 6e 20 77 68 65 6e 20 74 68 65 72 65 20 even when there
1d030 69 73 20 6e 6f 20 62 75 67 20 69 6e 20 74 68 65 is no bug in the
1d040 20 63 6f 64 65 0d 0a 20 20 20 20 20 20 20 20 23 code.. #
1d050 20 20 20 20 20 20 20 62 65 69 6e 67 20 74 65 73 being tes
1d060 74 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ted... #.
1d070 0a 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f . checkFo
1d080 72 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 24 rRuntimeOption $
1d090 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 6e ::test_channel n
1d0a0 6f 50 6f 6f 6c 43 6f 75 6e 74 73 0d 0a 0d 0a 20 oPoolCounts....
1d0b0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1d0c0 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 # NOTE: Check
1d0d0 69 66 20 74 68 65 20 74 65 73 74 20 73 75 69 74 if the test suit
1d0e0 65 20 73 68 6f 75 6c 64 20 75 73 65 20 73 68 61 e should use sha
1d0f0 72 65 64 2d 63 61 63 68 65 20 6d 6f 64 65 2e 0d red-cache mode..
1d100 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1d110 20 20 20 20 63 68 65 63 6b 46 6f 72 52 75 6e 74 checkForRunt
1d120 69 6d 65 4f 70 74 69 6f 6e 20 24 3a 3a 74 65 73 imeOption $::tes
1d130 74 5f 63 68 61 6e 6e 65 6c 20 73 68 61 72 65 64 t_channel shared
1d140 43 61 63 68 65 0d 0a 0d 0a 20 20 20 20 20 20 20 Cache....
1d150 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
1d160 54 45 3a 20 52 65 70 6f 72 74 20 74 68 65 20 72 TE: Report the r
1d170 65 73 6f 75 72 63 65 20 75 73 61 67 65 20 70 72 esource usage pr
1d180 69 6f 72 20 74 6f 20 72 75 6e 6e 69 6e 67 20 61 ior to running a
1d190 6e 79 20 74 65 73 74 73 2e 0d 0a 20 20 20 20 20 ny tests...
1d1a0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 #.. re
1d1b0 70 6f 72 74 53 51 4c 69 74 65 52 65 73 6f 75 72 portSQLiteResour
1d1c0 63 65 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e ces $::test_chan
1d1d0 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 nel.... #
1d1e0 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
1d1f0 3a 20 47 72 61 62 20 74 68 65 20 6c 69 73 74 20 : Grab the list
1d200 6f 66 20 6e 61 74 69 76 65 20 6d 6f 64 75 6c 65 of native module
1d210 73 20 66 6f 72 20 74 68 65 20 63 75 72 72 65 6e s for the curren
1d220 74 20 70 72 6f 63 65 73 73 20 61 6e 64 0d 0a 20 t process and..
1d230 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 # r
1d240 65 70 6f 72 74 20 6f 6e 20 74 68 65 20 53 79 73 eport on the Sys
1d250 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
1d260 72 65 6c 61 74 65 64 20 6f 6e 65 73 2e 0d 0a 20 related ones...
1d270 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1d280 20 20 73 65 74 20 6d 6f 64 75 6c 65 73 20 5b 6f set modules [o
1d290 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 5c 0d 0a bject invoke \..
1d2a0 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
1d2b0 65 6d 2e 44 69 61 67 6e 6f 73 74 69 63 73 2e 50 em.Diagnostics.P
1d2c0 72 6f 63 65 73 73 2e 47 65 74 43 75 72 72 65 6e rocess.GetCurren
1d2d0 74 50 72 6f 63 65 73 73 20 4d 6f 64 75 6c 65 73 tProcess Modules
1d2e0 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a ].... obj
1d2f0 65 63 74 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 ect foreach -ali
1d300 61 73 20 6d 6f 64 75 6c 65 20 24 6d 6f 64 75 6c as module $modul
1d310 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
1d320 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
1d330 4f 54 45 3a 20 54 68 65 20 6d 6f 64 75 6c 65 20 OTE: The module
1d340 66 69 6c 65 20 6e 61 6d 65 20 68 65 72 65 20 6d file name here m
1d350 75 73 74 20 62 65 20 6e 6f 72 6d 61 6c 69 7a 65 ust be normalize
1d360 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d d... #.
1d370 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 66 . set f
1d380 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6e 6f ileName [file no
1d390 72 6d 61 6c 69 7a 65 20 5b 24 6d 6f 64 75 6c 65 rmalize [$module
1d3a0 20 46 69 6c 65 4e 61 6d 65 5d 5d 0d 0a 0d 0a 20 FileName]]....
1d3b0 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 if {[st
1d3c0 72 69 6e 67 20 6d 61 74 63 68 20 2d 6e 6f 63 61 ring match -noca
1d3d0 73 65 20 2a 2f 73 71 6c 69 74 65 33 2e 64 6c 6c se */sqlite3.dll
1d3e0 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 $fileName]} the
1d3f0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1d400 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
1d410 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1d420 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1d430 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 6f 75 6e "---- foun
1d440 64 20 6c 6f 61 64 65 64 20 53 51 4c 69 74 65 20 d loaded SQLite
1d450 6e 61 74 69 76 65 20 6c 69 62 72 61 72 79 20 6d native library m
1d460 6f 64 75 6c 65 3a 20 22 20 5c 0d 0a 20 20 20 20 odule: " \..
1d470 20 20 20 20 20 20 20 20 20 20 20 20 24 66 69 6c $fil
1d480 65 4e 61 6d 65 20 5c 6e 5d 0d 0a 20 20 20 20 20 eName \n]..
1d490 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b } elseif {[
1d4a0 73 74 72 69 6e 67 20 6d 61 74 63 68 20 5c 0d 0a string match \..
1d4b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 6e -n
1d4c0 6f 63 61 73 65 20 2a 2f 53 51 4c 69 74 65 2e 49 ocase */SQLite.I
1d4d0 6e 74 65 72 6f 70 2e 64 6c 6c 20 24 66 69 6c 65 nterop.dll $file
1d4e0 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 Name]} then {..
1d4f0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
1d500 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
1d510 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1d520 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1d530 22 2d 2d 2d 2d 20 66 6f 75 6e 64 20 6c 6f 61 64 "---- found load
1d540 65 64 20 53 51 4c 69 74 65 20 69 6e 74 65 72 6f ed SQLite intero
1d550 70 20 61 73 73 65 6d 62 6c 79 20 6d 6f 64 75 6c p assembly modul
1d560 65 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 e: " \..
1d570 20 20 20 20 20 20 20 20 24 66 69 6c 65 4e 61 6d $fileNam
1d580 65 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 e \n]..
1d590 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
1d5a0 0a 20 20 20 20 20 20 20 20 63 61 74 63 68 20 7b . catch {
1d5b0 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
1d5c0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
1d5d0 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 l \..
1d5e0 20 20 20 22 2d 2d 2d 2d 20 63 6f 6d 70 69 6c 65 "---- compile
1d5f0 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 73 20 66 6f -time options fo
1d600 72 20 53 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 r SQLite core li
1d610 62 72 61 72 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 brary... "....
1d620 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
1d630 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
1d640 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
1d650 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
1d660 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
1d670 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
1d680 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 .SQLite.SQLite3
1d690 53 51 4c 69 74 65 43 6f 6d 70 69 6c 65 4f 70 74 SQLiteCompileOpt
1d6a0 69 6f 6e 73 0d 0a 20 20 20 20 20 20 20 20 20 20 ions..
1d6b0 7d 20 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 } compileOptions
1d6c0 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
1d6d0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1d6e0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
1d6f0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 66 l [appendArgs [f
1d700 6f 72 6d 61 74 4c 69 73 74 20 5b 6c 73 6f 72 74 ormatList [lsort
1d710 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1d720 20 20 20 20 24 63 6f 6d 70 69 6c 65 4f 70 74 69 $compileOpti
1d730 6f 6e 73 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d ons] <none>] \n]
1d740 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c .. } el
1d750 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
1d760 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1d770 63 68 61 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c channel unknown\
1d780 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a n.. }..
1d790 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
1d7a0 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 catch {..
1d7b0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
1d7c0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d :test_channel \.
1d7d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
1d7e0 2d 2d 2d 2d 20 63 6f 6d 70 69 6c 65 2d 74 69 6d ---- compile-tim
1d7f0 65 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 53 51 e options for SQ
1d800 4c 69 74 65 20 69 6e 74 65 72 6f 70 20 61 73 73 Lite interop ass
1d810 65 6d 62 6c 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 embly... "....
1d820 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
1d830 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
1d840 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
1d850 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
1d860 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
1d870 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
1d880 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 .SQLite.SQLite3
1d890 49 6e 74 65 72 6f 70 43 6f 6d 70 69 6c 65 4f 70 InteropCompileOp
1d8a0 74 69 6f 6e 73 0d 0a 20 20 20 20 20 20 20 20 20 tions..
1d8b0 20 7d 20 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e } compileOption
1d8c0 73 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d s] == 0} then {.
1d8d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
1d8e0 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
1d8f0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5b el [appendArgs [
1d900 66 6f 72 6d 61 74 4c 69 73 74 20 5b 6c 73 6f 72 formatList [lsor
1d910 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 t \..
1d920 20 20 20 20 20 24 63 6f 6d 70 69 6c 65 4f 70 74 $compileOpt
1d930 69 6f 6e 73 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e ions] <none>] \n
1d940 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 ].. } e
1d950 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
1d960 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
1d970 5f 63 68 61 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e _channel unknown
1d980 5c 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d \n.. }.
1d990 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
1d9a0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1d9b0 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 74 68 # NOTE: Show th
1d9c0 65 20 61 63 74 69 76 65 20 74 65 73 74 20 63 6f e active test co
1d9d0 6e 73 74 72 61 69 6e 74 73 2e 0d 0a 20 20 20 20 nstraints...
1d9e0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 #.. t
1d9f0 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
1da00 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1da10 20 22 2d 2d 2d 2d 20 63 6f 6e 73 74 72 61 69 6e "---- constrain
1da20 74 73 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 ts: " \..
1da30 20 20 20 20 20 5b 66 6f 72 6d 61 74 4c 69 73 74 [formatList
1da40 20 5b 6c 73 6f 72 74 20 5b 67 65 74 43 6f 6e 73 [lsort [getCons
1da50 74 72 61 69 6e 74 73 5d 5d 20 3c 6e 6f 6e 65 3e traints]] <none>
1da60 5d 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 ] \n]....
1da70 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
1da80 54 45 3a 20 53 61 76 65 20 74 68 65 20 74 65 73 TE: Save the tes
1da90 74 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 66 6f t constraints fo
1daa0 72 20 75 73 65 20 62 79 20 74 68 72 65 61 64 73 r use by threads
1dab0 20 63 72 65 61 74 65 64 20 69 6e 20 74 68 69 73 created in this
1dac0 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
1dad0 20 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 64 6f application do
1dae0 6d 61 69 6e 2e 20 20 54 68 69 73 20 69 73 20 6e main. This is n
1daf0 65 63 65 73 73 61 72 79 20 62 65 63 61 75 73 65 ecessary because
1db00 20 61 6c 6c 20 74 68 65 20 45 61 67 6c 65 0d 0a all the Eagle..
1db10 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1db20 22 74 65 73 74 20 63 6f 6e 74 65 78 74 22 20 69 "test context" i
1db30 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 70 65 nformation is pe
1db40 72 2d 74 68 72 65 61 64 2e 0d 0a 20 20 20 20 20 r-thread...
1db50 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 #.. if
1db60 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
1db70 3a 3a 74 65 73 74 5f 63 6f 6e 73 74 72 61 69 6e ::test_constrain
1db80 74 73 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ts]} then {..
1db90 20 20 20 20 20 20 20 73 65 74 20 3a 3a 74 65 73 set ::tes
1dba0 74 5f 63 6f 6e 73 74 72 61 69 6e 74 73 20 24 3a t_constraints $:
1dbb0 3a 65 61 67 6c 65 5f 74 65 73 74 73 28 63 6f 6e :eagle_tests(con
1dbc0 73 74 72 61 69 6e 74 73 29 0d 0a 20 20 20 20 20 straints)..
1dbd0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1dbe0 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1dbf0 45 3a 20 4c 6f 61 64 20 74 68 65 20 22 61 66 74 E: Load the "aft
1dc00 65 72 2d 63 6f 6e 73 74 72 61 69 6e 74 73 22 20 er-constraints"
1dc10 63 75 73 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 custom per-user
1dc20 61 6e 64 2f 6f 72 20 70 65 72 2d 68 6f 73 74 0d and/or per-host.
1dc30 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
1dc40 20 74 65 73 74 20 73 65 74 74 69 6e 67 73 20 6e test settings n
1dc50 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ow... #..
1dc60 20 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 uplevel
1dc70 31 20 5b 6c 69 73 74 20 6c 6f 61 64 53 51 4c 69 1 [list loadSQLi
1dc80 74 65 54 65 73 74 53 65 74 74 69 6e 67 73 20 24 teTestSettings $
1dc90 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 2e ::test_channel .
1dca0 61 66 74 65 72 5d 0d 0a 0d 0a 20 20 20 20 20 20 after]....
1dcb0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
1dcc0 4f 54 45 3a 20 49 66 20 6e 65 63 65 73 73 61 72 OTE: If necessar
1dcd0 79 2c 20 65 6e 61 62 6c 65 20 73 68 61 72 65 64 y, enable shared
1dce0 2d 63 61 63 68 65 20 6d 6f 64 65 20 6e 6f 77 2e -cache mode now.
1dcf0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1dd00 20 20 20 20 20 69 66 20 7b 5b 68 61 73 52 75 6e if {[hasRun
1dd10 74 69 6d 65 4f 70 74 69 6f 6e 20 73 68 61 72 65 timeOption share
1dd20 64 43 61 63 68 65 5d 7d 20 74 68 65 6e 20 7b 0d dCache]} then {.
1dd30 0a 20 20 20 20 20 20 20 20 20 20 65 6e 61 62 6c . enabl
1dd40 65 53 68 61 72 65 64 43 61 63 68 65 20 24 3a 3a eSharedCache $::
1dd50 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 74 72 75 test_channel tru
1dd60 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a e.. }....
1dd70 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1dd80 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 # NOTE: Show
1dd90 77 68 65 6e 20 6f 75 72 20 74 65 73 74 73 20 61 when our tests a
1dda0 63 74 75 61 6c 6c 79 20 62 65 67 61 6e 20 28 6e ctually began (n
1ddb0 6f 77 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ow)... #.
1ddc0 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
1ddd0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
1dde0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1ddf0 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1de00 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
1de10 74 65 20 74 65 73 74 73 20 62 65 67 61 6e 20 61 te tests began a
1de20 74 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 t " \..
1de30 20 20 20 5b 63 6c 6f 63 6b 20 66 6f 72 6d 61 74 [clock format
1de40 20 5b 63 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d [clock seconds]
1de50 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a ] \n].. }..
1de60 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
1de70 6f 63 20 72 75 6e 53 51 4c 69 74 65 54 65 73 74 oc runSQLiteTest
1de80 46 69 6c 65 73 50 72 6f 6c 6f 67 75 65 20 7b 7d FilesPrologue {}
1de90 20 7b 0d 0a 20 20 20 20 20 20 75 70 6c 65 76 65 {.. upleve
1dea0 6c 20 31 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 l 1 {.. #
1deb0 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
1dec0 3a 20 53 65 74 75 70 20 74 68 65 20 76 61 72 69 : Setup the vari
1ded0 61 62 6c 65 73 20 74 68 61 74 20 72 65 66 65 72 ables that refer
1dee0 20 74 6f 20 74 68 65 20 76 61 72 69 6f 75 73 20 to the various
1def0 6e 6f 6e 2d 64 61 74 61 20 66 69 6c 65 73 0d 0a non-data files..
1df00 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1df10 72 65 71 75 69 72 65 64 20 62 79 20 74 68 65 20 required by the
1df20 74 65 73 74 73 20 69 6e 20 74 68 69 73 20 66 69 tests in this fi
1df30 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a le... #..
1df40 20 20 20 20 20 20 20 20 73 65 74 20 65 6e 74 69 set enti
1df50 74 79 46 72 61 6d 65 77 6f 72 6b 44 6c 6c 46 69 tyFrameworkDllFi
1df60 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 le \..
1df70 20 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e [getBuildFileN
1df80 61 6d 65 20 45 6e 74 69 74 79 46 72 61 6d 65 77 ame EntityFramew
1df90 6f 72 6b 2e 64 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 ork.dll]....
1dfa0 20 20 20 20 73 65 74 20 69 6e 73 74 61 6c 6c 65 set installe
1dfb0 72 45 78 65 46 69 6c 65 20 5b 67 65 74 42 75 69 rExeFile [getBui
1dfc0 6c 64 46 69 6c 65 4e 61 6d 65 20 49 6e 73 74 61 ldFileName Insta
1dfd0 6c 6c 65 72 2e 65 78 65 5d 0d 0a 20 20 20 20 20 ller.exe]..
1dfe0 20 20 20 73 65 74 20 73 71 6c 69 74 65 44 65 73 set sqliteDes
1dff0 69 67 6e 65 72 44 6c 6c 46 69 6c 65 20 5b 67 65 ignerDllFile [ge
1e000 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 53 tBuildFileName S
1e010 51 4c 69 74 65 2e 44 65 73 69 67 6e 65 72 2e 64 QLite.Designer.d
1e020 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 ll].... s
1e030 65 74 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c et systemDataSQL
1e040 69 74 65 44 6c 6c 46 69 6c 65 20 5c 0d 0a 20 20 iteDllFile \..
1e050 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 75 [getBu
1e060 69 6c 64 46 69 6c 65 4e 61 6d 65 20 53 79 73 74 ildFileName Syst
1e070 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 em.Data.SQLite.d
1e080 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 ll].... s
1e090 65 74 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c et systemDataSQL
1e0a0 69 74 65 4c 69 6e 71 44 6c 6c 46 69 6c 65 20 5c iteLinqDllFile \
1e0b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 .. [g
1e0c0 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 etBuildFileName
1e0d0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
1e0e0 74 65 2e 4c 69 6e 71 2e 64 6c 6c 5d 0d 0a 0d 0a te.Linq.dll]....
1e0f0 20 20 20 20 20 20 20 20 73 65 74 20 73 79 73 74 set syst
1e100 65 6d 44 61 74 61 53 51 4c 69 74 65 45 66 36 44 emDataSQLiteEf6D
1e110 6c 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 llFile \..
1e120 20 20 20 20 20 20 5b 67 65 74 42 75 69 6c 64 46 [getBuildF
1e130 69 6c 65 4e 61 6d 65 20 53 79 73 74 65 6d 2e 44 ileName System.D
1e140 61 74 61 2e 53 51 4c 69 74 65 2e 45 46 36 2e 64 ata.SQLite.EF6.d
1e150 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 ll].... s
1e160 65 74 20 74 65 73 74 45 78 65 46 69 6c 65 20 5b et testExeFile [
1e170 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 getBuildFileName
1e180 20 74 65 73 74 2e 65 78 65 5d 0d 0a 20 20 20 20 test.exe]..
1e190 20 20 20 20 73 65 74 20 74 65 73 74 4c 69 6e 71 set testLinq
1e1a0 45 78 65 46 69 6c 65 20 5b 67 65 74 42 75 69 6c ExeFile [getBuil
1e1b0 64 46 69 6c 65 4e 61 6d 65 20 74 65 73 74 6c 69 dFileName testli
1e1c0 6e 71 2e 65 78 65 5d 0d 0a 20 20 20 20 20 20 20 nq.exe]..
1e1d0 20 73 65 74 20 74 65 73 74 45 66 36 45 78 65 46 set testEf6ExeF
1e1e0 69 6c 65 20 5b 67 65 74 42 75 69 6c 64 46 69 6c ile [getBuildFil
1e1f0 65 4e 61 6d 65 20 74 65 73 74 65 66 36 2e 65 78 eName testef6.ex
1e200 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d e].... #.
1e210 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
1e220 20 53 65 74 75 70 20 74 68 65 20 76 61 72 69 61 Setup the varia
1e230 62 6c 65 73 20 74 68 61 74 20 72 65 66 65 72 20 bles that refer
1e240 74 6f 20 74 68 65 20 76 61 72 69 6f 75 73 20 64 to the various d
1e250 61 74 61 20 66 69 6c 65 73 0d 0a 20 20 20 20 20 ata files..
1e260 20 20 20 23 20 20 20 20 20 20 20 72 65 71 75 69 # requi
1e270 72 65 64 20 62 79 20 74 68 65 20 74 65 73 74 73 red by the tests
1e280 20 69 6e 20 74 68 69 73 20 66 69 6c 65 2e 0d 0a in this file...
1e290 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1e2a0 20 20 20 73 65 74 20 74 65 73 74 4c 69 6e 71 4f set testLinqO
1e2b0 75 74 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 utFile [file nat
1e2c0 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f ivename [file jo
1e2d0 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 in \..
1e2e0 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 [getSQLiteTest
1e2f0 44 61 74 61 50 61 74 68 5d 20 74 65 73 74 6c 69 DataPath] testli
1e300 6e 71 2e 6f 75 74 5d 5d 0d 0a 0d 0a 20 20 20 20 nq.out]]....
1e310 20 20 20 20 73 65 74 20 6e 6f 72 74 68 77 69 6e set northwin
1e320 64 45 66 44 62 46 69 6c 65 20 5b 66 69 6c 65 20 dEfDbFile [file
1e330 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 nativename [file
1e340 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 join \..
1e350 20 20 20 20 20 5b 66 69 6c 65 20 64 69 72 6e 61 [file dirna
1e360 6d 65 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 me [file dirname
1e370 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 [getSQLiteTestD
1e380 61 74 61 50 61 74 68 5d 5d 5d 20 5c 0d 0a 20 20 ataPath]]] \..
1e390 20 20 20 20 20 20 20 20 20 20 74 65 73 74 6c 69 testli
1e3a0 6e 71 20 6e 6f 72 74 68 77 69 6e 64 45 46 2e 64 nq northwindEF.d
1e3b0 62 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 b]].... s
1e3c0 65 74 20 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 20 et nonWalDbFile
1e3d0 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
1e3e0 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 [file join \..
1e3f0 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 [getS
1e400 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 74 QLiteTestDataPat
1e410 68 5d 20 6e 6f 6e 57 61 6c 2e 64 62 5d 5d 0d 0a h] nonWal.db]]..
1e420 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 77 61 .. set wa
1e430 6c 44 62 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 lDbFile [file na
1e440 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a tivename [file j
1e450 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 oin \..
1e460 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 [getSQLiteTes
1e470 74 44 61 74 61 50 61 74 68 5d 20 77 61 6c 2e 64 tDataPath] wal.d
1e480 62 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 b]].... #
1e490 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
1e4a0 3a 20 54 68 65 20 76 61 72 69 6f 75 73 20 69 6e : The various in
1e4b0 73 74 61 6c 6c 2f 75 6e 69 6e 73 74 61 6c 6c 20 stall/uninstall
1e4c0 6c 6f 67 20 66 69 6c 65 73 20 75 73 65 64 20 74 log files used t
1e4d0 6f 20 74 65 73 74 20 74 68 65 0d 0a 20 20 20 20 o test the..
1e4e0 20 20 20 20 23 20 20 20 20 20 20 20 64 65 73 69 # desi
1e4f0 67 6e 2d 74 69 6d 65 20 63 6f 6d 70 6f 6e 65 6e gn-time componen
1e500 74 20 69 6e 73 74 61 6c 6c 65 72 2e 0d 0a 20 20 t installer...
1e510 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1e520 20 73 65 74 20 74 65 73 74 49 6e 73 74 61 6c 6c set testInstall
1e530 56 73 32 30 30 35 4c 6f 67 46 69 6c 65 20 5b 66 Vs2005LogFile [f
1e540 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b ile nativename [
1e550 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 file join \..
1e560 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c [getSQL
1e570 69 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d iteTestDataPath]
1e580 20 49 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f Installer_Test_
1e590 56 73 32 30 30 35 2e 6c 6f 67 5d 5d 0d 0a 0d 0a Vs2005.log]]....
1e5a0 20 20 20 20 20 20 20 20 73 65 74 20 74 65 73 74 set test
1e5b0 49 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 InstallVs2008Log
1e5c0 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 File [file nativ
1e5d0 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
1e5e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1e5f0 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 [getSQLiteTestDa
1e600 74 61 50 61 74 68 5d 20 49 6e 73 74 61 6c 6c 65 taPath] Installe
1e610 72 5f 54 65 73 74 5f 56 73 32 30 30 38 2e 6c 6f r_Test_Vs2008.lo
1e620 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 g]].... s
1e630 65 74 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 et testInstallVs
1e640 32 30 31 30 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 2010LogFile [fil
1e650 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 e nativename [fi
1e660 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 le join \..
1e670 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 [getSQLit
1e680 65 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 49 eTestDataPath] I
1e690 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 nstaller_Test_Vs
1e6a0 32 30 31 30 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 2010.log]]....
1e6b0 20 20 20 20 20 20 73 65 74 20 74 65 73 74 49 6e set testIn
1e6c0 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 stallVs2012LogFi
1e6d0 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e le [file nativen
1e6e0 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c ame [file join \
1e6f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 .. [g
1e700 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 etSQLiteTestData
1e710 50 61 74 68 5d 20 49 6e 73 74 61 6c 6c 65 72 5f Path] Installer_
1e720 54 65 73 74 5f 56 73 32 30 31 32 2e 6c 6f 67 5d Test_Vs2012.log]
1e730 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 ].... set
1e740 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 testInstallVs20
1e750 31 33 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 13LogFile [file
1e760 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 nativename [file
1e770 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 join \..
1e780 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 [getSQLiteT
1e790 65 73 74 44 61 74 61 50 61 74 68 5d 20 49 6e 73 estDataPath] Ins
1e7a0 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 taller_Test_Vs20
1e7b0 31 33 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 13.log]]....
1e7c0 20 20 20 20 73 65 74 20 74 65 73 74 55 6e 69 6e set testUnin
1e7d0 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 69 stallVs2005LogFi
1e7e0 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e le [file nativen
1e7f0 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c ame [file join \
1e800 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 .. [g
1e810 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 etSQLiteTestData
1e820 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 Path] Uninstalle
1e830 72 5f 54 65 73 74 5f 56 73 32 30 30 35 2e 6c 6f r_Test_Vs2005.lo
1e840 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 g]].... s
1e850 65 74 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c et testUninstall
1e860 56 73 32 30 30 38 4c 6f 67 46 69 6c 65 20 5b 66 Vs2008LogFile [f
1e870 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b ile nativename [
1e880 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 file join \..
1e890 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c [getSQL
1e8a0 69 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d iteTestDataPath]
1e8b0 20 55 6e 69 6e 73 74 61 6c 6c 65 72 5f 54 65 73 Uninstaller_Tes
1e8c0 74 5f 56 73 32 30 30 38 2e 6c 6f 67 5d 5d 0d 0a t_Vs2008.log]]..
1e8d0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 65 .. set te
1e8e0 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
1e8f0 30 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 0LogFile [file n
1e900 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 ativename [file
1e910 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 join \..
1e920 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 [getSQLiteTe
1e930 73 74 44 61 74 61 50 61 74 68 5d 20 55 6e 69 6e stDataPath] Unin
1e940 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 staller_Test_Vs2
1e950 30 31 30 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 010.log]]....
1e960 20 20 20 20 20 73 65 74 20 74 65 73 74 55 6e 69 set testUni
1e970 6e 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 nstallVs2012LogF
1e980 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 ile [file native
1e990 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 name [file join
1e9a0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
1e9b0 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 getSQLiteTestDat
1e9c0 61 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c aPath] Uninstall
1e9d0 65 72 5f 54 65 73 74 5f 56 73 32 30 31 32 2e 6c er_Test_Vs2012.l
1e9e0 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 og]]....
1e9f0 73 65 74 20 74 65 73 74 55 6e 69 6e 73 74 61 6c set testUninstal
1ea00 6c 56 73 32 30 31 33 4c 6f 67 46 69 6c 65 20 5b lVs2013LogFile [
1ea10 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 file nativename
1ea20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 [file join \..
1ea30 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 [getSQ
1ea40 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 74 68 LiteTestDataPath
1ea50 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 72 5f 54 65 ] Uninstaller_Te
1ea60 73 74 5f 56 73 32 30 31 33 2e 6c 6f 67 5d 5d 0d st_Vs2013.log]].
1ea70 0a 0d 0a 20 20 20 20 20 20 20 20 23 23 23 23 23 ... #####
1ea80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1ea90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1eaa0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1eab0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1eac0 23 23 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 ##.... if
1ead0 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 {![haveConstrai
1eae0 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 nt [appendArgs f
1eaf0 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 ile_ \..
1eb00 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
1eb10 65 6e 74 69 74 79 46 72 61 6d 65 77 6f 72 6b 44 entityFrameworkD
1eb20 6c 6c 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 llFile]]]} then
1eb30 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 {.. che
1eb40 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f ckForFile $test_
1eb50 63 68 61 6e 6e 65 6c 20 24 65 6e 74 69 74 79 46 channel $entityF
1eb60 72 61 6d 65 77 6f 72 6b 44 6c 6c 46 69 6c 65 0d rameworkDllFile.
1eb70 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
1eb80 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 if {![have
1eb90 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
1eba0 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a ndArgs file_ \..
1ebb0 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c [fil
1ebc0 65 20 74 61 69 6c 20 24 69 6e 73 74 61 6c 6c 65 e tail $installe
1ebd0 72 45 78 65 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 rExeFile]]]} the
1ebe0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 n {.. c
1ebf0 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
1ec00 74 5f 63 68 61 6e 6e 65 6c 20 24 69 6e 73 74 61 t_channel $insta
1ec10 6c 6c 65 72 45 78 65 46 69 6c 65 20 49 6e 73 74 llerExeFile Inst
1ec20 61 6c 6c 65 72 2e 65 78 65 0d 0a 20 20 20 20 20 aller.exe..
1ec30 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1ec40 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 if {![haveConstr
1ec50 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
1ec60 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 file_ \..
1ec70 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c [file tail
1ec80 20 24 73 71 6c 69 74 65 44 65 73 69 67 6e 65 72 $sqliteDesigner
1ec90 44 6c 6c 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e DllFile]]]} then
1eca0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 {.. ch
1ecb0 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 eckForFile $test
1ecc0 5f 63 68 61 6e 6e 65 6c 20 24 73 71 6c 69 74 65 _channel $sqlite
1ecd0 44 65 73 69 67 6e 65 72 44 6c 6c 46 69 6c 65 0d DesignerDllFile.
1ece0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
1ecf0 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 if {![have
1ed00 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
1ed10 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a ndArgs file_ \..
1ed20 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c [fil
1ed30 65 20 74 61 69 6c 20 24 73 79 73 74 65 6d 44 61 e tail $systemDa
1ed40 74 61 53 51 4c 69 74 65 44 6c 6c 46 69 6c 65 5d taSQLiteDllFile]
1ed50 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 ]]} then {..
1ed60 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 checkForFi
1ed70 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c le $test_channel
1ed80 20 24 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 $systemDataSQLi
1ed90 74 65 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 20 20 teDllFile..
1eda0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1edb0 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 if {![haveConstr
1edc0 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
1edd0 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 file_ \..
1ede0 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c [file tail
1edf0 20 24 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 $systemDataSQLi
1ee00 74 65 4c 69 6e 71 44 6c 6c 46 69 6c 65 5d 5d 5d teLinqDllFile]]]
1ee10 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1ee20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 checkForFile
1ee30 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 $test_channel $
1ee40 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 systemDataSQLite
1ee50 4c 69 6e 71 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 LinqDllFile..
1ee60 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1ee70 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
1ee80 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
1ee90 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
1eea0 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 [file ta
1eeb0 69 6c 20 24 73 79 73 74 65 6d 44 61 74 61 53 51 il $systemDataSQ
1eec0 4c 69 74 65 45 66 36 44 6c 6c 46 69 6c 65 5d 5d LiteEf6DllFile]]
1eed0 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1eee0 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
1eef0 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
1ef00 24 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 $systemDataSQLit
1ef10 65 45 66 36 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 eEf6DllFile..
1ef20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1ef30 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
1ef40 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
1ef50 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
1ef60 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 [file ta
1ef70 69 6c 20 24 74 65 73 74 45 78 65 46 69 6c 65 5d il $testExeFile]
1ef80 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 ]]} then {..
1ef90 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 checkForFi
1efa0 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c le $test_channel
1efb0 20 24 74 65 73 74 45 78 65 46 69 6c 65 20 74 65 $testExeFile te
1efc0 73 74 2e 65 78 65 0d 0a 20 20 20 20 20 20 20 20 st.exe..
1efd0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 }.... if
1efe0 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e {![haveConstrain
1eff0 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 t [appendArgs fi
1f000 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 le_ \..
1f010 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 [file tail $t
1f020 65 73 74 4c 69 6e 71 45 78 65 46 69 6c 65 5d 5d estLinqExeFile]]
1f030 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1f040 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
1f050 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
1f060 24 74 65 73 74 4c 69 6e 71 45 78 65 46 69 6c 65 $testLinqExeFile
1f070 20 74 65 73 74 6c 69 6e 71 2e 65 78 65 0d 0a 20 testlinq.exe..
1f080 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1f090 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f if {![haveCo
1f0a0 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
1f0b0 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 Args file_ \..
1f0c0 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
1f0d0 74 61 69 6c 20 24 74 65 73 74 45 66 36 45 78 65 tail $testEf6Exe
1f0e0 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d File]]]} then {.
1f0f0 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b . check
1f100 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 ForFile $test_ch
1f110 61 6e 6e 65 6c 20 24 74 65 73 74 45 66 36 45 78 annel $testEf6Ex
1f120 65 46 69 6c 65 20 74 65 73 74 65 66 36 2e 65 78 eFile testef6.ex
1f130 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a e.. }....
1f140 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 if {![ha
1f150 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 veConstraint [ap
1f160 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c pendArgs file_ \
1f170 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 .. [f
1f180 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 4c 69 ile tail $testLi
1f190 6e 71 4f 75 74 46 69 6c 65 5d 5d 5d 7d 20 74 68 nqOutFile]]]} th
1f1a0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1f1b0 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 checkForFile $te
1f1c0 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 st_channel $test
1f1d0 4c 69 6e 71 4f 75 74 46 69 6c 65 0d 0a 20 20 20 LinqOutFile..
1f1e0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1f1f0 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
1f200 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
1f210 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
1f220 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 [file ta
1f230 69 6c 20 24 6e 6f 72 74 68 77 69 6e 64 45 66 44 il $northwindEfD
1f240 62 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b bFile]]]} then {
1f250 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
1f260 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
1f270 68 61 6e 6e 65 6c 20 24 6e 6f 72 74 68 77 69 6e hannel $northwin
1f280 64 45 66 44 62 46 69 6c 65 0d 0a 20 20 20 20 20 dEfDbFile..
1f290 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1f2a0 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 if {![haveConstr
1f2b0 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
1f2c0 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 file_ \..
1f2d0 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c [file tail
1f2e0 20 24 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 5d 5d $nonWalDbFile]]
1f2f0 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1f300 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
1f310 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
1f320 24 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 0d 0a 20 $nonWalDbFile..
1f330 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1f340 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f if {![haveCo
1f350 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
1f360 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 Args file_ \..
1f370 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
1f380 74 61 69 6c 20 24 77 61 6c 44 62 46 69 6c 65 5d tail $walDbFile]
1f390 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 ]]} then {..
1f3a0 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 checkForFi
1f3b0 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c le $test_channel
1f3c0 20 24 77 61 6c 44 62 46 69 6c 65 0d 0a 20 20 20 $walDbFile..
1f3d0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1f3e0 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
1f3f0 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
1f400 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
1f410 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 [file ta
1f420 69 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 il $testInstallV
1f430 73 32 30 30 35 4c 6f 67 46 69 6c 65 5d 5d 5d 7d s2005LogFile]]]}
1f440 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1f450 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 checkForFile
1f460 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 $test_channel $t
1f470 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 30 35 estInstallVs2005
1f480 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 LogFile..
1f490 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 }.... if
1f4a0 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 {![haveConstrai
1f4b0 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 nt [appendArgs f
1f4c0 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 ile_ \..
1f4d0 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
1f4e0 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 30 testInstallVs200
1f4f0 38 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 8LogFile]]]} the
1f500 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 n {.. c
1f510 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
1f520 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 49 t_channel $testI
1f530 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 nstallVs2008LogF
1f540 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a ile.. }..
1f550 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b .. if {![
1f560 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
1f570 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
1f580 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1f590 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 [file tail $test
1f5a0 49 6e 73 74 61 6c 6c 56 73 32 30 31 30 4c 6f 67 InstallVs2010Log
1f5b0 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d File]]]} then {.
1f5c0 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b . check
1f5d0 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 ForFile $test_ch
1f5e0 61 6e 6e 65 6c 20 24 74 65 73 74 49 6e 73 74 61 annel $testInsta
1f5f0 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 6c 65 0d llVs2010LogFile.
1f600 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
1f610 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 if {![have
1f620 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
1f630 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a ndArgs file_ \..
1f640 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c [fil
1f650 65 20 74 61 69 6c 20 24 74 65 73 74 49 6e 73 74 e tail $testInst
1f660 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 allVs2012LogFile
1f670 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ]]]} then {..
1f680 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 checkForF
1f690 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 ile $test_channe
1f6a0 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 l $testInstallVs
1f6b0 32 30 31 32 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 2012LogFile..
1f6c0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1f6d0 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
1f6e0 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
1f6f0 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
1f700 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 [file ta
1f710 69 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 il $testInstallV
1f720 73 32 30 31 33 4c 6f 67 46 69 6c 65 5d 5d 5d 7d s2013LogFile]]]}
1f730 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1f740 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 checkForFile
1f750 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 $test_channel $t
1f760 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 33 estInstallVs2013
1f770 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 LogFile..
1f780 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 }.... if
1f790 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 {![haveConstrai
1f7a0 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 nt [appendArgs f
1f7b0 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 ile_ \..
1f7c0 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
1f7d0 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
1f7e0 30 30 35 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 005LogFile]]]} t
1f7f0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1f800 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
1f810 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 est_channel $tes
1f820 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 35 tUninstallVs2005
1f830 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 LogFile..
1f840 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 }.... if
1f850 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 {![haveConstrai
1f860 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 nt [appendArgs f
1f870 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 ile_ \..
1f880 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
1f890 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
1f8a0 30 30 38 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 008LogFile]]]} t
1f8b0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1f8c0 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
1f8d0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 est_channel $tes
1f8e0 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 38 tUninstallVs2008
1f8f0 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 LogFile..
1f900 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 }.... if
1f910 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 {![haveConstrai
1f920 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 nt [appendArgs f
1f930 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 ile_ \..
1f940 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
1f950 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
1f960 30 31 30 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 010LogFile]]]} t
1f970 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1f980 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
1f990 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 est_channel $tes
1f9a0 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 30 tUninstallVs2010
1f9b0 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 LogFile..
1f9c0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 }.... if
1f9d0 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 {![haveConstrai
1f9e0 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 nt [appendArgs f
1f9f0 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 ile_ \..
1fa00 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
1fa10 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
1fa20 30 31 32 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 012LogFile]]]} t
1fa30 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1fa40 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
1fa50 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 est_channel $tes
1fa60 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 32 tUninstallVs2012
1fa70 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 LogFile..
1fa80 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 }.... if
1fa90 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 {![haveConstrai
1faa0 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 nt [appendArgs f
1fab0 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 ile_ \..
1fac0 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
1fad0 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
1fae0 30 31 33 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 013LogFile]]]} t
1faf0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1fb00 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
1fb10 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 est_channel $tes
1fb20 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 33 tUninstallVs2013
1fb30 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 LogFile..
1fb40 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 }.. }..
1fb50 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
1fb60 72 75 6e 53 51 4c 69 74 65 54 65 73 74 46 69 6c runSQLiteTestFil
1fb70 65 73 45 70 69 6c 6f 67 75 65 20 7b 7d 20 7b 0d esEpilogue {} {.
1fb80 0a 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 . uplevel 1
1fb90 20 7b 0d 0a 20 20 20 20 20 20 20 20 75 6e 73 65 {.. unse
1fba0 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 5c 0d t -nocomplain \.
1fbb0 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 65 73 . tes
1fbc0 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 33 tUninstallVs2013
1fbd0 4c 6f 67 46 69 6c 65 20 74 65 73 74 55 6e 69 6e LogFile testUnin
1fbe0 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 stallVs2012LogFi
1fbf0 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 le \..
1fc00 20 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 testUninstallV
1fc10 73 32 30 31 30 4c 6f 67 46 69 6c 65 20 74 65 73 s2010LogFile tes
1fc20 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 38 tUninstallVs2008
1fc30 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 LogFile \..
1fc40 20 20 20 20 20 20 20 74 65 73 74 55 6e 69 6e 73 testUnins
1fc50 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 69 6c tallVs2005LogFil
1fc60 65 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 e testInstallVs2
1fc70 30 31 33 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 20 013LogFile \..
1fc80 20 20 20 20 20 20 20 20 20 20 74 65 73 74 49 6e testIn
1fc90 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 stallVs2012LogFi
1fca0 6c 65 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 le testInstallVs
1fcb0 32 30 31 30 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 2010LogFile \..
1fcc0 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 49 testI
1fcd0 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 nstallVs2008LogF
1fce0 69 6c 65 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 ile testInstallV
1fcf0 73 32 30 30 35 4c 6f 67 46 69 6c 65 0d 0a 0d 0a s2005LogFile....
1fd00 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 2d 6e unset -n
1fd10 6f 63 6f 6d 70 6c 61 69 6e 20 5c 0d 0a 20 20 20 ocomplain \..
1fd20 20 20 20 20 20 20 20 20 20 6e 6f 72 74 68 77 69 northwi
1fd30 6e 64 45 66 44 62 46 69 6c 65 20 74 65 73 74 4c ndEfDbFile testL
1fd40 69 6e 71 4f 75 74 46 69 6c 65 20 5c 0d 0a 20 20 inqOutFile \..
1fd50 20 20 20 20 20 20 20 20 20 20 77 61 6c 44 62 46 walDbF
1fd60 69 6c 65 20 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 ile nonWalDbFile
1fd70 0d 0a 0d 0a 20 20 20 20 20 20 20 20 75 6e 73 65 .... unse
1fd80 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 5c 0d t -nocomplain \.
1fd90 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 65 73 . tes
1fda0 74 45 66 36 45 78 65 46 69 6c 65 20 74 65 73 74 tEf6ExeFile test
1fdb0 4c 69 6e 71 45 78 65 46 69 6c 65 20 5c 0d 0a 20 LinqExeFile \..
1fdc0 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 45 testE
1fdd0 78 65 46 69 6c 65 20 73 79 73 74 65 6d 44 61 74 xeFile systemDat
1fde0 61 53 51 4c 69 74 65 45 66 36 44 6c 6c 46 69 6c aSQLiteEf6DllFil
1fdf0 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
1fe00 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 systemDataSQLit
1fe10 65 4c 69 6e 71 44 6c 6c 46 69 6c 65 20 73 79 73 eLinqDllFile sys
1fe20 74 65 6d 44 61 74 61 53 51 4c 69 74 65 44 6c 6c temDataSQLiteDll
1fe30 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 File \..
1fe40 20 20 20 20 73 71 6c 69 74 65 44 65 73 69 67 6e sqliteDesign
1fe50 65 72 44 6c 6c 46 69 6c 65 20 69 6e 73 74 61 6c erDllFile instal
1fe60 6c 65 72 45 78 65 46 69 6c 65 20 5c 0d 0a 20 20 lerExeFile \..
1fe70 20 20 20 20 20 20 20 20 20 20 65 6e 74 69 74 79 entity
1fe80 46 72 61 6d 65 77 6f 72 6b 44 6c 6c 46 69 6c 65 FrameworkDllFile
1fe90 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
1fea0 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 75 ..... proc ru
1feb0 6e 53 51 4c 69 74 65 54 65 73 74 45 70 69 6c 6f nSQLiteTestEpilo
1fec0 67 75 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 gue {} {..
1fed0 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
1fee0 20 53 6b 69 70 20 72 75 6e 6e 69 6e 67 20 6f 75 Skip running ou
1fef0 72 20 63 75 73 74 6f 6d 20 65 70 69 6c 6f 67 75 r custom epilogu
1ff00 65 20 69 66 20 74 68 65 20 6d 61 69 6e 20 6f 6e e if the main on
1ff10 65 20 68 61 73 20 62 65 65 6e 0d 0a 20 20 20 20 e has been..
1ff20 20 20 23 20 20 20 20 20 20 20 73 6b 69 70 70 65 # skippe
1ff30 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 d... #..
1ff40 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
1ff50 69 73 74 73 20 3a 3a 6e 6f 28 65 70 69 6c 6f 67 ists ::no(epilog
1ff60 75 65 2e 65 61 67 6c 65 29 5d 7d 20 74 68 65 6e ue.eagle)]} then
1ff70 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
1ff80 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 # NOTE: S
1ff90 68 6f 77 20 77 68 65 6e 20 6f 75 72 20 74 65 73 how when our tes
1ffa0 74 73 20 61 63 74 75 61 6c 6c 79 20 65 6e 64 65 ts actually ende
1ffb0 64 20 28 6e 6f 77 29 2e 0d 0a 20 20 20 20 20 20 d (now)...
1ffc0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 70 75 #.. tpu
1ffd0 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
1ffe0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
1fff0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d .. "-
20000 2d 2d 2d 20 53 79 73 74 65 6d 2e 44 61 74 61 2e --- System.Data.
20010 53 51 4c 69 74 65 20 74 65 73 74 73 20 65 6e 64 SQLite tests end
20020 65 64 20 61 74 20 22 20 5c 0d 0a 20 20 20 20 20 ed at " \..
20030 20 20 20 20 20 20 20 5b 63 6c 6f 63 6b 20 66 6f [clock fo
20040 72 6d 61 74 20 5b 63 6c 6f 63 6b 20 73 65 63 6f rmat [clock seco
20050 6e 64 73 5d 5d 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 nds]] \n]....
20060 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
20070 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 20 74 68 65 # NOTE: Load the
20080 20 22 65 70 69 6c 6f 67 75 65 22 20 63 75 73 74 "epilogue" cust
20090 6f 6d 20 70 65 72 2d 75 73 65 72 20 61 6e 64 2f om per-user and/
200a0 6f 72 20 70 65 72 2d 68 6f 73 74 20 74 65 73 74 or per-host test
200b0 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
200c0 20 20 73 65 74 74 69 6e 67 73 20 6e 6f 77 2e 0d settings now..
200d0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
200e0 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 5b 6c uplevel 1 [l
200f0 69 73 74 20 6c 6f 61 64 53 51 4c 69 74 65 54 65 ist loadSQLiteTe
20100 73 74 53 65 74 74 69 6e 67 73 20 24 3a 3a 74 65 stSettings $::te
20110 73 74 5f 63 68 61 6e 6e 65 6c 20 2e 65 70 69 6c st_channel .epil
20120 6f 67 75 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 ogue]....
20130 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 42 55 #.. # BU
20140 47 46 49 58 3a 20 42 65 66 6f 72 65 20 63 68 65 GFIX: Before che
20150 63 6b 69 6e 67 20 74 68 65 20 66 69 6e 61 6c 20 cking the final
20160 72 65 73 6f 75 72 63 65 73 20 69 6e 20 75 73 65 resources in use
20170 20 62 79 20 53 51 4c 69 74 65 2c 20 6d 61 6b 65 by SQLite, make
20180 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
20190 20 20 20 20 73 75 72 65 20 62 6f 74 68 20 6f 66 sure both of
201a0 20 74 68 65 20 50 52 41 47 4d 41 20 72 65 6c 61 the PRAGMA rela
201b0 74 65 64 20 64 69 72 65 63 74 6f 72 79 20 6e 61 ted directory na
201c0 6d 65 73 20 61 72 65 20 66 72 65 65 64 2e 0d 0a mes are freed...
201d0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
201e0 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 checkForSQLit
201f0 65 44 69 72 65 63 74 6f 72 69 65 73 20 24 3a 3a eDirectories $::
20200 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 74 72 75 test_channel tru
20210 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a e.... #..
20220 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
20230 41 6c 73 6f 20 72 65 70 6f 72 74 20 74 68 65 20 Also report the
20240 72 65 73 6f 75 72 63 65 20 75 73 61 67 65 20 61 resource usage a
20250 66 74 65 72 20 72 75 6e 6e 69 6e 67 20 74 68 65 fter running the
20260 20 74 65 73 74 73 2e 0d 0a 20 20 20 20 20 20 20 tests...
20270 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 70 6f #.. repo
20280 72 74 53 51 4c 69 74 65 52 65 73 6f 75 72 63 65 rtSQLiteResource
20290 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
202a0 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a l.... #..
202b0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
202c0 52 65 70 6f 72 74 20 74 68 65 20 63 72 69 74 69 Report the criti
202d0 63 61 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 cal handle count
202e0 73 20 61 66 74 65 72 20 72 75 6e 6e 69 6e 67 20 s after running
202f0 74 68 65 20 74 65 73 74 73 2e 0d 0a 20 20 20 20 the tests...
20300 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 67 #.. g
20310 65 74 53 51 4c 69 74 65 48 61 6e 64 6c 65 43 6f etSQLiteHandleCo
20320 75 6e 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 unts $::test_cha
20330 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 20 nnel....
20340 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
20350 45 3a 20 49 66 20 6e 65 63 65 73 73 61 72 79 2c E: If necessary,
20360 20 64 69 73 61 62 6c 65 20 73 68 61 72 65 64 2d disable shared-
20370 63 61 63 68 65 20 6d 6f 64 65 20 6e 6f 77 2e 0d cache mode now..
20380 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
20390 20 20 20 20 69 66 20 7b 5b 68 61 73 52 75 6e 74 if {[hasRunt
203a0 69 6d 65 4f 70 74 69 6f 6e 20 73 68 61 72 65 64 imeOption shared
203b0 43 61 63 68 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a Cache]} then {..
203c0 20 20 20 20 20 20 20 20 20 20 65 6e 61 62 6c 65 enable
203d0 53 68 61 72 65 64 43 61 63 68 65 20 24 3a 3a 74 SharedCache $::t
203e0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 66 61 6c 73 est_channel fals
203f0 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 e.. }..
20400 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
20410 0a 20 20 20 20 23 23 23 23 23 23 23 23 23 23 23 . ###########
20420 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20430 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20440 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20450 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20460 0d 0a 20 20 20 20 23 23 23 23 23 23 23 23 23 23 .. ##########
20470 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20480 23 23 23 20 45 4e 44 20 45 61 67 6c 65 20 4f 4e ### END Eagle ON
20490 4c 59 20 23 23 23 23 23 23 23 23 23 23 23 23 23 LY #############
204a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
204b0 23 0d 0a 20 20 20 20 23 23 23 23 23 23 23 23 23 #.. #########
204c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
204d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
204e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
204f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
20500 23 23 0d 0a 20 20 7d 0d 0a 0d 0a 20 20 23 0d 0a ##.. }.... #..
20510 20 20 23 20 4e 4f 54 45 3a 20 53 61 76 65 20 74 # NOTE: Save t
20520 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 64 he name of the d
20530 69 72 65 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e irectory contain
20540 69 6e 67 20 74 68 69 73 20 66 69 6c 65 2e 0d 0a ing this file...
20550 20 20 23 0d 0a 20 20 69 66 20 7b 21 5b 69 6e 66 #.. if {![inf
20560 6f 20 65 78 69 73 74 73 20 63 6f 6d 6d 6f 6e 5f o exists common_
20570 64 69 72 65 63 74 6f 72 79 5d 7d 20 74 68 65 6e directory]} then
20580 20 7b 0d 0a 20 20 20 20 73 65 74 20 63 6f 6d 6d {.. set comm
20590 6f 6e 5f 64 69 72 65 63 74 6f 72 79 20 5b 66 69 on_directory [fi
205a0 6c 65 20 64 69 72 6e 61 6d 65 20 5b 69 6e 66 6f le dirname [info
205b0 20 73 63 72 69 70 74 5d 5d 0d 0a 20 20 7d 0d 0a script]].. }..
205c0 0d 0a 20 20 23 0d 0a 20 20 23 20 4e 4f 54 45 3a .. #.. # NOTE:
205d0 20 50 72 6f 76 69 64 65 20 74 68 65 20 53 79 73 Provide the Sys
205e0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
205f0 74 65 73 74 20 70 61 63 6b 61 67 65 20 74 6f 20 test package to
20600 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 2e the interpreter.
20610 0d 0a 20 20 23 0d 0a 20 20 70 61 63 6b 61 67 65 .. #.. package
20620 20 70 72 6f 76 69 64 65 20 53 79 73 74 65 6d 2e provide System.
20630 44 61 74 61 2e 53 51 4c 69 74 65 2e 54 65 73 74 Data.SQLite.Test
20640 20 31 2e 30 0d 0a 7d 0d 0a 1.0..}..