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 32 30 31 2010, 2012, 201
0460: 33 2c 20 6f 72 20 32 30 31 35 20 62 75 69 6c 64 3, or 2015 build
0470: 20 73 79 73 74 65 6d 73 2e 20 20 54 6f 20 6f 76 systems. To ov
0480: 65 72 72 69 64 65 0d 0a 20 20 20 20 20 20 23 20 erride.. #
0490: 20 20 20 20 20 20 74 68 69 73 20 76 61 6c 75 65 this value
04a0: 20 76 69 61 20 74 68 65 20 63 6f 6d 6d 61 6e 64 via the command
04b0: 20 6c 69 6e 65 2c 20 65 6e 74 65 72 20 61 20 63 line, enter a c
04c0: 6f 6d 6d 61 6e 64 20 73 69 6d 69 6c 61 72 20 74 ommand similar t
04d0: 6f 20 6f 6e 65 0d 0a 20 20 20 20 20 20 23 20 20 o one.. #
04e0: 20 20 20 20 20 6f 66 20 74 68 65 20 66 6f 6c 6c of the foll
04f0: 6f 77 69 6e 67 20 28 61 6c 6c 20 6f 6e 20 6f 6e owing (all on on
0500: 65 20 6c 69 6e 65 29 3a 0d 0a 20 20 20 20 20 20 e line):..
0510: 23 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 #.. #
0520: 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 20 EagleShell.exe
0530: 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a 65 20 22 -anyInitialize "
0540: 73 65 74 20 74 65 73 74 5f 79 65 61 72 20 32 30 set test_year 20
0550: 30 35 22 0d 0a 20 20 20 20 20 20 23 20 20 20 20 05".. #
0560: 20 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 -file .\pat
0570: 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a h\to\all.eagle..
0580: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
0590: 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c EagleShel
05a0: 6c 2e 65 78 65 20 2d 61 6e 79 49 6e 69 74 69 61 l.exe -anyInitia
05b0: 6c 69 7a 65 20 22 73 65 74 20 74 65 73 74 5f 79 lize "set test_y
05c0: 65 61 72 20 32 30 30 38 22 0d 0a 20 20 20 20 20 ear 2008"..
05d0: 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 6c 65 # -file
05e0: 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 .\path\to\all.e
05f0: 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a 20 agle.. #..
0600: 20 20 20 20 20 23 20 20 20 20 20 20 20 45 61 67 # Eag
0610: 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 leShell.exe -any
0620: 49 6e 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 Initialize "set
0630: 74 65 73 74 5f 79 65 61 72 20 32 30 31 30 22 0d test_year 2010".
0640: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 . #
0650: 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 6f -file .\path\to
0660: 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 20 \all.eagle..
0670: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 20 #.. #
0680: 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 EagleShell.ex
0690: 65 20 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a 65 e -anyInitialize
06a0: 20 22 73 65 74 20 74 65 73 74 5f 79 65 61 72 20 "set test_year
06b0: 32 30 31 32 22 0d 0a 20 20 20 20 20 20 23 20 20 2012".. #
06c0: 20 20 20 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 -file .\p
06d0: 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 ath\to\all.eagle
06e0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
06f0: 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 # EagleSh
0700: 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 49 6e 69 74 ell.exe -anyInit
0710: 69 61 6c 69 7a 65 20 22 73 65 74 20 74 65 73 74 ialize "set test
0720: 5f 79 65 61 72 20 32 30 31 33 22 0d 0a 20 20 20 _year 2013"..
0730: 20 20 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 # -fi
0740: 6c 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c le .\path\to\all
0750: 2e 65 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d .eagle.. #.
0760: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 45 . # E
0770: 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d 61 agleShell.exe -a
0780: 6e 79 49 6e 69 74 69 61 6c 69 7a 65 20 22 73 65 nyInitialize "se
0790: 74 20 74 65 73 74 5f 79 65 61 72 20 32 30 31 35 t test_year 2015
07a0: 22 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 ".. #
07b0: 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c -file .\path\
07c0: 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 to\all.eagle..
07d0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 #.. #
07e0: 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e EagleShell.
07f0: 65 78 65 20 2d 61 6e 79 49 6e 69 74 69 61 6c 69 exe -anyInitiali
0800: 7a 65 20 22 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d ze "unset -nocom
0810: 70 6c 61 69 6e 20 74 65 73 74 5f 79 65 61 72 22 plain test_year"
0820: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
0830: 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 -file .\path\t
0840: 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 o\all.eagle..
0850: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
0860: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
0870: 65 73 74 5f 79 65 61 72 5d 20 26 26 20 5b 73 74 est_year] && [st
0880: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 ring length $::t
0890: 65 73 74 5f 79 65 61 72 5d 20 3e 20 30 7d 20 74 est_year] > 0} t
08a0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
08b0: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
08c0: 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 69 66 : Use the specif
08d0: 69 65 64 20 74 65 73 74 20 79 65 61 72 2e 20 20 ied test year.
08e0: 49 66 20 74 68 69 73 20 76 61 72 69 61 62 6c 65 If this variable
08f0: 20 69 73 20 6e 6f 74 20 73 65 74 2c 20 74 68 65 is not set, the
0900: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
0910: 20 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 20 default value
0920: 77 69 6c 6c 20 62 65 20 62 61 73 65 64 20 6f 6e will be based on
0930: 20 77 68 65 74 68 65 72 20 6f 72 20 6e 6f 74 20 whether or not
0940: 45 61 67 6c 65 20 68 61 73 20 62 65 65 6e 0d 0a Eagle has been..
0950: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
0960: 63 6f 6d 70 69 6c 65 64 20 61 67 61 69 6e 73 74 compiled against
0970: 20 74 68 65 20 43 4c 52 20 76 32 2e 30 20 6f 72 the CLR v2.0 or
0980: 20 43 4c 52 20 76 34 2e 30 2e 0d 0a 20 20 20 20 CLR v4.0...
0990: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
09a0: 65 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f 79 65 eturn $::test_ye
09b0: 61 72 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 ar.. } else
09c0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
09d0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 # NOTE: I
09e0: 66 20 45 61 67 6c 65 20 68 61 73 20 62 65 65 6e f Eagle has been
09f0: 20 63 6f 6d 70 69 6c 65 64 20 61 67 61 69 6e 73 compiled agains
0a00: 74 20 74 68 65 20 43 4c 52 20 76 34 2e 30 2c 20 t the CLR v4.0,
0a10: 75 73 65 20 22 32 30 31 30 22 20 62 79 0d 0a 20 use "2010" by..
0a20: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 # d
0a30: 65 66 61 75 6c 74 20 28 77 65 20 63 6f 75 6c 64 efault (we could
0a40: 20 75 73 65 20 22 32 30 31 32 22 2c 20 22 32 30 use "2012", "20
0a50: 31 33 22 2c 20 6f 72 20 22 32 30 31 35 22 20 69 13", or "2015" i
0a60: 6e 20 74 68 61 74 20 63 61 73 65 20 61 73 0d 0a n that case as..
0a70: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
0a80: 77 65 6c 6c 29 20 61 73 20 74 68 65 20 74 65 73 well) as the tes
0a90: 74 20 79 65 61 72 3b 20 6f 74 68 65 72 77 69 73 t year; otherwis
0aa0: 65 2c 20 75 73 65 20 22 32 30 30 38 22 20 62 79 e, use "2008" by
0ab0: 20 64 65 66 61 75 6c 74 20 28 77 65 0d 0a 20 20 default (we..
0ac0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
0ad0: 75 6c 64 20 75 73 65 20 22 32 30 30 35 22 20 69 uld use "2005" i
0ae0: 6e 20 74 68 61 74 20 63 61 73 65 20 61 73 20 77 n that case as w
0af0: 65 6c 6c 29 2e 20 20 49 66 20 61 6e 6f 74 68 65 ell). If anothe
0b00: 72 20 6d 61 6a 6f 72 0d 0a 20 20 20 20 20 20 20 r major..
0b10: 20 23 20 20 20 20 20 20 20 5b 69 6e 63 6f 6d 70 # [incomp
0b20: 61 74 69 62 6c 65 5d 20 76 65 72 73 69 6f 6e 20 atible] version
0b30: 6f 66 20 74 68 65 20 43 4c 52 20 69 73 20 72 65 of the CLR is re
0b40: 6c 65 61 73 65 64 2c 20 74 68 69 73 20 63 68 65 leased, this che
0b50: 63 6b 20 77 69 6c 6c 0d 0a 20 20 20 20 20 20 20 ck will..
0b60: 20 23 20 20 20 20 20 20 20 68 61 76 65 20 74 6f # have to
0b70: 20 62 65 20 63 68 61 6e 67 65 64 2e 20 20 54 68 be changed. Th
0b80: 65 20 64 65 66 61 75 6c 74 20 74 65 73 74 20 79 e default test y
0b90: 65 61 72 20 74 6f 20 75 73 65 20 66 6f 72 20 61 ear to use for a
0ba0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
0bb0: 20 20 70 61 72 74 69 63 75 6c 61 72 20 43 4c 52 particular CLR
0bc0: 20 76 65 72 73 69 6f 6e 20 6d 61 79 20 62 65 20 version may be
0bd0: 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 73 65 overridden by se
0be0: 74 74 69 6e 67 20 74 68 65 20 67 6c 6f 62 61 6c tting the global
0bf0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
0c00: 20 20 76 61 72 69 61 62 6c 65 20 22 74 65 73 74 variable "test
0c10: 5f 79 65 61 72 5f 63 6c 72 5f 76 24 58 22 2c 20 _year_clr_v$X",
0c20: 77 68 65 72 65 20 22 24 58 22 20 6d 61 79 20 5b where "$X" may [
0c30: 63 75 72 72 65 6e 74 6c 79 5d 20 62 65 0d 0a 20 currently] be..
0c40: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 65 # e
0c50: 69 74 68 65 72 20 22 32 22 20 6f 72 20 22 34 22 ither "2" or "4"
0c60: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
0c70: 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 43 if {[haveC
0c80: 6f 6e 73 74 72 61 69 6e 74 20 69 6d 61 67 65 52 onstraint imageR
0c90: 75 6e 74 69 6d 65 34 30 5d 7d 20 74 68 65 6e 20 untime40]} then
0ca0: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 {.. if
0cb0: 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a {[info exists ::
0cc0: 74 65 73 74 5f 79 65 61 72 5f 63 6c 72 5f 76 34 test_year_clr_v4
0cd0: 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] && \..
0ce0: 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 [string le
0cf0: 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 79 65 61 ngth $::test_yea
0d00: 72 5f 63 6c 72 5f 76 34 5d 20 3e 20 30 7d 20 74 r_clr_v4] > 0} t
0d10: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
0d20: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
0d30: 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 # NOTE: Use th
0d40: 65 20 73 70 65 63 69 66 69 65 64 20 74 65 73 74 e specified test
0d50: 20 79 65 61 72 20 66 6f 72 20 74 68 65 20 43 4c year for the CL
0d60: 52 20 76 34 2e 30 2e 0d 0a 20 20 20 20 20 20 20 R v4.0...
0d70: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
0d80: 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 74 65 return $::te
0d90: 73 74 5f 79 65 61 72 5f 63 6c 72 5f 76 34 0d 0a st_year_clr_v4..
0da0: 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 } else
0db0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
0dc0: 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 #.. #
0dd0: 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 64 NOTE: Use the d
0de0: 65 66 61 75 6c 74 20 74 65 73 74 20 79 65 61 72 efault test year
0df0: 20 66 6f 72 20 74 68 65 20 43 4c 52 20 76 34 2e for the CLR v4.
0e00: 30 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 0...
0e10: 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 #.. r
0e20: 65 74 75 72 6e 20 32 30 31 30 3b 20 23 20 54 4f eturn 2010; # TO
0e30: 44 4f 3a 20 47 6f 6f 64 20 22 66 61 6c 6c 62 61 DO: Good "fallba
0e40: 63 6b 22 20 64 65 66 61 75 6c 74 3f 0d 0a 20 20 ck" default?..
0e50: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
0e60: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
0e70: 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f if {[info
0e80: 20 65 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 79 exists ::test_y
0e90: 65 61 72 5f 63 6c 72 5f 76 32 5d 20 26 26 20 5c ear_clr_v2] && \
0ea0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
0eb0: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
0ec0: 3a 3a 74 65 73 74 5f 79 65 61 72 5f 63 6c 72 5f ::test_year_clr_
0ed0: 76 32 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d v2] > 0} then {.
0ee0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
0ef0: 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f # NO
0f00: 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 TE: Use the spec
0f10: 69 66 69 65 64 20 74 65 73 74 20 79 65 61 72 20 ified test year
0f20: 66 6f 72 20 74 68 65 20 43 4c 52 20 76 32 2e 30 for the CLR v2.0
0f30: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 ... #
0f40: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
0f50: 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f 79 65 61 turn $::test_yea
0f60: 72 5f 63 6c 72 5f 76 32 0d 0a 20 20 20 20 20 20 r_clr_v2..
0f70: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
0f80: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
0f90: 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
0fa0: 20 55 73 65 20 74 68 65 20 64 65 66 61 75 6c 74 Use the default
0fb0: 20 74 65 73 74 20 79 65 61 72 20 66 6f 72 20 74 test year for t
0fc0: 68 65 20 43 4c 52 20 76 32 2e 30 2e 0d 0a 20 20 he CLR v2.0...
0fd0: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
0fe0: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
0ff0: 32 30 30 38 3b 20 23 20 54 4f 44 4f 3a 20 47 6f 2008; # TODO: Go
1000: 6f 64 20 22 66 61 6c 6c 62 61 63 6b 22 20 64 65 od "fallback" de
1010: 66 61 75 6c 74 3f 0d 0a 20 20 20 20 20 20 20 20 fault?..
1020: 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
1030: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
1040: 0c 0d 0a 20 20 20 20 23 0d 0a 20 20 20 20 23 20 ... #.. #
1050: 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f 63 65 NOTE: This proce
1060: 64 75 72 65 20 69 73 20 6f 6e 6c 79 20 75 73 65 dure is only use
1070: 64 20 77 68 65 6e 20 61 64 64 69 6e 67 20 73 68 d when adding sh
1080: 69 6d 6d 65 64 20 74 65 73 74 20 63 6f 6e 73 74 immed test const
1090: 72 61 69 6e 74 73 2e 0d 0a 20 20 20 20 23 0d 0a raints... #..
10a0: 20 20 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c proc getBuil
10b0: 64 43 6c 72 56 65 72 73 69 6f 6e 20 7b 7d 20 7b dClrVersion {} {
10c0: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 .. if {[inf
10d0: 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 73 74 5f o exists ::test_
10e0: 63 6c 72 5d 20 26 26 20 5b 73 74 72 69 6e 67 20 clr] && [string
10f0: 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 63 length $::test_c
1100: 6c 72 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d lr] > 0} then {.
1110: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1120: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
1130: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 74 65 the specified te
1140: 73 74 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 74 st version for t
1150: 68 65 20 43 4c 52 2e 20 20 49 66 20 74 68 69 73 he CLR. If this
1160: 20 76 61 72 69 61 62 6c 65 0d 0a 20 20 20 20 20 variable..
1170: 20 20 20 23 20 20 20 20 20 20 20 69 73 20 6e 6f # is no
1180: 74 20 73 65 74 2c 20 74 68 65 20 64 65 66 61 75 t set, the defau
1190: 6c 74 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 65 lt value will be
11a0: 20 62 61 73 65 64 20 6f 6e 20 77 68 65 74 68 65 based on whethe
11b0: 72 20 6f 72 20 6e 6f 74 0d 0a 20 20 20 20 20 20 r or not..
11c0: 20 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 20 # Eagle
11d0: 68 61 73 20 62 65 65 6e 20 63 6f 6d 70 69 6c 65 has been compile
11e0: 64 20 61 67 61 69 6e 73 74 20 74 68 65 20 43 4c d against the CL
11f0: 52 20 76 32 2e 30 20 6f 72 20 43 4c 52 20 76 34 R v2.0 or CLR v4
1200: 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a .0... #..
1210: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
1220: 3a 3a 74 65 73 74 5f 63 6c 72 0d 0a 20 20 20 20 ::test_clr..
1230: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
1240: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
1250: 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 NOTE: Check if
1260: 45 61 67 6c 65 20 68 61 73 20 62 65 65 6e 20 63 Eagle has been c
1270: 6f 6d 70 69 6c 65 64 20 61 67 61 69 6e 73 74 20 ompiled against
1280: 74 68 65 20 43 4c 52 20 76 34 2e 30 2e 20 20 49 the CLR v4.0. I
1290: 66 20 73 6f 2c 0d 0a 20 20 20 20 20 20 20 20 23 f so,.. #
12a0: 20 20 20 20 20 20 20 6a 75 73 74 20 75 73 65 20 just use
12b0: 74 68 61 74 20 43 4c 52 20 76 65 72 73 69 6f 6e that CLR version
12c0: 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 75 73 . Otherwise, us
12d0: 65 20 74 68 65 20 76 65 72 73 69 6f 6e 20 66 6f e the version fo
12e0: 72 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 r the.. #
12f0: 20 20 20 20 20 20 20 43 4c 52 20 76 32 2e 30 2e CLR v2.0.
1300: 20 20 49 66 20 61 6e 6f 74 68 65 72 20 6d 61 6a If another maj
1310: 6f 72 20 5b 69 6e 63 6f 6d 70 61 74 69 62 6c 65 or [incompatible
1320: 5d 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 ] version of the
1330: 20 43 4c 52 0d 0a 20 20 20 20 20 20 20 20 23 20 CLR.. #
1340: 20 20 20 20 20 20 69 73 20 72 65 6c 65 61 73 65 is release
1350: 64 2c 20 74 68 69 73 20 63 68 65 63 6b 20 77 69 d, this check wi
1360: 6c 6c 20 68 61 76 65 20 74 6f 20 62 65 20 63 68 ll have to be ch
1370: 61 6e 67 65 64 2e 20 20 54 68 65 20 64 65 66 61 anged. The defa
1380: 75 6c 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ult.. #
1390: 20 20 20 20 20 76 65 72 73 69 6f 6e 20 76 61 6c version val
13a0: 75 65 20 66 6f 72 20 61 20 70 61 72 74 69 63 75 ue for a particu
13b0: 6c 61 72 20 43 4c 52 20 76 65 72 73 69 6f 6e 20 lar CLR version
13c0: 6d 61 79 20 62 65 20 6f 76 65 72 72 69 64 64 65 may be overridde
13d0: 6e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 n.. #
13e0: 20 20 20 62 79 20 73 65 74 74 69 6e 67 20 74 68 by setting th
13f0: 65 20 67 6c 6f 62 61 6c 20 76 61 72 69 61 62 6c e global variabl
1400: 65 20 22 74 65 73 74 5f 63 6c 72 5f 76 24 58 22 e "test_clr_v$X"
1410: 2c 20 77 68 65 72 65 20 22 24 58 22 20 6d 61 79 , where "$X" may
1420: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
1430: 20 20 5b 63 75 72 72 65 6e 74 6c 79 5d 20 62 65 [currently] be
1440: 20 65 69 74 68 65 72 20 22 32 22 20 6f 72 20 22 either "2" or "
1450: 34 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 4"... #..
1460: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 if {[hav
1470: 65 43 6f 6e 73 74 72 61 69 6e 74 20 69 6d 61 67 eConstraint imag
1480: 65 52 75 6e 74 69 6d 65 34 30 5d 7d 20 74 68 65 eRuntime40]} the
1490: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 n {.. i
14a0: 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
14b0: 3a 3a 74 65 73 74 5f 63 6c 72 5f 76 34 5d 20 26 ::test_clr_v4] &
14c0: 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 & \..
14d0: 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 [string lengt
14e0: 68 20 24 3a 3a 74 65 73 74 5f 63 6c 72 5f 76 34 h $::test_clr_v4
14f0: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
1500: 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
1510: 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
1520: 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 69 66 : Use the specif
1530: 69 65 64 20 74 65 73 74 20 76 65 72 73 69 6f 6e ied test version
1540: 20 66 6f 72 20 74 68 65 20 43 4c 52 20 76 34 2e for the CLR v4.
1550: 30 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 0...
1560: 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 #.. r
1570: 65 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f 63 6c eturn $::test_cl
1580: 72 5f 76 34 0d 0a 20 20 20 20 20 20 20 20 20 20 r_v4..
1590: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
15a0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
15b0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 # NOTE: Use
15c0: 20 74 68 65 20 64 65 66 61 75 6c 74 20 74 65 73 the default tes
15d0: 74 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 74 68 t version for th
15e0: 65 20 43 4c 52 20 76 34 2e 30 2e 0d 0a 20 20 20 e CLR v4.0...
15f0: 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
1600: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 34 return 4
1610: 2e 30 2e 33 30 33 31 39 3b 20 23 20 54 4f 44 4f .0.30319; # TODO
1620: 3a 20 47 6f 6f 64 20 22 66 61 6c 6c 62 61 63 6b : Good "fallback
1630: 22 20 64 65 66 61 75 6c 74 3f 0d 0a 20 20 20 20 " default?..
1640: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1650: 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
1660: 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 if {[info e
1670: 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 63 6c 72 xists ::test_clr
1680: 5f 76 32 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 _v2] && \..
1690: 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 [string
16a0: 20 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f length $::test_
16b0: 63 6c 72 5f 76 32 5d 20 3e 20 30 7d 20 74 68 65 clr_v2] > 0} the
16c0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
16d0: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
16e0: 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 # NOTE: Use the
16f0: 73 70 65 63 69 66 69 65 64 20 74 65 73 74 20 76 specified test v
1700: 65 72 73 69 6f 6e 20 66 6f 72 20 74 68 65 20 43 ersion for the C
1710: 4c 52 20 76 32 2e 30 2e 0d 0a 20 20 20 20 20 20 LR v2.0...
1720: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1730: 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 74 return $::t
1740: 65 73 74 5f 63 6c 72 5f 76 32 0d 0a 20 20 20 20 est_clr_v2..
1750: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
1760: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
1770: 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 # NOT
1780: 45 3a 20 55 73 65 20 74 68 65 20 64 65 66 61 75 E: Use the defau
1790: 6c 74 20 74 65 73 74 20 76 65 72 73 69 6f 6e 20 lt test version
17a0: 66 6f 72 20 74 68 65 20 43 4c 52 20 76 32 2e 30 for the CLR v2.0
17b0: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 ... #
17c0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
17d0: 74 75 72 6e 20 32 2e 30 2e 35 30 37 32 37 3b 20 turn 2.0.50727;
17e0: 23 20 54 4f 44 4f 3a 20 47 6f 6f 64 20 22 66 61 # TODO: Good "fa
17f0: 6c 6c 62 61 63 6b 22 20 64 65 66 61 75 6c 74 3f llback" default?
1800: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1810: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1820: 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
1830: 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 59 65 proc getBuildYe
1840: 61 72 73 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 ars {} {..
1850: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
1860: 20 53 65 65 20 69 66 20 74 68 65 20 6c 69 73 74 See if the list
1870: 20 6f 66 20 74 65 73 74 20 79 65 61 72 73 20 68 of test years h
1880: 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 64 as been overridd
1890: 65 6e 20 62 79 20 74 68 65 20 75 73 65 72 0d 0a en by the user..
18a0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 28 65 # (e
18b0: 2e 67 2e 20 6f 6e 20 74 68 65 20 63 6f 6d 6d 61 .g. on the comma
18c0: 6e 64 20 6c 69 6e 65 29 2e 0d 0a 20 20 20 20 20 nd line)...
18d0: 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 #.. if {[i
18e0: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 73 nfo exists ::tes
18f0: 74 5f 79 65 61 72 73 5d 20 26 26 20 5b 6c 6c 65 t_years] && [lle
1900: 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 79 65 61 ngth $::test_yea
1910: 72 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d rs] > 0} then {.
1920: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1930: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
1940: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 6c 69 the specified li
1950: 73 74 20 6f 66 20 74 65 73 74 20 79 65 61 72 73 st of test years
1960: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
1970: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
1980: 74 65 73 74 5f 79 65 61 72 73 0d 0a 20 20 20 20 test_years..
1990: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
19a0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
19b0: 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 64 NOTE: Use the d
19c0: 65 66 61 75 6c 74 20 6c 69 73 74 20 6f 66 20 74 efault list of t
19d0: 65 73 74 20 79 65 61 72 73 20 28 69 2e 65 2e 20 est years (i.e.
19e0: 61 6c 6c 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 all)... #
19f0: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
1a00: 20 5b 6c 69 73 74 20 32 30 30 35 20 32 30 30 38 [list 2005 2008
1a10: 20 32 30 31 30 20 32 30 31 32 20 32 30 31 33 20 2010 2012 2013
1a20: 32 30 31 35 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 2015].. }..
1a30: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
1a40: 6f 63 20 67 65 74 42 75 69 6c 64 4e 65 74 46 78 oc getBuildNetFx
1a50: 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a {} {.. #..
1a60: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 65 # NOTE: Se
1a70: 65 20 69 66 20 74 68 65 20 74 65 73 74 20 2e 4e e if the test .N
1a80: 45 54 20 46 72 61 6d 65 77 6f 72 6b 20 73 65 74 ET Framework set
1a90: 74 69 6e 67 20 68 61 73 20 62 65 65 6e 20 6f 76 ting has been ov
1aa0: 65 72 72 69 64 64 65 6e 20 62 79 0d 0a 20 20 20 erridden by..
1ab0: 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 75 # the u
1ac0: 73 65 72 20 28 65 2e 67 2e 20 6f 6e 20 74 68 65 ser (e.g. on the
1ad0: 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 29 2e 0d command line)..
1ae0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
1af0: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
1b00: 20 3a 3a 74 65 73 74 5f 6e 65 74 5f 66 78 5d 20 ::test_net_fx]
1b10: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
1b20: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
1b30: 3a 3a 74 65 73 74 5f 6e 65 74 5f 66 78 5d 20 3e ::test_net_fx] >
1b40: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
1b50: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
1b60: 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 NOTE: Use the s
1b70: 70 65 63 69 66 69 65 64 20 74 65 73 74 20 2e 4e pecified test .N
1b80: 45 54 20 46 72 61 6d 65 77 6f 72 6b 2e 0d 0a 20 ET Framework...
1b90: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1ba0: 20 20 72 65 74 75 72 6e 20 24 3a 3a 74 65 73 74 return $::test
1bb0: 5f 6e 65 74 5f 66 78 0d 0a 20 20 20 20 20 20 7d _net_fx.. }
1bc0: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
1bd0: 20 73 65 74 20 79 65 61 72 20 5b 67 65 74 42 75 set year [getBu
1be0: 69 6c 64 59 65 61 72 5d 0d 0a 0d 0a 20 20 20 20 ildYear]....
1bf0: 20 20 20 20 73 77 69 74 63 68 20 2d 65 78 61 63 switch -exac
1c00: 74 20 2d 2d 20 24 79 65 61 72 20 7b 0d 0a 20 20 t -- $year {..
1c10: 20 20 20 20 20 20 20 20 32 30 30 35 20 7b 0d 0a 2005 {..
1c20: 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 retu
1c30: 72 6e 20 6e 65 74 46 78 32 30 0d 0a 20 20 20 20 rn netFx20..
1c40: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1c50: 20 20 20 32 30 30 38 20 7b 0d 0a 20 20 20 20 20 2008 {..
1c60: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 65 return ne
1c70: 74 46 78 33 35 0d 0a 20 20 20 20 20 20 20 20 20 tFx35..
1c80: 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 32 30 }.. 20
1c90: 31 30 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 10 {..
1ca0: 20 20 72 65 74 75 72 6e 20 6e 65 74 46 78 34 30 return netFx40
1cb0: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1cc0: 20 20 20 20 20 20 20 20 20 32 30 31 32 20 7b 0d 2012 {.
1cd0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 . ret
1ce0: 75 72 6e 20 6e 65 74 46 78 34 35 0d 0a 20 20 20 urn netFx45..
1cf0: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1d00: 20 20 20 20 32 30 31 33 20 7b 0d 0a 20 20 20 20 2013 {..
1d10: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e return n
1d20: 65 74 46 78 34 35 31 0d 0a 20 20 20 20 20 20 20 etFx451..
1d30: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
1d40: 32 30 31 35 20 7b 0d 0a 20 20 20 20 20 20 20 20 2015 {..
1d50: 20 20 20 20 72 65 74 75 72 6e 20 6e 65 74 46 78 return netFx
1d60: 34 36 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 46.. }.
1d70: 0a 20 20 20 20 20 20 20 20 20 20 64 65 66 61 75 . defau
1d80: 6c 74 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 lt {..
1d90: 20 20 72 65 74 75 72 6e 20 6e 65 74 46 78 33 35 return netFx35
1da0: 3b 20 23 20 54 4f 44 4f 3a 20 47 6f 6f 64 20 22 ; # TODO: Good "
1db0: 66 61 6c 6c 62 61 63 6b 22 20 64 65 66 61 75 6c fallback" defaul
1dc0: 74 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d t?.. }.
1dd0: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
1de0: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
1df0: 20 20 20 23 0d 0a 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
1e00: 3a 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 : This procedure
1e10: 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 6e should return n
1e20: 6f 6e 2d 7a 65 72 6f 20 69 66 20 74 68 65 20 63 on-zero if the c
1e30: 6f 6e 66 69 67 75 72 65 64 20 74 65 73 74 0d 0a onfigured test..
1e40: 20 20 20 20 23 20 20 20 20 20 20 20 70 6c 61 74 # plat
1e50: 66 6f 72 6d 20 69 73 20 6d 6f 73 74 20 6c 69 6b form is most lik
1e60: 65 6c 79 20 74 68 65 20 64 65 66 61 75 6c 74 20 ely the default
1e70: 66 6f 72 20 74 68 69 73 20 6d 61 63 68 69 6e 65 for this machine
1e80: 2e 0d 0a 20 20 20 20 23 0d 0a 20 20 20 20 70 72 ... #.. pr
1e90: 6f 63 20 69 73 44 65 66 61 75 6c 74 42 75 69 6c oc isDefaultBuil
1ea0: 64 50 6c 61 74 66 6f 72 6d 20 7b 20 7b 76 65 72 dPlatform { {ver
1eb0: 62 6f 73 65 20 66 61 6c 73 65 7d 20 7d 20 7b 0d bose false} } {.
1ec0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
1ed0: 23 20 4e 4f 54 45 3a 20 52 75 6e 6e 69 6e 67 20 # NOTE: Running
1ee0: 6f 6e 20 57 6f 57 36 34 20 69 73 20 6e 65 76 65 on WoW64 is neve
1ef0: 72 20 74 68 65 20 64 65 66 61 75 6c 74 20 70 6c r the default pl
1f00: 61 74 66 6f 72 6d 2e 0d 0a 20 20 20 20 20 20 23 atform... #
1f10: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 73 52 .. if {[isR
1f20: 75 6e 6e 69 6e 67 57 6f 57 36 34 5d 7d 20 74 68 unningWoW64]} th
1f30: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 en {.. if
1f40: 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e {$verbose} then
1f50: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 {.. tp
1f60: 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
1f70: 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 nel \..
1f80: 20 20 20 20 20 22 2d 2d 2d 2d 20 64 65 74 65 63 "---- detec
1f90: 74 65 64 20 6e 6f 6e 2d 64 65 66 61 75 6c 74 20 ted non-default
1fa0: 70 6c 61 74 66 6f 72 6d 20 28 57 6f 57 36 34 29 platform (WoW64)
1fb0: 5c 6e 22 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a \n".. }..
1fc0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 return f
1fd0: 61 6c 73 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d alse.. }...
1fe0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
1ff0: 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 68 61 73 # NOTE: This has
2000: 20 61 20 67 6f 6f 64 20 63 68 61 6e 63 65 20 6f a good chance o
2010: 66 20 62 65 69 6e 67 20 74 68 65 20 64 65 66 61 f being the defa
2020: 75 6c 74 20 70 6c 61 74 66 6f 72 6d 2e 0d 0a 20 ult platform...
2030: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
2040: 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e {$verbose} then
2050: 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 {.. tput
2060: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
2070: 6c 20 22 2d 2d 2d 2d 20 64 65 74 65 63 74 65 64 l "---- detected
2080: 20 64 65 66 61 75 6c 74 20 70 6c 61 74 66 6f 72 default platfor
2090: 6d 5c 6e 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 m\n".. }..
20a0: 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 return true
20b0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
20c0: 70 72 6f 63 20 67 65 74 42 75 69 6c 64 50 6c 61 proc getBuildPla
20d0: 74 66 6f 72 6d 20 7b 20 6e 61 74 69 76 65 20 7d tform { native }
20e0: 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 {.. if {[i
20f0: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 73 nfo exists ::tes
2100: 74 5f 70 6c 61 74 66 6f 72 6d 5d 20 26 26 20 5c t_platform] && \
2110: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 .. [str
2120: 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 65 ing length $::te
2130: 73 74 5f 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 st_platform] > 0
2140: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
2150: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
2160: 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 OTE: Use the spe
2170: 63 69 66 69 65 64 20 74 65 73 74 20 70 6c 61 74 cified test plat
2180: 66 6f 72 6d 2e 20 20 49 66 20 74 68 69 73 20 76 form. If this v
2190: 61 72 69 61 62 6c 65 20 69 73 20 6e 6f 74 20 73 ariable is not s
21a0: 65 74 2c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 et,.. #
21b0: 20 20 20 20 20 74 68 65 20 64 65 66 61 75 6c 74 the default
21c0: 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 65 20 62 value will be b
21d0: 61 73 65 64 20 6f 6e 20 74 68 65 20 6d 61 63 68 ased on the mach
21e0: 69 6e 65 20 61 72 63 68 69 74 65 63 74 75 72 65 ine architecture
21f0: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
2200: 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 65 78 return [ex
2210: 70 72 20 7b 24 6e 61 74 69 76 65 20 3f 20 24 3a pr {$native ? $:
2220: 3a 74 65 73 74 5f 70 6c 61 74 66 6f 72 6d 20 3a :test_platform :
2230: 20 22 22 7d 5d 0d 0a 20 20 20 20 20 20 7d 20 65 ""}].. } e
2240: 6c 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 lseif {[info exi
2250: 73 74 73 20 3a 3a 74 65 73 74 5f 6d 61 63 68 69 sts ::test_machi
2260: 6e 65 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 ne] && \..
2270: 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 [string leng
2280: 74 68 20 24 3a 3a 74 65 73 74 5f 6d 61 63 68 69 th $::test_machi
2290: 6e 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d ne] > 0} then {.
22a0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
22b0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 6f 72 20 # NOTE: For
22c0: 6e 61 74 69 76 65 20 62 75 69 6c 64 73 2c 20 72 native builds, r
22d0: 65 74 75 72 6e 20 74 68 65 20 70 6c 61 74 66 6f eturn the platfo
22e0: 72 6d 20 6e 61 6d 65 20 63 6f 72 72 65 73 70 6f rm name correspo
22f0: 6e 64 69 6e 67 20 74 6f 0d 0a 20 20 20 20 20 20 nding to..
2300: 20 20 23 20 20 20 20 20 20 20 74 68 65 20 74 65 # the te
2310: 73 74 20 6d 61 63 68 69 6e 65 20 61 72 63 68 69 st machine archi
2320: 74 65 63 74 75 72 65 3b 20 6f 74 68 65 72 77 69 tecture; otherwi
2330: 73 65 2c 20 72 65 74 75 72 6e 20 61 6e 20 65 6d se, return an em
2340: 70 74 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 pty.. #
2350: 20 20 20 20 20 73 74 72 69 6e 67 2e 0d 0a 20 20 string...
2360: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
2370: 20 72 65 74 75 72 6e 20 5b 65 78 70 72 20 7b 0d return [expr {.
2380: 0a 20 20 20 20 20 20 20 20 20 20 24 6e 61 74 69 . $nati
2390: 76 65 20 3f 20 5b 6d 61 63 68 69 6e 65 54 6f 50 ve ? [machineToP
23a0: 6c 61 74 66 6f 72 6d 20 24 3a 3a 74 65 73 74 5f latform $::test_
23b0: 6d 61 63 68 69 6e 65 5d 20 3a 20 22 22 0d 0a 20 machine] : ""..
23c0: 20 20 20 20 20 20 20 7d 5d 0d 0a 20 20 20 20 20 }]..
23d0: 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 6f } elseif {[info
23e0: 20 65 78 69 73 74 73 20 3a 3a 74 63 6c 5f 70 6c exists ::tcl_pl
23f0: 61 74 66 6f 72 6d 28 6d 61 63 68 69 6e 65 29 5d atform(machine)]
2400: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
2410: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
2420: 4f 54 45 3a 20 46 6f 72 20 6e 61 74 69 76 65 20 OTE: For native
2430: 62 75 69 6c 64 73 2c 20 72 65 74 75 72 6e 20 74 builds, return t
2440: 68 65 20 70 6c 61 74 66 6f 72 6d 20 6e 61 6d 65 he platform name
2450: 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 corresponding t
2460: 6f 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 o.. #
2470: 20 20 20 74 68 65 20 6d 61 63 68 69 6e 65 20 61 the machine a
2480: 72 63 68 69 74 65 63 74 75 72 65 3b 20 6f 74 68 rchitecture; oth
2490: 65 72 77 69 73 65 2c 20 72 65 74 75 72 6e 20 61 erwise, return a
24a0: 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2e 0d n empty string..
24b0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
24c0: 20 20 20 20 72 65 74 75 72 6e 20 5b 65 78 70 72 return [expr
24d0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 24 6e {.. $n
24e0: 61 74 69 76 65 20 3f 20 5b 6d 61 63 68 69 6e 65 ative ? [machine
24f0: 54 6f 50 6c 61 74 66 6f 72 6d 20 24 3a 3a 74 63 ToPlatform $::tc
2500: 6c 5f 70 6c 61 74 66 6f 72 6d 28 6d 61 63 68 69 l_platform(machi
2510: 6e 65 29 5d 20 3a 20 22 22 0d 0a 20 20 20 20 20 ne)] : ""..
2520: 20 20 20 7d 5d 0d 0a 20 20 20 20 20 20 7d 20 65 }].. } e
2530: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 lse {.. #
2540: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
2550: 3a 20 4e 6f 20 6d 61 63 68 69 6e 65 20 61 72 63 : No machine arc
2560: 68 69 74 65 63 74 75 72 65 20 69 73 20 61 76 61 hitecture is ava
2570: 69 6c 61 62 6c 65 2c 20 72 65 74 75 72 6e 20 61 ilable, return a
2580: 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2e 0d n empty string..
2590: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
25a0: 20 49 74 20 69 73 20 69 6d 70 6f 72 74 61 6e 74 It is important
25b0: 20 74 6f 20 72 65 74 75 72 6e 20 61 6e 20 65 6d to return an em
25c0: 70 74 79 20 73 74 72 69 6e 67 20 68 65 72 65 20 pty string here
25d0: 62 65 63 61 75 73 65 20 74 68 65 0d 0a 20 20 20 because the..
25e0: 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 73 # res
25f0: 75 6c 74 20 6f 66 20 74 68 69 73 20 70 72 6f 63 ult of this proc
2600: 65 64 75 72 65 20 6d 61 79 20 62 65 20 75 73 65 edure may be use
2610: 64 20 77 69 74 68 20 5b 66 69 6c 65 20 6a 6f 69 d with [file joi
2620: 6e 5d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n]... #..
2630: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 22 return "
2640: 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 ".. }..
2650: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 }..... proc g
2660: 65 74 42 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 etBuildConfigura
2670: 74 69 6f 6e 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 tion {} {..
2680: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
2690: 3a 20 53 65 65 20 69 66 20 74 68 65 20 22 63 6f : See if the "co
26a0: 6e 66 69 67 75 72 61 74 69 6f 6e 22 20 73 65 74 nfiguration" set
26b0: 74 69 6e 67 20 68 61 73 20 62 65 65 6e 20 6f 76 ting has been ov
26c0: 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 65 0d erridden by the.
26d0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 75 . # u
26e0: 73 65 72 20 28 65 2e 67 2e 20 6f 6e 20 74 68 65 ser (e.g. on the
26f0: 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 29 2e 20 command line).
2700: 20 54 68 69 73 20 68 65 6c 70 73 20 63 6f 6e 74 This helps cont
2710: 72 6f 6c 20 65 78 61 63 74 6c 79 0d 0a 20 20 20 rol exactly..
2720: 20 20 20 23 20 20 20 20 20 20 20 77 68 69 63 68 # which
2730: 20 73 65 74 20 6f 66 20 62 69 6e 61 72 69 65 73 set of binaries
2740: 20 77 65 20 61 72 65 20 74 65 73 74 69 6e 67 20 we are testing
2750: 28 69 2e 65 2e 20 74 68 6f 73 65 20 62 75 69 6c (i.e. those buil
2760: 74 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 t in the..
2770: 23 20 20 20 20 20 20 20 22 44 65 62 75 67 22 20 # "Debug"
2780: 6f 72 20 22 52 65 6c 65 61 73 65 22 20 62 75 69 or "Release" bui
2790: 6c 64 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e ld configuration
27a0: 73 29 2e 20 20 54 6f 20 6f 76 65 72 72 69 64 65 s). To override
27b0: 20 74 68 69 73 0d 0a 20 20 20 20 20 20 23 20 20 this.. #
27c0: 20 20 20 20 20 76 61 6c 75 65 20 76 69 61 20 74 value via t
27d0: 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 2c he command line,
27e0: 20 65 6e 74 65 72 20 61 20 63 6f 6d 6d 61 6e 64 enter a command
27f0: 20 73 69 6d 69 6c 61 72 20 74 6f 20 6f 6e 65 20 similar to one
2800: 6f 66 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 of.. #
2810: 20 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 the following
2820: 28 61 6c 6c 20 6f 6e 20 6f 6e 65 20 6c 69 6e 65 (all on one line
2830: 29 3a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 ):.. #..
2840: 20 20 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 # Eagle
2850: 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 49 6e Shell.exe -anyIn
2860: 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 74 65 itialize "set te
2870: 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e st_configuration
2880: 20 44 65 62 75 67 22 0d 0a 20 20 20 20 20 20 23 Debug".. #
2890: 20 20 20 20 20 20 20 20 20 2d 66 69 6c 65 20 2e -file .
28a0: 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 \path\to\all.eag
28b0: 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 le.. #..
28c0: 20 20 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 # Eagle
28d0: 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 49 6e Shell.exe -anyIn
28e0: 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 74 65 itialize "set te
28f0: 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e st_configuration
2900: 20 52 65 6c 65 61 73 65 22 0d 0a 20 20 20 20 20 Release"..
2910: 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 6c 65 # -file
2920: 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 .\path\to\all.e
2930: 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a 20 agle.. #..
2940: 20 20 20 20 20 23 20 20 20 20 20 20 20 45 61 67 # Eag
2950: 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d 66 69 6c leShell.exe -fil
2960: 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e e .\path\to\all.
2970: 65 61 67 6c 65 20 2d 70 72 65 54 65 73 74 0d 0a eagle -preTest..
2980: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 #
2990: 22 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 "unset -nocompla
29a0: 69 6e 20 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 in test_configur
29b0: 61 74 69 6f 6e 22 0d 0a 20 20 20 20 20 20 23 0d ation".. #.
29c0: 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f . if {[info
29d0: 20 65 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 63 exists ::test_c
29e0: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5d 20 26 26 onfiguration] &&
29f0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 \.. [s
2a00: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a tring length $::
2a10: 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 test_configurati
2a20: 6f 6e 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d on] > 0} then {.
2a30: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
2a40: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
2a50: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 74 65 the specified te
2a60: 73 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e st configuration
2a70: 2e 20 20 54 68 65 20 64 65 66 61 75 6c 74 20 76 . The default v
2a80: 61 6c 75 65 20 75 73 65 64 0d 0a 20 20 20 20 20 alue used..
2a90: 20 20 20 23 20 20 20 20 20 20 20 66 6f 72 20 74 # for t
2aa0: 68 69 73 20 76 61 72 69 61 62 6c 65 20 69 73 20 his variable is
2ab0: 74 79 70 69 63 61 6c 6c 79 20 22 52 65 6c 65 61 typically "Relea
2ac0: 73 65 22 2c 20 61 73 20 73 65 74 20 62 79 20 74 se", as set by t
2ad0: 68 65 20 74 65 73 74 0d 0a 20 20 20 20 20 20 20 he test..
2ae0: 20 23 20 20 20 20 20 20 20 73 75 69 74 65 20 69 # suite i
2af0: 74 73 65 6c 66 2e 0d 0a 20 20 20 20 20 20 20 20 tself...
2b00: 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 #.. retur
2b10: 6e 20 24 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 67 n $::test_config
2b20: 75 72 61 74 69 6f 6e 0d 0a 20 20 20 20 20 20 7d uration.. }
2b30: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
2b40: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
2b50: 54 45 3a 20 4e 6f 72 6d 61 6c 6c 79 2c 20 77 65 TE: Normally, we
2b60: 20 77 69 6c 6c 20 6e 65 76 65 72 20 68 69 74 20 will never hit
2b70: 74 68 69 73 20 63 61 73 65 20 62 65 63 61 75 73 this case becaus
2b80: 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 e the value of t
2b90: 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 he.. #
2ba0: 20 20 20 20 74 65 73 74 20 63 6f 6e 66 69 67 75 test configu
2bb0: 72 61 74 69 6f 6e 20 76 61 72 69 61 62 6c 65 20 ration variable
2bc0: 69 73 20 61 6c 77 61 79 73 20 73 65 74 20 62 79 is always set by
2bd0: 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 0d the test suite.
2be0: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
2bf0: 20 69 74 73 65 6c 66 3b 20 68 6f 77 65 76 65 72 itself; however
2c00: 2c 20 69 74 20 63 61 6e 20 62 65 20 6f 76 65 72 , it can be over
2c10: 72 69 64 64 65 6e 20 75 73 69 6e 67 20 74 68 65 ridden using the
2c20: 20 75 6e 73 65 74 20 63 6f 6d 6d 61 6e 64 0d 0a unset command..
2c30: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
2c40: 66 72 6f 6d 20 74 68 65 20 2d 70 72 65 54 65 73 from the -preTes
2c50: 74 20 6f 70 74 69 6f 6e 20 74 6f 20 74 68 65 20 t option to the
2c60: 74 65 73 74 20 73 75 69 74 65 2e 0d 0a 20 20 20 test suite...
2c70: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
2c80: 72 65 74 75 72 6e 20 24 3a 3a 65 61 67 6c 65 5f return $::eagle_
2c90: 70 6c 61 74 66 6f 72 6d 28 63 6f 6e 66 69 67 75 platform(configu
2ca0: 72 61 74 69 6f 6e 29 0d 0a 20 20 20 20 20 20 7d ration).. }
2cb0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
2cc0: 70 72 6f 63 20 67 65 74 42 75 69 6c 64 43 6f 6e proc getBuildCon
2cd0: 66 69 67 75 72 61 74 69 6f 6e 73 20 7b 7d 20 7b figurations {} {
2ce0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
2cf0: 20 23 20 4e 4f 54 45 3a 20 53 65 65 20 69 66 20 # NOTE: See if
2d00: 74 68 65 20 6c 69 73 74 20 6f 66 20 74 65 73 74 the list of test
2d10: 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 73 20 configurations
2d20: 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 has been overrid
2d30: 64 65 6e 20 62 79 0d 0a 20 20 20 20 20 20 23 20 den by.. #
2d40: 20 20 20 20 20 20 74 68 65 20 75 73 65 72 20 28 the user (
2d50: 65 2e 67 2e 20 6f 6e 20 74 68 65 20 63 6f 6d 6d e.g. on the comm
2d60: 61 6e 64 20 6c 69 6e 65 29 2e 0d 0a 20 20 20 20 and line)...
2d70: 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
2d80: 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 info exists ::te
2d90: 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e st_configuration
2da0: 73 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 s] && \..
2db0: 20 20 20 5b 6c 6c 65 6e 67 74 68 20 24 3a 3a 74 [llength $::t
2dc0: 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f est_configuratio
2dd0: 6e 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d ns] > 0} then {.
2de0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
2df0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
2e00: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 6c 69 the specified li
2e10: 73 74 20 6f 66 20 74 65 73 74 20 63 6f 6e 66 69 st of test confi
2e20: 67 75 72 61 74 69 6f 6e 73 2e 0d 0a 20 20 20 20 gurations...
2e30: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
2e40: 65 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f 63 6f eturn $::test_co
2e50: 6e 66 69 67 75 72 61 74 69 6f 6e 73 0d 0a 20 20 nfigurations..
2e60: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
2e70: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
2e80: 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 # NOTE: Use the
2e90: 20 64 65 66 61 75 6c 74 20 6c 69 73 74 20 6f 66 default list of
2ea0: 20 74 65 73 74 20 63 6f 6e 66 69 67 75 72 61 74 test configurat
2eb0: 69 6f 6e 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 ions... #
2ec0: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
2ed0: 20 5b 6c 69 73 74 20 44 65 62 75 67 20 52 65 6c [list Debug Rel
2ee0: 65 61 73 65 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a ease].. }..
2ef0: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
2f00: 6f 63 20 67 65 74 42 75 69 6c 64 42 61 73 65 44 oc getBuildBaseD
2f10: 69 72 65 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a 20 irectory {} {..
2f20: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
2f30: 4e 4f 54 45 3a 20 46 69 67 75 72 65 20 6f 75 74 NOTE: Figure out
2f40: 20 74 68 65 20 62 61 73 65 20 64 69 72 65 63 74 the base direct
2f50: 6f 72 79 20 77 68 65 72 65 20 61 6c 6c 20 74 68 ory where all th
2f60: 65 20 62 75 69 6c 64 73 20 73 68 6f 75 6c 64 20 e builds should
2f70: 62 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 be.. #
2f80: 20 20 6c 6f 63 61 74 65 64 2e 20 20 54 68 69 73 located. This
2f90: 20 77 69 6c 6c 20 62 65 20 74 68 65 20 64 69 72 will be the dir
2fa0: 65 63 74 6f 72 79 20 74 68 61 74 20 63 6f 6e 74 ectory that cont
2fb0: 61 69 6e 73 20 74 68 65 20 61 63 74 75 61 6c 0d ains the actual.
2fc0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 . # b
2fd0: 75 69 6c 64 20 6f 75 74 70 75 74 20 64 69 72 65 uild output dire
2fe0: 63 74 6f 72 79 20 28 65 2e 67 2e 20 70 61 72 65 ctory (e.g. pare
2ff0: 6e 74 20 6f 66 20 22 62 69 6e 22 29 2e 0d 0a 20 nt of "bin")...
3000: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
3010: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {[info exists :
3020: 3a 62 75 69 6c 64 5f 62 61 73 65 5f 64 69 72 65 :build_base_dire
3030: 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a 20 20 20 ctory] && \..
3040: 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c [string l
3050: 65 6e 67 74 68 20 24 3a 3a 62 75 69 6c 64 5f 62 ength $::build_b
3060: 61 73 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 3e ase_directory] >
3070: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
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 54 68 65 20 6c 6f 63 61 74 NOTE: The locat
30a0: 69 6f 6e 20 6f 66 20 74 68 65 20 62 75 69 6c 64 ion of the build
30b0: 20 62 61 73 65 20 64 69 72 65 63 74 6f 72 79 20 base directory
30c0: 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 has been overrid
30d0: 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 den;.. #
30e0: 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c therefore,
30f0: 20 75 73 65 20 69 74 20 76 65 72 62 61 74 69 6d use it verbatim
3100: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
3110: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
3120: 62 75 69 6c 64 5f 62 61 73 65 5f 64 69 72 65 63 build_base_direc
3130: 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c tory.. } el
3140: 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 seif {[info exis
3150: 74 73 20 3a 3a 63 6f 6d 6d 6f 6e 5f 64 69 72 65 ts ::common_dire
3160: 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a 20 20 20 ctory] && \..
3170: 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c [string l
3180: 65 6e 67 74 68 20 24 3a 3a 63 6f 6d 6d 6f 6e 5f ength $::common_
3190: 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 30 7d 20 directory] > 0}
31a0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
31b0: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
31c0: 45 3a 20 4e 65 78 74 2c 20 66 61 6c 6c 62 61 63 E: Next, fallbac
31d0: 6b 20 74 6f 20 74 68 65 20 67 72 61 6e 64 70 61 k to the grandpa
31e0: 72 65 6e 74 20 64 69 72 65 63 74 6f 72 79 20 6f rent directory o
31f0: 66 20 74 68 65 20 6f 6e 65 0d 0a 20 20 20 20 20 f the one..
3200: 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 74 61 # conta
3210: 69 6e 69 6e 67 20 74 68 69 73 20 66 69 6c 65 20 ining this file
3220: 28 69 2e 65 2e 20 22 63 6f 6d 6d 6f 6e 2e 65 61 (i.e. "common.ea
3230: 67 6c 65 22 29 2c 20 69 66 20 61 76 61 69 6c 61 gle"), if availa
3240: 62 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ble... #.
3250: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
3260: 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 5b 66 [file dirname [f
3270: 69 6c 65 20 64 69 72 6e 61 6d 65 20 24 3a 3a 63 ile dirname $::c
3280: 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 5d ommon_directory]
3290: 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 ].. } elsei
32a0: 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
32b0: 3a 3a 70 61 74 68 5d 20 26 26 20 5c 0d 0a 20 20 ::path] && \..
32c0: 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
32d0: 6c 65 6e 67 74 68 20 24 3a 3a 70 61 74 68 5d 20 length $::path]
32e0: 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
32f0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
3300: 23 20 4e 4f 54 45 3a 20 46 69 6e 61 6c 6c 79 2c # NOTE: Finally,
3310: 20 66 61 6c 6c 62 61 63 6b 20 74 6f 20 74 68 65 fallback to the
3320: 20 70 61 72 65 6e 74 20 64 69 72 65 63 74 6f 72 parent director
3330: 79 20 6f 66 20 74 68 65 20 45 61 67 6c 65 54 65 y of the EagleTe
3340: 73 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 st.. #
3350: 20 20 20 20 70 61 74 68 2e 20 20 54 68 65 20 45 path. The E
3360: 61 67 6c 65 54 65 73 74 20 70 61 63 6b 61 67 65 agleTest package
3370: 20 67 75 61 72 61 6e 74 65 65 73 20 74 68 61 74 guarantees that
3380: 20 74 68 69 73 20 76 61 72 69 61 62 6c 65 0d 0a this variable..
3390: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
33a0: 77 69 6c 6c 20 62 65 20 73 65 74 20 74 6f 20 74 will be set to t
33b0: 68 65 20 64 69 72 65 63 74 6f 72 79 20 63 6f 6e he directory con
33c0: 74 61 69 6e 69 6e 67 20 74 68 65 20 66 69 72 73 taining the firs
33d0: 74 20 66 69 6c 65 20 74 6f 0d 0a 20 20 20 20 20 t file to..
33e0: 20 20 20 23 20 20 20 20 20 20 20 65 78 65 63 75 # execu
33f0: 74 65 20 74 68 65 20 5b 72 75 6e 54 65 73 74 50 te the [runTestP
3400: 72 6f 6c 6f 67 75 65 5d 20 73 63 72 69 70 74 20 rologue] script
3410: 6c 69 62 72 61 72 79 20 70 72 6f 63 65 64 75 72 library procedur
3420: 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 e... #..
3430: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 66 return [f
3440: 69 6c 65 20 64 69 72 6e 61 6d 65 20 24 3a 3a 70 ile dirname $::p
3450: 61 74 68 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c ath].. } el
3460: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d se {.. #.
3470: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
3480: 20 4e 6f 20 70 61 74 68 20 69 73 20 61 76 61 69 No path is avai
3490: 6c 61 62 6c 65 2c 20 72 65 74 75 72 6e 20 61 6e lable, return an
34a0: 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2e 20 20 empty string.
34b0: 54 68 69 73 20 70 6f 69 6e 74 0d 0a 20 20 20 20 This point..
34c0: 20 20 20 20 23 20 20 20 20 20 20 20 73 68 6f 75 # shou
34d0: 6c 64 20 6e 6f 74 20 62 65 20 72 65 61 63 68 65 ld not be reache
34e0: 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 d... #..
34f0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 22 22 return ""
3500: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
3510: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
3520: 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 tSQLiteTestDataP
3530: 61 74 68 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 ath {} {..
3540: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
3550: 20 46 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 Figure out the
3560: 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 directory where
3570: 61 6c 6c 20 74 68 65 20 74 65 73 74 20 64 61 74 all the test dat
3580: 61 20 66 69 6c 65 73 20 73 68 6f 75 6c 64 0d 0a a files should..
3590: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 65 # be
35a0: 20 6c 6f 63 61 74 65 64 2e 20 20 54 68 69 73 20 located. This
35b0: 73 68 6f 75 6c 64 20 62 65 20 74 68 65 20 22 64 should be the "d
35c0: 61 74 61 22 20 64 69 72 65 63 74 6f 72 79 20 62 ata" directory b
35d0: 65 6e 65 61 74 68 20 74 68 65 0d 0a 20 20 20 20 eneath the..
35e0: 20 20 23 20 20 20 20 20 20 20 64 69 72 65 63 74 # direct
35f0: 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 ory containing t
3600: 68 65 20 61 63 74 75 61 6c 20 74 65 73 74 20 73 he actual test s
3610: 63 72 69 70 74 73 2e 0d 0a 20 20 20 20 20 20 23 cripts... #
3620: 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b .. return [
3630: 66 69 6c 65 20 6a 6f 69 6e 20 24 3a 3a 70 61 74 file join $::pat
3640: 68 20 64 61 74 61 5d 0d 0a 20 20 20 20 7d 0d 0a h data].. }..
3650: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 69 73 52 75 ... proc isRu
3660: 6e 6e 69 6e 67 57 6f 57 36 34 20 7b 7d 20 7b 0d nningWoW64 {} {.
3670: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
3680: 23 20 4e 4f 54 45 3a 20 46 6f 72 20 6e 6f 77 2c # NOTE: For now,
3690: 20 6a 75 73 74 20 75 73 65 20 74 68 65 20 65 78 just use the ex
36a0: 69 73 74 69 6e 67 20 74 65 73 74 20 63 6f 6e 73 isting test cons
36b0: 74 72 61 69 6e 74 20 66 6f 72 20 64 65 74 65 63 traint for detec
36c0: 74 69 6e 67 0d 0a 20 20 20 20 20 20 23 20 20 20 ting.. #
36d0: 20 20 20 20 61 20 57 6f 57 36 34 20 70 72 6f 63 a WoW64 proc
36e0: 65 73 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ess... #..
36f0: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 68 61 76 return [hav
3700: 65 43 6f 6e 73 74 72 61 69 6e 74 20 77 6f 77 36 eConstraint wow6
3710: 34 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 4].. }.....
3720: 20 20 70 72 6f 63 20 69 73 4d 69 78 65 64 4d 6f proc isMixedMo
3730: 64 65 41 73 73 65 6d 62 6c 79 20 7b 20 66 69 6c deAssembly { fil
3740: 65 4e 61 6d 65 20 7b 76 61 72 4e 61 6d 65 20 22 eName {varName "
3750: 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d "} } {.. #.
3760: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 . # NOTE: F
3770: 69 72 73 74 2c 20 6d 61 6b 65 20 73 75 72 65 20 irst, make sure
3780: 74 68 65 20 74 65 73 74 20 73 75 69 74 65 20 69 the test suite i
3790: 6e 66 72 61 73 74 72 75 63 74 75 72 65 20 69 73 nfrastructure is
37a0: 20 61 6c 6c 6f 77 65 64 20 74 6f 0d 0a 20 20 20 allowed to..
37b0: 20 20 20 23 20 20 20 20 20 20 20 75 73 65 20 74 # use t
37c0: 68 65 20 5b 65 78 65 63 5d 20 63 6f 6d 6d 61 6e he [exec] comman
37d0: 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 d... #..
37e0: 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
37f0: 69 73 74 73 20 3a 3a 6e 6f 28 65 78 65 63 29 5d ists ::no(exec)]
3800: 20 26 26 20 21 5b 69 6e 66 6f 20 65 78 69 73 74 && ![info exist
3810: 73 20 3a 3a 6e 6f 28 63 6f 72 46 6c 61 67 73 29 s ::no(corFlags)
3820: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
3830: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
3840: 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 6c 6f 63 NOTE: If the loc
3850: 61 74 69 6f 6e 20 6f 66 20 43 6f 72 46 6c 61 67 ation of CorFlag
3860: 73 20 69 73 20 70 72 65 73 65 6e 74 20 69 6e 20 s is present in
3870: 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c the environment,
3880: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
3890: 20 20 75 73 65 20 69 74 3b 20 6f 74 68 65 72 77 use it; otherw
38a0: 69 73 65 20 61 73 73 75 6d 65 20 69 74 20 69 73 ise assume it is
38b0: 20 69 6e 20 74 68 65 20 50 41 54 48 2e 0d 0a 20 in the PATH...
38c0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
38d0: 20 20 73 65 74 20 63 6f 72 46 6c 61 67 73 20 5b set corFlags [
38e0: 65 78 70 72 20 7b 0d 0a 20 20 20 20 20 20 20 20 expr {..
38f0: 20 20 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a [info exists :
3900: 3a 65 6e 76 28 43 6f 72 46 6c 61 67 73 29 5d 20 :env(CorFlags)]
3910: 3f 20 24 3a 3a 65 6e 76 28 43 6f 72 46 6c 61 67 ? $::env(CorFlag
3920: 73 29 20 3a 20 22 43 6f 72 46 6c 61 67 73 22 0d s) : "CorFlags".
3930: 0a 20 20 20 20 20 20 20 20 7d 5d 0d 0a 0d 0a 20 . }]....
3940: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
3950: 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 # NOTE: Attemp
3960: 74 20 74 6f 20 65 78 65 63 75 74 65 20 43 6f 72 t to execute Cor
3970: 46 6c 61 67 73 20 6f 6e 20 74 68 65 20 73 70 65 Flags on the spe
3980: 63 69 66 69 65 64 20 66 69 6c 65 2e 0d 0a 20 20 cified file...
3990: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
39a0: 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
39b0: 20 20 20 20 20 20 20 20 20 65 78 65 63 20 2d 2d exec --
39c0: 20 24 63 6f 72 46 6c 61 67 73 20 5b 66 69 6c 65 $corFlags [file
39d0: 20 6e 61 74 69 76 65 6e 61 6d 65 20 24 66 69 6c nativename $fil
39e0: 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 20 20 eName]..
39f0: 7d 20 65 78 65 63 5d 20 3d 3d 20 30 7d 20 74 68 } exec] == 0} th
3a00: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
3a10: 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
3a20: 4f 54 45 3a 20 49 66 20 72 65 71 75 65 73 74 65 OTE: If requeste
3a30: 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 2c d by our caller,
3a40: 20 61 74 74 65 6d 70 74 20 74 6f 20 64 65 74 65 attempt to dete
3a50: 72 6d 69 6e 65 20 74 68 65 0d 0a 20 20 20 20 20 rmine the..
3a60: 20 20 20 20 20 23 20 20 20 20 20 20 20 70 6c 61 # pla
3a70: 74 66 6f 72 6d 20 66 6f 72 20 74 68 65 20 73 70 tform for the sp
3a80: 65 63 69 66 69 65 64 20 66 69 6c 65 20 61 73 20 ecified file as
3a90: 77 65 6c 6c 2e 0d 0a 20 20 20 20 20 20 20 20 20 well...
3aa0: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 #.. if
3ab0: 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
3ac0: 20 24 76 61 72 4e 61 6d 65 5d 20 3e 20 30 7d 20 $varName] > 0}
3ad0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
3ae0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
3af0: 20 20 20 23 20 4e 4f 54 45 3a 20 53 74 6f 72 65 # NOTE: Store
3b00: 20 74 68 65 20 70 6c 61 74 66 6f 72 6d 20 69 6e the platform in
3b10: 20 74 68 65 20 6e 61 6d 65 64 20 76 61 72 69 61 the named varia
3b20: 62 6c 65 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 ble in the..
3b30: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
3b40: 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 20 63 context of our c
3b50: 61 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 aller...
3b60: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
3b70: 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 4e upvar 1 $varN
3b80: 61 6d 65 20 70 6c 61 74 66 6f 72 6d 0d 0a 0d 0a ame platform....
3b90: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
3ba0: 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 # NOT
3bb0: 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 65 78 E: Attempt to ex
3bc0: 74 72 61 63 74 20 74 68 65 20 50 45 20 6c 69 6e tract the PE lin
3bd0: 65 20 66 72 6f 6d 20 74 68 65 20 63 61 70 74 75 e from the captu
3be0: 72 65 64 0d 0a 20 20 20 20 20 20 20 20 20 20 20 red..
3bf0: 20 23 20 20 20 20 20 20 20 6f 75 74 70 75 74 2e # output.
3c00: 20 20 49 66 20 74 68 69 73 20 76 61 6c 75 65 20 If this value
3c10: 69 73 20 22 50 45 33 32 22 20 6f 72 20 22 50 45 is "PE32" or "PE
3c20: 33 32 2b 22 2c 20 74 68 65 0d 0a 20 20 20 20 20 32+", the..
3c30: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 # a
3c40: 73 73 65 6d 62 6c 79 20 66 69 6c 65 20 69 73 20 ssembly file is
3c50: 33 32 2d 62 69 74 20 6f 72 20 36 34 2d 62 69 74 32-bit or 64-bit
3c60: 2c 20 72 65 73 70 65 63 74 69 76 65 6c 79 3b 0d , respectively;.
3c70: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 . #
3c80: 20 20 20 20 20 6f 74 68 65 72 77 69 73 65 2c 20 otherwise,
3c90: 69 74 73 20 74 79 70 65 20 69 73 20 75 6e 6b 6e its type is unkn
3ca0: 6f 77 6e 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 own...
3cb0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
3cc0: 20 73 65 74 20 70 61 74 74 65 72 6e 20 7b 5e 50 set pattern {^P
3cd0: 45 20 20 20 20 20 20 20 20 3a 20 28 50 45 33 32 E : (PE32
3ce0: 7c 50 45 33 32 5c 2b 29 5c 73 2b 24 7d 0d 0a 0d |PE32\+)\s+$}...
3cf0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
3d00: 7b 5b 72 65 67 65 78 70 20 2d 6c 69 6e 65 20 2d {[regexp -line -
3d10: 2d 20 24 70 61 74 74 65 72 6e 20 24 65 78 65 63 - $pattern $exec
3d20: 20 64 75 6d 6d 79 20 70 65 33 32 5d 7d 20 74 68 dummy pe32]} th
3d30: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
3d40: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
3d50: 20 20 20 20 20 23 20 48 41 43 4b 3a 20 54 68 69 # HACK: Thi
3d60: 73 20 5b 73 77 69 74 63 68 5d 20 61 73 73 75 6d s [switch] assum
3d70: 65 73 20 74 68 61 74 20 33 32 2d 62 69 74 20 65 es that 32-bit e
3d80: 78 65 63 75 74 61 62 6c 65 73 20 61 72 65 0d 0a xecutables are..
3d90: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
3da0: 20 20 20 20 20 20 61 6c 77 61 79 73 20 78 38 36 always x86
3db0: 20 61 6e 64 20 74 68 61 74 20 36 34 2d 62 69 74 and that 64-bit
3dc0: 20 65 78 65 63 75 74 61 62 6c 65 73 20 61 72 65 executables are
3dd0: 20 61 6c 77 61 79 73 0d 0a 20 20 20 20 20 20 20 always..
3de0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 78 # x
3df0: 36 34 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 64...
3e00: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
3e10: 20 20 20 20 73 77 69 74 63 68 20 2d 65 78 61 63 switch -exac
3e20: 74 20 2d 2d 20 24 70 65 33 32 20 7b 0d 0a 20 20 t -- $pe32 {..
3e30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 50 45 PE
3e40: 33 32 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 32 {..
3e50: 20 20 20 20 20 20 20 20 73 65 74 20 70 6c 61 74 set plat
3e60: 66 6f 72 6d 20 57 69 6e 33 32 0d 0a 20 20 20 20 form Win32..
3e70: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
3e80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 50 P
3e90: 45 33 32 2b 20 7b 0d 0a 20 20 20 20 20 20 20 20 E32+ {..
3ea0: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 70 6c set pl
3eb0: 61 74 66 6f 72 6d 20 78 36 34 0d 0a 20 20 20 20 atform x64..
3ec0: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
3ed0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 d
3ee0: 65 66 61 75 6c 74 20 7b 0d 0a 20 20 20 20 20 20 efault {..
3ef0: 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 set
3f00: 70 6c 61 74 66 6f 72 6d 20 22 22 0d 0a 20 20 20 platform ""..
3f10: 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
3f20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
3f30: 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 . } e
3f40: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
3f50: 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 set platfor
3f60: 6d 20 22 22 0d 0a 20 20 20 20 20 20 20 20 20 20 m ""..
3f70: 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
3f80: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d .... #.
3f90: 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 . # NOT
3fa0: 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 65 78 E: Attempt to ex
3fb0: 74 72 61 63 74 20 74 68 65 20 49 4c 4f 4e 4c 59 tract the ILONLY
3fc0: 20 6c 69 6e 65 20 66 72 6f 6d 20 74 68 65 20 63 line from the c
3fd0: 61 70 74 75 72 65 64 0d 0a 20 20 20 20 20 20 20 aptured..
3fe0: 20 20 20 23 20 20 20 20 20 20 20 6f 75 74 70 75 # outpu
3ff0: 74 2e 20 20 49 66 20 74 68 69 73 20 76 61 6c 75 t. If this valu
4000: 65 20 69 73 20 7a 65 72 6f 2c 20 74 68 65 20 73 e is zero, the s
4010: 70 65 63 69 66 69 65 64 20 66 69 6c 65 20 6d 75 pecified file mu
4020: 73 74 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 st.. #
4030: 20 20 20 20 20 20 62 65 20 61 20 6d 69 78 65 64 be a mixed
4040: 2d 6d 6f 64 65 20 61 73 73 65 6d 62 6c 79 3b 20 -mode assembly;
4050: 6f 74 68 65 72 77 69 73 65 2c 20 69 74 20 63 6f otherwise, it co
4060: 6e 74 61 69 6e 73 20 6f 6e 6c 79 0d 0a 20 20 20 ntains only..
4070: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6d # m
4080: 61 6e 61 67 65 64 20 63 6f 6d 70 6f 6e 65 6e 74 anaged component
4090: 73 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d s... #.
40a0: 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 70 . set p
40b0: 61 74 74 65 72 6e 20 7b 5e 49 4c 4f 4e 4c 59 20 attern {^ILONLY
40c0: 20 20 20 3a 20 28 30 7c 31 29 5c 73 2b 24 7d 0d : (0|1)\s+$}.
40d0: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 ... if
40e0: 7b 21 5b 72 65 67 65 78 70 20 2d 6c 69 6e 65 20 {![regexp -line
40f0: 2d 2d 20 24 70 61 74 74 65 72 6e 20 24 65 78 65 -- $pattern $exe
4100: 63 20 64 75 6d 6d 79 20 69 6c 4f 6e 6c 79 5d 7d c dummy ilOnly]}
4110: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
4120: 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 return fals
4130: 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a e.. }..
4140: 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
4150: 21 24 69 6c 4f 6e 6c 79 7d 20 74 68 65 6e 20 7b !$ilOnly} then {
4160: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
4170: 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 turn true..
4180: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
4190: 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
41a0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
41b0: 4f 54 45 3a 20 49 66 20 74 68 65 20 74 65 73 74 OTE: If the test
41c0: 20 73 75 69 74 65 20 63 61 6e 6e 6f 74 20 75 73 suite cannot us
41d0: 65 20 5b 65 78 65 63 5d 20 6f 72 20 65 78 65 63 e [exec] or exec
41e0: 75 74 69 6f 6e 20 6f 66 20 43 6f 72 46 6c 61 67 ution of CorFlag
41f0: 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 s.. #
4200: 20 66 61 69 6c 65 64 2c 20 72 65 74 75 72 6e 20 failed, return
4210: 66 61 6c 73 65 2e 0d 0a 20 20 20 20 20 20 23 0d false... #.
4220: 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 . return fa
4230: 6c 73 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 lse.. }.....
4240: 20 20 20 70 72 6f 63 20 69 73 42 75 69 6c 64 41 proc isBuildA
4250: 76 61 69 6c 61 62 6c 65 20 7b 20 6e 61 74 69 76 vailable { nativ
4260: 65 20 64 69 72 65 63 74 6f 72 79 20 7b 76 61 72 e directory {var
4270: 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 Name ""} } {..
4280: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
4290: 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 20 66 OTE: Build the f
42a0: 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 20 66 ully qualified f
42b0: 69 6c 65 20 6e 61 6d 65 20 66 6f 72 20 74 68 65 ile name for the
42c0: 20 70 72 69 6d 61 72 79 20 61 73 73 65 6d 62 6c primary assembl
42d0: 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 y.. #
42e0: 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 containing the
42f0: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
4300: 74 65 20 6d 61 6e 61 67 65 64 20 63 6f 6d 70 6f te managed compo
4310: 6e 65 6e 74 73 2e 20 20 49 74 0d 0a 20 20 20 20 nents. It..
4320: 20 20 23 20 20 20 20 20 20 20 73 68 6f 75 6c 64 # should
4330: 20 62 65 20 6e 6f 74 65 64 20 74 68 61 74 20 74 be noted that t
4340: 68 69 73 20 61 73 73 65 6d 62 6c 79 20 66 69 6c his assembly fil
4350: 65 20 6d 61 79 20 61 6c 73 6f 20 63 6f 6e 74 61 e may also conta
4360: 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 in the.. #
4370: 20 20 20 20 20 20 6e 61 74 69 76 65 20 63 6f 6d native com
4380: 70 6f 6e 65 6e 74 73 2c 20 69 66 20 61 20 6e 61 ponents, if a na
4390: 74 69 76 65 20 62 75 69 6c 64 20 69 73 20 69 6e tive build is in
43a0: 20 75 73 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a use... #..
43b0: 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 set fileNa
43c0: 6d 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e me [file nativen
43d0: 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 ame [file join $
43e0: 64 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 directory \..
43f0: 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 System.Da
4400: 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5d 5d 0d ta.SQLite.dll]].
4410: 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 66 ... if {![f
4420: 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 ile exists $file
4430: 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 Name]} then {..
4440: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 return fa
4450: 6c 73 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a lse.. }....
4460: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
4470: 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 NOTE: Attempt t
4480: 6f 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 o automatically
4490: 64 65 74 65 63 74 20 69 66 20 74 68 65 20 70 72 detect if the pr
44a0: 69 6d 61 72 79 20 61 73 73 65 6d 62 6c 79 0d 0a imary assembly..
44b0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
44c0: 6e 74 61 69 6e 73 20 61 6e 79 20 6e 61 74 69 76 ntains any nativ
44d0: 65 20 63 6f 6d 70 6f 6e 65 6e 74 73 2c 20 69 66 e components, if
44e0: 20 6e 65 63 65 73 73 61 72 79 2e 0d 0a 20 20 20 necessary...
44f0: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
4500: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
4510: 6e 61 74 69 76 65 5d 20 3d 3d 20 30 7d 20 74 68 native] == 0} th
4520: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 en {.. if
4530: 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
4540: 20 24 76 61 72 4e 61 6d 65 5d 20 3e 20 30 7d 20 $varName] > 0}
4550: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
4560: 20 20 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 upvar 1 $varNa
4570: 6d 65 20 24 76 61 72 4e 61 6d 65 0d 0a 20 20 20 me $varName..
4580: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
4590: 20 20 73 65 74 20 6e 61 74 69 76 65 20 5b 69 73 set native [is
45a0: 4d 69 78 65 64 4d 6f 64 65 41 73 73 65 6d 62 6c MixedModeAssembl
45b0: 79 20 24 66 69 6c 65 4e 61 6d 65 20 24 76 61 72 y $fileName $var
45c0: 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a Name].. }..
45d0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
45e0: 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 # NOTE: If the
45f0: 70 72 69 6d 61 72 79 20 61 73 73 65 6d 62 6c 79 primary assembly
4600: 20 61 6c 73 6f 20 63 6f 6e 74 61 69 6e 73 20 74 also contains t
4610: 68 65 20 6e 61 74 69 76 65 20 63 6f 6d 70 6f 6e he native compon
4620: 65 6e 74 73 2c 0d 0a 20 20 20 20 20 20 23 20 20 ents,.. #
4630: 20 20 20 20 20 77 65 20 68 61 76 65 20 65 76 65 we have eve
4640: 72 79 74 68 69 6e 67 20 77 65 20 6e 65 65 64 2e rything we need.
4650: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
4660: 20 69 66 20 7b 24 6e 61 74 69 76 65 7d 20 74 68 if {$native} th
4670: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 en {.. re
4680: 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 turn true..
4690: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
46a0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 68 61 # NOTE: Wha
46b0: 74 20 69 73 20 74 68 65 20 70 6c 61 74 66 6f 72 t is the platfor
46c0: 6d 20 66 6f 72 20 74 68 69 73 20 6d 61 63 68 69 m for this machi
46d0: 6e 65 3f 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ne?.. #..
46e0: 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d set platform
46f0: 20 5b 6d 61 63 68 69 6e 65 54 6f 50 6c 61 74 66 [machineToPlatf
4700: 6f 72 6d 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 orm $::tcl_platf
4710: 6f 72 6d 28 6d 61 63 68 69 6e 65 29 5d 0d 0a 0d orm(machine)]...
4720: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
4730: 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 # NOTE: Build th
4740: 65 20 66 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 e fully qualifie
4750: 64 20 66 69 6c 65 20 6e 61 6d 65 20 66 6f 72 20 d file name for
4760: 74 68 65 20 69 6e 74 65 72 6f 70 20 61 73 73 65 the interop asse
4770: 6d 62 6c 79 0d 0a 20 20 20 20 20 20 23 20 20 20 mbly.. #
4780: 20 20 20 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 containing t
4790: 68 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 he System.Data.S
47a0: 51 4c 69 74 65 20 6e 61 74 69 76 65 20 63 6f 6d QLite native com
47b0: 70 6f 6e 65 6e 74 73 2e 20 20 49 66 20 74 68 69 ponents. If thi
47c0: 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 s.. #
47d0: 20 66 69 6c 65 20 65 78 69 73 74 73 2c 20 77 65 file exists, we
47e0: 20 73 68 6f 75 6c 64 20 68 61 76 65 20 65 76 65 should have eve
47f0: 72 79 74 68 69 6e 67 20 77 65 20 6e 65 65 64 2e rything we need.
4800: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
4810: 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 set fileName [f
4820: 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b ile nativename [
4830: 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 65 63 file join $direc
4840: 74 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 tory \..
4850: 20 20 24 70 6c 61 74 66 6f 72 6d 20 53 51 4c 69 $platform SQLi
4860: 74 65 2e 49 6e 74 65 72 6f 70 2e 64 6c 6c 5d 5d te.Interop.dll]]
4870: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 66 .... if {[f
4880: 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 ile exists $file
4890: 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 Name]} then {..
48a0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
48b0: 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 ue.. }....
48c0: 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d set fileNam
48d0: 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 e [file nativena
48e0: 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 me [file join $d
48f0: 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 irectory \..
4900: 20 20 20 20 20 20 53 51 4c 69 74 65 2e 49 6e 74 SQLite.Int
4910: 65 72 6f 70 2e 64 6c 6c 5d 5d 0d 0a 0d 0a 20 20 erop.dll]]....
4920: 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 if {[file ex
4930: 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d ists $fileName]}
4940: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
4950: 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 return true..
4960: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 }.... #
4970: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
4980: 42 75 69 6c 64 20 74 68 65 20 66 75 6c 6c 79 20 Build the fully
4990: 71 75 61 6c 69 66 69 65 64 20 66 69 6c 65 20 6e qualified file n
49a0: 61 6d 65 20 66 6f 72 20 74 68 65 20 53 51 4c 69 ame for the SQLi
49b0: 74 65 20 63 6f 72 65 0d 0a 20 20 20 20 20 20 23 te core.. #
49c0: 20 20 20 20 20 20 20 6c 69 62 72 61 72 79 2e 20 library.
49d0: 20 49 66 20 74 68 69 73 20 66 69 6c 65 20 65 78 If this file ex
49e0: 69 73 74 73 2c 20 77 65 20 73 68 6f 75 6c 64 20 ists, we should
49f0: 68 61 76 65 20 65 76 65 72 79 74 68 69 6e 67 20 have everything
4a00: 77 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 we.. #
4a10: 20 20 6e 65 65 64 2e 0d 0a 20 20 20 20 20 20 23 need... #
4a20: 0d 0a 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 .. set file
4a30: 4e 61 6d 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 Name [file nativ
4a40: 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
4a50: 20 24 64 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 $directory \..
4a60: 20 20 20 20 20 20 20 20 20 24 70 6c 61 74 66 6f $platfo
4a70: 72 6d 20 73 71 6c 69 74 65 33 2e 64 6c 6c 5d 5d rm sqlite3.dll]]
4a80: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 66 .... if {[f
4a90: 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 ile exists $file
4aa0: 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 Name]} then {..
4ab0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
4ac0: 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 ue.. }....
4ad0: 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d set fileNam
4ae0: 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 e [file nativena
4af0: 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 me [file join $d
4b00: 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 irectory \..
4b10: 20 20 20 20 20 20 73 71 6c 69 74 65 33 2e 64 6c sqlite3.dl
4b20: 6c 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 l]].... if
4b30: 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 {[file exists $f
4b40: 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b ileName]} then {
4b50: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
4b60: 20 74 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a true.. }..
4b70: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
4b80: 20 23 20 4e 4f 54 45 3a 20 4f 6e 65 20 6f 72 20 # NOTE: One or
4b90: 6d 6f 72 65 20 6e 61 74 69 76 65 20 63 6f 6d 70 more native comp
4ba0: 6f 6e 65 6e 74 73 20 6e 65 65 64 65 64 20 62 79 onents needed by
4bb0: 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
4bc0: 69 74 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ite.. #
4bd0: 20 20 20 61 72 65 20 6d 69 73 73 69 6e 67 2e 0d are missing..
4be0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
4bf0: 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 return false..
4c00: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
4c10: 20 69 73 52 65 6c 65 61 73 65 41 76 61 69 6c 61 isReleaseAvaila
4c20: 62 6c 65 20 7b 20 64 69 72 65 63 74 6f 72 79 20 ble { directory
4c30: 7b 76 61 72 4e 61 6d 65 20 22 22 7d 20 7d 20 7b {varName ""} } {
4c40: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
4c50: 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e ing length $varN
4c60: 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ame] > 0} then {
4c70: 0d 0a 20 20 20 20 20 20 20 20 75 70 76 61 72 20 .. upvar
4c80: 31 20 24 76 61 72 4e 61 6d 65 20 24 76 61 72 4e 1 $varName $varN
4c90: 61 6d 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a ame.. }....
4ca0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 69 73 return [is
4cb0: 42 75 69 6c 64 41 76 61 69 6c 61 62 6c 65 20 22 BuildAvailable "
4cc0: 22 20 24 64 69 72 65 63 74 6f 72 79 20 24 76 61 " $directory $va
4cd0: 72 4e 61 6d 65 5d 0d 0a 20 20 20 20 7d 0d 0a 0c rName].. }...
4ce0: 0d 0a 20 20 20 20 70 72 6f 63 20 6a 6f 69 6e 42 .. proc joinB
4cf0: 75 69 6c 64 44 69 72 65 63 74 6f 72 79 20 7b 20 uildDirectory {
4d00: 6e 61 74 69 76 65 20 70 61 74 68 20 79 65 61 72 native path year
4d10: 20 70 6c 61 74 66 6f 72 6d 20 63 6f 6e 66 69 67 platform config
4d20: 75 72 61 74 69 6f 6e 20 7d 20 7b 0d 0a 20 20 20 uration } {..
4d30: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
4d40: 54 45 3a 20 46 69 67 75 72 65 20 6f 75 74 20 61 TE: Figure out a
4d50: 6e 64 20 74 68 65 6e 20 72 65 74 75 72 6e 20 74 nd then return t
4d60: 68 65 20 66 75 6c 6c 79 20 71 75 61 6c 69 66 69 he fully qualifi
4d70: 65 64 20 70 61 74 68 20 74 6f 20 74 68 65 20 62 ed path to the b
4d80: 75 69 6c 64 0d 0a 20 20 20 20 20 20 23 20 20 20 uild.. #
4d90: 20 20 20 20 64 69 72 65 63 74 6f 72 79 20 62 61 directory ba
4da0: 73 65 64 20 6f 6e 20 61 6c 6c 20 74 68 65 20 61 sed on all the a
4db0: 72 67 75 6d 65 6e 74 73 20 70 72 6f 76 69 64 65 rguments provide
4dc0: 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 2e d by our caller.
4dd0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
4de0: 20 69 66 20 7b 24 6e 61 74 69 76 65 7d 20 74 68 if {$native} th
4df0: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 en {.. re
4e00: 74 75 72 6e 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 turn [file join
4e10: 24 70 61 74 68 20 62 69 6e 20 24 79 65 61 72 20 $path bin $year
4e20: 24 70 6c 61 74 66 6f 72 6d 20 24 63 6f 6e 66 69 $platform $confi
4e30: 67 75 72 61 74 69 6f 6e 5d 0d 0a 20 20 20 20 20 guration]..
4e40: 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
4e50: 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 return [file
4e60: 6a 6f 69 6e 20 24 70 61 74 68 20 62 69 6e 20 24 join $path bin $
4e70: 79 65 61 72 20 24 63 6f 6e 66 69 67 75 72 61 74 year $configurat
4e80: 69 6f 6e 20 62 69 6e 5d 0d 0a 20 20 20 20 20 20 ion bin]..
4e90: 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
4ea0: 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 44 69 proc getBuildDi
4eb0: 72 65 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a 20 20 rectory {} {..
4ec0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
4ed0: 4f 54 45 3a 20 53 65 65 20 69 66 20 74 68 65 20 OTE: See if the
4ee0: 22 6e 61 74 69 76 65 22 20 72 75 6e 74 69 6d 65 "native" runtime
4ef0: 20 6f 70 74 69 6f 6e 20 68 61 73 20 62 65 65 6e option has been
4f00: 20 73 65 74 2e 20 20 49 66 20 73 6f 2c 20 75 73 set. If so, us
4f10: 65 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 e the.. #
4f20: 20 20 20 20 20 64 69 72 65 63 74 6f 72 79 20 66 directory f
4f30: 6f 72 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 or the mixed-mod
4f40: 65 20 61 73 73 65 6d 62 6c 79 20 28 61 2e 6b 2e e assembly (a.k.
4f50: 61 2e 20 74 68 65 20 6e 61 74 69 76 65 20 69 6e a. the native in
4f60: 74 65 72 6f 70 0d 0a 20 20 20 20 20 20 23 20 20 terop.. #
4f70: 20 20 20 20 20 61 73 73 65 6d 62 6c 79 29 2e 20 assembly).
4f80: 20 54 6f 20 65 6e 61 62 6c 65 20 74 68 69 73 20 To enable this
4f90: 6f 70 74 69 6f 6e 20 76 69 61 20 74 68 65 20 63 option via the c
4fa0: 6f 6d 6d 61 6e 64 20 6c 69 6e 65 2c 20 65 6e 74 ommand line, ent
4fb0: 65 72 20 61 0d 0a 20 20 20 20 20 20 23 20 20 20 er a.. #
4fc0: 20 20 20 20 63 6f 6d 6d 61 6e 64 20 73 69 6d 69 command simi
4fd0: 6c 61 72 20 74 6f 20 6f 6e 65 20 6f 66 20 74 68 lar to one of th
4fe0: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 28 61 6c 6c e following (all
4ff0: 20 6f 6e 20 6f 6e 65 20 6c 69 6e 65 29 3a 0d 0a on one line):..
5000: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
5010: 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c EagleShel
5020: 6c 2e 65 78 65 20 2d 69 6e 69 74 69 61 6c 69 7a l.exe -initializ
5030: 65 20 2d 72 75 6e 74 69 6d 65 4f 70 74 69 6f 6e e -runtimeOption
5040: 20 6e 61 74 69 76 65 0d 0a 20 20 20 20 20 20 23 native.. #
5050: 20 20 20 20 20 20 20 20 20 2d 66 69 6c 65 20 2e -file .
5060: 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 \path\to\all.eag
5070: 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 le.. #..
5080: 20 20 20 23 20 20 20 20 20 20 20 54 6f 20 65 6e # To en
5090: 61 62 6c 65 20 74 68 69 73 20 6f 70 74 69 6f 6e able this option
50a0: 20 76 69 61 20 74 68 65 20 63 6f 6d 6d 61 6e 64 via the command
50b0: 20 6c 69 6e 65 20 70 72 69 6f 72 20 74 6f 20 74 line prior to t
50c0: 68 65 20 22 62 65 74 61 20 31 36 22 0d 0a 20 20 he "beta 16"..
50d0: 20 20 20 20 23 20 20 20 20 20 20 20 72 65 6c 65 # rele
50e0: 61 73 65 20 6f 66 20 45 61 67 6c 65 2c 20 74 68 ase of Eagle, th
50f0: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f 6d 6d e following comm
5100: 61 6e 64 20 6d 75 73 74 20 62 65 20 75 73 65 64 and must be used
5110: 20 69 6e 73 74 65 61 64 0d 0a 20 20 20 20 20 20 instead..
5120: 23 20 20 20 20 20 20 20 28 61 6c 73 6f 20 61 6c # (also al
5130: 6c 20 6f 6e 20 6f 6e 65 20 6c 69 6e 65 29 3a 0d l on one line):.
5140: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
5150: 23 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 65 # EagleShe
5160: 6c 6c 2e 65 78 65 20 2d 69 6e 69 74 69 61 6c 69 ll.exe -initiali
5170: 7a 65 20 2d 70 6f 73 74 49 6e 69 74 69 61 6c 69 ze -postInitiali
5180: 7a 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ze.. #
5190: 20 20 20 20 22 6f 62 6a 65 63 74 20 69 6e 76 6f "object invo
51a0: 6b 65 20 49 6e 74 65 72 70 72 65 74 65 72 2e 47 ke Interpreter.G
51b0: 65 74 41 63 74 69 76 65 20 41 64 64 52 75 6e 74 etActive AddRunt
51c0: 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 69 76 65 imeOption native
51d0: 22 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 ".. #
51e0: 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c -file .\path\
51f0: 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 to\all.eagle..
5200: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
5210: 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a {[info exists ::
5220: 62 75 69 6c 64 5f 64 69 72 65 63 74 6f 72 79 5d build_directory]
5230: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
5240: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
5250: 24 3a 3a 62 75 69 6c 64 5f 64 69 72 65 63 74 6f $::build_directo
5260: 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d ry] > 0} then {.
5270: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
5280: 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 # NOTE: The
5290: 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 location of the
52a0: 62 75 69 6c 64 20 64 69 72 65 63 74 6f 72 79 20 build directory
52b0: 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 has been overrid
52c0: 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 den;.. #
52d0: 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c therefore,
52e0: 20 75 73 65 20 69 74 20 76 65 72 62 61 74 69 6d use it verbatim
52f0: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
5300: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
5310: 62 75 69 6c 64 5f 64 69 72 65 63 74 6f 72 79 0d build_directory.
5320: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
5330: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
5340: 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 # NOTE: If t
5350: 68 65 20 22 6e 61 74 69 76 65 22 20 72 75 6e 74 he "native" runt
5360: 69 6d 65 20 6f 70 74 69 6f 6e 20 69 73 20 73 65 ime option is se
5370: 74 2c 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 t, the mixed-mod
5380: 65 20 61 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 e assembly..
5390: 20 20 20 20 23 20 20 20 20 20 20 20 69 73 20 62 # is b
53a0: 65 69 6e 67 20 74 65 73 74 65 64 2e 20 20 49 6e eing tested. In
53b0: 20 74 68 61 74 20 63 61 73 65 2c 20 74 68 65 20 that case, the
53c0: 70 61 74 68 20 74 6f 20 74 68 65 20 62 75 69 6c path to the buil
53d0: 64 20 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 d directory..
53e0: 20 20 20 20 20 23 20 20 20 20 20 20 20 77 69 6c # wil
53f0: 6c 20 63 6f 6e 74 61 69 6e 20 74 68 65 20 70 6c l contain the pl
5400: 61 74 66 6f 72 6d 20 6e 61 6d 65 20 61 6e 64 20 atform name and
5410: 61 6c 6c 20 74 68 65 20 62 69 6e 61 72 69 65 73 all the binaries
5420: 20 75 6e 64 65 72 20 74 65 73 74 0d 0a 20 20 20 under test..
5430: 20 20 20 20 20 23 20 20 20 20 20 20 20 73 68 6f # sho
5440: 75 6c 64 20 62 65 20 70 72 65 73 65 6e 74 20 69 uld be present i
5450: 6e 20 74 68 61 74 20 64 69 72 65 63 74 6f 72 79 n that directory
5460: 2e 20 20 49 66 20 74 68 65 20 22 6e 61 74 69 76 . If the "nativ
5470: 65 22 20 72 75 6e 74 69 6d 65 0d 0a 20 20 20 20 e" runtime..
5480: 20 20 20 20 23 20 20 20 20 20 20 20 6f 70 74 69 # opti
5490: 6f 6e 20 69 73 20 6e 6f 74 20 73 65 74 2c 20 74 on is not set, t
54a0: 68 65 20 62 75 69 6c 64 20 64 69 72 65 63 74 6f he build directo
54b0: 72 79 20 77 69 6c 6c 20 62 65 20 63 6f 6e 73 69 ry will be consi
54c0: 64 65 72 65 64 20 74 6f 20 62 65 0d 0a 20 20 20 dered to be..
54d0: 20 20 20 20 20 23 20 20 20 20 20 20 20 22 70 6c # "pl
54e0: 61 74 66 6f 72 6d 2d 6e 65 75 74 72 61 6c 22 2c atform-neutral",
54f0: 20 77 69 74 68 20 74 68 65 20 6e 6f 74 61 62 6c with the notabl
5500: 65 20 65 78 63 65 70 74 69 6f 6e 20 6f 66 20 61 e exception of a
5510: 6e 79 20 6e 61 74 69 76 65 0d 0a 20 20 20 20 20 ny native..
5520: 20 20 20 23 20 20 20 20 20 20 20 61 73 73 65 6d # assem
5530: 62 6c 79 20 28 65 2e 67 2e 20 22 53 51 4c 69 74 bly (e.g. "SQLit
5540: 65 2e 49 6e 74 65 72 6f 70 2e 64 6c 6c 22 29 20 e.Interop.dll")
5550: 63 6f 70 69 65 64 20 74 68 65 72 65 20 64 75 72 copied there dur
5560: 69 6e 67 20 74 68 65 0d 0a 20 20 20 20 20 20 20 ing the..
5570: 20 23 20 20 20 20 20 20 20 62 75 69 6c 64 20 70 # build p
5580: 72 6f 63 65 73 73 20 69 74 73 65 6c 66 2e 20 20 rocess itself.
5590: 49 66 20 74 68 65 20 62 75 69 6c 64 20 70 72 6f If the build pro
55a0: 63 65 73 73 20 73 6f 6d 65 68 6f 77 20 64 6f 65 cess somehow doe
55b0: 73 20 6e 6f 74 0d 0a 20 20 20 20 20 20 20 20 23 s not.. #
55c0: 20 20 20 20 20 20 20 63 6f 70 79 20 74 68 65 20 copy the
55d0: 6e 61 74 69 76 65 20 61 73 73 65 6d 62 6c 79 20 native assembly
55e0: 66 6f 72 20 74 68 69 73 20 70 6c 61 74 66 6f 72 for this platfor
55f0: 6d 2c 20 6d 6f 73 74 20 6f 66 20 74 68 65 20 74 m, most of the t
5600: 65 73 74 73 0d 0a 20 20 20 20 20 20 20 20 23 20 ests.. #
5610: 20 20 20 20 20 20 69 6e 20 74 68 65 20 73 75 69 in the sui
5620: 74 65 20 77 69 6c 6c 20 73 69 6d 70 6c 79 20 62 te will simply b
5630: 65 20 73 6b 69 70 70 65 64 2e 20 20 47 65 6e 65 e skipped. Gene
5640: 72 61 6c 6c 79 20 73 70 65 61 6b 69 6e 67 2c 20 rally speaking,
5650: 74 68 65 72 65 0d 0a 20 20 20 20 20 20 20 20 23 there.. #
5660: 20 20 20 20 20 20 20 61 72 65 20 74 77 6f 20 77 are two w
5670: 61 79 73 20 74 6f 20 62 75 69 6c 64 20 74 68 65 ays to build the
5680: 20 62 69 6e 61 72 69 65 73 20 77 68 65 6e 20 70 binaries when p
5690: 72 65 70 61 72 69 6e 67 20 74 6f 20 72 75 6e 20 reparing to run
56a0: 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 the.. #
56b0: 20 20 20 20 20 74 65 73 74 20 73 75 69 74 65 3a test suite:
56c0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
56d0: 20 20 20 20 20 23 20 20 20 20 20 20 20 31 2e 20 # 1.
56e0: 42 75 69 6c 64 20 74 68 65 20 73 65 70 61 72 61 Build the separa
56f0: 74 65 20 6d 61 6e 61 67 65 64 20 61 6e 64 20 6e te managed and n
5700: 61 74 69 76 65 20 61 73 73 65 6d 62 6c 69 65 73 ative assemblies
5710: 20 75 73 69 6e 67 20 73 6f 6d 65 0d 0a 20 20 20 using some..
5720: 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 #
5730: 63 6f 6d 6d 61 6e 64 73 20 73 69 6d 69 6c 61 72 commands similar
5740: 20 74 6f 3a 0d 0a 20 20 20 20 20 20 20 20 23 0d to:.. #.
5750: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
5760: 20 20 20 20 62 75 69 6c 64 2e 62 61 74 20 24 7b build.bat ${
5770: 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 7d 4d 61 Configuration}Ma
5780: 6e 61 67 65 64 4f 6e 6c 79 20 24 7b 50 6c 61 74 nagedOnly ${Plat
5790: 66 6f 72 6d 7d 0d 0a 20 20 20 20 20 20 20 20 23 form}.. #
57a0: 20 20 20 20 20 20 20 20 20 20 62 75 69 6c 64 2e build.
57b0: 62 61 74 20 24 7b 43 6f 6e 66 69 67 75 72 61 74 bat ${Configurat
57c0: 69 6f 6e 7d 4e 61 74 69 76 65 4f 6e 6c 79 20 24 ion}NativeOnly $
57d0: 7b 50 6c 61 74 66 6f 72 6d 7d 0d 0a 20 20 20 20 {Platform}..
57e0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
57f0: 20 20 20 20 20 20 20 20 20 20 57 68 65 72 65 20 Where
5800: 24 7b 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 7d ${Configuration}
5810: 20 69 73 20 65 69 74 68 65 72 20 22 44 65 62 75 is either "Debu
5820: 67 22 20 6f 72 20 22 52 65 6c 65 61 73 65 22 20 g" or "Release"
5830: 61 6e 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 and.. #
5840: 20 20 20 20 20 20 20 20 24 7b 50 6c 61 74 66 6f ${Platfo
5850: 72 6d 7d 20 69 73 20 65 69 74 68 65 72 20 22 57 rm} is either "W
5860: 69 6e 33 32 22 20 6f 72 20 22 78 36 34 22 2e 0d in32" or "x64"..
5870: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
5880: 20 20 20 20 23 20 20 20 20 20 20 20 32 2e 20 42 # 2. B
5890: 75 69 6c 64 20 74 68 65 20 6d 69 78 65 64 2d 6d uild the mixed-m
58a0: 6f 64 65 20 61 73 73 65 6d 62 6c 79 20 75 73 69 ode assembly usi
58b0: 6e 67 20 61 20 63 6f 6d 6d 61 6e 64 20 73 69 6d ng a command sim
58c0: 69 6c 61 72 20 74 6f 3a 0d 0a 20 20 20 20 20 20 ilar to:..
58d0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 20 #.. #
58e0: 20 20 20 20 20 20 20 20 62 75 69 6c 64 2e 62 61 build.ba
58f0: 74 20 24 7b 43 6f 6e 66 69 67 75 72 61 74 69 6f t ${Configuratio
5900: 6e 7d 20 24 7b 50 6c 61 74 66 6f 72 6d 7d 0d 0a n} ${Platform}..
5910: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
5920: 20 20 20 23 20 20 20 20 20 20 20 20 20 20 57 68 # Wh
5930: 65 72 65 20 24 7b 43 6f 6e 66 69 67 75 72 61 74 ere ${Configurat
5940: 69 6f 6e 7d 20 69 73 20 65 69 74 68 65 72 20 22 ion} is either "
5950: 44 65 62 75 67 22 20 6f 72 20 22 52 65 6c 65 61 Debug" or "Relea
5960: 73 65 22 20 61 6e 64 0d 0a 20 20 20 20 20 20 20 se" and..
5970: 20 23 20 20 20 20 20 20 20 20 20 20 24 7b 50 6c # ${Pl
5980: 61 74 66 6f 72 6d 7d 20 69 73 20 65 69 74 68 65 atform} is eithe
5990: 72 20 22 57 69 6e 33 32 22 20 6f 72 20 22 78 36 r "Win32" or "x6
59a0: 34 22 2e 20 20 49 66 20 74 68 69 73 20 63 6f 6d 4". If this com
59b0: 6d 61 6e 64 20 69 73 0d 0a 20 20 20 20 20 20 20 mand is..
59c0: 20 23 20 20 20 20 20 20 20 20 20 20 75 73 65 64 # used
59d0: 2c 20 76 61 72 69 6f 75 73 20 74 65 73 74 73 20 , various tests
59e0: 74 68 61 74 20 72 65 71 75 69 72 65 20 73 75 70 that require sup
59f0: 70 6c 65 6d 65 6e 74 61 72 79 20 6d 61 6e 61 67 plementary manag
5a00: 65 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ed.. #
5a10: 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c 69 65 assemblie
5a20: 73 20 28 65 2e 67 2e 20 4c 49 4e 51 29 20 6d 61 s (e.g. LINQ) ma
5a30: 79 20 62 65 20 73 6b 69 70 70 65 64 20 75 6e 6c y be skipped unl
5a40: 65 73 73 20 74 68 6f 73 65 20 62 69 6e 61 72 69 ess those binari
5a50: 65 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 es.. #
5a60: 20 20 20 20 20 20 20 61 72 65 20 73 75 62 73 65 are subse
5a70: 71 75 65 6e 74 6c 79 20 63 6f 70 69 65 64 20 69 quently copied i
5a80: 6e 74 6f 20 74 68 65 20 63 6f 72 72 65 63 74 20 nto the correct
5a90: 64 69 72 65 63 74 6f 72 79 20 28 69 2e 65 2e 20 directory (i.e.
5aa0: 62 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 by.. #
5ab0: 20 20 20 20 20 20 20 22 74 65 73 74 5f 61 6c 6c "test_all
5ac0: 2e 62 61 74 22 29 2e 0d 0a 20 20 20 20 20 20 20 .bat")...
5ad0: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 #.. #
5ae0: 20 20 20 20 4e 6f 74 65 20 74 68 61 74 20 61 6c Note that al
5af0: 6c 20 6f 66 20 74 68 65 20 62 75 69 6c 64 20 63 l of the build c
5b00: 6f 6d 6d 61 6e 64 73 20 61 62 6f 76 65 20 77 69 ommands above wi
5b10: 6c 6c 20 64 65 66 61 75 6c 74 20 74 6f 20 75 73 ll default to us
5b20: 69 6e 67 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ing.. #
5b30: 20 20 20 20 20 74 68 65 20 6c 61 74 65 73 74 20 the latest
5b40: 76 65 72 73 69 6f 6e 20 6f 66 20 4d 53 42 75 69 version of MSBui
5b50: 6c 64 20 61 76 61 69 6c 61 62 6c 65 20 61 6e 64 ld available and
5b60: 20 74 68 65 20 22 74 65 73 74 5f 79 65 61 72 22 the "test_year"
5b70: 20 6d 61 79 0d 0a 20 20 20 20 20 20 20 20 23 20 may.. #
5b80: 20 20 20 20 20 20 6e 65 65 64 20 74 6f 20 62 65 need to be
5b90: 20 61 64 6a 75 73 74 65 64 20 61 63 63 6f 72 64 adjusted accord
5ba0: 69 6e 67 6c 79 20 74 6f 20 61 63 74 75 61 6c 6c ingly to actuall
5bb0: 79 20 72 75 6e 20 74 68 65 20 74 65 73 74 20 73 y run the test s
5bc0: 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 uite... #
5bd0: 20 20 20 20 20 20 20 52 65 66 65 72 20 74 6f 20 Refer to
5be0: 74 68 65 20 63 6f 6d 6d 65 6e 74 73 20 69 6e 20 the comments in
5bf0: 5b 67 65 74 42 75 69 6c 64 59 65 61 72 5d 20 66 [getBuildYear] f
5c00: 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 or more informat
5c10: 69 6f 6e 20 6f 6e 0d 0a 20 20 20 20 20 20 20 20 ion on..
5c20: 23 20 20 20 20 20 20 20 68 6f 77 20 74 6f 20 73 # how to s
5c30: 65 74 20 74 68 69 73 20 76 61 72 69 61 62 6c 65 et this variable
5c40: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
5c50: 20 20 20 20 20 20 73 65 74 20 6e 61 74 69 76 65 set native
5c60: 20 5b 68 61 73 52 75 6e 74 69 6d 65 4f 70 74 69 [hasRuntimeOpti
5c70: 6f 6e 20 6e 61 74 69 76 65 5d 0d 0a 0d 0a 20 20 on native]....
5c80: 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6a 6f return [jo
5c90: 69 6e 42 75 69 6c 64 44 69 72 65 63 74 6f 72 79 inBuildDirectory
5ca0: 20 24 6e 61 74 69 76 65 20 5b 67 65 74 42 75 69 $native [getBui
5cb0: 6c 64 42 61 73 65 44 69 72 65 63 74 6f 72 79 5d ldBaseDirectory]
5cc0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
5cd0: 5b 67 65 74 42 75 69 6c 64 59 65 61 72 5d 20 5b [getBuildYear] [
5ce0: 67 65 74 42 75 69 6c 64 50 6c 61 74 66 6f 72 6d getBuildPlatform
5cf0: 20 24 6e 61 74 69 76 65 5d 20 5b 67 65 74 42 75 $native] [getBu
5d00: 69 6c 64 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e ildConfiguration
5d10: 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 ]].. }..
5d20: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
5d30: 67 65 74 52 65 6c 65 61 73 65 56 65 72 73 69 6f getReleaseVersio
5d40: 6e 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d n {} {.. #.
5d50: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 . # NOTE: F
5d60: 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 72 65 igure out the re
5d70: 6c 65 61 73 65 20 76 65 72 73 69 6f 6e 20 66 6f lease version fo
5d80: 72 20 75 73 65 20 77 69 74 68 20 74 68 65 20 62 r use with the b
5d90: 75 69 6c 64 20 64 69 72 65 63 74 6f 72 79 0d 0a uild directory..
5da0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 77 68 # wh
5db0: 65 6e 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 en checking for
5dc0: 61 76 61 69 6c 61 62 6c 65 20 72 65 6c 65 61 73 available releas
5dd0: 65 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 es... #..
5de0: 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
5df0: 69 73 74 73 20 3a 3a 72 65 6c 65 61 73 65 5f 76 ists ::release_v
5e00: 65 72 73 69 6f 6e 5d 20 26 26 20 5c 0d 0a 20 20 ersion] && \..
5e10: 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
5e20: 6c 65 6e 67 74 68 20 24 3a 3a 72 65 6c 65 61 73 length $::releas
5e30: 65 5f 76 65 72 73 69 6f 6e 5d 20 3e 20 30 7d 20 e_version] > 0}
5e40: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
5e50: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
5e60: 45 3a 20 54 68 65 20 72 65 6c 65 61 73 65 20 76 E: The release v
5e70: 65 72 73 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 ersion has been
5e80: 6f 76 65 72 72 69 64 64 65 6e 3b 20 74 68 65 72 overridden; ther
5e90: 65 66 6f 72 65 2c 20 75 73 65 20 69 74 0d 0a 20 efore, use it..
5ea0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 # v
5eb0: 65 72 62 61 74 69 6d 2e 0d 0a 20 20 20 20 20 20 erbatim...
5ec0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
5ed0: 75 72 6e 20 24 3a 3a 72 65 6c 65 61 73 65 5f 76 urn $::release_v
5ee0: 65 72 73 69 6f 6e 0d 0a 20 20 20 20 20 20 7d 20 ersion.. }
5ef0: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
5f00: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
5f10: 45 3a 20 4e 6f 20 72 65 6c 65 61 73 65 20 76 65 E: No release ve
5f20: 72 73 69 6f 6e 20 69 73 20 61 76 61 69 6c 61 62 rsion is availab
5f30: 6c 65 2c 20 72 65 74 75 72 6e 20 61 6e 20 65 6d le, return an em
5f40: 70 74 79 20 73 74 72 69 6e 67 2e 0d 0a 20 20 20 pty string...
5f50: 20 20 20 20 20 23 20 20 20 20 20 20 20 49 74 20 # It
5f60: 69 73 20 69 6d 70 6f 72 74 61 6e 74 20 74 6f 20 is important to
5f70: 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 return an empty
5f80: 73 74 72 69 6e 67 20 68 65 72 65 20 62 65 63 61 string here beca
5f90: 75 73 65 20 74 68 65 0d 0a 20 20 20 20 20 20 20 use the..
5fa0: 20 23 20 20 20 20 20 20 20 72 65 73 75 6c 74 20 # result
5fb0: 6f 66 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 of this procedur
5fc0: 65 20 6d 61 79 20 62 65 20 75 73 65 64 20 77 69 e may be used wi
5fd0: 74 68 20 5b 66 69 6c 65 20 6a 6f 69 6e 5d 2e 0d th [file join]..
5fe0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
5ff0: 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 return ""..
6000: 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
6010: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 75 .. proc getBu
6020: 69 6c 64 46 69 6c 65 4e 61 6d 65 20 7b 20 66 69 ildFileName { fi
6030: 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d leName {platform
6040: 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 ""} } {..
6050: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
6060: 20 52 65 74 75 72 6e 73 20 74 68 65 20 73 70 65 Returns the spe
6070: 63 69 66 69 65 64 20 66 69 6c 65 20 6e 61 6d 65 cified file name
6080: 20 61 73 20 69 66 20 69 74 20 77 65 72 65 20 6c as if it were l
6090: 6f 63 61 74 65 64 20 69 6e 20 74 68 65 0d 0a 20 ocated in the..
60a0: 20 20 20 20 20 23 20 20 20 20 20 20 20 62 75 69 # bui
60b0: 6c 64 20 64 69 72 65 63 74 6f 72 79 2c 20 64 69 ld directory, di
60c0: 73 63 61 72 64 69 6e 67 20 61 6e 79 20 64 69 72 scarding any dir
60d0: 65 63 74 6f 72 79 20 69 6e 66 6f 72 6d 61 74 69 ectory informati
60e0: 6f 6e 20 70 72 65 73 65 6e 74 0d 0a 20 20 20 20 on present..
60f0: 20 20 23 20 20 20 20 20 20 20 69 6e 20 74 68 65 # in the
6100: 20 66 69 6c 65 20 6e 61 6d 65 20 61 73 20 70 72 file name as pr
6110: 6f 76 69 64 65 64 20 62 79 20 6f 75 72 20 63 61 ovided by our ca
6120: 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a ller... #..
6130: 20 20 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 set result
6140: 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d [file nativenam
6150: 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b e \.. [
6160: 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 42 75 file join [getBu
6170: 69 6c 64 44 69 72 65 63 74 6f 72 79 5d 20 24 70 ildDirectory] $p
6180: 6c 61 74 66 6f 72 6d 20 5b 66 69 6c 65 20 74 61 latform [file ta
6190: 69 6c 20 24 66 69 6c 65 4e 61 6d 65 5d 5d 5d 0d il $fileName]]].
61a0: 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
61b0: 20 20 23 20 48 41 43 4b 3a 20 57 68 65 6e 20 72 # HACK: When r
61c0: 75 6e 6e 69 6e 67 20 6f 6e 20 57 6f 57 36 34 2c unning on WoW64,
61d0: 20 61 73 73 75 6d 65 20 74 68 65 20 74 65 73 74 assume the test
61e0: 20 65 78 65 63 75 74 61 62 6c 65 73 20 61 72 65 executables are
61f0: 20 70 72 65 73 65 6e 74 0d 0a 20 20 20 20 20 20 present..
6200: 23 20 20 20 20 20 20 20 77 69 74 68 20 74 68 65 # with the
6210: 20 22 33 32 22 20 73 75 66 66 69 78 20 6f 6e 20 "32" suffix on
6220: 74 68 65 6d 2e 0d 0a 20 20 20 20 20 20 23 0d 0a them... #..
6230: 20 20 20 20 20 20 69 66 20 7b 5b 69 73 52 75 6e if {[isRun
6240: 6e 69 6e 67 57 6f 57 36 34 5d 20 26 26 20 5b 66 ningWoW64] && [f
6250: 69 6c 65 20 65 78 74 65 6e 73 69 6f 6e 20 24 72 ile extension $r
6260: 65 73 75 6c 74 5d 20 65 71 20 22 2e 65 78 65 22 esult] eq ".exe"
6270: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
6280: 20 20 73 65 74 20 72 65 73 75 6c 74 20 5b 61 70 set result [ap
6290: 70 65 6e 64 41 72 67 73 20 5b 66 69 6c 65 20 72 pendArgs [file r
62a0: 6f 6f 74 6e 61 6d 65 20 24 72 65 73 75 6c 74 5d ootname $result]
62b0: 20 33 32 2e 65 78 65 5d 0d 0a 20 20 20 20 20 20 32.exe]..
62c0: 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 }.... retur
62d0: 6e 20 24 72 65 73 75 6c 74 0d 0a 20 20 20 20 7d n $result.. }
62e0: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
62f0: 74 45 78 74 65 72 6e 61 6c 44 69 72 65 63 74 6f tExternalDirecto
6300: 72 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ry {} {.. #
6310: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
6320: 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 72 This procedure r
6330: 65 74 75 72 6e 73 20 74 68 65 20 64 69 72 65 63 eturns the direc
6340: 74 6f 72 79 20 77 68 65 72 65 20 74 68 65 20 65 tory where the e
6350: 78 74 65 72 6e 61 6c 20 62 69 6e 61 72 79 0d 0a xternal binary..
6360: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 66 69 # fi
6370: 6c 65 73 20 61 72 65 20 6c 6f 63 61 74 65 64 2e les are located.
6380: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
6390: 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 6e 61 return [file na
63a0: 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 64 tivename [file d
63b0: 69 72 6e 61 6d 65 20 5b 66 69 6c 65 20 64 69 72 irname [file dir
63c0: 6e 61 6d 65 20 5b 69 6e 66 6f 20 62 69 6e 61 72 name [info binar
63d0: 79 5d 5d 5d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d y]]]].. }....
63e0: 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 69 6e . proc getBin
63f0: 61 72 79 44 69 72 65 63 74 6f 72 79 20 7b 7d 20 aryDirectory {}
6400: 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
6410: 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 # NOTE: This p
6420: 72 6f 63 65 64 75 72 65 20 72 65 74 75 72 6e 73 rocedure returns
6430: 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 77 the directory w
6440: 68 65 72 65 20 74 68 65 20 74 65 73 74 20 61 70 here the test ap
6450: 70 6c 69 63 61 74 69 6f 6e 0d 0a 20 20 20 20 20 plication..
6460: 20 23 20 20 20 20 20 20 20 69 74 73 65 6c 66 20 # itself
6470: 28 69 2e 65 2e 20 74 68 65 20 45 61 67 6c 65 20 (i.e. the Eagle
6480: 73 68 65 6c 6c 29 20 69 73 20 6c 6f 63 61 74 65 shell) is locate
6490: 64 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 62 65 d. This will be
64a0: 20 75 73 65 64 20 61 73 0d 0a 20 20 20 20 20 20 used as..
64b0: 23 20 20 20 20 20 20 20 74 68 65 20 64 65 73 74 # the dest
64c0: 69 6e 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 ination for the
64d0: 63 6f 70 69 65 64 20 53 79 73 74 65 6d 2e 44 61 copied System.Da
64e0: 74 61 2e 53 51 4c 69 74 65 20 6e 61 74 69 76 65 ta.SQLite native
64f0: 20 61 6e 64 0d 0a 20 20 20 20 20 20 23 20 20 20 and.. #
6500: 20 20 20 20 6d 61 6e 61 67 65 64 20 61 73 73 65 managed asse
6510: 6d 62 6c 69 65 73 20 28 69 2e 65 2e 20 62 65 63 mblies (i.e. bec
6520: 61 75 73 65 20 74 68 69 73 20 69 73 20 6f 6e 65 ause this is one
6530: 20 6f 66 20 74 68 65 20 66 65 77 20 70 6c 61 63 of the few plac
6540: 65 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 es.. #
6550: 20 20 77 68 65 72 65 20 74 68 65 20 43 4c 52 20 where the CLR
6560: 77 69 6c 6c 20 61 63 74 75 61 6c 6c 79 20 66 69 will actually fi
6570: 6e 64 20 61 6e 64 20 6c 6f 61 64 20 74 68 65 6d nd and load them
6580: 20 70 72 6f 70 65 72 6c 79 29 2e 0d 0a 20 20 20 properly)...
6590: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
65a0: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 62 [info exists ::b
65b0: 69 6e 61 72 79 5f 64 69 72 65 63 74 6f 72 79 5d inary_directory]
65c0: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
65d0: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
65e0: 24 3a 3a 62 69 6e 61 72 79 5f 64 69 72 65 63 74 $::binary_direct
65f0: 6f 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ory] > 0} then {
6600: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
6610: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 # NOTE: The
6620: 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 location of the
6630: 20 62 69 6e 61 72 79 20 64 69 72 65 63 74 6f 72 binary director
6640: 79 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 y has been overr
6650: 69 64 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 idden;..
6660: 23 20 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 # therefor
6670: 65 2c 20 75 73 65 20 69 74 20 76 65 72 62 61 74 e, use it verbat
6680: 69 6d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a im... #..
6690: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
66a0: 3a 3a 62 69 6e 61 72 79 5f 64 69 72 65 63 74 6f ::binary_directo
66b0: 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 ry.. } else
66c0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 {.. retu
66d0: 72 6e 20 5b 69 6e 66 6f 20 62 69 6e 61 72 79 5d rn [info binary]
66e0: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
66f0: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
6700: 74 45 78 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d tExternalFileNam
6710: 65 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7d 20 7b e { fileName } {
6720: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
6730: 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 73 # NOTE: Returns
6740: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 66 the specified f
6750: 69 6c 65 20 6e 61 6d 65 20 61 73 20 69 66 20 69 ile name as if i
6760: 74 20 77 65 72 65 20 6c 6f 63 61 74 65 64 20 69 t were located i
6770: 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 n the.. #
6780: 20 20 20 20 20 64 69 72 65 63 74 6f 72 79 20 63 directory c
6790: 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 65 78 ontaining the ex
67a0: 74 65 72 6e 61 6c 20 62 69 6e 61 72 69 65 73 2e ternal binaries.
67b0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
67c0: 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 6e 61 return [file na
67d0: 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a tivename [file j
67e0: 6f 69 6e 20 5b 67 65 74 45 78 74 65 72 6e 61 6c oin [getExternal
67f0: 44 69 72 65 63 74 6f 72 79 5d 20 24 66 69 6c 65 Directory] $file
6800: 4e 61 6d 65 5d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c Name]].. }...
6810: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 69 .. proc getBi
6820: 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 7b 20 66 naryFileName { f
6830: 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 ileName {platfor
6840: 6d 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 m ""} } {..
6850: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
6860: 3a 20 52 65 74 75 72 6e 73 20 74 68 65 20 73 70 : Returns the sp
6870: 65 63 69 66 69 65 64 20 66 69 6c 65 20 6e 61 6d ecified file nam
6880: 65 20 61 73 20 69 66 20 69 74 20 77 65 72 65 20 e as if it were
6890: 6c 6f 63 61 74 65 64 20 69 6e 20 74 68 65 0d 0a located in the..
68a0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 69 # bi
68b0: 6e 61 72 79 20 64 69 72 65 63 74 6f 72 79 2c 20 nary directory,
68c0: 64 69 73 63 61 72 64 69 6e 67 20 61 6e 79 20 64 discarding any d
68d0: 69 72 65 63 74 6f 72 79 20 69 6e 66 6f 72 6d 61 irectory informa
68e0: 74 69 6f 6e 20 70 72 65 73 65 6e 74 0d 0a 20 20 tion present..
68f0: 20 20 20 20 23 20 20 20 20 20 20 20 69 6e 20 74 # in t
6900: 68 65 20 66 69 6c 65 20 6e 61 6d 65 20 61 73 20 he file name as
6910: 70 72 6f 76 69 64 65 64 20 62 79 20 6f 75 72 20 provided by our
6920: 63 61 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 23 caller... #
6930: 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b .. return [
6940: 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 file nativename
6950: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 66 69 \.. [fi
6960: 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 42 69 6e 61 le join [getBina
6970: 72 79 44 69 72 65 63 74 6f 72 79 5d 20 24 70 6c ryDirectory] $pl
6980: 61 74 66 6f 72 6d 20 5b 66 69 6c 65 20 74 61 69 atform [file tai
6990: 6c 20 24 66 69 6c 65 4e 61 6d 65 5d 5d 5d 0d 0a l $fileName]]]..
69a0: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
69b0: 6f 63 20 67 65 74 43 6f 72 65 42 69 6e 61 72 79 oc getCoreBinary
69c0: 46 69 6c 65 4e 61 6d 65 20 7b 20 7b 70 6c 61 74 FileName { {plat
69d0: 66 6f 72 6d 20 22 22 7d 20 7b 73 74 61 6e 64 61 form ""} {standa
69e0: 72 64 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 rd false} } {..
69f0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
6a00: 4e 4f 54 45 3a 20 52 65 74 75 72 6e 73 20 74 68 NOTE: Returns th
6a10: 65 20 66 75 6c 6c 20 70 61 74 68 20 66 6f 72 20 e full path for
6a20: 74 68 65 20 66 69 6c 65 20 63 6f 6e 74 61 69 6e the file contain
6a30: 69 6e 67 20 74 68 65 20 53 51 4c 69 74 65 20 63 ing the SQLite c
6a40: 6f 72 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ore.. #
6a50: 20 20 20 6e 61 74 69 76 65 20 6c 69 62 72 61 72 native librar
6a60: 79 20 63 6f 64 65 20 66 6f 72 20 74 68 69 73 20 y code for this
6a70: 70 6c 61 74 66 6f 72 6d 2e 20 20 46 69 72 73 74 platform. First
6a80: 2c 20 63 68 65 63 6b 20 61 6e 64 20 73 65 65 20 , check and see
6a90: 69 66 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 if.. #
6aa0: 20 20 74 68 65 20 53 51 4c 69 74 65 20 63 6f 72 the SQLite cor
6ab0: 65 20 6e 61 74 69 76 65 20 6c 69 62 72 61 72 79 e native library
6ac0: 20 68 61 73 20 61 6c 72 65 61 64 79 20 62 65 65 has already bee
6ad0: 6e 20 6c 6f 61 64 65 64 2e 20 20 4e 65 78 74 2c n loaded. Next,
6ae0: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
6af0: 66 61 6c 6c 62 61 63 6b 20 74 6f 20 77 68 61 74 fallback to what
6b00: 20 74 68 65 20 66 75 6c 6c 20 70 61 74 68 20 73 the full path s
6b10: 68 6f 75 6c 64 20 62 65 2c 20 62 61 73 65 64 20 hould be, based
6b20: 6f 6e 20 77 68 65 74 68 65 72 20 74 68 65 0d 0a on whether the..
6b30: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6d 69 # mi
6b40: 78 65 64 2d 6d 6f 64 65 20 61 73 73 65 6d 62 6c xed-mode assembl
6b50: 79 20 69 73 20 62 65 69 6e 67 20 75 73 65 64 20 y is being used
6b60: 61 6e 64 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 and the name of
6b70: 74 68 65 20 63 75 72 72 65 6e 74 0d 0a 20 20 20 the current..
6b80: 20 20 20 23 20 20 20 20 20 20 20 70 6c 61 74 66 # platf
6b90: 6f 72 6d 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 orm... #..
6ba0: 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
6bb0: 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 {.. objec
6bc0: 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 t invoke -flags
6bd0: 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 +NonPublic \..
6be0: 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
6bf0: 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 .Data.SQLite.Uns
6c00: 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 afeNativeMethods
6c10: 20 5f 53 51 4c 69 74 65 4e 61 74 69 76 65 4d 6f _SQLiteNativeMo
6c20: 64 75 6c 65 46 69 6c 65 4e 61 6d 65 0d 0a 20 20 duleFileName..
6c30: 20 20 20 20 7d 20 66 69 6c 65 4e 61 6d 65 5d 20 } fileName]
6c40: 3d 3d 20 30 20 26 26 20 5b 73 74 72 69 6e 67 20 == 0 && [string
6c50: 6c 65 6e 67 74 68 20 24 66 69 6c 65 4e 61 6d 65 length $fileName
6c60: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
6c70: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
6c80: 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 53 51 # NOTE: The SQ
6c90: 4c 69 74 65 20 63 6f 72 65 20 6e 61 74 69 76 65 Lite core native
6ca0: 20 6c 69 62 72 61 72 79 20 68 61 73 20 61 6c 72 library has alr
6cb0: 65 61 64 79 20 62 65 65 6e 20 6c 6f 61 64 65 64 eady been loaded
6cc0: 20 76 69 61 0d 0a 20 20 20 20 20 20 20 20 23 20 via.. #
6cd0: 20 20 20 20 20 20 74 68 65 20 6e 61 74 69 76 65 the native
6ce0: 20 6c 69 62 72 61 72 79 20 70 72 65 2d 6c 6f 61 library pre-loa
6cf0: 64 65 72 2e 20 20 52 65 74 75 72 6e 20 74 68 61 der. Return tha
6d00: 74 20 66 69 6c 65 20 6e 61 6d 65 20 6e 6f 77 2e t file name now.
6d10: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
6d20: 20 20 20 20 20 72 65 74 75 72 6e 20 24 66 69 6c return $fil
6d30: 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 7d 0d 0a eName.. }..
6d40: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 73 .. if {[has
6d50: 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 RuntimeOption na
6d60: 74 69 76 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 tive]} then {..
6d70: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
6d80: 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e # NOTE: Return
6d90: 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 the mixed-mode
6da0: 61 73 73 65 6d 62 6c 79 20 66 69 6c 65 20 6e 61 assembly file na
6db0: 6d 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a me... #..
6dc0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b return [
6dd0: 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 file nativename
6de0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
6df0: 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 42 69 file join [getBi
6e00: 6e 61 72 79 44 69 72 65 63 74 6f 72 79 5d 20 24 naryDirectory] $
6e10: 70 6c 61 74 66 6f 72 6d 20 53 79 73 74 65 6d 2e platform System.
6e20: 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5d Data.SQLite.dll]
6e30: 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 ].. } elsei
6e40: 66 20 7b 24 73 74 61 6e 64 61 72 64 7d 20 74 68 f {$standard} th
6e50: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
6e60: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
6e70: 20 52 65 74 75 72 6e 20 74 68 65 20 6e 61 74 69 Return the nati
6e80: 76 65 2d 6f 6e 6c 79 20 73 74 61 6e 64 61 72 64 ve-only standard
6e90: 20 53 51 4c 69 74 65 20 6c 69 62 72 61 72 79 20 SQLite library
6ea0: 66 69 6c 65 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 file name...
6eb0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
6ec0: 65 74 75 72 6e 20 5b 66 69 6c 65 20 6e 61 74 69 eturn [file nati
6ed0: 76 65 6e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 vename \..
6ee0: 20 20 20 20 20 20 5b 66 69 6c 65 20 6a 6f 69 6e [file join
6ef0: 20 5b 67 65 74 42 69 6e 61 72 79 44 69 72 65 63 [getBinaryDirec
6f00: 74 6f 72 79 5d 20 24 70 6c 61 74 66 6f 72 6d 20 tory] $platform
6f10: 73 71 6c 69 74 65 33 2e 64 6c 6c 5d 5d 0d 0a 20 sqlite3.dll]]..
6f20: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
6f30: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
6f40: 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e # NOTE: Return
6f50: 20 74 68 65 20 6e 61 74 69 76 65 2d 6f 6e 6c 79 the native-only
6f60: 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c interop assembl
6f70: 79 20 66 69 6c 65 20 6e 61 6d 65 2e 0d 0a 20 20 y file name...
6f80: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
6f90: 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 6e 61 return [file na
6fa0: 74 69 76 65 6e 61 6d 65 20 5c 0d 0a 20 20 20 20 tivename \..
6fb0: 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 6a 6f [file jo
6fc0: 69 6e 20 5b 67 65 74 42 69 6e 61 72 79 44 69 72 in [getBinaryDir
6fd0: 65 63 74 6f 72 79 5d 20 24 70 6c 61 74 66 6f 72 ectory] $platfor
6fe0: 6d 20 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f 70 m SQLite.Interop
6ff0: 2e 64 6c 6c 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d .dll]].. }.
7000: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
7010: 72 6f 63 20 67 65 74 43 6f 6d 6d 6f 6e 44 69 72 roc getCommonDir
7020: 65 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a 20 20 20 ectory {} {..
7030: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
7040: 54 45 3a 20 54 68 69 73 20 70 72 6f 63 65 64 75 TE: This procedu
7050: 72 65 20 72 65 74 75 72 6e 73 20 74 68 65 20 64 re returns the d
7060: 69 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 irectory where t
7070: 68 65 20 74 65 73 74 20 73 63 72 69 70 74 73 0d he test scripts.
7080: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 . # s
7090: 68 6f 75 6c 64 20 62 65 20 6c 6f 63 61 74 65 64 hould be located
70a0: 2e 20 20 42 79 20 64 65 66 61 75 6c 74 2c 20 74 . By default, t
70b0: 68 69 73 20 6a 75 73 74 20 72 65 74 75 72 6e 73 his just returns
70c0: 20 74 68 65 20 45 61 67 6c 65 0d 0a 20 20 20 20 the Eagle..
70d0: 20 20 23 20 20 20 20 20 20 20 62 69 6e 61 72 79 # binary
70e0: 20 64 69 72 65 63 74 6f 72 79 2e 0d 0a 20 20 20 directory...
70f0: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
7100: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 63 [info exists ::c
7110: 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 5d ommon_directory]
7120: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
7130: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
7140: 24 3a 3a 63 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 $::common_direct
7150: 6f 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ory] > 0} then {
7160: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
7170: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 # NOTE: The
7180: 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 location of the
7190: 20 63 6f 6d 6d 6f 6e 20 64 69 72 65 63 74 6f 72 common director
71a0: 79 20 68 61 73 20 62 65 65 6e 20 73 65 74 3b 0d y has been set;.
71b0: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
71c0: 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 therefore, use
71d0: 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a it... #..
71e0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
71f0: 3a 3a 63 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f ::common_directo
7200: 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 ry.. } else
7210: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
7220: 20 3a 3a 76 65 6e 64 6f 72 5f 64 69 72 65 63 74 ::vendor_direct
7230: 6f 72 79 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 ory] && \..
7240: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
7250: 67 74 68 20 24 3a 3a 76 65 6e 64 6f 72 5f 64 69 gth $::vendor_di
7260: 72 65 63 74 6f 72 79 5d 20 3e 20 30 7d 20 74 68 rectory] > 0} th
7270: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
7280: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
7290: 20 54 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 The location of
72a0: 20 74 68 65 20 76 65 6e 64 6f 72 20 64 69 72 65 the vendor dire
72b0: 63 74 6f 72 79 20 68 61 73 20 62 65 65 6e 20 73 ctory has been s
72c0: 65 74 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 20 et;.. #
72d0: 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c 20 therefore,
72e0: 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 use it...
72f0: 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 #.. retu
7300: 72 6e 20 24 3a 3a 76 65 6e 64 6f 72 5f 64 69 72 rn $::vendor_dir
7310: 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 ectory.. }
7320: 65 6c 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 elseif {[info ex
7330: 69 73 74 73 20 3a 3a 74 63 6c 5f 6c 69 62 72 61 ists ::tcl_libra
7340: 72 79 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 ry] && \..
7350: 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 [string leng
7360: 74 68 20 24 3a 3a 74 63 6c 5f 6c 69 62 72 61 72 th $::tcl_librar
7370: 79 5d 20 3e 20 30 20 26 26 20 5c 0d 0a 20 20 20 y] > 0 && \..
7380: 20 20 20 20 20 20 20 5b 66 69 6c 65 20 69 73 64 [file isd
7390: 69 72 65 63 74 6f 72 79 20 24 3a 3a 74 63 6c 5f irectory $::tcl_
73a0: 6c 69 62 72 61 72 79 5d 7d 20 74 68 65 6e 20 7b library]} then {
73b0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
73c0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 # NOTE: The
73d0: 20 76 61 72 69 61 62 6c 65 20 77 69 74 68 20 74 variable with t
73e0: 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 he location of t
73f0: 68 65 20 73 63 72 69 70 74 20 6c 69 62 72 61 72 he script librar
7400: 79 20 69 73 0d 0a 20 20 20 20 20 20 20 20 23 20 y is.. #
7410: 20 20 20 20 20 20 73 65 74 20 61 6e 64 20 61 70 set and ap
7420: 70 65 61 72 73 20 74 6f 20 62 65 20 61 20 72 65 pears to be a re
7430: 61 6c 20 64 69 72 65 63 74 6f 72 79 20 28 69 2e al directory (i.
7440: 65 2e 20 6e 6f 74 20 65 6d 62 65 64 64 65 64 0d e. not embedded.
7450: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
7460: 20 77 69 74 68 69 6e 20 61 20 66 69 6c 65 29 3b within a file);
7470: 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 therefore, use
7480: 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a it... #..
7490: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
74a0: 3a 3a 74 63 6c 5f 6c 69 62 72 61 72 79 0d 0a 20 ::tcl_library..
74b0: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
74c0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
74d0: 20 20 23 20 4e 4f 54 45 3a 20 46 61 6c 6c 62 61 # NOTE: Fallba
74e0: 63 6b 20 74 6f 20 74 68 65 20 64 69 72 65 63 74 ck to the direct
74f0: 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 ory containing t
7500: 68 65 20 65 78 65 63 75 74 61 62 6c 65 2e 0d 0a he executable...
7510: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
7520: 20 20 20 72 65 74 75 72 6e 20 5b 69 6e 66 6f 20 return [info
7530: 62 69 6e 61 72 79 5d 0d 0a 20 20 20 20 20 20 7d binary].. }
7540: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
7550: 70 72 6f 63 20 67 65 74 44 61 74 61 62 61 73 65 proc getDatabase
7560: 44 69 72 65 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a Directory {} {..
7570: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
7580: 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f 63 NOTE: This proc
7590: 65 64 75 72 65 20 72 65 74 75 72 6e 73 20 74 68 edure returns th
75a0: 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 e directory wher
75b0: 65 20 74 68 65 20 74 65 73 74 20 64 61 74 61 62 e the test datab
75c0: 61 73 65 73 0d 0a 20 20 20 20 20 20 23 20 20 20 ases.. #
75d0: 20 20 20 20 73 68 6f 75 6c 64 20 62 65 20 6c 6f should be lo
75e0: 63 61 74 65 64 2e 20 20 42 79 20 64 65 66 61 75 cated. By defau
75f0: 6c 74 2c 20 74 68 69 73 20 6a 75 73 74 20 75 73 lt, this just us
7600: 65 73 20 74 68 65 20 74 65 6d 70 6f 72 61 72 79 es the temporary
7610: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
7620: 64 69 72 65 63 74 6f 72 79 20 63 6f 6e 66 69 67 directory config
7630: 75 72 65 64 20 66 6f 72 20 74 68 69 73 20 73 79 ured for this sy
7640: 73 74 65 6d 2e 0d 0a 20 20 20 20 20 20 23 0d 0a stem... #..
7650: 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 if {[info
7660: 65 78 69 73 74 73 20 3a 3a 64 61 74 61 62 61 73 exists ::databas
7670: 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 26 20 e_directory] &&
7680: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 \.. [st
7690: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 64 ring length $::d
76a0: 61 74 61 62 61 73 65 5f 64 69 72 65 63 74 6f 72 atabase_director
76b0: 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a y] > 0} then {..
76c0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
76d0: 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c # NOTE: The l
76e0: 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 64 ocation of the d
76f0: 61 74 61 62 61 73 65 20 64 69 72 65 63 74 6f 72 atabase director
7700: 79 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 y has been overr
7710: 69 64 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 idden;..
7720: 23 20 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 # therefor
7730: 65 2c 20 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 e, use it...
7740: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
7750: 65 74 75 72 6e 20 24 3a 3a 64 61 74 61 62 61 73 eturn $::databas
7760: 65 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 e_directory..
7770: 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e } elseif {[in
7780: 66 6f 20 65 78 69 73 74 73 20 3a 3a 73 63 72 61 fo exists ::scra
7790: 74 63 68 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 tch_directory] &
77a0: 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b & \.. [
77b0: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a string length $:
77c0: 3a 73 63 72 61 74 63 68 5f 64 69 72 65 63 74 6f :scratch_directo
77d0: 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d ry] > 0} then {.
77e0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
77f0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 # NOTE: The
7800: 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 location of the
7810: 73 63 72 61 74 63 68 20 64 69 72 65 63 74 6f 72 scratch director
7820: 79 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 y has been overr
7830: 69 64 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 idden;..
7840: 23 20 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 # therefor
7850: 65 2c 20 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 e, use it...
7860: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
7870: 65 74 75 72 6e 20 24 3a 3a 73 63 72 61 74 63 68 eturn $::scratch
7880: 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 _directory..
7890: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
78a0: 20 20 20 20 72 65 74 75 72 6e 20 5b 67 65 74 54 return [getT
78b0: 65 6d 70 6f 72 61 72 79 50 61 74 68 5d 0d 0a 20 emporaryPath]..
78c0: 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
78d0: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 54 65 .. proc getTe
78e0: 6d 70 6f 72 61 72 79 44 69 72 65 63 74 6f 72 79 mporaryDirectory
78f0: 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a {} {.. #..
7900: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 # NOTE: Th
7910: 69 73 20 70 72 6f 63 65 64 75 72 65 20 72 65 74 is procedure ret
7920: 75 72 6e 73 20 74 68 65 20 64 69 72 65 63 74 6f urns the directo
7930: 72 79 20 77 68 65 72 65 20 74 68 65 20 74 65 6d ry where the tem
7940: 70 6f 72 61 72 79 20 66 69 6c 65 73 0d 0a 20 20 porary files..
7950: 20 20 20 20 23 20 20 20 20 20 20 20 73 68 6f 75 # shou
7960: 6c 64 20 62 65 20 6c 6f 63 61 74 65 64 2e 20 20 ld be located.
7970: 42 79 20 64 65 66 61 75 6c 74 2c 20 74 68 69 73 By default, this
7980: 20 6a 75 73 74 20 75 73 65 73 20 74 68 65 20 74 just uses the t
7990: 65 6d 70 6f 72 61 72 79 0d 0a 20 20 20 20 20 20 emporary..
79a0: 23 20 20 20 20 20 20 20 64 69 72 65 63 74 6f 72 # director
79b0: 79 20 63 6f 6e 66 69 67 75 72 65 64 20 66 6f 72 y configured for
79c0: 20 74 68 69 73 20 73 79 73 74 65 6d 2e 0d 0a 20 this system...
79d0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
79e0: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {[info exists :
79f0: 3a 74 65 6d 70 6f 72 61 72 79 5f 64 69 72 65 63 :temporary_direc
7a00: 74 6f 72 79 5d 20 26 26 20 5c 0d 0a 20 20 20 20 tory] && \..
7a10: 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 [string le
7a20: 6e 67 74 68 20 24 3a 3a 74 65 6d 70 6f 72 61 72 ngth $::temporar
7a30: 79 5f 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 30 y_directory] > 0
7a40: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
7a50: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
7a60: 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 74 69 6f OTE: The locatio
7a70: 6e 20 6f 66 20 74 68 65 20 74 65 6d 70 6f 72 61 n of the tempora
7a80: 72 79 20 64 69 72 65 63 74 6f 72 79 20 68 61 73 ry directory has
7a90: 20 62 65 65 6e 20 6f 76 65 72 72 69 64 64 65 6e been overridden
7aa0: 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 ;.. #
7ab0: 20 20 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 therefore, us
7ac0: 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 e it... #
7ad0: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
7ae0: 20 24 3a 3a 74 65 6d 70 6f 72 61 72 79 5f 64 69 $::temporary_di
7af0: 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d rectory.. }
7b00: 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 elseif {[info e
7b10: 78 69 73 74 73 20 3a 3a 73 63 72 61 74 63 68 5f xists ::scratch_
7b20: 64 69 72 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d directory] && \.
7b30: 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 . [stri
7b40: 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 73 63 72 ng length $::scr
7b50: 61 74 63 68 5f 64 69 72 65 63 74 6f 72 79 5d 20 atch_directory]
7b60: 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
7b70: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
7b80: 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 # NOTE: The loca
7b90: 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 63 72 61 tion of the scra
7ba0: 74 63 68 20 64 69 72 65 63 74 6f 72 79 20 68 61 tch directory ha
7bb0: 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 64 65 s been overridde
7bc0: 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 n;.. #
7bd0: 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c 20 75 therefore, u
7be0: 73 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 se it...
7bf0: 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 #.. retur
7c00: 6e 20 24 3a 3a 73 63 72 61 74 63 68 5f 64 69 72 n $::scratch_dir
7c10: 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 ectory.. }
7c20: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
7c30: 72 65 74 75 72 6e 20 5b 67 65 74 54 65 6d 70 6f return [getTempo
7c40: 72 61 72 79 50 61 74 68 5d 0d 0a 20 20 20 20 20 raryPath]..
7c50: 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
7c60: 20 20 70 72 6f 63 20 67 65 74 45 78 65 63 75 74 proc getExecut
7c70: 65 4f 6e 53 65 74 75 70 20 7b 7d 20 7b 0d 0a 20 eOnSetup {} {..
7c80: 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 if {[info e
7c90: 78 69 73 74 73 20 3a 3a 65 78 65 63 75 74 65 5f xists ::execute_
7ca0: 6f 6e 5f 73 65 74 75 70 5d 20 26 26 20 5c 0d 0a on_setup] && \..
7cb0: 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
7cc0: 67 20 6c 65 6e 67 74 68 20 24 3a 3a 65 78 65 63 g length $::exec
7cd0: 75 74 65 5f 6f 6e 5f 73 65 74 75 70 5d 20 3e 20 ute_on_setup] >
7ce0: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
7cf0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
7d00: 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 74 68 65 NOTE: Return the
7d10: 20 63 6f 6e 66 69 67 75 72 65 64 20 53 51 4c 20 configured SQL
7d20: 74 6f 20 65 78 65 63 75 74 65 20 64 75 72 69 6e to execute durin
7d30: 67 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e g the connection
7d40: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
7d50: 20 20 73 65 74 75 70 20 70 72 6f 63 65 64 75 72 setup procedur
7d60: 65 20 28 69 2e 65 2e 20 66 6f 72 20 65 76 65 72 e (i.e. for ever
7d70: 79 20 74 65 73 74 20 64 61 74 61 62 61 73 65 20 y test database
7d80: 63 6f 6e 6e 65 63 74 69 6f 6e 29 2e 0d 0a 20 20 connection)...
7d90: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
7da0: 20 72 65 74 75 72 6e 20 24 3a 3a 65 78 65 63 75 return $::execu
7db0: 74 65 5f 6f 6e 5f 73 65 74 75 70 0d 0a 20 20 20 te_on_setup..
7dc0: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
7dd0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
7de0: 23 20 4e 4f 54 45 3a 20 42 79 20 64 65 66 61 75 # NOTE: By defau
7df0: 6c 74 2c 20 74 68 65 72 65 20 69 73 20 6e 6f 20 lt, there is no
7e00: 53 51 4c 20 74 6f 20 65 78 65 63 75 74 65 20 64 SQL to execute d
7e10: 75 72 69 6e 67 20 74 68 65 20 63 6f 6e 6e 65 63 uring the connec
7e20: 74 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 23 20 tion.. #
7e30: 20 20 20 20 20 20 73 65 74 75 70 20 70 72 6f 63 setup proc
7e40: 65 64 75 72 65 20 28 69 2e 65 2e 20 66 6f 72 20 edure (i.e. for
7e50: 65 76 65 72 79 20 74 65 73 74 20 64 61 74 61 62 every test datab
7e60: 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 29 2e ase connection).
7e70: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
7e80: 20 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a return ""..
7e90: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
7ea0: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 54 ... proc getT
7eb0: 65 73 74 4f 76 65 72 72 69 64 65 73 50 72 65 61 estOverridesPrea
7ec0: 6d 62 6c 65 20 7b 20 7b 65 78 74 72 61 56 61 72 mble { {extraVar
7ed0: 4e 61 6d 65 73 20 22 22 7d 20 7d 20 7b 0d 0a 20 Names ""} } {..
7ee0: 20 20 20 20 20 73 65 74 20 76 61 72 4e 61 6d 65 set varName
7ef0: 73 20 5b 6c 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 s [list]....
7f00: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
7f10: 45 3a 20 49 66 20 61 76 61 69 6c 61 62 6c 65 2c E: If available,
7f20: 20 73 74 61 72 74 20 77 69 74 68 20 74 68 65 20 start with the
7f30: 6d 61 73 74 65 72 20 6c 69 73 74 20 6f 66 20 74 master list of t
7f40: 65 73 74 20 6f 76 65 72 72 69 64 65 0d 0a 20 20 est override..
7f50: 20 20 20 20 23 20 20 20 20 20 20 20 76 61 72 69 # vari
7f60: 61 62 6c 65 73 2e 0d 0a 20 20 20 20 20 20 23 0d ables... #.
7f70: 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f . if {[info
7f80: 20 65 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 6f exists ::test_o
7f90: 76 65 72 72 69 64 65 73 5d 20 26 26 20 5c 0d 0a verrides] && \..
7fa0: 20 20 20 20 20 20 20 20 20 20 5b 6c 6c 65 6e 67 [lleng
7fb0: 74 68 20 24 3a 3a 74 65 73 74 5f 6f 76 65 72 72 th $::test_overr
7fc0: 69 64 65 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 ides] > 0} then
7fd0: 7b 0d 0a 20 20 20 20 20 20 20 20 65 76 61 6c 20 {.. eval
7fe0: 6c 61 70 70 65 6e 64 20 76 61 72 4e 61 6d 65 73 lappend varNames
7ff0: 20 24 3a 3a 74 65 73 74 5f 6f 76 65 72 72 69 64 $::test_overrid
8000: 65 73 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 es.. }....
8010: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
8020: 4e 4f 54 45 3a 20 49 66 20 72 65 71 75 65 73 74 NOTE: If request
8030: 65 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 ed by our caller
8040: 2c 20 61 64 64 20 61 6e 79 20 61 64 64 69 74 69 , add any additi
8050: 6f 6e 61 6c 20 76 61 72 69 61 62 6c 65 0d 0a 20 onal variable..
8060: 20 20 20 20 20 23 20 20 20 20 20 20 20 6e 61 6d # nam
8070: 65 73 20 74 6f 20 63 6f 70 79 20 6e 6f 77 2e 0d es to copy now..
8080: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
8090: 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 65 78 if {[llength $ex
80a0: 74 72 61 56 61 72 4e 61 6d 65 73 5d 20 3e 20 30 traVarNames] > 0
80b0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
80c0: 20 20 65 76 61 6c 20 6c 61 70 70 65 6e 64 20 76 eval lappend v
80d0: 61 72 4e 61 6d 65 73 20 24 65 78 74 72 61 56 61 arNames $extraVa
80e0: 72 4e 61 6d 65 73 0d 0a 20 20 20 20 20 20 7d 0d rNames.. }.
80f0: 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
8100: 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 # NOTE: Build
8110: 74 68 65 20 73 63 72 69 70 74 20 66 72 61 67 6d the script fragm
8120: 65 6e 74 20 74 6f 20 62 65 20 72 65 74 75 72 6e ent to be return
8130: 65 64 20 62 79 20 70 72 6f 63 65 73 73 69 6e 67 ed by processing
8140: 20 65 61 63 68 0d 0a 20 20 20 20 20 20 23 20 20 each.. #
8150: 20 20 20 20 20 76 61 72 69 61 62 6c 65 20 6e 61 variable na
8160: 6d 65 20 61 6e 64 20 61 64 64 69 6e 67 20 74 68 me and adding th
8170: 65 20 6e 65 63 65 63 65 73 73 61 72 79 20 73 63 e nececessary sc
8180: 72 69 70 74 20 66 72 61 67 6d 65 6e 74 73 20 66 ript fragments f
8190: 6f 72 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 or.. #
81a0: 20 20 65 61 63 68 20 6f 6e 65 2e 0d 0a 20 20 20 each one...
81b0: 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 #.. set
81c0: 72 65 73 75 6c 74 20 22 22 0d 0a 0d 0a 20 20 20 result ""....
81d0: 20 20 20 66 6f 72 65 61 63 68 20 76 61 72 4e 61 foreach varNa
81e0: 6d 65 20 24 76 61 72 4e 61 6d 65 73 20 7b 0d 0a me $varNames {..
81f0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
8200: 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 # NOTE: Build
8210: 20 74 68 65 20 71 75 61 6c 69 66 69 65 64 20 67 the qualified g
8220: 6c 6f 62 61 6c 20 76 61 72 69 61 62 6c 65 20 6e lobal variable n
8230: 61 6d 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ame... #.
8240: 0a 20 20 20 20 20 20 20 20 73 65 74 20 66 75 6c . set ful
8250: 6c 56 61 72 4e 61 6d 65 20 5b 61 70 70 65 6e 64 lVarName [append
8260: 41 72 67 73 20 3a 3a 20 24 76 61 72 4e 61 6d 65 Args :: $varName
8270: 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ].... #..
8280: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
8290: 44 6f 65 73 20 74 68 65 20 76 61 72 69 61 62 6c Does the variabl
82a0: 65 20 65 78 69 73 74 20 69 6e 20 74 68 69 73 20 e exist in this
82b0: 69 6e 74 65 72 70 72 65 74 65 72 20 63 6f 6e 74 interpreter cont
82c0: 65 78 74 3f 0d 0a 20 20 20 20 20 20 20 20 23 0d ext?.. #.
82d0: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e . if {[in
82e0: 66 6f 20 65 78 69 73 74 73 20 24 66 75 6c 6c 56 fo exists $fullV
82f0: 61 72 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d arName]} then {.
8300: 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
8310: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
8320: 41 70 70 65 6e 64 20 61 20 73 63 72 69 70 74 20 Append a script
8330: 66 72 61 67 6d 65 6e 74 20 74 6f 20 74 68 65 20 fragment to the
8340: 72 65 73 75 6c 74 20 74 68 61 74 20 77 69 6c 6c result that will
8350: 20 63 6f 72 72 65 63 74 6c 79 0d 0a 20 20 20 20 correctly..
8360: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
8370: 70 79 20 61 6e 79 20 63 6f 6e 74 61 69 6e 65 64 py any contained
8380: 20 76 61 6c 75 65 20 74 6f 20 61 6e 6f 74 68 65 value to anothe
8390: 72 20 69 6e 74 65 72 70 72 65 74 65 72 20 63 6f r interpreter co
83a0: 6e 74 65 78 74 2e 0d 0a 20 20 20 20 20 20 20 20 ntext...
83b0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 61 #.. a
83c0: 70 70 65 6e 64 20 72 65 73 75 6c 74 20 5c 6e 20 ppend result \n
83d0: 22 73 65 74 20 22 20 24 66 75 6c 6c 56 61 72 4e "set " $fullVarN
83e0: 61 6d 65 20 22 20 5c 7b 22 20 5b 73 65 74 20 24 ame " \{" [set $
83f0: 66 75 6c 6c 56 61 72 4e 61 6d 65 5d 20 5c 7d 0d fullVarName] \}.
8400: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
8410: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
8420: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 # NOTE: If
8430: 20 74 68 65 20 72 65 73 75 6c 74 20 63 6f 6e 74 the result cont
8440: 61 69 6e 73 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 ains one or more
8450: 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 script fragment
8460: 73 2c 20 61 70 70 65 6e 64 20 61 0d 0a 20 20 20 s, append a..
8470: 20 20 20 23 20 20 20 20 20 20 20 6e 65 77 6c 69 # newli
8480: 6e 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ne... #..
8490: 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
84a0: 6c 65 6e 67 74 68 20 24 72 65 73 75 6c 74 5d 20 length $result]
84b0: 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
84c0: 20 20 20 20 20 61 70 70 65 6e 64 20 72 65 73 75 append resu
84d0: 6c 74 20 5c 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a lt \n.. }..
84e0: 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 .. return $
84f0: 72 65 73 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c result.. }...
8500: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 41 70 .. proc getAp
8510: 70 44 6f 6d 61 69 6e 50 72 65 61 6d 62 6c 65 20 pDomainPreamble
8520: 7b 20 7b 70 72 65 66 69 78 20 22 22 7d 20 7b 73 { {prefix ""} {s
8530: 75 66 66 69 78 20 22 22 7d 20 7d 20 7b 0d 0a 20 uffix ""} } {..
8540: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
8550: 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f 63 65 NOTE: This proce
8560: 64 75 72 65 20 72 65 74 75 72 6e 73 20 61 20 74 dure returns a t
8570: 65 73 74 20 73 65 74 75 70 20 73 63 72 69 70 74 est setup script
8580: 20 66 72 61 67 6d 65 6e 74 20 73 75 69 74 61 62 fragment suitab
8590: 6c 65 20 66 6f 72 0d 0a 20 20 20 20 20 20 23 20 le for.. #
85a0: 20 20 20 20 20 20 65 76 61 6c 75 61 74 69 6f 6e evaluation
85b0: 20 62 79 20 61 6e 20 69 6e 74 65 72 70 72 65 74 by an interpret
85c0: 65 72 20 63 72 65 61 74 65 64 20 69 6e 20 61 6e er created in an
85d0: 20 69 73 6f 6c 61 74 65 64 20 61 70 70 6c 69 63 isolated applic
85e0: 61 74 69 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 ation.. #
85f0: 20 20 20 20 20 64 6f 6d 61 69 6e 2e 20 20 54 68 domain. Th
8600: 65 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e e script fragmen
8610: 74 20 62 65 69 6e 67 20 72 65 74 75 72 6e 65 64 t being returned
8620: 20 77 69 6c 6c 20 62 65 20 73 75 72 72 6f 75 6e will be surroun
8630: 64 65 64 20 62 79 0d 0a 20 20 20 20 20 20 23 20 ded by.. #
8640: 20 20 20 20 20 20 74 68 65 20 70 72 65 66 69 78 the prefix
8650: 20 61 6e 64 20 73 75 66 66 69 78 20 22 73 63 72 and suffix "scr
8660: 69 70 74 20 66 72 61 67 6d 65 6e 74 73 22 20 73 ipt fragments" s
8670: 70 65 63 69 66 69 65 64 20 62 79 20 6f 75 72 20 pecified by our
8680: 63 61 6c 6c 65 72 2c 0d 0a 20 20 20 20 20 20 23 caller,.. #
8690: 20 20 20 20 20 20 20 69 66 20 61 6e 79 2e 20 20 if any.
86a0: 54 68 65 20 65 6e 74 69 72 65 20 73 63 72 69 70 The entire scrip
86b0: 74 20 62 65 69 6e 67 20 72 65 74 75 72 6e 65 64 t being returned
86c0: 20 77 69 6c 6c 20 62 65 20 73 75 62 73 74 69 74 will be substit
86d0: 75 74 65 64 20 76 69 61 0d 0a 20 20 20 20 20 20 uted via..
86e0: 23 20 20 20 20 20 20 20 5b 73 75 62 73 74 5d 2c # [subst],
86f0: 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 20 in the context
8700: 6f 66 20 6f 75 72 20 63 61 6c 6c 65 72 2c 20 62 of our caller, b
8710: 65 66 6f 72 65 20 62 65 69 6e 67 20 72 65 74 75 efore being retu
8720: 72 6e 65 64 2e 0d 0a 20 20 20 20 20 20 23 20 20 rned... #
8730: 20 20 20 20 20 54 68 69 73 20 73 74 65 70 20 69 This step i
8740: 73 20 6e 65 63 65 73 73 61 72 79 20 73 6f 20 74 s necessary so t
8750: 68 61 74 20 73 6f 6d 65 20 6c 69 6d 69 74 65 64 hat some limited
8760: 20 63 6f 6e 74 65 78 74 20 69 6e 66 6f 72 6d 61 context informa
8770: 74 69 6f 6e 2c 0d 0a 20 20 20 20 20 20 23 20 20 tion,.. #
8780: 20 20 20 20 20 70 72 69 6d 61 72 69 6c 79 20 72 primarily r
8790: 65 6c 61 74 65 64 20 74 6f 20 74 68 65 20 74 65 elated to the te
87a0: 73 74 69 6e 67 20 64 69 72 65 63 74 6f 72 69 65 sting directorie
87b0: 73 2c 20 63 61 6e 20 62 65 20 74 72 61 6e 73 66 s, can be transf
87c0: 65 72 72 65 64 0d 0a 20 20 20 20 20 20 23 20 20 erred.. #
87d0: 20 20 20 20 20 74 6f 20 74 68 65 20 69 6e 74 65 to the inte
87e0: 72 70 72 65 74 65 72 20 69 6e 20 74 68 65 20 69 rpreter in the i
87f0: 73 6f 6c 61 74 65 64 20 61 70 70 6c 69 63 61 74 solated applicat
8800: 69 6f 6e 20 64 6f 6d 61 69 6e 2c 20 6d 61 6b 69 ion domain, maki
8810: 6e 67 20 69 74 0d 0a 20 20 20 20 20 20 23 20 20 ng it.. #
8820: 20 20 20 20 20 61 62 6c 65 20 74 6f 20 73 75 63 able to suc
8830: 63 65 73 73 66 75 6c 6c 79 20 72 75 6e 20 74 65 cessfully run te
8840: 73 74 73 20 74 68 61 74 20 72 65 71 75 69 72 65 sts that require
8850: 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 one or more of
8860: 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 the.. #
8870: 20 20 20 66 69 6c 65 73 20 69 6e 20 6f 6e 65 20 files in one
8880: 6f 66 20 74 68 65 20 74 65 73 74 69 6e 67 20 64 of the testing d
8890: 69 72 65 63 74 6f 72 69 65 73 2e 20 20 43 61 6c irectories. Cal
88a0: 6c 65 72 73 20 73 68 6f 75 6c 64 20 6b 65 65 70 lers should keep
88b0: 20 69 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 in.. #
88c0: 20 20 20 6d 69 6e 64 20 74 68 61 74 20 74 68 65 mind that the
88d0: 20 74 65 73 74 20 73 63 72 69 70 74 20 66 72 61 test script fra
88e0: 67 6d 65 6e 74 20 62 65 69 6e 67 20 72 65 74 75 gment being retu
88f0: 72 6e 65 64 20 63 61 6e 6e 6f 74 20 72 65 6c 79 rned cannot rely
8900: 20 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 on.. #
8910: 20 20 20 61 6e 79 20 73 63 72 69 70 74 20 6c 69 any script li
8920: 62 72 61 72 79 20 70 72 6f 63 65 64 75 72 65 73 brary procedures
8930: 20 74 68 61 74 20 61 72 65 20 6e 6f 74 20 70 72 that are not pr
8940: 6f 76 69 64 65 64 20 62 79 20 74 68 65 20 45 61 ovided by the Ea
8950: 67 6c 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 gle.. #
8960: 20 20 20 6c 69 62 72 61 72 79 20 70 61 63 6b 61 library packa
8970: 67 65 20 28 69 2e 65 2e 20 22 69 6e 69 74 2e 65 ge (i.e. "init.e
8980: 61 67 6c 65 22 29 2c 20 69 6e 63 6c 75 64 69 6e agle"), includin
8990: 67 20 74 68 6f 73 65 20 70 72 6f 76 69 64 65 64 g those provided
89a0: 20 62 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 by.. #
89b0: 20 20 20 74 68 65 20 45 61 67 6c 65 20 74 65 73 the Eagle tes
89c0: 74 20 70 61 63 6b 61 67 65 2c 20 75 6e 6c 65 73 t package, unles
89d0: 73 20 74 68 65 20 66 69 6c 65 20 63 6f 6e 74 61 s the file conta
89e0: 69 6e 69 6e 67 20 74 68 65 6d 20 69 73 20 6c 6f ining them is lo
89f0: 61 64 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 aded.. #
8a00: 20 20 20 20 6d 61 6e 75 61 6c 6c 79 20 76 69 61 manually via
8a10: 20 73 6f 6d 65 20 6f 74 68 65 72 20 6d 65 63 68 some other mech
8a20: 61 6e 69 73 6d 20 28 65 2e 67 2e 20 62 79 20 69 anism (e.g. by i
8a30: 6e 63 6c 75 64 69 6e 67 20 61 70 70 72 6f 70 72 ncluding appropr
8a40: 69 61 74 65 0d 0a 20 20 20 20 20 20 23 20 20 20 iate.. #
8a50: 20 20 20 20 5b 70 61 63 6b 61 67 65 20 72 65 71 [package req
8a60: 75 69 72 65 5d 20 6f 72 20 5b 73 6f 75 72 63 65 uire] or [source
8a70: 5d 20 63 6f 6d 6d 61 6e 64 73 20 69 6e 20 74 68 ] commands in th
8a80: 65 20 70 72 65 66 69 78 20 6f 72 20 73 75 66 66 e prefix or suff
8a90: 69 78 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ix.. #
8aa0: 20 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e script fragmen
8ab0: 74 73 29 2e 20 20 41 6c 73 6f 2c 20 61 6c 6c 20 ts). Also, all
8ac0: 76 61 72 69 61 62 6c 65 20 72 65 66 65 72 65 6e variable referen
8ad0: 63 65 73 20 61 6e 64 20 61 6c 6c 20 6e 65 73 74 ces and all nest
8ae0: 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ed.. #
8af0: 20 20 63 6f 6d 6d 61 6e 64 73 20 28 69 2e 65 2e commands (i.e.
8b00: 20 74 68 6f 73 65 20 69 6e 20 73 71 75 61 72 65 those in square
8b10: 20 62 72 61 63 6b 65 74 73 29 20 63 6f 6e 74 61 brackets) conta
8b20: 69 6e 65 64 20 69 6e 20 74 68 65 20 66 69 6e 61 ined in the fina
8b30: 6c 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 l.. #
8b40: 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 script fragment
8b50: 20 77 69 6c 6c 20 65 6e 64 20 75 70 20 62 65 69 will end up bei
8b60: 6e 67 20 65 76 61 6c 75 61 74 65 64 20 69 6e 20 ng evaluated in
8b70: 74 68 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 74 the context of t
8b80: 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 he.. #
8b90: 20 20 63 61 6c 6c 69 6e 67 20 69 6e 74 65 72 70 calling interp
8ba0: 72 65 74 65 72 20 61 6e 64 20 6e 6f 74 20 74 68 reter and not th
8bb0: 65 20 74 61 72 67 65 74 20 69 6e 74 65 72 70 72 e target interpr
8bc0: 65 74 65 72 20 63 72 65 61 74 65 64 20 69 6e 20 eter created in
8bd0: 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 the.. #
8be0: 20 20 20 69 73 6f 6c 61 74 65 64 20 61 70 70 6c isolated appl
8bf0: 69 63 61 74 69 6f 6e 20 64 6f 6d 61 69 6e 20 75 ication domain u
8c00: 6e 6c 65 73 73 20 74 68 65 20 64 6f 6c 6c 61 72 nless the dollar
8c10: 20 73 69 67 6e 73 20 61 6e 64 2f 6f 72 20 73 71 signs and/or sq
8c20: 75 61 72 65 0d 0a 20 20 20 20 20 20 23 20 20 20 uare.. #
8c30: 20 20 20 20 62 72 61 63 6b 65 74 73 20 61 72 65 brackets are
8c40: 20 73 70 65 63 69 61 6c 6c 79 20 71 75 6f 74 65 specially quote
8c50: 64 20 77 69 74 68 20 62 61 63 6b 73 6c 61 73 68 d with backslash
8c60: 65 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 es... #..
8c70: 20 20 20 20 72 65 74 75 72 6e 20 5b 75 70 6c 65 return [uple
8c80: 76 65 6c 20 31 20 5b 6c 69 73 74 20 73 75 62 73 vel 1 [list subs
8c90: 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 70 t [appendArgs $p
8ca0: 72 65 66 69 78 20 7b 0d 0a 20 20 20 20 20 20 20 refix {..
8cb0: 20 69 66 20 7b 5b 68 61 73 52 75 6e 74 69 6d 65 if {[hasRuntime
8cc0: 4f 70 74 69 6f 6e 20 6e 61 74 69 76 65 5d 7d 20 Option native]}
8cd0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
8ce0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
8cf0: 20 4e 4f 54 45 3a 20 54 68 65 20 5c 5b 6f 62 6a NOTE: The \[obj
8d00: 65 63 74 5c 5d 20 63 6f 6d 6d 61 6e 64 20 6d 61 ect\] command ma
8d10: 79 20 62 65 20 6d 69 73 73 69 6e 67 20 69 6e 20 y be missing in
8d20: 73 6f 6d 65 20 45 61 67 6c 65 20 63 6f 72 65 0d some Eagle core.
8d30: 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
8d40: 20 20 20 6c 69 62 72 61 72 79 20 63 6f 6e 66 69 library confi
8d50: 67 75 72 61 74 69 6f 6e 73 2e 20 20 49 6e 20 74 gurations. In t
8d60: 68 61 74 20 63 61 73 65 2c 20 77 65 20 63 61 6e hat case, we can
8d70: 6e 6f 74 20 63 6f 70 79 20 74 68 65 0d 0a 20 20 not copy the..
8d80: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
8d90: 22 6e 61 74 69 76 65 22 20 72 75 6e 74 69 6d 65 "native" runtime
8da0: 20 6f 70 74 69 6f 6e 2e 0d 0a 20 20 20 20 20 20 option...
8db0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
8dc0: 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 catch {..
8dd0: 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 object inv
8de0: 6f 6b 65 20 49 6e 74 65 72 70 72 65 74 65 72 2e oke Interpreter.
8df0: 47 65 74 41 63 74 69 76 65 20 41 64 64 52 75 6e GetActive AddRun
8e00: 74 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 69 76 timeOption nativ
8e10: 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a e.. }..
8e20: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
8e30: 20 7d 20 5b 67 65 74 54 65 73 74 4f 76 65 72 72 } [getTestOverr
8e40: 69 64 65 73 50 72 65 61 6d 62 6c 65 20 5b 6c 69 idesPreamble [li
8e50: 73 74 20 70 61 74 68 20 74 65 73 74 5f 63 68 61 st path test_cha
8e60: 6e 6e 65 6c 5d 5d 20 24 73 75 66 66 69 78 5d 5d nnel]] $suffix]]
8e70: 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 ].. }.....
8e80: 20 70 72 6f 63 20 74 72 79 43 6f 70 79 45 78 74 proc tryCopyExt
8e90: 65 72 6e 61 6c 46 69 6c 65 20 7b 0d 0a 20 20 20 ernalFile {..
8ea0: 20 20 20 20 20 20 20 20 20 66 69 6c 65 4e 61 6d fileNam
8eb0: 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d 20 e {platform ""}
8ec0: 7b 6e 65 77 46 69 6c 65 4e 61 6d 65 20 22 22 7d {newFileName ""}
8ed0: 20 7b 76 65 72 62 6f 73 65 20 66 61 6c 73 65 7d {verbose false}
8ee0: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 } {.. set
8ef0: 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 5b sourceFileName [
8f00: 67 65 74 45 78 74 65 72 6e 61 6c 46 69 6c 65 4e getExternalFileN
8f10: 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a ame $fileName]..
8f20: 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 66 69 .. if {![fi
8f30: 6c 65 20 65 78 69 73 74 73 20 24 73 6f 75 72 63 le exists $sourc
8f40: 65 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e eFileName]} then
8f50: 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
8f60: 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b $verbose} then {
8f70: 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
8f80: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
8f90: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
8fa0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
8fb0: 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 63 6f 70 ---- skipped cop
8fc0: 79 69 6e 67 20 65 78 74 65 72 6e 61 6c 20 66 69 ying external fi
8fd0: 6c 65 20 5c 22 22 20 24 73 6f 75 72 63 65 46 69 le \"" $sourceFi
8fe0: 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 leName \..
8ff0: 20 20 20 20 20 20 20 20 22 5c 22 2c 20 69 74 20 "\", it
9000: 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 5c 6e does not exist\n
9010: 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 "].. }..
9020: 20 20 20 20 20 20 20 72 65 74 75 72 6e 0d 0a 20 return..
9030: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
9040: 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
9050: 74 68 20 24 6e 65 77 46 69 6c 65 4e 61 6d 65 5d th $newFileName]
9060: 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
9070: 20 20 20 20 20 20 73 65 74 20 74 61 72 67 65 74 set target
9080: 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 69 6e FileName [getBin
9090: 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 6e 65 77 aryFileName $new
90a0: 46 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f FileName $platfo
90b0: 72 6d 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 rm].. } els
90c0: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 e {.. set
90d0: 20 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 targetFileName
90e0: 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 [getBinaryFileNa
90f0: 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c me $fileName $pl
9100: 61 74 66 6f 72 6d 5d 0d 0a 20 20 20 20 20 20 7d atform].. }
9110: 0d 0a 0d 0a 20 20 20 20 20 20 73 65 74 20 74 61 .... set ta
9120: 72 67 65 74 44 69 72 65 63 74 6f 72 79 20 5b 66 rgetDirectory [f
9130: 69 6c 65 20 64 69 72 6e 61 6d 65 20 24 74 61 72 ile dirname $tar
9140: 67 65 74 46 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a getFileName]....
9150: 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
9160: 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
9170: 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 74 ![file exists $t
9180: 61 72 67 65 74 44 69 72 65 63 74 6f 72 79 5d 7d argetDirectory]}
9190: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
91a0: 20 20 20 66 69 6c 65 20 6d 6b 64 69 72 20 24 74 file mkdir $t
91b0: 61 72 67 65 74 44 69 72 65 63 74 6f 72 79 0d 0a argetDirectory..
91c0: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
91d0: 20 20 20 66 69 6c 65 20 63 6f 70 79 20 2d 66 6f file copy -fo
91e0: 72 63 65 20 24 73 6f 75 72 63 65 46 69 6c 65 4e rce $sourceFileN
91f0: 61 6d 65 20 24 74 61 72 67 65 74 46 69 6c 65 4e ame $targetFileN
9200: 61 6d 65 0d 0a 20 20 20 20 20 20 7d 5d 20 3d 3d ame.. }] ==
9210: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
9220: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
9230: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
9240: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
9250: 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 69 65 "---- copie
9260: 64 20 65 78 74 65 72 6e 61 6c 20 66 69 6c 65 20 d external file
9270: 66 72 6f 6d 20 5c 22 22 20 24 73 6f 75 72 63 65 from \"" $source
9280: 46 69 6c 65 4e 61 6d 65 20 22 5c 22 20 74 6f 20 FileName "\" to
9290: 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 \"" \..
92a0: 20 20 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 $targetFileNa
92b0: 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 me \"\n]..
92c0: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
92d0: 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
92e0: 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
92f0: 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
9300: 20 20 20 22 2d 2d 2d 2d 20 66 61 69 6c 65 64 20 "---- failed
9310: 74 6f 20 63 6f 70 79 20 65 78 74 65 72 6e 61 6c to copy external
9320: 20 66 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 file from \"" $
9330: 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 5c sourceFileName \
9340: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 5c .. "\
9350: 22 20 74 6f 20 5c 22 22 20 24 74 61 72 67 65 74 " to \"" $target
9360: 46 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a FileName \"\n]..
9370: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
9380: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 79 43 ... proc tryC
9390: 6f 70 79 42 69 6e 61 72 79 46 69 6c 65 20 7b 0d opyBinaryFile {.
93a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 66 69 6c . fil
93b0: 65 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d 20 eName {platform
93c0: 22 22 7d 20 7b 6e 65 77 46 69 6c 65 4e 61 6d 65 ""} {newFileName
93d0: 20 22 22 7d 20 7b 76 65 72 62 6f 73 65 20 66 61 ""} {verbose fa
93e0: 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 lse} } {..
93f0: 73 65 74 20 73 6f 75 72 63 65 46 69 6c 65 4e 61 set sourceFileNa
9400: 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c me [getBinaryFil
9410: 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 eName $fileName
9420: 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 0d 0a 20 20 $platform]....
9430: 20 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 if {![file e
9440: 78 69 73 74 73 20 24 73 6f 75 72 63 65 46 69 6c xists $sourceFil
9450: 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a eName]} then {..
9460: 20 20 20 20 20 20 20 20 69 66 20 7b 24 76 65 72 if {$ver
9470: 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 bose} then {..
9480: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
9490: 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
94a0: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
94b0: 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
94c0: 20 73 6b 69 70 70 65 64 20 63 6f 70 79 69 6e 67 skipped copying
94d0: 20 62 69 6e 61 72 79 20 66 69 6c 65 20 5c 22 22 binary file \""
94e0: 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 $sourceFileName
94f0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
9500: 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e "\", it does n
9510: 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 ot exist\n"]..
9520: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
9530: 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 20 7d return.. }
9540: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 .... if {[s
9550: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e 65 tring length $ne
9560: 77 46 69 6c 65 4e 61 6d 65 5d 20 3e 20 30 7d 20 wFileName] > 0}
9570: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
9580: 73 65 74 20 74 61 72 67 65 74 46 69 6c 65 4e 61 set targetFileNa
9590: 6d 65 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 me [getBuildFile
95a0: 4e 61 6d 65 20 24 6e 65 77 46 69 6c 65 4e 61 6d Name $newFileNam
95b0: 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 e $platform]..
95c0: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
95d0: 20 20 20 20 20 20 73 65 74 20 74 61 72 67 65 74 set target
95e0: 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 75 69 FileName [getBui
95f0: 6c 64 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 ldFileName $file
9600: 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d Name $platform].
9610: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
9620: 20 20 73 65 74 20 74 61 72 67 65 74 44 69 72 65 set targetDire
9630: 63 74 6f 72 79 20 5b 66 69 6c 65 20 64 69 72 6e ctory [file dirn
9640: 61 6d 65 20 24 74 61 72 67 65 74 46 69 6c 65 4e ame $targetFileN
9650: 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 ame].... if
9660: 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
9670: 20 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 if {![file e
9680: 78 69 73 74 73 20 24 74 61 72 67 65 74 44 69 72 xists $targetDir
9690: 65 63 74 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d ectory]} then {.
96a0: 0a 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 20 . file
96b0: 6d 6b 64 69 72 20 24 74 61 72 67 65 74 44 69 72 mkdir $targetDir
96c0: 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 20 20 ectory..
96d0: 7d 0d 0a 20 20 20 20 20 20 20 20 66 69 6c 65 20 }.. file
96e0: 63 6f 70 79 20 2d 66 6f 72 63 65 20 24 73 6f 75 copy -force $sou
96f0: 72 63 65 46 69 6c 65 4e 61 6d 65 20 24 74 61 72 rceFileName $tar
9700: 67 65 74 46 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 getFileName..
9710: 20 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e }] == 0} then
9720: 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 {.. tput
9730: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
9740: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
9750: 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d . "--
9760: 2d 2d 20 63 6f 70 69 65 64 20 62 69 6e 61 72 79 -- copied binary
9770: 20 66 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 file from \"" $
9780: 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 22 sourceFileName "
9790: 5c 22 20 74 6f 20 5c 22 22 20 5c 0d 0a 20 20 20 \" to \"" \..
97a0: 20 20 20 20 20 20 20 20 20 24 74 61 72 67 65 74 $target
97b0: 46 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a FileName \"\n]..
97c0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
97d0: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
97e0: 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
97f0: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
9800: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 "---- f
9810: 61 69 6c 65 64 20 74 6f 20 63 6f 70 79 20 62 69 ailed to copy bi
9820: 6e 61 72 79 20 66 69 6c 65 20 66 72 6f 6d 20 5c nary file from \
9830: 22 22 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 "" $sourceFileNa
9840: 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 me \..
9850: 20 20 22 5c 22 20 74 6f 20 5c 22 22 20 24 74 61 "\" to \"" $ta
9860: 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5c 22 5c rgetFileName \"\
9870: 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 n].. }..
9880: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
9890: 74 72 79 43 6f 70 79 42 75 69 6c 64 46 69 6c 65 tryCopyBuildFile
98a0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
98b0: 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 6f fileName {platfo
98c0: 72 6d 20 22 22 7d 20 7b 6e 65 77 46 69 6c 65 4e rm ""} {newFileN
98d0: 61 6d 65 20 22 22 7d 20 7b 76 65 72 62 6f 73 65 ame ""} {verbose
98e0: 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 false} } {..
98f0: 20 20 20 73 65 74 20 73 6f 75 72 63 65 46 69 6c set sourceFil
9900: 65 4e 61 6d 65 20 5b 67 65 74 42 75 69 6c 64 46 eName [getBuildF
9910: 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d ileName $fileNam
9920: 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 0d 0a e $platform]....
9930: 20 20 20 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 if {![file
9940: 20 65 78 69 73 74 73 20 24 73 6f 75 72 63 65 46 exists $sourceF
9950: 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b ileName]} then {
9960: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 24 76 .. if {$v
9970: 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a erbose} then {..
9980: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
9990: 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
99a0: 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
99b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
99c0: 2d 2d 20 73 6b 69 70 70 65 64 20 63 6f 70 79 69 -- skipped copyi
99d0: 6e 67 20 62 75 69 6c 64 20 66 69 6c 65 20 5c 22 ng build file \"
99e0: 22 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d " $sourceFileNam
99f0: 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
9a00: 20 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 "\", it does
9a10: 6e 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 not exist\n"]..
9a20: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
9a30: 20 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 20 return..
9a40: 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b }.... if {[
9a50: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e string length $n
9a60: 65 77 46 69 6c 65 4e 61 6d 65 5d 20 3e 20 30 7d ewFileName] > 0}
9a70: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
9a80: 20 73 65 74 20 74 61 72 67 65 74 46 69 6c 65 4e set targetFileN
9a90: 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 46 69 ame [getBinaryFi
9aa0: 6c 65 4e 61 6d 65 20 24 6e 65 77 46 69 6c 65 4e leName $newFileN
9ab0: 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a ame $platform]..
9ac0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
9ad0: 20 20 20 20 20 20 20 20 73 65 74 20 74 61 72 67 set targ
9ae0: 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 etFileName [getB
9af0: 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 inaryFileName $f
9b00: 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 ileName $platfor
9b10: 6d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 m].. }....
9b20: 20 20 20 20 20 73 65 74 20 74 61 72 67 65 74 44 set targetD
9b30: 69 72 65 63 74 6f 72 79 20 5b 66 69 6c 65 20 64 irectory [file d
9b40: 69 72 6e 61 6d 65 20 24 74 61 72 67 65 74 46 69 irname $targetFi
9b50: 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 leName]....
9b60: 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
9b70: 20 20 20 20 20 20 20 69 66 20 7b 21 5b 66 69 6c if {![fil
9b80: 65 20 65 78 69 73 74 73 20 24 74 61 72 67 65 74 e exists $target
9b90: 44 69 72 65 63 74 6f 72 79 5d 7d 20 74 68 65 6e Directory]} then
9ba0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 69 {.. fi
9bb0: 6c 65 20 6d 6b 64 69 72 20 24 74 61 72 67 65 74 le mkdir $target
9bc0: 44 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 Directory..
9bd0: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 66 69 }.. fi
9be0: 6c 65 20 63 6f 70 79 20 2d 66 6f 72 63 65 20 24 le copy -force $
9bf0: 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 24 sourceFileName $
9c00: 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 0d 0a targetFileName..
9c10: 20 20 20 20 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 }] == 0} t
9c20: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 hen {.. t
9c30: 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
9c40: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
9c50: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
9c60: 22 2d 2d 2d 2d 20 63 6f 70 69 65 64 20 62 75 69 "---- copied bui
9c70: 6c 64 20 66 69 6c 65 20 66 72 6f 6d 20 5c 22 22 ld file from \""
9c80: 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 $sourceFileName
9c90: 20 22 5c 22 20 74 6f 20 5c 22 22 20 5c 0d 0a 20 "\" to \"" \..
9ca0: 20 20 20 20 20 20 20 20 20 20 20 24 74 61 72 67 $targ
9cb0: 65 74 46 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d etFileName \"\n]
9cc0: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
9cd0: 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
9ce0: 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
9cf0: 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
9d00: 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
9d10: 20 66 61 69 6c 65 64 20 74 6f 20 63 6f 70 79 20 failed to copy
9d20: 62 75 69 6c 64 20 66 69 6c 65 20 66 72 6f 6d 20 build file from
9d30: 5c 22 22 20 24 73 6f 75 72 63 65 46 69 6c 65 4e \"" $sourceFileN
9d40: 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ame \..
9d50: 20 20 20 22 5c 22 20 74 6f 20 5c 22 22 20 24 74 "\" to \"" $t
9d60: 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5c 22 argetFileName \"
9d70: 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 \n].. }..
9d80: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
9d90: 20 74 72 79 44 65 6c 65 74 65 42 69 6e 61 72 79 tryDeleteBinary
9da0: 46 69 6c 65 20 7b 20 66 69 6c 65 4e 61 6d 65 20 File { fileName
9db0: 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7b 76 {platform ""} {v
9dc0: 65 72 62 6f 73 65 20 66 61 6c 73 65 7d 20 7d 20 erbose false} }
9dd0: 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 66 69 6c {.. set fil
9de0: 65 4e 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 eName [getBinary
9df0: 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 FileName $fileNa
9e00: 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 0d me $platform]...
9e10: 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 66 69 6c . if {![fil
9e20: 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 e exists $fileNa
9e30: 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 me]} then {..
9e40: 20 20 20 20 20 69 66 20 7b 24 76 65 72 62 6f 73 if {$verbos
9e50: 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 e} then {..
9e60: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
9e70: 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
9e80: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
9e90: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6b "---- sk
9ea0: 69 70 70 65 64 20 64 65 6c 65 74 69 6e 67 20 62 ipped deleting b
9eb0: 69 6e 61 72 79 20 66 69 6c 65 20 5c 22 22 20 24 inary file \"" $
9ec0: 66 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 fileName \..
9ed0: 20 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 69 "\", i
9ee0: 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 t does not exist
9ef0: 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d \n"].. }.
9f00: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 0d . return.
9f10: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
9f20: 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 66 69 if {[catch {fi
9f30: 6c 65 20 64 65 6c 65 74 65 20 24 66 69 6c 65 4e le delete $fileN
9f40: 61 6d 65 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e ame}] == 0} then
9f50: 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 {.. tput
9f60: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
9f70: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
9f80: 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d . "--
9f90: 2d 2d 20 64 65 6c 65 74 65 64 20 62 69 6e 61 72 -- deleted binar
9fa0: 79 20 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 y file \"" $file
9fb0: 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 Name \"\n]..
9fc0: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
9fd0: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
9fe0: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
9ff0: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
a000: 20 20 20 20 20 22 2d 2d 2d 2d 20 66 61 69 6c 65 "---- faile
a010: 64 20 74 6f 20 64 65 6c 65 74 65 20 62 69 6e 61 d to delete bina
a020: 72 79 20 66 69 6c 65 20 5c 22 22 20 24 66 69 6c ry file \"" $fil
a030: 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 eName \"\n]..
a040: 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
a050: 20 20 20 20 70 72 6f 63 20 74 72 79 44 65 6c 65 proc tryDele
a060: 74 65 42 75 69 6c 64 46 69 6c 65 20 7b 20 66 69 teBuildFile { fi
a070: 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d leName {platform
a080: 20 22 22 7d 20 7b 76 65 72 62 6f 73 65 20 66 61 ""} {verbose fa
a090: 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 lse} } {..
a0a0: 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 67 65 set fileName [ge
a0b0: 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 24 tBuildFileName $
a0c0: 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f fileName $platfo
a0d0: 72 6d 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 rm].... if
a0e0: 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {![file exists $
a0f0: 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 fileName]} then
a100: 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 24 {.. if {$
a110: 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d verbose} then {.
a120: 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
a130: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
a140: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
a150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
a160: 2d 2d 2d 20 73 6b 69 70 70 65 64 20 64 65 6c 65 --- skipped dele
a170: 74 69 6e 67 20 62 75 69 6c 64 20 66 69 6c 65 20 ting build file
a180: 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 0d \"" $fileName \.
a190: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
a1a0: 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 \", it does not
a1b0: 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 exist\n"]..
a1c0: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 72 65 }.. re
a1d0: 74 75 72 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d turn.. }...
a1e0: 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 . if {[catc
a1f0: 68 20 7b 66 69 6c 65 20 64 65 6c 65 74 65 20 24 h {file delete $
a200: 66 69 6c 65 4e 61 6d 65 7d 5d 20 3d 3d 20 30 7d fileName}] == 0}
a210: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
a220: 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
a230: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
a240: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
a250: 20 20 22 2d 2d 2d 2d 20 64 65 6c 65 74 65 64 20 "---- deleted
a260: 62 75 69 6c 64 20 66 69 6c 65 20 5c 22 22 20 24 build file \"" $
a270: 66 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a fileName \"\n]..
a280: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
a290: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
a2a0: 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
a2b0: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
a2c0: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 "---- f
a2d0: 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20 ailed to delete
a2e0: 62 75 69 6c 64 20 66 69 6c 65 20 5c 22 22 20 24 build file \"" $
a2f0: 66 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a fileName \"\n]..
a300: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
a310: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 79 43 ... proc tryC
a320: 6f 70 79 41 73 73 65 6d 62 6c 79 20 7b 0d 0a 20 opyAssembly {..
a330: 20 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 4e fileN
a340: 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 ame {platform ""
a350: 7d 20 7b 70 64 62 20 74 72 75 65 7d 20 7b 76 65 } {pdb true} {ve
a360: 72 62 6f 73 65 20 66 61 6c 73 65 7d 20 7d 20 7b rbose false} } {
a370: 0d 0a 20 20 20 20 20 20 74 72 79 43 6f 70 79 42 .. tryCopyB
a380: 75 69 6c 64 46 69 6c 65 20 24 66 69 6c 65 4e 61 uildFile $fileNa
a390: 6d 65 20 24 70 6c 61 74 66 6f 72 6d 20 22 22 20 me $platform ""
a3a0: 24 76 65 72 62 6f 73 65 0d 0a 0d 0a 20 20 20 20 $verbose....
a3b0: 20 20 69 66 20 7b 24 70 64 62 7d 20 74 68 65 6e if {$pdb} then
a3c0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 72 79 43 {.. tryC
a3d0: 6f 70 79 42 75 69 6c 64 46 69 6c 65 20 5b 61 70 opyBuildFile [ap
a3e0: 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
a3f0: 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 72 6f [file ro
a400: 6f 74 6e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 otname $fileName
a410: 5d 20 2e 70 64 62 5d 20 24 70 6c 61 74 66 6f 72 ] .pdb] $platfor
a420: 6d 20 22 22 20 24 76 65 72 62 6f 73 65 0d 0a 20 m "" $verbose..
a430: 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
a440: 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 79 44 65 .. proc tryDe
a450: 6c 65 74 65 41 73 73 65 6d 62 6c 79 20 7b 0d 0a leteAssembly {..
a460: 20 20 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 file
a470: 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 Name {platform "
a480: 22 7d 20 7b 70 64 62 20 74 72 75 65 7d 20 7b 76 "} {pdb true} {v
a490: 65 72 62 6f 73 65 20 66 61 6c 73 65 7d 20 7d 20 erbose false} }
a4a0: 7b 0d 0a 20 20 20 20 20 20 74 72 79 44 65 6c 65 {.. tryDele
a4b0: 74 65 42 69 6e 61 72 79 46 69 6c 65 20 24 66 69 teBinaryFile $fi
a4c0: 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d leName $platform
a4d0: 20 24 76 65 72 62 6f 73 65 0d 0a 0d 0a 20 20 20 $verbose....
a4e0: 20 20 20 69 66 20 7b 24 70 64 62 7d 20 74 68 65 if {$pdb} the
a4f0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 72 79 n {.. try
a500: 44 65 6c 65 74 65 42 69 6e 61 72 79 46 69 6c 65 DeleteBinaryFile
a510: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
a520: 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c [fil
a530: 65 20 72 6f 6f 74 6e 61 6d 65 20 24 66 69 6c 65 e rootname $file
a540: 4e 61 6d 65 5d 20 2e 70 64 62 5d 20 24 70 6c 61 Name] .pdb] $pla
a550: 74 66 6f 72 6d 20 24 76 65 72 62 6f 73 65 0d 0a tform $verbose..
a560: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
a570: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 79 4c ... proc tryL
a580: 6f 61 64 41 73 73 65 6d 62 6c 79 20 7b 20 66 69 oadAssembly { fi
a590: 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d leName {platform
a5a0: 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 ""} } {..
a5b0: 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 67 65 set fileName [ge
a5c0: 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 tBinaryFileName
a5d0: 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 $fileName $platf
a5e0: 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 orm].... if
a5f0: 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
a600: 20 20 20 20 73 65 74 20 61 73 73 65 6d 62 6c 79 set assembly
a610: 20 5b 6f 62 6a 65 63 74 20 6c 6f 61 64 20 2d 6c [object load -l
a620: 6f 61 64 74 79 70 65 20 46 69 6c 65 20 2d 61 6c oadtype File -al
a630: 69 61 73 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a ias $fileName]..
a640: 20 20 20 20 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 }] == 0} t
a650: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
a660: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
a670: 3a 20 4e 6f 77 2c 20 61 64 64 20 74 68 65 20 6e : Now, add the n
a680: 65 63 65 73 73 61 72 79 20 74 65 73 74 20 63 6f ecessary test co
a690: 6e 73 74 72 61 69 6e 74 2e 0d 0a 20 20 20 20 20 nstraint...
a6a0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 61 64 #.. ad
a6b0: 64 43 6f 6e 73 74 72 61 69 6e 74 20 5b 66 69 6c dConstraint [fil
a6c0: 65 20 72 6f 6f 74 6e 61 6d 65 20 5b 66 69 6c 65 e rootname [file
a6d0: 20 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d 65 5d tail $fileName]
a6e0: 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ].... #..
a6f0: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
a700: 47 72 61 62 20 74 68 65 20 69 6d 61 67 65 20 72 Grab the image r
a710: 75 6e 74 69 6d 65 20 76 65 72 73 69 6f 6e 20 66 untime version f
a720: 72 6f 6d 20 74 68 65 20 61 73 73 65 6d 62 6c 79 rom the assembly
a730: 20 62 65 63 61 75 73 65 0d 0a 20 20 20 20 20 20 because..
a740: 20 20 23 20 20 20 20 20 20 20 73 65 76 65 72 61 # severa
a750: 6c 20 74 65 73 74 73 20 72 65 6c 79 20 6f 6e 20 l tests rely on
a760: 69 74 20 68 61 76 69 6e 67 20 61 20 63 65 72 74 it having a cert
a770: 61 69 6e 20 76 61 6c 75 65 2e 0d 0a 20 20 20 20 ain value...
a780: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 61 #.. a
a790: 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 ddConstraint [ap
a7a0: 70 65 6e 64 41 72 67 73 20 5b 66 69 6c 65 20 74 pendArgs [file t
a7b0: 61 69 6c 20 24 66 69 6c 65 4e 61 6d 65 5d 20 5f ail $fileName] _
a7c0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
a7d0: 5b 24 61 73 73 65 6d 62 6c 79 20 49 6d 61 67 65 [$assembly Image
a7e0: 52 75 6e 74 69 6d 65 56 65 72 73 69 6f 6e 5d 5d RuntimeVersion]]
a7f0: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
a800: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 # NOTE: R
a810: 65 74 75 72 6e 20 74 68 65 20 66 75 6c 6c 20 70 eturn the full p
a820: 61 74 68 20 6f 66 20 74 68 65 20 6c 6f 61 64 65 ath of the loade
a830: 64 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 20 d file...
a840: 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 #.. retu
a850: 72 6e 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 rn $fileName..
a860: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 }.... r
a870: 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 7d 0d eturn "".. }.
a880: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 69 73 53 .... proc isS
a890: 51 4c 69 74 65 52 65 61 64 79 20 7b 7d 20 7b 0d QLiteReady {} {.
a8a0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
a8b0: 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f # NOTE: This pro
a8c0: 63 65 64 75 72 65 20 6d 75 73 74 20 72 65 74 75 cedure must retu
a8d0: 72 6e 20 6e 6f 6e 2d 7a 65 72 6f 20 6f 6e 6c 79 rn non-zero only
a8e0: 20 69 66 20 74 68 65 20 53 51 4c 69 74 65 20 6e if the SQLite n
a8f0: 61 74 69 76 65 0d 0a 20 20 20 20 20 20 23 20 20 ative.. #
a900: 20 20 20 20 20 6c 69 62 72 61 72 79 20 61 6e 64 library and
a910: 20 74 68 65 20 53 79 73 74 65 6d 2e 44 61 74 61 the System.Data
a920: 2e 53 51 4c 69 74 65 20 6d 61 6e 61 67 65 64 20 .SQLite managed
a930: 61 73 73 65 6d 62 6c 79 20 61 72 65 20 6c 6f 61 assembly are loa
a940: 64 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ded.. #
a950: 20 20 20 61 6e 64 20 72 65 61 64 79 20 66 6f 72 and ready for
a960: 20 75 73 65 20 62 79 20 74 68 65 20 74 65 73 74 use by the test
a970: 20 73 75 69 74 65 2e 20 20 43 75 72 72 65 6e 74 suite. Current
a980: 6c 79 2c 20 74 68 69 73 20 70 72 6f 63 65 64 75 ly, this procedu
a990: 72 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 re.. #
a9a0: 20 20 73 68 6f 75 6c 64 20 62 65 20 63 61 6c 6c should be call
a9b0: 65 64 20 6f 6e 6c 79 20 61 66 74 65 72 20 74 68 ed only after th
a9c0: 65 20 5b 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 e [tryLoadAssemb
a9d0: 6c 79 5d 20 70 72 6f 63 65 64 75 72 65 20 68 61 ly] procedure ha
a9e0: 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 s.. #
a9f0: 20 62 65 65 6e 20 63 61 6c 6c 65 64 20 74 6f 20 been called to
aa00: 70 72 6f 62 65 20 66 6f 72 20 74 68 65 20 53 79 probe for the Sy
aa10: 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
aa20: 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c managed assembl
aa30: 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 y.. #
aa40: 20 61 6e 64 20 74 68 65 20 5b 63 68 65 63 6b 46 and the [checkF
aa50: 6f 72 53 51 4c 69 74 65 5d 20 70 72 6f 63 65 64 orSQLite] proced
aa60: 75 72 65 20 68 61 73 20 62 65 65 6e 20 63 61 6c ure has been cal
aa70: 6c 65 64 20 74 6f 20 70 72 6f 62 65 20 66 6f 72 led to probe for
aa80: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
aa90: 74 68 65 20 53 51 4c 69 74 65 20 6e 61 74 69 76 the SQLite nativ
aaa0: 65 20 6c 69 62 72 61 72 79 3b 20 6f 74 68 65 72 e library; other
aab0: 77 69 73 65 2c 20 74 68 69 73 20 70 72 6f 63 65 wise, this proce
aac0: 64 75 72 65 20 77 69 6c 6c 20 73 69 6d 70 6c 79 dure will simply
aad0: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
aae0: 61 6c 77 61 79 73 20 72 65 74 75 72 6e 20 7a 65 always return ze
aaf0: 72 6f 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ro... #..
ab00: 20 20 20 20 72 65 74 75 72 6e 20 5b 65 78 70 72 return [expr
ab10: 20 7b 0d 0a 20 20 20 20 20 20 20 20 5b 68 61 76 {.. [hav
ab20: 65 43 6f 6e 73 74 72 61 69 6e 74 20 53 79 73 74 eConstraint Syst
ab30: 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 5d 20 em.Data.SQLite]
ab40: 26 26 20 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 && [haveConstrai
ab50: 6e 74 20 53 51 4c 69 74 65 5d 0d 0a 20 20 20 20 nt SQLite]..
ab60: 20 20 7d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }].. }.....
ab70: 20 20 20 20 70 72 6f 63 20 6d 61 74 63 68 4d 61 proc matchMa
ab80: 63 68 69 6e 65 20 7b 20 70 6c 61 74 66 6f 72 6d chine { platform
ab90: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
aba0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 6e 20 # NOTE: An
abb0: 65 6d 70 74 79 20 73 74 72 69 6e 67 20 66 6f 72 empty string for
abc0: 20 74 68 65 20 70 6c 61 74 66 6f 72 6d 20 6d 65 the platform me
abd0: 61 6e 73 20 74 68 61 74 20 74 68 65 20 62 75 69 ans that the bui
abe0: 6c 64 20 69 73 20 6e 6f 74 0d 0a 20 20 20 20 20 ld is not..
abf0: 20 23 20 20 20 20 20 20 20 5b 70 72 69 6d 61 72 # [primar
ac00: 69 6c 79 5d 20 61 20 6e 61 74 69 76 65 20 62 75 ily] a native bu
ac10: 69 6c 64 3b 20 74 68 65 72 65 66 6f 72 65 2c 20 ild; therefore,
ac20: 69 74 20 61 6c 77 61 79 73 20 6d 61 74 63 68 65 it always matche
ac30: 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 s... #..
ac40: 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c if {[string l
ac50: 65 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d ength $platform]
ac60: 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
ac70: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
ac80: 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 ue.. }....
ac90: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
aca0: 4e 4f 54 45 3a 20 44 6f 65 73 20 74 68 65 20 73 NOTE: Does the s
acb0: 70 65 63 69 66 69 65 64 20 70 6c 61 74 66 6f 72 pecified platfor
acc0: 6d 20 6d 61 74 63 68 20 75 70 20 74 6f 20 74 68 m match up to th
acd0: 65 20 63 75 72 72 65 6e 74 20 70 72 6f 63 65 73 e current proces
ace0: 73 3f 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 s?.. #..
acf0: 20 20 20 69 66 20 7b 24 70 6c 61 74 66 6f 72 6d if {$platform
ad00: 20 65 71 20 5b 6d 61 63 68 69 6e 65 54 6f 50 6c eq [machineToPl
ad10: 61 74 66 6f 72 6d 20 24 3a 3a 74 63 6c 5f 70 6c atform $::tcl_pl
ad20: 61 74 66 6f 72 6d 28 6d 61 63 68 69 6e 65 29 5d atform(machine)]
ad30: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
ad40: 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 return true..
ad50: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
ad60: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
ad70: 20 54 68 65 20 73 70 65 63 69 66 69 65 64 20 70 The specified p
ad80: 6c 61 74 66 6f 72 6d 20 64 6f 65 73 20 6e 6f 74 latform does not
ad90: 20 6d 61 74 63 68 20 75 70 20 77 69 74 68 20 74 match up with t
ada0: 68 65 20 70 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 he platform..
adb0: 20 20 20 23 20 20 20 20 20 20 20 66 6f 72 20 74 # for t
adc0: 68 65 20 63 75 72 72 65 6e 74 20 70 72 6f 63 65 he current proce
add0: 73 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ss... #..
ade0: 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 return false
adf0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
ae00: 70 72 6f 63 20 68 61 76 65 53 51 4c 69 74 65 4f proc haveSQLiteO
ae10: 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 20 7b 7d 20 bjectCommand {}
ae20: 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
ae30: 20 20 23 20 4e 4f 54 45 3a 20 49 73 20 74 68 65 # NOTE: Is the
ae40: 20 5b 6f 62 6a 65 63 74 5d 20 63 6f 6d 6d 61 6e [object] comman
ae50: 64 20 63 75 72 72 65 6e 74 6c 79 20 61 76 61 69 d currently avai
ae60: 6c 61 62 6c 65 3f 0d 0a 20 20 20 20 20 20 23 0d lable?.. #.
ae70: 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 65 . return [e
ae80: 78 70 72 20 7b 5b 6c 6c 65 6e 67 74 68 20 5b 69 xpr {[llength [i
ae90: 6e 66 6f 20 63 6f 6d 6d 61 6e 64 73 20 6f 62 6a nfo commands obj
aea0: 65 63 74 5d 5d 20 3e 20 30 7d 5d 0d 0a 20 20 20 ect]] > 0}]..
aeb0: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
aec0: 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 4f 62 checkForSQLiteOb
aed0: 6a 65 63 74 43 6f 6d 6d 61 6e 64 20 7b 20 63 68 jectCommand { ch
aee0: 61 6e 6e 65 6c 20 7d 20 7b 0d 0a 20 20 20 20 20 annel } {..
aef0: 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
af00: 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 "---- checking f
af10: 6f 72 20 5c 22 6f 62 6a 65 63 74 5c 22 20 63 6f or \"object\" co
af20: 6d 6d 61 6e 64 20 75 73 61 67 65 2e 2e 2e 20 22 mmand usage... "
af30: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b .... if {![
af40: 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
af50: 28 73 71 6c 69 74 65 4f 62 6a 65 63 74 43 6f 6d (sqliteObjectCom
af60: 6d 61 6e 64 29 5d 20 26 26 20 5c 0d 0a 20 20 20 mand)] && \..
af70: 20 20 20 20 20 20 20 5b 68 61 76 65 53 51 4c 69 [haveSQLi
af80: 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d teObjectCommand]
af90: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
afa0: 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
afb0: 20 79 65 73 5c 6e 0d 0a 20 20 20 20 20 20 7d 20 yes\n.. }
afc0: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
afd0: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
afe0: 45 3a 20 55 6e 6c 65 73 73 20 77 65 20 61 72 65 E: Unless we are
aff0: 20 66 6f 72 62 69 64 64 65 6e 20 66 72 6f 6d 20 forbidden from
b000: 64 6f 69 6e 67 20 73 6f 2c 20 61 64 64 20 73 6f doing so, add so
b010: 6d 65 20 63 6f 6e 73 74 72 61 69 6e 74 73 0d 0a me constraints..
b020: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
b030: 74 68 61 74 20 77 69 6c 6c 20 61 6c 6c 6f 77 20 that will allow
b040: 6d 6f 73 74 20 6f 66 20 74 68 65 20 74 65 73 74 most of the test
b050: 20 73 75 69 74 65 20 74 6f 20 72 75 6e 20 28 69 suite to run (i
b060: 2e 65 2e 20 74 68 6f 73 65 0d 0a 20 20 20 20 20 .e. those..
b070: 20 20 20 23 20 20 20 20 20 20 20 74 65 73 74 73 # tests
b080: 20 74 68 61 74 20 64 6f 20 6e 6f 74 20 64 69 72 that do not dir
b090: 65 63 74 6c 79 20 72 65 6c 79 20 75 70 6f 6e 20 ectly rely upon
b0a0: 74 68 65 20 5b 6f 62 6a 65 63 74 5d 20 63 6f 6d the [object] com
b0b0: 6d 61 6e 64 29 2e 0d 0a 20 20 20 20 20 20 20 20 mand)...
b0c0: 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
b0d0: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
b0e0: 6f 28 73 68 69 6d 53 51 4c 69 74 65 41 73 73 65 o(shimSQLiteAsse
b0f0: 6d 62 6c 79 43 6f 6e 73 74 72 61 69 6e 74 73 29 mblyConstraints)
b100: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
b110: 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 addConstrai
b120: 6e 74 20 53 51 4c 69 74 65 0d 0a 20 20 20 20 20 nt SQLite..
b130: 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 addConstrai
b140: 6e 74 20 53 51 4c 69 74 65 49 6e 74 65 72 6f 70 nt SQLiteInterop
b150: 0d 0a 20 20 20 20 20 20 20 20 20 20 61 64 64 43 .. addC
b160: 6f 6e 73 74 72 61 69 6e 74 20 53 79 73 74 65 6d onstraint System
b170: 2e 44 61 74 61 2e 53 51 4c 69 74 65 0d 0a 20 20 .Data.SQLite..
b180: 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 addConst
b190: 72 61 69 6e 74 20 53 79 73 74 65 6d 2e 44 61 74 raint System.Dat
b1a0: 61 2e 53 51 4c 69 74 65 2e 45 6e 63 72 79 70 74 a.SQLite.Encrypt
b1b0: 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 61 ion.. a
b1c0: 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 79 73 ddConstraint Sys
b1d0: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
b1e0: 4c 69 6e 71 0d 0a 0d 0a 20 20 20 20 20 20 20 20 Linq....
b1f0: 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 addConstraint
b200: 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
b210: 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 Sys
b220: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
b230: 64 6c 6c 5f 76 20 5b 67 65 74 42 75 69 6c 64 43 dll_v [getBuildC
b240: 6c 72 56 65 72 73 69 6f 6e 5d 5d 0d 0a 20 20 20 lrVersion]]..
b250: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
b260: 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
b270: 73 74 73 20 3a 3a 6e 6f 28 73 68 69 6d 53 51 4c sts ::no(shimSQL
b280: 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 61 6e iteDefineConstan
b290: 74 43 6f 6e 73 74 72 61 69 6e 74 73 29 5d 7d 20 tConstraints)]}
b2a0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
b2b0: 20 20 66 6f 72 65 61 63 68 20 64 65 66 69 6e 65 foreach define
b2c0: 43 6f 6e 73 74 61 6e 74 20 5b 6c 69 73 74 20 5c Constant [list \
b2d0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
b2e0: 49 4e 54 45 52 4f 50 5f 45 58 54 45 4e 53 49 4f INTEROP_EXTENSIO
b2f0: 4e 5f 46 55 4e 43 54 49 4f 4e 53 20 49 4e 54 45 N_FUNCTIONS INTE
b300: 52 4f 50 5f 54 45 53 54 5f 45 58 54 45 4e 53 49 ROP_TEST_EXTENSI
b310: 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ON \..
b320: 20 20 20 20 49 4e 54 45 52 4f 50 5f 56 49 52 54 INTEROP_VIRT
b330: 55 41 4c 5f 54 41 42 4c 45 20 55 53 45 5f 49 4e UAL_TABLE USE_IN
b340: 54 45 52 4f 50 5f 44 4c 4c 5d 20 7b 0d 0a 20 20 TEROP_DLL] {..
b350: 20 20 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e addCon
b360: 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
b370: 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
b380: 20 20 20 20 20 20 20 64 65 66 69 6e 65 43 6f 6e defineCon
b390: 73 74 61 6e 74 2e 53 79 73 74 65 6d 2e 44 61 74 stant.System.Dat
b3a0: 61 2e 53 51 4c 69 74 65 2e 20 24 64 65 66 69 6e a.SQLite. $defin
b3b0: 65 43 6f 6e 73 74 61 6e 74 5d 0d 0a 20 20 20 20 eConstant]..
b3c0: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
b3d0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 }.... if
b3e0: 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
b3f0: 3a 3a 6e 6f 28 73 68 69 6d 53 51 4c 69 74 65 56 ::no(shimSQLiteV
b400: 69 73 75 61 6c 53 74 75 64 69 6f 43 6f 6e 73 74 isualStudioConst
b410: 72 61 69 6e 74 73 29 5d 7d 20 74 68 65 6e 20 7b raints)]} then {
b420: 0d 0a 20 20 20 20 20 20 20 20 20 20 61 64 64 43 .. addC
b430: 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e onstraint [appen
b440: 64 41 72 67 73 20 76 69 73 75 61 6c 53 74 75 64 dArgs visualStud
b450: 69 6f 20 5b 67 65 74 42 75 69 6c 64 59 65 61 72 io [getBuildYear
b460: 5d 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d ]].. }...
b470: 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
b480: 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 20 channel no\n..
b490: 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
b4a0: 0a 20 20 20 20 70 72 6f 63 20 63 68 61 6e 67 65 . proc change
b4b0: 4e 61 74 69 76 65 52 75 6e 74 69 6d 65 4f 70 74 NativeRuntimeOpt
b4c0: 69 6f 6e 20 7b 20 6e 61 74 69 76 65 20 7d 20 7b ion { native } {
b4d0: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 6c 6c 65 .. if {[lle
b4e0: 6e 67 74 68 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 ngth [info comma
b4f0: 6e 64 73 20 64 65 62 75 67 5d 5d 20 3e 20 30 20 nds debug]] > 0
b500: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
b510: 5b 6c 6c 65 6e 67 74 68 20 5b 69 6e 66 6f 20 73 [llength [info s
b520: 75 62 63 6f 6d 6d 61 6e 64 73 20 64 65 62 75 67 ubcommands debug
b530: 20 72 75 6e 74 69 6d 65 6f 70 74 69 6f 6e 5d 5d runtimeoption]]
b540: 20 3e 20 30 20 26 26 20 5b 63 61 74 63 68 20 7b > 0 && [catch {
b550: 0d 0a 20 20 20 20 20 20 20 20 64 65 62 75 67 20 .. debug
b560: 72 75 6e 74 69 6d 65 6f 70 74 69 6f 6e 20 5b 65 runtimeoption [e
b570: 78 70 72 20 7b 24 6e 61 74 69 76 65 20 3f 20 22 xpr {$native ? "
b580: 61 64 64 22 20 3a 20 22 72 65 6d 6f 76 65 22 7d add" : "remove"}
b590: 5d 20 6e 61 74 69 76 65 0d 0a 20 20 20 20 20 20 ] native..
b5a0: 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d }] == 0} then {.
b5b0: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
b5c0: 74 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d true.. }...
b5d0: 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 . if {[have
b5e0: 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d SQLiteObjectComm
b5f0: 61 6e 64 5d 20 26 26 20 5b 63 61 74 63 68 20 7b and] && [catch {
b600: 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 .. object
b610: 20 69 6e 76 6f 6b 65 20 49 6e 74 65 72 70 72 65 invoke Interpre
b620: 74 65 72 2e 47 65 74 41 63 74 69 76 65 20 5b 65 ter.GetActive [e
b630: 78 70 72 20 7b 24 6e 61 74 69 76 65 20 3f 20 5c xpr {$native ? \
b640: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 41 .. "A
b650: 64 64 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 22 ddRuntimeOption"
b660: 20 3a 20 22 52 65 6d 6f 76 65 52 75 6e 74 69 6d : "RemoveRuntim
b670: 65 4f 70 74 69 6f 6e 22 7d 5d 20 6e 61 74 69 76 eOption"}] nativ
b680: 65 0d 0a 20 20 20 20 20 20 7d 5d 20 3d 3d 20 30 e.. }] == 0
b690: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
b6a0: 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 return true..
b6b0: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
b6c0: 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 return false..
b6d0: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
b6e0: 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 42 checkForSQLiteB
b6f0: 75 69 6c 64 73 20 7b 20 63 68 61 6e 6e 65 6c 20 uilds { channel
b700: 7b 73 65 6c 65 63 74 20 66 61 6c 73 65 7d 20 7d {select false} }
b710: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
b720: 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b # NOTE: Check
b730: 20 66 6f 72 20 65 76 65 72 79 20 70 6f 73 73 69 for every possi
b740: 62 6c 65 20 76 61 6c 69 64 20 63 6f 6d 62 69 6e ble valid combin
b750: 61 74 69 6f 6e 20 6f 66 20 76 61 6c 75 65 73 20 ation of values
b760: 75 73 65 64 20 77 68 65 6e 0d 0a 20 20 20 20 20 used when..
b770: 20 23 20 20 20 20 20 20 20 6c 6f 63 61 74 69 6e # locatin
b780: 67 20 6f 75 74 20 74 68 65 20 62 75 69 6c 64 20 g out the build
b790: 6f 75 74 70 75 74 20 64 69 72 65 63 74 6f 72 79 output directory
b7a0: 2c 20 73 68 6f 77 69 6e 67 20 65 61 63 68 20 61 , showing each a
b7b0: 76 61 69 6c 61 62 6c 65 0d 0a 20 20 20 20 20 20 vailable..
b7c0: 23 20 20 20 20 20 20 20 62 75 69 6c 64 20 76 61 # build va
b7d0: 72 69 61 74 69 6f 6e 20 61 6c 6f 6e 67 20 74 68 riation along th
b7e0: 65 20 77 61 79 2e 0d 0a 20 20 20 20 20 20 23 0d e way... #.
b7f0: 0a 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 6e . foreach n
b800: 61 74 69 76 65 20 5b 6c 69 73 74 20 66 61 6c 73 ative [list fals
b810: 65 20 74 72 75 65 5d 20 7b 0d 0a 20 20 20 20 20 e true] {..
b820: 20 20 20 66 6f 72 65 61 63 68 20 79 65 61 72 20 foreach year
b830: 5b 67 65 74 42 75 69 6c 64 59 65 61 72 73 5d 20 [getBuildYears]
b840: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 {.. for
b850: 65 61 63 68 20 63 6f 6e 66 69 67 75 72 61 74 69 each configurati
b860: 6f 6e 20 5b 67 65 74 42 75 69 6c 64 43 6f 6e 66 on [getBuildConf
b870: 69 67 75 72 61 74 69 6f 6e 73 5d 20 7b 0d 0a 20 igurations] {..
b880: 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
b890: 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
b8a0: 3a 20 46 69 67 75 72 65 20 6f 75 74 20 74 68 65 : Figure out the
b8b0: 20 65 66 66 65 63 74 69 76 65 20 62 75 69 6c 64 effective build
b8c0: 20 70 6c 61 74 66 6f 72 6d 2e 20 20 54 68 69 73 platform. This
b8d0: 20 69 73 0d 0a 20 20 20 20 20 20 20 20 20 20 20 is..
b8e0: 20 23 20 20 20 20 20 20 20 62 61 73 65 64 20 6f # based o
b8f0: 6e 20 77 68 65 74 68 65 72 20 6f 72 20 6e 6f 74 n whether or not
b900: 20 61 20 5b 70 72 69 6d 61 72 69 6c 79 5d 20 6e a [primarily] n
b910: 61 74 69 76 65 20 62 75 69 6c 64 0d 0a 20 20 20 ative build..
b920: 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
b930: 20 69 73 20 62 65 69 6e 67 20 75 73 65 64 2e 20 is being used.
b940: 20 46 6f 72 20 5b 70 72 69 6d 61 72 69 6c 79 5d For [primarily]
b950: 20 6e 6f 6e 2d 6e 61 74 69 76 65 20 62 75 69 6c non-native buil
b960: 64 73 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ds,..
b970: 20 23 20 20 20 20 20 20 20 74 68 69 73 20 77 69 # this wi
b980: 6c 6c 20 62 65 20 61 6e 20 65 6d 70 74 79 20 73 ll be an empty s
b990: 74 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 20 20 tring...
b9a0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
b9b0: 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 set platform
b9c0: 5b 67 65 74 42 75 69 6c 64 50 6c 61 74 66 6f 72 [getBuildPlatfor
b9d0: 6d 20 24 6e 61 74 69 76 65 5d 0d 0a 0d 0a 20 20 m $native]....
b9e0: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
b9f0: 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
ba00: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
ba10: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 "---- ch
ba20: 65 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 74 65 ecking for Syste
ba30: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 62 75 m.Data.SQLite bu
ba40: 69 6c 64 20 5c 22 22 20 5b 65 78 70 72 20 5c 0d ild \"" [expr \.
ba50: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
ba60: 20 7b 24 6e 61 74 69 76 65 20 3f 20 22 6e 61 74 {$native ? "nat
ba70: 69 76 65 2f 22 20 3a 20 22 22 7d 5d 20 5b 65 78 ive/" : ""}] [ex
ba80: 70 72 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 pr {[string leng
ba90: 74 68 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 th \..
baa0: 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 6d 5d $platform]
bab0: 20 3e 20 30 20 3f 20 5b 61 70 70 65 6e 64 41 72 > 0 ? [appendAr
bac0: 67 73 20 24 70 6c 61 74 66 6f 72 6d 20 2f 5d 20 gs $platform /]
bad0: 3a 20 22 22 7d 5d 20 24 79 65 61 72 20 5c 0d 0a : ""}] $year \..
bae0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
baf0: 2f 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e / $configuration
bb00: 20 22 5c 22 2e 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 "\"... "]....
bb10: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
bb20: 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
bb30: 20 42 75 69 6c 64 20 74 68 65 20 66 75 6c 6c 79 Build the fully
bb40: 20 71 75 61 6c 69 66 69 65 64 20 64 69 72 65 63 qualified direc
bb50: 74 6f 72 79 20 77 68 65 72 65 20 74 68 65 20 6e tory where the n
bb60: 65 63 65 73 73 61 72 79 0d 0a 20 20 20 20 20 20 ecessary..
bb70: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
bb80: 6d 70 6f 6e 65 6e 74 73 20 66 6f 72 20 53 79 73 mponents for Sys
bb90: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
bba0: 73 68 6f 75 6c 64 20 62 65 20 66 6f 75 6e 64 2e should be found.
bbb0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d .. #.
bbc0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 . set
bbd0: 20 64 69 72 65 63 74 6f 72 79 20 5b 6a 6f 69 6e directory [join
bbe0: 42 75 69 6c 64 44 69 72 65 63 74 6f 72 79 20 24 BuildDirectory $
bbf0: 6e 61 74 69 76 65 20 5c 0d 0a 20 20 20 20 20 20 native \..
bc00: 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 75 [getBu
bc10: 69 6c 64 42 61 73 65 44 69 72 65 63 74 6f 72 79 ildBaseDirectory
bc20: 5d 20 24 79 65 61 72 20 24 70 6c 61 74 66 6f 72 ] $year $platfor
bc30: 6d 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e m $configuration
bc40: 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ]....
bc50: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
bc60: 23 20 4e 4f 54 45 3a 20 44 6f 20 74 68 65 20 6e # NOTE: Do the n
bc70: 65 63 65 73 73 61 72 79 20 66 69 6c 65 73 20 65 ecessary files e
bc80: 78 69 73 74 3f 20 20 43 75 72 72 65 6e 74 6c 79 xist? Currently
bc90: 2c 20 6e 6f 20 6f 74 68 65 72 20 73 74 65 70 73 , no other steps
bca0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 .. #
bcb0: 20 20 20 20 20 20 61 72 65 20 74 61 6b 65 6e 20 are taken
bcc0: 74 6f 20 76 65 72 69 66 79 20 74 68 69 73 20 62 to verify this b
bcd0: 75 69 6c 64 20 69 73 20 61 63 74 75 61 6c 6c 79 uild is actually
bce0: 20 76 69 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 viable...
bcf0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
bd00: 20 20 20 20 20 69 66 20 7b 5b 69 73 42 75 69 6c if {[isBuil
bd10: 64 41 76 61 69 6c 61 62 6c 65 20 24 6e 61 74 69 dAvailable $nati
bd20: 76 65 20 24 64 69 72 65 63 74 6f 72 79 5d 7d 20 ve $directory]}
bd30: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
bd40: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
bd50: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 # NOTE: W
bd60: 68 65 6e 20 69 6e 20 22 73 65 6c 65 63 74 22 20 hen in "select"
bd70: 6d 6f 64 65 2c 20 61 75 74 6f 6d 61 74 69 63 61 mode, automatica
bd80: 6c 6c 79 20 73 65 6c 65 63 74 20 74 68 65 20 66 lly select the f
bd90: 69 72 73 74 0d 0a 20 20 20 20 20 20 20 20 20 20 irst..
bda0: 20 20 20 20 23 20 20 20 20 20 20 20 61 76 61 69 # avai
bdb0: 6c 61 62 6c 65 20 62 75 69 6c 64 20 6f 66 20 53 lable build of S
bdc0: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
bdd0: 65 20 61 6e 64 20 74 68 65 6e 20 72 65 74 75 72 e and then retur
bde0: 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 n..
bdf0: 20 23 20 20 20 20 20 20 20 69 6d 6d 65 64 69 61 # immedia
be00: 74 65 6c 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 tely...
be10: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
be20: 20 20 20 20 20 20 69 66 20 7b 24 73 65 6c 65 63 if {$selec
be30: 74 20 26 26 20 5b 6d 61 74 63 68 4d 61 63 68 69 t && [matchMachi
be40: 6e 65 20 24 70 6c 61 74 66 6f 72 6d 5d 7d 20 74 ne $platform]} t
be50: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
be60: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
be70: 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
be80: 3a 20 4d 61 6e 75 61 6c 6c 79 20 6f 76 65 72 72 : Manually overr
be90: 69 64 65 20 61 6c 6c 20 74 68 65 20 62 75 69 6c ide all the buil
bea0: 64 20 64 69 72 65 63 74 6f 72 79 20 73 65 6c 65 d directory sele
beb0: 63 74 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 20 ction..
bec0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 # r
bed0: 65 6c 61 74 65 64 20 74 65 73 74 20 73 65 74 74 elated test sett
bee0: 69 6e 67 73 20 69 6e 20 6f 72 64 65 72 20 74 6f ings in order to
bef0: 20 66 6f 72 63 65 20 74 68 69 73 20 62 75 69 6c force this buil
bf00: 64 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 d..
bf10: 20 20 20 23 20 20 20 20 20 20 20 6f 66 20 53 79 # of Sy
bf20: 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
bf30: 20 74 6f 20 62 65 20 75 73 65 64 2e 0d 0a 20 20 to be used...
bf40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
bf50: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
bf60: 20 69 66 20 7b 21 5b 63 68 61 6e 67 65 4e 61 74 if {![changeNat
bf70: 69 76 65 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e iveRuntimeOption
bf80: 20 24 6e 61 74 69 76 65 5d 7d 20 74 68 65 6e 20 $native]} then
bf90: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
bfa0: 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
bfb0: 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
bfc0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
bfd0: 20 20 20 20 20 20 20 20 20 22 6e 6f 2c 20 66 61 "no, fa
bfe0: 69 6c 65 64 20 74 6f 20 22 20 5b 65 78 70 72 20 iled to " [expr
bff0: 7b 24 6e 61 74 69 76 65 20 3f 20 22 61 64 64 22 {$native ? "add"
c000: 20 3a 20 22 72 65 6d 6f 76 65 22 7d 5d 20 5c 0d : "remove"}] \.
c010: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
c020: 20 20 20 20 20 20 20 22 20 74 68 65 20 5c 22 6e " the \"n
c030: 61 74 69 76 65 5c 22 20 72 75 6e 74 69 6d 65 20 ative\" runtime
c040: 6f 70 74 69 6f 6e 5c 6e 22 5d 0d 0a 0d 0a 20 20 option\n"]....
c050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
c060: 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 return false..
c070: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
c080: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
c090: 20 20 20 73 65 74 20 3a 3a 74 65 73 74 5f 79 65 set ::test_ye
c0a0: 61 72 20 24 79 65 61 72 0d 0a 20 20 20 20 20 20 ar $year..
c0b0: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a set ::
c0c0: 74 65 73 74 5f 70 6c 61 74 66 6f 72 6d 20 24 70 test_platform $p
c0d0: 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 20 20 20 20 latform..
c0e0: 20 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a 74 set ::t
c0f0: 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f est_configuratio
c100: 6e 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e n $configuration
c110: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
c120: 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
c130: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
c140: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
c150: 20 20 20 20 20 20 22 79 65 73 2c 20 73 65 6c 65 "yes, sele
c160: 63 74 65 64 20 28 22 20 5b 65 78 70 72 20 7b 24 cted (" [expr {$
c170: 6e 61 74 69 76 65 20 3f 20 22 6e 61 74 69 76 65 native ? "native
c180: 2f 22 20 3a 20 22 22 7d 5d 20 5c 0d 0a 20 20 20 /" : ""}] \..
c190: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
c1a0: 20 5b 65 78 70 72 20 7b 5b 73 74 72 69 6e 67 20 [expr {[string
c1b0: 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 6d length $platform
c1c0: 5d 20 3e 20 30 20 3f 20 5b 61 70 70 65 6e 64 41 ] > 0 ? [appendA
c1d0: 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
c1e0: 20 20 20 20 20 20 20 20 20 20 20 24 70 6c 61 74 $plat
c1f0: 66 6f 72 6d 20 2f 5d 20 3a 20 22 22 7d 5d 20 24 form /] : ""}] $
c200: 79 65 61 72 20 2f 20 24 63 6f 6e 66 69 67 75 72 year / $configur
c210: 61 74 69 6f 6e 20 22 29 5c 6e 22 5d 0d 0a 0d 0a ation ")\n"]....
c220: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
c230: 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 return true..
c240: 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 } els
c250: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
c260: 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
c270: 6e 65 6c 20 79 65 73 5c 6e 0d 0a 20 20 20 20 20 nel yes\n..
c280: 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
c290: 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
c2a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
c2b0: 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e tputs $channel n
c2c0: 6f 5c 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 o\n..
c2d0: 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d }.. }.
c2e0: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
c2f0: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 }.... ret
c300: 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 7d urn false.. }
c310: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 68 ..... proc ch
c320: 65 63 6b 46 6f 72 53 51 4c 69 74 65 52 65 6c 65 eckForSQLiteRele
c330: 61 73 65 73 20 7b 20 63 68 61 6e 6e 65 6c 20 7b ases { channel {
c340: 73 65 6c 65 63 74 20 66 61 6c 73 65 7d 20 7d 20 select false} }
c350: 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
c360: 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 # NOTE: Check
c370: 66 6f 72 20 70 61 73 74 20 72 65 6c 65 61 73 65 for past release
c380: 73 20 6f 66 20 53 79 73 74 65 6d 2e 44 61 74 61 s of System.Data
c390: 2e 53 51 4c 69 74 65 20 69 6e 20 74 68 65 20 64 .SQLite in the d
c3a0: 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 irectory..
c3b0: 23 20 20 20 20 20 20 20 63 6f 6e 74 61 69 6e 65 # containe
c3c0: 64 20 69 6e 20 74 68 65 20 22 53 79 73 74 65 6d d in the "System
c3d0: 2e 44 61 74 61 2e 53 51 4c 69 74 65 22 20 65 6e .Data.SQLite" en
c3e0: 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 vironment variab
c3f0: 6c 65 2c 20 69 66 0d 0a 20 20 20 20 20 20 23 20 le, if.. #
c400: 20 20 20 20 20 20 70 72 65 73 65 6e 74 2e 0d 0a present...
c410: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
c420: 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
c430: 3a 3a 65 6e 76 28 53 79 73 74 65 6d 2e 44 61 74 ::env(System.Dat
c440: 61 2e 53 51 4c 69 74 65 29 5d 20 26 26 20 5c 0d a.SQLite)] && \.
c450: 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 . [stri
c460: 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 65 6e 76 ng length $::env
c470: 28 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c (System.Data.SQL
c480: 69 74 65 29 5d 20 3e 20 30 7d 20 74 68 65 6e 20 ite)] > 0} then
c490: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
c4a0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 # NOTE: Bu
c4b0: 69 6c 64 20 74 68 65 20 66 75 6c 6c 79 20 71 75 ild the fully qu
c4c0: 61 6c 69 66 69 65 64 20 64 69 72 65 63 74 6f 72 alified director
c4d0: 79 20 77 68 65 72 65 20 74 68 65 20 6e 65 63 65 y where the nece
c4e0: 73 73 61 72 79 0d 0a 20 20 20 20 20 20 20 20 23 ssary.. #
c4f0: 20 20 20 20 20 20 20 63 6f 6d 70 6f 6e 65 6e 74 component
c500: 73 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 61 74 s for System.Dat
c510: 61 2e 53 51 4c 69 74 65 20 73 68 6f 75 6c 64 20 a.SQLite should
c520: 62 65 20 66 6f 75 6e 64 2e 0d 0a 20 20 20 20 20 be found...
c530: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 #.. se
c540: 74 20 64 69 72 65 63 74 6f 72 79 20 5b 66 69 6c t directory [fil
c550: 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 e nativename [fi
c560: 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 le join \..
c570: 20 20 20 20 20 20 20 24 3a 3a 65 6e 76 28 53 79 $::env(Sy
c580: 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
c590: 29 20 5b 67 65 74 52 65 6c 65 61 73 65 56 65 72 ) [getReleaseVer
c5a0: 73 69 6f 6e 5d 5d 5d 0d 0a 0d 0a 20 20 20 20 20 sion]]]....
c5b0: 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
c5c0: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
c5d0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d . "--
c5e0: 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 -- checking for
c5f0: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
c600: 74 65 20 72 65 6c 65 61 73 65 20 5c 22 22 20 5c te release \"" \
c610: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 64 .. $d
c620: 69 72 65 63 74 6f 72 79 20 22 5c 22 2e 2e 2e 20 irectory "\"...
c630: 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 "].... if
c640: 20 7b 5b 69 73 52 65 6c 65 61 73 65 41 76 61 69 {[isReleaseAvai
c650: 6c 61 62 6c 65 20 24 64 69 72 65 63 74 6f 72 79 lable $directory
c660: 20 70 6c 61 74 66 6f 72 6d 5d 7d 20 74 68 65 6e platform]} then
c670: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 {.. if
c680: 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
c690: 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3d 3d 20 30 $platform] == 0
c6a0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
c6b0: 20 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f set platfo
c6c0: 72 6d 20 75 6e 6b 6e 6f 77 6e 0d 0a 20 20 20 20 rm unknown..
c6d0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
c6e0: 20 20 20 20 20 69 66 20 7b 24 73 65 6c 65 63 74 if {$select
c6f0: 20 26 26 20 5b 6d 61 74 63 68 4d 61 63 68 69 6e && [matchMachin
c700: 65 20 24 70 6c 61 74 66 6f 72 6d 5d 7d 20 74 68 e $platform]} th
c710: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
c720: 20 20 73 65 74 20 3a 3a 62 75 69 6c 64 5f 64 69 set ::build_di
c730: 72 65 63 74 6f 72 79 20 24 64 69 72 65 63 74 6f rectory $directo
c740: 72 79 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 ry....
c750: 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
c760: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 79 65 [appendArgs "ye
c770: 73 2c 20 73 65 6c 65 63 74 65 64 20 28 22 20 24 s, selected (" $
c780: 70 6c 61 74 66 6f 72 6d 20 22 29 5c 6e 22 5d 0d platform ")\n"].
c790: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 ... r
c7a0: 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 eturn true..
c7b0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
c7c0: 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
c7d0: 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
c7e0: 6e 64 41 72 67 73 20 22 79 65 73 20 28 22 20 24 ndArgs "yes (" $
c7f0: 70 6c 61 74 66 6f 72 6d 20 22 29 5c 6e 22 5d 0d platform ")\n"].
c800: 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
c810: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
c820: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
c830: 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 0d $channel no\n...
c840: 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 . forea
c850: 63 68 20 70 61 74 68 20 5b 6c 73 6f 72 74 20 2d ch path [lsort -
c860: 64 65 63 72 65 61 73 69 6e 67 20 5b 66 69 6c 65 decreasing [file
c870: 20 6c 69 73 74 20 24 64 69 72 65 63 74 6f 72 79 list $directory
c880: 20 2a 5d 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 *]] {..
c890: 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 if {[file ex
c8a0: 69 73 74 73 20 24 70 61 74 68 5d 20 26 26 20 5b ists $path] && [
c8b0: 66 69 6c 65 20 69 73 64 69 72 65 63 74 6f 72 79 file isdirectory
c8c0: 20 24 70 61 74 68 5d 7d 20 74 68 65 6e 20 7b 0d $path]} then {.
c8d0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 . t
c8e0: 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
c8f0: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
c900: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
c910: 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f ---- checking fo
c920: 72 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 r System.Data.SQ
c930: 4c 69 74 65 20 72 65 6c 65 61 73 65 20 5c 22 22 Lite release \""
c940: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
c950: 20 20 20 20 20 20 24 70 61 74 68 20 22 5c 22 2e $path "\".
c960: 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 .. "]....
c970: 20 20 20 20 20 20 20 69 66 20 7b 5b 69 73 52 65 if {[isRe
c980: 6c 65 61 73 65 41 76 61 69 6c 61 62 6c 65 20 24 leaseAvailable $
c990: 70 61 74 68 20 70 6c 61 74 66 6f 72 6d 5d 7d 20 path platform]}
c9a0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
c9b0: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 if {[str
c9c0: 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 ing length $plat
c9d0: 66 6f 72 6d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e form] == 0} then
c9e0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
c9f0: 20 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f set platfo
ca00: 72 6d 20 75 6e 6b 6e 6f 77 6e 0d 0a 20 20 20 20 rm unknown..
ca10: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d }...
ca20: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
ca30: 20 69 66 20 7b 24 73 65 6c 65 63 74 20 26 26 20 if {$select &&
ca40: 5b 6d 61 74 63 68 4d 61 63 68 69 6e 65 20 24 70 [matchMachine $p
ca50: 6c 61 74 66 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b latform]} then {
ca60: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
ca70: 20 20 20 20 73 65 74 20 3a 3a 62 75 69 6c 64 5f set ::build_
ca80: 64 69 72 65 63 74 6f 72 79 20 24 70 61 74 68 0d directory $path.
ca90: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
caa0: 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
cab0: 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
cac0: 22 79 65 73 2c 20 73 65 6c 65 63 74 65 64 20 28 "yes, selected (
cad0: 22 20 24 70 6c 61 74 66 6f 72 6d 20 22 29 5c 6e " $platform ")\n
cae0: 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 "]....
caf0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 return t
cb00: 72 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 rue..
cb10: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
cb20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
cb30: 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
cb40: 5b 61 70 70 65 6e 64 41 72 67 73 20 22 79 65 73 [appendArgs "yes
cb50: 20 28 22 20 24 70 6c 61 74 66 6f 72 6d 20 22 29 (" $platform ")
cb60: 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
cb70: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
cb80: 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
cb90: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
cba0: 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
cbb0: 6e 6f 5c 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 no\n..
cbc0: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
cbd0: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
cbe0: 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
cbf0: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
cc00: 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
cc10: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
cc20: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
cc30: 22 2d 2d 2d 2d 20 65 6e 76 69 72 6f 6e 6d 65 6e "---- environmen
cc40: 74 20 76 61 72 69 61 62 6c 65 20 5c 22 53 79 73 t variable \"Sys
cc50: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 5c tem.Data.SQLite\
cc60: 22 20 69 73 20 6e 6f 74 20 22 20 5c 0d 0a 20 20 " is not " \..
cc70: 20 20 20 20 20 20 20 20 20 20 22 73 65 74 2c 20 "set,
cc80: 73 6b 69 70 70 69 6e 67 20 63 68 65 63 6b 20 66 skipping check f
cc90: 6f 72 20 72 65 6c 65 61 73 65 73 2e 2e 2e 5c 6e or releases...\n
cca0: 22 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 "].. }....
ccb0: 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 return fals
ccc0: 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 e.. }.....
ccd0: 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 51 proc checkForSQ
cce0: 4c 69 74 65 4c 69 62 72 61 72 79 20 7b 20 63 68 LiteLibrary { ch
ccf0: 61 6e 6e 65 6c 20 7d 20 7b 0d 0a 20 20 20 20 20 annel } {..
cd00: 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
cd10: 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 "---- checking f
cd20: 6f 72 20 53 51 4c 69 74 65 20 63 6f 72 65 20 6c or SQLite core l
cd30: 69 62 72 61 72 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 ibrary... "....
cd40: 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
cd50: 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 {.. objec
cd60: 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 t invoke -flags
cd70: 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 +NonPublic \..
cd80: 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
cd90: 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c .Data.SQLite.SQL
cda0: 69 74 65 33 20 53 51 4c 69 74 65 56 65 72 73 69 ite3 SQLiteVersi
cdb0: 6f 6e 0d 0a 20 20 20 20 20 20 7d 20 76 65 72 73 on.. } vers
cdc0: 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ion] == 0} then
cdd0: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
cde0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 # NOTE: Ch
cdf0: 65 63 6b 20 69 66 20 74 68 65 20 72 65 74 75 72 eck if the retur
ce00: 6e 65 64 20 76 65 72 73 69 6f 6e 20 77 61 73 20 ned version was
ce10: 6e 75 6c 6c 2e 20 20 49 66 20 73 6f 2c 20 6d 61 null. If so, ma
ce20: 6b 65 20 69 74 20 65 61 73 79 0d 0a 20 20 20 20 ke it easy..
ce30: 20 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 73 # to s
ce40: 70 6f 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d pot... #.
ce50: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 . if {[st
ce60: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 65 72 ring length $ver
ce70: 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 6e sion] == 0} then
ce80: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 {.. se
ce90: 74 20 76 65 72 73 69 6f 6e 20 6e 75 6c 6c 0d 0a t version null..
cea0: 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
ceb0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
cec0: 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
ced0: 74 6f 20 71 75 65 72 79 20 74 68 65 20 46 6f 73 to query the Fos
cee0: 73 69 6c 20 73 6f 75 72 63 65 20 69 64 65 6e 74 sil source ident
cef0: 69 66 69 65 72 20 66 6f 72 20 74 68 65 20 53 51 ifier for the SQ
cf00: 4c 69 74 65 0d 0a 20 20 20 20 20 20 20 20 23 20 Lite.. #
cf10: 20 20 20 20 20 20 63 6f 72 65 20 6c 69 62 72 61 core libra
cf20: 72 79 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ry... #..
cf30: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
cf40: 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
cf50: 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 object invoke -f
cf60: 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 lags +NonPublic
cf70: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
cf80: 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
cf90: 69 74 65 2e 53 51 4c 69 74 65 33 20 53 51 4c 69 ite.SQLite3 SQLi
cfa0: 74 65 53 6f 75 72 63 65 49 64 0d 0a 20 20 20 20 teSourceId..
cfb0: 20 20 20 20 7d 20 73 6f 75 72 63 65 49 64 5d 7d } sourceId]}
cfc0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
cfd0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
cfe0: 23 20 4e 4f 54 45 3a 20 57 65 20 66 61 69 6c 65 # NOTE: We faile
cff0: 64 20 74 6f 20 71 75 65 72 79 20 74 68 65 20 46 d to query the F
d000: 6f 73 73 69 6c 20 73 6f 75 72 63 65 20 69 64 65 ossil source ide
d010: 6e 74 69 66 69 65 72 2e 0d 0a 20 20 20 20 20 20 ntifier...
d020: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
d030: 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 75 6e set sourceId un
d040: 6b 6e 6f 77 6e 0d 0a 20 20 20 20 20 20 20 20 7d known.. }
d050: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
d060: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 # NOTE: C
d070: 68 65 63 6b 20 69 66 20 74 68 65 20 72 65 74 75 heck if the retu
d080: 72 6e 65 64 20 46 6f 73 73 69 6c 20 73 6f 75 72 rned Fossil sour
d090: 63 65 20 69 64 65 6e 74 69 66 69 65 72 20 77 61 ce identifier wa
d0a0: 73 20 6e 75 6c 6c 2e 20 20 49 66 0d 0a 20 20 20 s null. If..
d0b0: 20 20 20 20 20 23 20 20 20 20 20 20 20 73 6f 2c # so,
d0c0: 20 6d 61 6b 65 20 69 74 20 65 61 73 79 20 74 6f make it easy to
d0d0: 20 73 70 6f 74 2e 0d 0a 20 20 20 20 20 20 20 20 spot...
d0e0: 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
d0f0: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 73 string length $s
d100: 6f 75 72 63 65 49 64 5d 20 3d 3d 20 30 7d 20 74 ourceId] == 0} t
d110: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
d120: 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 6e 75 set sourceId nu
d130: 6c 6c 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d ll.. }...
d140: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
d150: 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 65 73 2c # NOTE: Yes,
d160: 20 74 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 the SQLite core
d170: 20 6c 69 62 72 61 72 79 20 61 70 70 65 61 72 73 library appears
d180: 20 74 6f 20 62 65 20 61 76 61 69 6c 61 62 6c 65 to be available
d190: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
d1a0: 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 addConstra
d1b0: 69 6e 74 20 53 51 4c 69 74 65 0d 0a 0d 0a 20 20 int SQLite....
d1c0: 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
d1d0: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
d1e0: 20 22 79 65 73 20 28 22 20 24 76 65 72 73 69 6f "yes (" $versio
d1f0: 6e 20 22 20 22 20 24 73 6f 75 72 63 65 49 64 20 n " " $sourceId
d200: 22 29 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 7d 20 ")\n"].. }
d210: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
d220: 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e tputs $channel n
d230: 6f 5c 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 o\n.. }..
d240: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
d250: 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 49 checkForSQLiteI
d260: 6e 74 65 72 6f 70 20 7b 20 63 68 61 6e 6e 65 6c nterop { channel
d270: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 70 75 74 } {.. tput
d280: 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d s $channel "----
d290: 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 51 checking for SQ
d2a0: 4c 69 74 65 20 69 6e 74 65 72 6f 70 20 61 73 73 Lite interop ass
d2b0: 65 6d 62 6c 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 embly... "....
d2c0: 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
d2d0: 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 .. object
d2e0: 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
d2f0: 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 NonPublic \..
d300: 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e System.
d310: 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 Data.SQLite.SQLi
d320: 74 65 33 20 49 6e 74 65 72 6f 70 56 65 72 73 69 te3 InteropVersi
d330: 6f 6e 0d 0a 20 20 20 20 20 20 7d 20 76 65 72 73 on.. } vers
d340: 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ion] == 0} then
d350: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
d360: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 # NOTE: Ch
d370: 65 63 6b 20 69 66 20 74 68 65 20 72 65 74 75 72 eck if the retur
d380: 6e 65 64 20 76 65 72 73 69 6f 6e 20 77 61 73 20 ned version was
d390: 6e 75 6c 6c 2e 20 20 49 66 20 73 6f 2c 20 6d 61 null. If so, ma
d3a0: 6b 65 20 69 74 20 65 61 73 79 0d 0a 20 20 20 20 ke it easy..
d3b0: 20 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 73 # to s
d3c0: 70 6f 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d pot... #.
d3d0: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 . if {[st
d3e0: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 65 72 ring length $ver
d3f0: 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 6e sion] == 0} then
d400: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 {.. se
d410: 74 20 76 65 72 73 69 6f 6e 20 6e 75 6c 6c 0d 0a t version null..
d420: 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
d430: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
d440: 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
d450: 74 6f 20 71 75 65 72 79 20 74 68 65 20 46 6f 73 to query the Fos
d460: 73 69 6c 20 73 6f 75 72 63 65 20 69 64 65 6e 74 sil source ident
d470: 69 66 69 65 72 20 66 6f 72 20 74 68 65 20 53 51 ifier for the SQ
d480: 4c 69 74 65 0d 0a 20 20 20 20 20 20 20 20 23 20 Lite.. #
d490: 20 20 20 20 20 20 63 6f 72 65 20 6c 69 62 72 61 core libra
d4a0: 72 79 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ry... #..
d4b0: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
d4c0: 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
d4d0: 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 object invoke -f
d4e0: 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 lags +NonPublic
d4f0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
d500: 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
d510: 69 74 65 2e 53 51 4c 69 74 65 33 20 49 6e 74 65 ite.SQLite3 Inte
d520: 72 6f 70 53 6f 75 72 63 65 49 64 0d 0a 20 20 20 ropSourceId..
d530: 20 20 20 20 20 7d 20 73 6f 75 72 63 65 49 64 5d } sourceId]
d540: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
d550: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
d560: 20 23 20 4e 4f 54 45 3a 20 57 65 20 66 61 69 6c # NOTE: We fail
d570: 65 64 20 74 6f 20 71 75 65 72 79 20 74 68 65 20 ed to query the
d580: 46 6f 73 73 69 6c 20 73 6f 75 72 63 65 20 69 64 Fossil source id
d590: 65 6e 74 69 66 69 65 72 2e 0d 0a 20 20 20 20 20 entifier...
d5a0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
d5b0: 20 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 75 set sourceId u
d5c0: 6e 6b 6e 6f 77 6e 0d 0a 20 20 20 20 20 20 20 20 nknown..
d5d0: 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a }.... #..
d5e0: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
d5f0: 43 68 65 63 6b 20 69 66 20 74 68 65 20 72 65 74 Check if the ret
d600: 75 72 6e 65 64 20 46 6f 73 73 69 6c 20 73 6f 75 urned Fossil sou
d610: 72 63 65 20 69 64 65 6e 74 69 66 69 65 72 20 77 rce identifier w
d620: 61 73 20 6e 75 6c 6c 2e 20 20 49 66 0d 0a 20 20 as null. If..
d630: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 6f # so
d640: 2c 20 6d 61 6b 65 20 69 74 20 65 61 73 79 20 74 , make it easy t
d650: 6f 20 73 70 6f 74 2e 0d 0a 20 20 20 20 20 20 20 o spot...
d660: 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b #.. if {
d670: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
d680: 73 6f 75 72 63 65 49 64 5d 20 3d 3d 20 30 7d 20 sourceId] == 0}
d690: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
d6a0: 20 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 6e set sourceId n
d6b0: 75 6c 6c 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a ull.. }..
d6c0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
d6d0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 65 73 # NOTE: Yes
d6e0: 2c 20 74 68 65 20 53 51 4c 69 74 65 20 69 6e 74 , the SQLite int
d6f0: 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 61 70 erop assembly ap
d700: 70 65 61 72 73 20 74 6f 20 62 65 20 61 76 61 69 pears to be avai
d710: 6c 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 lable...
d720: 23 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f #.. addCo
d730: 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 74 65 49 nstraint SQLiteI
d740: 6e 74 65 72 6f 70 0d 0a 0d 0a 20 20 20 20 20 20 nterop....
d750: 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
d760: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 79 65 [appendArgs "ye
d770: 73 20 28 22 20 24 76 65 72 73 69 6f 6e 20 22 20 s (" $version "
d780: 22 20 24 73 6f 75 72 63 65 49 64 20 22 29 5c 6e " $sourceId ")\n
d790: 22 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 "].. } else
d7a0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 {.. tput
d7b0: 73 20 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d s $channel no\n.
d7c0: 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d . }.. }.
d7d0: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 68 65 .... proc che
d7e0: 63 6b 46 6f 72 53 51 4c 69 74 65 44 65 66 69 6e ckForSQLiteDefin
d7f0: 65 43 6f 6e 73 74 61 6e 74 20 7b 20 63 68 61 6e eConstant { chan
d800: 6e 65 6c 20 6e 61 6d 65 20 7d 20 7b 0d 0a 20 20 nel name } {..
d810: 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
d820: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
d830: 0d 0a 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d .. "---
d840: 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 - checking for S
d850: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
d860: 65 20 64 65 66 69 6e 65 20 63 6f 6e 73 74 61 6e e define constan
d870: 74 20 5c 22 22 20 24 6e 61 6d 65 20 5c 0d 0a 20 t \"" $name \..
d880: 20 20 20 20 20 20 20 20 20 22 5c 22 2e 2e 2e 20 "\"...
d890: 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b "].... if {
d8a0: 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 [catch {..
d8b0: 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
d8c0: 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
d8d0: 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
d8e0: 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
d8f0: 69 74 65 2e 53 51 4c 69 74 65 33 20 44 65 66 69 ite.SQLite3 Defi
d900: 6e 65 43 6f 6e 73 74 61 6e 74 73 0d 0a 20 20 20 neConstants..
d910: 20 20 20 7d 20 64 65 66 69 6e 65 43 6f 6e 73 74 } defineConst
d920: 61 6e 74 73 5d 20 3d 3d 20 30 7d 20 74 68 65 6e ants] == 0} then
d930: 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
d940: 5b 6c 73 65 61 72 63 68 20 2d 65 78 61 63 74 20 [lsearch -exact
d950: 2d 6e 6f 63 61 73 65 20 24 64 65 66 69 6e 65 43 -nocase $defineC
d960: 6f 6e 73 74 61 6e 74 73 20 24 6e 61 6d 65 5d 20 onstants $name]
d970: 21 3d 20 2d 31 7d 20 74 68 65 6e 20 7b 0d 0a 20 != -1} then {..
d980: 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
d990: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 65 # NOTE: Ye
d9a0: 73 2c 20 74 68 69 73 20 64 65 66 69 6e 65 20 63 s, this define c
d9b0: 6f 6e 73 74 61 6e 74 20 77 61 73 20 65 6e 61 62 onstant was enab
d9c0: 6c 65 64 20 77 68 65 6e 20 74 68 65 20 6d 61 6e led when the man
d9d0: 61 67 65 64 0d 0a 20 20 20 20 20 20 20 20 20 20 aged..
d9e0: 23 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c 79 # assembly
d9f0: 20 77 61 73 20 63 6f 6d 70 69 6c 65 64 2e 0d 0a was compiled...
da00: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
da10: 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 addConstr
da20: 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
da30: 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 2e defineConstant.
da40: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
da50: 74 65 2e 20 24 6e 61 6d 65 5d 0d 0a 0d 0a 20 20 te. $name]....
da60: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
da70: 68 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a 20 20 hannel yes\n..
da80: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
da90: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
daa0: 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 $channel no\n..
dab0: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
dac0: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
dad0: 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
dae0: 20 65 72 72 6f 72 5c 6e 0d 0a 20 20 20 20 20 20 error\n..
daf0: 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
db00: 20 70 72 6f 63 20 67 65 74 44 61 74 65 54 69 6d proc getDateTim
db10: 65 46 6f 72 6d 61 74 20 7b 7d 20 7b 0d 0a 20 20 eFormat {} {..
db20: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
db30: 4f 54 45 3a 20 54 68 69 73 20 70 72 6f 63 65 64 OTE: This proced
db40: 75 72 65 20 73 69 6d 70 6c 79 20 72 65 74 75 72 ure simply retur
db50: 6e 73 20 74 68 65 20 22 64 65 66 61 75 6c 74 22 ns the "default"
db60: 20 44 61 74 65 54 69 6d 65 20 66 6f 72 6d 61 74 DateTime format
db70: 20 75 73 65 64 0d 0a 20 20 20 20 20 20 23 20 20 used.. #
db80: 20 20 20 20 20 62 79 20 74 68 65 20 74 65 73 74 by the test
db90: 20 73 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 23 suite... #
dba0: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 .. if {[inf
dbb0: 6f 20 65 78 69 73 74 73 20 3a 3a 64 61 74 65 74 o exists ::datet
dbc0: 69 6d 65 5f 66 6f 72 6d 61 74 5d 20 26 26 20 5c ime_format] && \
dbd0: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 .. [str
dbe0: 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 64 61 ing length $::da
dbf0: 74 65 74 69 6d 65 5f 66 6f 72 6d 61 74 5d 20 3e tetime_format] >
dc00: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
dc10: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
dc20: 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 74 68 NOTE: Return th
dc30: 65 20 6d 61 6e 75 61 6c 6c 79 20 6f 76 65 72 72 e manually overr
dc40: 69 64 64 65 6e 20 76 61 6c 75 65 20 66 6f 72 20 idden value for
dc50: 74 68 65 20 44 61 74 65 54 69 6d 65 20 66 6f 72 the DateTime for
dc60: 6d 61 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d mat... #.
dc70: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
dc80: 24 3a 3a 64 61 74 65 74 69 6d 65 5f 66 6f 72 6d $::datetime_form
dc90: 61 74 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 at.. } else
dca0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
dcb0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 # NOTE: R
dcc0: 65 74 75 72 6e 20 61 6e 20 49 53 4f 38 36 30 31 eturn an ISO8601
dcd0: 20 44 61 74 65 54 69 6d 65 20 66 6f 72 6d 61 74 DateTime format
dce0: 20 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74 68 compatible with
dcf0: 20 53 51 4c 69 74 65 2c 0d 0a 20 20 20 20 20 20 SQLite,..
dd00: 20 20 23 20 20 20 20 20 20 20 53 79 73 74 65 6d # System
dd10: 2e 44 61 74 61 2e 53 51 4c 69 74 65 2c 20 61 6e .Data.SQLite, an
dd20: 64 20 73 75 69 74 61 62 6c 65 20 66 6f 72 20 72 d suitable for r
dd30: 6f 75 6e 64 2d 74 72 69 70 70 69 6e 67 20 77 69 ound-tripping wi
dd40: 74 68 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 th the..
dd50: 23 20 20 20 20 20 20 20 44 61 74 65 54 69 6d 65 # DateTime
dd60: 20 63 6c 61 73 73 20 6f 66 20 74 68 65 20 66 72 class of the fr
dd70: 61 6d 65 77 6f 72 6b 2e 20 20 49 66 20 74 68 69 amework. If thi
dd80: 73 20 76 61 6c 75 65 20 69 73 20 63 68 61 6e 67 s value is chang
dd90: 65 64 2c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ed,.. #
dda0: 20 20 20 20 20 76 61 72 69 6f 75 73 20 74 65 73 various tes
ddb0: 74 73 20 6d 61 79 20 66 61 69 6c 2e 0d 0a 20 20 ts may fail...
ddc0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
ddd0: 20 72 65 74 75 72 6e 20 22 79 79 79 79 2d 4d 4d return "yyyy-MM
dde0: 2d 64 64 20 48 48 3a 6d 6d 3a 73 73 2e 46 46 46 -dd HH:mm:ss.FFF
ddf0: 46 46 46 46 4b 22 0d 0a 20 20 20 20 20 20 7d 0d FFFFK".. }.
de00: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
de10: 72 6f 63 20 65 6e 75 6d 65 72 61 62 6c 65 54 6f roc enumerableTo
de20: 4c 69 73 74 20 7b 20 65 6e 75 6d 65 72 61 62 6c List { enumerabl
de30: 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 e } {.. set
de40: 20 72 65 73 75 6c 74 20 5b 6c 69 73 74 5d 0d 0a result [list]..
de50: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
de60: 69 6e 67 20 6c 65 6e 67 74 68 20 24 65 6e 75 6d ing length $enum
de70: 65 72 61 62 6c 65 5d 20 3d 3d 20 30 20 7c 7c 20 erable] == 0 ||
de80: 24 65 6e 75 6d 65 72 61 62 6c 65 20 65 71 20 22 $enumerable eq "
de90: 6e 75 6c 6c 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 null"} then {..
dea0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 72 return $r
deb0: 65 73 75 6c 74 0d 0a 20 20 20 20 20 20 7d 0d 0a esult.. }..
dec0: 0d 0a 20 20 20 20 20 20 6f 62 6a 65 63 74 20 66 .. object f
ded0: 6f 72 65 61 63 68 20 2d 61 6c 69 61 73 20 69 74 oreach -alias it
dee0: 65 6d 20 24 65 6e 75 6d 65 72 61 62 6c 65 20 7b em $enumerable {
def0: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 .. if {[s
df00: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 69 74 tring length $it
df10: 65 6d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d em] > 0} then {.
df20: 0a 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 65 . lappe
df30: 6e 64 20 72 65 73 75 6c 74 20 5b 24 69 74 65 6d nd result [$item
df40: 20 54 6f 53 74 72 69 6e 67 5d 0d 0a 20 20 20 20 ToString]..
df50: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
df60: 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 .. return $
df70: 72 65 73 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c result.. }...
df80: 0d 0a 20 20 20 20 70 72 6f 63 20 63 61 74 63 68 .. proc catch
df90: 41 6e 64 52 65 74 75 72 6e 20 7b 20 73 63 72 69 AndReturn { scri
dfa0: 70 74 20 7b 73 74 61 63 6b 54 72 61 63 65 20 66 pt {stackTrace f
dfb0: 61 6c 73 65 7d 20 7b 73 74 72 69 63 74 20 74 72 alse} {strict tr
dfc0: 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ue} } {.. #
dfd0: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
dfe0: 45 76 61 6c 75 61 74 65 20 74 68 65 20 73 63 72 Evaluate the scr
dff0: 69 70 74 20 70 72 6f 76 69 64 65 64 20 62 79 20 ipt provided by
e000: 6f 75 72 20 63 61 6c 6c 65 72 20 69 6e 20 74 68 our caller in th
e010: 65 69 72 20 63 6f 6e 74 65 78 74 2c 0d 0a 20 20 eir context,..
e020: 20 20 20 20 23 20 20 20 20 20 20 20 63 61 70 74 # capt
e030: 75 72 69 6e 67 20 62 6f 74 68 20 74 68 65 20 72 uring both the r
e040: 65 73 75 6c 74 20 61 6e 64 20 74 68 65 20 72 65 esult and the re
e050: 74 75 72 6e 20 63 6f 64 65 2e 0d 0a 20 20 20 20 turn code...
e060: 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 63 #.. set c
e070: 6f 64 65 20 5b 63 61 74 63 68 20 7b 75 70 6c 65 ode [catch {uple
e080: 76 65 6c 20 31 20 24 73 63 72 69 70 74 7d 20 72 vel 1 $script} r
e090: 65 73 75 6c 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 esult]....
e0a0: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
e0b0: 20 44 69 64 20 74 68 65 20 73 63 72 69 70 74 20 Did the script
e0c0: 70 72 6f 76 69 64 65 64 20 62 79 20 6f 75 72 20 provided by our
e0d0: 63 61 6c 6c 65 72 20 4e 4f 54 20 72 61 69 73 65 caller NOT raise
e0e0: 20 61 6e 20 65 72 72 6f 72 3f 0d 0a 20 20 20 20 an error?..
e0f0: 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 #.. if {$
e100: 73 74 72 69 63 74 20 26 26 20 24 63 6f 64 65 20 strict && $code
e110: 3d 3d 20 30 20 7c 7c 20 21 24 73 74 72 69 63 74 == 0 || !$strict
e120: 20 26 26 20 24 63 6f 64 65 20 21 3d 20 31 7d 20 && $code != 1}
e130: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
e140: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
e150: 45 3a 20 53 75 63 63 65 73 73 2e 20 20 52 65 74 E: Success. Ret
e160: 75 72 6e 20 61 20 6c 69 73 74 20 77 69 74 68 20 urn a list with
e170: 74 68 65 20 72 65 74 75 72 6e 20 63 6f 64 65 20 the return code
e180: 61 6e 64 20 74 68 65 20 72 65 73 75 6c 74 2e 0d and the result..
e190: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
e1a0: 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 return [list
e1b0: 20 24 63 6f 64 65 20 24 72 65 73 75 6c 74 5d 0d $code $result].
e1c0: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 . } elseif
e1d0: 7b 24 73 74 61 63 6b 54 72 61 63 65 7d 20 74 68 {$stackTrace} th
e1e0: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
e1f0: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
e200: 20 46 61 69 6c 75 72 65 2e 20 20 4f 75 72 20 63 Failure. Our c
e210: 61 6c 6c 65 72 20 77 61 6e 74 73 20 61 20 66 75 aller wants a fu
e220: 6c 6c 20 73 74 61 63 6b 20 74 72 61 63 65 20 28 ll stack trace (
e230: 69 66 20 61 70 70 6c 69 63 61 62 6c 65 29 2c 0d if applicable),.
e240: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
e250: 20 72 65 74 75 72 6e 20 61 20 6c 69 73 74 20 77 return a list w
e260: 69 74 68 20 74 68 65 20 72 65 74 75 72 6e 20 63 ith the return c
e270: 6f 64 65 20 61 6e 64 20 74 68 65 20 72 65 73 75 ode and the resu
e280: 6c 74 20 76 65 72 62 61 74 69 6d 2e 0d 0a 20 20 lt verbatim...
e290: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
e2a0: 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 24 63 return [list $c
e2b0: 6f 64 65 20 24 72 65 73 75 6c 74 5d 0d 0a 20 20 ode $result]..
e2c0: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
e2d0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
e2e0: 20 23 20 4e 4f 54 45 3a 20 46 61 69 6c 75 72 65 # NOTE: Failure
e2f0: 2e 20 20 4f 75 72 20 63 61 6c 6c 65 72 20 64 6f . Our caller do
e300: 65 73 20 6e 6f 74 20 77 61 6e 74 20 61 20 66 75 es not want a fu
e310: 6c 6c 20 73 74 61 63 6b 20 74 72 61 63 65 20 28 ll stack trace (
e320: 69 66 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 if.. #
e330: 20 20 20 20 61 70 70 6c 69 63 61 62 6c 65 29 2c applicable),
e340: 20 72 65 74 75 72 6e 20 61 20 6c 69 73 74 20 77 return a list w
e350: 69 74 68 20 74 68 65 20 72 65 74 75 72 6e 20 63 ith the return c
e360: 6f 64 65 2c 20 74 68 65 20 65 72 72 6f 72 0d 0a ode, the error..
e370: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
e380: 63 6f 64 65 20 66 6f 72 20 74 68 65 20 69 6e 74 code for the int
e390: 65 72 70 72 65 74 65 72 2c 20 61 6e 64 20 74 68 erpreter, and th
e3a0: 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65 20 e error message
e3b0: 75 70 20 74 6f 20 74 68 65 0d 0a 20 20 20 20 20 up to the..
e3c0: 20 20 20 23 20 20 20 20 20 20 20 70 6f 69 6e 74 # point
e3d0: 20 77 68 65 72 65 20 74 68 65 20 73 74 61 63 6b where the stack
e3e0: 20 74 72 61 63 65 20 73 68 6f 75 6c 64 20 73 74 trace should st
e3f0: 61 72 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d art... #.
e400: 0a 20 20 20 20 20 20 20 20 73 65 74 20 69 6e 64 . set ind
e410: 65 78 20 5b 73 74 72 69 6e 67 20 66 69 72 73 74 ex [string first
e420: 20 22 20 20 20 61 74 20 22 20 24 72 65 73 75 6c " at " $resul
e430: 74 5d 3b 20 23 20 48 41 43 4b 3a 20 52 65 6c 69 t]; # HACK: Reli
e440: 61 62 6c 65 3f 0d 0a 0d 0a 20 20 20 20 20 20 20 able?....
e450: 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 24 63 return [list $c
e460: 6f 64 65 20 24 3a 3a 65 72 72 6f 72 43 6f 64 65 ode $::errorCode
e470: 20 5b 65 78 70 72 20 7b 24 69 6e 64 65 78 20 21 [expr {$index !
e480: 3d 20 2d 31 20 3f 20 5c 0d 0a 20 20 20 20 20 20 = -1 ? \..
e490: 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 74 72 [string tr
e4a0: 69 6d 20 5b 73 74 72 69 6e 67 20 72 61 6e 67 65 im [string range
e4b0: 20 24 72 65 73 75 6c 74 20 30 20 24 69 6e 64 65 $result 0 $inde
e4c0: 78 5d 5d 20 3a 20 24 72 65 73 75 6c 74 7d 5d 5d x]] : $result}]]
e4d0: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
e4e0: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 6f ..... proc co
e4f0: 6d 70 69 6c 65 43 53 68 61 72 70 57 69 74 68 20 mpileCSharpWith
e500: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
e510: 65 78 74 20 6d 65 6d 6f 72 79 20 73 79 6d 62 6f ext memory symbo
e520: 6c 73 20 73 74 72 69 63 74 20 72 65 73 75 6c 74 ls strict result
e530: 73 56 61 72 4e 61 6d 65 20 65 72 72 6f 72 73 56 sVarName errorsV
e540: 61 72 4e 61 6d 65 20 66 69 6c 65 4e 61 6d 65 73 arName fileNames
e550: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 61 72 .. ar
e560: 67 73 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d gs } {.. #.
e570: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 . # NOTE: S
e580: 69 6e 63 65 20 77 65 20 61 72 65 20 67 6f 69 6e ince we are goin
e590: 67 20 74 6f 20 75 73 65 20 74 68 69 73 20 6d 65 g to use this me
e5a0: 74 68 6f 64 20 6e 61 6d 65 20 61 20 6c 6f 74 2c thod name a lot,
e5b0: 20 61 73 73 69 67 6e 20 69 74 20 74 6f 20 61 0d assign it to a.
e5c0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 . # v
e5d0: 61 72 69 61 62 6c 65 20 66 69 72 73 74 2e 0d 0a ariable first...
e5e0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 #.. s
e5f0: 65 74 20 61 64 64 20 52 65 66 65 72 65 6e 63 65 et add Reference
e600: 64 41 73 73 65 6d 62 6c 69 65 73 2e 41 64 64 0d dAssemblies.Add.
e610: 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
e620: 20 20 23 20 4e 4f 54 45 3a 20 43 72 65 61 74 65 # NOTE: Create
e630: 20 74 68 65 20 62 61 73 65 20 63 6f 6d 6d 61 6e the base comman
e640: 64 20 74 6f 20 65 76 61 6c 75 61 74 65 20 61 6e d to evaluate an
e650: 64 20 61 64 64 20 74 68 65 20 70 72 6f 70 65 72 d add the proper
e660: 74 79 20 73 65 74 74 69 6e 67 73 0d 0a 20 20 20 ty settings..
e670: 20 20 20 23 20 20 20 20 20 20 20 74 68 61 74 20 # that
e680: 61 72 65 20 61 6c 6d 6f 73 74 20 61 6c 77 61 79 are almost alway
e690: 73 20 6e 65 65 64 65 64 20 62 79 20 6f 75 72 20 s needed by our
e6a0: 75 6e 69 74 20 74 65 73 74 73 20 28 69 2e 65 2e unit tests (i.e.
e6b0: 20 74 68 65 20 53 79 73 74 65 6d 0d 0a 20 20 20 the System..
e6c0: 20 20 20 23 20 20 20 20 20 20 20 61 6e 64 20 53 # and S
e6d0: 79 73 74 65 6d 2e 44 61 74 61 20 61 73 73 65 6d ystem.Data assem
e6e0: 62 6c 79 20 72 65 66 65 72 65 6e 63 65 73 29 2e bly references).
e6f0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
e700: 20 73 65 74 20 63 6f 6d 6d 61 6e 64 20 5b 6c 69 set command [li
e710: 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 st \..
e720: 63 6f 6d 70 69 6c 65 43 53 68 61 72 70 20 24 74 compileCSharp $t
e730: 65 78 74 20 24 6d 65 6d 6f 72 79 20 24 73 79 6d ext $memory $sym
e740: 62 6f 6c 73 20 24 73 74 72 69 63 74 20 72 65 73 bols $strict res
e750: 75 6c 74 73 20 65 72 72 6f 72 73 20 5c 0d 0a 20 ults errors \..
e760: 20 20 20 20 20 20 20 20 20 24 61 64 64 20 53 79 $add Sy
e770: 73 74 65 6d 2e 64 6c 6c 20 24 61 64 64 20 53 79 stem.dll $add Sy
e780: 73 74 65 6d 2e 44 61 74 61 2e 64 6c 6c 20 24 61 stem.Data.dll $a
e790: 64 64 20 53 79 73 74 65 6d 2e 54 72 61 6e 73 61 dd System.Transa
e7a0: 63 74 69 6f 6e 73 2e 64 6c 6c 20 5c 0d 0a 20 20 ctions.dll \..
e7b0: 20 20 20 20 20 20 20 20 24 61 64 64 20 53 79 73 $add Sys
e7c0: 74 65 6d 2e 58 6d 6c 2e 64 6c 6c 5d 0d 0a 0d 0a tem.Xml.dll]....
e7d0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
e7e0: 20 4e 4f 54 45 3a 20 41 64 64 20 61 6c 6c 20 74 NOTE: Add all t
e7f0: 68 65 20 70 72 6f 76 69 64 65 64 20 66 69 6c 65 he provided file
e800: 20 6e 61 6d 65 73 20 61 73 20 61 73 73 65 6d 62 names as assemb
e810: 6c 79 20 72 65 66 65 72 65 6e 63 65 73 2e 0d 0a ly references...
e820: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 66 #.. f
e830: 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 oreach fileName
e840: 24 66 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 $fileNames {..
e850: 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 63 6f lappend co
e860: 6d 6d 61 6e 64 20 24 61 64 64 20 5b 67 65 74 42 mmand $add [getB
e870: 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 inaryFileName $f
e880: 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 ileName]..
e890: 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
e8a0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 # NOTE: Add
e8b0: 74 68 65 20 65 78 74 72 61 20 61 72 67 75 6d 65 the extra argume
e8c0: 6e 74 73 2c 20 69 66 20 61 6e 79 2c 20 74 6f 20 nts, if any, to
e8d0: 74 68 65 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 65 the command to e
e8e0: 76 61 6c 75 61 74 65 2e 0d 0a 20 20 20 20 20 20 valuate...
e8f0: 23 0d 0a 20 20 20 20 20 20 65 76 61 6c 20 6c 61 #.. eval la
e900: 70 70 65 6e 64 20 63 6f 6d 6d 61 6e 64 20 24 61 ppend command $a
e910: 72 67 73 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a rgs.... #..
e920: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 6c # NOTE: Al
e930: 69 61 73 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 ias the compiler
e940: 20 6c 6f 63 61 6c 20 72 65 73 75 6c 74 73 20 61 local results a
e950: 6e 64 20 65 72 72 6f 72 73 20 76 61 72 69 61 62 nd errors variab
e960: 6c 65 73 20 74 6f 20 74 68 65 0d 0a 20 20 20 20 les to the..
e970: 20 20 23 20 20 20 20 20 20 20 76 61 72 69 61 62 # variab
e980: 6c 65 20 6e 61 6d 65 73 20 70 72 6f 76 69 64 65 le names provide
e990: 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 2e d by our caller.
e9a0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
e9b0: 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
e9c0: 67 74 68 20 24 72 65 73 75 6c 74 73 56 61 72 4e gth $resultsVarN
e9d0: 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ame] > 0} then {
e9e0: 0d 0a 20 20 20 20 20 20 20 20 75 70 76 61 72 20 .. upvar
e9f0: 31 20 24 72 65 73 75 6c 74 73 56 61 72 4e 61 6d 1 $resultsVarNam
ea00: 65 20 72 65 73 75 6c 74 73 0d 0a 20 20 20 20 20 e results..
ea10: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b }.... if {
ea20: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
ea30: 65 72 72 6f 72 73 56 61 72 4e 61 6d 65 5d 20 3e errorsVarName] >
ea40: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
ea50: 20 20 20 20 75 70 76 61 72 20 31 20 24 65 72 72 upvar 1 $err
ea60: 6f 72 73 56 61 72 4e 61 6d 65 20 65 72 72 6f 72 orsVarName error
ea70: 73 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 s.. }....
ea80: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
ea90: 4f 54 45 3a 20 45 76 61 6c 75 61 74 65 20 74 68 OTE: Evaluate th
eaa0: 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 5b 63 e constructed [c
eab0: 6f 6d 70 69 6c 65 43 53 68 61 72 70 5d 20 63 6f ompileCSharp] co
eac0: 6d 6d 61 6e 64 20 61 6e 64 20 72 65 74 75 72 6e mmand and return
ead0: 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 the.. #
eae0: 20 20 20 20 72 65 73 75 6c 74 2e 0d 0a 20 20 20 result...
eaf0: 20 20 20 23 0d 0a 20 20 20 20 20 20 65 76 61 6c #.. eval
eb00: 20 24 63 6f 6d 6d 61 6e 64 0d 0a 20 20 20 20 7d $command.. }
eb10: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 69 73 ..... proc is
eb20: 4d 65 6d 6f 72 79 44 62 20 7b 20 66 69 6c 65 4e MemoryDb { fileN
eb30: 61 6d 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ame } {.. #
eb40: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
eb50: 49 73 20 74 68 65 20 73 70 65 63 69 66 69 65 64 Is the specified
eb60: 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 6e database file n
eb70: 61 6d 65 20 72 65 61 6c 6c 79 20 61 6e 20 69 6e ame really an in
eb80: 2d 6d 65 6d 6f 72 79 20 64 61 74 61 62 61 73 65 -memory database
eb90: 3f 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ?.. #..
eba0: 20 20 72 65 74 75 72 6e 20 5b 65 78 70 72 20 7b return [expr {
ebb0: 24 66 69 6c 65 4e 61 6d 65 20 65 71 20 22 3a 6d $fileName eq ":m
ebc0: 65 6d 6f 72 79 3a 22 20 7c 7c 20 5c 0d 0a 20 20 emory:" || \..
ebd0: 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
ebe0: 72 61 6e 67 65 20 24 66 69 6c 65 4e 61 6d 65 20 range $fileName
ebf0: 30 20 31 32 5d 20 65 71 20 22 66 69 6c 65 3a 3a 0 12] eq "file::
ec00: 6d 65 6d 6f 72 79 3a 22 7d 5d 0d 0a 20 20 20 20 memory:"}]..
ec10: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 69 }..... proc i
ec20: 73 54 61 62 6c 65 49 6e 44 62 20 7b 20 6e 61 6d sTableInDb { nam
ec30: 65 20 7b 76 61 72 4e 61 6d 65 20 64 62 7d 20 7d e {varName db} }
ec40: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
ec50: 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 # NOTE: Refer
ec60: 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 to the specifie
ec70: 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e d variable (e.g.
ec80: 20 22 64 62 22 29 20 69 6e 20 74 68 65 20 63 6f "db") in the co
ec90: 6e 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a 20 20 ntext of our..
eca0: 20 20 20 20 23 20 20 20 20 20 20 20 63 61 6c 6c # call
ecb0: 65 72 2e 20 20 49 74 20 63 6f 6e 74 61 69 6e 73 er. It contains
ecc0: 20 74 68 65 20 64 61 74 61 62 61 73 65 20 63 6f the database co
ecd0: 6e 6e 65 63 74 69 6f 6e 20 68 61 6e 64 6c 65 20 nnection handle
ece0: 74 68 61 74 20 77 69 6c 6c 20 62 65 0d 0a 20 20 that will be..
ecf0: 20 20 20 20 23 20 20 20 20 20 20 20 75 73 65 64 # used
ed00: 20 74 6f 20 65 78 65 63 75 74 65 20 74 68 65 20 to execute the
ed10: 71 75 65 72 79 20 75 73 65 64 20 74 6f 20 64 65 query used to de
ed20: 74 65 72 6d 69 6e 65 20 69 66 20 74 68 65 20 6e termine if the n
ed30: 61 6d 65 64 20 74 61 62 6c 65 20 69 73 0d 0a 20 amed table is..
ed40: 20 20 20 20 20 23 20 20 20 20 20 20 20 70 72 65 # pre
ed50: 73 65 6e 74 20 69 6e 20 74 68 61 74 20 64 61 74 sent in that dat
ed60: 61 62 61 73 65 2e 0d 0a 20 20 20 20 20 20 23 0d abase... #.
ed70: 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 . upvar 1 $
ed80: 76 61 72 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 varName db....
ed90: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
eda0: 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 71 6c OTE: Use the sql
edb0: 69 74 65 5f 6d 61 73 74 65 72 20 74 61 62 6c 65 ite_master table
edc0: 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 69 66 to determine if
edd0: 20 74 68 65 20 6e 61 6d 65 64 20 74 61 62 6c 65 the named table
ede0: 20 69 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 is.. #
edf0: 20 20 20 70 72 65 73 65 6e 74 20 69 6e 20 74 68 present in th
ee00: 65 20 64 61 74 61 62 61 73 65 2e 0d 0a 20 20 20 e database...
ee10: 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 #.. set
ee20: 73 71 6c 20 7b 0d 0a 20 20 20 20 20 20 20 20 53 sql {.. S
ee30: 45 4c 45 43 54 20 43 4f 55 4e 54 28 2a 29 20 46 ELECT COUNT(*) F
ee40: 52 4f 4d 20 73 71 6c 69 74 65 5f 6d 61 73 74 65 ROM sqlite_maste
ee50: 72 20 57 48 45 52 45 20 74 79 70 65 20 3d 20 27 r WHERE type = '
ee60: 74 61 62 6c 65 27 20 41 4e 44 20 6e 61 6d 65 20 table' AND name
ee70: 3d 20 3f 3b 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d = ?;.. }...
ee80: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
ee90: 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 6e # NOTE: Return n
eea0: 6f 6e 2d 7a 65 72 6f 20 69 66 20 74 68 65 20 6e on-zero if the n
eeb0: 61 6d 65 64 20 74 61 62 6c 65 20 69 73 20 70 72 amed table is pr
eec0: 65 73 65 6e 74 2e 0d 0a 20 20 20 20 20 20 23 0d esent... #.
eed0: 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 65 . return [e
eee0: 78 70 72 20 7b 0d 0a 20 20 20 20 20 20 20 20 5b xpr {.. [
eef0: 73 71 6c 20 65 78 65 63 75 74 65 20 2d 65 78 65 sql execute -exe
ef00: 63 75 74 65 20 73 63 61 6c 61 72 20 24 64 62 20 cute scalar $db
ef10: 24 73 71 6c 20 5b 6c 69 73 74 20 70 61 72 61 6d $sql [list param
ef20: 31 20 53 74 72 69 6e 67 20 24 6e 61 6d 65 5d 5d 1 String $name]]
ef30: 20 3e 20 30 0d 0a 20 20 20 20 20 20 7d 5d 0d 0a > 0.. }]..
ef40: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
ef50: 6f 63 20 74 72 69 6d 53 71 6c 20 7b 20 73 71 6c oc trimSql { sql
ef60: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 72 65 74 75 } {.. retu
ef70: 72 6e 20 5b 72 65 67 73 75 62 20 2d 61 6c 6c 20 rn [regsub -all
ef80: 2d 2d 20 7b 5c 73 2b 7d 20 5b 73 74 72 69 6e 67 -- {\s+} [string
ef90: 20 74 72 69 6d 20 24 73 71 6c 5d 20 22 20 22 5d trim $sql] " "]
efa0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
efb0: 70 72 6f 63 20 65 78 65 63 75 74 65 53 71 6c 20 proc executeSql
efc0: 7b 20 73 71 6c 20 7b 65 78 65 63 75 74 65 20 6e { sql {execute n
efd0: 6f 6e 65 7d 20 7b 66 6f 72 6d 61 74 20 6e 6f 6e one} {format non
efe0: 65 7d 20 7b 66 69 6c 65 4e 61 6d 65 20 22 22 7d e} {fileName ""}
eff0: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b } {.. if {
f000: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
f010: 66 69 6c 65 4e 61 6d 65 5d 20 3d 3d 20 30 7d 20 fileName] == 0}
f020: 74 68 65 6e 20 7b 73 65 74 20 66 69 6c 65 4e 61 then {set fileNa
f030: 6d 65 20 3a 6d 65 6d 6f 72 79 3a 7d 0d 0a 20 20 me :memory:}..
f040: 20 20 20 20 73 65 74 75 70 44 62 20 24 66 69 6c setupDb $fil
f050: 65 4e 61 6d 65 20 22 22 20 22 22 20 22 22 20 22 eName "" "" "" "
f060: 22 20 22 22 20 66 61 6c 73 65 20 66 61 6c 73 65 " "" false false
f070: 20 66 61 6c 73 65 20 66 61 6c 73 65 20 64 62 20 false false db
f080: 74 72 75 65 0d 0a 0d 0a 20 20 20 20 20 20 74 72 true.... tr
f090: 79 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 y {.. ret
f0a0: 75 72 6e 20 5b 75 70 6c 65 76 65 6c 20 31 20 5b urn [uplevel 1 [
f0b0: 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 list \..
f0c0: 20 20 20 20 73 71 6c 20 65 78 65 63 75 74 65 20 sql execute
f0d0: 2d 65 78 65 63 75 74 65 20 24 65 78 65 63 75 74 -execute $execut
f0e0: 65 20 2d 66 6f 72 6d 61 74 20 24 66 6f 72 6d 61 e -format $forma
f0f0: 74 20 24 64 62 20 24 73 71 6c 5d 5d 0d 0a 20 20 t $db $sql]]..
f100: 20 20 20 20 7d 20 66 69 6e 61 6c 6c 79 20 7b 0d } finally {.
f110: 0a 20 20 20 20 20 20 20 20 63 6c 65 61 6e 75 70 . cleanup
f120: 44 62 20 24 66 69 6c 65 4e 61 6d 65 20 64 62 20 Db $fileName db
f130: 66 61 6c 73 65 20 66 61 6c 73 65 20 66 61 6c 73 false false fals
f140: 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 e.. }..
f150: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 68 }..... proc h
f160: 61 73 4e 6f 46 6c 61 67 73 20 7b 20 76 61 72 4e asNoFlags { varN
f170: 61 6d 65 20 6e 6f 6e 65 20 7d 20 7b 0d 0a 20 20 ame none } {..
f180: 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 upvar 1 $var
f190: 4e 61 6d 65 20 66 6c 61 67 73 0d 0a 0d 0a 20 20 Name flags....
f1a0: 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
f1b0: 78 69 73 74 73 20 66 6c 61 67 73 5d 7d 20 74 68 xists flags]} th
f1c0: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 en {.. re
f1d0: 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 turn true..
f1e0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b }.... if {
f1f0: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
f200: 66 6c 61 67 73 5d 20 3d 3d 20 30 7d 20 74 68 65 flags] == 0} the
f210: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 n {.. ret
f220: 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 urn true..
f230: 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 }.... if {$
f240: 6e 6f 6e 65 20 26 26 20 24 66 6c 61 67 73 20 65 none && $flags e
f250: 71 20 22 4e 6f 6e 65 22 7d 20 74 68 65 6e 20 7b q "None"} then {
f260: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
f270: 20 74 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a true.. }..
f280: 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 .. return f
f290: 61 6c 73 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a alse.. }.....
f2a0: 20 20 20 20 70 72 6f 63 20 67 65 74 43 6f 6e 6e proc getConn
f2b0: 65 63 74 69 6f 6e 46 6c 61 67 73 20 7b 20 66 69 ectionFlags { fi
f2c0: 6c 65 4e 61 6d 65 20 66 6c 61 67 73 20 7b 71 75 leName flags {qu
f2d0: 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a iet false} } {..
f2e0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
f2f0: 20 4e 4f 54 45 3a 20 46 69 67 75 72 65 20 6f 75 NOTE: Figure ou
f300: 74 20 77 68 69 63 68 20 64 61 74 61 62 61 73 65 t which database
f310: 20 66 69 6c 65 20 6e 61 6d 65 20 6f 72 20 63 6f file name or co
f320: 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 20 nnection string
f330: 74 68 65 73 65 0d 0a 20 20 20 20 20 20 23 20 20 these.. #
f340: 20 20 20 20 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 connection
f350: 66 6c 61 67 73 20 77 69 6c 6c 20 61 63 74 75 61 flags will actua
f360: 6c 6c 79 20 61 70 70 6c 79 20 74 6f 2e 20 20 54 lly apply to. T
f370: 68 69 73 20 69 73 20 6e 6f 74 20 6e 65 63 65 73 his is not neces
f380: 73 61 72 79 0d 0a 20 20 20 20 20 20 23 20 20 20 sary.. #
f390: 20 20 20 20 69 6e 20 71 75 69 65 74 20 6d 6f 64 in quiet mod
f3a0: 65 20 62 65 63 61 75 73 65 20 74 68 69 73 20 69 e because this i
f3b0: 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 6f 6e nformation is on
f3c0: 6c 79 20 75 73 65 64 20 66 6f 72 20 6c 6f 67 67 ly used for logg
f3d0: 69 6e 67 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ing.. #
f3e0: 20 20 20 61 6e 64 20 72 65 70 6f 72 74 69 6e 67 and reporting
f3f0: 20 70 75 72 70 6f 73 65 73 2e 0d 0a 20 20 20 20 purposes...
f400: 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
f410: 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
f420: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 if {[str
f430: 69 6e 67 20 6c 65 6e 67 74 68 20 24 66 69 6c 65 ing length $file
f440: 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 Name] > 0} then
f450: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 {.. set
f460: 20 64 61 74 61 62 61 73 65 20 5b 61 70 70 65 6e database [appen
f470: 64 41 72 67 73 20 22 66 69 6c 65 20 6e 61 6d 65 dArgs "file name
f480: 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c \"" $fileName \
f490: 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c "].. } el
f4a0: 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 seif {[info exis
f4b0: 74 73 20 3a 3a 64 61 74 61 53 6f 75 72 63 65 5d ts ::dataSource]
f4c0: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
f4d0: 20 20 20 21 5b 61 72 72 61 79 20 65 78 69 73 74 ![array exist
f4e0: 73 20 3a 3a 64 61 74 61 53 6f 75 72 63 65 5d 7d s ::dataSource]}
f4f0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
f500: 20 20 20 73 65 74 20 64 61 74 61 62 61 73 65 20 set database
f510: 5b 61 70 70 65 6e 64 41 72 67 73 20 22 64 61 74 [appendArgs "dat
f520: 61 20 73 6f 75 72 63 65 20 5c 22 22 20 24 3a 3a a source \"" $::
f530: 64 61 74 61 53 6f 75 72 63 65 20 5c 22 5d 0d 0a dataSource \"]..
f540: 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
f550: 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
f560: 64 61 74 61 62 61 73 65 20 3c 75 6e 6b 6e 6f 77 database <unknow
f570: 6e 3e 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 n>.. }..
f580: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
f590: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
f5a0: 20 53 68 6f 77 20 28 61 6e 64 20 6c 6f 67 29 20 Show (and log)
f5b0: 74 68 65 20 6c 6f 63 61 6c 20 63 6f 6e 6e 65 63 the local connec
f5c0: 74 69 6f 6e 20 66 6c 61 67 73 20 61 6e 64 20 74 tion flags and t
f5d0: 68 65 20 61 73 73 6f 63 69 61 74 65 64 0d 0a 20 he associated..
f5e0: 20 20 20 20 20 23 20 20 20 20 20 20 20 64 61 74 # dat
f5f0: 61 20 73 6f 75 72 63 65 20 6f 72 20 66 69 6c 65 a source or file
f600: 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 20 23 0d name... #.
f610: 0a 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 . if {!$qui
f620: 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
f630: 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
f640: 78 69 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 4c xists ::no(emitL
f650: 6f 63 61 6c 46 6c 61 67 73 29 5d 20 26 26 20 5c ocalFlags)] && \
f660: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 21 .. (!
f670: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
f680: 6f 28 65 6d 69 74 4c 6f 63 61 6c 46 6c 61 67 73 o(emitLocalFlags
f690: 49 66 4e 6f 6e 65 29 5d 20 7c 7c 20 5c 0d 0a 20 IfNone)] || \..
f6a0: 20 20 20 20 20 20 20 20 20 20 20 20 21 5b 68 61 ![ha
f6b0: 73 4e 6f 46 6c 61 67 73 20 66 6c 61 67 73 20 66 sNoFlags flags f
f6c0: 61 6c 73 65 5d 29 7d 20 74 68 65 6e 20 7b 0d 0a alse])} then {..
f6d0: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
f6e0: 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
f6f0: 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
f700: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
f710: 2d 2d 20 6c 6f 63 61 6c 20 63 6f 6e 6e 65 63 74 -- local connect
f720: 69 6f 6e 20 66 6c 61 67 73 20 66 6f 72 20 22 20 ion flags for "
f730: 24 64 61 74 61 62 61 73 65 20 5c 0d 0a 20 20 20 $database \..
f740: 20 20 20 20 20 20 20 20 20 20 20 22 20 61 72 65 " are
f750: 3a 20 22 20 5b 65 78 70 72 20 7b 21 5b 68 61 73 : " [expr {![has
f760: 4e 6f 46 6c 61 67 73 20 66 6c 61 67 73 20 66 61 NoFlags flags fa
f770: 6c 73 65 5d 20 3f 20 5c 0d 0a 20 20 20 20 20 20 lse] ? \..
f780: 20 20 20 20 20 20 20 20 5b 61 70 70 65 6e 64 41 [appendA
f790: 72 67 73 20 5c 22 20 24 66 6c 61 67 73 20 5c 22 rgs \" $flags \"
f7a0: 5d 20 3a 20 22 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c ] : "<none>"}] \
f7b0: 6e 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 n].. }..
f7c0: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
f7d0: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
f7e0: 20 53 68 6f 77 20 28 61 6e 64 20 6c 6f 67 29 20 Show (and log)
f7f0: 74 68 65 20 73 68 61 72 65 64 20 63 6f 6e 6e 65 the shared conne
f800: 63 74 69 6f 6e 20 66 6c 61 67 73 2e 0d 0a 20 20 ction flags...
f810: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
f820: 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
f830: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 .. if {[c
f840: 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
f850: 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
f860: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
f870: 74 65 2e 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 te.SQLiteConnect
f880: 69 6f 6e 20 53 68 61 72 65 64 46 6c 61 67 73 0d ion SharedFlags.
f890: 0a 20 20 20 20 20 20 20 20 7d 20 73 68 61 72 65 . } share
f8a0: 64 46 6c 61 67 73 5d 20 3d 3d 20 30 7d 20 74 68 dFlags] == 0} th
f8b0: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
f8c0: 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
f8d0: 73 20 3a 3a 6e 6f 28 65 6d 69 74 53 68 61 72 65 s ::no(emitShare
f8e0: 64 46 6c 61 67 73 29 5d 20 26 26 20 5c 0d 0a 20 dFlags)] && \..
f8f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 21 5b (![
f900: 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
f910: 28 65 6d 69 74 53 68 61 72 65 64 46 6c 61 67 73 (emitSharedFlags
f920: 49 66 4e 6f 6e 65 29 5d 20 7c 7c 20 5c 0d 0a 20 IfNone)] || \..
f930: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 21 5b ![
f940: 68 61 73 4e 6f 46 6c 61 67 73 20 73 68 61 72 65 hasNoFlags share
f950: 64 46 6c 61 67 73 20 74 72 75 65 5d 29 7d 20 74 dFlags true])} t
f960: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
f970: 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
f980: 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
f990: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
f9a0: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 68 "---- sh
f9b0: 61 72 65 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 ared connection
f9c0: 66 6c 61 67 73 20 66 6f 72 20 22 20 24 64 61 74 flags for " $dat
f9d0: 61 62 61 73 65 20 5c 0d 0a 20 20 20 20 20 20 20 abase \..
f9e0: 20 20 20 20 20 20 20 20 20 22 20 61 72 65 3a 20 " are:
f9f0: 22 20 5b 65 78 70 72 20 7b 21 5b 68 61 73 4e 6f " [expr {![hasNo
fa00: 46 6c 61 67 73 20 73 68 61 72 65 64 46 6c 61 67 Flags sharedFlag
fa10: 73 20 74 72 75 65 5d 20 3f 20 5c 0d 0a 20 20 20 s true] ? \..
fa20: 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 61 70 [ap
fa30: 70 65 6e 64 41 72 67 73 20 5c 22 20 24 73 68 61 pendArgs \" $sha
fa40: 72 65 64 46 6c 61 67 73 20 5c 22 5d 20 3a 20 22 redFlags \"] : "
fa50: 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c 6e 5d 0d 0a 20 <none>"}] \n]..
fa60: 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
fa70: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
fa80: 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
fa90: 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 fo exists ::no(e
faa0: 6d 69 74 53 68 61 72 65 64 46 6c 61 67 73 29 5d mitSharedFlags)]
fab0: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
fac0: 20 20 20 20 20 21 5b 69 6e 66 6f 20 65 78 69 73 ![info exis
fad0: 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 53 68 61 72 ts ::no(emitShar
fae0: 65 64 46 6c 61 67 73 49 66 55 6e 61 76 61 69 6c edFlagsIfUnavail
faf0: 61 62 6c 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a able)]} then {..
fb00: 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
fb10: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
fb20: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
fb30: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
fb40: 20 22 2d 2d 2d 2d 20 73 68 61 72 65 64 20 63 6f "---- shared co
fb50: 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 66 nnection flags f
fb60: 6f 72 20 22 20 24 64 61 74 61 62 61 73 65 20 5c or " $database \
fb70: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
fb80: 20 20 22 20 61 72 65 3a 20 3c 75 6e 61 76 61 69 " are: <unavai
fb90: 6c 61 62 6c 65 3e 5c 6e 22 5d 0d 0a 20 20 20 20 lable>\n"]..
fba0: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
fbb0: 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }.. }....
fbc0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
fbd0: 4e 4f 54 45 3a 20 53 68 6f 77 20 28 61 6e 64 20 NOTE: Show (and
fbe0: 6c 6f 67 29 20 74 68 65 20 64 65 74 65 63 74 65 log) the detecte
fbf0: 64 20 67 6c 6f 62 61 6c 20 63 6f 6e 6e 65 63 74 d global connect
fc00: 69 6f 6e 20 66 6c 61 67 73 2c 20 69 66 20 61 6e ion flags, if an
fc10: 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 y... #..
fc20: 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
fc30: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
fc40: 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
fc50: 73 20 3a 3a 6e 6f 28 65 6d 69 74 47 6c 6f 62 61 s ::no(emitGloba
fc60: 6c 46 6c 61 67 73 29 5d 20 26 26 20 5c 0d 0a 20 lFlags)] && \..
fc70: 20 20 20 20 20 20 20 20 20 20 20 28 21 5b 69 6e (![in
fc80: 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 fo exists ::no(e
fc90: 6d 69 74 47 6c 6f 62 61 6c 46 6c 61 67 73 49 66 mitGlobalFlagsIf
fca0: 4e 6f 6e 65 29 5d 20 7c 7c 20 5c 0d 0a 20 20 20 None)] || \..
fcb0: 20 20 20 20 20 20 20 20 20 20 21 5b 68 61 73 4e ![hasN
fcc0: 6f 46 6c 61 67 73 20 3a 3a 63 6f 6e 6e 65 63 74 oFlags ::connect
fcd0: 69 6f 6e 5f 66 6c 61 67 73 20 66 61 6c 73 65 5d ion_flags false]
fce0: 29 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 )} then {..
fcf0: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
fd00: 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
fd10: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
fd20: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 67 6c "---- gl
fd30: 6f 62 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 obal connection
fd40: 66 6c 61 67 73 20 61 72 65 3a 20 22 20 5c 0d 0a flags are: " \..
fd50: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 65 [e
fd60: 78 70 72 20 7b 21 5b 68 61 73 4e 6f 46 6c 61 67 xpr {![hasNoFlag
fd70: 73 20 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 s ::connection_f
fd80: 6c 61 67 73 20 66 61 6c 73 65 5d 20 3f 20 5c 0d lags false] ? \.
fd90: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b . [
fda0: 61 70 70 65 6e 64 41 72 67 73 20 5c 22 20 24 3a appendArgs \" $:
fdb0: 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 6c 61 67 :connection_flag
fdc0: 73 20 5c 22 5d 20 3a 20 22 3c 6e 6f 6e 65 3e 22 s \"] : "<none>"
fdd0: 7d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 }] \n]..
fde0: 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
fdf0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
fe00: 4f 54 45 3a 20 49 66 20 74 68 65 72 65 20 61 72 OTE: If there ar
fe10: 65 20 61 6e 79 20 67 6c 6f 62 61 6c 20 28 70 65 e any global (pe
fe20: 72 20 74 65 73 74 20 72 75 6e 29 20 63 6f 6e 6e r test run) conn
fe30: 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 63 75 72 ection flags cur
fe40: 72 65 6e 74 6c 79 0d 0a 20 20 20 20 20 20 23 20 rently.. #
fe50: 20 20 20 20 20 20 73 65 74 2c 20 75 73 65 20 74 set, use t
fe60: 68 65 6d 20 6e 6f 77 20 28 69 2e 65 2e 20 62 79 hem now (i.e. by
fe70: 20 63 6f 6d 62 69 6e 69 6e 67 20 74 68 65 6d 20 combining them
fe80: 77 69 74 68 20 74 68 65 20 6f 6e 65 73 20 66 6f with the ones fo
fe90: 72 20 74 68 69 73 0d 0a 20 20 20 20 20 20 23 20 r this.. #
fea0: 20 20 20 20 20 20 63 6f 6e 6e 65 63 74 69 6f 6e connection
feb0: 29 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 )... #..
fec0: 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 if {[info exi
fed0: 73 74 73 20 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e sts ::connection
fee0: 5f 66 6c 61 67 73 5d 7d 20 74 68 65 6e 20 7b 0d _flags]} then {.
fef0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
ff00: 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 6f 6d 62 # NOTE: Comb
ff10: 69 6e 65 20 61 6e 64 2f 6f 72 20 72 65 70 6c 61 ine and/or repla
ff20: 63 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f ce the connectio
ff30: 6e 20 66 6c 61 67 73 20 61 6e 64 20 74 68 65 6e n flags and then
ff40: 20 73 68 6f 77 20 74 68 65 0d 0a 20 20 20 20 20 show the..
ff50: 20 20 20 23 20 20 20 20 20 20 20 6e 65 77 20 76 # new v
ff60: 61 6c 75 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 alue... #
ff70: 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 66 6c .. set fl
ff80: 61 67 73 20 5b 63 6f 6d 62 69 6e 65 46 6c 61 67 ags [combineFlag
ff90: 73 20 24 66 6c 61 67 73 20 24 3a 3a 63 6f 6e 6e s $flags $::conn
ffa0: 65 63 74 69 6f 6e 5f 66 6c 61 67 73 5d 0d 0a 0d ection_flags]...
ffb0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
ffc0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 # NOTE: Show
ffd0: 20 28 61 6e 64 20 6c 6f 67 29 20 74 68 65 20 6e (and log) the n
ffe0: 65 77 20 65 66 66 65 63 74 69 76 65 20 63 6f 6e ew effective con
fff0: 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 2e 0d 0a nection flags...
10000 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
10010 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
10020 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
10030 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
10040 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 43 6f 6d sts ::no(emitCom
10050 62 69 6e 65 64 46 6c 61 67 73 29 5d 20 26 26 20 binedFlags)] &&
10060 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
10070 20 28 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 (![info exists
10080 3a 3a 6e 6f 28 65 6d 69 74 43 6f 6d 62 69 6e 65 ::no(emitCombine
10090 64 46 6c 61 67 73 49 66 4e 6f 6e 65 29 5d 20 7c dFlagsIfNone)] |
100a0 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 | \..
100b0 20 20 20 20 21 5b 68 61 73 4e 6f 46 6c 61 67 73 ![hasNoFlags
100c0 20 66 6c 61 67 73 20 66 61 6c 73 65 5d 29 7d 20 flags false])}
100d0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
100e0 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
100f0 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
10100 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
10110 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 "---- c
10120 6f 6d 62 69 6e 65 64 20 63 6f 6e 6e 65 63 74 69 ombined connecti
10130 6f 6e 20 66 6c 61 67 73 20 66 6f 72 20 22 20 24 on flags for " $
10140 64 61 74 61 62 61 73 65 20 5c 0d 0a 20 20 20 20 database \..
10150 20 20 20 20 20 20 20 20 20 20 20 20 22 20 61 72 " ar
10160 65 3a 20 22 20 5b 65 78 70 72 20 7b 21 5b 68 61 e: " [expr {![ha
10170 73 4e 6f 46 6c 61 67 73 20 66 6c 61 67 73 20 66 sNoFlags flags f
10180 61 6c 73 65 5d 20 3f 20 5c 0d 0a 20 20 20 20 20 alse] ? \..
10190 20 20 20 20 20 20 20 20 20 20 20 5b 61 70 70 65 [appe
101a0 6e 64 41 72 67 73 20 5c 22 20 24 66 6c 61 67 73 ndArgs \" $flags
101b0 20 5c 22 5d 20 3a 20 22 3c 6e 6f 6e 65 3e 22 7d \"] : "<none>"}
101c0 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 ] \n]..
101d0 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
101e0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
101f0 72 65 74 75 72 6e 20 24 66 6c 61 67 73 0d 0a 20 return $flags..
10200 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
10210 63 20 67 65 74 46 6c 61 67 73 50 72 6f 70 65 72 c getFlagsProper
10220 74 79 20 7b 20 7b 66 6c 61 67 73 20 22 22 7d 20 ty { {flags ""}
10230 7b 71 75 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 {quiet false} }
10240 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
10250 20 20 23 20 4e 4f 54 45 3a 20 44 65 74 65 72 6d # NOTE: Determ
10260 69 6e 65 20 77 68 61 74 20 74 68 65 20 63 6f 6d ine what the com
10270 62 69 6e 65 64 20 28 67 6c 6f 62 61 6c 20 61 6e bined (global an
10280 64 20 6c 6f 63 61 6c 29 20 63 6f 6e 6e 65 63 74 d local) connect
10290 69 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ion.. #
102a0 20 20 20 66 6c 61 67 73 20 73 68 6f 75 6c 64 20 flags should
102b0 62 65 2c 20 70 6f 73 73 69 62 6c 79 20 71 75 69 be, possibly qui
102c0 65 74 6c 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a etly... #..
102d0 20 20 20 20 20 20 73 65 74 20 66 6c 61 67 73 20 set flags
102e0 5b 67 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 46 6c [getConnectionFl
102f0 61 67 73 20 22 22 20 24 66 6c 61 67 73 20 24 71 ags "" $flags $q
10300 75 69 65 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 uiet].... #
10310 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
10320 49 66 20 6e 6f 20 67 6c 6f 62 61 6c 20 6f 72 20 If no global or
10330 6c 6f 63 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e local connection
10340 20 66 6c 61 67 73 20 77 65 72 65 20 73 70 65 63 flags were spec
10350 69 66 69 65 64 2c 20 74 68 65 0d 0a 20 20 20 20 ified, the..
10360 20 20 23 20 20 20 20 20 20 20 64 65 66 61 75 6c # defaul
10370 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 t connection fla
10380 67 73 20 73 68 6f 75 6c 64 20 62 65 20 75 73 65 gs should be use
10390 64 3b 20 74 68 65 72 65 66 6f 72 65 2c 20 72 65 d; therefore, re
103a0 74 75 72 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 turn.. #
103b0 20 20 20 20 61 6e 20 65 6d 70 74 79 20 73 74 72 an empty str
103c0 69 6e 67 20 69 6e 20 74 68 61 74 20 63 61 73 65 ing in that case
103d0 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
103e0 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
103f0 6e 67 74 68 20 24 66 6c 61 67 73 5d 20 3d 3d 20 ngth $flags] ==
10400 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
10410 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 return ""..
10420 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 }.... #
10430 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
10440 49 6e 20 6f 72 64 65 72 20 74 6f 20 63 68 65 63 In order to chec
10450 6b 20 69 66 20 74 68 65 20 64 65 66 61 75 6c 74 k if the default
10460 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 connection flag
10470 73 20 61 72 65 20 62 65 69 6e 67 20 75 73 65 64 s are being used
10480 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
10490 69 74 20 69 73 20 6e 65 63 65 73 73 61 72 79 20 it is necessary
104a0 74 6f 20 61 74 74 65 6d 70 74 20 61 20 63 6f 6e to attempt a con
104b0 76 65 72 73 69 6f 6e 20 74 6f 20 74 68 65 20 61 version to the a
104c0 63 74 75 61 6c 20 65 6e 75 6d 65 72 61 74 65 64 ctual enumerated
104d0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
104e0 74 79 70 65 2e 20 20 46 61 69 6c 69 6e 67 20 74 type. Failing t
104f0 68 61 74 2c 20 74 68 65 20 63 68 65 63 6b 20 61 hat, the check a
10500 67 61 69 6e 73 74 20 74 68 65 20 64 65 66 61 75 gainst the defau
10510 6c 74 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 65 lt value will be
10520 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
10530 73 6b 69 70 70 65 64 2e 0d 0a 20 20 20 20 20 20 skipped...
10540 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 #.. if {[ca
10550 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 tch {.. s
10560 65 74 20 65 72 72 6f 72 20 6e 75 6c 6c 3b 20 23 et error null; #
10570 20 49 47 4e 4f 52 45 44 0d 0a 0d 0a 20 20 20 20 IGNORED....
10580 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b object invok
10590 65 20 55 74 69 6c 69 74 79 20 54 72 79 50 61 72 e Utility TryPar
105a0 73 65 46 6c 61 67 73 45 6e 75 6d 20 22 22 20 5c seFlagsEnum "" \
105b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 79 .. Sy
105c0 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
105d0 2e 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f .SQLiteConnectio
105e0 6e 46 6c 61 67 73 20 22 22 20 24 66 6c 61 67 73 nFlags "" $flags
105f0 20 6e 75 6c 6c 20 74 72 75 65 20 5c 0d 0a 20 20 null true \..
10600 20 20 20 20 20 20 20 20 20 20 74 72 75 65 20 65 true e
10610 72 72 6f 72 0d 0a 20 20 20 20 20 20 7d 20 76 61 rror.. } va
10620 6c 75 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 lue]} then {..
10630 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
10640 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 # NOTE: Attempt
10650 69 6e 67 20 74 6f 20 70 61 72 73 65 20 74 68 65 ing to parse the
10660 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 connection flag
10670 73 20 63 61 75 73 65 64 20 61 20 73 63 72 69 70 s caused a scrip
10680 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 t.. #
10690 20 20 20 65 72 72 6f 72 2e 20 20 45 6d 69 74 20 error. Emit
106a0 61 20 77 61 72 6e 69 6e 67 20 74 6f 20 74 68 65 a warning to the
106b0 20 74 65 73 74 20 6c 6f 67 20 66 69 6c 65 20 61 test log file a
106c0 6e 64 20 63 6f 6e 74 69 6e 75 65 0d 0a 20 20 20 nd continue..
106d0 20 20 20 20 20 23 20 20 20 20 20 20 20 75 73 69 # usi
106e0 6e 67 20 61 6e 20 65 6d 74 70 79 20 73 74 72 69 ng an emtpy stri
106f0 6e 67 20 69 6e 73 74 65 61 64 2e 0d 0a 20 20 20 ng instead...
10700 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
10710 74 6c 6f 67 20 5b 61 70 70 65 6e 64 41 72 67 73 tlog [appendArgs
10720 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
10730 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 "==== WARNING: f
10740 61 69 6c 65 64 20 74 6f 20 70 61 72 73 65 20 63 ailed to parse c
10750 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 2c onnection flags,
10760 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 error: " \..
10770 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 76 \n\t $v
10780 61 6c 75 65 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 alue \n]....
10790 20 20 20 20 73 65 74 20 76 61 6c 75 65 20 22 22 set value ""
107a0 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
107b0 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
107c0 54 45 3a 20 49 66 20 74 68 65 20 63 6f 6d 62 69 TE: If the combi
107d0 6e 65 64 20 66 6c 61 67 73 20 73 74 72 69 6e 67 ned flags string
107e0 20 63 6f 75 6c 64 20 6e 6f 74 20 61 63 74 75 61 could not actua
107f0 6c 6c 79 20 62 65 20 63 6f 6e 76 65 72 74 65 64 lly be converted
10800 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
10810 74 6f 20 74 68 65 20 65 6e 75 6d 65 72 61 74 65 to the enumerate
10820 64 20 74 79 70 65 20 69 74 20 69 73 20 74 68 65 d type it is the
10830 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 2c 20 default value,
10840 74 68 65 6e 20 6a 75 73 74 20 75 73 65 0d 0a 20 then just use..
10850 20 20 20 20 20 23 20 20 20 20 20 20 20 69 74 20 # it
10860 76 65 72 62 61 74 69 6d 3b 20 6f 74 68 65 72 77 verbatim; otherw
10870 69 73 65 2c 20 6a 75 73 74 20 72 65 74 75 72 6e ise, just return
10880 20 61 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 an empty string
10890 2e 20 20 49 6e 20 74 68 61 74 0d 0a 20 20 20 20 . In that..
108a0 20 20 23 20 20 20 20 20 20 20 63 61 73 65 2c 20 # case,
108b0 74 68 65 20 64 65 66 61 75 6c 74 20 63 6f 6e 6e the default conn
108c0 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 77 69 6c ection flags wil
108d0 6c 20 62 65 20 75 73 65 64 2e 0d 0a 20 20 20 20 l be used...
108e0 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
108f0 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 string length $v
10900 61 6c 75 65 5d 20 3d 3d 20 30 20 7c 7c 20 24 76 alue] == 0 || $v
10910 61 6c 75 65 20 6e 65 20 22 44 65 66 61 75 6c 74 alue ne "Default
10920 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 "} then {..
10930 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
10940 57 41 52 4e 49 4e 47 3a 20 54 68 69 73 20 72 65 WARNING: This re
10950 74 75 72 6e 73 20 74 68 65 20 73 74 72 69 6e 67 turns the string
10960 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 63 6f value of the co
10970 6d 62 69 6e 65 64 20 66 6c 61 67 73 2c 20 6e 6f mbined flags, no
10980 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 t.. #
10990 20 20 20 20 20 20 74 68 65 20 65 6e 75 6d 65 72 the enumer
109a0 61 74 65 64 20 76 61 6c 75 65 2e 20 20 54 68 69 ated value. Thi
109b0 73 20 69 73 20 62 79 20 64 65 73 69 67 6e 20 61 s is by design a
109c0 6e 64 20 73 68 6f 75 6c 64 20 6e 6f 74 0d 0a 20 nd should not..
109d0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 #
109e0 20 20 62 65 20 63 68 61 6e 67 65 64 20 77 69 74 be changed wit
109f0 68 6f 75 74 20 63 61 72 65 66 75 6c 20 63 6f 6e hout careful con
10a00 73 69 64 65 72 61 74 69 6f 6e 20 28 65 2e 67 2e sideration (e.g.
10a10 20 69 74 20 77 6f 75 6c 64 0d 0a 20 20 20 20 20 it would..
10a20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 70 72 # pr
10a30 65 76 65 6e 74 20 74 68 65 20 53 51 4c 69 74 65 event the SQLite
10a40 43 6f 6e 6e 65 63 74 69 6f 6e 20 63 6c 61 73 73 Connection class
10a50 20 66 72 6f 6d 20 61 6c 6c 6f 77 69 6e 67 20 69 from allowing i
10a60 6e 76 61 6c 69 64 0d 0a 20 20 20 20 20 20 20 20 nvalid..
10a70 23 20 20 20 20 20 20 20 20 20 20 5b 22 6d 61 67 # ["mag
10a80 69 63 61 6c 22 5d 20 6d 65 74 61 2d 66 6c 61 67 ical"] meta-flag
10a90 73 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a s)... #..
10aa0 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b return [
10ab0 61 70 70 65 6e 64 41 72 67 73 20 22 46 6c 61 67 appendArgs "Flag
10ac0 73 3d 22 20 24 66 6c 61 67 73 20 5c 3b 5d 0d 0a s=" $flags \;]..
10ad0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
10ae0 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 return ""..
10af0 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 65 }..... proc e
10b00 6e 61 62 6c 65 53 68 61 72 65 64 43 61 63 68 65 nableSharedCache
10b10 20 7b 20 63 68 61 6e 6e 65 6c 20 65 6e 61 62 6c { channel enabl
10b20 65 20 7b 71 75 69 65 74 20 66 61 6c 73 65 7d 20 e {quiet false}
10b30 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b } {.. if {[
10b40 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
10b50 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
10b60 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
10b70 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
10b80 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
10b90 74 65 2e 55 6e 73 61 66 65 4e 61 74 69 76 65 4d te.UnsafeNativeM
10ba0 65 74 68 6f 64 73 20 5c 0d 0a 20 20 20 20 20 20 ethods \..
10bb0 20 20 20 20 20 20 73 71 6c 69 74 65 33 5f 65 6e sqlite3_en
10bc0 61 62 6c 65 5f 73 68 61 72 65 64 5f 63 61 63 68 able_shared_cach
10bd0 65 20 5b 65 78 70 72 20 69 6e 74 28 24 65 6e 61 e [expr int($ena
10be0 62 6c 65 29 5d 0d 0a 20 20 20 20 20 20 7d 20 72 ble)].. } r
10bf0 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 esult] == 0} the
10c00 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
10c10 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
10c20 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
10c30 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
10c40 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
10c50 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 61 "---- ca
10c60 6c 6c 20 73 71 6c 69 74 65 33 5f 65 6e 61 62 6c ll sqlite3_enabl
10c70 65 5f 73 68 61 72 65 64 5f 63 61 63 68 65 28 22 e_shared_cache("
10c80 20 24 65 6e 61 62 6c 65 20 5c 0d 0a 20 20 20 20 $enable \..
10c90 20 20 20 20 20 20 20 20 20 20 22 29 2e 2e 2e 20 ")...
10ca0 6f 6b 3a 20 22 20 24 72 65 73 75 6c 74 20 5c 6e ok: " $result \n
10cb0 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 ].. }..
10cc0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
10cd0 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
10ce0 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
10cf0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
10d00 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
10d10 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
10d20 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 "---- call sqli
10d30 74 65 33 5f 65 6e 61 62 6c 65 5f 73 68 61 72 65 te3_enable_share
10d40 64 5f 63 61 63 68 65 28 22 20 24 65 6e 61 62 6c d_cache(" $enabl
10d50 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
10d60 20 20 20 22 29 2e 2e 2e 20 65 72 72 6f 72 3a 20 ")... error:
10d70 22 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c " \n\t $result \
10d80 6e 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 n].. }..
10d90 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
10da0 0d 0a 20 20 20 20 70 72 6f 63 20 73 65 74 75 70 .. proc setup
10db0 44 62 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 Db {..
10dc0 20 20 66 69 6c 65 4e 61 6d 65 20 7b 6d 6f 64 65 fileName {mode
10dd0 20 22 22 7d 20 7b 64 61 74 65 54 69 6d 65 46 6f ""} {dateTimeFo
10de0 72 6d 61 74 20 22 22 7d 20 7b 64 61 74 65 54 69 rmat ""} {dateTi
10df0 6d 65 4b 69 6e 64 20 22 22 7d 20 7b 66 6c 61 67 meKind ""} {flag
10e00 73 20 22 22 7d 0d 0a 20 20 20 20 20 20 20 20 20 s ""}..
10e10 20 20 20 7b 65 78 74 72 61 20 22 22 7d 20 7b 71 {extra ""} {q
10e20 75 61 6c 69 66 79 20 74 72 75 65 7d 20 7b 64 65 ualify true} {de
10e30 6c 65 74 65 20 74 72 75 65 7d 20 7b 75 72 69 20 lete true} {uri
10e40 66 61 6c 73 65 7d 0d 0a 20 20 20 20 20 20 20 20 false}..
10e50 20 20 20 20 7b 74 65 6d 70 6f 72 61 72 79 20 74 {temporary t
10e60 72 75 65 7d 20 7b 76 61 72 4e 61 6d 65 20 64 62 rue} {varName db
10e70 7d 20 7b 71 75 69 65 74 20 66 61 6c 73 65 7d 20 } {quiet false}
10e80 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
10e90 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 72 73 # NOTE: Firs
10ea0 74 2c 20 73 65 65 20 69 66 20 6f 75 72 20 63 61 t, see if our ca
10eb0 6c 6c 65 72 20 68 61 73 20 72 65 71 75 65 73 74 ller has request
10ec0 65 64 20 61 6e 20 69 6e 2d 6d 65 6d 6f 72 79 20 ed an in-memory
10ed0 64 61 74 61 62 61 73 65 2e 0d 0a 20 20 20 20 20 database...
10ee0 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 69 73 #.. set is
10ef0 4d 65 6d 6f 72 79 20 5b 69 73 4d 65 6d 6f 72 79 Memory [isMemory
10f00 44 62 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 0d Db $fileName]...
10f10 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
10f20 23 20 4e 4f 54 45 3a 20 46 6f 72 20 6e 6f 77 2c # NOTE: For now,
10f30 20 61 6c 6c 20 74 65 73 74 20 64 61 74 61 62 61 all test databa
10f40 73 65 73 20 75 73 65 64 20 62 79 20 74 68 65 20 ses used by the
10f50 74 65 73 74 20 73 75 69 74 65 20 61 72 65 20 70 test suite are p
10f60 6c 61 63 65 64 0d 0a 20 20 20 20 20 20 23 20 20 laced.. #
10f70 20 20 20 20 20 69 6e 74 6f 20 74 68 65 20 64 61 into the da
10f80 74 61 62 61 73 65 20 64 69 72 65 63 74 6f 72 79 tabase directory
10f90 2e 20 20 45 61 63 68 20 64 61 74 61 62 61 73 65 . Each database
10fa0 20 61 6e 64 20 72 65 6c 61 74 65 64 20 66 69 6c and related fil
10fb0 65 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 es.. #
10fc0 20 20 75 73 65 64 20 62 79 20 61 20 74 65 73 74 used by a test
10fd0 20 73 68 6f 75 6c 64 20 62 65 20 63 6c 65 61 6e should be clean
10fe0 65 64 20 75 70 20 62 79 20 74 68 61 74 20 74 65 ed up by that te
10ff0 73 74 20 75 73 69 6e 67 20 74 68 65 0d 0a 20 20 st using the..
11000 20 20 20 20 23 20 20 20 20 20 20 20 22 63 6c 65 # "cle
11010 61 6e 75 70 44 62 22 20 70 72 6f 63 65 64 75 72 anupDb" procedur
11020 65 2c 20 62 65 6c 6f 77 2e 0d 0a 20 20 20 20 20 e, below...
11030 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 24 #.. if {!$
11040 69 73 4d 65 6d 6f 72 79 20 26 26 20 24 71 75 61 isMemory && $qua
11050 6c 69 66 79 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 lify} then {..
11060 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 set fileNa
11070 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 me [file join [g
11080 65 74 44 61 74 61 62 61 73 65 44 69 72 65 63 74 etDatabaseDirect
11090 6f 72 79 5d 20 5b 66 69 6c 65 20 74 61 69 6c 20 ory] [file tail
110a0 24 66 69 6c 65 4e 61 6d 65 5d 5d 0d 0a 20 20 20 $fileName]]..
110b0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
110c0 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 . # NOTE: B
110d0 79 20 64 65 66 61 75 6c 74 2c 20 64 65 6c 65 74 y default, delet
110e0 65 20 61 6e 79 20 70 72 65 2d 65 78 69 73 74 69 e any pre-existi
110f0 6e 67 20 64 61 74 61 62 61 73 65 20 77 69 74 68 ng database with
11100 20 74 68 65 20 73 61 6d 65 20 66 69 6c 65 0d 0a the same file..
11110 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6e 61 # na
11120 6d 65 20 69 66 20 69 74 20 63 75 72 72 65 6e 74 me if it current
11130 6c 79 20 65 78 69 73 74 73 2e 0d 0a 20 20 20 20 ly exists...
11140 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
11150 24 69 73 4d 65 6d 6f 72 79 20 26 26 20 24 64 65 $isMemory && $de
11160 6c 65 74 65 20 26 26 20 5b 66 69 6c 65 20 65 78 lete && [file ex
11170 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d ists $fileName]}
11180 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
11190 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
111a0 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 64 TE: Attempt to d
111b0 65 6c 65 74 65 20 61 6e 79 20 70 72 65 2d 65 78 elete any pre-ex
111c0 69 73 74 69 6e 67 20 64 61 74 61 62 61 73 65 20 isting database
111d0 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 66 69 with the same fi
111e0 6c 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 le.. #
111f0 20 20 20 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 name...
11200 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 #.. if
11210 20 7b 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 64 {[catch {file d
11220 65 6c 65 74 65 20 24 66 69 6c 65 4e 61 6d 65 7d elete $fileName}
11230 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d error]} then {.
11240 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
11250 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
11260 57 65 20 73 6f 6d 65 68 6f 77 20 66 61 69 6c 65 We somehow faile
11270 64 20 74 6f 20 64 65 6c 65 74 65 20 74 68 65 20 d to delete the
11280 66 69 6c 65 2c 20 72 65 70 6f 72 74 20 77 68 79 file, report why
11290 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
112a0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
112b0 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
112c0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
112d0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
112e0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
112f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
11300 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 "==== WARNING: f
11310 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20 ailed to delete
11320 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 5c 22 database file \"
11330 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 " $fileName \..
11340 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
11350 5c 22 20 64 75 72 69 6e 67 20 73 65 74 75 70 2c \" during setup,
11360 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 error: " \n\t $
11370 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 error \n]..
11380 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
11390 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
113a0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
113b0 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 74 68 OTE: Refer to th
113c0 65 20 73 70 65 63 69 66 69 65 64 20 76 61 72 69 e specified vari
113d0 61 62 6c 65 20 28 65 2e 67 2e 20 22 64 62 22 29 able (e.g. "db")
113e0 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 20 in the context
113f0 6f 66 20 6f 75 72 0d 0a 20 20 20 20 20 20 23 20 of our.. #
11400 20 20 20 20 20 20 63 61 6c 6c 65 72 2e 20 20 54 caller. T
11410 68 65 20 68 61 6e 64 6c 65 20 74 6f 20 74 68 65 he handle to the
11420 20 6f 70 65 6e 65 64 20 64 61 74 61 62 61 73 65 opened database
11430 20 77 69 6c 6c 20 62 65 20 73 74 6f 72 65 64 20 will be stored
11440 74 68 65 72 65 2e 0d 0a 20 20 20 20 20 20 23 0d there... #.
11450 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 . upvar 1 $
11460 76 61 72 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 varName db....
11470 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
11480 4f 54 45 3a 20 53 74 61 72 74 20 62 75 69 6c 64 OTE: Start build
11490 69 6e 67 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 ing the connecti
114a0 6f 6e 20 73 74 72 69 6e 67 2e 20 20 54 68 65 20 on string. The
114b0 6f 6e 6c 79 20 72 65 71 75 69 72 65 64 20 70 6f only required po
114c0 72 74 69 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 rtion.. #
114d0 20 20 20 20 20 6f 66 20 74 68 65 20 63 6f 6e 6e of the conn
114e0 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 20 69 73 ection string is
114f0 20 74 68 65 20 64 61 74 61 20 73 6f 75 72 63 65 the data source
11500 2c 20 77 68 69 63 68 20 63 6f 6e 74 61 69 6e 73 , which contains
11510 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 the.. #
11520 20 20 20 20 64 61 74 61 62 61 73 65 20 66 69 6c database fil
11530 65 20 6e 61 6d 65 20 69 74 73 65 6c 66 2e 20 20 e name itself.
11540 49 66 20 6f 75 72 20 63 61 6c 6c 65 72 20 77 61 If our caller wa
11550 6e 74 73 20 74 6f 20 75 73 65 20 61 20 55 52 49 nts to use a URI
11560 20 61 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 as.. #
11570 20 20 20 74 68 65 20 64 61 74 61 20 73 6f 75 72 the data sour
11580 63 65 2c 20 75 73 65 20 74 68 65 20 46 75 6c 6c ce, use the Full
11590 55 72 69 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 Uri connection s
115a0 74 72 69 6e 67 20 70 72 6f 70 65 72 74 79 20 74 tring property t
115b0 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 o.. #
115c0 20 70 72 65 76 65 6e 74 20 74 68 65 20 64 61 74 prevent the dat
115d0 61 20 73 6f 75 72 63 65 20 73 74 72 69 6e 67 20 a source string
115e0 66 72 6f 6d 20 62 65 69 6e 67 20 6d 61 6e 67 6c from being mangl
115f0 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ed... #..
11600 20 20 20 20 69 66 20 7b 24 75 72 69 7d 20 74 68 if {$uri} th
11610 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 en {.. se
11620 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 7b 46 75 t connection {Fu
11630 6c 6c 55 72 69 3d 24 7b 66 69 6c 65 4e 61 6d 65 llUri=${fileName
11640 7d 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 }}.. } else
11650 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 {.. set
11660 63 6f 6e 6e 65 63 74 69 6f 6e 20 7b 44 61 74 61 connection {Data
11670 20 53 6f 75 72 63 65 3d 24 7b 66 69 6c 65 4e 61 Source=${fileNa
11680 6d 65 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d me}}.. }...
11690 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
116a0 23 20 4e 4f 54 45 3a 20 53 69 6e 63 65 20 74 68 # NOTE: Since th
116b0 69 73 20 70 72 6f 63 65 64 75 72 65 20 68 61 73 is procedure has
116c0 20 6e 6f 20 73 70 65 63 69 61 6c 20 6b 6e 6f 77 no special know
116d0 6c 65 64 67 65 20 6f 66 20 77 68 61 74 20 74 68 ledge of what th
116e0 65 20 64 65 66 61 75 6c 74 0d 0a 20 20 20 20 20 e default..
116f0 20 23 20 20 20 20 20 20 20 73 65 74 74 69 6e 67 # setting
11700 20 69 73 20 66 6f 72 20 74 68 65 20 54 6f 46 75 is for the ToFu
11710 6c 6c 50 61 74 68 20 63 6f 6e 6e 65 63 74 69 6f llPath connectio
11720 6e 20 73 74 72 69 6e 67 20 70 72 6f 70 65 72 79 n string propery
11730 2c 20 61 6c 77 61 79 73 0d 0a 20 20 20 20 20 20 , always..
11740 23 20 20 20 20 20 20 20 61 64 64 20 74 68 65 20 # add the
11750 76 61 6c 75 65 20 77 65 20 6b 6e 6f 77 20 61 62 value we know ab
11760 6f 75 74 20 74 6f 20 74 68 65 20 63 6f 6e 6e 65 out to the conne
11770 63 74 69 6f 6e 20 73 74 72 69 6e 67 2e 0d 0a 20 ction string...
11780 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 61 70 #.. ap
11790 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 pend connection
117a0 7b 3b 54 6f 46 75 6c 6c 50 61 74 68 3d 24 7b 71 {;ToFullPath=${q
117b0 75 61 6c 69 66 79 7d 7d 0d 0a 0d 0a 20 20 20 20 ualify}}....
117c0 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
117d0 45 3a 20 49 66 20 6f 75 72 20 63 61 6c 6c 65 72 E: If our caller
117e0 20 73 70 65 63 69 66 69 65 64 20 61 20 6a 6f 75 specified a jou
117f0 72 6e 61 6c 20 6d 6f 64 65 2c 20 61 64 64 20 74 rnal mode, add t
11800 68 65 20 6e 65 63 65 73 73 61 72 79 20 70 6f 72 he necessary por
11810 74 69 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 tion.. #
11820 20 20 20 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65 of the conne
11830 63 74 69 6f 6e 20 73 74 72 69 6e 67 20 6e 6f 77 ction string now
11840 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
11850 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
11860 6e 67 74 68 20 24 6d 6f 64 65 5d 20 3e 20 30 7d ngth $mode] > 0}
11870 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
11880 20 61 70 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 append connecti
11890 6f 6e 20 7b 3b 4a 6f 75 72 6e 61 6c 20 4d 6f 64 on {;Journal Mod
118a0 65 3d 24 7b 6d 6f 64 65 7d 7d 0d 0a 20 20 20 20 e=${mode}}..
118b0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
118c0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 # NOTE: If
118d0 20 6f 75 72 20 63 61 6c 6c 65 72 20 73 70 65 63 our caller spec
118e0 69 66 69 65 64 20 61 20 44 61 74 65 54 69 6d 65 ified a DateTime
118f0 20 66 6f 72 6d 61 74 2c 20 61 64 64 20 74 68 65 format, add the
11900 20 6e 65 63 65 73 73 61 72 79 0d 0a 20 20 20 20 necessary..
11910 20 20 23 20 20 20 20 20 20 20 70 6f 72 74 69 6f # portio
11920 6e 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 n of the connect
11930 69 6f 6e 20 73 74 72 69 6e 67 20 6e 6f 77 2e 0d ion string now..
11940 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
11950 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
11960 74 68 20 24 64 61 74 65 54 69 6d 65 46 6f 72 6d th $dateTimeForm
11970 61 74 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d at] > 0} then {.
11980 0a 20 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 . append
11990 63 6f 6e 6e 65 63 74 69 6f 6e 20 7b 3b 44 61 74 connection {;Dat
119a0 65 54 69 6d 65 46 6f 72 6d 61 74 3d 24 7b 64 61 eTimeFormat=${da
119b0 74 65 54 69 6d 65 46 6f 72 6d 61 74 7d 7d 0d 0a teTimeFormat}}..
119c0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
119d0 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
119e0 3a 20 49 66 20 6f 75 72 20 63 61 6c 6c 65 72 20 : If our caller
119f0 73 70 65 63 69 66 69 65 64 20 61 20 44 61 74 65 specified a Date
11a00 54 69 6d 65 4b 69 6e 64 2c 20 61 64 64 20 74 68 TimeKind, add th
11a10 65 20 6e 65 63 65 73 73 61 72 79 20 70 6f 72 74 e necessary port
11a20 69 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ion.. #
11a30 20 20 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63 of the connec
11a40 74 69 6f 6e 20 73 74 72 69 6e 67 20 6e 6f 77 2e tion string now.
11a50 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
11a60 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
11a70 67 74 68 20 24 64 61 74 65 54 69 6d 65 4b 69 6e gth $dateTimeKin
11a80 64 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a d] > 0} then {..
11a90 20 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 63 append c
11aa0 6f 6e 6e 65 63 74 69 6f 6e 20 7b 3b 44 61 74 65 onnection {;Date
11ab0 54 69 6d 65 4b 69 6e 64 3d 24 7b 64 61 74 65 54 TimeKind=${dateT
11ac0 69 6d 65 4b 69 6e 64 7d 7d 0d 0a 20 20 20 20 20 imeKind}}..
11ad0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
11ae0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 67 # NOTE: Fig
11af0 75 72 65 20 6f 75 74 20 77 68 61 74 20 74 68 65 ure out what the
11b00 20 66 69 6e 61 6c 20 66 6c 61 67 73 20 66 6f 72 final flags for
11b10 20 74 68 69 73 20 63 6f 6e 6e 65 63 74 69 6f 6e this connection
11b20 20 6e 65 65 64 20 74 6f 20 62 65 2e 0d 0a 20 20 need to be...
11b30 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 #.. set
11b40 20 66 6c 61 67 73 20 5b 67 65 74 43 6f 6e 6e 65 flags [getConne
11b50 63 74 69 6f 6e 46 6c 61 67 73 20 24 66 69 6c 65 ctionFlags $file
11b60 4e 61 6d 65 20 24 66 6c 61 67 73 20 24 71 75 69 Name $flags $qui
11b70 65 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a et].... #..
11b80 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 # NOTE: If
11b90 20 6f 75 72 20 63 61 6c 6c 65 72 20 73 70 65 63 our caller spec
11ba0 69 66 69 65 64 20 73 6f 6d 65 20 53 51 4c 69 74 ified some SQLit
11bb0 65 43 6f 6e 6e 65 63 74 69 6f 6e 46 6c 61 67 73 eConnectionFlags
11bc0 2c 20 61 64 64 20 74 68 65 0d 0a 20 20 20 20 20 , add the..
11bd0 20 23 20 20 20 20 20 20 20 6e 65 63 65 73 73 61 # necessa
11be0 72 79 20 70 6f 72 74 69 6f 6e 20 6f 66 20 74 68 ry portion of th
11bf0 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 e connection str
11c00 69 6e 67 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 ing now...
11c10 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 #.. if {[st
11c20 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 66 6c 61 ring length $fla
11c30 67 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d gs] > 0} then {.
11c40 0a 20 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 . append
11c50 63 6f 6e 6e 65 63 74 69 6f 6e 20 7b 3b 46 6c 61 connection {;Fla
11c60 67 73 3d 24 7b 66 6c 61 67 73 7d 7d 0d 0a 20 20 gs=${flags}}..
11c70 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 }.... #
11c80 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
11c90 49 66 20 6f 75 72 20 63 61 6c 6c 65 72 20 73 70 If our caller sp
11ca0 65 63 69 66 69 65 64 20 61 6e 20 65 78 74 72 61 ecified an extra
11cb0 20 70 61 79 6c 6f 61 64 20 74 6f 20 74 68 65 20 payload to the
11cc0 63 6f 6e 6e 65 63 74 69 6f 6e 0d 0a 20 20 20 20 connection..
11cd0 20 20 23 20 20 20 20 20 20 20 73 74 72 69 6e 67 # string
11ce0 2c 20 61 70 70 65 6e 64 20 69 74 20 6e 6f 77 2e , append it now.
11cf0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
11d00 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
11d10 67 74 68 20 24 65 78 74 72 61 5d 20 3e 20 30 7d gth $extra] > 0}
11d20 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
11d30 20 61 70 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 append connecti
11d40 6f 6e 20 5c 3b 20 24 65 78 74 72 61 0d 0a 20 20 on \; $extra..
11d50 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 }.... #
11d60 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
11d70 4f 70 65 6e 20 74 68 65 20 64 61 74 61 62 61 73 Open the databas
11d80 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 6e 6f 77 e connection now
11d90 2c 20 70 6c 61 63 69 6e 67 20 74 68 65 20 6f 70 , placing the op
11da0 61 71 75 65 20 68 61 6e 64 6c 65 20 76 61 6c 75 aque handle valu
11db0 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
11dc0 20 69 6e 74 6f 20 74 68 65 20 76 61 72 69 61 62 into the variab
11dd0 6c 65 20 73 70 65 63 69 66 69 65 64 20 62 79 20 le specified by
11de0 6f 75 72 20 63 61 6c 6c 65 72 2e 0d 0a 20 20 20 our caller...
11df0 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 #.. set
11e00 64 62 20 5b 73 71 6c 20 6f 70 65 6e 20 2d 74 79 db [sql open -ty
11e10 70 65 20 53 51 4c 69 74 65 20 5b 73 75 62 73 74 pe SQLite [subst
11e20 20 24 63 6f 6e 6e 65 63 74 69 6f 6e 5d 5d 0d 0a $connection]]..
11e30 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
11e40 20 23 20 4e 4f 54 45 3a 20 43 6f 6e 66 69 67 75 # NOTE: Configu
11e50 72 65 20 74 68 65 20 74 65 6d 70 6f 72 61 72 79 re the temporary
11e60 20 64 69 72 65 63 74 6f 72 79 20 66 6f 72 20 74 directory for t
11e70 68 65 20 6e 65 77 6c 79 20 6f 70 65 6e 65 64 20 he newly opened
11e80 64 61 74 61 62 61 73 65 0d 0a 20 20 20 20 20 20 database..
11e90 23 20 20 20 20 20 20 20 63 6f 6e 6e 65 63 74 69 # connecti
11ea0 6f 6e 20 6e 6f 77 20 75 6e 6c 65 73 73 20 6f 75 on now unless ou
11eb0 72 20 63 61 6c 6c 65 72 20 66 6f 72 62 69 64 73 r caller forbids
11ec0 20 69 74 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 it... #..
11ed0 20 20 20 20 20 69 66 20 7b 24 74 65 6d 70 6f 72 if {$tempor
11ee0 61 72 79 20 26 26 20 21 5b 69 6e 66 6f 20 65 78 ary && ![info ex
11ef0 69 73 74 73 20 3a 3a 6e 6f 28 73 65 74 54 65 6d ists ::no(setTem
11f00 70 6f 72 61 72 79 44 69 72 65 63 74 6f 72 79 29 poraryDirectory)
11f10 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
11f20 20 20 20 73 71 6c 20 65 78 65 63 75 74 65 20 24 sql execute $
11f30 64 62 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c db [appendArgs \
11f40 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 50 .. "P
11f50 52 41 47 4d 41 20 74 65 6d 70 5f 73 74 6f 72 65 RAGMA temp_store
11f60 5f 64 69 72 65 63 74 6f 72 79 20 3d 20 5c 22 22 _directory = \""
11f70 20 5b 67 65 74 54 65 6d 70 6f 72 61 72 79 44 69 [getTemporaryDi
11f80 72 65 63 74 6f 72 79 5d 20 5c 22 5c 3b 5d 0d 0a rectory] \"\;]..
11f90 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
11fa0 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
11fb0 3a 20 50 65 72 66 6f 72 6d 20 61 6e 79 20 65 78 : Perform any ex
11fc0 74 72 61 20 70 65 72 2d 63 6f 6e 6e 65 63 74 69 tra per-connecti
11fd0 6f 6e 20 73 65 74 75 70 20 66 6f 72 20 74 68 65 on setup for the
11fe0 20 6e 65 77 6c 79 20 6f 70 65 6e 65 64 0d 0a 20 newly opened..
11ff0 20 20 20 20 20 23 20 20 20 20 20 20 20 64 61 74 # dat
12000 61 62 61 73 65 20 6e 6f 77 20 75 6e 6c 65 73 73 abase now unless
12010 20 6f 75 72 20 63 61 6c 6c 65 72 20 66 6f 72 62 our caller forb
12020 69 64 73 20 69 74 2e 0d 0a 20 20 20 20 20 20 23 ids it... #
12030 0d 0a 20 20 20 20 20 20 73 65 74 20 65 78 65 63 .. set exec
12040 75 74 65 4f 6e 53 65 74 75 70 20 5b 67 65 74 45 uteOnSetup [getE
12050 78 65 63 75 74 65 4f 6e 53 65 74 75 70 5d 0d 0a xecuteOnSetup]..
12060 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
12070 69 6e 67 20 6c 65 6e 67 74 68 20 24 65 78 65 63 ing length $exec
12080 75 74 65 4f 6e 53 65 74 75 70 5d 20 3e 20 30 20 uteOnSetup] > 0
12090 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
120a0 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
120b0 6e 6f 28 65 78 65 63 75 74 65 4f 6e 53 65 74 75 no(executeOnSetu
120c0 70 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 p)]} then {..
120d0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
120e0 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 63 6f 6d # NOTE: This com
120f0 6d 61 6e 64 20 6d 61 79 20 72 61 69 73 65 20 61 mand may raise a
12100 6e 20 65 72 72 6f 72 3b 20 69 66 20 73 6f 2c 20 n error; if so,
12110 74 68 61 74 20 69 73 20 66 69 6e 65 2c 20 61 73 that is fine, as
12120 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
12130 20 20 74 68 65 20 65 6e 63 6c 6f 73 69 6e 67 20 the enclosing
12140 74 65 73 74 20 77 69 6c 6c 20 74 68 65 6e 20 66 test will then f
12150 61 69 6c 2e 20 20 54 68 65 20 5b 73 75 62 73 74 ail. The [subst
12160 5d 20 63 6f 6d 6d 61 6e 64 20 69 73 0d 0a 20 20 ] command is..
12170 20 20 20 20 20 20 23 20 20 20 20 20 20 20 75 73 # us
12180 65 64 20 6f 6e 20 74 68 65 20 53 51 4c 20 69 6e ed on the SQL in
12190 20 63 61 73 65 20 69 74 20 6e 65 65 64 73 20 74 case it needs t
121a0 6f 20 72 65 66 65 72 20 74 6f 20 73 74 61 74 65 o refer to state
121b0 20 69 6e 20 6f 75 72 0d 0a 20 20 20 20 20 20 20 in our..
121c0 20 23 20 20 20 20 20 20 20 63 6f 6e 74 65 78 74 # context
121d0 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
121e0 20 20 20 20 20 20 73 71 6c 20 65 78 65 63 75 74 sql execut
121f0 65 20 24 64 62 20 5b 73 75 62 73 74 20 24 65 78 e $db [subst $ex
12200 65 63 75 74 65 4f 6e 53 65 74 75 70 5d 0d 0a 20 ecuteOnSetup]..
12210 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
12220 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
12230 20 41 6c 77 61 79 73 20 72 65 74 75 72 6e 20 74 Always return t
12240 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 68 61 he connection ha
12250 6e 64 6c 65 20 75 70 6f 6e 20 73 75 63 63 65 73 ndle upon succes
12260 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 s... #..
12270 20 20 20 72 65 74 75 72 6e 20 24 64 62 0d 0a 20 return $db..
12280 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
12290 63 20 67 65 74 44 62 43 6f 6e 6e 65 63 74 69 6f c getDbConnectio
122a0 6e 20 7b 20 7b 76 61 72 4e 61 6d 65 20 64 62 7d n { {varName db}
122b0 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
122c0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 # NOTE: Ref
122d0 65 72 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 er to the specif
122e0 69 65 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e ied variable (e.
122f0 67 2e 20 22 64 62 22 29 20 69 6e 20 74 68 65 20 g. "db") in the
12300 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a context of our..
12310 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 61 # ca
12320 6c 6c 65 72 2e 20 20 54 68 65 20 68 61 6e 64 6c ller. The handl
12330 65 20 74 6f 20 74 68 65 20 64 61 74 61 62 61 73 e to the databas
12340 65 20 70 72 65 76 69 6f 75 73 6c 79 20 6f 70 65 e previously ope
12350 6e 65 64 20 76 69 61 20 74 68 65 0d 0a 20 20 20 ned via the..
12360 20 20 20 23 20 20 20 20 20 20 20 5b 73 65 74 75 # [setu
12370 70 44 62 5d 20 70 72 6f 63 65 64 75 72 65 20 73 pDb] procedure s
12380 68 6f 75 6c 64 20 62 65 20 73 74 6f 72 65 64 20 hould be stored
12390 74 68 65 72 65 2e 0d 0a 20 20 20 20 20 20 23 0d there... #.
123a0 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 . upvar 1 $
123b0 76 61 72 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 varName db....
123c0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
123d0 4f 54 45 3a 20 54 68 69 73 20 72 65 74 75 72 6e OTE: This return
123e0 73 20 74 68 65 20 41 44 4f 2e 4e 45 54 20 49 44 s the ADO.NET ID
123f0 62 43 6f 6e 6e 65 63 74 69 6f 6e 20 6f 62 6a 65 bConnection obje
12400 63 74 20 69 6e 73 74 61 6e 63 65 20 66 6f 72 20 ct instance for
12410 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 the.. #
12420 20 20 20 73 70 65 63 69 66 69 65 64 20 64 61 74 specified dat
12430 61 62 73 65 20 68 61 6e 64 6c 65 2e 20 20 53 69 abse handle. Si
12440 6e 63 65 20 67 65 74 74 69 6e 67 20 74 68 69 73 nce getting this
12450 20 6f 62 6a 65 63 74 20 72 65 6c 69 65 73 20 75 object relies u
12460 70 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 pon.. #
12470 20 20 20 45 61 67 6c 65 20 69 6e 74 65 72 6e 61 Eagle interna
12480 6c 73 2c 20 67 72 65 61 74 20 63 61 72 65 20 73 ls, great care s
12490 68 6f 75 6c 64 20 62 65 20 74 61 6b 65 6e 20 74 hould be taken t
124a0 6f 20 61 76 6f 69 64 20 64 69 73 70 6f 73 69 6e o avoid disposin
124b0 67 20 6f 66 0d 0a 20 20 20 20 20 20 23 20 20 20 g of.. #
124c0 20 20 20 20 74 68 69 73 20 6f 62 6a 65 63 74 20 this object
124d0 6f 72 20 6f 74 68 65 72 77 69 73 65 20 70 75 74 or otherwise put
124e0 74 69 6e 67 20 69 74 20 69 6e 74 6f 20 61 6e 20 ting it into an
124f0 69 6e 76 61 6c 69 64 20 73 74 61 74 65 2e 0d 0a invalid state...
12500 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
12510 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
12520 64 62 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 db]} then {..
12530 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
12540 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a {.. obj
12550 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 ect invoke -flag
12560 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 2d 6f 62 s +NonPublic -ob
12570 6a 65 63 74 66 6c 61 67 73 20 2b 4e 6f 44 69 73 jectflags +NoDis
12580 70 6f 73 65 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 pose -alias \..
12590 20 20 20 20 20 20 20 20 20 20 20 20 20 49 6e 74 Int
125a0 65 72 70 72 65 74 65 72 2e 47 65 74 41 63 74 69 erpreter.GetActi
125b0 76 65 2e 63 6f 6e 6e 65 63 74 69 6f 6e 73 20 49 ve.connections I
125c0 74 65 6d 20 24 64 62 0d 0a 20 20 20 20 20 20 20 tem $db..
125d0 20 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d } result] == 0}
125e0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
125f0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
12600 23 20 4e 4f 54 45 3a 20 53 75 63 63 65 73 73 2c # NOTE: Success,
12610 20 72 65 74 75 72 6e 20 74 68 65 20 6f 70 61 71 return the opaq
12620 75 65 20 6f 62 6a 65 63 74 20 68 61 6e 64 6c 65 ue object handle
12630 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
12640 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
12650 20 24 72 65 73 75 6c 74 0d 0a 20 20 20 20 20 20 $result..
12660 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
12670 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
12680 20 20 20 23 20 4e 4f 54 45 3a 20 46 61 69 6c 75 # NOTE: Failu
12690 72 65 2c 20 72 65 70 6f 72 74 20 77 68 79 2e 0d re, report why..
126a0 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
126b0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
126c0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
126d0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
126e0 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d "====
126f0 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 WARNING: failed
12700 20 74 6f 20 67 65 74 20 63 6f 6e 6e 65 63 74 69 to get connecti
12710 6f 6e 20 68 61 6e 64 6c 65 20 66 6f 72 20 64 61 on handle for da
12720 74 61 62 61 73 65 20 5c 22 22 20 5c 0d 0a 20 20 tabase \"" \..
12730 20 20 20 20 20 20 20 20 20 20 20 20 24 64 62 20 $db
12740 22 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e "\", error: " \n
12750 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a \t $result \n]..
12760 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
12770 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
12780 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 61 69 # NOTE: Fai
12790 6c 75 72 65 2c 20 72 65 74 75 72 6e 20 61 6e 20 lure, return an
127a0 6f 62 76 69 6f 75 73 6c 79 20 69 6e 76 61 6c 69 obviously invali
127b0 64 20 6f 70 61 71 75 65 20 6f 62 6a 65 63 74 20 d opaque object
127c0 68 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 20 23 handle... #
127d0 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 22 .. return "
127e0 22 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 ".. }.....
127f0 20 70 72 6f 63 20 66 72 65 65 44 62 43 6f 6e 6e proc freeDbConn
12800 65 63 74 69 6f 6e 20 7b 20 7b 76 61 72 4e 61 6d ection { {varNam
12810 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 7d 20 7d 20 e connection} }
12820 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
12830 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 20 # NOTE: Refer
12840 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 64 to the specified
12850 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e 20 variable (e.g.
12860 22 63 6f 6e 6e 65 63 74 69 6f 6e 22 29 20 69 6e "connection") in
12870 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 the.. #
12880 20 20 20 20 63 6f 6e 74 65 78 74 20 6f 66 20 6f context of o
12890 75 72 20 63 61 6c 6c 65 72 2e 20 20 54 68 65 20 ur caller. The
128a0 6f 70 61 71 75 65 20 6f 62 6a 65 63 74 20 68 61 opaque object ha
128b0 6e 64 6c 65 20 66 6f 72 20 61 6e 20 41 44 4f 2e ndle for an ADO.
128c0 4e 45 54 0d 0a 20 20 20 20 20 20 23 20 20 20 20 NET.. #
128d0 20 20 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 70 72 connection pr
128e0 65 76 69 6f 75 73 6c 79 20 72 65 74 75 72 6e 65 eviously returne
128f0 64 20 62 79 20 5b 67 65 74 44 62 43 6f 6e 6e 65 d by [getDbConne
12900 63 74 69 6f 6e 5d 20 73 68 6f 75 6c 64 20 62 65 ction] should be
12910 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
12920 73 74 6f 72 65 64 20 74 68 65 72 65 2e 0d 0a 20 stored there...
12930 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 75 70 #.. up
12940 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 63 var 1 $varName c
12950 6f 6e 6e 65 63 74 69 6f 6e 0d 0a 0d 0a 20 20 20 onnection....
12960 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
12970 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 72 TE: Attempt to r
12980 65 6d 6f 76 65 20 74 68 65 20 6f 70 61 71 75 65 emove the opaque
12990 20 6f 62 6a 65 63 74 20 68 61 6e 64 6c 65 20 66 object handle f
129a0 72 6f 6d 20 74 68 65 20 69 6e 74 65 72 70 72 65 rom the interpre
129b0 74 65 72 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ter.. #
129c0 20 20 20 6e 6f 77 2e 20 20 54 68 69 73 20 5b 6f now. This [o
129d0 62 6a 65 63 74 20 64 69 73 70 6f 73 65 5d 20 63 bject dispose] c
129e0 61 6c 6c 20 77 69 6c 6c 20 6e 6f 74 20 61 63 74 all will not act
129f0 75 61 6c 6c 79 20 64 69 73 70 6f 73 65 20 6f 66 ually dispose of
12a00 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 the.. #
12a10 20 20 20 20 75 6e 64 65 72 6c 79 69 6e 67 20 6f underlying o
12a20 62 6a 65 63 74 20 62 65 63 61 75 73 65 20 74 68 bject because th
12a30 65 20 2b 4e 6f 44 69 73 70 6f 73 65 20 66 6c 61 e +NoDispose fla
12a40 67 20 77 61 73 20 73 65 74 20 6f 6e 20 69 74 0d g was set on it.
12a50 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 . # d
12a60 75 72 69 6e 67 20 63 72 65 61 74 69 6f 6e 20 6f uring creation o
12a70 66 20 74 68 65 20 6f 70 61 71 75 65 20 6f 62 6a f the opaque obj
12a80 65 63 74 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 20 ect handle...
12a90 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
12aa0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 63 6f 6e [info exists con
12ab0 6e 65 63 74 69 6f 6e 5d 20 26 26 20 5c 0d 0a 20 nection] && \..
12ac0 20 20 20 20 20 20 20 20 20 5b 63 61 74 63 68 20 [catch
12ad0 7b 6f 62 6a 65 63 74 20 64 69 73 70 6f 73 65 20 {object dispose
12ae0 24 63 6f 6e 6e 65 63 74 69 6f 6e 7d 20 65 72 72 $connection} err
12af0 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 or]} then {..
12b00 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
12b10 23 20 4e 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 # NOTE: We someh
12b20 6f 77 20 66 61 69 6c 65 64 20 74 6f 20 72 65 6d ow failed to rem
12b30 6f 76 65 20 74 68 65 20 68 61 6e 64 6c 65 2c 20 ove the handle,
12b40 72 65 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 20 report why...
12b50 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
12b60 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
12b70 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
12b80 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
12b90 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 "==== WARNING:
12ba0 66 61 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 failed to remove
12bb0 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 68 61 6e 64 connection hand
12bc0 6c 65 20 5c 22 22 20 24 63 6f 6e 6e 65 63 74 69 le \"" $connecti
12bd0 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 on \..
12be0 20 20 22 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 "\", error: "
12bf0 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d \n\t $error \n].
12c00 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d . }.. }.
12c10 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 61 64 64 .... proc add
12c20 44 62 43 6f 6e 6e 65 63 74 69 6f 6e 20 7b 20 63 DbConnection { c
12c30 6f 6e 6e 65 63 74 69 6f 6e 20 7b 76 61 72 4e 61 onnection {varNa
12c40 6d 65 20 64 62 7d 20 7d 20 7b 0d 0a 20 20 20 20 me db} } {..
12c50 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
12c60 45 3a 20 52 65 66 65 72 20 74 6f 20 74 68 65 20 E: Refer to the
12c70 73 70 65 63 69 66 69 65 64 20 76 61 72 69 61 62 specified variab
12c80 6c 65 20 28 65 2e 67 2e 20 22 64 62 22 29 20 69 le (e.g. "db") i
12c90 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 20 6f 66 n the context of
12ca0 20 6f 75 72 0d 0a 20 20 20 20 20 20 23 20 20 20 our.. #
12cb0 20 20 20 20 63 61 6c 6c 65 72 2e 0d 0a 20 20 20 caller...
12cc0 20 20 20 23 0d 0a 20 20 20 20 20 20 75 70 76 61 #.. upva
12cd0 72 20 31 20 24 76 61 72 4e 61 6d 65 20 64 62 0d r 1 $varName db.
12ce0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
12cf0 20 20 23 20 4e 4f 54 45 3a 20 43 72 65 61 74 65 # NOTE: Create
12d00 20 61 20 63 6f 72 72 65 63 74 6c 79 20 66 6f 72 a correctly for
12d10 6d 61 74 74 65 64 20 6e 61 6d 65 20 66 6f 72 20 matted name for
12d20 74 68 65 20 64 61 74 61 62 61 73 65 20 63 6f 6e the database con
12d30 6e 65 63 74 69 6f 6e 20 74 6f 0d 0a 20 20 20 20 nection to..
12d40 20 20 23 20 20 20 20 20 20 20 62 65 20 61 64 64 # be add
12d50 65 64 20 74 6f 20 74 68 65 20 6c 69 73 74 20 6d ed to the list m
12d60 61 6e 61 67 65 64 20 62 79 20 74 68 65 20 45 61 anaged by the Ea
12d70 67 6c 65 20 69 6e 74 65 72 70 72 65 74 65 72 2e gle interpreter.
12d80 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
12d90 20 73 65 74 20 64 62 20 5b 6f 62 6a 65 63 74 20 set db [object
12da0 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
12db0 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
12dc0 20 20 20 20 20 20 45 61 67 6c 65 2e 5f 43 6f 6d Eagle._Com
12dd0 70 6f 6e 65 6e 74 73 2e 50 72 69 76 61 74 65 2e ponents.Private.
12de0 46 6f 72 6d 61 74 4f 70 73 20 44 61 74 61 62 61 FormatOps Databa
12df0 73 65 4f 62 6a 65 63 74 4e 61 6d 65 20 24 63 6f seObjectName $co
12e00 6e 6e 65 63 74 69 6f 6e 20 5c 0d 0a 20 20 20 20 nnection \..
12e10 20 20 20 20 20 20 53 51 4c 69 74 65 43 6f 6e 6e SQLiteConn
12e20 65 63 74 69 6f 6e 20 5b 6f 62 6a 65 63 74 20 69 ection [object i
12e30 6e 76 6f 6b 65 20 49 6e 74 65 72 70 72 65 74 65 nvoke Interprete
12e40 72 2e 47 65 74 41 63 74 69 76 65 20 4e 65 78 74 r.GetActive Next
12e50 49 64 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d Id]].... #.
12e60 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 . # NOTE: A
12e70 64 64 20 74 68 65 20 64 61 74 61 62 61 73 65 20 dd the database
12e80 63 6f 6e 6e 65 63 74 69 6f 6e 20 70 72 6f 76 69 connection provi
12e90 64 65 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 ded by our calle
12ea0 72 20 74 6f 20 74 68 65 20 6c 69 73 74 0d 0a 20 r to the list..
12eb0 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 66 20 # of
12ec0 74 68 6f 73 65 20 6b 6e 6f 77 6e 20 74 6f 20 74 those known to t
12ed0 68 65 20 45 61 67 6c 65 20 69 6e 74 65 72 70 72 he Eagle interpr
12ee0 65 74 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a eter... #..
12ef0 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 object inv
12f00 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 oke -flags +NonP
12f10 75 62 6c 69 63 20 49 6e 74 65 72 70 72 65 74 65 ublic Interprete
12f20 72 2e 47 65 74 41 63 74 69 76 65 2e 63 6f 6e 6e r.GetActive.conn
12f30 65 63 74 69 6f 6e 73 20 41 64 64 20 5c 0d 0a 20 ections Add \..
12f40 20 20 20 20 20 20 20 20 20 24 64 62 20 24 63 6f $db $co
12f50 6e 6e 65 63 74 69 6f 6e 0d 0a 20 20 20 20 7d 0d nnection.. }.
12f60 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 .... proc get
12f70 52 6f 77 73 46 72 6f 6d 44 61 74 61 54 61 62 6c RowsFromDataTabl
12f80 65 20 7b 20 64 61 74 61 54 61 62 6c 65 20 7d 20 e { dataTable }
12f90 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 72 6f 77 {.. set row
12fa0 73 20 5b 6c 69 73 74 5d 0d 0a 20 20 20 20 20 20 s [list]..
12fb0 73 65 74 20 63 6f 75 6e 74 20 5b 24 64 61 74 61 set count [$data
12fc0 54 61 62 6c 65 20 43 6f 6c 75 6d 6e 73 2e 43 6f Table Columns.Co
12fd0 75 6e 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 66 6f unt].... fo
12fe0 72 20 7b 73 65 74 20 69 6e 64 65 78 20 30 7d 20 r {set index 0}
12ff0 7b 24 69 6e 64 65 78 20 3c 20 24 63 6f 75 6e 74 {$index < $count
13000 7d 20 7b 69 6e 63 72 20 69 6e 64 65 78 7d 20 7b } {incr index} {
13010 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 64 61 .. set da
13020 74 61 43 6f 6c 75 6d 6e 20 5b 24 64 61 74 61 54 taColumn [$dataT
13030 61 62 6c 65 20 2d 61 6c 69 61 73 20 43 6f 6c 75 able -alias Colu
13040 6d 6e 73 2e 67 65 74 5f 49 74 65 6d 20 24 69 6e mns.get_Item $in
13050 64 65 78 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 dex].. se
13060 74 20 6e 61 6d 65 73 28 24 69 6e 64 65 78 29 20 t names($index)
13070 5b 24 64 61 74 61 43 6f 6c 75 6d 6e 20 43 6f 6c [$dataColumn Col
13080 75 6d 6e 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 umnName]..
13090 7d 0d 0a 0d 0a 20 20 20 20 20 20 6f 62 6a 65 63 }.... objec
130a0 74 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 61 73 t foreach -alias
130b0 20 64 61 74 61 52 6f 77 20 5b 73 65 74 20 64 61 dataRow [set da
130c0 74 61 52 6f 77 73 20 5b 24 64 61 74 61 54 61 62 taRows [$dataTab
130d0 6c 65 20 52 6f 77 73 5d 5d 20 7b 0d 0a 20 20 20 le Rows]] {..
130e0 20 20 20 20 20 73 65 74 20 72 6f 77 20 5b 6c 69 set row [li
130f0 73 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 66 st].... f
13100 6f 72 20 7b 73 65 74 20 69 6e 64 65 78 20 30 7d or {set index 0}
13110 20 7b 24 69 6e 64 65 78 20 3c 20 24 63 6f 75 6e {$index < $coun
13120 74 7d 20 7b 69 6e 63 72 20 69 6e 64 65 78 7d 20 t} {incr index}
13130 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 {.. set
13140 20 76 61 6c 75 65 20 5b 24 64 61 74 61 52 6f 77 value [$dataRow
13150 20 2d 63 72 65 61 74 65 20 2d 61 6c 69 61 73 20 -create -alias
13160 67 65 74 5f 49 74 65 6d 20 24 69 6e 64 65 78 5d get_Item $index]
13170 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 .... if
13180 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
13190 20 24 76 61 6c 75 65 5d 20 3e 20 30 20 26 26 20 $value] > 0 &&
131a0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
131b0 20 21 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 ![object invoke
131c0 20 43 6f 6e 76 65 72 74 20 49 73 44 42 4e 75 6c Convert IsDBNul
131d0 6c 20 24 76 61 6c 75 65 5d 7d 20 74 68 65 6e 20 l $value]} then
131e0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c {.. l
131f0 61 70 70 65 6e 64 20 72 6f 77 20 5b 6c 69 73 74 append row [list
13200 20 24 6e 61 6d 65 73 28 24 69 6e 64 65 78 29 20 $names($index)
13210 5b 24 76 61 6c 75 65 20 54 6f 53 74 72 69 6e 67 [$value ToString
13220 5d 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 ]].. }
13230 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
13240 20 20 20 20 6c 61 70 70 65 6e 64 20 72 6f 77 20 lappend row
13250 5b 6c 69 73 74 20 24 6e 61 6d 65 73 28 24 69 6e [list $names($in
13260 64 65 78 29 5d 0d 0a 20 20 20 20 20 20 20 20 20 dex)]..
13270 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
13280 0a 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 . lappend
13290 20 72 6f 77 73 20 24 72 6f 77 0d 0a 20 20 20 20 rows $row..
132a0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 }.... ret
132b0 75 72 6e 20 24 72 6f 77 73 0d 0a 20 20 20 20 7d urn $rows.. }
132c0 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 64 75 ..... proc du
132d0 6d 70 52 6f 77 73 46 72 6f 6d 44 61 74 61 54 61 mpRowsFromDataTa
132e0 62 6c 65 20 7b 20 63 68 61 6e 6e 65 6c 20 72 6f ble { channel ro
132f0 77 73 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 ws } {.. se
13300 74 20 73 65 71 75 65 6e 63 65 20 31 0d 0a 0d 0a t sequence 1....
13310 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 72 6f foreach ro
13320 77 20 24 72 6f 77 73 20 7b 0d 0a 20 20 20 20 20 w $rows {..
13330 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
13340 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
13350 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 65 78 . [ex
13360 70 72 20 7b 24 73 65 71 75 65 6e 63 65 20 3e 20 pr {$sequence >
13370 31 20 3f 20 22 5c 6e 22 20 3a 20 22 22 7d 5d 20 1 ? "\n" : ""}]
13380 22 2d 2d 2d 2d 20 52 4f 57 20 23 22 20 24 73 65 "---- ROW #" $se
13390 71 75 65 6e 63 65 20 3a 5c 6e 5d 0d 0a 0d 0a 20 quence :\n]....
133a0 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 70 foreach p
133b0 61 69 72 20 24 72 6f 77 20 7b 0d 0a 20 20 20 20 air $row {..
133c0 20 20 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 if {[lleng
133d0 74 68 20 24 70 61 69 72 5d 20 3e 3d 20 32 7d 20 th $pair] >= 2}
133e0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
133f0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
13400 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
13410 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 t \..
13420 20 20 20 20 20 5b 6c 69 73 74 20 5b 6c 69 6e 64 [list [lind
13430 65 78 20 24 70 61 69 72 20 30 5d 5d 20 22 3a 20 ex $pair 0]] ":
13440 22 20 5b 6c 69 73 74 20 5b 6c 69 6e 64 65 78 20 " [list [lindex
13450 24 70 61 69 72 20 31 5d 5d 20 5c 6e 5d 0d 0a 20 $pair 1]] \n]..
13460 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 69 } elsei
13470 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 70 61 69 f {[llength $pai
13480 72 5d 20 3d 3d 20 31 7d 20 74 68 65 6e 20 7b 0d r] == 1} then {.
13490 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
134a0 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
134b0 65 6e 64 41 72 67 73 20 5c 74 20 5c 0d 0a 20 20 endArgs \t \..
134c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 6c [l
134d0 69 73 74 20 5b 6c 69 6e 64 65 78 20 24 70 61 69 ist [lindex $pai
134e0 72 20 30 5d 5d 20 22 3a 20 3c 6e 75 6c 6c 3e 5c r 0]] ": <null>\
134f0 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d n"].. }
13500 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
13510 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
13520 6e 65 6c 20 5c 74 3c 65 6d 70 74 79 3e 5c 6e 3b nel \t<empty>\n;
13530 20 23 20 4e 4f 54 45 3a 20 4e 6f 20 64 61 74 61 # NOTE: No data
13540 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ?.. }..
13550 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
13560 20 20 20 20 20 69 6e 63 72 20 73 65 71 75 65 6e incr sequen
13570 63 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 ce.. }..
13580 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
13590 63 6c 65 61 6e 75 70 44 62 20 7b 20 66 69 6c 65 cleanupDb { file
135a0 4e 61 6d 65 20 7b 76 61 72 4e 61 6d 65 20 64 62 Name {varName db
135b0 7d 20 7b 63 6f 6c 6c 65 63 74 20 74 72 75 65 7d } {collect true}
135c0 20 7b 71 75 61 6c 69 66 79 20 74 72 75 65 7d 0d {qualify true}.
135d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
135e0 20 20 20 20 20 20 7b 64 65 6c 65 74 65 20 74 72 {delete tr
135f0 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ue} } {.. #
13600 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
13610 41 74 74 65 6d 70 74 20 74 6f 20 66 6f 72 63 65 Attempt to force
13620 20 61 6c 6c 20 70 65 6e 64 69 6e 67 20 22 67 61 all pending "ga
13630 72 62 61 67 65 22 20 6f 62 6a 65 63 74 73 20 74 rbage" objects t
13640 6f 20 62 65 20 63 6f 6c 6c 65 63 74 65 64 2c 0d o be collected,.
13650 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 69 . # i
13660 6e 63 6c 75 64 69 6e 67 20 53 51 4c 69 74 65 20 ncluding SQLite
13670 73 74 61 74 65 6d 65 6e 74 73 20 61 6e 64 20 62 statements and b
13680 61 63 6b 75 70 20 6f 62 6a 65 63 74 73 3b 20 74 ackup objects; t
13690 68 69 73 20 73 68 6f 75 6c 64 20 61 6c 6c 6f 77 his should allow
136a0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
136b0 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 64 the underlying d
136c0 61 74 61 62 61 73 65 20 66 69 6c 65 20 74 6f 20 atabase file to
136d0 62 65 20 64 65 6c 65 74 65 64 2e 0d 0a 20 20 20 be deleted...
136e0 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
136f0 24 63 6f 6c 6c 65 63 74 7d 20 74 68 65 6e 20 7b $collect} then {
13700 0d 0a 20 20 20 20 20 20 20 20 63 6f 6c 6c 65 63 .. collec
13710 74 47 61 72 62 61 67 65 20 24 3a 3a 74 65 73 74 tGarbage $::test
13720 5f 63 68 61 6e 6e 65 6c 0d 0a 20 20 20 20 20 20 _channel..
13730 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
13740 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 # NOTE: Refe
13750 72 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 r to the specifi
13760 65 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 ed variable (e.g
13770 2e 20 22 64 62 22 29 20 69 6e 20 74 68 65 20 63 . "db") in the c
13780 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a 20 ontext of our..
13790 20 20 20 20 20 23 20 20 20 20 20 20 20 63 61 6c # cal
137a0 6c 65 72 2e 20 20 54 68 65 20 68 61 6e 64 6c 65 ler. The handle
137b0 20 74 6f 20 74 68 65 20 64 61 74 61 62 61 73 65 to the database
137c0 20 70 72 65 76 69 6f 75 73 6c 79 20 6f 70 65 6e previously open
137d0 65 64 20 76 69 61 20 74 68 65 0d 0a 20 20 20 20 ed via the..
137e0 20 20 23 20 20 20 20 20 20 20 5b 73 65 74 75 70 # [setup
137f0 44 62 5d 20 70 72 6f 63 65 64 75 72 65 20 73 68 Db] procedure sh
13800 6f 75 6c 64 20 62 65 20 73 74 6f 72 65 64 20 74 ould be stored t
13810 68 65 72 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a here... #..
13820 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 76 upvar 1 $v
13830 61 72 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 20 arName db....
13840 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
13850 54 45 3a 20 43 6c 6f 73 65 20 74 68 65 20 63 6f TE: Close the co
13860 6e 6e 65 63 74 69 6f 6e 20 74 6f 20 74 68 65 20 nnection to the
13870 64 61 74 61 62 61 73 65 20 6e 6f 77 2e 20 20 54 database now. T
13880 68 69 73 20 73 68 6f 75 6c 64 20 61 6c 6c 6f 77 his should allow
13890 20 75 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 us.. #
138a0 20 20 20 74 6f 20 64 65 6c 65 74 65 20 74 68 65 to delete the
138b0 20 75 6e 64 65 72 6c 79 69 6e 67 20 64 61 74 61 underlying data
138c0 62 61 73 65 20 66 69 6c 65 2e 0d 0a 20 20 20 20 base file...
138d0 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
138e0 69 6e 66 6f 20 65 78 69 73 74 73 20 64 62 5d 20 info exists db]
138f0 26 26 20 5b 63 61 74 63 68 20 7b 73 71 6c 20 63 && [catch {sql c
13900 6c 6f 73 65 20 24 64 62 7d 20 65 72 72 6f 72 5d lose $db} error]
13910 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
13920 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
13930 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 20 OTE: We somehow
13940 66 61 69 6c 65 64 20 74 6f 20 63 6c 6f 73 65 20 failed to close
13950 74 68 65 20 64 61 74 61 62 61 73 65 2c 20 72 65 the database, re
13960 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 port why...
13970 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 70 #.. tp
13980 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
13990 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
139a0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
139b0 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 ==== WARNING: fa
139c0 69 6c 65 64 20 74 6f 20 63 6c 6f 73 65 20 64 61 iled to close da
139d0 74 61 62 61 73 65 20 5c 22 22 20 24 64 62 20 22 tabase \"" $db "
139e0 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a \", error: " \..
139f0 20 20 20 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 \n\t
13a00 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 $error \n]..
13a10 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
13a20 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 . # NOTE: F
13a30 69 72 73 74 2c 20 73 65 65 20 69 66 20 6f 75 72 irst, see if our
13a40 20 63 61 6c 6c 65 72 20 68 61 73 20 72 65 71 75 caller has requ
13a50 65 73 74 65 64 20 61 6e 20 69 6e 2d 6d 65 6d 6f ested an in-memo
13a60 72 79 20 64 61 74 61 62 61 73 65 2e 0d 0a 20 20 ry database...
13a70 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 #.. set
13a80 20 69 73 4d 65 6d 6f 72 79 20 5b 69 73 4d 65 6d isMemory [isMem
13a90 6f 72 79 44 62 20 24 66 69 6c 65 4e 61 6d 65 5d oryDb $fileName]
13aa0 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
13ab0 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 # NOTE: Build
13ac0 20 74 68 65 20 66 75 6c 6c 20 70 61 74 68 20 74 the full path t
13ad0 6f 20 74 68 65 20 64 61 74 61 62 61 73 65 20 66 o the database f
13ae0 69 6c 65 20 6e 61 6d 65 2e 20 20 46 6f 72 20 6e ile name. For n
13af0 6f 77 2c 20 61 6c 6c 20 74 65 73 74 0d 0a 20 20 ow, all test..
13b00 20 20 20 20 23 20 20 20 20 20 20 20 64 61 74 61 # data
13b10 62 61 73 65 20 66 69 6c 65 73 20 61 72 65 20 73 base files are s
13b20 74 6f 72 65 64 20 69 6e 20 74 68 65 20 74 65 6d tored in the tem
13b30 70 6f 72 61 72 79 20 64 69 72 65 63 74 6f 72 79 porary directory
13b40 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
13b50 20 20 69 66 20 7b 21 24 69 73 4d 65 6d 6f 72 79 if {!$isMemory
13b60 20 26 26 20 24 71 75 61 6c 69 66 79 7d 20 74 68 && $qualify} th
13b70 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 en {.. se
13b80 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 t fileName [file
13b90 20 6a 6f 69 6e 20 5b 67 65 74 44 61 74 61 62 61 join [getDataba
13ba0 73 65 44 69 72 65 63 74 6f 72 79 5d 20 5b 66 69 seDirectory] [fi
13bb0 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d le tail $fileNam
13bc0 65 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a e]].. }....
13bd0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
13be0 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 NOTE: Check if
13bf0 74 68 65 20 66 69 6c 65 20 73 74 69 6c 6c 20 65 the file still e
13c00 78 69 73 74 73 2e 0d 0a 20 20 20 20 20 20 23 0d xists... #.
13c10 0a 20 20 20 20 20 20 69 66 20 7b 21 24 69 73 4d . if {!$isM
13c20 65 6d 6f 72 79 20 26 26 20 24 64 65 6c 65 74 65 emory && $delete
13c30 20 26 26 20 5b 66 69 6c 65 20 65 78 69 73 74 73 && [file exists
13c40 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 $fileName]} the
13c50 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
13c60 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
13c70 53 6b 69 70 20 64 65 6c 65 74 69 6e 67 20 64 61 Skip deleting da
13c80 74 61 62 61 73 65 20 66 69 6c 65 73 20 69 66 20 tabase files if
13c90 73 6f 6d 65 62 6f 64 79 20 73 65 74 73 20 74 68 somebody sets th
13ca0 65 20 67 6c 6f 62 61 6c 0d 0a 20 20 20 20 20 20 e global..
13cb0 20 20 23 20 20 20 20 20 20 20 76 61 72 69 61 62 # variab
13cc0 6c 65 20 74 6f 20 70 72 65 76 65 6e 74 20 69 74 le to prevent it
13cd0 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
13ce0 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
13cf0 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6c 65 exists ::no(cle
13d00 61 6e 75 70 44 62 46 69 6c 65 29 5d 7d 20 74 68 anupDbFile)]} th
13d10 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
13d20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
13d30 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 OTE: Attempt to
13d40 64 65 6c 65 74 65 20 74 68 65 20 74 65 73 74 20 delete the test
13d50 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 6e 6f database file no
13d60 77 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d w... #.
13d70 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
13d80 73 65 74 20 63 6f 64 65 20 5b 63 61 74 63 68 20 set code [catch
13d90 7b 66 69 6c 65 20 64 65 6c 65 74 65 20 24 66 69 {file delete $fi
13da0 6c 65 4e 61 6d 65 7d 20 65 72 72 6f 72 5d 5d 7d leName} error]]}
13db0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
13dc0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
13dd0 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 65 20 73 # NOTE: We s
13de0 6f 6d 65 68 6f 77 20 66 61 69 6c 65 64 20 74 6f omehow failed to
13df0 20 64 65 6c 65 74 65 20 74 68 65 20 66 69 6c 65 delete the file
13e00 2c 20 72 65 70 6f 72 74 20 77 68 79 2e 0d 0a 20 , report why...
13e10 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
13e20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
13e30 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
13e40 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
13e50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
13e60 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 ==== WARNING: fa
13e70 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20 64 iled to delete d
13e80 61 74 61 62 61 73 65 20 66 69 6c 65 20 5c 22 22 atabase file \""
13e90 20 24 66 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 $fileName \..
13ea0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c "\
13eb0 22 20 64 75 72 69 6e 67 20 63 6c 65 61 6e 75 70 " during cleanup
13ec0 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 , error: " \n\t
13ed0 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 $error \n]..
13ee0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
13ef0 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
13f00 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
13f10 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 74 # NOTE: Show t
13f20 68 61 74 20 77 65 20 73 6b 69 70 70 65 64 20 64 hat we skipped d
13f30 65 6c 65 74 69 6e 67 20 74 68 65 20 66 69 6c 65 eleting the file
13f40 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
13f50 20 20 20 20 20 20 20 20 20 20 73 65 74 20 63 6f set co
13f60 64 65 20 30 0d 0a 0d 0a 20 20 20 20 20 20 20 20 de 0....
13f70 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
13f80 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
13f90 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
13fa0 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 "==== WARNI
13fb0 4e 47 3a 20 73 6b 69 70 70 65 64 20 64 65 6c 65 NG: skipped dele
13fc0 74 69 6e 67 20 64 61 74 61 62 61 73 65 20 66 69 ting database fi
13fd0 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 le \"" $fileName
13fe0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
13ff0 20 20 22 5c 22 20 64 75 72 69 6e 67 20 63 6c 65 "\" during cle
14000 61 6e 75 70 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 anup\n"]..
14010 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 }.. } els
14020 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a e {.. #..
14030 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
14040 54 68 65 20 66 69 6c 65 20 64 6f 65 73 20 6e 6f The file does no
14050 74 20 65 78 69 73 74 2c 20 73 75 63 63 65 73 73 t exist, success
14060 21 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 !.. #..
14070 20 20 20 20 20 20 73 65 74 20 63 6f 64 65 20 30 set code 0
14080 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
14090 20 20 20 72 65 74 75 72 6e 20 24 63 6f 64 65 0d return $code.
140a0 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
140b0 72 6f 63 20 73 65 74 75 70 44 62 49 6e 74 65 72 roc setupDbInter
140c0 72 75 70 74 43 61 6c 6c 62 61 63 6b 20 7b 20 63 ruptCallback { c
140d0 68 61 6e 6e 65 6c 20 6c 6f 67 20 7d 20 7b 0d 0a hannel log } {..
140e0 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
140f0 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 73 65 74 74 69 nnel "---- setti
14100 6e 67 20 75 70 20 64 65 62 75 67 67 65 72 20 69 ng up debugger i
14110 6e 74 65 72 72 75 70 74 20 63 61 6c 6c 62 61 63 nterrupt callbac
14120 6b 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 k... "....
14130 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 if {[catch {..
14140 20 20 20 20 20 20 73 65 74 20 3a 3a 65 6e 76 28 set ::env(
14150 71 75 69 65 74 46 69 6e 64 49 6e 74 65 72 70 72 quietFindInterpr
14160 65 74 65 72 54 65 73 74 50 61 74 68 29 20 31 0d eterTestPath) 1.
14170 0a 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a 65 . set ::e
14180 6e 76 28 71 75 69 65 74 53 65 74 75 70 49 6e 74 nv(quietSetupInt
14190 65 72 70 72 65 74 65 72 54 65 73 74 50 61 74 68 erpreterTestPath
141a0 29 20 31 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 ) 1.... t
141b0 72 79 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ry {..
141c0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
141d0 4f 54 45 3a 20 4d 61 6b 65 20 73 75 72 65 20 74 OTE: Make sure t
141e0 68 65 20 73 63 72 69 70 74 20 64 65 62 75 67 67 he script debugg
141f0 65 72 20 61 6e 64 20 74 68 65 20 69 73 6f 6c 61 er and the isola
14200 74 65 64 20 69 6e 74 65 72 70 72 65 74 65 72 0d ted interpreter.
14210 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
14220 20 20 20 61 72 65 20 73 65 74 75 70 20 61 6e 64 are setup and
14230 20 72 65 61 64 79 20 66 6f 72 20 75 73 65 2e 0d ready for use..
14240 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
14250 20 20 20 20 20 20 20 20 64 65 62 75 67 20 73 65 debug se
14260 74 75 70 20 74 72 75 65 20 74 72 75 65 0d 0a 0d tup true true...
14270 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
14280 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
14290 4c 6f 61 64 20 74 68 65 20 6e 65 63 65 73 73 61 Load the necessa
142a0 72 79 20 70 61 63 6b 61 67 65 73 20 69 6e 74 6f ry packages into
142b0 20 74 68 65 20 69 73 6f 6c 61 74 65 64 20 69 6e the isolated in
142c0 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 20 terpreter...
142d0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
142e0 20 20 20 64 65 62 75 67 20 65 76 61 6c 20 7b 0d debug eval {.
142f0 0a 20 20 20 20 20 20 20 20 20 20 20 20 70 61 63 . pac
14300 6b 61 67 65 20 72 65 71 75 69 72 65 20 45 61 67 kage require Eag
14310 6c 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 le..
14320 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 package require
14330 45 61 67 6c 65 2e 4c 69 62 72 61 72 79 0d 0a 20 Eagle.Library..
14340 20 20 20 20 20 20 20 20 20 20 20 70 61 63 6b 61 packa
14350 67 65 20 72 65 71 75 69 72 65 20 45 61 67 6c 65 ge require Eagle
14360 2e 54 65 73 74 0d 0a 20 20 20 20 20 20 20 20 20 .Test..
14370 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
14380 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
14390 4f 54 45 3a 20 43 6f 70 79 20 74 68 65 20 6e 65 OTE: Copy the ne
143a0 63 65 73 73 61 72 79 20 76 61 72 69 61 62 6c 65 cessary variable
143b0 73 20 69 6e 74 6f 20 74 68 65 20 69 73 6f 6c 61 s into the isola
143c0 74 65 64 20 69 6e 74 65 72 70 72 65 74 65 72 2e ted interpreter.
143d0 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
143e0 20 20 20 20 20 20 20 20 20 64 65 62 75 67 20 69 debug i
143f0 6e 76 6f 6b 65 20 30 20 73 65 74 20 3a 3a 74 65 nvoke 0 set ::te
14400 73 74 5f 63 68 61 6e 6e 65 6c 20 24 63 68 61 6e st_channel $chan
14410 6e 65 6c 3b 20 23 20 4e 4f 54 45 3a 20 46 6f 72 nel; # NOTE: For
14420 20 5b 74 70 75 74 73 5d 2e 0d 0a 20 20 20 20 20 [tputs]...
14430 20 20 20 20 20 64 65 62 75 67 20 69 6e 76 6f 6b debug invok
14440 65 20 30 20 73 65 74 20 3a 3a 74 65 73 74 5f 6c e 0 set ::test_l
14450 6f 67 20 24 6c 6f 67 3b 20 23 20 4e 4f 54 45 3a og $log; # NOTE:
14460 20 46 6f 72 20 5b 74 6c 6f 67 5d 2e 0d 0a 0d 0a For [tlog].....
14470 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
14480 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 # NOTE: I
14490 6e 73 74 61 6c 6c 20 74 68 65 20 63 61 6c 6c 62 nstall the callb
144a0 61 63 6b 20 73 63 72 69 70 74 20 74 6f 20 62 65 ack script to be
144b0 20 65 76 61 6c 75 61 74 65 64 20 69 6e 20 74 68 evaluated in th
144c0 65 20 69 73 6f 6c 61 74 65 64 0d 0a 20 20 20 20 e isolated..
144d0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 69 6e # in
144e0 74 65 72 70 72 65 74 65 72 20 77 68 65 6e 20 74 terpreter when t
144f0 68 69 73 20 69 6e 74 65 72 70 72 65 74 65 72 20 his interpreter
14500 69 73 20 69 6e 74 65 72 72 75 70 74 65 64 20 62 is interrupted b
14510 79 20 73 63 72 69 70 74 0d 0a 20 20 20 20 20 20 y script..
14520 20 20 20 20 23 20 20 20 20 20 20 20 63 61 6e 63 # canc
14530 65 6c 6c 61 74 69 6f 6e 2c 20 65 74 63 2e 0d 0a ellation, etc...
14540 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
14550 20 20 20 20 20 20 20 64 65 62 75 67 20 63 61 6c debug cal
14560 6c 62 61 63 6b 20 61 70 70 6c 79 20 7b 7b 73 65 lback apply {{se
14570 6e 64 65 72 20 65 7d 20 7b 0d 0a 20 20 20 20 20 nder e} {..
14580 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
14590 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 # NOTE: Ch
145a0 65 63 6b 20 69 66 20 74 68 69 73 20 63 61 6c 6c eck if this call
145b0 62 61 63 6b 20 69 73 20 6f 6e 65 20 74 68 61 74 back is one that
145c0 20 77 65 20 63 61 72 65 20 61 62 6f 75 74 2e 0d we care about..
145d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
145e0 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
145f0 22 43 61 6e 63 65 6c 65 64 22 20 69 6e 20 5b 73 "Canceled" in [s
14600 70 6c 69 74 20 5b 24 65 20 49 6e 74 65 72 72 75 plit [$e Interru
14610 70 74 54 79 70 65 5d 20 22 2c 20 22 5d 7d 20 74 ptType] ", "]} t
14620 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
14630 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
14640 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4d 61 # NOTE: Ma
14650 6b 65 20 73 75 72 65 20 74 68 65 20 5b 6f 62 6a ke sure the [obj
14660 65 63 74 5d 20 63 6f 6d 6d 61 6e 64 20 69 73 20 ect] command is
14670 61 76 61 69 6c 61 62 6c 65 2e 20 20 53 69 6e 63 available. Sinc
14680 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e..
14690 20 23 20 20 20 20 20 20 20 74 68 69 73 20 69 73 # this is
146a0 20 61 6e 20 69 73 6f 6c 61 74 65 64 20 69 6e 74 an isolated int
146b0 65 72 70 72 65 74 65 72 2c 20 63 68 65 63 6b 20 erpreter, check
146c0 66 6f 72 20 69 74 20 74 68 65 20 68 61 72 64 0d for it the hard.
146d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
146e0 20 20 20 20 20 20 20 77 61 79 2e 0d 0a 20 20 20 way...
146f0 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
14700 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
14710 5b 6c 6c 65 6e 67 74 68 20 5b 69 6e 66 6f 20 63 [llength [info c
14720 6f 6d 6d 61 6e 64 73 20 6f 62 6a 65 63 74 5d 5d ommands object]]
14730 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
14740 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
14750 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
14760 20 23 20 4e 4f 54 45 3a 20 49 74 65 72 61 74 65 # NOTE: Iterate
14770 20 74 68 72 6f 75 67 68 20 61 6c 6c 20 64 61 74 through all dat
14780 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e abase connection
14790 73 20 6b 6e 6f 77 6e 20 74 6f 20 74 68 65 0d 0a s known to the..
147a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
147b0 23 20 20 20 20 20 20 20 70 61 72 65 6e 74 20 69 # parent i
147c0 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 nterpreter...
147d0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
147e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
147f0 6f 62 6a 65 63 74 20 66 6f 72 65 61 63 68 20 2d object foreach -
14800 61 6c 69 61 73 20 70 61 69 72 20 5b 6f 62 6a 65 alias pair [obje
14810 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
14820 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 +NonPublic \..
14830 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
14840 20 20 20 24 65 20 49 6e 74 65 72 70 72 65 74 65 $e Interprete
14850 72 2e 63 6f 6e 6e 65 63 74 69 6f 6e 73 5d 20 7b r.connections] {
14860 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
14870 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
14880 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
14890 20 41 74 74 65 6d 70 74 20 74 6f 20 63 61 6e 63 Attempt to canc
148a0 65 6c 20 61 6e 79 20 53 51 4c 20 71 75 65 72 69 el any SQL queri
148b0 65 73 20 69 6e 20 70 72 6f 67 72 65 73 73 20 6f es in progress o
148c0 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 n..
148d0 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 69 # thi
148e0 73 20 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 s database conne
148f0 63 74 69 6f 6e 2e 0d 0a 20 20 20 20 20 20 20 20 ction...
14900 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
14910 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 i
14920 66 20 7b 5b 63 61 74 63 68 20 7b 24 70 61 69 72 f {[catch {$pair
14930 20 56 61 6c 75 65 2e 43 61 6e 63 65 6c 7d 20 65 Value.Cancel} e
14940 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 rror]} then {..
14950 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
14960 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
14970 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
14980 41 72 67 73 20 5c 6e 20 5c 0d 0a 20 20 20 20 20 Args \n \..
14990 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
149a0 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 "==== WARNING
149b0 3a 20 66 61 69 6c 65 64 20 74 6f 20 63 61 6e 63 : failed to canc
149c0 65 6c 20 71 75 65 72 79 20 66 6f 72 20 22 20 5c el query for " \
149d0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
149e0 20 20 20 20 20 20 20 20 20 20 22 63 6f 6e 6e 65 "conne
149f0 63 74 69 6f 6e 20 5c 22 22 20 5b 24 70 61 69 72 ction \"" [$pair
14a00 20 4b 65 79 5d 20 22 5c 22 2c 20 65 72 72 6f 72 Key] "\", error
14a10 3a 20 22 20 5c 6e 5c 74 20 5c 0d 0a 20 20 20 20 : " \n\t \..
14a20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
14a30 20 20 20 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a $error \n]..
14a40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
14a50 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
14a60 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
14a70 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
14a80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
14a90 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
14aa0 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
14ab0 73 20 5c 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 s \n \..
14ac0 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d "===
14ad0 3d 20 57 41 52 4e 49 4e 47 3a 20 63 61 6e 6e 6f = WARNING: canno
14ae0 74 20 63 61 6e 63 65 6c 20 61 6e 79 20 71 75 65 t cancel any que
14af0 72 69 65 73 3a 20 22 20 5c 0d 0a 20 20 20 20 20 ries: " \..
14b00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
14b10 74 68 65 20 5c 22 6f 62 6a 65 63 74 5c 22 20 63 the \"object\" c
14b20 6f 6d 6d 61 6e 64 20 69 73 20 6e 6f 74 20 61 76 ommand is not av
14b30 61 69 6c 61 62 6c 65 5c 6e 22 5d 0d 0a 20 20 20 ailable\n"]..
14b40 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
14b50 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
14b60 20 20 20 20 20 20 20 7d 7d 0d 0a 20 20 20 20 20 }}..
14b70 20 20 20 7d 20 66 69 6e 61 6c 6c 79 20 7b 0d 0a } finally {..
14b80 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 20 catch
14b90 7b 75 6e 73 65 74 20 3a 3a 65 6e 76 28 71 75 69 {unset ::env(qui
14ba0 65 74 53 65 74 75 70 49 6e 74 65 72 70 72 65 74 etSetupInterpret
14bb0 65 72 54 65 73 74 50 61 74 68 29 7d 0d 0a 20 20 erTestPath)}..
14bc0 20 20 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 catch {u
14bd0 6e 73 65 74 20 3a 3a 65 6e 76 28 71 75 69 65 74 nset ::env(quiet
14be0 46 69 6e 64 49 6e 74 65 72 70 72 65 74 65 72 54 FindInterpreterT
14bf0 65 73 74 50 61 74 68 29 7d 0d 0a 20 20 20 20 20 estPath)}..
14c00 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 72 }.. } er
14c10 72 6f 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ror] == 0} then
14c20 7b 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f {.. addCo
14c30 6e 73 74 72 61 69 6e 74 20 69 6e 74 65 72 72 75 nstraint interru
14c40 70 74 43 61 6c 6c 62 61 63 6b 2e 73 71 6c 69 74 ptCallback.sqlit
14c50 65 33 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 e3.... tp
14c60 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 79 65 73 uts $channel yes
14c70 5c 6e 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 \n.. } else
14c80 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 {.. tput
14c90 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
14ca0 6e 64 41 72 67 73 20 22 6e 6f 2c 20 65 72 72 6f ndArgs "no, erro
14cb0 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 r: " \n\t $error
14cc0 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 \n].. }..
14cd0 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
14ce0 63 20 63 6c 65 61 6e 75 70 46 69 6c 65 20 7b 20 c cleanupFile {
14cf0 66 69 6c 65 4e 61 6d 65 20 7b 63 6f 6c 6c 65 63 fileName {collec
14d00 74 20 74 72 75 65 7d 20 7b 66 6f 72 63 65 20 66 t true} {force f
14d10 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 alse} } {..
14d20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
14d30 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 66 6f 72 : Attempt to for
14d40 63 65 20 61 6c 6c 20 70 65 6e 64 69 6e 67 20 22 ce all pending "
14d50 67 61 72 62 61 67 65 22 20 6f 62 6a 65 63 74 73 garbage" objects
14d60 20 74 6f 20 62 65 20 63 6f 6c 6c 65 63 74 65 64 to be collected
14d70 2c 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 ,.. #
14d80 20 69 6e 63 6c 75 64 69 6e 67 20 53 51 4c 69 74 including SQLit
14d90 65 20 73 74 61 74 65 6d 65 6e 74 73 20 61 6e 64 e statements and
14da0 20 62 61 63 6b 75 70 20 6f 62 6a 65 63 74 73 3b backup objects;
14db0 20 74 68 69 73 20 73 68 6f 75 6c 64 20 61 6c 6c this should all
14dc0 6f 77 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ow.. #
14dd0 20 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 the underlying
14de0 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 74 database file t
14df0 6f 20 62 65 20 64 65 6c 65 74 65 64 2e 0d 0a 20 o be deleted...
14e00 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
14e10 20 7b 24 63 6f 6c 6c 65 63 74 7d 20 74 68 65 6e {$collect} then
14e20 20 7b 0d 0a 20 20 20 20 20 20 20 20 63 6f 6c 6c {.. coll
14e30 65 63 74 47 61 72 62 61 67 65 20 24 3a 3a 74 65 ectGarbage $::te
14e40 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 20 20 20 20 st_channel..
14e50 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
14e60 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 # NOTE: Ch
14e70 65 63 6b 20 69 66 20 74 68 65 20 66 69 6c 65 20 eck if the file
14e80 73 74 69 6c 6c 20 65 78 69 73 74 73 2e 0d 0a 20 still exists...
14e90 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
14ea0 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {[file exists $
14eb0 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 fileName]} then
14ec0 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
14ed0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b # NOTE: Sk
14ee0 69 70 20 64 65 6c 65 74 69 6e 67 20 74 65 73 74 ip deleting test
14ef0 20 66 69 6c 65 73 20 69 66 20 73 6f 6d 65 62 6f files if somebo
14f00 64 79 20 73 65 74 73 20 74 68 65 20 67 6c 6f 62 dy sets the glob
14f10 61 6c 20 76 61 72 69 61 62 6c 65 0d 0a 20 20 20 al variable..
14f20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 # to
14f30 70 72 65 76 65 6e 74 20 69 74 2e 0d 0a 20 20 20 prevent it...
14f40 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
14f50 69 66 20 7b 24 66 6f 72 63 65 20 7c 7c 20 21 5b if {$force || ![
14f60 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
14f70 28 63 6c 65 61 6e 75 70 46 69 6c 65 29 5d 7d 20 (cleanupFile)]}
14f80 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
14f90 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
14fa0 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 NOTE: Attempt t
14fb0 6f 20 64 65 6c 65 74 65 20 74 68 65 20 74 65 73 o delete the tes
14fc0 74 20 66 69 6c 65 20 6e 6f 77 2e 0d 0a 20 20 20 t file now...
14fd0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
14fe0 20 20 20 20 69 66 20 7b 5b 73 65 74 20 63 6f 64 if {[set cod
14ff0 65 20 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 64 e [catch {file d
15000 65 6c 65 74 65 20 24 66 69 6c 65 4e 61 6d 65 7d elete $fileName}
15010 20 65 72 72 6f 72 5d 5d 7d 20 74 68 65 6e 20 7b error]]} then {
15020 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d .. #.
15030 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e . # N
15040 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 20 OTE: We somehow
15050 66 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 failed to delete
15060 20 74 68 65 20 66 69 6c 65 2c 20 72 65 70 6f 72 the file, repor
15070 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 20 t why...
15080 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
15090 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
150a0 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
150b0 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
150c0 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 "==== WA
150d0 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f RNING: failed to
150e0 20 64 65 6c 65 74 65 20 74 65 73 74 20 66 69 6c delete test fil
150f0 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 e \"" $fileName
15100 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
15110 20 20 20 22 5c 22 20 64 75 72 69 6e 67 20 63 6c "\" during cl
15120 65 61 6e 75 70 2c 20 65 72 72 6f 72 3a 20 22 20 eanup, error: "
15130 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d \n\t $error \n].
15140 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
15150 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
15160 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
15170 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 # NOTE: S
15180 68 6f 77 20 74 68 61 74 20 77 65 20 73 6b 69 70 how that we skip
15190 70 65 64 20 64 65 6c 65 74 69 6e 67 20 74 68 65 ped deleting the
151a0 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 file...
151b0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 73 #.. s
151c0 65 74 20 63 6f 64 65 20 30 0d 0a 0d 0a 20 20 20 et code 0....
151d0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
151e0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
151f0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
15200 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
15210 57 41 52 4e 49 4e 47 3a 20 73 6b 69 70 70 65 64 WARNING: skipped
15220 20 64 65 6c 65 74 69 6e 67 20 74 65 73 74 20 66 deleting test f
15230 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d ile \"" $fileNam
15240 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
15250 20 20 20 22 5c 22 20 64 75 72 69 6e 67 20 63 6c "\" during cl
15260 65 61 6e 75 70 5c 6e 22 5d 0d 0a 20 20 20 20 20 eanup\n"]..
15270 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c }.. } el
15280 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d se {.. #.
15290 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
152a0 20 54 68 65 20 66 69 6c 65 20 64 6f 65 73 20 6e The file does n
152b0 6f 74 20 65 78 69 73 74 2c 20 73 75 63 63 65 73 ot exist, succes
152c0 73 21 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 s!.. #..
152d0 20 20 20 20 20 20 20 73 65 74 20 63 6f 64 65 20 set code
152e0 30 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 0.. }....
152f0 20 20 20 20 72 65 74 75 72 6e 20 24 63 6f 64 65 return $code
15300 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
15310 70 72 6f 63 20 63 6f 6c 6c 65 63 74 47 61 72 62 proc collectGarb
15320 61 67 65 20 7b 20 63 68 61 6e 6e 65 6c 20 7b 6d age { channel {m
15330 69 6c 6c 69 73 65 63 6f 6e 64 73 20 31 30 30 30 illiseconds 1000
15340 7d 20 7b 71 75 69 65 74 20 74 72 75 65 7d 20 7d } {quiet true} }
15350 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 {.. if {[h
15360 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 aveSQLiteObjectC
15370 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d ommand]} then {.
15380 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 . if {[ca
15390 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
153a0 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 47 object invoke G
153b0 43 20 47 65 74 54 6f 74 61 6c 4d 65 6d 6f 72 79 C GetTotalMemory
153c0 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 false..
153d0 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 } result] == 0}
153e0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
153f0 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
15400 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
15410 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
15420 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
15430 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
15440 20 22 2d 2d 2d 2d 20 6d 65 6d 6f 72 79 20 69 6e "---- memory in
15450 20 75 73 65 20 62 79 20 74 68 65 20 43 4c 52 20 use by the CLR
15460 62 65 66 6f 72 65 20 63 6f 6c 6c 65 63 74 69 6f before collectio
15470 6e 2e 2e 2e 20 22 20 5c 0d 0a 20 20 20 20 20 20 n... " \..
15480 20 20 20 20 20 20 20 20 20 20 24 72 65 73 75 6c $resul
15490 74 20 22 20 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 t " bytes\n"]..
154a0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
154b0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
154c0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
154d0 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
154e0 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
154f0 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e "==== WARNIN
15500 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 67 65 74 G: failed to get
15510 20 43 4c 52 20 6d 65 6d 6f 72 79 20 75 73 61 67 CLR memory usag
15520 65 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 e, error: " \..
15530 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 6e 5c \n\
15540 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 t $result \n]..
15550 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
15560 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 23 23 23 23 }.... #####
15570 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15580 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15590 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
155a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
155b0 23 23 23 23 0d 0a 0d 0a 20 20 20 20 20 20 23 0d ####.... #.
155c0 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 . # NOTE: R
155d0 65 70 65 61 74 65 64 6c 79 20 61 74 74 65 6d 70 epeatedly attemp
155e0 74 20 74 6f 20 63 6f 6c 6c 65 63 74 20 67 61 72 t to collect gar
155f0 62 61 67 65 20 75 6e 74 69 6c 20 74 68 65 20 61 bage until the a
15600 6c 6c 6f 74 74 65 64 20 6e 75 6d 62 65 72 0d 0a llotted number..
15610 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 66 # of
15620 20 6d 69 6c 6c 69 73 65 63 6f 6e 64 73 20 68 61 milliseconds ha
15630 73 20 65 6c 61 70 73 65 64 2e 20 20 41 6c 77 61 s elapsed. Alwa
15640 79 73 20 61 74 74 65 6d 70 74 20 74 6f 20 63 6f ys attempt to co
15650 6c 6c 65 63 74 20 67 61 72 62 61 67 65 0d 0a 20 llect garbage..
15660 20 20 20 20 20 23 20 20 20 20 20 20 20 61 74 20 # at
15670 6c 65 61 73 74 20 6f 6e 63 65 2e 0d 0a 20 20 20 least once...
15680 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
15690 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 [haveSQLiteObjec
156a0 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 tCommand]} then
156b0 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 73 {.. set s
156c0 74 61 72 74 20 5b 63 6c 6f 63 6b 20 73 65 63 6f tart [clock seco
156d0 6e 64 73 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 nds].. se
156e0 74 20 73 74 6f 70 20 5b 65 78 70 72 20 7b 24 73 t stop [expr {$s
156f0 74 61 72 74 20 2b 20 28 24 6d 69 6c 6c 69 73 65 tart + ($millise
15700 63 6f 6e 64 73 20 2f 20 31 30 30 30 29 7d 5d 0d conds / 1000)}].
15710 0a 0d 0a 20 20 20 20 20 20 20 20 64 6f 20 7b 0d ... do {.
15720 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
15730 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
15740 41 74 74 65 6d 70 74 20 74 6f 20 66 6f 72 63 65 Attempt to force
15750 20 61 20 66 75 6c 6c 20 67 61 72 62 61 67 65 20 a full garbage
15760 63 6f 6c 6c 65 63 74 69 6f 6e 20 6e 6f 77 2e 20 collection now.
15770 20 52 65 70 6f 72 74 20 61 6e 79 0d 0a 20 20 20 Report any..
15780 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 65 # e
15790 72 72 6f 72 20 74 68 61 74 20 69 73 20 65 6e 63 rror that is enc
157a0 6f 75 6e 74 65 72 65 64 20 69 66 20 77 65 20 66 ountered if we f
157b0 61 69 6c 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ail...
157c0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 #.. if
157d0 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
157e0 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
157f0 76 6f 6b 65 20 47 43 20 47 65 74 54 6f 74 61 6c voke GC GetTotal
15800 4d 65 6d 6f 72 79 20 74 72 75 65 0d 0a 20 20 20 Memory true..
15810 20 20 20 20 20 20 20 7d 20 65 72 72 6f 72 5d 7d } error]}
15820 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
15830 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
15840 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
15850 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
15860 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 "==== WARNING
15870 3a 20 66 61 69 6c 65 64 20 66 75 6c 6c 20 67 61 : failed full ga
15880 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e rbage collection
15890 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 , error: " \..
158a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 6e \n
158b0 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 \t $error \n]..
158c0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
158d0 20 20 20 20 20 20 20 20 73 65 74 20 6e 6f 77 20 set now
158e0 5b 63 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d 0d [clock seconds].
158f0 0a 20 20 20 20 20 20 20 20 7d 20 77 68 69 6c 65 . } while
15900 20 7b 24 73 74 61 72 74 20 3c 3d 20 24 6e 6f 77 {$start <= $now
15910 20 26 26 20 24 6e 6f 77 20 3c 20 24 73 74 6f 70 && $now < $stop
15920 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
15930 20 20 20 20 23 23 23 23 23 23 23 23 23 23 23 23 ############
15940 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15950 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15960 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
15970 23 23 23 23 23 23 23 23 23 23 23 23 23 0d 0a 0d #############...
15980 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 . if {[have
15990 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d SQLiteObjectComm
159a0 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 and]} then {..
159b0 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
159c0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 {.. ob
159d0 6a 65 63 74 20 69 6e 76 6f 6b 65 20 47 43 20 47 ject invoke GC G
159e0 65 74 54 6f 74 61 6c 4d 65 6d 6f 72 79 20 66 61 etTotalMemory fa
159f0 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 7d 20 72 lse.. } r
15a00 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 esult] == 0} the
15a10 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 n {.. i
15a20 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
15a30 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
15a40 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
15a50 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
15a60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
15a70 2d 2d 2d 20 6d 65 6d 6f 72 79 20 69 6e 20 75 73 --- memory in us
15a80 65 20 62 79 20 74 68 65 20 43 4c 52 20 61 66 74 e by the CLR aft
15a90 65 72 20 63 6f 6c 6c 65 63 74 69 6f 6e 2e 2e 2e er collection...
15aa0 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 " \..
15ab0 20 20 20 20 20 20 24 72 65 73 75 6c 74 20 22 20 $result "
15ac0 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 bytes\n"]..
15ad0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
15ae0 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
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 5c el [appendArgs \
15b10 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
15b20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 "==== WARNING: f
15b30 61 69 6c 65 64 20 74 6f 20 67 65 74 20 43 4c 52 ailed to get CLR
15b40 20 6d 65 6d 6f 72 79 20 75 73 61 67 65 2c 20 65 memory usage, e
15b50 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 rror: " \..
15b60 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 72 \n\t $r
15b70 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 esult \n]..
15b80 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
15b90 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
15ba0 63 20 67 65 74 53 51 4c 69 74 65 48 61 6e 64 6c c getSQLiteHandl
15bb0 65 43 6f 75 6e 74 73 20 7b 20 63 68 61 6e 6e 65 eCounts { channe
15bc0 6c 20 7b 71 75 69 65 74 20 66 61 6c 73 65 7d 20 l {quiet false}
15bd0 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 72 } {.. set r
15be0 65 73 75 6c 74 20 5b 6c 69 73 74 5d 0d 0a 0d 0a esult [list]....
15bf0 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 if {[haveS
15c00 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 QLiteObjectComma
15c10 6e 64 5d 20 26 26 20 5b 68 61 76 65 43 6f 6e 73 nd] && [haveCons
15c20 74 72 61 69 6e 74 20 5c 0d 0a 20 20 20 20 20 20 traint \..
15c30 20 20 20 20 20 20 20 20 64 65 66 69 6e 65 43 6f defineCo
15c40 6e 73 74 61 6e 74 2e 53 79 73 74 65 6d 2e 44 61 nstant.System.Da
15c50 74 61 2e 53 51 4c 69 74 65 2e 43 4f 55 4e 54 5f ta.SQLite.COUNT_
15c60 48 41 4e 44 4c 45 5d 7d 20 74 68 65 6e 20 7b 0d HANDLE]} then {.
15c70 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
15c80 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 # NOTE: Add
15c90 65 61 63 68 20 63 72 69 74 69 63 61 6c 20 68 61 each critical ha
15ca0 6e 64 6c 65 20 63 6f 75 6e 74 20 74 6f 20 74 68 ndle count to th
15cb0 65 20 72 65 73 75 6c 74 69 6e 67 20 6c 69 73 74 e resulting list
15cc0 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
15cd0 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 6e 61 foreach na
15ce0 6d 65 20 5b 6c 69 73 74 20 63 6f 6e 6e 65 63 74 me [list connect
15cf0 69 6f 6e 43 6f 75 6e 74 20 73 74 61 74 65 6d 65 ionCount stateme
15d00 6e 74 43 6f 75 6e 74 20 62 61 63 6b 75 70 43 6f ntCount backupCo
15d10 75 6e 74 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 unt] {..
15d20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
15d30 20 20 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 obje
15d40 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
15d50 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 +NonPublic \..
15d60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 S
15d70 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
15d80 65 2e 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 e.UnsafeNativeMe
15d90 74 68 6f 64 73 20 24 6e 61 6d 65 0d 0a 20 20 20 thods $name..
15da0 20 20 20 20 20 20 20 7d 20 76 61 6c 75 65 5d 20 } value]
15db0 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
15dc0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
15dd0 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
15de0 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 tpu
15df0 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
15e00 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
15e10 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
15e20 2d 2d 20 63 72 69 74 69 63 61 6c 20 68 61 6e 64 -- critical hand
15e30 6c 65 20 63 6f 75 6e 74 20 5c 22 22 20 24 6e 61 le count \"" $na
15e40 6d 65 20 22 5c 22 20 69 73 20 22 20 24 76 61 6c me "\" is " $val
15e50 75 65 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 ue \n]..
15e60 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
15e70 20 20 20 20 20 6c 61 70 70 65 6e 64 20 72 65 73 lappend res
15e80 75 6c 74 20 24 76 61 6c 75 65 0d 0a 20 20 20 20 ult $value..
15e90 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
15ea0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
15eb0 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
15ec0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
15ed0 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
15ee0 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
15ef0 74 6f 20 67 65 74 20 63 72 69 74 69 63 61 6c 20 to get critical
15f00 68 61 6e 64 6c 65 20 63 6f 75 6e 74 20 5c 22 22 handle count \""
15f10 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
15f20 20 20 20 20 24 6e 61 6d 65 20 22 5c 22 2c 20 65 $name "\", e
15f30 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 76 61 rror: " \n\t $va
15f40 6c 75 65 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 lue \n]..
15f50 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
15f60 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 . } elseif
15f70 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
15f80 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
15f90 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 # NOTE: The
15fa0 20 61 63 74 75 61 6c 20 68 61 6e 64 6c 65 20 63 actual handle c
15fb0 6f 75 6e 74 73 20 61 72 65 20 6e 6f 74 20 61 76 ounts are not av
15fc0 61 69 6c 61 62 6c 65 3b 20 74 68 65 72 65 66 6f ailable; therefo
15fd0 72 65 2c 20 6a 75 73 74 0d 0a 20 20 20 20 20 20 re, just..
15fe0 20 20 23 20 20 20 20 20 20 20 72 65 74 75 72 6e # return
15ff0 20 61 6e 20 65 6d 70 74 79 20 6c 69 73 74 2e 0d an empty list..
16000 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
16010 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
16020 65 6c 20 22 2d 2d 2d 2d 20 63 72 69 74 69 63 61 el "---- critica
16030 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 73 20 l handle counts
16040 75 6e 61 76 61 69 6c 61 62 6c 65 5c 6e 22 0d 0a unavailable\n"..
16050 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
16060 20 72 65 74 75 72 6e 20 24 72 65 73 75 6c 74 0d return $result.
16070 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
16080 72 6f 63 20 73 68 75 74 64 6f 77 6e 53 51 4c 69 roc shutdownSQLi
16090 74 65 20 7b 20 63 68 61 6e 6e 65 6c 20 7b 66 6f te { channel {fo
160a0 72 63 65 20 66 61 6c 73 65 7d 20 7b 71 75 69 65 rce false} {quie
160b0 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 t false} } {..
160c0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
160d0 4f 54 45 3a 20 4d 61 6b 65 20 73 75 72 65 20 74 OTE: Make sure t
160e0 68 61 74 20 53 51 4c 69 74 65 20 63 6f 72 65 20 hat SQLite core
160f0 6c 69 62 72 61 72 79 20 69 73 20 63 6f 6d 70 6c library is compl
16100 65 74 65 6c 79 20 73 68 75 74 64 6f 77 6e 2e 20 etely shutdown.
16110 20 54 68 69 73 0d 0a 20 20 20 20 20 20 23 20 20 This.. #
16120 20 20 20 20 20 69 73 20 75 73 65 64 20 62 79 20 is used by
16130 74 65 73 74 73 20 74 68 61 74 20 63 68 61 6e 67 tests that chang
16140 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 e configuration
16150 6f 70 74 69 6f 6e 73 20 61 6e 64 2f 6f 72 20 74 options and/or t
16160 68 6f 73 65 0d 0a 20 20 20 20 20 20 23 20 20 20 hose.. #
16170 20 20 20 20 74 68 61 74 20 6e 65 65 64 20 74 6f that need to
16180 20 6d 61 6b 65 20 73 75 72 65 20 6c 6f 67 67 69 make sure loggi
16190 6e 67 20 69 73 20 69 6e 69 74 69 61 6c 69 7a 65 ng is initialize
161a0 64 20 28 69 2e 65 2e 20 6a 75 73 74 20 69 6e 20 d (i.e. just in
161b0 63 61 73 65 0d 0a 20 20 20 20 20 20 23 20 20 20 case.. #
161c0 20 20 20 20 74 68 65 20 53 51 4c 69 74 65 20 63 the SQLite c
161d0 6f 72 65 20 6c 69 62 72 61 72 79 20 77 61 73 20 ore library was
161e0 69 6e 69 74 69 61 6c 69 7a 65 64 20 69 6e 20 74 initialized in t
161f0 68 65 20 70 72 6f 63 65 73 73 20 70 72 69 6f 72 he process prior
16200 20 74 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 20 to.. #
16210 20 20 20 74 68 65 20 53 51 4c 69 74 65 4c 6f 67 the SQLiteLog
16220 20 63 6c 61 73 73 20 62 65 69 6e 67 20 61 62 6c class being abl
16230 65 20 74 6f 20 73 65 74 75 70 20 69 74 73 20 6c e to setup its l
16240 6f 67 67 69 6e 67 20 63 61 6c 6c 62 61 63 6b 29 ogging callback)
16250 2e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 ... #
16260 20 4e 6f 72 6d 61 6c 6c 79 2c 20 74 68 69 73 20 Normally, this
16270 73 68 6f 75 6c 64 20 6f 6e 6c 79 20 62 65 20 70 should only be p
16280 65 72 66 6f 72 6d 65 64 20 69 66 20 53 51 4c 69 erformed if SQLi
16290 74 65 20 69 73 20 6c 6f 61 64 65 64 20 61 6e 64 te is loaded and
162a0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
162b0 72 65 61 64 79 20 66 6f 72 20 75 73 65 20 62 79 ready for use by
162c0 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 2e the test suite.
162d0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
162e0 20 69 66 20 7b 24 66 6f 72 63 65 20 7c 7c 20 5b if {$force || [
162f0 69 73 53 51 4c 69 74 65 52 65 61 64 79 5d 7d 20 isSQLiteReady]}
16300 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
16310 23 0d 0a 20 20 20 20 20 20 20 20 23 20 42 55 47 #.. # BUG
16320 46 49 58 3a 20 4d 61 6b 65 20 73 75 72 65 20 74 FIX: Make sure t
16330 68 61 74 20 61 6e 79 20 22 6c 65 61 6b 65 64 22 hat any "leaked"
16340 20 74 72 61 6e 73 61 63 74 69 6f 6e 73 20 61 6e transactions an
16350 64 2f 6f 72 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 d/or connections
16360 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
16370 20 20 20 20 61 72 65 20 63 6c 65 61 6e 65 64 20 are cleaned
16380 75 70 20 62 65 66 6f 72 65 20 63 61 6c 6c 69 6e up before callin
16390 67 20 74 68 65 20 6e 61 74 69 76 65 20 73 68 75 g the native shu
163a0 74 64 6f 77 6e 20 66 75 6e 63 74 69 6f 6e 2e 0d tdown function..
163b0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
163c0 20 20 20 20 66 6f 72 65 61 63 68 20 74 72 61 6e foreach tran
163d0 73 61 63 74 69 6f 6e 20 5b 69 6e 66 6f 20 74 72 saction [info tr
163e0 61 6e 73 61 63 74 69 6f 6e 73 5d 20 7b 0d 0a 20 ansactions] {..
163f0 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 if {[st
16400 72 69 6e 67 20 6d 61 74 63 68 20 5c 0d 0a 20 20 ring match \..
16410 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
16420 65 6d 23 44 61 74 61 23 53 51 4c 69 74 65 23 53 em#Data#SQLite#S
16430 51 4c 69 74 65 54 72 61 6e 73 61 63 74 69 6f 6e QLiteTransaction
16440 23 2a 20 24 74 72 61 6e 73 61 63 74 69 6f 6e 5d #* $transaction]
16450 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
16460 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
16470 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
16480 20 20 73 71 6c 20 74 72 61 6e 73 61 63 74 69 6f sql transactio
16490 6e 20 72 6f 6c 6c 62 61 63 6b 20 24 74 72 61 6e n rollback $tran
164a0 73 61 63 74 69 6f 6e 0d 0a 20 20 20 20 20 20 20 saction..
164b0 20 20 20 20 20 7d 20 65 72 72 6f 72 5d 20 3d 3d } error] ==
164c0 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
164d0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
164e0 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
164f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
16500 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
16510 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
16520 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
16530 20 22 2d 2d 2d 2d 20 72 6f 6c 6c 65 64 20 62 61 "---- rolled ba
16540 63 6b 20 6c 65 61 6b 65 64 20 74 72 61 6e 73 61 ck leaked transa
16550 63 74 69 6f 6e 20 5c 22 22 20 5c 0d 0a 20 20 20 ction \"" \..
16560 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
16570 20 24 74 72 61 6e 73 61 63 74 69 6f 6e 20 5c 22 $transaction \"
16580 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 \n]..
16590 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
165a0 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
165b0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
165c0 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
165d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
165e0 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
165f0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
16600 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
16610 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 "==== WARNING:
16620 66 61 69 6c 65 64 20 74 6f 20 72 6f 6c 6c 62 61 failed to rollba
16630 63 6b 20 6c 65 61 6b 65 64 20 74 72 61 6e 73 61 ck leaked transa
16640 63 74 69 6f 6e 20 5c 22 22 20 5c 0d 0a 20 20 20 ction \"" \..
16650 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
16660 20 24 74 72 61 6e 73 61 63 74 69 6f 6e 20 22 5c $transaction "\
16670 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 ", error: " \n\t
16680 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 $error \n]..
16690 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
166a0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
166b0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
166c0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 66 }.... f
166d0 6f 72 65 61 63 68 20 64 62 20 5b 69 6e 66 6f 20 oreach db [info
166e0 63 6f 6e 6e 65 63 74 69 6f 6e 73 5d 20 7b 0d 0a connections] {..
166f0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 if {[s
16700 74 72 69 6e 67 20 6d 61 74 63 68 20 5c 0d 0a 20 tring match \..
16710 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 Sys
16720 74 65 6d 23 44 61 74 61 23 53 51 4c 69 74 65 23 tem#Data#SQLite#
16730 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e SQLiteConnection
16740 23 2a 20 24 64 62 5d 7d 20 74 68 65 6e 20 7b 0d #* $db]} then {.
16750 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
16760 7b 5b 63 61 74 63 68 20 7b 73 71 6c 20 63 6c 6f {[catch {sql clo
16770 73 65 20 24 64 62 7d 20 65 72 72 6f 72 5d 20 3d se $db} error] =
16780 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
16790 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
167a0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
167b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
167c0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
167d0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
167e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
167f0 20 20 22 2d 2d 2d 2d 20 63 6c 6f 73 65 64 20 6c "---- closed l
16800 65 61 6b 65 64 20 64 61 74 61 62 61 73 65 20 5c eaked database \
16810 22 22 20 24 64 62 20 5c 22 5c 6e 5d 0d 0a 20 20 "" $db \"\n]..
16820 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
16830 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 } els
16840 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
16850 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
16860 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
16870 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
16880 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
16890 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
168a0 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
168b0 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
168c0 74 6f 20 63 6c 6f 73 65 20 6c 65 61 6b 65 64 20 to close leaked
168d0 64 61 74 61 62 61 73 65 20 5c 22 22 20 5c 0d 0a database \"" \..
168e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
168f0 20 20 20 20 24 64 62 20 22 5c 22 2c 20 65 72 72 $db "\", err
16900 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f or: " \n\t $erro
16910 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 r \n]..
16920 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
16930 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
16940 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
16950 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
16960 20 20 20 20 23 20 42 55 47 46 49 58 3a 20 42 65 # BUGFIX: Be
16970 66 6f 72 65 20 63 61 6c 6c 69 6e 67 20 74 68 65 fore calling the
16980 20 6e 61 74 69 76 65 20 73 68 75 74 64 6f 77 6e native shutdown
16990 20 66 75 6e 63 74 69 6f 6e 2c 20 6d 61 6b 65 20 function, make
169a0 73 75 72 65 20 62 6f 74 68 0d 0a 20 20 20 20 20 sure both..
169b0 20 20 20 23 20 20 20 20 20 20 20 20 20 6f 66 20 # of
169c0 74 68 65 20 50 52 41 47 4d 41 20 72 65 6c 61 74 the PRAGMA relat
169d0 65 64 20 64 69 72 65 63 74 6f 72 79 20 6e 61 6d ed directory nam
169e0 65 73 20 61 72 65 20 66 72 65 65 64 2e 0d 0a 20 es are freed...
169f0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
16a00 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 checkForSQLite
16a10 44 69 72 65 63 74 6f 72 69 65 73 20 24 63 68 61 Directories $cha
16a20 6e 6e 65 6c 20 74 72 75 65 0d 0a 0d 0a 20 20 20 nnel true....
16a30 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
16a40 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a {.. obj
16a50 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 ect invoke -flag
16a60 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a s +NonPublic \..
16a70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 Sy
16a80 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
16a90 2e 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 .UnsafeNativeMet
16aa0 68 6f 64 73 20 73 71 6c 69 74 65 33 5f 73 68 75 hods sqlite3_shu
16ab0 74 64 6f 77 6e 0d 0a 20 20 20 20 20 20 20 20 7d tdown.. }
16ac0 20 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 result] == 0} t
16ad0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
16ae0 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
16af0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
16b00 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
16b10 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
16b20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
16b30 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 74 "---- call sqlit
16b40 65 33 5f 73 68 75 74 64 6f 77 6e 28 29 2e 2e 2e e3_shutdown()...
16b50 20 6f 6b 3a 20 22 20 24 72 65 73 75 6c 74 20 5c ok: " $result \
16b60 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d n].. }.
16b70 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 . } else
16b80 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 {.. if
16b90 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
16ba0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
16bb0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
16bc0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
16bd0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
16be0 2d 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 5f 73 - call sqlite3_s
16bf0 68 75 74 64 6f 77 6e 28 29 2e 2e 2e 20 65 72 72 hutdown()... err
16c00 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 72 65 73 75 or: " \n\t $resu
16c10 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 lt \n]..
16c20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
16c30 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
16c40 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 65 70 6f ... proc repo
16c50 72 74 53 51 4c 69 74 65 52 65 73 6f 75 72 63 65 rtSQLiteResource
16c60 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
16c70 20 63 68 61 6e 6e 65 6c 20 7b 71 75 69 65 74 20 channel {quiet
16c80 66 61 6c 73 65 7d 20 7b 72 65 73 65 74 20 74 72 false} {reset tr
16c90 75 65 7d 20 7b 63 6f 6c 6c 65 63 74 20 74 72 75 ue} {collect tru
16ca0 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d e} } {.. #.
16cb0 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 . # NOTE: I
16cc0 66 20 61 76 61 69 6c 61 62 6c 65 2c 20 72 65 70 f available, rep
16cd0 6f 72 74 20 6f 6e 20 28 61 6e 64 20 70 6f 73 73 ort on (and poss
16ce0 69 62 6c 79 20 72 65 73 65 74 29 20 74 68 65 20 ibly reset) the
16cf0 72 75 6e 74 69 6d 65 0d 0a 20 20 20 20 20 20 23 runtime.. #
16d00 20 20 20 20 20 20 20 63 6f 6e 66 69 67 75 72 61 configura
16d10 74 69 6f 6e 20 73 74 61 74 69 73 74 69 63 73 2e tion statistics.
16d20 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
16d30 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 if {[haveSQLite
16d40 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 20 26 ObjectCommand] &
16d50 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b & \.. [
16d60 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 62 haveConstraint b
16d70 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 74 69 6f uildConfiguratio
16d80 6e 2e 44 65 62 75 67 5d 20 26 26 20 5b 63 61 74 n.Debug] && [cat
16d90 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 ch {.. ob
16da0 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 ject invoke -fla
16db0 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 2d 61 gs +NonPublic -a
16dc0 6c 69 61 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 lias \..
16dd0 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e System.Data.
16de0 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e 61 74 SQLite.UnsafeNat
16df0 69 76 65 4d 65 74 68 6f 64 73 20 73 65 74 74 69 iveMethods setti
16e00 6e 67 52 65 61 64 43 6f 75 6e 74 73 0d 0a 20 20 ngReadCounts..
16e10 20 20 20 20 7d 20 73 65 74 74 69 6e 67 52 65 61 } settingRea
16e20 64 43 6f 75 6e 74 73 5d 20 3d 3d 20 30 7d 20 74 dCounts] == 0} t
16e30 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 hen {.. s
16e40 65 74 20 6e 61 6d 65 43 6f 75 6e 74 20 5b 24 73 et nameCount [$s
16e50 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e 74 73 ettingReadCounts
16e60 20 43 6f 75 6e 74 5d 0d 0a 20 20 20 20 20 20 20 Count]..
16e70 20 73 65 74 20 76 61 6c 75 65 43 6f 75 6e 74 20 set valueCount
16e80 30 0d 0a 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 0.... obj
16e90 65 63 74 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 ect foreach -ali
16ea0 61 73 20 70 61 69 72 20 24 73 65 74 74 69 6e 67 as pair $setting
16eb0 52 65 61 64 43 6f 75 6e 74 73 20 7b 0d 0a 20 20 ReadCounts {..
16ec0 20 20 20 20 20 20 20 20 69 6e 63 72 20 76 61 6c incr val
16ed0 75 65 43 6f 75 6e 74 20 5b 24 70 61 69 72 20 56 ueCount [$pair V
16ee0 61 6c 75 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 alue]....
16ef0 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
16f00 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
16f10 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
16f20 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
16f30 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
16f40 20 20 22 2d 2d 2d 2d 20 73 65 74 74 69 6e 67 20 "---- setting
16f50 5c 22 22 20 5b 24 70 61 69 72 20 4b 65 79 5d 20 \"" [$pair Key]
16f60 22 5c 22 20 77 61 73 20 72 65 61 64 20 22 20 5c "\" was read " \
16f70 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
16f80 20 20 5b 24 70 61 69 72 20 56 61 6c 75 65 5d 20 [$pair Value]
16f90 22 20 74 69 6d 65 73 5c 6e 22 5d 0d 0a 20 20 20 " times\n"]..
16fa0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
16fb0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
16fc0 66 20 7b 24 72 65 73 65 74 7d 20 74 68 65 6e 20 f {$reset} then
16fd0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 {.. if
16fe0 7b 5b 63 61 74 63 68 20 7b 24 73 65 74 74 69 6e {[catch {$settin
16ff0 67 52 65 61 64 43 6f 75 6e 74 73 20 43 6c 65 61 gReadCounts Clea
17000 72 7d 20 65 72 72 6f 72 5d 20 3d 3d 20 30 7d 20 r} error] == 0}
17010 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
17020 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
17030 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
17040 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
17050 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
17060 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
17070 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 72 65 73 "---- res
17080 65 74 20 73 65 74 74 69 6e 67 20 73 74 61 74 69 et setting stati
17090 73 74 69 63 73 20 66 6f 72 20 74 68 65 20 70 72 stics for the pr
170a0 65 76 69 6f 75 73 20 22 20 5c 0d 0a 20 20 20 20 evious " \..
170b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 6e $n
170c0 61 6d 65 43 6f 75 6e 74 20 22 20 6e 61 6d 65 73 ameCount " names
170d0 20 61 6e 64 20 22 20 24 76 61 6c 75 65 43 6f 75 and " $valueCou
170e0 6e 74 20 22 20 76 61 6c 75 65 73 20 72 65 61 64 nt " values read
170f0 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
17100 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
17110 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
17120 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
17130 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
17140 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
17150 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 "==== WARNING
17160 3a 20 66 61 69 6c 65 64 20 74 6f 20 72 65 73 65 : failed to rese
17170 74 20 73 65 74 74 69 6e 67 20 73 74 61 74 69 73 t setting statis
17180 74 69 63 73 20 66 6f 72 20 22 20 5c 0d 0a 20 20 tics for " \..
17190 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 74 "t
171a0 68 65 20 70 72 65 76 69 6f 75 73 20 22 20 24 6e he previous " $n
171b0 61 6d 65 43 6f 75 6e 74 20 22 20 6e 61 6d 65 73 ameCount " names
171c0 20 61 6e 64 20 22 20 24 76 61 6c 75 65 43 6f 75 and " $valueCou
171d0 6e 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 nt \..
171e0 20 20 20 20 20 20 22 20 76 61 6c 75 65 73 20 72 " values r
171f0 65 61 64 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e ead, error: " \n
17200 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 \t $error \n]..
17210 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
17220 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
17230 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 .. if {[hav
17240 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d eSQLiteObjectCom
17250 6d 61 6e 64 5d 20 26 26 20 5b 68 61 76 65 43 6f mand] && [haveCo
17260 6e 73 74 72 61 69 6e 74 20 5c 0d 0a 20 20 20 20 nstraint \..
17270 20 20 20 20 20 20 20 20 20 20 64 65 66 69 6e 65 define
17280 43 6f 6e 73 74 61 6e 74 2e 53 79 73 74 65 6d 2e Constant.System.
17290 44 61 74 61 2e 53 51 4c 69 74 65 2e 49 4e 54 45 Data.SQLite.INTE
172a0 52 4f 50 5f 56 49 52 54 55 41 4c 5f 54 41 42 4c ROP_VIRTUAL_TABL
172b0 45 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 E] && \..
172c0 20 20 20 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 [haveConstrai
172d0 6e 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 nt \..
172e0 20 20 20 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 defineConsta
172f0 6e 74 2e 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 nt.System.Data.S
17300 51 4c 69 74 65 2e 54 52 41 43 4b 5f 4d 45 4d 4f QLite.TRACK_MEMO
17310 52 59 5f 42 59 54 45 53 5d 7d 20 74 68 65 6e 20 RY_BYTES]} then
17320 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 {.. if {!
17330 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} 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 22 2d 2d 2d 2d 20 63 $channel "---- c
17360 75 72 72 65 6e 74 20 6d 65 6d 6f 72 79 20 69 6e urrent memory in
17370 20 75 73 65 20 62 79 20 53 51 4c 69 74 65 4d 65 use by SQLiteMe
17380 6d 6f 72 79 2e 2e 2e 20 22 0d 0a 20 20 20 20 20 mory... "..
17390 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
173a0 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 if {[catch {..
173b0 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 object i
173c0 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f nvoke -flags +No
173d0 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 nPublic \..
173e0 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e System.
173f0 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 Data.SQLite.SQLi
17400 74 65 4d 65 6d 6f 72 79 20 62 79 74 65 73 41 6c teMemory bytesAl
17410 6c 6f 63 61 74 65 64 0d 0a 20 20 20 20 20 20 20 located..
17420 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 30 7d } memory] == 0}
17430 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
17440 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
17450 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
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 24 el [appendArgs $
17480 6d 65 6d 6f 72 79 20 22 20 62 79 74 65 73 5c 6e memory " bytes\n
17490 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d "].. }.
174a0 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 . } else
174b0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 {.. set
174c0 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e 0d memory unknown.
174d0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 ... if
174e0 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
174f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
17500 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
17510 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 pendArgs $memory
17520 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
17530 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
17540 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
17550 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
17560 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
17570 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 6d 61 78 69 annel "---- maxi
17580 6d 75 6d 20 6d 65 6d 6f 72 79 20 69 6e 20 75 73 mum memory in us
17590 65 20 62 79 20 53 51 4c 69 74 65 4d 65 6d 6f 72 e by SQLiteMemor
175a0 79 2e 2e 2e 20 22 0d 0a 20 20 20 20 20 20 20 20 y... "..
175b0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 }.... if
175c0 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
175d0 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
175e0 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
175f0 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 blic \..
17600 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 System.Dat
17610 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 4d a.SQLite.SQLiteM
17620 65 6d 6f 72 79 20 6d 61 78 69 6d 75 6d 42 79 74 emory maximumByt
17630 65 73 41 6c 6c 6f 63 61 74 65 64 0d 0a 20 20 20 esAllocated..
17640 20 20 20 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d } memory] =
17650 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
17660 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
17670 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
17680 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
17690 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
176a0 67 73 20 24 6d 65 6d 6f 72 79 20 22 20 62 79 74 gs $memory " byt
176b0 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 es\n"]..
176c0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 }.. } e
176d0 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
176e0 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e set memory unkn
176f0 6f 77 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 own....
17700 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
17710 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
17720 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
17730 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 [appendArgs $me
17740 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 mory \n]..
17750 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
17760 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
17770 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
17780 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
17790 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 tputs $channel "
177a0 2d 2d 2d 2d 20 63 75 72 72 65 6e 74 20 6d 65 6d ---- current mem
177b0 6f 72 79 20 69 6e 20 75 73 65 20 62 79 20 53 51 ory in use by SQ
177c0 4c 69 74 65 2e 2e 2e 20 22 0d 0a 20 20 20 20 20 Lite... "..
177d0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b }.... if {
177e0 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 [haveSQLiteObjec
177f0 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 tCommand]} then
17800 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b {.. if {[
17810 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
17820 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
17830 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c -flags +NonPubl
17840 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ic \..
17850 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e System.Data.
17860 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e 61 74 SQLite.UnsafeNat
17870 69 76 65 4d 65 74 68 6f 64 73 20 73 71 6c 69 74 iveMethods sqlit
17880 65 33 5f 6d 65 6d 6f 72 79 5f 75 73 65 64 0d 0a e3_memory_used..
17890 20 20 20 20 20 20 20 20 7d 20 6d 65 6d 6f 72 79 } memory
178a0 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
178b0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
178c0 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
178d0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
178e0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
178f0 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 22 20 dArgs $memory "
17900 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 bytes\n"]..
17910 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
17920 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
17930 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
17940 20 23 20 4e 4f 54 45 3a 20 4d 61 79 62 65 20 74 # NOTE: Maybe t
17950 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 20 6c he SQLite core l
17960 69 62 72 61 72 79 20 69 73 20 75 6e 61 76 61 69 ibrary is unavai
17970 6c 61 62 6c 65 3f 0d 0a 20 20 20 20 20 20 20 20 lable?..
17980 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 73 #.. s
17990 65 74 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 et memory unknow
179a0 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 n.... i
179b0 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
179c0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
179d0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
179e0 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f appendArgs $memo
179f0 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 ry \n]..
17a00 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
17a10 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
17a20 20 20 20 20 20 20 20 20 73 65 74 20 6d 65 6d 6f set memo
17a30 72 79 20 75 6e 61 76 61 69 6c 61 62 6c 65 0d 0a ry unavailable..
17a40 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 .. if {!$
17a50 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
17a60 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
17a70 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
17a80 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d rgs $memory \n].
17a90 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
17aa0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 65 74 }.... set
17ab0 20 72 65 73 75 6c 74 20 24 6d 65 6d 6f 72 79 3b result $memory;
17ac0 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 # NOTE: Return
17ad0 6d 65 6d 6f 72 79 20 69 6e 2d 75 73 65 20 74 6f memory in-use to
17ae0 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d 0a 0d 0a our caller.....
17af0 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
17b00 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
17b10 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
17b20 6c 20 22 2d 2d 2d 2d 20 6d 61 78 69 6d 75 6d 20 l "---- maximum
17b30 6d 65 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 79 memory in use by
17b40 20 53 51 4c 69 74 65 2e 2e 2e 20 22 0d 0a 20 20 SQLite... "..
17b50 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 }.... i
17b60 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 f {[haveSQLiteOb
17b70 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 jectCommand]} th
17b80 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 en {.. if
17b90 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
17ba0 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 object inv
17bb0 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 oke -flags +NonP
17bc0 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 ublic \..
17bd0 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 System.Da
17be0 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 ta.SQLite.Unsafe
17bf0 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 20 5c 0d NativeMethods \.
17c00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 . s
17c10 71 6c 69 74 65 33 5f 6d 65 6d 6f 72 79 5f 68 69 qlite3_memory_hi
17c20 67 68 77 61 74 65 72 20 30 0d 0a 20 20 20 20 20 ghwater 0..
17c30 20 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 } memory] ==
17c40 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
17c50 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
17c60 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
17c70 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
17c80 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
17c90 20 24 6d 65 6d 6f 72 79 20 22 20 62 79 74 65 73 $memory " bytes
17ca0 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
17cb0 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 }.. } els
17cc0 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 e {.. #
17cd0 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f .. # NO
17ce0 54 45 3a 20 4d 61 79 62 65 20 74 68 65 20 53 51 TE: Maybe the SQ
17cf0 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 Lite core librar
17d00 79 20 69 73 20 75 6e 61 76 61 69 6c 61 62 6c 65 y is unavailable
17d10 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ?.. #..
17d20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 6d 65 set me
17d30 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e 0d 0a 0d 0a mory unknown....
17d40 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
17d50 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
17d60 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
17d70 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
17d80 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e dArgs $memory \n
17d90 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
17da0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
17db0 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
17dc0 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e set memory un
17dd0 61 76 61 69 6c 61 62 6c 65 0d 0a 0d 0a 20 20 20 available....
17de0 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
17df0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
17e00 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
17e10 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 el [appendArgs $
17e20 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 memory \n]..
17e30 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
17e40 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 63 6f 6c .. if {$col
17e50 6c 65 63 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 lect} then {..
17e60 20 20 20 20 20 20 63 6f 6c 6c 65 63 74 47 61 72 collectGar
17e70 62 61 67 65 20 24 63 68 61 6e 6e 65 6c 0d 0a 20 bage $channel..
17e80 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
17e90 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
17ea0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 n {.. tpu
17eb0 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d ts $channel "---
17ec0 2d 20 63 75 72 72 65 6e 74 20 6d 65 6d 6f 72 79 - current memory
17ed0 20 69 6e 20 75 73 65 20 62 79 20 74 68 65 20 43 in use by the C
17ee0 4c 52 2e 2e 2e 20 22 0d 0a 20 20 20 20 20 20 7d LR... ".. }
17ef0 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 .... if {[h
17f00 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 aveSQLiteObjectC
17f10 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d ommand]} then {.
17f20 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 . if {[ca
17f30 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
17f40 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 47 object invoke G
17f50 43 20 47 65 74 54 6f 74 61 6c 4d 65 6d 6f 72 79 C GetTotalMemory
17f60 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 false..
17f70 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 30 7d 20 } memory] == 0}
17f80 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
17f90 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 69 73 if {[string is
17fa0 20 69 6e 74 65 67 65 72 20 2d 73 74 72 69 63 74 integer -strict
17fb0 20 24 6d 65 6d 6f 72 79 5d 7d 20 74 68 65 6e 20 $memory]} then
17fc0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 {.. i
17fd0 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
17fe0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
17ff0 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
18000 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 [appendArgs $me
18010 6d 6f 72 79 20 22 20 62 79 74 65 73 5c 6e 22 5d mory " bytes\n"]
18020 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
18030 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 . } els
18040 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
18050 20 73 65 74 20 6d 65 6d 6f 72 79 20 69 6e 76 61 set memory inva
18060 6c 69 64 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 lid....
18070 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
18080 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
18090 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
180a0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
180b0 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 $memory \n]..
180c0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
180d0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
180e0 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
180f0 20 20 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 set memory
18100 20 75 6e 6b 6e 6f 77 6e 0d 0a 0d 0a 20 20 20 20 unknown....
18110 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
18120 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
18130 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
18140 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
18150 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 s $memory \n]..
18160 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
18170 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 }.. } e
18180 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 lse {.. s
18190 65 74 20 6d 65 6d 6f 72 79 20 75 6e 61 76 61 69 et memory unavai
181a0 6c 61 62 6c 65 0d 0a 0d 0a 20 20 20 20 20 20 20 lable....
181b0 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
181c0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
181d0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
181e0 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f appendArgs $memo
181f0 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 ry \n]..
18200 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
18210 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 return $resu
18220 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 lt.. }.....
18230 20 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 proc checkForS
18240 51 4c 69 74 65 44 69 72 65 63 74 6f 72 69 65 73 QLiteDirectories
18250 20 7b 20 63 68 61 6e 6e 65 6c 20 7b 72 65 73 65 { channel {rese
18260 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 t false} } {..
18270 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
18280 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 OTE: Check if th
18290 65 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f e sqlite3_win32_
182a0 73 65 74 5f 64 69 72 65 63 74 6f 72 79 20 66 75 set_directory fu
182b0 6e 63 74 69 6f 6e 20 69 73 20 61 76 61 69 6c 61 nction is availa
182c0 62 6c 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ble... #..
182d0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
182e0 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 nel \..
182f0 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 "---- checking
18300 66 6f 72 20 66 75 6e 63 74 69 6f 6e 20 73 71 6c for function sql
18310 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 ite3_win32_set_d
18320 69 72 65 63 74 6f 72 79 2e 2e 2e 20 22 0d 0a 0d irectory... "...
18330 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
18340 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 63 61 6c # NOTE: This cal
18350 6c 20 74 6f 20 74 68 65 20 73 71 6c 69 74 65 33 l to the sqlite3
18360 5f 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 _win32_set_direc
18370 74 6f 72 79 20 66 75 6e 63 74 69 6f 6e 20 75 73 tory function us
18380 65 73 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 es the.. #
18390 20 20 20 20 20 20 69 6e 76 61 6c 69 64 20 76 61 invalid va
183a0 6c 75 65 20 30 20 66 6f 72 20 74 68 65 20 66 69 lue 0 for the fi
183b0 72 73 74 20 61 72 67 75 6d 65 6e 74 2e 20 20 54 rst argument. T
183c0 68 69 73 20 63 6f 64 65 20 69 73 20 64 65 73 69 his code is desi
183d0 67 6e 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 gned.. #
183e0 20 20 20 20 74 6f 20 63 68 65 63 6b 20 69 66 20 to check if
183f0 63 61 6c 6c 69 6e 67 20 74 68 65 20 66 75 6e 63 calling the func
18400 74 69 6f 6e 20 77 69 6c 6c 20 72 61 69 73 65 20 tion will raise
18410 61 6e 20 65 78 63 65 70 74 69 6f 6e 20 28 69 2e an exception (i.
18420 65 2e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 e... #
18430 20 20 74 68 65 20 61 63 74 75 61 6c 20 72 65 73 the actual res
18440 75 6c 74 20 6f 66 20 74 68 65 20 66 75 6e 63 74 ult of the funct
18450 69 6f 6e 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 ion does not mat
18460 74 65 72 20 61 73 20 6c 6f 6e 67 20 61 73 20 6e ter as long as n
18470 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 o.. #
18480 20 64 69 72 65 63 74 6f 72 79 20 69 73 20 63 68 directory is ch
18490 61 6e 67 65 64 29 2e 0d 0a 20 20 20 20 20 20 23 anged)... #
184a0 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 .. if {[cat
184b0 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 ch {.. ob
184c0 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 ject invoke -fla
184d0 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d gs +NonPublic \.
184e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 . Sys
184f0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
18500 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 UnsafeNativeMeth
18510 6f 64 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ods \..
18520 20 20 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 sqlite3_win32
18530 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 20 30 _set_directory 0
18540 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 7d 5d 20 null.. }]
18550 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
18560 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
18570 20 23 20 4e 4f 54 45 3a 20 43 61 6c 6c 69 6e 67 # NOTE: Calling
18580 20 74 68 65 20 73 71 6c 69 74 65 33 5f 77 69 6e the sqlite3_win
18590 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 32_set_directory
185a0 20 66 75 6e 63 74 69 6f 6e 20 64 6f 65 73 20 6e function does n
185b0 6f 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ot.. #
185c0 20 20 20 20 63 61 75 73 65 20 61 6e 20 65 78 63 cause an exc
185d0 65 70 74 69 6f 6e 3b 20 74 68 65 72 65 66 6f 72 eption; therefor
185e0 65 2c 20 69 74 20 6d 75 73 74 20 62 65 20 61 76 e, it must be av
185f0 61 69 6c 61 62 6c 65 20 28 69 2e 65 2e 0d 0a 20 ailable (i.e...
18600 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 65 # e
18610 76 65 6e 20 74 68 6f 75 67 68 20 69 74 20 73 68 ven though it sh
18620 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 20 66 61 ould return a fa
18630 69 6c 75 72 65 20 72 65 74 75 72 6e 20 63 6f 64 ilure return cod
18640 65 20 69 6e 20 74 68 69 73 0d 0a 20 20 20 20 20 e in this..
18650 20 20 20 23 20 20 20 20 20 20 20 63 61 73 65 29 # case)
18660 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
18670 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 addConstra
18680 69 6e 74 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 int sqlite3_win3
18690 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 0d 2_set_directory.
186a0 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 ... tputs
186b0 20 24 63 68 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d $channel yes\n.
186c0 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
186d0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 6f # NOTE: Do
186e0 65 73 20 6f 75 72 20 63 61 6c 6c 65 72 20 77 61 es our caller wa
186f0 6e 74 20 74 6f 20 72 65 73 65 74 20 74 68 65 20 nt to reset the
18700 64 69 72 65 63 74 6f 72 69 65 73 3f 0d 0a 20 20 directories?..
18710 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
18720 20 69 66 20 7b 24 72 65 73 65 74 7d 20 74 68 65 if {$reset} the
18730 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 n {.. #
18740 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f .. # NO
18750 54 45 3a 20 4e 6f 77 20 6d 61 6b 65 20 73 75 72 TE: Now make sur
18760 65 20 74 68 65 20 64 61 74 61 62 61 73 65 20 61 e the database a
18770 6e 64 20 74 65 6d 70 6f 72 61 72 79 20 64 69 72 nd temporary dir
18780 65 63 74 6f 72 69 65 73 20 61 72 65 0d 0a 20 20 ectories are..
18790 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
187a0 72 65 73 65 74 20 74 68 65 69 72 20 64 65 66 61 reset their defa
187b0 75 6c 74 20 76 61 6c 75 65 73 2c 20 77 68 69 63 ult values, whic
187c0 68 20 73 68 6f 75 6c 64 20 62 65 20 6e 75 6c 6c h should be null
187d0 20 66 6f 72 20 62 6f 74 68 2e 0d 0a 20 20 20 20 for both...
187e0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 53 69 # Si
187f0 6e 63 65 20 74 68 65 20 73 71 6c 69 74 65 33 5f nce the sqlite3_
18800 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 win32_set_direct
18810 6f 72 79 20 66 75 6e 63 74 69 6f 6e 20 69 73 20 ory function is
18820 61 76 61 69 6c 61 62 6c 65 2c 0d 0a 20 20 20 20 available,..
18830 20 20 20 20 20 20 23 20 20 20 20 20 20 20 75 73 # us
18840 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 20 e it...
18850 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f #.. fo
18860 72 20 7b 73 65 74 20 69 6e 64 65 78 20 31 7d 20 r {set index 1}
18870 7b 24 69 6e 64 65 78 20 3c 20 33 7d 20 7b 69 6e {$index < 3} {in
18880 63 72 20 69 6e 64 65 78 7d 20 7b 0d 0a 20 20 20 cr index} {..
18890 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 if {[ca
188a0 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
188b0 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
188c0 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
188d0 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 blic \..
188e0 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
188f0 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 .Data.SQLite.Uns
18900 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 afeNativeMethods
18910 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
18920 20 20 20 20 20 20 73 71 6c 69 74 65 33 5f 77 69 sqlite3_wi
18930 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 n32_set_director
18940 79 20 24 69 6e 64 65 78 20 6e 75 6c 6c 0d 0a 20 y $index null..
18950 20 20 20 20 20 20 20 20 20 20 20 7d 20 72 65 73 } res
18960 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ult] == 0} then
18970 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
18980 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
18990 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
189a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
189b0 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 "---- call sqli
189c0 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 69 te3_win32_set_di
189d0 72 65 63 74 6f 72 79 28 22 20 24 69 6e 64 65 78 rectory(" $index
189e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
189f0 20 20 20 20 20 20 22 2c 20 6e 75 6c 6c 29 2e 2e ", null)..
18a00 2e 20 6f 6b 3a 20 22 20 24 72 65 73 75 6c 74 20 . ok: " $result
18a10 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 \n]..
18a20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
18a30 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
18a40 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
18a50 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
18a60 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 "---- c
18a70 61 6c 6c 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 all sqlite3_win3
18a80 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 28 2_set_directory(
18a90 22 20 24 69 6e 64 65 78 20 5c 0d 0a 20 20 20 20 " $index \..
18aa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2c ",
18ab0 20 6e 75 6c 6c 29 2e 2e 2e 20 65 72 72 6f 72 3a null)... error:
18ac0 20 22 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 " \n\t $result
18ad0 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 \n]..
18ae0 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d }.. }.
18af0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
18b00 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
18b10 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
18b20 65 6c 20 6e 6f 5c 6e 0d 0a 0d 0a 20 20 20 20 20 el no\n....
18b30 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
18b40 4e 4f 54 45 3a 20 44 6f 65 73 20 6f 75 72 20 63 NOTE: Does our c
18b50 61 6c 6c 65 72 20 77 61 6e 74 20 74 6f 20 72 65 aller want to re
18b60 73 65 74 20 74 68 65 20 64 69 72 65 63 74 6f 72 set the director
18b70 69 65 73 3f 20 20 54 68 69 73 20 63 61 6e 20 6f ies? This can o
18b80 6e 6c 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 nly.. #
18b90 20 20 20 20 20 62 65 20 70 65 72 66 6f 72 6d 65 be performe
18ba0 64 20 69 66 20 53 51 4c 69 74 65 20 69 73 20 6c d if SQLite is l
18bb0 6f 61 64 65 64 20 61 6e 64 20 72 65 61 64 79 20 oaded and ready
18bc0 66 6f 72 20 75 73 65 20 62 79 20 74 68 65 20 74 for use by the t
18bd0 65 73 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 est.. #
18be0 20 20 20 20 20 73 75 69 74 65 2e 0d 0a 20 20 20 suite...
18bf0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
18c00 69 66 20 7b 24 72 65 73 65 74 20 26 26 20 5b 69 if {$reset && [i
18c10 73 53 51 4c 69 74 65 52 65 61 64 79 5d 7d 20 74 sSQLiteReady]} t
18c20 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
18c30 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 #.. #
18c40 4e 4f 54 45 3a 20 4e 6f 77 20 6d 61 6b 65 20 73 NOTE: Now make s
18c50 75 72 65 20 74 68 65 20 64 61 74 61 62 61 73 65 ure the database
18c60 20 61 6e 64 20 74 65 6d 70 6f 72 61 72 79 20 64 and temporary d
18c70 69 72 65 63 74 6f 72 69 65 73 20 61 72 65 0d 0a irectories are..
18c80 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
18c90 20 20 72 65 73 65 74 20 74 68 65 69 72 20 64 65 reset their de
18ca0 66 61 75 6c 74 20 76 61 6c 75 65 73 2c 20 77 68 fault values, wh
18cb0 69 63 68 20 73 68 6f 75 6c 64 20 62 65 20 6e 75 ich should be nu
18cc0 6c 6c 20 66 6f 72 20 62 6f 74 68 2e 0d 0a 20 20 ll for both...
18cd0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
18ce0 53 69 6e 63 65 20 74 68 65 20 73 71 6c 69 74 65 Since the sqlite
18cf0 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 3_win32_set_dire
18d00 63 74 6f 72 79 20 66 75 6e 63 74 69 6f 6e 20 64 ctory function d
18d10 6f 65 73 20 6e 6f 74 0d 0a 20 20 20 20 20 20 20 oes not..
18d20 20 20 20 23 20 20 20 20 20 20 20 61 70 70 65 61 # appea
18d30 72 20 74 6f 20 62 65 20 61 76 61 69 6c 61 62 6c r to be availabl
18d40 65 2c 20 75 73 65 20 74 68 65 20 61 73 73 6f 63 e, use the assoc
18d50 69 61 74 65 64 20 50 52 41 47 4d 41 20 63 6f 6d iated PRAGMA com
18d60 6d 61 6e 64 73 0d 0a 20 20 20 20 20 20 20 20 20 mands..
18d70 20 23 20 20 20 20 20 20 20 69 6e 73 74 65 61 64 # instead
18d80 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
18d90 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 foreac
18da0 68 20 64 69 72 65 63 74 6f 72 79 20 5b 6c 69 73 h directory [lis
18db0 74 20 64 61 74 61 5f 73 74 6f 72 65 5f 64 69 72 t data_store_dir
18dc0 65 63 74 6f 72 79 20 74 65 6d 70 5f 73 74 6f 72 ectory temp_stor
18dd0 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 7b 0d 0a e_directory] {..
18de0 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 set
18df0 73 71 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 sql [appendArgs
18e00 22 50 52 41 47 4d 41 20 22 20 24 64 69 72 65 63 "PRAGMA " $direc
18e10 74 6f 72 79 20 22 20 3d 20 5c 22 5c 22 3b 22 5d tory " = \"\";"]
18e20 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
18e30 69 66 20 7b 5b 63 61 74 63 68 20 7b 65 78 65 63 if {[catch {exec
18e40 75 74 65 53 71 6c 20 24 73 71 6c 7d 20 72 65 73 uteSql $sql} res
18e50 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ult] == 0} then
18e60 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
18e70 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
18e80 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
18e90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18ea0 20 22 2d 2d 2d 2d 20 65 78 65 63 75 74 65 20 50 "---- execute P
18eb0 52 41 47 4d 41 20 22 20 24 64 69 72 65 63 74 6f RAGMA " $directo
18ec0 72 79 20 22 2e 2e 2e 20 6f 6b 3a 20 5c 22 22 20 ry "... ok: \""
18ed0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
18ee0 20 20 20 20 20 24 72 65 73 75 6c 74 20 5c 22 5c $result \"\
18ef0 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 n]..
18f00 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
18f10 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
18f20 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
18f30 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
18f40 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 65 78 "---- ex
18f50 65 63 75 74 65 20 50 52 41 47 4d 41 20 22 20 24 ecute PRAGMA " $
18f60 64 69 72 65 63 74 6f 72 79 20 22 2e 2e 2e 20 65 directory "... e
18f70 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 rror: " \..
18f80 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 6e 5c \n\
18f90 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 t $result \n]..
18fa0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
18fb0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
18fc0 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
18fd0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
18fe0 23 20 4e 4f 54 45 3a 20 46 69 6e 61 6c 6c 79 2c # NOTE: Finally,
18ff0 20 73 68 6f 77 20 74 68 65 20 63 75 72 72 65 6e show the curren
19000 74 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 64 t value of the d
19010 61 74 61 62 61 73 65 20 61 6e 64 20 74 65 6d 70 atabase and temp
19020 6f 72 61 72 79 0d 0a 20 20 20 20 20 20 23 20 20 orary.. #
19030 20 20 20 20 20 64 69 72 65 63 74 6f 72 69 65 73 directories
19040 2e 20 20 54 68 69 73 20 63 61 6e 20 6f 6e 6c 79 . This can only
19050 20 62 65 20 70 65 72 66 6f 72 6d 65 64 20 69 66 be performed if
19060 20 53 51 4c 69 74 65 20 69 73 20 6c 6f 61 64 65 SQLite is loade
19070 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 d.. #
19080 20 61 6e 64 20 72 65 61 64 79 20 66 6f 72 20 75 and ready for u
19090 73 65 20 62 79 20 74 68 65 20 74 65 73 74 20 73 se by the test s
190a0 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a uite... #..
190b0 20 20 20 20 20 20 69 66 20 7b 5b 69 73 53 51 4c if {[isSQL
190c0 69 74 65 52 65 61 64 79 5d 7d 20 74 68 65 6e 20 iteReady]} then
190d0 7b 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 {.. forea
190e0 63 68 20 64 69 72 65 63 74 6f 72 79 20 5b 6c 69 ch directory [li
190f0 73 74 20 64 61 74 61 5f 73 74 6f 72 65 5f 64 69 st data_store_di
19100 72 65 63 74 6f 72 79 20 74 65 6d 70 5f 73 74 6f rectory temp_sto
19110 72 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 7b 0d re_directory] {.
19120 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
19130 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
19140 64 41 72 67 73 20 22 2d 2d 2d 2d 20 63 68 65 63 dArgs "---- chec
19150 6b 69 6e 67 20 22 20 24 64 69 72 65 63 74 6f 72 king " $director
19160 79 20 22 2e 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 20 y "... "]....
19170 20 20 20 20 20 20 20 73 65 74 20 73 71 6c 20 5b set sql [
19180 61 70 70 65 6e 64 41 72 67 73 20 22 50 52 41 47 appendArgs "PRAG
19190 4d 41 20 22 20 24 64 69 72 65 63 74 6f 72 79 20 MA " $directory
191a0 5c 3b 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 \;]....
191b0 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 65 78 65 if {[catch {exe
191c0 63 75 74 65 53 71 6c 20 24 73 71 6c 20 73 63 61 cuteSql $sql sca
191d0 6c 61 72 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 lar} result] ==
191e0 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
191f0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
19200 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
19210 73 20 22 6f 6b 3a 20 5c 22 22 20 24 72 65 73 75 s "ok: \"" $resu
19220 6c 74 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 lt \"\n]..
19230 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
19240 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
19250 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
19260 41 72 67 73 20 22 65 72 72 6f 72 3a 20 22 20 5c Args "error: " \
19270 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d n\t $result \n].
19280 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
19290 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
192a0 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
192b0 70 72 6f 63 20 6c 6f 61 64 53 51 4c 69 74 65 54 proc loadSQLiteT
192c0 65 73 74 53 65 74 74 69 6e 67 73 20 7b 20 63 68 estSettings { ch
192d0 61 6e 6e 65 6c 20 7b 73 75 66 66 69 78 20 22 22 annel {suffix ""
192e0 7d 20 7b 71 75 69 65 74 20 66 61 6c 73 65 7d 20 } {quiet false}
192f0 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
19300 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 # NOTE: Skip
19310 20 6c 6f 61 64 69 6e 67 20 74 68 65 20 73 65 74 loading the set
19320 74 69 6e 67 73 20 69 66 20 74 68 65 69 72 20 75 tings if their u
19330 73 61 67 65 20 68 61 73 20 62 65 65 6e 20 64 69 sage has been di
19340 73 61 62 6c 65 64 2e 0d 0a 20 20 20 20 20 20 23 sabled... #
19350 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e .. if {![in
19360 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 73 fo exists ::no(s
19370 71 6c 69 74 65 54 65 73 74 53 65 74 74 69 6e 67 qliteTestSetting
19380 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
19390 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
193a0 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 20 63 75 73 # NOTE: Load cus
193b0 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 61 6e 64 tom per-user and
193c0 2f 6f 72 20 70 65 72 2d 68 6f 73 74 20 74 65 73 /or per-host tes
193d0 74 20 73 65 74 74 69 6e 67 73 20 6e 6f 77 2e 0d t settings now..
193e0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
193f0 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
19400 69 73 74 73 20 3a 3a 74 63 6c 5f 70 6c 61 74 66 ists ::tcl_platf
19410 6f 72 6d 28 75 73 65 72 29 5d 7d 20 74 68 65 6e orm(user)]} then
19420 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 {.. se
19430 74 20 75 73 65 72 53 65 74 74 69 6e 67 73 46 69 t userSettingsFi
19440 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 leName [file joi
19450 6e 20 5b 67 65 74 43 6f 6d 6d 6f 6e 44 69 72 65 n [getCommonDire
19460 63 74 6f 72 79 5d 20 5c 0d 0a 20 20 20 20 20 20 ctory] \..
19470 20 20 20 20 20 20 20 20 5b 61 70 70 65 6e 64 41 [appendA
19480 72 67 73 20 73 65 74 74 69 6e 67 73 20 24 73 75 rgs settings $su
19490 66 66 69 78 20 2e 20 24 3a 3a 74 63 6c 5f 70 6c ffix . $::tcl_pl
194a0 61 74 66 6f 72 6d 28 75 73 65 72 29 20 2e 65 61 atform(user) .ea
194b0 67 6c 65 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 gle]]....
194c0 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 if {[file exi
194d0 73 74 73 20 24 75 73 65 72 53 65 74 74 69 6e 67 sts $userSetting
194e0 73 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e sFileName]} then
194f0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
19500 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
19510 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
19520 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
19530 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
19540 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
19550 20 20 20 22 2d 2d 2d 2d 20 6c 6f 61 64 69 6e 67 "---- loading
19560 20 70 65 72 2d 75 73 65 72 20 74 65 73 74 20 73 per-user test s
19570 65 74 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 22 ettings file \""
19580 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
19590 20 20 20 20 20 20 24 75 73 65 72 53 65 74 74 69 $userSetti
195a0 6e 67 73 46 69 6c 65 4e 61 6d 65 20 5c 22 2e 2e ngsFileName \"..
195b0 2e 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 .\n]..
195c0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
195d0 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
195e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 75 . u
195f0 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 73 plevel 1 [list s
19600 6f 75 72 63 65 20 24 75 73 65 72 53 65 74 74 69 ource $userSetti
19610 6e 67 73 46 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 ngsFileName]..
19620 20 20 20 20 20 20 20 20 20 20 7d 20 65 72 72 6f } erro
19630 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 r]} then {..
19640 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
19650 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
19660 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
19670 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
19680 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
19690 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
196a0 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 "==== WARNING:
196b0 66 61 69 6c 65 64 20 74 6f 20 6c 6f 61 64 20 70 failed to load p
196c0 65 72 2d 75 73 65 72 20 73 65 74 74 69 6e 67 73 er-user settings
196d0 20 66 69 6c 65 20 5c 22 22 20 5c 0d 0a 20 20 20 file \"" \..
196e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
196f0 20 24 75 73 65 72 53 65 74 74 69 6e 67 73 46 69 $userSettingsFi
19700 6c 65 4e 61 6d 65 20 22 5c 22 2c 20 65 72 72 6f leName "\", erro
19710 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 r: " \n\t $error
19720 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
19730 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
19740 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
19750 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
19760 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
19770 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
19780 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
19790 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
197a0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
197b0 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
197c0 6b 69 70 70 65 64 20 6c 6f 61 64 69 6e 67 20 70 kipped loading p
197d0 65 72 2d 75 73 65 72 20 74 65 73 74 20 73 65 74 er-user test set
197e0 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 22 20 5c tings file \"" \
197f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
19800 20 20 20 20 24 75 73 65 72 53 65 74 74 69 6e 67 $userSetting
19810 73 46 69 6c 65 4e 61 6d 65 20 22 5c 22 2c 20 69 sFileName "\", i
19820 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 t does not exist
19830 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
19840 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
19850 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
19860 20 20 20 20 20 20 20 23 23 23 23 23 23 23 23 23 #########
19870 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19880 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19890 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
198a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0d 0a ##############..
198b0 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 .. if {[i
198c0 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 63 6c nfo exists ::tcl
198d0 5f 70 6c 61 74 66 6f 72 6d 28 68 6f 73 74 29 5d _platform(host)]
198e0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
198f0 20 20 20 20 73 65 74 20 68 6f 73 74 53 65 74 74 set hostSett
19900 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 5b 66 69 ingsFileName [fi
19910 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 43 6f 6d 6d le join [getComm
19920 6f 6e 44 69 72 65 63 74 6f 72 79 5d 20 5c 0d 0a onDirectory] \..
19930 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 61 [a
19940 70 70 65 6e 64 41 72 67 73 20 73 65 74 74 69 6e ppendArgs settin
19950 67 73 20 24 73 75 66 66 69 78 20 2e 20 24 3a 3a gs $suffix . $::
19960 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 68 6f 73 tcl_platform(hos
19970 74 29 20 2e 65 61 67 6c 65 5d 5d 0d 0a 0d 0a 20 t) .eagle]]....
19980 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 66 69 if {[fi
19990 6c 65 20 65 78 69 73 74 73 20 24 68 6f 73 74 53 le exists $hostS
199a0 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 5d ettingsFileName]
199b0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
199c0 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
199d0 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
199e0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
199f0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
19a00 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
19a10 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6c "---- l
19a20 6f 61 64 69 6e 67 20 70 65 72 2d 68 6f 73 74 20 oading per-host
19a30 74 65 73 74 20 73 65 74 74 69 6e 67 73 20 66 69 test settings fi
19a40 6c 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 le \"" \..
19a50 20 20 20 20 20 20 20 20 20 20 20 20 24 68 6f 73 $hos
19a60 74 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d tSettingsFileNam
19a70 65 20 5c 22 2e 2e 2e 5c 6e 5d 0d 0a 20 20 20 20 e \"...\n]..
19a80 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
19a90 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 if {[ca
19aa0 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
19ab0 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 5b uplevel 1 [
19ac0 6c 69 73 74 20 73 6f 75 72 63 65 20 24 68 6f 73 list source $hos
19ad0 74 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d tSettingsFileNam
19ae0 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 e]..
19af0 7d 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b } error]} then {
19b00 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
19b10 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
19b20 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
19b30 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
19b40 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
19b50 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
19b60 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 "==== WAR
19b70 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 NING: failed to
19b80 6c 6f 61 64 20 70 65 72 2d 68 6f 73 74 20 73 65 load per-host se
19b90 74 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 22 20 ttings file \""
19ba0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
19bb0 20 20 20 20 20 20 20 24 68 6f 73 74 53 65 74 74 $hostSett
19bc0 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 22 5c 22 ingsFileName "\"
19bd0 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 , error: " \n\t
19be0 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 $error \n]..
19bf0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
19c00 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
19c10 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
19c20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
19c30 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
19c40 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 . t
19c50 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
19c60 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
19c70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
19c80 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 6c 6f 61 ---- skipped loa
19c90 64 69 6e 67 20 70 65 72 2d 68 6f 73 74 20 74 65 ding per-host te
19ca0 73 74 20 73 65 74 74 69 6e 67 73 20 66 69 6c 65 st settings file
19cb0 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 \"" \..
19cc0 20 20 20 20 20 20 20 20 20 20 24 68 6f 73 74 53 $hostS
19cd0 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 ettingsFileName
19ce0 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 "\", it does not
19cf0 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 exist\n"]..
19d00 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
19d10 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
19d20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }.. }..
19d30 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 }..... proc r
19d40 75 6e 53 51 4c 69 74 65 54 65 73 74 50 72 6f 6c unSQLiteTestProl
19d50 6f 67 75 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 ogue {} {..
19d60 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
19d70 3a 20 53 6b 69 70 20 72 75 6e 6e 69 6e 67 20 6f : Skip running o
19d80 75 72 20 63 75 73 74 6f 6d 20 70 72 6f 6c 6f 67 ur custom prolog
19d90 75 65 20 69 66 20 74 68 65 20 6d 61 69 6e 20 6f ue if the main o
19da0 6e 65 20 68 61 73 20 62 65 65 6e 0d 0a 20 20 20 ne has been..
19db0 20 20 20 23 20 20 20 20 20 20 20 73 6b 69 70 70 # skipp
19dc0 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ed... #..
19dd0 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
19de0 78 69 73 74 73 20 3a 3a 6e 6f 28 70 72 6f 6c 6f xists ::no(prolo
19df0 67 75 65 2e 65 61 67 6c 65 29 5d 7d 20 74 68 65 gue.eagle)]} the
19e00 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
19e10 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
19e20 4c 6f 61 64 20 74 68 65 20 22 62 65 66 6f 72 65 Load the "before
19e30 2d 63 6f 6e 73 74 72 61 69 6e 74 73 22 20 63 75 -constraints" cu
19e40 73 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 61 6e stom per-user an
19e50 64 2f 6f 72 20 70 65 72 2d 68 6f 73 74 0d 0a 20 d/or per-host..
19e60 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
19e70 65 73 74 20 73 65 74 74 69 6e 67 73 20 6e 6f 77 est settings now
19e80 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
19e90 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 uplevel 1
19ea0 5b 6c 69 73 74 20 6c 6f 61 64 53 51 4c 69 74 65 [list loadSQLite
19eb0 54 65 73 74 53 65 74 74 69 6e 67 73 20 24 3a 3a TestSettings $::
19ec0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 2e 62 65 test_channel .be
19ed0 66 6f 72 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 fore]....
19ee0 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
19ef0 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 65 TE: Check if the
19f00 20 5b 6f 62 6a 65 63 74 5d 20 63 6f 6d 6d 61 6e [object] comman
19f10 64 20 69 73 20 61 76 61 69 6c 61 62 6c 65 3b 20 d is available;
19f20 69 66 20 6e 6f 74 2c 20 61 64 64 20 73 6f 6d 65 if not, add some
19f30 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
19f40 20 20 73 68 69 6d 73 20 74 6f 20 6d 61 6b 65 20 shims to make
19f50 74 68 65 20 74 65 73 74 20 73 75 69 74 65 20 72 the test suite r
19f60 75 6e 20 73 6d 6f 6f 74 68 65 72 2e 0d 0a 20 20 un smoother...
19f70 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
19f80 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 4f checkForSQLiteO
19f90 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 20 24 3a 3a bjectCommand $::
19fa0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a test_channel....
19fb0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
19fc0 20 20 20 23 20 4e 4f 54 45 3a 20 44 65 74 65 72 # NOTE: Deter
19fd0 6d 69 6e 65 20 74 68 65 20 6e 61 6d 65 73 20 6f mine the names o
19fe0 66 20 74 68 65 20 6e 61 74 69 76 65 20 70 6c 61 f the native pla
19ff0 74 66 6f 72 6d 20 61 6e 64 20 61 72 63 68 69 74 tform and archit
1a000 65 63 74 75 72 65 2e 0d 0a 20 20 20 20 20 20 20 ecture...
1a010 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 #.. set
1a020 70 6c 61 74 66 6f 72 6d 20 5b 67 65 74 42 75 69 platform [getBui
1a030 6c 64 50 6c 61 74 66 6f 72 6d 20 74 72 75 65 5d ldPlatform true]
1a040 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 61 72 .. set ar
1a050 63 68 69 74 65 63 74 75 72 65 20 5b 61 72 63 68 chitecture [arch
1a060 69 74 65 63 74 75 72 65 46 6f 72 50 6c 61 74 66 itectureForPlatf
1a070 6f 72 6d 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a orm $platform]..
1a080 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1a090 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f # NOTE: Sho
1a0a0 77 20 74 68 65 20 70 6c 61 74 66 6f 72 6d 20 61 w the platform a
1a0b0 6e 64 20 61 72 63 68 69 74 65 63 74 75 72 65 20 nd architecture
1a0c0 75 73 65 64 20 74 6f 20 68 65 6c 70 20 6c 6f 63 used to help loc
1a0d0 61 74 65 20 74 68 65 0d 0a 20 20 20 20 20 20 20 ate the..
1a0e0 20 23 20 20 20 20 20 20 20 6e 61 74 69 76 65 20 # native
1a0f0 62 75 69 6c 64 20 66 69 6c 65 73 2e 0d 0a 20 20 build files...
1a100 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1a110 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
1a120 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1a130 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1a140 20 20 22 2d 2d 2d 2d 20 70 6c 61 74 66 6f 72 6d "---- platform
1a150 20 66 6f 72 20 6c 6f 63 61 74 69 6e 67 20 6e 61 for locating na
1a160 74 69 76 65 20 62 75 69 6c 64 20 66 69 6c 65 73 tive build files
1a170 20 69 73 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 is \"" \..
1a180 20 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 6d $platform
1a190 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 \"\n]....
1a1a0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1a1b0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1a1c0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
1a1d0 20 20 20 22 2d 2d 2d 2d 20 61 72 63 68 69 74 65 "---- archite
1a1e0 63 74 75 72 65 20 66 6f 72 20 6c 6f 63 61 74 69 cture for locati
1a1f0 6e 67 20 6e 61 74 69 76 65 20 62 75 69 6c 64 20 ng native build
1a200 66 69 6c 65 73 20 69 73 20 5c 22 22 20 5c 0d 0a files is \"" \..
1a210 20 20 20 20 20 20 20 20 20 20 20 20 24 61 72 63 $arc
1a220 68 69 74 65 63 74 75 72 65 20 5c 22 5c 6e 5d 0d hitecture \"\n].
1a230 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
1a240 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 # NOTE: Bu
1a250 69 6c 64 20 61 20 6c 69 73 74 20 6f 66 20 63 6f ild a list of co
1a260 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 69 6c 65 nfiguration file
1a270 73 20 74 68 61 74 20 77 65 20 68 61 6e 64 6c 65 s that we handle
1a280 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
1a290 20 20 20 20 20 20 73 65 74 20 63 6f 6e 66 69 67 set config
1a2a0 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 20 FileNames [list
1a2b0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 \.. S
1a2c0 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1a2d0 65 2e 64 6c 6c 2e 63 6f 6e 66 69 67 5d 0d 0a 0d e.dll.config]...
1a2e0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1a2f0 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c # NOTE: Buil
1a300 64 20 61 20 6c 69 73 74 20 6f 66 20 61 75 78 69 d a list of auxi
1a310 6c 69 61 72 79 20 4d 61 6e 61 67 65 64 20 44 65 liary Managed De
1a320 62 75 67 67 69 6e 67 20 41 73 73 69 73 74 61 6e bugging Assistan
1a330 74 73 20 28 4d 44 41 29 0d 0a 20 20 20 20 20 20 ts (MDA)..
1a340 20 20 23 20 20 20 20 20 20 20 63 6f 6e 66 69 67 # config
1a350 75 72 61 74 69 6f 6e 20 66 69 6c 65 73 20 74 68 uration files th
1a360 61 74 20 77 65 20 68 61 6e 64 6c 65 2e 0d 0a 20 at we handle...
1a370 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1a380 20 20 73 65 74 20 6d 64 61 43 6f 6e 66 69 67 46 set mdaConfigF
1a390 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 20 5c ileNames [list \
1a3a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 45 61 .. Ea
1a3b0 67 6c 65 53 68 65 6c 6c 33 32 2e 65 78 65 2e 6d gleShell32.exe.m
1a3c0 64 61 2e 63 6f 6e 66 69 67 20 49 6e 73 74 61 6c da.config Instal
1a3d0 6c 65 72 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 ler.exe.mda.conf
1a3e0 69 67 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ig \..
1a3f0 20 20 74 65 73 74 2e 65 78 65 2e 6d 64 61 2e 63 test.exe.mda.c
1a400 6f 6e 66 69 67 20 74 65 73 74 6c 69 6e 71 2e 65 onfig testlinq.e
1a410 78 65 2e 6d 64 61 2e 63 6f 6e 66 69 67 20 5c 0d xe.mda.config \.
1a420 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 65 73 . tes
1a430 74 65 66 36 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e tef6.exe.mda.con
1a440 66 69 67 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 fig]....
1a450 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1a460 45 3a 20 42 75 69 6c 64 20 74 68 65 20 6c 69 73 E: Build the lis
1a470 74 20 6f 66 20 65 78 74 65 72 6e 61 6c 20 66 69 t of external fi
1a480 6c 65 73 20 74 68 61 74 20 77 65 20 68 61 6e 64 les that we hand
1a490 6c 65 2e 20 20 53 6f 6d 65 20 6f 66 0d 0a 20 20 le. Some of..
1a4a0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 # th
1a4b0 65 73 65 20 66 69 6c 65 73 20 6d 61 79 20 62 65 ese files may be
1a4c0 20 6e 61 74 69 76 65 20 61 6e 64 2f 6f 72 20 6d native and/or m
1a4d0 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 69 65 anaged assemblie
1a4e0 73 20 74 68 61 74 20 61 72 65 0d 0a 20 20 20 20 s that are..
1a4f0 20 20 20 20 23 20 20 20 20 20 20 20 72 65 71 75 # requ
1a500 69 72 65 64 20 74 6f 20 70 65 72 66 6f 72 6d 20 ired to perform
1a510 76 61 72 69 6f 75 73 20 74 65 73 74 73 2e 0d 0a various tests...
1a520 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1a530 20 20 20 73 65 74 20 65 78 74 65 72 6e 61 6c 46 set externalF
1a540 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 20 5c ileNames [list \
1a550 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 .. [f
1a560 69 6c 65 20 6a 6f 69 6e 20 45 6e 74 69 74 79 46 ile join EntityF
1a570 72 61 6d 65 77 6f 72 6b 20 6c 69 62 20 5b 73 74 ramework lib [st
1a580 72 69 6e 67 20 6d 61 70 20 5b 6c 69 73 74 20 46 ring map [list F
1a590 78 20 22 22 5d 20 5b 73 74 72 69 6e 67 20 5c 0d x ""] [string \.
1a5a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 6d 61 70 . map
1a5b0 20 5b 6c 69 73 74 20 6e 65 74 46 78 34 35 31 20 [list netFx451
1a5c0 6e 65 74 46 78 34 35 5d 20 5b 67 65 74 42 75 69 netFx45] [getBui
1a5d0 6c 64 4e 65 74 46 78 5d 5d 5d 20 45 6e 74 69 74 ldNetFx]]] Entit
1a5e0 79 46 72 61 6d 65 77 6f 72 6b 2e 64 6c 6c 5d 5d yFramework.dll]]
1a5f0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
1a600 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 # NOTE: B
1a610 75 69 6c 64 20 74 68 65 20 6c 69 73 74 20 6f 66 uild the list of
1a620 20 6e 61 74 69 76 65 20 61 73 73 65 6d 62 6c 79 native assembly
1a630 20 66 69 6c 65 73 20 74 68 61 74 20 77 65 20 68 files that we h
1a640 61 6e 64 6c 65 2e 20 20 54 68 65 0d 0a 20 20 20 andle. The..
1a650 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 61 # rea
1a660 73 6f 6e 20 74 68 65 20 22 53 79 73 74 65 6d 2e son the "System.
1a670 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 22 Data.SQLite.dll"
1a680 20 66 69 6c 65 20 69 73 20 69 6e 63 6c 75 64 65 file is include
1a690 64 20 68 65 72 65 20 69 73 0d 0a 20 20 20 20 20 d here is..
1a6a0 20 20 20 23 20 20 20 20 20 20 20 62 65 63 61 75 # becau
1a6b0 73 65 20 69 74 20 63 6f 75 6c 64 20 62 65 20 74 se it could be t
1a6c0 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 he mixed-mode as
1a6d0 73 65 6d 62 6c 79 2e 0d 0a 20 20 20 20 20 20 20 sembly...
1a6e0 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 #.. set
1a6f0 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 nativeFileNames
1a700 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 [list \..
1a710 20 20 20 20 20 73 71 6c 69 74 65 33 2e 64 6c 6c sqlite3.dll
1a720 20 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f 70 2e SQLite.Interop.
1a730 64 6c 6c 20 53 79 73 74 65 6d 2e 44 61 74 61 2e dll System.Data.
1a740 53 51 4c 69 74 65 2e 64 6c 6c 5d 0d 0a 0d 0a 20 SQLite.dll]....
1a750 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1a760 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 # NOTE: Build
1a770 74 68 65 20 6c 69 73 74 20 6f 66 20 6d 61 6e 61 the list of mana
1a780 67 65 64 20 61 73 73 65 6d 62 6c 79 20 66 69 6c ged assembly fil
1a790 65 73 20 74 68 61 74 20 77 65 20 68 61 6e 64 6c es that we handl
1a7a0 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 e... #..
1a7b0 20 20 20 20 20 20 20 73 65 74 20 6d 61 6e 61 67 set manag
1a7c0 65 64 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 edFileNames [lis
1a7d0 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 t \..
1a7e0 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
1a7f0 69 74 65 2e 64 6c 6c 20 53 79 73 74 65 6d 2e 44 ite.dll System.D
1a800 61 74 61 2e 53 51 4c 69 74 65 2e 4c 69 6e 71 2e ata.SQLite.Linq.
1a810 64 6c 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 dll \..
1a820 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 System.Data.S
1a830 51 4c 69 74 65 2e 45 46 36 2e 64 6c 6c 5d 0d 0a QLite.EF6.dll]..
1a840 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1a850 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 6d # NOTE: Rem
1a860 6f 76 65 20 61 6e 79 20 74 65 73 74 20 63 6f 6e ove any test con
1a870 73 74 72 61 69 6e 74 73 20 74 68 61 74 20 72 65 straints that re
1a880 66 65 72 20 74 6f 20 74 68 65 20 6e 61 74 69 76 fer to the nativ
1a890 65 20 61 6e 64 2f 6f 72 0d 0a 20 20 20 20 20 20 e and/or..
1a8a0 20 20 23 20 20 20 20 20 20 20 6d 61 6e 61 67 65 # manage
1a8b0 64 20 61 73 73 65 6d 62 6c 79 20 66 69 6c 65 73 d assembly files
1a8c0 20 74 68 61 74 20 77 65 20 68 61 6e 64 6c 65 20 that we handle
1a8d0 75 6e 6c 65 73 73 20 66 6f 72 62 69 64 64 65 6e unless forbidden
1a8e0 20 66 72 6f 6d 0d 0a 20 20 20 20 20 20 20 20 23 from.. #
1a8f0 20 20 20 20 20 20 20 64 6f 69 6e 67 20 73 6f 2e doing so.
1a900 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1a910 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
1a920 65 78 69 73 74 73 20 3a 3a 6e 6f 28 73 71 6c 69 exists ::no(sqli
1a930 74 65 52 65 6d 6f 76 65 43 6f 6e 73 74 72 61 69 teRemoveConstrai
1a940 6e 74 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 nts)]} then {..
1a950 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 foreach
1a960 20 66 69 6c 65 4e 61 6d 65 20 24 63 6f 6e 66 69 fileName $confi
1a970 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 gFileNames {..
1a980 20 20 20 20 20 20 20 20 20 20 72 65 6d 6f 76 65 remove
1a990 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
1a9a0 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 24 66 69 ndArgs file_ $fi
1a9b0 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 20 leName]..
1a9c0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1a9d0 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
1a9e0 6d 65 20 24 6d 64 61 43 6f 6e 66 69 67 46 69 6c me $mdaConfigFil
1a9f0 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
1aa00 20 20 20 20 20 20 72 65 6d 6f 76 65 43 6f 6e 73 removeCons
1aa10 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
1aa20 67 73 20 66 69 6c 65 5f 20 24 66 69 6c 65 4e 61 gs file_ $fileNa
1aa30 6d 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d me].. }
1aa40 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f .... fo
1aa50 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
1aa60 65 78 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 externalFileName
1aa70 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
1aa80 20 72 65 6d 6f 76 65 43 6f 6e 73 74 72 61 69 6e removeConstrain
1aa90 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 t [appendArgs fi
1aaa0 6c 65 5f 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 le_ [file tail $
1aab0 66 69 6c 65 4e 61 6d 65 5d 5d 0d 0a 20 20 20 20 fileName]]..
1aac0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1aad0 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
1aae0 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 46 69 6c eName $nativeFil
1aaf0 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
1ab00 20 20 20 20 20 20 72 65 6d 6f 76 65 43 6f 6e 73 removeCons
1ab10 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
1ab20 67 73 20 66 69 6c 65 5f 20 24 66 69 6c 65 4e 61 gs file_ $fileNa
1ab30 6d 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d me].. }
1ab40 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f .... fo
1ab50 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
1ab60 6d 61 6e 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 managedFileNames
1ab70 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1ab80 72 65 6d 6f 76 65 43 6f 6e 73 74 72 61 69 6e 74 removeConstraint
1ab90 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
1aba0 65 5f 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 e_ $fileName]..
1abb0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1abc0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
1abd0 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
1abe0 54 45 3a 20 53 6b 69 70 20 61 6c 6c 20 53 79 73 TE: Skip all Sys
1abf0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
1ac00 72 65 6c 61 74 65 64 20 66 69 6c 65 20 68 61 6e related file han
1ac10 64 6c 69 6e 67 20 28 64 65 6c 65 74 69 6e 67 2c dling (deleting,
1ac20 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
1ac30 20 20 63 6f 70 79 69 6e 67 2c 20 61 6e 64 20 6c copying, and l
1ac40 6f 61 64 69 6e 67 29 20 69 66 20 69 6e 73 74 72 oading) if instr
1ac50 75 63 74 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 ucted...
1ac60 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
1ac70 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
1ac80 6f 28 73 71 6c 69 74 65 46 69 6c 65 73 29 5d 7d o(sqliteFiles)]}
1ac90 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1aca0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
1acb0 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 74 72 79 # NOTE: Skip try
1acc0 69 6e 67 20 74 6f 20 64 65 6c 65 74 65 20 61 6e ing to delete an
1acd0 79 20 66 69 6c 65 73 20 69 66 20 69 6e 73 74 72 y files if instr
1ace0 75 63 74 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 ucted...
1acf0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 #.. i
1ad00 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
1ad10 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 ::no(deleteSqli
1ad20 74 65 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 teFiles)]} then
1ad30 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 {.. i
1ad40 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
1ad50 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 ::no(deleteSqli
1ad60 74 65 43 6f 6e 66 69 67 46 69 6c 65 73 29 5d 7d teConfigFiles)]}
1ad70 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1ad80 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
1ad90 69 6c 65 4e 61 6d 65 20 24 63 6f 6e 66 69 67 46 ileName $configF
1ada0 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 ileNames {..
1adb0 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 44 tryD
1adc0 65 6c 65 74 65 42 69 6e 61 72 79 46 69 6c 65 20 eleteBinaryFile
1add0 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 $fileName..
1ade0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1adf0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
1ae00 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
1ae10 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
1ae20 64 65 6c 65 74 65 53 71 6c 69 74 65 45 78 74 65 deleteSqliteExte
1ae30 72 6e 61 6c 46 69 6c 65 73 29 5d 7d 20 74 68 65 rnalFiles)]} the
1ae40 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1ae50 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e foreach fileN
1ae60 61 6d 65 20 24 6d 64 61 43 6f 6e 66 69 67 46 69 ame $mdaConfigFi
1ae70 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
1ae80 20 20 20 20 20 20 20 20 20 20 20 74 72 79 44 65 tryDe
1ae90 6c 65 74 65 42 75 69 6c 64 46 69 6c 65 20 24 66 leteBuildFile $f
1aea0 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 ileName..
1aeb0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1aec0 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 foreac
1aed0 68 20 66 69 6c 65 4e 61 6d 65 20 24 65 78 74 65 h fileName $exte
1aee0 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 73 20 7b 0d rnalFileNames {.
1aef0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1af00 20 74 72 79 44 65 6c 65 74 65 42 69 6e 61 72 79 tryDeleteBinary
1af10 46 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 0d 0a File $fileName..
1af20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
1af30 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
1af40 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
1af50 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
1af60 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 ::no(deleteSqlit
1af70 65 4e 61 74 69 76 65 46 69 6c 65 73 29 5d 7d 20 eNativeFiles)]}
1af80 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1af90 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
1afa0 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c exists ::no(del
1afb0 65 74 65 53 71 6c 69 74 65 49 6d 70 6c 69 63 69 eteSqliteImplici
1afc0 74 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b tFiles)]} then {
1afd0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1afe0 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
1aff0 6d 65 20 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 me $nativeFileNa
1b000 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 mes {..
1b010 20 20 20 20 20 20 20 20 20 74 72 79 44 65 6c 65 tryDele
1b020 74 65 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 teAssembly $file
1b030 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 Name..
1b040 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1b050 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1b060 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
1b070 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
1b080 28 64 65 6c 65 74 65 53 71 6c 69 74 65 4e 6f 6e (deleteSqliteNon
1b090 49 6d 70 6c 69 63 69 74 46 69 6c 65 73 29 5d 7d ImplicitFiles)]}
1b0a0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1b0b0 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
1b0c0 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
1b0d0 64 65 6c 65 74 65 53 71 6c 69 74 65 50 6c 61 74 deleteSqlitePlat
1b0e0 66 6f 72 6d 46 69 6c 65 73 29 5d 20 26 26 20 5c formFiles)] && \
1b0f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1b100 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 [string le
1b110 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 ngth $platform]
1b120 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
1b130 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 f
1b140 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 oreach fileName
1b150 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 $nativeFileNames
1b160 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1b170 20 20 20 20 20 20 20 20 74 72 79 44 65 6c 65 74 tryDelet
1b180 65 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e eAssembly $fileN
1b190 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 0d 0a 20 ame $platform..
1b1a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b1b0 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
1b1c0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
1b1d0 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
1b1e0 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
1b1f0 64 65 6c 65 74 65 53 71 6c 69 74 65 41 72 63 68 deleteSqliteArch
1b200 69 74 65 63 74 75 72 65 46 69 6c 65 73 29 5d 20 itectureFiles)]
1b210 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
1b220 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
1b230 67 20 6c 65 6e 67 74 68 20 24 61 72 63 68 69 74 g length $archit
1b240 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 74 68 65 ecture] > 0} the
1b250 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1b260 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
1b270 69 6c 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 46 ileName $nativeF
1b280 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 ileNames {..
1b290 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b2a0 74 72 79 44 65 6c 65 74 65 41 73 73 65 6d 62 6c tryDeleteAssembl
1b2b0 79 20 24 66 69 6c 65 4e 61 6d 65 20 24 61 72 63 y $fileName $arc
1b2c0 68 69 74 65 63 74 75 72 65 0d 0a 20 20 20 20 20 hitecture..
1b2d0 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
1b2e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b2f0 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 }..
1b300 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
1b310 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }....
1b320 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
1b330 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 ts ::no(deleteSq
1b340 6c 69 74 65 4d 61 6e 61 67 65 64 46 69 6c 65 73 liteManagedFiles
1b350 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 )]} then {..
1b360 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 foreac
1b370 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d 61 6e 61 h fileName $mana
1b380 67 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a gedFileNames {..
1b390 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b3a0 74 72 79 44 65 6c 65 74 65 41 73 73 65 6d 62 6c tryDeleteAssembl
1b3b0 79 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 y $fileName..
1b3c0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
1b3d0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1b3e0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1b3f0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1b400 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b # NOTE: Check
1b410 20 66 6f 72 20 74 68 65 20 22 61 75 74 6f 53 65 for the "autoSe
1b420 6c 65 63 74 22 20 72 75 6e 74 69 6d 65 20 6f 70 lect" runtime op
1b430 74 69 6f 6e 2e 20 20 49 66 20 70 72 65 73 65 6e tion. If presen
1b440 74 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 t,.. #
1b450 20 20 20 20 20 20 61 74 74 65 6d 70 74 20 74 6f attempt to
1b460 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 73 automatically s
1b470 65 6c 65 63 74 20 74 68 65 20 66 69 72 73 74 20 elect the first
1b480 61 76 61 69 6c 61 62 6c 65 0d 0a 20 20 20 20 20 available..
1b490 20 20 20 20 20 23 20 20 20 20 20 20 20 62 75 69 # bui
1b4a0 6c 64 20 28 6f 72 20 22 72 65 6c 65 61 73 65 22 ld (or "release"
1b4b0 29 20 6f 66 20 53 51 4c 69 74 65 20 61 6e 64 20 ) of SQLite and
1b4c0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
1b4d0 74 65 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 te.. #
1b4e0 20 20 20 20 20 20 66 6f 72 20 75 73 65 20 77 69 for use wi
1b4f0 74 68 20 74 68 65 20 74 65 73 74 20 73 75 69 74 th the test suit
1b500 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d e... #.
1b510 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
1b520 68 61 73 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e hasRuntimeOption
1b530 20 61 75 74 6f 53 65 6c 65 63 74 5d 7d 20 74 68 autoSelect]} th
1b540 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1b550 20 20 69 66 20 7b 21 5b 63 68 65 63 6b 46 6f 72 if {![checkFor
1b560 53 51 4c 69 74 65 42 75 69 6c 64 73 20 24 3a 3a SQLiteBuilds $::
1b570 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 74 72 75 test_channel tru
1b580 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
1b590 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
1b5a0 6f 72 53 51 4c 69 74 65 52 65 6c 65 61 73 65 73 orSQLiteReleases
1b5b0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
1b5c0 20 74 72 75 65 0d 0a 20 20 20 20 20 20 20 20 20 true..
1b5d0 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
1b5e0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 23 }.... #
1b5f0 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f .. # NO
1b600 54 45 3a 20 53 6b 69 70 20 74 72 79 69 6e 67 20 TE: Skip trying
1b610 74 6f 20 76 65 72 69 66 79 20 74 68 65 20 62 75 to verify the bu
1b620 69 6c 64 20 64 69 72 65 63 74 6f 72 79 20 69 66 ild directory if
1b630 20 69 6e 73 74 72 75 63 74 65 64 3b 0d 0a 20 20 instructed;..
1b640 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1b650 6f 74 68 65 72 77 69 73 65 2c 20 6d 61 6b 65 20 otherwise, make
1b660 73 75 72 65 20 69 74 20 61 63 74 75 61 6c 6c 79 sure it actually
1b670 20 65 78 69 73 74 73 20 6f 72 20 68 61 6c 74 20 exists or halt
1b680 74 68 65 20 65 6e 74 69 72 65 0d 0a 20 20 20 20 the entire..
1b690 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 65 # te
1b6a0 73 74 69 6e 67 20 70 72 6f 63 65 73 73 20 69 66 sting process if
1b6b0 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 it does not exi
1b6c0 73 74 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 st... #
1b6d0 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
1b6e0 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
1b6f0 6e 6f 28 76 65 72 69 66 79 42 75 69 6c 64 44 69 no(verifyBuildDi
1b700 72 65 63 74 6f 72 79 29 5d 7d 20 74 68 65 6e 20 rectory)]} then
1b710 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 {.. #
1b720 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 .. #
1b730 4e 4f 54 45 3a 20 41 74 20 74 68 69 73 20 70 6f NOTE: At this po
1b740 69 6e 74 2c 20 74 68 65 20 62 75 69 6c 64 20 64 int, the build d
1b750 69 72 65 63 74 6f 72 79 20 4d 55 53 54 20 65 78 irectory MUST ex
1b760 69 73 74 20 61 73 20 61 0d 0a 20 20 20 20 20 20 ist as a..
1b770 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 61 # va
1b780 6c 69 64 20 64 69 72 65 63 74 6f 72 79 20 66 6f lid directory fo
1b790 72 20 74 68 65 20 74 65 73 74 69 6e 67 20 70 72 r the testing pr
1b7a0 6f 63 65 73 73 20 74 6f 20 63 6f 6e 74 69 6e 75 ocess to continu
1b7b0 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 e...
1b7c0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 #.. s
1b7d0 65 74 20 64 69 72 65 63 74 6f 72 79 20 5b 67 65 et directory [ge
1b7e0 74 42 75 69 6c 64 44 69 72 65 63 74 6f 72 79 5d tBuildDirectory]
1b7f0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
1b800 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 if {![file exist
1b810 73 20 24 64 69 72 65 63 74 6f 72 79 5d 20 7c 7c s $directory] ||
1b820 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1b830 20 20 20 20 21 5b 66 69 6c 65 20 69 73 64 69 72 ![file isdir
1b840 65 63 74 6f 72 79 20 24 64 69 72 65 63 74 6f 72 ectory $director
1b850 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 y]} then {..
1b860 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
1b870 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 # NOT
1b880 45 3a 20 4a 75 73 74 20 70 72 69 6f 72 20 74 6f E: Just prior to
1b890 20 61 63 74 75 61 6c 6c 79 20 68 61 6c 74 69 6e actually haltin
1b8a0 67 20 74 68 65 20 74 65 73 74 69 6e 67 20 70 72 g the testing pr
1b8b0 6f 63 65 73 73 2c 0d 0a 20 20 20 20 20 20 20 20 ocess,..
1b8c0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 64 # ad
1b8d0 64 20 61 6e 20 65 72 72 6f 72 20 74 6f 20 74 68 d an error to th
1b8e0 65 20 74 65 73 74 20 6c 6f 67 20 66 69 6c 65 2e e test log file.
1b8f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1b900 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 #..
1b910 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
1b920 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1b930 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1b940 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f "---- co
1b950 75 6c 64 20 6e 6f 74 20 76 65 72 69 66 79 20 62 uld not verify b
1b960 75 69 6c 64 20 64 69 72 65 63 74 6f 72 79 20 5c uild directory \
1b970 22 22 20 24 64 69 72 65 63 74 6f 72 79 20 5c 0d "" $directory \.
1b980 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1b990 20 20 20 22 5c 22 2c 20 61 6c 6c 20 74 65 73 74 "\", all test
1b9a0 69 6e 67 20 68 61 6c 74 65 64 5c 6e 22 5d 0d 0a ing halted\n"]..
1b9b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1b9c0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 #..
1b9d0 20 23 20 4e 4f 54 45 3a 20 52 61 69 73 69 6e 67 # NOTE: Raising
1b9e0 20 61 20 73 63 72 69 70 74 20 65 72 72 6f 72 20 a script error
1b9f0 66 72 6f 6d 20 74 68 69 73 20 70 6f 69 6e 74 20 from this point
1ba00 73 68 6f 75 6c 64 20 68 61 6c 74 0d 0a 20 20 20 should halt..
1ba10 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 #
1ba20 20 20 20 74 68 65 20 74 65 73 74 69 6e 67 20 70 the testing p
1ba30 72 6f 63 65 73 73 2e 0d 0a 20 20 20 20 20 20 20 rocess...
1ba40 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1ba50 20 20 20 20 20 20 20 20 65 72 72 6f 72 20 5b 61 error [a
1ba60 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
1ba70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1ba80 63 6f 75 6c 64 20 6e 6f 74 20 76 65 72 69 66 79 could not verify
1ba90 20 62 75 69 6c 64 20 64 69 72 65 63 74 6f 72 79 build directory
1baa0 20 5c 22 22 20 24 64 69 72 65 63 74 6f 72 79 20 \"" $directory
1bab0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1bac0 20 20 20 20 20 22 5c 22 2c 20 61 6c 6c 20 74 65 "\", all te
1bad0 73 74 69 6e 67 20 68 61 6c 74 65 64 22 5d 0d 0a sting halted"]..
1bae0 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
1baf0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
1bb00 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1bb10 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 # NOTE: Ski
1bb20 70 20 74 72 79 69 6e 67 20 74 6f 20 63 6f 70 79 p trying to copy
1bb30 20 61 6e 79 20 66 69 6c 65 73 20 69 66 20 69 6e any files if in
1bb40 73 74 72 75 63 74 65 64 2e 0d 0a 20 20 20 20 20 structed...
1bb50 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1bb60 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
1bb70 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c sts ::no(copySql
1bb80 69 74 65 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e iteFiles)]} then
1bb90 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1bba0 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
1bbb0 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 s ::no(copySqlit
1bbc0 65 43 6f 6e 66 69 67 46 69 6c 65 73 29 5d 7d 20 eConfigFiles)]}
1bbd0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1bbe0 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 foreach fi
1bbf0 6c 65 4e 61 6d 65 20 24 63 6f 6e 66 69 67 46 69 leName $configFi
1bc00 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
1bc10 20 20 20 20 20 20 20 20 20 20 20 74 72 79 43 6f tryCo
1bc20 70 79 42 75 69 6c 64 46 69 6c 65 20 24 66 69 6c pyBuildFile $fil
1bc30 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 eName..
1bc40 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1bc50 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
1bc60 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
1bc70 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 exists ::no(copy
1bc80 53 71 6c 69 74 65 45 78 74 65 72 6e 61 6c 46 69 SqliteExternalFi
1bc90 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 les)]} then {..
1bca0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
1bcb0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
1bcc0 4e 4f 54 45 3a 20 43 6f 70 79 20 74 68 65 20 4d NOTE: Copy the M
1bcd0 61 6e 61 67 65 64 20 44 65 62 75 67 67 69 6e 67 anaged Debugging
1bce0 20 41 73 73 69 73 74 61 6e 74 73 20 28 4d 44 41 Assistants (MDA
1bcf0 29 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 0d ) configuration.
1bd00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
1bd10 20 20 20 20 20 20 20 66 69 6c 65 20 66 6f 72 20 file for
1bd20 74 68 65 20 45 61 67 6c 65 20 73 68 65 6c 6c 20 the Eagle shell
1bd30 74 6f 20 74 68 65 20 62 75 69 6c 64 20 6f 75 74 to the build out
1bd40 70 75 74 20 64 69 72 65 63 74 6f 72 79 2c 0d 0a put directory,..
1bd50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
1bd60 20 20 20 20 20 20 77 68 69 6c 65 20 75 73 69 6e while usin
1bd70 67 20 65 61 63 68 20 6f 66 20 74 68 65 20 6e 61 g each of the na
1bd80 6d 65 73 20 6f 66 20 74 68 65 20 76 61 72 69 6f mes of the vario
1bd90 75 73 20 6c 65 67 61 63 79 20 74 65 73 74 0d 0a us legacy test..
1bda0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
1bdb0 20 20 20 20 20 20 65 78 65 63 75 74 61 62 6c 65 executable
1bdc0 73 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 68 65 s. This will he
1bdd0 6c 70 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 20 lp to make sure
1bde0 74 68 61 74 20 61 6c 6c 20 74 68 65 0d 0a 20 20 that all the..
1bdf0 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 #
1be00 20 20 20 20 6c 65 67 61 63 79 20 74 65 73 74 73 legacy tests
1be10 20 72 75 6e 20 77 69 74 68 20 65 78 61 63 74 6c run with exactl
1be20 79 20 74 68 65 20 73 61 6d 65 20 73 65 74 20 6f y the same set o
1be30 66 20 4d 61 6e 61 67 65 64 0d 0a 20 20 20 20 20 f Managed..
1be40 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
1be50 20 44 65 62 75 67 67 69 6e 67 20 41 73 73 69 73 Debugging Assis
1be60 74 61 6e 74 73 20 63 6f 6e 66 69 67 75 72 65 64 tants configured
1be70 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
1be80 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
1be90 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
1bea0 6d 65 20 24 6d 64 61 43 6f 6e 66 69 67 46 69 6c me $mdaConfigFil
1beb0 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
1bec0 20 20 20 20 20 20 20 20 20 20 74 72 79 43 6f 70 tryCop
1bed0 79 42 69 6e 61 72 79 46 69 6c 65 20 45 61 67 6c yBinaryFile Eagl
1bee0 65 53 68 65 6c 6c 2e 65 78 65 2e 6d 64 61 2e 63 eShell.exe.mda.c
1bef0 6f 6e 66 69 67 20 22 22 20 24 66 69 6c 65 4e 61 onfig "" $fileNa
1bf00 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 me..
1bf10 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
1bf20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1bf30 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 6f # NOTE: Co
1bf40 70 79 20 74 68 65 20 65 78 74 65 72 6e 61 6c 20 py the external
1bf50 62 69 6e 61 72 69 65 73 2c 20 69 66 20 61 6e 79 binaries, if any
1bf60 2c 20 74 6f 20 74 68 65 20 64 69 72 65 63 74 6f , to the directo
1bf70 72 79 20 74 68 61 74 0d 0a 20 20 20 20 20 20 20 ry that..
1bf80 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 # c
1bf90 6f 6e 74 61 69 6e 73 20 74 68 65 20 45 61 67 6c ontains the Eagl
1bfa0 65 20 73 68 65 6c 6c 2e 20 20 54 68 69 73 20 69 e shell. This i
1bfb0 73 20 74 79 70 69 63 61 6c 6c 79 20 75 73 65 64 s typically used
1bfc0 20 74 6f 20 6d 61 6b 65 0d 0a 20 20 20 20 20 20 to make..
1bfd0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1bfe0 73 75 72 65 20 61 73 73 65 6d 62 6c 69 65 73 20 sure assemblies
1bff0 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 referenced by th
1c000 65 20 6f 6e 65 73 20 62 65 69 6e 67 20 74 65 73 e ones being tes
1c010 74 65 64 20 61 72 65 0d 0a 20 20 20 20 20 20 20 ted are..
1c020 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 # a
1c030 76 61 69 6c 61 62 6c 65 20 64 75 72 69 6e 67 20 vailable during
1c040 74 68 65 20 74 65 73 74 69 6e 67 20 70 72 6f 63 the testing proc
1c050 65 73 73 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ess...
1c060 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
1c070 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
1c080 65 4e 61 6d 65 20 24 65 78 74 65 72 6e 61 6c 46 eName $externalF
1c090 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 ileNames {..
1c0a0 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 43 tryC
1c0b0 6f 70 79 45 78 74 65 72 6e 61 6c 46 69 6c 65 20 opyExternalFile
1c0c0 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 $fileName..
1c0d0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1c0e0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
1c0f0 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
1c100 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
1c110 63 6f 70 79 53 71 6c 69 74 65 4e 61 74 69 76 65 copySqliteNative
1c120 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d Files)]} then {.
1c130 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
1c140 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c150 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 74 # NOTE: If the t
1c160 65 73 74 20 70 6c 61 74 66 6f 72 6d 20 69 73 20 est platform is
1c170 6c 69 6b 65 6c 79 20 74 68 65 20 64 65 66 61 75 likely the defau
1c180 6c 74 20 66 6f 72 20 74 68 69 73 0d 0a 20 20 20 lt for this..
1c190 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 #
1c1a0 20 20 20 6d 61 63 68 69 6e 65 2c 20 61 6c 73 6f machine, also
1c1b0 20 74 72 79 20 74 6f 20 63 6f 70 79 20 74 68 65 try to copy the
1c1c0 20 6e 61 74 69 76 65 20 66 69 6c 65 73 20 74 6f native files to
1c1d0 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 20 20 the..
1c1e0 20 20 20 20 23 20 20 20 20 20 20 20 62 69 6e 61 # bina
1c1f0 72 79 20 6c 6f 63 61 74 69 6f 6e 2e 0d 0a 20 20 ry location...
1c200 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
1c210 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
1c220 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
1c230 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 49 6d :no(copySqliteIm
1c240 70 6c 69 63 69 74 46 69 6c 65 73 29 5d 20 26 26 plicitFiles)] &&
1c250 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1c260 20 20 20 20 20 20 5b 69 73 44 65 66 61 75 6c 74 [isDefault
1c270 42 75 69 6c 64 50 6c 61 74 66 6f 72 6d 20 74 72 BuildPlatform tr
1c280 75 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ue]} then {..
1c290 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 for
1c2a0 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6e each fileName $n
1c2b0 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b ativeFileNames {
1c2c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c2d0 20 20 20 20 74 72 79 43 6f 70 79 41 73 73 65 6d tryCopyAssem
1c2e0 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 bly $fileName..
1c2f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
1c300 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c310 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }....
1c320 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
1c330 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 ists ::no(copySq
1c340 6c 69 74 65 4e 6f 6e 49 6d 70 6c 69 63 69 74 46 liteNonImplicitF
1c350 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
1c360 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1c370 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
1c380 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 s ::no(copySqlit
1c390 65 50 6c 61 74 66 6f 72 6d 46 69 6c 65 73 29 5d ePlatformFiles)]
1c3a0 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
1c3b0 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 [stri
1c3c0 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 ng length $platf
1c3d0 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b orm] > 0} then {
1c3e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c3f0 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
1c400 4e 61 6d 65 20 24 6e 61 74 69 76 65 46 69 6c 65 Name $nativeFile
1c410 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 Names {..
1c420 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 try
1c430 43 6f 70 79 41 73 73 65 6d 62 6c 79 20 24 66 69 CopyAssembly $fi
1c440 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d leName $platform
1c450 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c460 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
1c470 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1c480 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
1c490 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
1c4a0 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 41 72 63 no(copySqliteArc
1c4b0 68 69 74 65 63 74 75 72 65 46 69 6c 65 73 29 5d hitectureFiles)]
1c4c0 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
1c4d0 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 [stri
1c4e0 6e 67 20 6c 65 6e 67 74 68 20 24 61 72 63 68 69 ng length $archi
1c4f0 74 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 74 68 tecture] > 0} th
1c500 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1c510 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
1c520 66 69 6c 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 fileName $native
1c530 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 FileNames {..
1c540 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1c550 20 74 72 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 tryCopyAssembly
1c560 20 24 66 69 6c 65 4e 61 6d 65 20 24 61 72 63 68 $fileName $arch
1c570 69 74 65 63 74 75 72 65 0d 0a 20 20 20 20 20 20 itecture..
1c580 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
1c590 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
1c5a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c5b0 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d }.. }
1c5c0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
1c5d0 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
1c5e0 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 s ::no(copySqlit
1c5f0 65 4d 61 6e 61 67 65 64 46 69 6c 65 73 29 5d 7d eManagedFiles)]}
1c600 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1c610 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
1c620 69 6c 65 4e 61 6d 65 20 24 6d 61 6e 61 67 65 64 ileName $managed
1c630 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 FileNames {..
1c640 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 try
1c650 43 6f 70 79 41 73 73 65 6d 62 6c 79 20 24 66 69 CopyAssembly $fi
1c660 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 leName..
1c670 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1c680 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1c690 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
1c6a0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 #.. #
1c6b0 4e 4f 54 45 3a 20 53 6b 69 70 20 74 72 79 69 6e NOTE: Skip tryin
1c6c0 67 20 74 6f 20 6c 6f 61 64 20 61 6e 79 20 66 69 g to load any fi
1c6d0 6c 65 73 20 69 66 20 69 6e 73 74 72 75 63 74 65 les if instructe
1c6e0 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d d... #.
1c6f0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 . if {!
1c700 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
1c710 6f 28 6c 6f 61 64 53 71 6c 69 74 65 46 69 6c 65 o(loadSqliteFile
1c720 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
1c730 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
1c740 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
1c750 6c 6f 61 64 53 71 6c 69 74 65 49 6d 70 6c 69 63 loadSqliteImplic
1c760 69 74 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 itFiles)]} then
1c770 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1c780 20 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 6c 79 tryLoadAssembly
1c790 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
1c7a0 69 74 65 2e 64 6c 6c 0d 0a 20 20 20 20 20 20 20 ite.dll..
1c7b0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1c7c0 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
1c7d0 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 exists ::no(loa
1c7e0 64 53 71 6c 69 74 65 4c 69 6e 71 46 69 6c 65 73 dSqliteLinqFiles
1c7f0 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 )]} then {..
1c800 20 20 20 20 20 20 20 20 20 20 74 72 79 4c 6f 61 tryLoa
1c810 64 41 73 73 65 6d 62 6c 79 20 53 79 73 74 65 6d dAssembly System
1c820 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 4c 69 6e .Data.SQLite.Lin
1c830 71 2e 64 6c 6c 0d 0a 20 20 20 20 20 20 20 20 20 q.dll..
1c840 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1c850 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
1c860 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 xists ::no(loadS
1c870 71 6c 69 74 65 45 66 36 46 69 6c 65 73 29 5d 7d qliteEf6Files)]}
1c880 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1c890 20 20 20 20 20 20 20 74 72 79 4c 6f 61 64 41 73 tryLoadAs
1c8a0 73 65 6d 62 6c 79 20 53 79 73 74 65 6d 2e 44 61 sembly System.Da
1c8b0 74 61 2e 53 51 4c 69 74 65 2e 45 46 36 2e 64 6c ta.SQLite.EF6.dl
1c8c0 6c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d l.. }
1c8d0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
1c8e0 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
1c8f0 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 s ::no(loadSqlit
1c900 65 4e 6f 6e 49 6d 70 6c 69 63 69 74 46 69 6c 65 eNonImplicitFile
1c910 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
1c920 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
1c930 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
1c940 6f 28 6c 6f 61 64 53 71 6c 69 74 65 50 6c 61 74 o(loadSqlitePlat
1c950 66 6f 72 6d 46 69 6c 65 73 29 5d 20 26 26 20 5c formFiles)] && \
1c960 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c970 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 [string leng
1c980 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 th $platform] >
1c990 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
1c9a0 20 20 20 20 20 20 20 20 20 20 20 74 72 79 4c 6f tryLo
1c9b0 61 64 41 73 73 65 6d 62 6c 79 20 53 79 73 74 65 adAssembly Syste
1c9c0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c m.Data.SQLite.dl
1c9d0 6c 20 24 70 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 l $platform..
1c9e0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
1c9f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
1ca00 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
1ca10 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 65 41 ::no(loadSqliteA
1ca20 72 63 68 69 74 65 63 74 75 72 65 46 69 6c 65 73 rchitectureFiles
1ca30 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 )] && \..
1ca40 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 [stri
1ca50 6e 67 20 6c 65 6e 67 74 68 20 24 61 72 63 68 69 ng length $archi
1ca60 74 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 74 68 tecture] > 0} th
1ca70 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1ca80 20 20 20 20 20 20 74 72 79 4c 6f 61 64 41 73 73 tryLoadAss
1ca90 65 6d 62 6c 79 20 53 79 73 74 65 6d 2e 44 61 74 embly System.Dat
1caa0 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 20 24 61 72 a.SQLite.dll $ar
1cab0 63 68 69 74 65 63 74 75 72 65 0d 0a 20 20 20 20 chitecture..
1cac0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1cad0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1cae0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1caf0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 63 61 }.... ca
1cb00 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
1cb10 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
1cb20 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1cb30 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1cb40 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 "---- file v
1cb50 65 72 73 69 6f 6e 20 6f 66 20 5c 22 73 71 6c 69 ersion of \"sqli
1cb60 74 65 33 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 20 5c te3.dll\"... " \
1cb70 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1cb80 5b 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 5b 67 [file version [g
1cb90 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 etBinaryFileName
1cba0 20 73 71 6c 69 74 65 33 2e 64 6c 6c 5d 5d 20 5c sqlite3.dll]] \
1cbb0 6e 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d n].. }...
1cbc0 0a 20 20 20 20 20 20 20 20 63 61 74 63 68 20 7b . catch {
1cbd0 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
1cbe0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
1cbf0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
1cc00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
1cc10 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 6f ---- file versio
1cc20 6e 20 6f 66 20 5c 22 53 51 4c 69 74 65 2e 49 6e n of \"SQLite.In
1cc30 74 65 72 6f 70 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 terop.dll\"... "
1cc40 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1cc50 20 20 5b 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 [file version
1cc60 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 [getBinaryFileNa
1cc70 6d 65 20 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f me SQLite.Intero
1cc80 70 2e 64 6c 6c 5d 5d 20 5c 6e 5d 0d 0a 20 20 20 p.dll]] \n]..
1cc90 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1cca0 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 catch {..
1ccb0 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1ccc0 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
1ccd0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1cce0 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 "---- fi
1ccf0 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 le version of \"
1cd00 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
1cd10 74 65 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 20 5c 0d te.dll\"... " \.
1cd20 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b . [
1cd30 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 5b 67 65 file version [ge
1cd40 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 tBinaryFileName
1cd50 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
1cd60 74 65 2e 64 6c 6c 5d 5d 20 5c 6e 5d 0d 0a 20 20 te.dll]] \n]..
1cd70 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1cd80 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 catch {..
1cd90 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
1cda0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
1cdb0 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
1cdc0 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 "---- f
1cdd0 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c ile version of \
1cde0 22 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c "System.Data.SQL
1cdf0 69 74 65 2e 4c 69 6e 71 2e 64 6c 6c 5c 22 2e 2e ite.Linq.dll\"..
1ce00 2e 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 . " \..
1ce10 20 20 20 20 20 5b 66 69 6c 65 20 76 65 72 73 69 [file versi
1ce20 6f 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c on [getBinaryFil
1ce30 65 4e 61 6d 65 20 53 79 73 74 65 6d 2e 44 61 74 eName System.Dat
1ce40 61 2e 53 51 4c 69 74 65 2e 4c 69 6e 71 2e 64 6c a.SQLite.Linq.dl
1ce50 6c 5d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 l]] \n]..
1ce60 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 63 61 }.... ca
1ce70 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
1ce80 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
1ce90 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1cea0 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1ceb0 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 "---- file v
1cec0 65 72 73 69 6f 6e 20 6f 66 20 5c 22 53 79 73 74 ersion of \"Syst
1ced0 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 45 em.Data.SQLite.E
1cee0 46 36 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 20 5c 0d F6.dll\"... " \.
1cef0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b . [
1cf00 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 5b 67 65 file version [ge
1cf10 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 tBinaryFileName
1cf20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
1cf30 74 65 2e 45 46 36 2e 64 6c 6c 5d 5d 20 5c 6e 5d te.EF6.dll]] \n]
1cf40 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
1cf50 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 if {[stri
1cf60 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 ng length $platf
1cf70 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b orm] > 0} then {
1cf80 0d 0a 20 20 20 20 20 20 20 20 20 20 63 61 74 63 .. catc
1cf90 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 h {..
1cfa0 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
1cfb0 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1cfc0 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1cfd0 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 "---- file
1cfe0 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 20 version of \""
1cff0 24 70 6c 61 74 66 6f 72 6d 20 5c 0d 0a 20 20 20 $platform \..
1d000 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2f 73 "/s
1d010 71 6c 69 74 65 33 2e 64 6c 6c 5c 22 2e 2e 2e 20 qlite3.dll\"...
1d020 22 20 5b 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 " [file version
1d030 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1d040 20 20 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c [getBinaryFil
1d050 65 4e 61 6d 65 20 73 71 6c 69 74 65 33 2e 64 6c eName sqlite3.dl
1d060 6c 20 24 70 6c 61 74 66 6f 72 6d 5d 5d 20 5c 6e l $platform]] \n
1d070 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
1d080 0d 0a 20 20 20 20 20 20 20 20 20 20 63 61 74 63 .. catc
1d090 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 h {..
1d0a0 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
1d0b0 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1d0c0 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1d0d0 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 "---- file
1d0e0 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 20 version of \""
1d0f0 24 70 6c 61 74 66 6f 72 6d 20 5c 0d 0a 20 20 20 $platform \..
1d100 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2f 53 "/S
1d110 51 4c 69 74 65 2e 49 6e 74 65 72 6f 70 2e 64 6c QLite.Interop.dl
1d120 6c 5c 22 2e 2e 2e 20 22 20 5b 66 69 6c 65 20 76 l\"... " [file v
1d130 65 72 73 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 ersion \..
1d140 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 69 [getBi
1d150 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 53 51 4c naryFileName SQL
1d160 69 74 65 2e 49 6e 74 65 72 6f 70 2e 64 6c 6c 20 ite.Interop.dll
1d170 24 70 6c 61 74 66 6f 72 6d 5d 5d 20 5c 6e 5d 0d $platform]] \n].
1d180 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a . }....
1d190 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 20 catch
1d1a0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
1d1b0 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
1d1c0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1d1d0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1d1e0 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 "---- file v
1d1f0 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 20 24 70 ersion of \"" $p
1d200 6c 61 74 66 6f 72 6d 20 5c 0d 0a 20 20 20 20 20 latform \..
1d210 20 20 20 20 20 20 20 20 20 20 20 22 2f 53 79 73 "/Sys
1d220 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
1d230 64 6c 6c 5c 22 2e 2e 2e 20 22 20 5b 66 69 6c 65 dll\"... " [file
1d240 20 76 65 72 73 69 6f 6e 20 5c 0d 0a 20 20 20 20 version \..
1d250 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
1d260 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 53 BinaryFileName S
1d270 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1d280 65 2e 64 6c 6c 20 24 70 6c 61 74 66 6f 72 6d 5d e.dll $platform]
1d290 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 ] \n]..
1d2a0 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
1d2b0 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 . if {[st
1d2c0 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 61 72 63 ring length $arc
1d2d0 68 69 74 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 hitecture] > 0}
1d2e0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1d2f0 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 catch {..
1d300 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
1d310 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
1d320 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
1d330 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
1d340 2d 20 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f - file version o
1d350 66 20 5c 22 22 20 24 61 72 63 68 69 74 65 63 74 f \"" $architect
1d360 75 72 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ure \..
1d370 20 20 20 20 20 20 20 22 2f 73 71 6c 69 74 65 33 "/sqlite3
1d380 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 20 5b 66 69 6c .dll\"... " [fil
1d390 65 20 76 65 72 73 69 6f 6e 20 5c 0d 0a 20 20 20 e version \..
1d3a0 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 [ge
1d3b0 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 tBinaryFileName
1d3c0 73 71 6c 69 74 65 33 2e 64 6c 6c 20 24 61 72 63 sqlite3.dll $arc
1d3d0 68 69 74 65 63 74 75 72 65 5d 5d 20 5c 6e 5d 0d hitecture]] \n].
1d3e0 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a . }....
1d3f0 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 20 catch
1d400 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
1d410 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
1d420 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1d430 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1d440 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 "---- file v
1d450 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 20 24 61 ersion of \"" $a
1d460 72 63 68 69 74 65 63 74 75 72 65 20 5c 0d 0a 20 rchitecture \..
1d470 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1d480 2f 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f 70 2e /SQLite.Interop.
1d490 64 6c 6c 5c 22 2e 2e 2e 20 22 20 5b 66 69 6c 65 dll\"... " [file
1d4a0 20 76 65 72 73 69 6f 6e 20 5c 0d 0a 20 20 20 20 version \..
1d4b0 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
1d4c0 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 53 BinaryFileName S
1d4d0 51 4c 69 74 65 2e 49 6e 74 65 72 6f 70 2e 64 6c QLite.Interop.dl
1d4e0 6c 20 24 61 72 63 68 69 74 65 63 74 75 72 65 5d l $architecture]
1d4f0 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 ] \n]..
1d500 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
1d510 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
1d520 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1d530 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
1d540 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1d550 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1d560 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 file version of
1d570 5c 22 22 20 24 61 72 63 68 69 74 65 63 74 75 72 \"" $architectur
1d580 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
1d590 20 20 20 20 20 22 2f 53 79 73 74 65 6d 2e 44 61 "/System.Da
1d5a0 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5c 22 2e ta.SQLite.dll\".
1d5b0 2e 2e 20 22 20 5b 66 69 6c 65 20 76 65 72 73 69 .. " [file versi
1d5c0 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 on \..
1d5d0 20 20 20 20 20 20 5b 67 65 74 42 69 6e 61 72 79 [getBinary
1d5e0 46 69 6c 65 4e 61 6d 65 20 53 79 73 74 65 6d 2e FileName System.
1d5f0 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 20 Data.SQLite.dll
1d600 24 61 72 63 68 69 74 65 63 74 75 72 65 5d 5d 20 $architecture]]
1d610 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
1d620 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
1d630 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1d640 20 20 23 20 4e 4f 54 45 3a 20 47 72 61 62 20 74 # NOTE: Grab t
1d650 68 65 20 6c 69 73 74 20 6f 66 20 6d 61 6e 61 67 he list of manag
1d660 65 64 20 61 73 73 65 6d 62 6c 69 65 73 20 66 6f ed assemblies fo
1d670 72 20 74 68 65 20 63 75 72 72 65 6e 74 20 70 72 r the current pr
1d680 6f 63 65 73 73 0d 0a 20 20 20 20 20 20 20 20 23 ocess.. #
1d690 20 20 20 20 20 20 20 61 6e 64 20 72 65 70 6f 72 and repor
1d6a0 74 20 6f 6e 20 74 68 65 20 53 79 73 74 65 6d 2e t on the System.
1d6b0 44 61 74 61 2e 53 51 4c 69 74 65 20 72 65 6c 61 Data.SQLite rela
1d6c0 74 65 64 20 6f 6e 65 73 2e 0d 0a 20 20 20 20 20 ted ones...
1d6d0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 #.. if
1d6e0 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a {[haveSQLiteObj
1d6f0 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 ectCommand]} the
1d700 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 n {.. s
1d710 65 74 20 61 73 73 65 6d 62 6c 69 65 73 20 5b 6f et assemblies [o
1d720 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 41 70 70 bject invoke App
1d730 44 6f 6d 61 69 6e 2e 43 75 72 72 65 6e 74 44 6f Domain.CurrentDo
1d740 6d 61 69 6e 20 47 65 74 41 73 73 65 6d 62 6c 69 main GetAssembli
1d750 65 73 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 es]....
1d760 20 6f 62 6a 65 63 74 20 66 6f 72 65 61 63 68 20 object foreach
1d770 61 73 73 65 6d 62 6c 79 20 24 61 73 73 65 6d 62 assembly $assemb
1d780 6c 69 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 lies {..
1d790 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
1d7a0 6d 61 74 63 68 20 5c 7b 53 79 73 74 65 6d 2e 44 match \{System.D
1d7b0 61 74 61 2e 53 51 4c 69 74 65 2a 20 24 61 73 73 ata.SQLite* $ass
1d7c0 65 6d 62 6c 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a embly]} then {..
1d7d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
1d7e0 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
1d7f0 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1d800 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1d810 20 20 20 20 20 22 2d 2d 2d 2d 20 66 6f 75 6e 64 "---- found
1d820 20 6c 6f 61 64 65 64 20 61 73 73 65 6d 62 6c 79 loaded assembly
1d830 3a 20 22 20 24 61 73 73 65 6d 62 6c 79 20 5c 6e : " $assembly \n
1d840 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
1d850 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1d860 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1d870 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 catch {..
1d880 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
1d890 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a test_channel \..
1d8a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
1d8b0 2d 2d 2d 20 64 65 66 69 6e 65 20 63 6f 6e 73 74 --- define const
1d8c0 61 6e 74 73 20 66 6f 72 20 5c 22 53 79 73 74 65 ants for \"Syste
1d8d0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 5c 22 2e m.Data.SQLite\".
1d8e0 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 .. "....
1d8f0 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
1d900 20 20 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 obje
1d910 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
1d920 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 +NonPublic \..
1d930 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 S
1d940 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1d950 65 2e 53 51 4c 69 74 65 33 20 44 65 66 69 6e 65 e.SQLite3 Define
1d960 43 6f 6e 73 74 61 6e 74 73 0d 0a 20 20 20 20 20 Constants..
1d970 20 20 20 20 20 7d 20 64 65 66 69 6e 65 43 6f 6e } defineCon
1d980 73 74 61 6e 74 73 5d 20 3d 3d 20 30 7d 20 74 68 stants] == 0} th
1d990 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1d9a0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1d9b0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1d9c0 72 67 73 20 5b 66 6f 72 6d 61 74 4c 69 73 74 20 rgs [formatList
1d9d0 5b 6c 73 6f 72 74 20 5c 0d 0a 20 20 20 20 20 20 [lsort \..
1d9e0 20 20 20 20 20 20 20 20 20 20 24 64 65 66 69 6e $defin
1d9f0 65 43 6f 6e 73 74 61 6e 74 73 5d 20 3c 6e 6f 6e eConstants] <non
1da00 65 3e 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 e>] \n]..
1da10 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
1da20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1da30 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 75 ::test_channel u
1da40 6e 6b 6e 6f 77 6e 5c 6e 0d 0a 20 20 20 20 20 20 nknown\n..
1da50 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1da60 0d 0a 0d 0a 20 20 20 20 20 20 20 20 63 61 74 63 .... catc
1da70 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 h {.. t
1da80 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
1da90 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 nnel \..
1daa0 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6f 75 72 "---- sour
1dab0 63 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 ce version of \"
1dac0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
1dad0 74 65 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 0d 0a 0d te.dll\"... "...
1dae0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
1daf0 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
1db00 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
1db10 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
1db20 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 blic \..
1db30 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
1db40 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 ata.SQLite.SQLit
1db50 65 43 6f 6e 6e 65 63 74 69 6f 6e 20 50 72 6f 76 eConnection Prov
1db60 69 64 65 72 56 65 72 73 69 6f 6e 0d 0a 20 20 20 iderVersion..
1db70 20 20 20 20 20 20 20 7d 20 76 65 72 73 69 6f 6e } version
1db80 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
1db90 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
1dba0 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
1dbb0 76 65 72 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 version] == 0} t
1dbc0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1dbd0 20 20 20 20 20 73 65 74 20 76 65 72 73 69 6f 6e set version
1dbe0 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 20 20 20 null..
1dbf0 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
1dc00 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1dc10 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1dc20 72 67 73 20 24 76 65 72 73 69 6f 6e 20 5c 6e 5d rgs $version \n]
1dc30 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c .. } el
1dc40 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
1dc50 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1dc60 63 68 61 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c channel unknown\
1dc70 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a n.. }..
1dc80 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
1dc90 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 catch {..
1dca0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
1dcb0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d :test_channel \.
1dcc0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
1dcd0 2d 2d 2d 2d 20 73 6f 75 72 63 65 20 63 68 65 63 ---- source chec
1dce0 6b 6f 75 74 20 6f 66 20 5c 22 53 79 73 74 65 6d kout of \"System
1dcf0 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c .Data.SQLite.dll
1dd00 5c 22 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 \"... "....
1dd10 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
1dd20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6f {.. o
1dd30 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c bject invoke -fl
1dd40 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c ags +NonPublic \
1dd50 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1dd60 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
1dd70 4c 69 74 65 2e 53 51 4c 69 74 65 43 6f 6e 6e 65 Lite.SQLiteConne
1dd80 63 74 69 6f 6e 20 50 72 6f 76 69 64 65 72 53 6f ction ProviderSo
1dd90 75 72 63 65 49 64 0d 0a 20 20 20 20 20 20 20 20 urceId..
1dda0 20 20 7d 20 73 6f 75 72 63 65 49 64 5d 20 3d 3d } sourceId] ==
1ddb0 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
1ddc0 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 if {[str
1ddd0 69 6e 67 20 6c 65 6e 67 74 68 20 24 73 6f 75 72 ing length $sour
1dde0 63 65 49 64 5d 20 3d 3d 20 30 7d 20 74 68 65 6e ceId] == 0} then
1ddf0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1de00 20 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 6e set sourceId n
1de10 75 6c 6c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ull..
1de20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
1de30 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
1de40 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
1de50 73 20 24 73 6f 75 72 63 65 49 64 20 5c 6e 5d 0d s $sourceId \n].
1de60 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 . } els
1de70 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
1de80 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
1de90 68 61 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e hannel unknown\n
1dea0 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1deb0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1dec0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
1ded0 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 65 NOTE: Check the
1dee0 20 61 76 61 69 6c 61 62 6c 65 20 62 75 69 6c 64 available build
1def0 73 20 28 61 6e 64 20 22 72 65 6c 65 61 73 65 73 s (and "releases
1df00 22 29 20 6f 66 20 53 51 4c 69 74 65 20 61 6e 64 ") of SQLite and
1df10 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
1df20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
1df30 4c 69 74 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 Lite... #
1df40 0d 0a 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 .. checkF
1df50 6f 72 53 51 4c 69 74 65 42 75 69 6c 64 73 20 24 orSQLiteBuilds $
1df60 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a ::test_channel..
1df70 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
1df80 53 51 4c 69 74 65 52 65 6c 65 61 73 65 73 20 24 SQLiteReleases $
1df90 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a ::test_channel..
1dfa0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1dfb0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4e 6f 77 # NOTE: Now
1dfc0 2c 20 77 65 20 6e 65 65 64 20 74 6f 20 6b 6e 6f , we need to kno
1dfd0 77 20 69 66 20 74 68 65 20 53 51 4c 69 74 65 20 w if the SQLite
1dfe0 63 6f 72 65 20 6c 69 62 72 61 72 79 20 69 73 20 core library is
1dff0 61 76 61 69 6c 61 62 6c 65 0d 0a 20 20 20 20 20 available..
1e000 20 20 20 23 20 20 20 20 20 20 20 28 69 2e 65 2e # (i.e.
1e010 20 62 65 63 61 75 73 65 20 74 68 65 20 6d 61 6e because the man
1e020 61 67 65 64 2d 6f 6e 6c 79 20 53 79 73 74 65 6d aged-only System
1e030 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 61 73 73 .Data.SQLite ass
1e040 65 6d 62 6c 79 20 63 61 6e 0d 0a 20 20 20 20 20 embly can..
1e050 20 20 20 23 20 20 20 20 20 20 20 6c 6f 61 64 20 # load
1e060 77 69 74 68 6f 75 74 20 69 74 3b 20 68 6f 77 65 without it; howe
1e070 76 65 72 2c 20 69 74 20 63 61 6e 6e 6f 74 20 64 ver, it cannot d
1e080 6f 20 61 6e 79 74 68 69 6e 67 20 75 73 65 66 75 o anything usefu
1e090 6c 20 77 69 74 68 6f 75 74 0d 0a 20 20 20 20 20 l without..
1e0a0 20 20 20 23 20 20 20 20 20 20 20 69 74 29 2e 20 # it).
1e0b0 20 49 66 20 77 65 20 61 72 65 20 75 73 69 6e 67 If we are using
1e0c0 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 the mixed-mode
1e0d0 61 73 73 65 6d 62 6c 79 20 61 6e 64 20 77 65 20 assembly and we
1e0e0 61 6c 72 65 61 64 79 0d 0a 20 20 20 20 20 20 20 already..
1e0f0 20 23 20 20 20 20 20 20 20 66 6f 75 6e 64 20 69 # found i
1e100 74 20 28 61 62 6f 76 65 29 2c 20 74 68 69 73 20 t (above), this
1e110 73 68 6f 75 6c 64 20 61 6c 77 61 79 73 20 73 75 should always su
1e120 63 63 65 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 cceed...
1e130 23 0d 0a 20 20 20 20 20 20 20 20 63 68 65 63 6b #.. check
1e140 46 6f 72 53 51 4c 69 74 65 4c 69 62 72 61 72 79 ForSQLiteLibrary
1e150 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
1e160 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
1e170 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 # NOTE: C
1e180 68 65 63 6b 20 69 66 20 74 68 65 20 53 51 4c 69 heck if the SQLi
1e190 74 65 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d te interop assem
1e1a0 62 6c 79 20 69 73 20 61 76 61 69 6c 61 62 6c 65 bly is available
1e1b0 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
1e1c0 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 53 51 checkForSQ
1e1d0 4c 69 74 65 49 6e 74 65 72 6f 70 20 24 3a 3a 74 LiteInterop $::t
1e1e0 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 est_channel....
1e1f0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1e200 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 # NOTE: Check
1e210 74 68 65 20 53 51 4c 69 74 65 20 64 61 74 61 62 the SQLite datab
1e220 61 73 65 20 61 6e 64 20 74 65 6d 70 6f 72 61 72 ase and temporar
1e230 79 20 64 69 72 65 63 74 6f 72 69 65 73 2e 0d 0a y directories...
1e240 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1e250 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 checkForSQLit
1e260 65 44 69 72 65 63 74 6f 72 69 65 73 20 24 3a 3a eDirectories $::
1e270 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a test_channel....
1e280 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1e290 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d # NOTE: Attem
1e2a0 70 74 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 pt to determine
1e2b0 69 66 20 76 61 72 69 6f 75 73 20 63 6f 6d 70 69 if various compi
1e2c0 6c 65 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 73 20 le-time options
1e2d0 6e 65 65 64 65 64 20 66 6f 72 0d 0a 20 20 20 20 needed for..
1e2e0 20 20 20 20 23 20 20 20 20 20 20 20 74 65 73 74 # test
1e2f0 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 77 65 72 constraints wer
1e300 65 20 65 6e 61 62 6c 65 64 20 66 6f 72 20 74 68 e enabled for th
1e310 65 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 e managed assemb
1e320 6c 79 2e 20 20 54 68 65 72 65 0d 0a 20 20 20 20 ly. There..
1e330 20 20 20 20 23 20 20 20 20 20 20 20 61 72 65 20 # are
1e340 73 6f 6d 65 20 63 6f 6d 70 69 6c 65 2d 74 69 6d some compile-tim
1e350 65 20 6f 70 74 69 6f 6e 73 20 74 68 61 74 20 6d e options that m
1e360 75 73 74 20 61 6c 73 6f 20 68 61 76 65 20 62 65 ust also have be
1e370 65 6e 20 65 6e 61 62 6c 65 64 0d 0a 20 20 20 20 en enabled..
1e380 20 20 20 20 23 20 20 20 20 20 20 20 66 6f 72 20 # for
1e390 74 68 65 20 69 6e 74 65 72 6f 70 20 61 73 73 65 the interop asse
1e3a0 6d 62 6c 79 20 69 6e 20 6f 72 64 65 72 20 74 6f mbly in order to
1e3b0 20 62 65 20 65 66 66 65 63 74 69 76 65 2e 20 20 be effective.
1e3c0 46 6f 72 20 74 68 6f 73 65 0d 0a 20 20 20 20 20 For those..
1e3d0 20 20 20 23 20 20 20 20 20 20 20 6f 70 74 69 6f # optio
1e3e0 6e 73 2c 20 69 74 20 77 69 6c 6c 20 62 65 20 61 ns, it will be a
1e3f0 73 73 75 6d 65 64 20 74 68 61 74 20 69 74 20 77 ssumed that it w
1e400 61 73 20 65 6e 61 62 6c 65 64 20 66 6f 72 20 74 as enabled for t
1e410 68 65 20 69 6e 74 65 72 6f 70 0d 0a 20 20 20 20 he interop..
1e420 20 20 20 20 23 20 20 20 20 20 20 20 61 73 73 65 # asse
1e430 6d 62 6c 79 20 69 66 20 69 74 20 77 61 73 20 65 mbly if it was e
1e440 6e 61 62 6c 65 64 20 66 6f 72 20 74 68 65 20 6d nabled for the m
1e450 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 79 2e anaged assembly.
1e460 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1e470 20 20 20 20 20 66 6f 72 65 61 63 68 20 64 65 66 foreach def
1e480 69 6e 65 43 6f 6e 73 74 61 6e 74 20 5b 6c 69 73 ineConstant [lis
1e490 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 t \..
1e4a0 20 43 48 45 43 4b 5f 53 54 41 54 45 20 43 4f 55 CHECK_STATE COU
1e4b0 4e 54 5f 48 41 4e 44 4c 45 20 44 45 42 55 47 20 NT_HANDLE DEBUG
1e4c0 49 4e 54 45 52 4f 50 5f 43 4f 44 45 43 20 49 4e INTEROP_CODEC IN
1e4d0 54 45 52 4f 50 5f 44 45 42 55 47 20 5c 0d 0a 20 TEROP_DEBUG \..
1e4e0 20 20 20 20 20 20 20 20 20 20 20 49 4e 54 45 52 INTER
1e4f0 4f 50 5f 45 58 54 45 4e 53 49 4f 4e 5f 46 55 4e OP_EXTENSION_FUN
1e500 43 54 49 4f 4e 53 20 49 4e 54 45 52 4f 50 5f 49 CTIONS INTEROP_I
1e510 4e 43 4c 55 44 45 5f 43 45 52 4f 44 20 5c 0d 0a NCLUDE_CEROD \..
1e520 20 20 20 20 20 20 20 20 20 20 20 20 49 4e 54 45 INTE
1e530 52 4f 50 5f 49 4e 43 4c 55 44 45 5f 45 58 54 52 ROP_INCLUDE_EXTR
1e540 41 20 49 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 44 A INTEROP_INCLUD
1e550 45 5f 53 45 45 20 49 4e 54 45 52 4f 50 5f 49 4e E_SEE INTEROP_IN
1e560 43 4c 55 44 45 5f 5a 49 50 56 46 53 20 5c 0d 0a CLUDE_ZIPVFS \..
1e570 20 20 20 20 20 20 20 20 20 20 20 20 49 4e 54 45 INTE
1e580 52 4f 50 5f 4c 45 47 41 43 59 5f 43 4c 4f 53 45 ROP_LEGACY_CLOSE
1e590 20 49 4e 54 45 52 4f 50 5f 4c 4f 47 20 49 4e 54 INTEROP_LOG INT
1e5a0 45 52 4f 50 5f 54 45 53 54 5f 45 58 54 45 4e 53 EROP_TEST_EXTENS
1e5b0 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ION \..
1e5c0 20 20 20 49 4e 54 45 52 4f 50 5f 56 49 52 54 55 INTEROP_VIRTU
1e5d0 41 4c 5f 54 41 42 4c 45 20 4e 45 54 5f 32 30 20 AL_TABLE NET_20
1e5e0 4e 45 54 5f 33 35 20 4e 45 54 5f 34 30 20 4e 45 NET_35 NET_40 NE
1e5f0 54 5f 34 35 20 4e 45 54 5f 34 35 31 20 4e 45 54 T_45 NET_451 NET
1e600 5f 34 36 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 _46 \..
1e610 20 20 20 4e 45 54 5f 43 4f 4d 50 41 43 54 5f 32 NET_COMPACT_2
1e620 30 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 0 PLATFORM_COMPA
1e630 43 54 46 52 41 4d 45 57 4f 52 4b 20 50 52 45 4c CTFRAMEWORK PREL
1e640 4f 41 44 5f 4e 41 54 49 56 45 5f 4c 49 42 52 41 OAD_NATIVE_LIBRA
1e650 52 59 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 RY \..
1e660 20 20 52 45 54 41 52 47 45 54 41 42 4c 45 20 53 RETARGETABLE S
1e670 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 20 54 QLITE_STANDARD T
1e680 48 52 4f 57 5f 4f 4e 5f 44 49 53 50 4f 53 45 44 HROW_ON_DISPOSED
1e690 20 54 52 41 43 45 20 5c 0d 0a 20 20 20 20 20 20 TRACE \..
1e6a0 20 20 20 20 20 20 54 52 41 43 45 5f 43 4f 4e 4e TRACE_CONN
1e6b0 45 43 54 49 4f 4e 20 54 52 41 43 45 5f 44 45 54 ECTION TRACE_DET
1e6c0 45 43 54 49 4f 4e 20 54 52 41 43 45 5f 48 41 4e ECTION TRACE_HAN
1e6d0 44 4c 45 20 54 52 41 43 45 5f 50 52 45 4c 4f 41 DLE TRACE_PRELOA
1e6e0 44 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 D \..
1e6f0 20 54 52 41 43 45 5f 53 48 41 52 45 44 20 54 52 TRACE_SHARED TR
1e700 41 43 45 5f 53 54 41 54 45 4d 45 4e 54 20 54 52 ACE_STATEMENT TR
1e710 41 43 45 5f 57 41 52 4e 49 4e 47 20 54 52 41 43 ACE_WARNING TRAC
1e720 4b 5f 4d 45 4d 4f 52 59 5f 42 59 54 45 53 20 5c K_MEMORY_BYTES \
1e730 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 55 53 .. US
1e740 45 5f 45 4e 54 49 54 59 5f 46 52 41 4d 45 57 4f E_ENTITY_FRAMEWO
1e750 52 4b 5f 36 20 55 53 45 5f 49 4e 54 45 52 4f 50 RK_6 USE_INTEROP
1e760 5f 44 4c 4c 20 55 53 45 5f 50 52 45 50 41 52 45 _DLL USE_PREPARE
1e770 5f 56 32 20 57 49 4e 44 4f 57 53 5d 20 7b 0d 0a _V2 WINDOWS] {..
1e780 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
1e790 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 # NOTE: C
1e7a0 68 65 63 6b 20 69 66 20 74 68 65 20 63 6f 6d 70 heck if the comp
1e7b0 69 6c 65 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 20 ile-time option
1e7c0 69 73 20 6c 69 73 74 65 64 20 69 6e 20 74 68 65 is listed in the
1e7d0 20 6c 69 73 74 20 6f 66 0d 0a 20 20 20 20 20 20 list of..
1e7e0 20 20 20 20 23 20 20 20 20 20 20 20 22 64 65 66 # "def
1e7f0 69 6e 65 20 63 6f 6e 73 74 61 6e 74 73 22 20 6b ine constants" k
1e800 65 70 74 20 74 72 61 63 6b 20 6f 66 20 62 79 20 ept track of by
1e810 74 68 65 20 6d 61 6e 61 67 65 64 20 61 73 73 65 the managed asse
1e820 6d 62 6c 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 mbly...
1e830 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 #.. ch
1e840 65 63 6b 46 6f 72 53 51 4c 69 74 65 44 65 66 69 eckForSQLiteDefi
1e850 6e 65 43 6f 6e 73 74 61 6e 74 20 24 3a 3a 74 65 neConstant $::te
1e860 73 74 5f 63 68 61 6e 6e 65 6c 20 24 64 65 66 69 st_channel $defi
1e870 6e 65 43 6f 6e 73 74 61 6e 74 0d 0a 20 20 20 20 neConstant..
1e880 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
1e890 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
1e8a0 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 65 TE: Check if the
1e8b0 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
1e8c0 69 74 65 20 70 72 6f 76 69 64 65 72 20 77 61 73 ite provider was
1e8d0 20 63 6f 6d 70 69 6c 65 64 20 77 69 74 68 0d 0a compiled with..
1e8e0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1e8f0 73 75 70 70 6f 72 74 20 66 6f 72 20 61 6e 79 20 support for any
1e900 65 6e 63 72 79 70 74 65 64 20 64 61 74 61 62 61 encrypted databa
1e910 73 65 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ses... #.
1e920 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 68 61 . if {[ha
1e930 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5c 0d 0a veConstraint \..
1e940 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1e950 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 2e 53 defineConstant.S
1e960 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1e970 65 2e 49 4e 54 45 52 4f 50 5f 43 4f 44 45 43 5d e.INTEROP_CODEC]
1e980 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 || \..
1e990 20 20 20 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 [haveConstrai
1e9a0 6e 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 nt \..
1e9b0 20 20 20 20 20 20 64 65 66 69 6e 65 43 6f 6e 73 defineCons
1e9c0 74 61 6e 74 2e 53 79 73 74 65 6d 2e 44 61 74 61 tant.System.Data
1e9d0 2e 53 51 4c 69 74 65 2e 49 4e 54 45 52 4f 50 5f .SQLite.INTEROP_
1e9e0 49 4e 43 4c 55 44 45 5f 53 45 45 5d 7d 20 74 68 INCLUDE_SEE]} th
1e9f0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1ea00 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
1ea10 4f 54 45 3a 20 59 65 73 2c 20 61 64 64 20 67 65 OTE: Yes, add ge
1ea20 6e 65 72 69 63 20 63 6f 6e 73 74 72 61 69 6e 74 neric constraint
1ea30 20 66 6f 72 20 75 73 65 20 62 79 20 74 68 65 20 for use by the
1ea40 74 65 73 74 20 73 75 69 74 65 2e 0d 0a 20 20 20 test suite...
1ea50 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1ea60 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e addConstrain
1ea70 74 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 t System.Data.SQ
1ea80 4c 69 74 65 2e 45 6e 63 72 79 70 74 69 6f 6e 0d Lite.Encryption.
1ea90 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
1eaa0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1eab0 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 74 # NOTE: Check t
1eac0 68 65 20 63 75 72 72 65 6e 74 20 62 75 69 6c 64 he current build
1ead0 20 79 65 61 72 2e 20 20 42 61 73 69 63 61 6c 6c year. Basicall
1eae0 79 2c 20 74 68 69 73 20 69 6e 64 69 63 61 74 65 y, this indicate
1eaf0 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 s.. #
1eb00 20 20 20 77 68 69 63 68 20 76 65 72 73 69 6f 6e which version
1eb10 20 6f 66 20 4d 53 42 75 69 6c 64 20 61 6e 64 2f of MSBuild and/
1eb20 6f 72 20 56 69 73 75 61 6c 20 53 74 75 64 69 6f or Visual Studio
1eb30 20 77 61 73 20 75 73 65 64 20 74 6f 0d 0a 20 20 was used to..
1eb40 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
1eb50 6d 70 69 6c 65 20 74 68 65 20 61 73 73 65 6d 62 mpile the assemb
1eb60 6c 79 20 62 69 6e 61 72 69 65 73 20 75 6e 64 65 ly binaries unde
1eb70 72 20 74 65 73 74 2e 0d 0a 20 20 20 20 20 20 20 r test...
1eb80 20 23 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 #.. tput
1eb90 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
1eba0 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 l \..
1ebb0 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 "---- checking
1ebc0 66 6f 72 20 53 79 73 74 65 6d 2e 44 61 74 61 2e for System.Data.
1ebd0 53 51 4c 69 74 65 20 62 75 69 6c 64 20 79 65 61 SQLite build yea
1ebe0 72 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 r... "....
1ebf0 20 20 73 65 74 20 79 65 61 72 20 5b 67 65 74 42 set year [getB
1ec00 75 69 6c 64 59 65 61 72 5d 0d 0a 20 20 20 20 20 uildYear]..
1ec10 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 addConstraint
1ec20 20 5b 61 70 70 65 6e 64 41 72 67 73 20 62 75 69 [appendArgs bui
1ec30 6c 64 59 65 61 72 2e 20 24 79 65 61 72 5d 0d 0a ldYear. $year]..
1ec40 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
1ec50 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
1ec60 70 70 65 6e 64 41 72 67 73 20 5c 22 20 24 79 65 ppendArgs \" $ye
1ec70 61 72 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 ar \"\n]....
1ec80 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
1ec90 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 65 NOTE: Check the
1eca0 20 63 75 72 72 65 6e 74 20 62 75 69 6c 64 20 2e current build .
1ecb0 4e 45 54 20 46 72 61 6d 65 77 6f 72 6b 2e 20 20 NET Framework.
1ecc0 42 61 73 69 63 61 6c 6c 79 2c 20 74 68 69 73 0d Basically, this.
1ecd0 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
1ece0 20 69 6e 64 69 63 61 74 65 73 20 77 68 69 63 68 indicates which
1ecf0 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 version of the
1ed00 2e 4e 45 54 20 46 72 61 6d 65 77 6f 72 6b 20 69 .NET Framework i
1ed10 73 20 62 65 69 6e 67 0d 0a 20 20 20 20 20 20 20 s being..
1ed20 20 23 20 20 20 20 20 20 20 75 73 65 64 20 62 79 # used by
1ed30 20 74 68 65 20 61 73 73 65 6d 62 6c 79 20 62 69 the assembly bi
1ed40 6e 61 72 69 65 73 20 75 6e 64 65 72 20 74 65 73 naries under tes
1ed50 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 t... #..
1ed60 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
1ed70 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a test_channel \..
1ed80 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
1ed90 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 - checking for S
1eda0 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1edb0 65 20 62 75 69 6c 64 20 2e 4e 45 54 20 46 72 61 e build .NET Fra
1edc0 6d 65 77 6f 72 6b 2e 2e 2e 20 22 0d 0a 0d 0a 20 mework... "....
1edd0 20 20 20 20 20 20 20 73 65 74 20 6e 65 74 46 78 set netFx
1ede0 20 5b 67 65 74 42 75 69 6c 64 4e 65 74 46 78 5d [getBuildNetFx]
1edf0 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e .. addCon
1ee00 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
1ee10 72 67 73 20 62 75 69 6c 64 46 72 61 6d 65 77 6f rgs buildFramewo
1ee20 72 6b 2e 20 24 6e 65 74 46 78 5d 0d 0a 20 20 20 rk. $netFx]..
1ee30 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1ee40 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
1ee50 6e 64 41 72 67 73 20 5c 22 20 24 6e 65 74 46 78 ndArgs \" $netFx
1ee60 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 \"\n]....
1ee70 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
1ee80 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 65 20 63 OTE: Check the c
1ee90 75 72 72 65 6e 74 20 62 75 69 6c 64 20 63 6f 6e urrent build con
1eea0 66 69 67 75 72 61 74 69 6f 6e 2e 20 20 54 68 69 figuration. Thi
1eeb0 73 20 73 68 6f 75 6c 64 20 6e 6f 72 6d 61 6c 6c s should normall
1eec0 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 y.. #
1eed0 20 20 20 62 65 20 65 69 74 68 65 72 20 22 44 65 be either "De
1eee0 62 75 67 22 20 6f 72 20 22 52 65 6c 65 61 73 65 bug" or "Release
1eef0 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 "... #..
1ef00 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
1ef10 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a test_channel \..
1ef20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
1ef30 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 - checking for S
1ef40 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1ef50 65 20 62 75 69 6c 64 20 63 6f 6e 66 69 67 75 72 e build configur
1ef60 61 74 69 6f 6e 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 ation... "....
1ef70 20 20 20 20 20 20 73 65 74 20 63 6f 6e 66 69 67 set config
1ef80 75 72 61 74 69 6f 6e 20 5b 67 65 74 42 75 69 6c uration [getBuil
1ef90 64 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5d 0d dConfiguration].
1efa0 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 . addCons
1efb0 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
1efc0 67 73 20 62 75 69 6c 64 43 6f 6e 66 69 67 75 72 gs buildConfigur
1efd0 61 74 69 6f 6e 2e 20 24 63 6f 6e 66 69 67 75 72 ation. $configur
1efe0 61 74 69 6f 6e 5d 0d 0a 20 20 20 20 20 20 20 20 ation]..
1eff0 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
1f000 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
1f010 73 20 5c 22 20 24 63 6f 6e 66 69 67 75 72 61 74 s \" $configurat
1f020 69 6f 6e 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 ion \"\n]....
1f030 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1f040 23 20 4e 4f 54 45 3a 20 54 72 79 20 74 6f 20 73 # NOTE: Try to s
1f050 65 74 75 70 20 61 6e 20 69 6e 74 65 72 72 75 70 etup an interrup
1f060 74 20 63 61 6c 6c 62 61 63 6b 20 75 73 69 6e 67 t callback using
1f070 20 74 68 65 20 73 63 72 69 70 74 20 64 65 62 75 the script debu
1f080 67 67 65 72 0d 0a 20 20 20 20 20 20 20 20 23 20 gger.. #
1f090 20 20 20 20 20 20 74 68 61 74 20 77 69 6c 6c 20 that will
1f0a0 63 61 6e 63 65 6c 20 61 6c 6c 20 53 51 4c 20 71 cancel all SQL q
1f0b0 75 65 72 69 65 73 20 69 6e 20 70 72 6f 67 72 65 ueries in progre
1f0c0 73 73 20 66 6f 72 20 61 6c 6c 20 64 61 74 61 62 ss for all datab
1f0d0 61 73 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ase.. #
1f0e0 20 20 20 20 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 connections
1f0f0 20 6b 6e 6f 77 6e 20 74 6f 20 74 68 69 73 20 69 known to this i
1f100 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 nterpreter...
1f110 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1f120 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
1f130 73 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 49 6e 74 s ::no(sqliteInt
1f140 65 72 72 75 70 74 43 61 6c 6c 62 61 63 6b 29 5d erruptCallback)]
1f150 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1f160 20 20 20 20 73 65 74 75 70 44 62 49 6e 74 65 72 setupDbInter
1f170 72 75 70 74 43 61 6c 6c 62 61 63 6b 20 24 3a 3a ruptCallback $::
1f180 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 3a 3a test_channel $::
1f190 74 65 73 74 5f 6c 6f 67 0d 0a 20 20 20 20 20 20 test_log..
1f1a0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 }.... #
1f1b0 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
1f1c0 3a 20 43 68 65 63 6b 20 66 6f 72 20 74 68 65 20 : Check for the
1f1d0 6e 61 74 69 76 65 20 72 75 6e 74 69 6d 65 20 6f native runtime o
1f1e0 70 74 69 6f 6e 2c 20 77 68 69 63 68 20 77 6f 75 ption, which wou
1f1f0 6c 64 20 6d 65 61 6e 20 77 65 20 61 72 65 0d 0a ld mean we are..
1f200 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1f210 75 73 69 6e 67 20 74 68 65 20 6d 69 78 65 64 2d using the mixed-
1f220 6d 6f 64 65 20 61 73 73 65 6d 62 6c 79 2e 0d 0a mode assembly...
1f230 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1f240 20 20 20 63 68 65 63 6b 46 6f 72 52 75 6e 74 69 checkForRunti
1f250 6d 65 4f 70 74 69 6f 6e 20 24 3a 3a 74 65 73 74 meOption $::test
1f260 5f 63 68 61 6e 6e 65 6c 20 6e 61 74 69 76 65 0d _channel native.
1f270 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
1f280 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 # NOTE: Ch
1f290 65 63 6b 20 69 66 20 74 68 65 20 74 65 73 74 20 eck if the test
1f2a0 73 75 69 74 65 20 73 68 6f 75 6c 64 20 63 6f 75 suite should cou
1f2b0 6e 74 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 nt the number of
1f2c0 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 0d 0a 20 20 connections..
1f2d0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 22 6f # "o
1f2e0 70 65 6e 65 64 22 20 61 6e 64 20 22 63 6c 6f 73 pened" and "clos
1f2f0 65 64 22 20 66 72 6f 6d 20 74 68 65 20 70 6f 6f ed" from the poo
1f300 6c 20 77 68 65 6e 20 64 65 74 65 72 6d 69 6e 69 l when determini
1f310 6e 67 20 69 66 20 61 20 74 65 73 74 0d 0a 20 20 ng if a test..
1f320 20 20 20 20 20 20 23 20 20 20 20 20 20 20 70 61 # pa
1f330 73 73 65 64 2e 20 20 44 69 73 61 62 6c 69 6e 67 ssed. Disabling
1f340 20 74 68 69 73 20 62 65 68 61 76 69 6f 72 20 69 this behavior i
1f350 73 20 73 6f 6d 65 74 69 6d 65 73 20 6e 65 63 65 s sometimes nece
1f360 73 73 61 72 79 20 28 65 2e 67 2e 0d 0a 20 20 20 ssary (e.g...
1f370 20 20 20 20 20 23 20 20 20 20 20 20 20 64 75 72 # dur
1f380 69 6e 67 20 74 68 65 20 72 65 6c 65 61 73 65 20 ing the release
1f390 74 65 73 74 69 6e 67 20 70 72 6f 63 65 73 73 29 testing process)
1f3a0 20 62 65 63 61 75 73 65 20 74 68 65 72 65 20 61 because there a
1f3b0 72 65 20 73 65 76 65 72 61 6c 0d 0a 20 20 20 20 re several..
1f3c0 20 20 20 20 23 20 20 20 20 20 20 20 74 65 73 74 # test
1f3d0 73 20 74 68 61 74 20 72 65 6c 79 20 6f 6e 20 74 s that rely on t
1f3e0 68 65 20 22 6f 70 65 6e 65 64 20 66 72 6f 6d 20 he "opened from
1f3f0 70 6f 6f 6c 22 20 63 6f 75 6e 74 20 62 65 69 6e pool" count bein
1f400 67 20 67 72 65 61 74 65 72 0d 0a 20 20 20 20 20 g greater..
1f410 20 20 20 23 20 20 20 20 20 20 20 74 68 61 6e 20 # than
1f420 7a 65 72 6f 2e 20 20 54 68 65 73 65 20 74 65 73 zero. These tes
1f430 74 73 20 6d 61 79 20 66 61 69 6c 20 64 75 65 20 ts may fail due
1f440 74 6f 20 74 68 65 20 6e 6f 6e 2d 64 65 74 65 72 to the non-deter
1f450 6d 69 6e 69 73 74 69 63 0d 0a 20 20 20 20 20 20 ministic..
1f460 20 20 23 20 20 20 20 20 20 20 62 65 68 61 76 69 # behavi
1f470 6f 72 20 6f 66 20 74 68 65 20 43 4c 52 20 47 43 or of the CLR GC
1f480 2c 20 65 76 65 6e 20 77 68 65 6e 20 74 68 65 72 , even when ther
1f490 65 20 69 73 20 6e 6f 20 62 75 67 20 69 6e 20 74 e is no bug in t
1f4a0 68 65 20 63 6f 64 65 0d 0a 20 20 20 20 20 20 20 he code..
1f4b0 20 23 20 20 20 20 20 20 20 62 65 69 6e 67 20 74 # being t
1f4c0 65 73 74 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 ested...
1f4d0 23 0d 0a 20 20 20 20 20 20 20 20 63 68 65 63 6b #.. check
1f4e0 46 6f 72 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e ForRuntimeOption
1f4f0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
1f500 20 6e 6f 50 6f 6f 6c 43 6f 75 6e 74 73 0d 0a 0d noPoolCounts...
1f510 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1f520 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 # NOTE: Chec
1f530 6b 20 69 66 20 74 68 65 20 74 65 73 74 20 73 75 k if the test su
1f540 69 74 65 20 73 68 6f 75 6c 64 20 75 73 65 20 73 ite should use s
1f550 68 61 72 65 64 2d 63 61 63 68 65 20 6d 6f 64 65 hared-cache mode
1f560 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
1f570 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 52 75 checkForRu
1f580 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 24 3a 3a 74 ntimeOption $::t
1f590 65 73 74 5f 63 68 61 6e 6e 65 6c 20 73 68 61 72 est_channel shar
1f5a0 65 64 43 61 63 68 65 0d 0a 0d 0a 20 20 20 20 20 edCache....
1f5b0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
1f5c0 4e 4f 54 45 3a 20 52 65 70 6f 72 74 20 74 68 65 NOTE: Report the
1f5d0 20 72 65 73 6f 75 72 63 65 20 75 73 61 67 65 20 resource usage
1f5e0 70 72 69 6f 72 20 74 6f 20 72 75 6e 6e 69 6e 67 prior to running
1f5f0 20 61 6e 79 20 74 65 73 74 73 2e 0d 0a 20 20 20 any tests...
1f600 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1f610 72 65 70 6f 72 74 53 51 4c 69 74 65 52 65 73 6f reportSQLiteReso
1f620 75 72 63 65 73 20 24 3a 3a 74 65 73 74 5f 63 68 urces $::test_ch
1f630 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 annel....
1f640 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
1f650 54 45 3a 20 47 72 61 62 20 74 68 65 20 6c 69 73 TE: Grab the lis
1f660 74 20 6f 66 20 6e 61 74 69 76 65 20 6d 6f 64 75 t of native modu
1f670 6c 65 73 20 66 6f 72 20 74 68 65 20 63 75 72 72 les for the curr
1f680 65 6e 74 20 70 72 6f 63 65 73 73 20 61 6e 64 0d ent process and.
1f690 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
1f6a0 20 72 65 70 6f 72 74 20 6f 6e 20 74 68 65 20 53 report on the S
1f6b0 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1f6c0 65 20 72 65 6c 61 74 65 64 20 6f 6e 65 73 2e 0d e related ones..
1f6d0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1f6e0 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c if {[haveSQL
1f6f0 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 iteObjectCommand
1f700 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1f710 20 20 20 20 20 73 65 74 20 6d 6f 64 75 6c 65 73 set modules
1f720 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 [object invoke
1f730 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1f740 20 53 79 73 74 65 6d 2e 44 69 61 67 6e 6f 73 74 System.Diagnost
1f750 69 63 73 2e 50 72 6f 63 65 73 73 2e 47 65 74 43 ics.Process.GetC
1f760 75 72 72 65 6e 74 50 72 6f 63 65 73 73 20 4d 6f urrentProcess Mo
1f770 64 75 6c 65 73 5d 0d 0a 0d 0a 20 20 20 20 20 20 dules]....
1f780 20 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 61 object forea
1f790 63 68 20 2d 61 6c 69 61 73 20 6d 6f 64 75 6c 65 ch -alias module
1f7a0 20 24 6d 6f 64 75 6c 65 73 20 7b 0d 0a 20 20 20 $modules {..
1f7b0 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
1f7c0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1f7d0 54 68 65 20 6d 6f 64 75 6c 65 20 66 69 6c 65 20 The module file
1f7e0 6e 61 6d 65 20 68 65 72 65 20 6d 75 73 74 20 62 name here must b
1f7f0 65 20 6e 6f 72 6d 61 6c 69 7a 65 64 2e 0d 0a 20 e normalized...
1f800 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
1f810 20 20 20 20 20 20 20 20 20 20 73 65 74 20 66 69 set fi
1f820 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6e 6f 72 leName [file nor
1f830 6d 61 6c 69 7a 65 20 5b 24 6d 6f 64 75 6c 65 20 malize [$module
1f840 46 69 6c 65 4e 61 6d 65 5d 5d 0d 0a 0d 0a 20 20 FileName]]....
1f850 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 if {[s
1f860 74 72 69 6e 67 20 6d 61 74 63 68 20 2d 6e 6f 63 tring match -noc
1f870 61 73 65 20 2a 2f 73 71 6c 69 74 65 33 2e 64 6c ase */sqlite3.dl
1f880 6c 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 l $fileName]} th
1f890 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1f8a0 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
1f8b0 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
1f8c0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
1f8d0 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
1f8e0 20 66 6f 75 6e 64 20 6c 6f 61 64 65 64 20 53 51 found loaded SQ
1f8f0 4c 69 74 65 20 6e 61 74 69 76 65 20 6c 69 62 72 Lite native libr
1f900 61 72 79 20 6d 6f 64 75 6c 65 3a 20 22 20 5c 0d ary module: " \.
1f910 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1f920 20 20 20 24 66 69 6c 65 4e 61 6d 65 20 5c 6e 5d $fileName \n]
1f930 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 .. }
1f940 65 6c 73 65 69 66 20 7b 5b 73 74 72 69 6e 67 20 elseif {[string
1f950 6d 61 74 63 68 20 5c 0d 0a 20 20 20 20 20 20 20 match \..
1f960 20 20 20 20 20 20 20 20 20 2d 6e 6f 63 61 73 65 -nocase
1f970 20 2a 2f 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f */SQLite.Intero
1f980 70 2e 64 6c 6c 20 24 66 69 6c 65 4e 61 6d 65 5d p.dll $fileName]
1f990 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1f9a0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
1f9b0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
1f9c0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
1f9d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1f9e0 2d 2d 2d 2d 20 66 6f 75 6e 64 20 6c 6f 61 64 65 ---- found loade
1f9f0 64 20 53 51 4c 69 74 65 20 69 6e 74 65 72 6f 70 d SQLite interop
1fa00 20 61 73 73 65 6d 62 6c 79 20 6d 6f 64 75 6c 65 assembly module
1fa10 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 : " \..
1fa20 20 20 20 20 20 20 20 20 20 24 66 69 6c 65 4e 61 $fileNa
1fa30 6d 65 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 me \n]..
1fa40 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
1fa50 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
1fa60 0a 20 20 20 20 20 20 20 20 63 61 74 63 68 20 7b . catch {
1fa70 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
1fa80 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
1fa90 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 l \..
1faa0 20 20 20 22 2d 2d 2d 2d 20 63 6f 6d 70 69 6c 65 "---- compile
1fab0 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 73 20 66 6f -time options fo
1fac0 72 20 53 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 r SQLite core li
1fad0 62 72 61 72 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 brary... "....
1fae0 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
1faf0 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
1fb00 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
1fb10 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
1fb20 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
1fb30 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
1fb40 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 .SQLite.SQLite3
1fb50 53 51 4c 69 74 65 43 6f 6d 70 69 6c 65 4f 70 74 SQLiteCompileOpt
1fb60 69 6f 6e 73 0d 0a 20 20 20 20 20 20 20 20 20 20 ions..
1fb70 7d 20 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 } compileOptions
1fb80 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
1fb90 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1fba0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
1fbb0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 66 l [appendArgs [f
1fbc0 6f 72 6d 61 74 4c 69 73 74 20 5b 6c 73 6f 72 74 ormatList [lsort
1fbd0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1fbe0 20 20 20 20 24 63 6f 6d 70 69 6c 65 4f 70 74 69 $compileOpti
1fbf0 6f 6e 73 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d ons] <none>] \n]
1fc00 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c .. } el
1fc10 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
1fc20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1fc30 63 68 61 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c channel unknown\
1fc40 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a n.. }..
1fc50 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
1fc60 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 catch {..
1fc70 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
1fc80 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d :test_channel \.
1fc90 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
1fca0 2d 2d 2d 2d 20 63 6f 6d 70 69 6c 65 2d 74 69 6d ---- compile-tim
1fcb0 65 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 53 51 e options for SQ
1fcc0 4c 69 74 65 20 69 6e 74 65 72 6f 70 20 61 73 73 Lite interop ass
1fcd0 65 6d 62 6c 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 embly... "....
1fce0 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
1fcf0 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
1fd00 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
1fd10 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
1fd20 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
1fd30 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
1fd40 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 .SQLite.SQLite3
1fd50 49 6e 74 65 72 6f 70 43 6f 6d 70 69 6c 65 4f 70 InteropCompileOp
1fd60 74 69 6f 6e 73 0d 0a 20 20 20 20 20 20 20 20 20 tions..
1fd70 20 7d 20 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e } compileOption
1fd80 73 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d s] == 0} then {.
1fd90 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
1fda0 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
1fdb0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5b el [appendArgs [
1fdc0 66 6f 72 6d 61 74 4c 69 73 74 20 5b 6c 73 6f 72 formatList [lsor
1fdd0 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 t \..
1fde0 20 20 20 20 20 24 63 6f 6d 70 69 6c 65 4f 70 74 $compileOpt
1fdf0 69 6f 6e 73 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e ions] <none>] \n
1fe00 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 ].. } e
1fe10 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
1fe20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
1fe30 5f 63 68 61 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e _channel unknown
1fe40 5c 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d \n.. }.
1fe50 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
1fe60 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1fe70 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 74 68 # NOTE: Show th
1fe80 65 20 61 63 74 69 76 65 20 74 65 73 74 20 63 6f e active test co
1fe90 6e 73 74 72 61 69 6e 74 73 2e 0d 0a 20 20 20 20 nstraints...
1fea0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 #.. t
1feb0 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
1fec0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1fed0 20 22 2d 2d 2d 2d 20 63 6f 6e 73 74 72 61 69 6e "---- constrain
1fee0 74 73 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 ts: " \..
1fef0 20 20 20 20 20 5b 66 6f 72 6d 61 74 4c 69 73 74 [formatList
1ff00 20 5b 6c 73 6f 72 74 20 5b 67 65 74 43 6f 6e 73 [lsort [getCons
1ff10 74 72 61 69 6e 74 73 5d 5d 20 3c 6e 6f 6e 65 3e traints]] <none>
1ff20 5d 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 ] \n]....
1ff30 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
1ff40 54 45 3a 20 53 61 76 65 20 74 68 65 20 74 65 73 TE: Save the tes
1ff50 74 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 66 6f t constraints fo
1ff60 72 20 75 73 65 20 62 79 20 74 68 72 65 61 64 73 r use by threads
1ff70 20 63 72 65 61 74 65 64 20 69 6e 20 74 68 69 73 created in this
1ff80 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
1ff90 20 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 64 6f application do
1ffa0 6d 61 69 6e 2e 20 20 54 68 69 73 20 69 73 20 6e main. This is n
1ffb0 65 63 65 73 73 61 72 79 20 62 65 63 61 75 73 65 ecessary because
1ffc0 20 61 6c 6c 20 74 68 65 20 45 61 67 6c 65 0d 0a all the Eagle..
1ffd0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1ffe0 22 74 65 73 74 20 63 6f 6e 74 65 78 74 22 20 69 "test context" i
1fff0 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 70 65 nformation is pe
20000 72 2d 74 68 72 65 61 64 2e 0d 0a 20 20 20 20 20 r-thread...
20010 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 #.. if
20020 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
20030 3a 3a 74 65 73 74 5f 63 6f 6e 73 74 72 61 69 6e ::test_constrain
20040 74 73 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ts]} then {..
20050 20 20 20 20 20 20 20 73 65 74 20 3a 3a 74 65 73 set ::tes
20060 74 5f 63 6f 6e 73 74 72 61 69 6e 74 73 20 24 3a t_constraints $:
20070 3a 65 61 67 6c 65 5f 74 65 73 74 73 28 63 6f 6e :eagle_tests(con
20080 73 74 72 61 69 6e 74 73 29 0d 0a 20 20 20 20 20 straints)..
20090 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
200a0 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
200b0 45 3a 20 4c 6f 61 64 20 74 68 65 20 22 61 66 74 E: Load the "aft
200c0 65 72 2d 63 6f 6e 73 74 72 61 69 6e 74 73 22 20 er-constraints"
200d0 63 75 73 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 custom per-user
200e0 61 6e 64 2f 6f 72 20 70 65 72 2d 68 6f 73 74 0d and/or per-host.
200f0 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
20100 20 74 65 73 74 20 73 65 74 74 69 6e 67 73 20 6e test settings n
20110 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ow... #..
20120 20 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 uplevel
20130 31 20 5b 6c 69 73 74 20 6c 6f 61 64 53 51 4c 69 1 [list loadSQLi
20140 74 65 54 65 73 74 53 65 74 74 69 6e 67 73 20 24 teTestSettings $
20150 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 2e ::test_channel .
20160 61 66 74 65 72 5d 0d 0a 0d 0a 20 20 20 20 20 20 after]....
20170 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
20180 4f 54 45 3a 20 49 66 20 6e 65 63 65 73 73 61 72 OTE: If necessar
20190 79 2c 20 65 6e 61 62 6c 65 20 73 68 61 72 65 64 y, enable shared
201a0 2d 63 61 63 68 65 20 6d 6f 64 65 20 6e 6f 77 2e -cache mode now.
201b0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
201c0 20 20 20 20 20 69 66 20 7b 5b 68 61 73 52 75 6e if {[hasRun
201d0 74 69 6d 65 4f 70 74 69 6f 6e 20 73 68 61 72 65 timeOption share
201e0 64 43 61 63 68 65 5d 7d 20 74 68 65 6e 20 7b 0d dCache]} then {.
201f0 0a 20 20 20 20 20 20 20 20 20 20 65 6e 61 62 6c . enabl
20200 65 53 68 61 72 65 64 43 61 63 68 65 20 24 3a 3a eSharedCache $::
20210 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 74 72 75 test_channel tru
20220 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a e.. }....
20230 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
20240 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 # NOTE: Show
20250 77 68 65 6e 20 6f 75 72 20 74 65 73 74 73 20 61 when our tests a
20260 63 74 75 61 6c 6c 79 20 62 65 67 61 6e 20 28 6e ctually began (n
20270 6f 77 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ow)... #.
20280 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
20290 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
202a0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
202b0 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
202c0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
202d0 74 65 20 74 65 73 74 73 20 62 65 67 61 6e 20 61 te tests began a
202e0 74 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 t " \..
202f0 20 20 20 5b 63 6c 6f 63 6b 20 66 6f 72 6d 61 74 [clock format
20300 20 5b 63 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d [clock seconds]
20310 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a ] \n].. }..
20320 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
20330 6f 63 20 72 75 6e 53 51 4c 69 74 65 54 65 73 74 oc runSQLiteTest
20340 46 69 6c 65 73 50 72 6f 6c 6f 67 75 65 20 7b 7d FilesPrologue {}
20350 20 7b 0d 0a 20 20 20 20 20 20 75 70 6c 65 76 65 {.. upleve
20360 6c 20 31 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 l 1 {.. #
20370 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
20380 3a 20 53 65 74 75 70 20 74 68 65 20 76 61 72 69 : Setup the vari
20390 61 62 6c 65 73 20 74 68 61 74 20 72 65 66 65 72 ables that refer
203a0 20 74 6f 20 74 68 65 20 76 61 72 69 6f 75 73 20 to the various
203b0 6e 6f 6e 2d 64 61 74 61 20 66 69 6c 65 73 0d 0a non-data files..
203c0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
203d0 72 65 71 75 69 72 65 64 20 62 79 20 74 68 65 20 required by the
203e0 74 65 73 74 73 20 69 6e 20 74 68 69 73 20 66 69 tests in this fi
203f0 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a le... #..
20400 20 20 20 20 20 20 20 20 73 65 74 20 65 6e 74 69 set enti
20410 74 79 46 72 61 6d 65 77 6f 72 6b 44 6c 6c 46 69 tyFrameworkDllFi
20420 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 le \..
20430 20 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e [getBuildFileN
20440 61 6d 65 20 45 6e 74 69 74 79 46 72 61 6d 65 77 ame EntityFramew
20450 6f 72 6b 2e 64 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 ork.dll]....
20460 20 20 20 20 73 65 74 20 69 6e 73 74 61 6c 6c 65 set installe
20470 72 45 78 65 46 69 6c 65 20 5b 67 65 74 42 75 69 rExeFile [getBui
20480 6c 64 46 69 6c 65 4e 61 6d 65 20 49 6e 73 74 61 ldFileName Insta
20490 6c 6c 65 72 2e 65 78 65 5d 0d 0a 20 20 20 20 20 ller.exe]..
204a0 20 20 20 73 65 74 20 73 71 6c 69 74 65 44 65 73 set sqliteDes
204b0 69 67 6e 65 72 44 6c 6c 46 69 6c 65 20 5b 67 65 ignerDllFile [ge
204c0 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 53 tBuildFileName S
204d0 51 4c 69 74 65 2e 44 65 73 69 67 6e 65 72 2e 64 QLite.Designer.d
204e0 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 ll].... s
204f0 65 74 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c et systemDataSQL
20500 69 74 65 44 6c 6c 46 69 6c 65 20 5c 0d 0a 20 20 iteDllFile \..
20510 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 75 [getBu
20520 69 6c 64 46 69 6c 65 4e 61 6d 65 20 53 79 73 74 ildFileName Syst
20530 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 em.Data.SQLite.d
20540 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 ll].... s
20550 65 74 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c et systemDataSQL
20560 69 74 65 4c 69 6e 71 44 6c 6c 46 69 6c 65 20 5c iteLinqDllFile \
20570 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 .. [g
20580 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 etBuildFileName
20590 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
205a0 74 65 2e 4c 69 6e 71 2e 64 6c 6c 5d 0d 0a 0d 0a te.Linq.dll]....
205b0 20 20 20 20 20 20 20 20 73 65 74 20 73 79 73 74 set syst
205c0 65 6d 44 61 74 61 53 51 4c 69 74 65 45 66 36 44 emDataSQLiteEf6D
205d0 6c 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 llFile \..
205e0 20 20 20 20 20 20 5b 67 65 74 42 75 69 6c 64 46 [getBuildF
205f0 69 6c 65 4e 61 6d 65 20 53 79 73 74 65 6d 2e 44 ileName System.D
20600 61 74 61 2e 53 51 4c 69 74 65 2e 45 46 36 2e 64 ata.SQLite.EF6.d
20610 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 ll].... s
20620 65 74 20 74 65 73 74 45 78 65 46 69 6c 65 20 5b et testExeFile [
20630 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 getBuildFileName
20640 20 74 65 73 74 2e 65 78 65 5d 0d 0a 20 20 20 20 test.exe]..
20650 20 20 20 20 73 65 74 20 74 65 73 74 4c 69 6e 71 set testLinq
20660 45 78 65 46 69 6c 65 20 5b 67 65 74 42 75 69 6c ExeFile [getBuil
20670 64 46 69 6c 65 4e 61 6d 65 20 74 65 73 74 6c 69 dFileName testli
20680 6e 71 2e 65 78 65 5d 0d 0a 20 20 20 20 20 20 20 nq.exe]..
20690 20 73 65 74 20 74 65 73 74 45 66 36 45 78 65 46 set testEf6ExeF
206a0 69 6c 65 20 5b 67 65 74 42 75 69 6c 64 46 69 6c ile [getBuildFil
206b0 65 4e 61 6d 65 20 74 65 73 74 65 66 36 2e 65 78 eName testef6.ex
206c0 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d e].... #.
206d0 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
206e0 20 53 65 74 75 70 20 74 68 65 20 76 61 72 69 61 Setup the varia
206f0 62 6c 65 73 20 74 68 61 74 20 72 65 66 65 72 20 bles that refer
20700 74 6f 20 74 68 65 20 76 61 72 69 6f 75 73 20 64 to the various d
20710 61 74 61 20 66 69 6c 65 73 0d 0a 20 20 20 20 20 ata files..
20720 20 20 20 23 20 20 20 20 20 20 20 72 65 71 75 69 # requi
20730 72 65 64 20 62 79 20 74 68 65 20 74 65 73 74 73 red by the tests
20740 20 69 6e 20 74 68 69 73 20 66 69 6c 65 2e 0d 0a in this file...
20750 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
20760 20 20 20 73 65 74 20 74 65 73 74 4c 69 6e 71 4f set testLinqO
20770 75 74 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 utFile [file nat
20780 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f ivename [file jo
20790 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 in \..
207a0 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 [getSQLiteTest
207b0 44 61 74 61 50 61 74 68 5d 20 74 65 73 74 6c 69 DataPath] testli
207c0 6e 71 2e 6f 75 74 5d 5d 0d 0a 0d 0a 20 20 20 20 nq.out]]....
207d0 20 20 20 20 73 65 74 20 6e 6f 72 74 68 77 69 6e set northwin
207e0 64 45 66 44 62 46 69 6c 65 20 5b 66 69 6c 65 20 dEfDbFile [file
207f0 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 nativename [file
20800 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 join \..
20810 20 20 20 20 20 5b 66 69 6c 65 20 64 69 72 6e 61 [file dirna
20820 6d 65 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 me [file dirname
20830 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 [getSQLiteTestD
20840 61 74 61 50 61 74 68 5d 5d 5d 20 5c 0d 0a 20 20 ataPath]]] \..
20850 20 20 20 20 20 20 20 20 20 20 74 65 73 74 6c 69 testli
20860 6e 71 20 6e 6f 72 74 68 77 69 6e 64 45 46 2e 64 nq northwindEF.d
20870 62 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 b]].... s
20880 65 74 20 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 20 et nonWalDbFile
20890 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
208a0 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 [file join \..
208b0 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 [getS
208c0 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 74 QLiteTestDataPat
208d0 68 5d 20 6e 6f 6e 57 61 6c 2e 64 62 5d 5d 0d 0a h] nonWal.db]]..
208e0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 77 61 .. set wa
208f0 6c 44 62 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 lDbFile [file na
20900 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a tivename [file j
20910 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 oin \..
20920 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 [getSQLiteTes
20930 74 44 61 74 61 50 61 74 68 5d 20 77 61 6c 2e 64 tDataPath] wal.d
20940 62 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 b]].... #
20950 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
20960 3a 20 54 68 65 20 76 61 72 69 6f 75 73 20 69 6e : The various in
20970 73 74 61 6c 6c 2f 75 6e 69 6e 73 74 61 6c 6c 20 stall/uninstall
20980 6c 6f 67 20 66 69 6c 65 73 20 75 73 65 64 20 74 log files used t
20990 6f 20 74 65 73 74 20 74 68 65 0d 0a 20 20 20 20 o test the..
209a0 20 20 20 20 23 20 20 20 20 20 20 20 64 65 73 69 # desi
209b0 67 6e 2d 74 69 6d 65 20 63 6f 6d 70 6f 6e 65 6e gn-time componen
209c0 74 20 69 6e 73 74 61 6c 6c 65 72 2e 0d 0a 20 20 t installer...
209d0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
209e0 20 73 65 74 20 74 65 73 74 49 6e 73 74 61 6c 6c set testInstall
209f0 56 73 32 30 30 35 4c 6f 67 46 69 6c 65 20 5b 66 Vs2005LogFile [f
20a00 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b ile nativename [
20a10 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 file join \..
20a20 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c [getSQL
20a30 69 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d iteTestDataPath]
20a40 20 49 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f Installer_Test_
20a50 56 73 32 30 30 35 2e 6c 6f 67 5d 5d 0d 0a 0d 0a Vs2005.log]]....
20a60 20 20 20 20 20 20 20 20 73 65 74 20 74 65 73 74 set test
20a70 49 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 InstallVs2008Log
20a80 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 File [file nativ
20a90 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
20aa0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
20ab0 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 [getSQLiteTestDa
20ac0 74 61 50 61 74 68 5d 20 49 6e 73 74 61 6c 6c 65 taPath] Installe
20ad0 72 5f 54 65 73 74 5f 56 73 32 30 30 38 2e 6c 6f r_Test_Vs2008.lo
20ae0 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 g]].... s
20af0 65 74 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 et testInstallVs
20b00 32 30 31 30 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 2010LogFile [fil
20b10 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 e nativename [fi
20b20 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 le join \..
20b30 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 [getSQLit
20b40 65 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 49 eTestDataPath] I
20b50 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 nstaller_Test_Vs
20b60 32 30 31 30 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 2010.log]]....
20b70 20 20 20 20 20 20 73 65 74 20 74 65 73 74 49 6e set testIn
20b80 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 stallVs2012LogFi
20b90 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e le [file nativen
20ba0 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c ame [file join \
20bb0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 .. [g
20bc0 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 etSQLiteTestData
20bd0 50 61 74 68 5d 20 49 6e 73 74 61 6c 6c 65 72 5f Path] Installer_
20be0 54 65 73 74 5f 56 73 32 30 31 32 2e 6c 6f 67 5d Test_Vs2012.log]
20bf0 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 ].... set
20c00 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 testInstallVs20
20c10 31 33 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 13LogFile [file
20c20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 nativename [file
20c30 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 join \..
20c40 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 [getSQLiteT
20c50 65 73 74 44 61 74 61 50 61 74 68 5d 20 49 6e 73 estDataPath] Ins
20c60 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 taller_Test_Vs20
20c70 31 33 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 13.log]]....
20c80 20 20 20 20 73 65 74 20 74 65 73 74 49 6e 73 74 set testInst
20c90 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 allVs2015LogFile
20ca0 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d [file nativenam
20cb0 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a e [file join \..
20cc0 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
20cd0 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 SQLiteTestDataPa
20ce0 74 68 5d 20 49 6e 73 74 61 6c 6c 65 72 5f 54 65 th] Installer_Te
20cf0 73 74 5f 56 73 32 30 31 35 2e 6c 6f 67 5d 5d 0d st_Vs2015.log]].
20d00 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 ... set t
20d10 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 estUninstallVs20
20d20 30 35 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 05LogFile [file
20d30 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 nativename [file
20d40 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 join \..
20d50 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 [getSQLiteT
20d60 65 73 74 44 61 74 61 50 61 74 68 5d 20 55 6e 69 estDataPath] Uni
20d70 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 nstaller_Test_Vs
20d80 32 30 30 35 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 2005.log]]....
20d90 20 20 20 20 20 20 73 65 74 20 74 65 73 74 55 6e set testUn
20da0 69 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 installVs2008Log
20db0 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 File [file nativ
20dc0 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
20dd0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
20de0 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 [getSQLiteTestDa
20df0 74 61 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c taPath] Uninstal
20e00 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 30 38 2e ler_Test_Vs2008.
20e10 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 log]]....
20e20 20 73 65 74 20 74 65 73 74 55 6e 69 6e 73 74 61 set testUninsta
20e30 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 6c 65 20 llVs2010LogFile
20e40 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
20e50 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 [file join \..
20e60 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 [getS
20e70 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 74 QLiteTestDataPat
20e80 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 72 5f 54 h] Uninstaller_T
20e90 65 73 74 5f 56 73 32 30 31 30 2e 6c 6f 67 5d 5d est_Vs2010.log]]
20ea0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 .... set
20eb0 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
20ec0 30 31 32 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 012LogFile [file
20ed0 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c nativename [fil
20ee0 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 e join \..
20ef0 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 [getSQLite
20f00 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 55 6e TestDataPath] Un
20f10 69 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 installer_Test_V
20f20 73 32 30 31 32 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 s2012.log]]....
20f30 20 20 20 20 20 20 20 73 65 74 20 74 65 73 74 55 set testU
20f40 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f ninstallVs2013Lo
20f50 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 gFile [file nati
20f60 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 vename [file joi
20f70 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n \..
20f80 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 [getSQLiteTestD
20f90 61 74 61 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 ataPath] Uninsta
20fa0 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 31 33 ller_Test_Vs2013
20fb0 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 .log]]....
20fc0 20 20 73 65 74 20 74 65 73 74 55 6e 69 6e 73 74 set testUninst
20fd0 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 allVs2015LogFile
20fe0 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d [file nativenam
20ff0 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a e [file join \..
21000 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
21010 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 SQLiteTestDataPa
21020 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 72 5f th] Uninstaller_
21030 54 65 73 74 5f 56 73 32 30 31 35 2e 6c 6f 67 5d Test_Vs2015.log]
21040 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 23 23 ].... ###
21050 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21060 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21070 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21080 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21090 23 23 23 23 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ####....
210a0 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 if {![haveConstr
210b0 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
210c0 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 file_ \..
210d0 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c [file tail
210e0 20 24 65 6e 74 69 74 79 46 72 61 6d 65 77 6f 72 $entityFramewor
210f0 6b 44 6c 6c 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 kDllFile]]]} the
21100 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 n {.. c
21110 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
21120 74 5f 63 68 61 6e 6e 65 6c 20 24 65 6e 74 69 74 t_channel $entit
21130 79 46 72 61 6d 65 77 6f 72 6b 44 6c 6c 46 69 6c yFrameworkDllFil
21140 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a e.. }....
21150 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 if {![ha
21160 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 veConstraint [ap
21170 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c pendArgs file_ \
21180 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 .. [f
21190 69 6c 65 20 74 61 69 6c 20 24 69 6e 73 74 61 6c ile tail $instal
211a0 6c 65 72 45 78 65 46 69 6c 65 5d 5d 5d 7d 20 74 lerExeFile]]]} t
211b0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
211c0 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
211d0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 69 6e 73 est_channel $ins
211e0 74 61 6c 6c 65 72 45 78 65 46 69 6c 65 20 49 6e tallerExeFile In
211f0 73 74 61 6c 6c 65 72 2e 65 78 65 0d 0a 20 20 20 staller.exe..
21200 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
21210 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
21220 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
21230 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
21240 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 [file ta
21250 69 6c 20 24 73 71 6c 69 74 65 44 65 73 69 67 6e il $sqliteDesign
21260 65 72 44 6c 6c 46 69 6c 65 5d 5d 5d 7d 20 74 68 erDllFile]]]} th
21270 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
21280 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 checkForFile $te
21290 73 74 5f 63 68 61 6e 6e 65 6c 20 24 73 71 6c 69 st_channel $sqli
212a0 74 65 44 65 73 69 67 6e 65 72 44 6c 6c 46 69 6c teDesignerDllFil
212b0 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a e.. }....
212c0 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 if {![ha
212d0 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 veConstraint [ap
212e0 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c pendArgs file_ \
212f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 .. [f
21300 69 6c 65 20 74 61 69 6c 20 24 73 79 73 74 65 6d ile tail $system
21310 44 61 74 61 53 51 4c 69 74 65 44 6c 6c 46 69 6c DataSQLiteDllFil
21320 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 e]]]} then {..
21330 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
21340 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e File $test_chann
21350 65 6c 20 24 73 79 73 74 65 6d 44 61 74 61 53 51 el $systemDataSQ
21360 4c 69 74 65 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 LiteDllFile..
21370 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
21380 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
21390 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
213a0 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
213b0 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 [file ta
213c0 69 6c 20 24 73 79 73 74 65 6d 44 61 74 61 53 51 il $systemDataSQ
213d0 4c 69 74 65 4c 69 6e 71 44 6c 6c 46 69 6c 65 5d LiteLinqDllFile]
213e0 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 ]]} then {..
213f0 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 checkForFi
21400 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c le $test_channel
21410 20 24 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 $systemDataSQLi
21420 74 65 4c 69 6e 71 44 6c 6c 46 69 6c 65 0d 0a 20 teLinqDllFile..
21430 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
21440 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f if {![haveCo
21450 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
21460 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 Args file_ \..
21470 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
21480 74 61 69 6c 20 24 73 79 73 74 65 6d 44 61 74 61 tail $systemData
21490 53 51 4c 69 74 65 45 66 36 44 6c 6c 46 69 6c 65 SQLiteEf6DllFile
214a0 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ]]]} then {..
214b0 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 checkForF
214c0 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 ile $test_channe
214d0 6c 20 24 73 79 73 74 65 6d 44 61 74 61 53 51 4c l $systemDataSQL
214e0 69 74 65 45 66 36 44 6c 6c 46 69 6c 65 0d 0a 20 iteEf6DllFile..
214f0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
21500 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f if {![haveCo
21510 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
21520 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 Args file_ \..
21530 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
21540 74 61 69 6c 20 24 74 65 73 74 45 78 65 46 69 6c tail $testExeFil
21550 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 e]]]} then {..
21560 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
21570 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e File $test_chann
21580 65 6c 20 24 74 65 73 74 45 78 65 46 69 6c 65 20 el $testExeFile
21590 74 65 73 74 2e 65 78 65 0d 0a 20 20 20 20 20 20 test.exe..
215a0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
215b0 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
215c0 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
215d0 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
215e0 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
215f0 24 74 65 73 74 4c 69 6e 71 45 78 65 46 69 6c 65 $testLinqExeFile
21600 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ]]]} then {..
21610 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 checkForF
21620 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 ile $test_channe
21630 6c 20 24 74 65 73 74 4c 69 6e 71 45 78 65 46 69 l $testLinqExeFi
21640 6c 65 20 74 65 73 74 6c 69 6e 71 2e 65 78 65 0d le testlinq.exe.
21650 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
21660 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 if {![have
21670 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
21680 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a ndArgs file_ \..
21690 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c [fil
216a0 65 20 74 61 69 6c 20 24 74 65 73 74 45 66 36 45 e tail $testEf6E
216b0 78 65 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 xeFile]]]} then
216c0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 {.. che
216d0 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f ckForFile $test_
216e0 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 45 66 36 channel $testEf6
216f0 45 78 65 46 69 6c 65 20 74 65 73 74 65 66 36 2e ExeFile testef6.
21700 65 78 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a exe.. }..
21710 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b .. if {![
21720 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
21730 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
21740 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
21750 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 [file tail $test
21760 4c 69 6e 71 4f 75 74 46 69 6c 65 5d 5d 5d 7d 20 LinqOutFile]]]}
21770 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
21780 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
21790 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 test_channel $te
217a0 73 74 4c 69 6e 71 4f 75 74 46 69 6c 65 0d 0a 20 stLinqOutFile..
217b0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
217c0 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f if {![haveCo
217d0 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
217e0 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 Args file_ \..
217f0 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
21800 74 61 69 6c 20 24 6e 6f 72 74 68 77 69 6e 64 45 tail $northwindE
21810 66 44 62 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e fDbFile]]]} then
21820 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 {.. ch
21830 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 eckForFile $test
21840 5f 63 68 61 6e 6e 65 6c 20 24 6e 6f 72 74 68 77 _channel $northw
21850 69 6e 64 45 66 44 62 46 69 6c 65 0d 0a 20 20 20 indEfDbFile..
21860 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
21870 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
21880 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
21890 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
218a0 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 [file ta
218b0 69 6c 20 24 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 il $nonWalDbFile
218c0 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ]]]} then {..
218d0 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 checkForF
218e0 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 ile $test_channe
218f0 6c 20 24 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 0d l $nonWalDbFile.
21900 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
21910 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 if {![have
21920 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
21930 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a ndArgs file_ \..
21940 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c [fil
21950 65 20 74 61 69 6c 20 24 77 61 6c 44 62 46 69 6c e tail $walDbFil
21960 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 e]]]} then {..
21970 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
21980 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e File $test_chann
21990 65 6c 20 24 77 61 6c 44 62 46 69 6c 65 0d 0a 20 el $walDbFile..
219a0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
219b0 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f if {![haveCo
219c0 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
219d0 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 Args file_ \..
219e0 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
219f0 74 61 69 6c 20 24 74 65 73 74 49 6e 73 74 61 6c tail $testInstal
21a00 6c 56 73 32 30 30 35 4c 6f 67 46 69 6c 65 5d 5d lVs2005LogFile]]
21a10 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
21a20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
21a30 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
21a40 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 $testInstallVs20
21a50 30 35 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 05LogFile..
21a60 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
21a70 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 if {![haveConstr
21a80 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
21a90 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 file_ \..
21aa0 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c [file tail
21ab0 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 $testInstallVs2
21ac0 30 30 38 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 008LogFile]]]} t
21ad0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
21ae0 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
21af0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 est_channel $tes
21b00 74 49 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f tInstallVs2008Lo
21b10 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d gFile.. }
21b20 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
21b30 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 ![haveConstraint
21b40 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
21b50 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 e_ \..
21b60 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 [file tail $te
21b70 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 30 4c stInstallVs2010L
21b80 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 ogFile]]]} then
21b90 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 {.. che
21ba0 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f ckForFile $test_
21bb0 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 49 6e 73 channel $testIns
21bc0 74 61 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 6c tallVs2010LogFil
21bd0 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a e.. }....
21be0 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 if {![ha
21bf0 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 veConstraint [ap
21c00 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c pendArgs file_ \
21c10 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 .. [f
21c20 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 49 6e ile tail $testIn
21c30 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 stallVs2012LogFi
21c40 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 le]]]} then {..
21c50 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f checkFo
21c60 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e rFile $test_chan
21c70 6e 65 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c nel $testInstall
21c80 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 0d 0a 20 Vs2012LogFile..
21c90 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
21ca0 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f if {![haveCo
21cb0 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
21cc0 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 Args file_ \..
21cd0 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
21ce0 74 61 69 6c 20 24 74 65 73 74 49 6e 73 74 61 6c tail $testInstal
21cf0 6c 56 73 32 30 31 33 4c 6f 67 46 69 6c 65 5d 5d lVs2013LogFile]]
21d00 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
21d10 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
21d20 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
21d30 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 $testInstallVs20
21d40 31 33 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 13LogFile..
21d50 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
21d60 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 if {![haveConstr
21d70 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
21d80 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 file_ \..
21d90 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c [file tail
21da0 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 $testInstallVs2
21db0 30 31 35 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 015LogFile]]]} t
21dc0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
21dd0 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
21de0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 est_channel $tes
21df0 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f tInstallVs2015Lo
21e00 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d gFile.. }
21e10 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
21e20 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 ![haveConstraint
21e30 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
21e40 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 e_ \..
21e50 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 [file tail $te
21e60 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 stUninstallVs200
21e70 35 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 5LogFile]]]} the
21e80 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 n {.. c
21e90 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
21ea0 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 t_channel $testU
21eb0 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f ninstallVs2005Lo
21ec0 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d gFile.. }
21ed0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
21ee0 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 ![haveConstraint
21ef0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
21f00 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 e_ \..
21f10 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 [file tail $te
21f20 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 stUninstallVs200
21f30 38 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 8LogFile]]]} the
21f40 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 n {.. c
21f50 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
21f60 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 t_channel $testU
21f70 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f ninstallVs2008Lo
21f80 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d gFile.. }
21f90 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
21fa0 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 ![haveConstraint
21fb0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
21fc0 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 e_ \..
21fd0 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 [file tail $te
21fe0 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
21ff0 30 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 0LogFile]]]} the
22000 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 n {.. c
22010 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
22020 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 t_channel $testU
22030 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 30 4c 6f ninstallVs2010Lo
22040 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d gFile.. }
22050 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
22060 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 ![haveConstraint
22070 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
22080 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 e_ \..
22090 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 [file tail $te
220a0 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
220b0 32 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 2LogFile]]]} the
220c0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 n {.. c
220d0 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
220e0 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 t_channel $testU
220f0 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f ninstallVs2012Lo
22100 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d gFile.. }
22110 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
22120 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 ![haveConstraint
22130 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
22140 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 e_ \..
22150 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 [file tail $te
22160 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
22170 33 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 3LogFile]]]} the
22180 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 n {.. c
22190 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
221a0 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 t_channel $testU
221b0 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f ninstallVs2013Lo
221c0 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d gFile.. }
221d0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
221e0 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 ![haveConstraint
221f0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
22200 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 e_ \..
22210 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 [file tail $te
22220 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
22230 35 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 5LogFile]]]} the
22240 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 n {.. c
22250 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
22260 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 t_channel $testU
22270 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f ninstallVs2015Lo
22280 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d gFile.. }
22290 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
222a0 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 75 ..... proc ru
222b0 6e 53 51 4c 69 74 65 54 65 73 74 46 69 6c 65 73 nSQLiteTestFiles
222c0 45 70 69 6c 6f 67 75 65 20 7b 7d 20 7b 0d 0a 20 Epilogue {} {..
222d0 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 7b uplevel 1 {
222e0 0d 0a 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 .. unset
222f0 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 5c 0d 0a 20 -nocomplain \..
22300 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 55 testU
22310 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f ninstallVs2015Lo
22320 67 46 69 6c 65 20 74 65 73 74 55 6e 69 6e 73 74 gFile testUninst
22330 61 6c 6c 56 73 32 30 31 33 4c 6f 67 46 69 6c 65 allVs2013LogFile
22340 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
22350 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
22360 30 31 32 4c 6f 67 46 69 6c 65 20 74 65 73 74 55 012LogFile testU
22370 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 30 4c 6f ninstallVs2010Lo
22380 67 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 gFile \..
22390 20 20 20 20 20 74 65 73 74 55 6e 69 6e 73 74 61 testUninsta
223a0 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c 65 20 llVs2008LogFile
223b0 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
223c0 30 30 35 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 20 005LogFile \..
223d0 20 20 20 20 20 20 20 20 20 20 74 65 73 74 49 6e testIn
223e0 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 stallVs2015LogFi
223f0 6c 65 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 le testInstallVs
22400 32 30 31 33 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 2013LogFile \..
22410 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 49 testI
22420 6e 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 nstallVs2012LogF
22430 69 6c 65 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 ile testInstallV
22440 73 32 30 31 30 4c 6f 67 46 69 6c 65 20 5c 0d 0a s2010LogFile \..
22450 20 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 test
22460 49 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 InstallVs2008Log
22470 46 69 6c 65 20 74 65 73 74 49 6e 73 74 61 6c 6c File testInstall
22480 56 73 32 30 30 35 4c 6f 67 46 69 6c 65 0d 0a 0d Vs2005LogFile...
22490 0a 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 2d . unset -
224a0 6e 6f 63 6f 6d 70 6c 61 69 6e 20 5c 0d 0a 20 20 nocomplain \..
224b0 20 20 20 20 20 20 20 20 20 20 6e 6f 72 74 68 77 northw
224c0 69 6e 64 45 66 44 62 46 69 6c 65 20 74 65 73 74 indEfDbFile test
224d0 4c 69 6e 71 4f 75 74 46 69 6c 65 20 5c 0d 0a 20 LinqOutFile \..
224e0 20 20 20 20 20 20 20 20 20 20 20 77 61 6c 44 62 walDb
224f0 46 69 6c 65 20 6e 6f 6e 57 61 6c 44 62 46 69 6c File nonWalDbFil
22500 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 75 6e 73 e.... uns
22510 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 5c et -nocomplain \
22520 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 65 .. te
22530 73 74 45 66 36 45 78 65 46 69 6c 65 20 74 65 73 stEf6ExeFile tes
22540 74 4c 69 6e 71 45 78 65 46 69 6c 65 20 5c 0d 0a tLinqExeFile \..
22550 20 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 test
22560 45 78 65 46 69 6c 65 20 73 79 73 74 65 6d 44 61 ExeFile systemDa
22570 74 61 53 51 4c 69 74 65 45 66 36 44 6c 6c 46 69 taSQLiteEf6DllFi
22580 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 le \..
22590 20 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 systemDataSQLi
225a0 74 65 4c 69 6e 71 44 6c 6c 46 69 6c 65 20 73 79 teLinqDllFile sy
225b0 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 44 6c stemDataSQLiteDl
225c0 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 lFile \..
225d0 20 20 20 20 20 73 71 6c 69 74 65 44 65 73 69 67 sqliteDesig
225e0 6e 65 72 44 6c 6c 46 69 6c 65 20 69 6e 73 74 61 nerDllFile insta
225f0 6c 6c 65 72 45 78 65 46 69 6c 65 20 5c 0d 0a 20 llerExeFile \..
22600 20 20 20 20 20 20 20 20 20 20 20 65 6e 74 69 74 entit
22610 79 46 72 61 6d 65 77 6f 72 6b 44 6c 6c 46 69 6c yFrameworkDllFil
22620 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 e.. }..
22630 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 }..... proc r
22640 75 6e 53 51 4c 69 74 65 54 65 73 74 45 70 69 6c unSQLiteTestEpil
22650 6f 67 75 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 ogue {} {..
22660 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
22670 3a 20 53 6b 69 70 20 72 75 6e 6e 69 6e 67 20 6f : Skip running o
22680 75 72 20 63 75 73 74 6f 6d 20 65 70 69 6c 6f 67 ur custom epilog
22690 75 65 20 69 66 20 74 68 65 20 6d 61 69 6e 20 6f ue if the main o
226a0 6e 65 20 68 61 73 20 62 65 65 6e 0d 0a 20 20 20 ne has been..
226b0 20 20 20 23 20 20 20 20 20 20 20 73 6b 69 70 70 # skipp
226c0 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ed... #..
226d0 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
226e0 78 69 73 74 73 20 3a 3a 6e 6f 28 65 70 69 6c 6f xists ::no(epilo
226f0 67 75 65 2e 65 61 67 6c 65 29 5d 7d 20 74 68 65 gue.eagle)]} the
22700 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
22710 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
22720 53 68 6f 77 20 77 68 65 6e 20 6f 75 72 20 74 65 Show when our te
22730 73 74 73 20 61 63 74 75 61 6c 6c 79 20 65 6e 64 sts actually end
22740 65 64 20 28 6e 6f 77 29 2e 0d 0a 20 20 20 20 20 ed (now)...
22750 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 70 #.. tp
22760 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
22770 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
22780 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
22790 2d 2d 2d 2d 20 53 79 73 74 65 6d 2e 44 61 74 61 ---- System.Data
227a0 2e 53 51 4c 69 74 65 20 74 65 73 74 73 20 65 6e .SQLite tests en
227b0 64 65 64 20 61 74 20 22 20 5c 0d 0a 20 20 20 20 ded at " \..
227c0 20 20 20 20 20 20 20 20 5b 63 6c 6f 63 6b 20 66 [clock f
227d0 6f 72 6d 61 74 20 5b 63 6c 6f 63 6b 20 73 65 63 ormat [clock sec
227e0 6f 6e 64 73 5d 5d 20 5c 6e 5d 0d 0a 0d 0a 20 20 onds]] \n]....
227f0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
22800 20 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 20 74 68 # NOTE: Load th
22810 65 20 22 65 70 69 6c 6f 67 75 65 22 20 63 75 73 e "epilogue" cus
22820 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 61 6e 64 tom per-user and
22830 2f 6f 72 20 70 65 72 2d 68 6f 73 74 20 74 65 73 /or per-host tes
22840 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 t.. #
22850 20 20 20 73 65 74 74 69 6e 67 73 20 6e 6f 77 2e settings now.
22860 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
22870 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 5b uplevel 1 [
22880 6c 69 73 74 20 6c 6f 61 64 53 51 4c 69 74 65 54 list loadSQLiteT
22890 65 73 74 53 65 74 74 69 6e 67 73 20 24 3a 3a 74 estSettings $::t
228a0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 2e 65 70 69 est_channel .epi
228b0 6c 6f 67 75 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 logue]....
228c0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 42 #.. # B
228d0 55 47 46 49 58 3a 20 42 65 66 6f 72 65 20 63 68 UGFIX: Before ch
228e0 65 63 6b 69 6e 67 20 74 68 65 20 66 69 6e 61 6c ecking the final
228f0 20 72 65 73 6f 75 72 63 65 73 20 69 6e 20 75 73 resources in us
22900 65 20 62 79 20 53 51 4c 69 74 65 2c 20 6d 61 6b e by SQLite, mak
22910 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
22920 20 20 20 20 20 73 75 72 65 20 62 6f 74 68 20 6f sure both o
22930 66 20 74 68 65 20 50 52 41 47 4d 41 20 72 65 6c f the PRAGMA rel
22940 61 74 65 64 20 64 69 72 65 63 74 6f 72 79 20 6e ated directory n
22950 61 6d 65 73 20 61 72 65 20 66 72 65 65 64 2e 0d ames are freed..
22960 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
22970 20 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 checkForSQLi
22980 74 65 44 69 72 65 63 74 6f 72 69 65 73 20 24 3a teDirectories $:
22990 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 74 72 :test_channel tr
229a0 75 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d ue.... #.
229b0 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
229c0 20 41 6c 73 6f 20 72 65 70 6f 72 74 20 74 68 65 Also report the
229d0 20 72 65 73 6f 75 72 63 65 20 75 73 61 67 65 20 resource usage
229e0 61 66 74 65 72 20 72 75 6e 6e 69 6e 67 20 74 68 after running th
229f0 65 20 74 65 73 74 73 2e 0d 0a 20 20 20 20 20 20 e tests...
22a00 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 70 #.. rep
22a10 6f 72 74 53 51 4c 69 74 65 52 65 73 6f 75 72 63 ortSQLiteResourc
22a20 65 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e es $::test_chann
22a30 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d el.... #.
22a40 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
22a50 20 52 65 70 6f 72 74 20 74 68 65 20 63 72 69 74 Report the crit
22a60 69 63 61 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e ical handle coun
22a70 74 73 20 61 66 74 65 72 20 72 75 6e 6e 69 6e 67 ts after running
22a80 20 74 68 65 20 74 65 73 74 73 2e 0d 0a 20 20 20 the tests...
22a90 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
22aa0 67 65 74 53 51 4c 69 74 65 48 61 6e 64 6c 65 43 getSQLiteHandleC
22ab0 6f 75 6e 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 ounts $::test_ch
22ac0 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 annel....
22ad0 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
22ae0 54 45 3a 20 49 66 20 6e 65 63 65 73 73 61 72 79 TE: If necessary
22af0 2c 20 64 69 73 61 62 6c 65 20 73 68 61 72 65 64 , disable shared
22b00 2d 63 61 63 68 65 20 6d 6f 64 65 20 6e 6f 77 2e -cache mode now.
22b10 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
22b20 20 20 20 20 20 69 66 20 7b 5b 68 61 73 52 75 6e if {[hasRun
22b30 74 69 6d 65 4f 70 74 69 6f 6e 20 73 68 61 72 65 timeOption share
22b40 64 43 61 63 68 65 5d 7d 20 74 68 65 6e 20 7b 0d dCache]} then {.
22b50 0a 20 20 20 20 20 20 20 20 20 20 65 6e 61 62 6c . enabl
22b60 65 53 68 61 72 65 64 43 61 63 68 65 20 24 3a 3a eSharedCache $::
22b70 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 66 61 6c test_channel fal
22b80 73 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 se.. }..
22b90 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
22ba0 0d 0a 20 20 20 20 23 23 23 23 23 23 23 23 23 23 .. ##########
22bb0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22bc0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22bd0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22be0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22bf0 23 0d 0a 20 20 20 20 23 23 23 23 23 23 23 23 23 #.. #########
22c00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c10 23 23 23 23 20 45 4e 44 20 45 61 67 6c 65 20 4f #### END Eagle O
22c20 4e 4c 59 20 23 23 23 23 23 23 23 23 23 23 23 23 NLY ############
22c30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c40 23 23 0d 0a 20 20 20 20 23 23 23 23 23 23 23 23 ##.. ########
22c50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
22c90 23 23 23 0d 0a 20 20 7d 0d 0a 0d 0a 20 20 23 0d ###.. }.... #.
22ca0 0a 20 20 23 20 4e 4f 54 45 3a 20 53 61 76 65 20 . # NOTE: Save
22cb0 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 the name of the
22cc0 64 69 72 65 63 74 6f 72 79 20 63 6f 6e 74 61 69 directory contai
22cd0 6e 69 6e 67 20 74 68 69 73 20 66 69 6c 65 2e 0d ning this file..
22ce0 0a 20 20 23 0d 0a 20 20 69 66 20 7b 21 5b 69 6e . #.. if {![in
22cf0 66 6f 20 65 78 69 73 74 73 20 63 6f 6d 6d 6f 6e fo exists common
22d00 5f 64 69 72 65 63 74 6f 72 79 5d 7d 20 74 68 65 _directory]} the
22d10 6e 20 7b 0d 0a 20 20 20 20 73 65 74 20 63 6f 6d n {.. set com
22d20 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 20 5b 66 mon_directory [f
22d30 69 6c 65 20 64 69 72 6e 61 6d 65 20 5b 69 6e 66 ile dirname [inf
22d40 6f 20 73 63 72 69 70 74 5d 5d 0d 0a 20 20 7d 0d o script]].. }.
22d50 0a 0d 0a 20 20 23 0d 0a 20 20 23 20 4e 4f 54 45 ... #.. # NOTE
22d60 3a 20 50 72 6f 76 69 64 65 20 74 68 65 20 53 79 : Provide the Sy
22d70 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
22d80 20 74 65 73 74 20 70 61 63 6b 61 67 65 20 74 6f test package to
22d90 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 the interpreter
22da0 2e 0d 0a 20 20 23 0d 0a 20 20 70 61 63 6b 61 67 ... #.. packag
22db0 65 20 70 72 6f 76 69 64 65 20 53 79 73 74 65 6d e provide System
22dc0 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 54 65 73 .Data.SQLite.Tes
22dd0 74 20 31 2e 30 0d 0a 7d 0d 0a t 1.0..}..