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 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f etSQLiteDefineCo
0340: 6e 73 74 61 6e 74 50 72 65 66 69 78 20 7b 7d 20 nstantPrefix {}
0350: 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
0360: 20 20 23 20 4e 4f 54 45 3a 20 53 65 65 20 69 66 # NOTE: See if
0370: 20 74 68 65 20 64 65 66 69 6e 65 20 63 6f 6e 73 the define cons
0380: 74 61 6e 74 20 70 72 65 66 69 78 20 73 65 74 74 tant prefix sett
0390: 69 6e 67 20 68 61 73 20 62 65 65 6e 20 6f 76 65 ing has been ove
03a0: 72 72 69 64 64 65 6e 0d 0a 20 20 20 20 20 20 23 rridden.. #
03b0: 20 20 20 20 20 20 20 62 79 20 74 68 65 20 75 73 by the us
03c0: 65 72 20 28 65 2e 67 2e 20 6f 6e 20 74 68 65 20 er (e.g. on the
03d0: 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 29 2e 0d 0a command line)...
03e0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
03f0: 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
0400: 3a 3a 64 65 66 69 6e 65 5f 63 6f 6e 73 74 61 6e ::define_constan
0410: 74 5f 70 72 65 66 69 78 5d 20 26 26 20 5c 0d 0a t_prefix] && \..
0420: 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
0430: 67 20 6c 65 6e 67 74 68 20 24 3a 3a 64 65 66 69 g length $::defi
0440: 6e 65 5f 63 6f 6e 73 74 61 6e 74 5f 70 72 65 66 ne_constant_pref
0450: 69 78 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d ix] > 0} then {.
0460: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
0470: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
0480: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 64 65 the specified de
0490: 66 69 6e 65 20 63 6f 6e 73 74 61 6e 74 20 70 72 fine constant pr
04a0: 65 66 69 78 2e 0d 0a 20 20 20 20 20 20 20 20 23 efix... #
04b0: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
04c0: 20 24 3a 3a 64 65 66 69 6e 65 5f 63 6f 6e 73 74 $::define_const
04d0: 61 6e 74 5f 70 72 65 66 69 78 0d 0a 20 20 20 20 ant_prefix..
04e0: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
04f0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
0500: 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 64 NOTE: Use the d
0510: 65 66 61 75 6c 74 20 64 65 66 69 6e 65 20 63 6f efault define co
0520: 6e 73 74 61 6e 74 20 70 72 65 66 69 78 2e 0d 0a nstant prefix...
0530: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
0540: 20 20 20 72 65 74 75 72 6e 20 64 65 66 69 6e 65 return define
0550: 43 6f 6e 73 74 61 6e 74 2e 53 79 73 74 65 6d 2e Constant.System.
0560: 44 61 74 61 2e 53 51 4c 69 74 65 2e 0d 0a 20 20 Data.SQLite...
0570: 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
0580: 0a 20 20 20 20 70 72 6f 63 20 68 61 76 65 53 51 . proc haveSQ
0590: 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 61 LiteDefineConsta
05a0: 6e 74 20 7b 20 6e 61 6d 65 20 7d 20 7b 0d 0a 20 nt { name } {..
05b0: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 68 61 76 return [hav
05c0: 65 43 6f 6e 73 74 72 61 69 6e 74 20 5c 0d 0a 20 eConstraint \..
05d0: 20 20 20 20 20 20 20 20 20 5b 61 70 70 65 6e 64 [append
05e0: 41 72 67 73 20 5b 67 65 74 53 51 4c 69 74 65 44 Args [getSQLiteD
05f0: 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 50 72 65 efineConstantPre
0600: 66 69 78 5d 20 24 6e 61 6d 65 5d 5d 0d 0a 20 20 fix] $name]]..
0610: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
0620: 20 67 65 74 42 75 69 6c 64 59 65 61 72 20 7b 7d getBuildYear {}
0630: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
0640: 20 20 20 23 20 4e 4f 54 45 3a 20 53 65 65 20 69 # NOTE: See i
0650: 66 20 74 68 65 20 22 79 65 61 72 22 20 73 65 74 f the "year" set
0660: 74 69 6e 67 20 68 61 73 20 62 65 65 6e 20 6f 76 ting has been ov
0670: 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 65 20 erridden by the
0680: 75 73 65 72 20 28 65 2e 67 2e 0d 0a 20 20 20 20 user (e.g...
0690: 20 20 23 20 20 20 20 20 20 20 6f 6e 20 74 68 65 # on the
06a0: 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 29 2e 20 command line).
06b0: 20 54 68 69 73 20 68 65 6c 70 73 20 63 6f 6e 74 This helps cont
06c0: 72 6f 6c 20 65 78 61 63 74 6c 79 20 77 68 69 63 rol exactly whic
06d0: 68 20 73 65 74 20 6f 66 0d 0a 20 20 20 20 20 20 h set of..
06e0: 23 20 20 20 20 20 20 20 62 69 6e 61 72 69 65 73 # binaries
06f0: 20 77 65 20 61 72 65 20 74 65 73 74 69 6e 67 2c we are testing,
0700: 20 74 68 6f 73 65 20 70 72 6f 64 75 63 65 64 20 those produced
0710: 75 73 69 6e 67 20 74 68 65 20 56 69 73 75 61 6c using the Visual
0720: 20 53 74 75 64 69 6f 0d 0a 20 20 20 20 20 20 23 Studio.. #
0730: 20 20 20 20 20 20 20 32 30 30 35 2c 20 32 30 30 2005, 200
0740: 38 2c 20 32 30 31 30 2c 20 32 30 31 32 2c 20 32 8, 2010, 2012, 2
0750: 30 31 33 2c 20 6f 72 20 32 30 31 35 20 62 75 69 013, or 2015 bui
0760: 6c 64 20 73 79 73 74 65 6d 73 2e 20 20 54 6f 20 ld systems. To
0770: 6f 76 65 72 72 69 64 65 0d 0a 20 20 20 20 20 20 override..
0780: 23 20 20 20 20 20 20 20 74 68 69 73 20 76 61 6c # this val
0790: 75 65 20 76 69 61 20 74 68 65 20 63 6f 6d 6d 61 ue via the comma
07a0: 6e 64 20 6c 69 6e 65 2c 20 65 6e 74 65 72 20 61 nd line, enter a
07b0: 20 63 6f 6d 6d 61 6e 64 20 73 69 6d 69 6c 61 72 command similar
07c0: 20 74 6f 20 6f 6e 65 0d 0a 20 20 20 20 20 20 23 to one.. #
07d0: 20 20 20 20 20 20 20 6f 66 20 74 68 65 20 66 6f of the fo
07e0: 6c 6c 6f 77 69 6e 67 20 28 61 6c 6c 20 6f 6e 20 llowing (all on
07f0: 6f 6e 65 20 6c 69 6e 65 29 3a 0d 0a 20 20 20 20 one line):..
0800: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 20 #.. #
0810: 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 EagleShell.ex
0820: 65 20 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a 65 e -anyInitialize
0830: 20 22 73 65 74 20 74 65 73 74 5f 79 65 61 72 20 "set test_year
0840: 32 30 30 35 22 0d 0a 20 20 20 20 20 20 23 20 20 2005".. #
0850: 20 20 20 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 -file .\p
0860: 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 ath\to\all.eagle
0870: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
0880: 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 # EagleSh
0890: 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 49 6e 69 74 ell.exe -anyInit
08a0: 69 61 6c 69 7a 65 20 22 73 65 74 20 74 65 73 74 ialize "set test
08b0: 5f 79 65 61 72 20 32 30 30 38 22 0d 0a 20 20 20 _year 2008"..
08c0: 20 20 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 # -fi
08d0: 6c 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c le .\path\to\all
08e0: 2e 65 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d .eagle.. #.
08f0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 45 . # E
0900: 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d 61 agleShell.exe -a
0910: 6e 79 49 6e 69 74 69 61 6c 69 7a 65 20 22 73 65 nyInitialize "se
0920: 74 20 74 65 73 74 5f 79 65 61 72 20 32 30 31 30 t test_year 2010
0930: 22 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 ".. #
0940: 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c -file .\path\
0950: 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 to\all.eagle..
0960: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 #.. #
0970: 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e EagleShell.
0980: 65 78 65 20 2d 61 6e 79 49 6e 69 74 69 61 6c 69 exe -anyInitiali
0990: 7a 65 20 22 73 65 74 20 74 65 73 74 5f 79 65 61 ze "set test_yea
09a0: 72 20 32 30 31 32 22 0d 0a 20 20 20 20 20 20 23 r 2012".. #
09b0: 20 20 20 20 20 20 20 20 20 2d 66 69 6c 65 20 2e -file .
09c0: 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 \path\to\all.eag
09d0: 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 le.. #..
09e0: 20 20 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 # Eagle
09f0: 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 49 6e Shell.exe -anyIn
0a00: 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 74 65 itialize "set te
0a10: 73 74 5f 79 65 61 72 20 32 30 31 33 22 0d 0a 20 st_year 2013"..
0a20: 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 2d # -
0a30: 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 file .\path\to\a
0a40: 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 20 20 20 ll.eagle..
0a50: 23 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 #.. #
0a60: 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 20 EagleShell.exe
0a70: 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a 65 20 22 -anyInitialize "
0a80: 73 65 74 20 74 65 73 74 5f 79 65 61 72 20 32 30 set test_year 20
0a90: 31 35 22 0d 0a 20 20 20 20 20 20 23 20 20 20 20 15".. #
0aa0: 20 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 -file .\pat
0ab0: 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a h\to\all.eagle..
0ac0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
0ad0: 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c EagleShel
0ae0: 6c 2e 65 78 65 20 2d 61 6e 79 49 6e 69 74 69 61 l.exe -anyInitia
0af0: 6c 69 7a 65 20 22 75 6e 73 65 74 20 2d 6e 6f 63 lize "unset -noc
0b00: 6f 6d 70 6c 61 69 6e 20 74 65 73 74 5f 79 65 61 omplain test_yea
0b10: 72 22 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 r".. #
0b20: 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 -file .\path
0b30: 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 \to\all.eagle..
0b40: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
0b50: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {[info exists :
0b60: 3a 74 65 73 74 5f 79 65 61 72 5d 20 26 26 20 5b :test_year] && [
0b70: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a string length $:
0b80: 3a 74 65 73 74 5f 79 65 61 72 5d 20 3e 20 30 7d :test_year] > 0}
0b90: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
0ba0: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
0bb0: 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 TE: Use the spec
0bc0: 69 66 69 65 64 20 74 65 73 74 20 79 65 61 72 2e ified test year.
0bd0: 20 20 49 66 20 74 68 69 73 20 76 61 72 69 61 62 If this variab
0be0: 6c 65 20 69 73 20 6e 6f 74 20 73 65 74 2c 20 74 le is not set, t
0bf0: 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 he.. #
0c00: 20 20 20 20 64 65 66 61 75 6c 74 20 76 61 6c 75 default valu
0c10: 65 20 77 69 6c 6c 20 62 65 20 62 61 73 65 64 20 e will be based
0c20: 6f 6e 20 77 68 65 74 68 65 72 20 6f 72 20 6e 6f on whether or no
0c30: 74 20 45 61 67 6c 65 20 68 61 73 20 62 65 65 6e t Eagle has been
0c40: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
0c50: 20 20 63 6f 6d 70 69 6c 65 64 20 61 67 61 69 6e compiled again
0c60: 73 74 20 74 68 65 20 43 4c 52 20 76 32 2e 30 20 st the CLR v2.0
0c70: 6f 72 20 43 4c 52 20 76 34 2e 30 2e 0d 0a 20 20 or CLR v4.0...
0c80: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
0c90: 20 72 65 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f return $::test_
0ca0: 79 65 61 72 0d 0a 20 20 20 20 20 20 7d 20 65 6c year.. } el
0cb0: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d se {.. #.
0cc0: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
0cd0: 20 49 66 20 45 61 67 6c 65 20 68 61 73 20 62 65 If Eagle has be
0ce0: 65 6e 20 63 6f 6d 70 69 6c 65 64 20 61 67 61 69 en compiled agai
0cf0: 6e 73 74 20 74 68 65 20 43 4c 52 20 76 34 2e 30 nst the CLR v4.0
0d00: 2c 20 75 73 65 20 22 32 30 31 30 22 20 62 79 0d , use "2010" by.
0d10: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
0d20: 20 64 65 66 61 75 6c 74 20 28 77 65 20 63 6f 75 default (we cou
0d30: 6c 64 20 75 73 65 20 22 32 30 31 32 22 2c 20 22 ld use "2012", "
0d40: 32 30 31 33 22 2c 20 6f 72 20 22 32 30 31 35 22 2013", or "2015"
0d50: 20 69 6e 20 74 68 61 74 20 63 61 73 65 20 61 73 in that case as
0d60: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
0d70: 20 20 77 65 6c 6c 29 20 61 73 20 74 68 65 20 74 well) as the t
0d80: 65 73 74 20 79 65 61 72 3b 20 6f 74 68 65 72 77 est year; otherw
0d90: 69 73 65 2c 20 75 73 65 20 22 32 30 30 38 22 20 ise, use "2008"
0da0: 62 79 20 64 65 66 61 75 6c 74 20 28 77 65 0d 0a by default (we..
0db0: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
0dc0: 63 6f 75 6c 64 20 75 73 65 20 22 32 30 30 35 22 could use "2005"
0dd0: 20 69 6e 20 74 68 61 74 20 63 61 73 65 20 61 73 in that case as
0de0: 20 77 65 6c 6c 29 2e 20 20 49 66 20 61 6e 6f 74 well). If anot
0df0: 68 65 72 20 6d 61 6a 6f 72 0d 0a 20 20 20 20 20 her major..
0e00: 20 20 20 23 20 20 20 20 20 20 20 5b 69 6e 63 6f # [inco
0e10: 6d 70 61 74 69 62 6c 65 5d 20 76 65 72 73 69 6f mpatible] versio
0e20: 6e 20 6f 66 20 74 68 65 20 43 4c 52 20 69 73 20 n of the CLR is
0e30: 72 65 6c 65 61 73 65 64 2c 20 74 68 69 73 20 63 released, this c
0e40: 68 65 63 6b 20 77 69 6c 6c 0d 0a 20 20 20 20 20 heck will..
0e50: 20 20 20 23 20 20 20 20 20 20 20 68 61 76 65 20 # have
0e60: 74 6f 20 62 65 20 63 68 61 6e 67 65 64 2e 20 20 to be changed.
0e70: 54 68 65 20 64 65 66 61 75 6c 74 20 74 65 73 74 The default test
0e80: 20 79 65 61 72 20 74 6f 20 75 73 65 20 66 6f 72 year to use for
0e90: 20 61 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 a.. #
0ea0: 20 20 20 20 70 61 72 74 69 63 75 6c 61 72 20 43 particular C
0eb0: 4c 52 20 76 65 72 73 69 6f 6e 20 6d 61 79 20 62 LR version may b
0ec0: 65 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 e overridden by
0ed0: 73 65 74 74 69 6e 67 20 74 68 65 20 67 6c 6f 62 setting the glob
0ee0: 61 6c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 al.. #
0ef0: 20 20 20 20 76 61 72 69 61 62 6c 65 20 22 74 65 variable "te
0f00: 73 74 5f 79 65 61 72 5f 63 6c 72 5f 76 24 58 22 st_year_clr_v$X"
0f10: 2c 20 77 68 65 72 65 20 22 24 58 22 20 6d 61 79 , where "$X" may
0f20: 20 5b 63 75 72 72 65 6e 74 6c 79 5d 20 62 65 0d [currently] be.
0f30: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
0f40: 20 65 69 74 68 65 72 20 22 32 22 20 6f 72 20 22 either "2" or "
0f50: 34 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 4"... #..
0f60: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 if {[hav
0f70: 65 43 6f 6e 73 74 72 61 69 6e 74 20 69 6d 61 67 eConstraint imag
0f80: 65 52 75 6e 74 69 6d 65 34 30 5d 7d 20 74 68 65 eRuntime40]} the
0f90: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 n {.. i
0fa0: 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
0fb0: 3a 3a 74 65 73 74 5f 79 65 61 72 5f 63 6c 72 5f ::test_year_clr_
0fc0: 76 34 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 v4] && \..
0fd0: 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
0fe0: 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 79 length $::test_y
0ff0: 65 61 72 5f 63 6c 72 5f 76 34 5d 20 3e 20 30 7d ear_clr_v4] > 0}
1000: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1010: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1020: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
1030: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 74 65 the specified te
1040: 73 74 20 79 65 61 72 20 66 6f 72 20 74 68 65 20 st year for the
1050: 43 4c 52 20 76 34 2e 30 2e 0d 0a 20 20 20 20 20 CLR v4.0...
1060: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1070: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
1080: 74 65 73 74 5f 79 65 61 72 5f 63 6c 72 5f 76 34 test_year_clr_v4
1090: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c .. } el
10a0: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
10b0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
10c0: 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 # NOTE: Use the
10d0: 20 64 65 66 61 75 6c 74 20 74 65 73 74 20 79 65 default test ye
10e0: 61 72 20 66 6f 72 20 74 68 65 20 43 4c 52 20 76 ar for the CLR v
10f0: 34 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 4.0...
1100: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
1110: 20 72 65 74 75 72 6e 20 32 30 31 30 3b 20 23 20 return 2010; #
1120: 54 4f 44 4f 3a 20 47 6f 6f 64 20 22 66 61 6c 6c TODO: Good "fall
1130: 62 61 63 6b 22 20 64 65 66 61 75 6c 74 3f 0d 0a back" default?..
1140: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1150: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
1160: 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e if {[in
1170: 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 73 74 fo exists ::test
1180: 5f 79 65 61 72 5f 63 6c 72 5f 76 32 5d 20 26 26 _year_clr_v2] &&
1190: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
11a0: 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
11b0: 20 24 3a 3a 74 65 73 74 5f 79 65 61 72 5f 63 6c $::test_year_cl
11c0: 72 5f 76 32 5d 20 3e 20 30 7d 20 74 68 65 6e 20 r_v2] > 0} then
11d0: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 {.. #
11e0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 .. #
11f0: 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 NOTE: Use the sp
1200: 65 63 69 66 69 65 64 20 74 65 73 74 20 79 65 61 ecified test yea
1210: 72 20 66 6f 72 20 74 68 65 20 43 4c 52 20 76 32 r for the CLR v2
1220: 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 .0...
1230: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
1240: 72 65 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f 79 return $::test_y
1250: 65 61 72 5f 63 6c 72 5f 76 32 0d 0a 20 20 20 20 ear_clr_v2..
1260: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
1270: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
1280: 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 # NOT
1290: 45 3a 20 55 73 65 20 74 68 65 20 64 65 66 61 75 E: Use the defau
12a0: 6c 74 20 74 65 73 74 20 79 65 61 72 20 66 6f 72 lt test year for
12b0: 20 74 68 65 20 43 4c 52 20 76 32 2e 30 2e 0d 0a the CLR v2.0...
12c0: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
12d0: 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 retur
12e0: 6e 20 32 30 30 38 3b 20 23 20 54 4f 44 4f 3a 20 n 2008; # TODO:
12f0: 47 6f 6f 64 20 22 66 61 6c 6c 62 61 63 6b 22 20 Good "fallback"
1300: 64 65 66 61 75 6c 74 3f 0d 0a 20 20 20 20 20 20 default?..
1310: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1320: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
1330: 0d 0a 0c 0d 0a 20 20 20 20 23 0d 0a 20 20 20 20 ..... #..
1340: 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f # NOTE: This pro
1350: 63 65 64 75 72 65 20 69 73 20 6f 6e 6c 79 20 75 cedure is only u
1360: 73 65 64 20 77 68 65 6e 20 61 64 64 69 6e 67 20 sed when adding
1370: 73 68 69 6d 6d 65 64 20 74 65 73 74 20 63 6f 6e shimmed test con
1380: 73 74 72 61 69 6e 74 73 2e 0d 0a 20 20 20 20 23 straints... #
1390: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 75 .. proc getBu
13a0: 69 6c 64 43 6c 72 56 65 72 73 69 6f 6e 20 7b 7d ildClrVersion {}
13b0: 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 {.. if {[i
13c0: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 73 nfo exists ::tes
13d0: 74 5f 63 6c 72 5d 20 26 26 20 5b 73 74 72 69 6e t_clr] && [strin
13e0: 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 g length $::test
13f0: 5f 63 6c 72 5d 20 3e 20 30 7d 20 74 68 65 6e 20 _clr] > 0} then
1400: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
1410: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 # NOTE: Us
1420: 65 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 e the specified
1430: 74 65 73 74 20 76 65 72 73 69 6f 6e 20 66 6f 72 test version for
1440: 20 74 68 65 20 43 4c 52 2e 20 20 49 66 20 74 68 the CLR. If th
1450: 69 73 20 76 61 72 69 61 62 6c 65 0d 0a 20 20 20 is variable..
1460: 20 20 20 20 20 23 20 20 20 20 20 20 20 69 73 20 # is
1470: 6e 6f 74 20 73 65 74 2c 20 74 68 65 20 64 65 66 not set, the def
1480: 61 75 6c 74 20 76 61 6c 75 65 20 77 69 6c 6c 20 ault value will
1490: 62 65 20 62 61 73 65 64 20 6f 6e 20 77 68 65 74 be based on whet
14a0: 68 65 72 20 6f 72 20 6e 6f 74 0d 0a 20 20 20 20 her or not..
14b0: 20 20 20 20 23 20 20 20 20 20 20 20 45 61 67 6c # Eagl
14c0: 65 20 68 61 73 20 62 65 65 6e 20 63 6f 6d 70 69 e has been compi
14d0: 6c 65 64 20 61 67 61 69 6e 73 74 20 74 68 65 20 led against the
14e0: 43 4c 52 20 76 32 2e 30 20 6f 72 20 43 4c 52 20 CLR v2.0 or CLR
14f0: 76 34 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 23 v4.0... #
1500: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
1510: 20 24 3a 3a 74 65 73 74 5f 63 6c 72 0d 0a 20 20 $::test_clr..
1520: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
1530: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1540: 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 # NOTE: Check i
1550: 66 20 45 61 67 6c 65 20 68 61 73 20 62 65 65 6e f Eagle has been
1560: 20 63 6f 6d 70 69 6c 65 64 20 61 67 61 69 6e 73 compiled agains
1570: 74 20 74 68 65 20 43 4c 52 20 76 34 2e 30 2e 20 t the CLR v4.0.
1580: 20 49 66 20 73 6f 2c 0d 0a 20 20 20 20 20 20 20 If so,..
1590: 20 23 20 20 20 20 20 20 20 6a 75 73 74 20 75 73 # just us
15a0: 65 20 74 68 61 74 20 43 4c 52 20 76 65 72 73 69 e that CLR versi
15b0: 6f 6e 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 on. Otherwise,
15c0: 75 73 65 20 74 68 65 20 76 65 72 73 69 6f 6e 20 use the version
15d0: 66 6f 72 20 74 68 65 0d 0a 20 20 20 20 20 20 20 for the..
15e0: 20 23 20 20 20 20 20 20 20 43 4c 52 20 76 32 2e # CLR v2.
15f0: 30 2e 20 20 49 66 20 61 6e 6f 74 68 65 72 20 6d 0. If another m
1600: 61 6a 6f 72 20 5b 69 6e 63 6f 6d 70 61 74 69 62 ajor [incompatib
1610: 6c 65 5d 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 le] version of t
1620: 68 65 20 43 4c 52 0d 0a 20 20 20 20 20 20 20 20 he CLR..
1630: 23 20 20 20 20 20 20 20 69 73 20 72 65 6c 65 61 # is relea
1640: 73 65 64 2c 20 74 68 69 73 20 63 68 65 63 6b 20 sed, this check
1650: 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 62 65 20 will have to be
1660: 63 68 61 6e 67 65 64 2e 20 20 54 68 65 20 64 65 changed. The de
1670: 66 61 75 6c 74 0d 0a 20 20 20 20 20 20 20 20 23 fault.. #
1680: 20 20 20 20 20 20 20 76 65 72 73 69 6f 6e 20 76 version v
1690: 61 6c 75 65 20 66 6f 72 20 61 20 70 61 72 74 69 alue for a parti
16a0: 63 75 6c 61 72 20 43 4c 52 20 76 65 72 73 69 6f cular CLR versio
16b0: 6e 20 6d 61 79 20 62 65 20 6f 76 65 72 72 69 64 n may be overrid
16c0: 64 65 6e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 den.. #
16d0: 20 20 20 20 20 62 79 20 73 65 74 74 69 6e 67 20 by setting
16e0: 74 68 65 20 67 6c 6f 62 61 6c 20 76 61 72 69 61 the global varia
16f0: 62 6c 65 20 22 74 65 73 74 5f 63 6c 72 5f 76 24 ble "test_clr_v$
1700: 58 22 2c 20 77 68 65 72 65 20 22 24 58 22 20 6d X", where "$X" m
1710: 61 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ay.. #
1720: 20 20 20 20 5b 63 75 72 72 65 6e 74 6c 79 5d 20 [currently]
1730: 62 65 20 65 69 74 68 65 72 20 22 32 22 20 6f 72 be either "2" or
1740: 20 22 34 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 "4"... #
1750: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 68 .. if {[h
1760: 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 69 6d aveConstraint im
1770: 61 67 65 52 75 6e 74 69 6d 65 34 30 5d 7d 20 74 ageRuntime40]} t
1780: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1790: 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
17a0: 73 20 3a 3a 74 65 73 74 5f 63 6c 72 5f 76 34 5d s ::test_clr_v4]
17b0: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
17c0: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
17d0: 67 74 68 20 24 3a 3a 74 65 73 74 5f 63 6c 72 5f gth $::test_clr_
17e0: 76 34 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d v4] > 0} then {.
17f0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
1800: 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f # NO
1810: 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 TE: Use the spec
1820: 69 66 69 65 64 20 74 65 73 74 20 76 65 72 73 69 ified test versi
1830: 6f 6e 20 66 6f 72 20 74 68 65 20 43 4c 52 20 76 on for the CLR v
1840: 34 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 4.0...
1850: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
1860: 20 72 65 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f return $::test_
1870: 63 6c 72 5f 76 34 0d 0a 20 20 20 20 20 20 20 20 clr_v4..
1880: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
1890: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
18a0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 # NOTE: U
18b0: 73 65 20 74 68 65 20 64 65 66 61 75 6c 74 20 74 se the default t
18c0: 65 73 74 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 est version for
18d0: 74 68 65 20 43 4c 52 20 76 34 2e 30 2e 0d 0a 20 the CLR v4.0...
18e0: 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
18f0: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
1900: 20 34 2e 30 2e 33 30 33 31 39 3b 20 23 20 54 4f 4.0.30319; # TO
1910: 44 4f 3a 20 47 6f 6f 64 20 22 66 61 6c 6c 62 61 DO: Good "fallba
1920: 63 6b 22 20 64 65 66 61 75 6c 74 3f 0d 0a 20 20 ck" default?..
1930: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1940: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
1950: 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f if {[info
1960: 20 65 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 63 exists ::test_c
1970: 6c 72 5f 76 32 5d 20 26 26 20 5c 0d 0a 20 20 20 lr_v2] && \..
1980: 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 [stri
1990: 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 ng length $::tes
19a0: 74 5f 63 6c 72 5f 76 32 5d 20 3e 20 30 7d 20 74 t_clr_v2] > 0} t
19b0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
19c0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
19d0: 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 # NOTE: Use th
19e0: 65 20 73 70 65 63 69 66 69 65 64 20 74 65 73 74 e specified test
19f0: 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 74 68 65 version for the
1a00: 20 43 4c 52 20 76 32 2e 30 2e 0d 0a 20 20 20 20 CLR v2.0...
1a10: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1a20: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a return $:
1a30: 3a 74 65 73 74 5f 63 6c 72 5f 76 32 0d 0a 20 20 :test_clr_v2..
1a40: 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
1a50: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d .. #.
1a60: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e . # N
1a70: 4f 54 45 3a 20 55 73 65 20 74 68 65 20 64 65 66 OTE: Use the def
1a80: 61 75 6c 74 20 74 65 73 74 20 76 65 72 73 69 6f ault test versio
1a90: 6e 20 66 6f 72 20 74 68 65 20 43 4c 52 20 76 32 n for the CLR v2
1aa0: 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 .0...
1ab0: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
1ac0: 72 65 74 75 72 6e 20 32 2e 30 2e 35 30 37 32 37 return 2.0.50727
1ad0: 3b 20 23 20 54 4f 44 4f 3a 20 47 6f 6f 64 20 22 ; # TODO: Good "
1ae0: 66 61 6c 6c 62 61 63 6b 22 20 64 65 66 61 75 6c fallback" defaul
1af0: 74 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d t?.. }.
1b00: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
1b10: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
1b20: 20 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 proc getBuild
1b30: 59 65 61 72 73 20 7b 7d 20 7b 0d 0a 20 20 20 20 Years {} {..
1b40: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1b50: 45 3a 20 53 65 65 20 69 66 20 74 68 65 20 6c 69 E: See if the li
1b60: 73 74 20 6f 66 20 74 65 73 74 20 79 65 61 72 73 st of test years
1b70: 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 has been overri
1b80: 64 64 65 6e 20 62 79 20 74 68 65 20 75 73 65 72 dden by the user
1b90: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
1ba0: 28 65 2e 67 2e 20 6f 6e 20 74 68 65 20 63 6f 6d (e.g. on the com
1bb0: 6d 61 6e 64 20 6c 69 6e 65 29 2e 0d 0a 20 20 20 mand line)...
1bc0: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
1bd0: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
1be0: 65 73 74 5f 79 65 61 72 73 5d 20 26 26 20 5b 6c est_years] && [l
1bf0: 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 79 length $::test_y
1c00: 65 61 72 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 ears] > 0} then
1c10: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
1c20: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 # NOTE: Us
1c30: 65 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 e the specified
1c40: 6c 69 73 74 20 6f 66 20 74 65 73 74 20 79 65 61 list of test yea
1c50: 72 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a rs... #..
1c60: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
1c70: 3a 3a 74 65 73 74 5f 79 65 61 72 73 0d 0a 20 20 ::test_years..
1c80: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
1c90: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1ca0: 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 # NOTE: Use the
1cb0: 20 64 65 66 61 75 6c 74 20 6c 69 73 74 20 6f 66 default list of
1cc0: 20 74 65 73 74 20 79 65 61 72 73 20 28 69 2e 65 test years (i.e
1cd0: 2e 20 61 6c 6c 29 2e 0d 0a 20 20 20 20 20 20 20 . all)...
1ce0: 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 #.. retu
1cf0: 72 6e 20 5b 6c 69 73 74 20 32 30 30 35 20 32 30 rn [list 2005 20
1d00: 30 38 20 32 30 31 30 20 32 30 31 32 20 32 30 31 08 2010 2012 201
1d10: 33 20 32 30 31 35 5d 0d 0a 20 20 20 20 20 20 7d 3 2015].. }
1d20: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
1d30: 70 72 6f 63 20 67 65 74 42 75 69 6c 64 4e 65 74 proc getBuildNet
1d40: 46 78 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 Fx {} {.. #
1d50: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
1d60: 53 65 65 20 69 66 20 74 68 65 20 74 65 73 74 20 See if the test
1d70: 2e 4e 45 54 20 46 72 61 6d 65 77 6f 72 6b 20 73 .NET Framework s
1d80: 65 74 74 69 6e 67 20 68 61 73 20 62 65 65 6e 20 etting has been
1d90: 6f 76 65 72 72 69 64 64 65 6e 20 62 79 0d 0a 20 overridden by..
1da0: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 # the
1db0: 20 75 73 65 72 20 28 65 2e 67 2e 20 6f 6e 20 74 user (e.g. on t
1dc0: 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 29 he command line)
1dd0: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
1de0: 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
1df0: 74 73 20 3a 3a 74 65 73 74 5f 6e 65 74 5f 66 78 ts ::test_net_fx
1e00: 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] && \..
1e10: 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
1e20: 20 24 3a 3a 74 65 73 74 5f 6e 65 74 5f 66 78 5d $::test_net_fx]
1e30: 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
1e40: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1e50: 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 # NOTE: Use the
1e60: 20 73 70 65 63 69 66 69 65 64 20 74 65 73 74 20 specified test
1e70: 2e 4e 45 54 20 46 72 61 6d 65 77 6f 72 6b 2e 0d .NET Framework..
1e80: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1e90: 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 74 65 return $::te
1ea0: 73 74 5f 6e 65 74 5f 66 78 0d 0a 20 20 20 20 20 st_net_fx..
1eb0: 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
1ec0: 20 20 20 73 65 74 20 79 65 61 72 20 5b 67 65 74 set year [get
1ed0: 42 75 69 6c 64 59 65 61 72 5d 0d 0a 20 20 20 20 BuildYear]..
1ee0: 20 20 20 20 73 65 74 20 79 65 61 72 56 61 72 4e set yearVarN
1ef0: 61 6d 65 20 5b 61 70 70 65 6e 64 41 72 67 73 20 ame [appendArgs
1f00: 3a 3a 74 65 73 74 5f 6e 65 74 5f 66 78 5f 20 24 ::test_net_fx_ $
1f10: 79 65 61 72 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 year]....
1f20: 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
1f30: 73 20 24 79 65 61 72 56 61 72 4e 61 6d 65 5d 20 s $yearVarName]
1f40: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
1f50: 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
1f60: 20 5b 73 65 74 20 24 79 65 61 72 56 61 72 4e 61 [set $yearVarNa
1f70: 6d 65 5d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b me]] > 0} then {
1f80: 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
1f90: 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
1fa0: 20 55 73 65 20 74 68 65 20 73 70 65 63 69 66 69 Use the specifi
1fb0: 65 64 20 74 65 73 74 20 2e 4e 45 54 20 46 72 61 ed test .NET Fra
1fc0: 6d 65 77 6f 72 6b 2c 20 62 61 73 65 64 20 6f 6e mework, based on
1fd0: 20 74 68 65 20 62 75 69 6c 64 0d 0a 20 20 20 20 the build..
1fe0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 79 65 # ye
1ff0: 61 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 ar... #
2000: 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 .. retu
2010: 72 6e 20 5b 73 65 74 20 24 79 65 61 72 56 61 72 rn [set $yearVar
2020: 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 20 20 7d Name].. }
2030: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
2040: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
2050: 23 20 4e 4f 54 45 3a 20 46 61 6c 6c 62 61 63 6b # NOTE: Fallback
2060: 20 74 6f 20 74 68 65 20 22 77 65 6c 6c 20 6b 6e to the "well kn
2070: 6f 77 6e 22 20 2e 4e 45 54 20 46 72 61 6d 65 77 own" .NET Framew
2080: 6f 72 6b 20 76 65 72 73 69 6f 6e 20 74 68 61 74 ork version that
2090: 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 .. #
20a0: 20 20 20 20 69 73 20 6d 6f 73 74 20 63 6c 6f 73 is most clos
20b0: 65 6c 79 20 61 73 73 6f 63 69 61 74 65 64 20 77 ely associated w
20c0: 69 74 68 20 61 20 70 61 72 74 69 63 75 6c 61 72 ith a particular
20d0: 20 76 65 72 73 69 6f 6e 20 6f 66 0d 0a 20 20 20 version of..
20e0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 56 # V
20f0: 69 73 75 61 6c 20 53 74 75 64 69 6f 2e 0d 0a 20 isual Studio...
2100: 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
2110: 20 20 20 20 20 20 73 77 69 74 63 68 20 2d 65 78 switch -ex
2120: 61 63 74 20 2d 2d 20 24 79 65 61 72 20 7b 0d 0a act -- $year {..
2130: 20 20 20 20 20 20 20 20 20 20 20 20 32 30 30 35 2005
2140: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
2150: 20 20 72 65 74 75 72 6e 20 6e 65 74 46 78 32 30 return netFx20
2160: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
2170: 0a 20 20 20 20 20 20 20 20 20 20 20 20 32 30 30 . 200
2180: 38 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 8 {..
2190: 20 20 20 72 65 74 75 72 6e 20 6e 65 74 46 78 33 return netFx3
21a0: 35 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 5.. }
21b0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 32 30 .. 20
21c0: 31 30 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 10 {..
21d0: 20 20 20 20 72 65 74 75 72 6e 20 6e 65 74 46 78 return netFx
21e0: 34 30 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 40..
21f0: 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 32 }.. 2
2200: 30 31 32 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 012 {..
2210: 20 20 20 20 20 72 65 74 75 72 6e 20 6e 65 74 46 return netF
2220: 78 34 35 0d 0a 20 20 20 20 20 20 20 20 20 20 20 x45..
2230: 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
2240: 32 30 31 33 20 7b 0d 0a 20 20 20 20 20 20 20 20 2013 {..
2250: 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 65 74 return net
2260: 46 78 34 35 31 3b 20 23 20 54 4f 44 4f 3a 20 4f Fx451; # TODO: O
2270: 72 20 22 6e 65 74 46 78 34 35 32 22 3f 0d 0a 20 r "netFx452"?..
2280: 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
2290: 20 20 20 20 20 20 20 20 20 20 32 30 31 35 20 7b 2015 {
22a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
22b0: 72 65 74 75 72 6e 20 6e 65 74 46 78 34 36 3b 20 return netFx46;
22c0: 23 20 54 4f 44 4f 3a 20 4f 72 20 22 6e 65 74 46 # TODO: Or "netF
22d0: 78 34 36 31 22 20 2f 20 22 6e 65 74 46 78 34 36 x461" / "netFx46
22e0: 32 22 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 2"?..
22f0: 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
2300: 64 65 66 61 75 6c 74 20 7b 0d 0a 20 20 20 20 20 default {..
2310: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
2320: 6e 65 74 46 78 33 35 3b 20 23 20 54 4f 44 4f 3a netFx35; # TODO:
2330: 20 47 6f 6f 64 20 22 66 61 6c 6c 62 61 63 6b 22 Good "fallback"
2340: 20 64 65 66 61 75 6c 74 3f 0d 0a 20 20 20 20 20 default?..
2350: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
2360: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
2370: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
2380: 0d 0a 0c 0d 0a 20 20 20 20 23 0d 0a 20 20 20 20 ..... #..
2390: 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f # NOTE: This pro
23a0: 63 65 64 75 72 65 20 73 68 6f 75 6c 64 20 72 65 cedure should re
23b0: 74 75 72 6e 20 6e 6f 6e 2d 7a 65 72 6f 20 69 66 turn non-zero if
23c0: 20 74 68 65 20 63 6f 6e 66 69 67 75 72 65 64 20 the configured
23d0: 74 65 73 74 0d 0a 20 20 20 20 23 20 20 20 20 20 test.. #
23e0: 20 20 70 6c 61 74 66 6f 72 6d 20 69 73 20 6d 6f platform is mo
23f0: 73 74 20 6c 69 6b 65 6c 79 20 74 68 65 20 64 65 st likely the de
2400: 66 61 75 6c 74 20 66 6f 72 20 74 68 69 73 20 6d fault for this m
2410: 61 63 68 69 6e 65 2e 0d 0a 20 20 20 20 23 0d 0a achine... #..
2420: 20 20 20 20 70 72 6f 63 20 69 73 44 65 66 61 75 proc isDefau
2430: 6c 74 42 75 69 6c 64 50 6c 61 74 66 6f 72 6d 20 ltBuildPlatform
2440: 7b 20 7b 76 65 72 62 6f 73 65 20 74 72 75 65 7d { {verbose true}
2450: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
2460: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 75 6e # NOTE: Run
2470: 6e 69 6e 67 20 6f 6e 20 57 6f 57 36 34 20 69 73 ning on WoW64 is
2480: 20 6e 65 76 65 72 20 74 68 65 20 64 65 66 61 75 never the defau
2490: 6c 74 20 70 6c 61 74 66 6f 72 6d 2e 0d 0a 20 20 lt platform...
24a0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
24b0: 7b 5b 69 73 52 75 6e 6e 69 6e 67 57 6f 57 36 34 {[isRunningWoW64
24c0: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
24d0: 20 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d if {$verbose}
24e0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
24f0: 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
2500: 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 _channel \..
2510: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
2520: 64 65 74 65 63 74 65 64 20 6e 6f 6e 2d 64 65 66 detected non-def
2530: 61 75 6c 74 20 70 6c 61 74 66 6f 72 6d 20 28 57 ault platform (W
2540: 6f 57 36 34 29 5c 6e 22 0d 0a 20 20 20 20 20 20 oW64)\n"..
2550: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 72 }.... r
2560: 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 eturn false..
2570: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
2580: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 . # NOTE: T
2590: 68 69 73 20 68 61 73 20 61 20 67 6f 6f 64 20 63 his has a good c
25a0: 68 61 6e 63 65 20 6f 66 20 62 65 69 6e 67 20 74 hance of being t
25b0: 68 65 20 64 65 66 61 75 6c 74 20 70 6c 61 74 66 he default platf
25c0: 6f 72 6d 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 orm... #..
25d0: 20 20 20 20 20 69 66 20 7b 24 76 65 72 62 6f 73 if {$verbos
25e0: 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 e} then {..
25f0: 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
2600: 5f 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 64 _channel "---- d
2610: 65 74 65 63 74 65 64 20 64 65 66 61 75 6c 74 20 etected default
2620: 70 6c 61 74 66 6f 72 6d 5c 6e 22 0d 0a 20 20 20 platform\n"..
2630: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 }.... re
2640: 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 7d turn true.. }
2650: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
2660: 74 42 75 69 6c 64 50 6c 61 74 66 6f 72 6d 20 7b tBuildPlatform {
2670: 20 6e 61 74 69 76 65 20 7d 20 7b 0d 0a 20 20 20 native } {..
2680: 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 if {[info exi
2690: 73 74 73 20 3a 3a 74 65 73 74 5f 70 6c 61 74 66 sts ::test_platf
26a0: 6f 72 6d 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 orm] && \..
26b0: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
26c0: 67 74 68 20 24 3a 3a 74 65 73 74 5f 70 6c 61 74 gth $::test_plat
26d0: 66 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 form] > 0} then
26e0: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
26f0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 # NOTE: Us
2700: 65 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 e the specified
2710: 74 65 73 74 20 70 6c 61 74 66 6f 72 6d 2e 20 20 test platform.
2720: 49 66 20 74 68 69 73 20 76 61 72 69 61 62 6c 65 If this variable
2730: 20 69 73 20 6e 6f 74 20 73 65 74 2c 0d 0a 20 20 is not set,..
2740: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 # th
2750: 65 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 20 e default value
2760: 77 69 6c 6c 20 62 65 20 62 61 73 65 64 20 6f 6e will be based on
2770: 20 74 68 65 20 6d 61 63 68 69 6e 65 20 61 72 63 the machine arc
2780: 68 69 74 65 63 74 75 72 65 2e 0d 0a 20 20 20 20 hitecture...
2790: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
27a0: 65 74 75 72 6e 20 5b 65 78 70 72 20 7b 24 6e 61 eturn [expr {$na
27b0: 74 69 76 65 20 3f 20 24 3a 3a 74 65 73 74 5f 70 tive ? $::test_p
27c0: 6c 61 74 66 6f 72 6d 20 3a 20 22 22 7d 5d 0d 0a latform : ""}]..
27d0: 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b } elseif {
27e0: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
27f0: 65 73 74 5f 6d 61 63 68 69 6e 65 5d 20 26 26 20 est_machine] &&
2800: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 \.. [st
2810: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 ring length $::t
2820: 65 73 74 5f 6d 61 63 68 69 6e 65 5d 20 3e 20 30 est_machine] > 0
2830: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
2840: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
2850: 4f 54 45 3a 20 46 6f 72 20 6e 61 74 69 76 65 20 OTE: For native
2860: 62 75 69 6c 64 73 2c 20 72 65 74 75 72 6e 20 74 builds, return t
2870: 68 65 20 70 6c 61 74 66 6f 72 6d 20 6e 61 6d 65 he platform name
2880: 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 corresponding t
2890: 6f 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 o.. #
28a0: 20 20 20 74 68 65 20 74 65 73 74 20 6d 61 63 68 the test mach
28b0: 69 6e 65 20 61 72 63 68 69 74 65 63 74 75 72 65 ine architecture
28c0: 3b 20 6f 74 68 65 72 77 69 73 65 2c 20 72 65 74 ; otherwise, ret
28d0: 75 72 6e 20 61 6e 20 65 6d 70 74 79 0d 0a 20 20 urn an empty..
28e0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 74 # st
28f0: 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 20 20 23 ring... #
2900: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
2910: 20 5b 65 78 70 72 20 7b 0d 0a 20 20 20 20 20 20 [expr {..
2920: 20 20 20 20 24 6e 61 74 69 76 65 20 3f 20 5b 6d $native ? [m
2930: 61 63 68 69 6e 65 54 6f 50 6c 61 74 66 6f 72 6d achineToPlatform
2940: 20 24 3a 3a 74 65 73 74 5f 6d 61 63 68 69 6e 65 $::test_machine
2950: 5d 20 3a 20 22 22 0d 0a 20 20 20 20 20 20 20 20 ] : ""..
2960: 7d 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 }].. } else
2970: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
2980: 20 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 ::tcl_platform(
2990: 6d 61 63 68 69 6e 65 29 5d 7d 20 74 68 65 6e 20 machine)]} then
29a0: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
29b0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 6f # NOTE: Fo
29c0: 72 20 6e 61 74 69 76 65 20 62 75 69 6c 64 73 2c r native builds,
29d0: 20 72 65 74 75 72 6e 20 74 68 65 20 70 6c 61 74 return the plat
29e0: 66 6f 72 6d 20 6e 61 6d 65 20 63 6f 72 72 65 73 form name corres
29f0: 70 6f 6e 64 69 6e 67 20 74 6f 0d 0a 20 20 20 20 ponding to..
2a00: 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 # the
2a10: 6d 61 63 68 69 6e 65 20 61 72 63 68 69 74 65 63 machine architec
2a20: 74 75 72 65 3b 20 6f 74 68 65 72 77 69 73 65 2c ture; otherwise,
2a30: 20 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 return an empty
2a40: 20 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 string...
2a50: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
2a60: 75 72 6e 20 5b 65 78 70 72 20 7b 0d 0a 20 20 20 urn [expr {..
2a70: 20 20 20 20 20 20 20 24 6e 61 74 69 76 65 20 3f $native ?
2a80: 20 5b 6d 61 63 68 69 6e 65 54 6f 50 6c 61 74 66 [machineToPlatf
2a90: 6f 72 6d 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 orm $::tcl_platf
2aa0: 6f 72 6d 28 6d 61 63 68 69 6e 65 29 5d 20 3a 20 orm(machine)] :
2ab0: 22 22 0d 0a 20 20 20 20 20 20 20 20 7d 5d 0d 0a "".. }]..
2ac0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
2ad0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
2ae0: 20 20 20 23 20 4e 4f 54 45 3a 20 4e 6f 20 6d 61 # NOTE: No ma
2af0: 63 68 69 6e 65 20 61 72 63 68 69 74 65 63 74 75 chine architectu
2b00: 72 65 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2c re is available,
2b10: 20 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 return an empty
2b20: 20 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 string...
2b30: 20 20 23 20 20 20 20 20 20 20 49 74 20 69 73 20 # It is
2b40: 69 6d 70 6f 72 74 61 6e 74 20 74 6f 20 72 65 74 important to ret
2b50: 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 73 74 72 urn an empty str
2b60: 69 6e 67 20 68 65 72 65 20 62 65 63 61 75 73 65 ing here because
2b70: 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 the.. #
2b80: 20 20 20 20 20 20 72 65 73 75 6c 74 20 6f 66 20 result of
2b90: 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 6d this procedure m
2ba0: 61 79 20 62 65 20 75 73 65 64 20 77 69 74 68 20 ay be used with
2bb0: 5b 66 69 6c 65 20 6a 6f 69 6e 5d 2e 0d 0a 20 20 [file join]...
2bc0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
2bd0: 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 return ""..
2be0: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
2bf0: 20 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 proc getBuild
2c00: 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 7b 7d Configuration {}
2c10: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
2c20: 20 20 20 23 20 4e 4f 54 45 3a 20 53 65 65 20 69 # NOTE: See i
2c30: 66 20 74 68 65 20 22 63 6f 6e 66 69 67 75 72 61 f the "configura
2c40: 74 69 6f 6e 22 20 73 65 74 74 69 6e 67 20 68 61 tion" setting ha
2c50: 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 64 65 s been overridde
2c60: 6e 20 62 79 20 74 68 65 0d 0a 20 20 20 20 20 20 n by the..
2c70: 23 20 20 20 20 20 20 20 75 73 65 72 20 28 65 2e # user (e.
2c80: 67 2e 20 6f 6e 20 74 68 65 20 63 6f 6d 6d 61 6e g. on the comman
2c90: 64 20 6c 69 6e 65 29 2e 20 20 54 68 69 73 20 68 d line). This h
2ca0: 65 6c 70 73 20 63 6f 6e 74 72 6f 6c 20 65 78 61 elps control exa
2cb0: 63 74 6c 79 0d 0a 20 20 20 20 20 20 23 20 20 20 ctly.. #
2cc0: 20 20 20 20 77 68 69 63 68 20 73 65 74 20 6f 66 which set of
2cd0: 20 62 69 6e 61 72 69 65 73 20 77 65 20 61 72 65 binaries we are
2ce0: 20 74 65 73 74 69 6e 67 20 28 69 2e 65 2e 20 74 testing (i.e. t
2cf0: 68 6f 73 65 20 62 75 69 6c 74 20 69 6e 20 74 68 hose built in th
2d00: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
2d10: 20 22 44 65 62 75 67 22 20 6f 72 20 22 52 65 6c "Debug" or "Rel
2d20: 65 61 73 65 22 20 62 75 69 6c 64 20 63 6f 6e 66 ease" build conf
2d30: 69 67 75 72 61 74 69 6f 6e 73 29 2e 20 20 54 6f igurations). To
2d40: 20 6f 76 65 72 72 69 64 65 20 74 68 69 73 0d 0a override this..
2d50: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 61 # va
2d60: 6c 75 65 20 76 69 61 20 74 68 65 20 63 6f 6d 6d lue via the comm
2d70: 61 6e 64 20 6c 69 6e 65 2c 20 65 6e 74 65 72 20 and line, enter
2d80: 61 20 63 6f 6d 6d 61 6e 64 20 73 69 6d 69 6c 61 a command simila
2d90: 72 20 74 6f 20 6f 6e 65 20 6f 66 0d 0a 20 20 20 r to one of..
2da0: 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 66 # the f
2db0: 6f 6c 6c 6f 77 69 6e 67 20 28 61 6c 6c 20 6f 6e ollowing (all on
2dc0: 20 6f 6e 65 20 6c 69 6e 65 29 3a 0d 0a 20 20 20 one line):..
2dd0: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 #.. #
2de0: 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 EagleShell.e
2df0: 78 65 20 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a xe -anyInitializ
2e00: 65 20 22 73 65 74 20 74 65 73 74 5f 63 6f 6e 66 e "set test_conf
2e10: 69 67 75 72 61 74 69 6f 6e 20 44 65 62 75 67 22 iguration Debug"
2e20: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
2e30: 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 -file .\path\t
2e40: 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 o\all.eagle..
2e50: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 #.. #
2e60: 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 EagleShell.e
2e70: 78 65 20 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a xe -anyInitializ
2e80: 65 20 22 73 65 74 20 74 65 73 74 5f 63 6f 6e 66 e "set test_conf
2e90: 69 67 75 72 61 74 69 6f 6e 20 52 65 6c 65 61 73 iguration Releas
2ea0: 65 22 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 e".. #
2eb0: 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 -file .\path
2ec0: 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 \to\all.eagle..
2ed0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
2ee0: 20 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c EagleShell
2ef0: 2e 65 78 65 20 2d 66 69 6c 65 20 2e 5c 70 61 74 .exe -file .\pat
2f00: 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 20 2d h\to\all.eagle -
2f10: 70 72 65 54 65 73 74 0d 0a 20 20 20 20 20 20 23 preTest.. #
2f20: 20 20 20 20 20 20 20 20 20 22 75 6e 73 65 74 20 "unset
2f30: 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 74 65 73 74 -nocomplain test
2f40: 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 22 0d _configuration".
2f50: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
2f60: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
2f70: 20 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 ::test_configur
2f80: 61 74 69 6f 6e 5d 20 26 26 20 5c 0d 0a 20 20 20 ation] && \..
2f90: 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c [string l
2fa0: 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 63 6f ength $::test_co
2fb0: 6e 66 69 67 75 72 61 74 69 6f 6e 5d 20 3e 20 30 nfiguration] > 0
2fc0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
2fd0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
2fe0: 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 OTE: Use the spe
2ff0: 63 69 66 69 65 64 20 74 65 73 74 20 63 6f 6e 66 cified test conf
3000: 69 67 75 72 61 74 69 6f 6e 2e 20 20 54 68 65 20 iguration. The
3010: 64 65 66 61 75 6c 74 20 76 61 6c 75 65 20 75 73 default value us
3020: 65 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ed.. #
3030: 20 20 20 20 66 6f 72 20 74 68 69 73 20 76 61 72 for this var
3040: 69 61 62 6c 65 20 69 73 20 74 79 70 69 63 61 6c iable is typical
3050: 6c 79 20 22 52 65 6c 65 61 73 65 22 2c 20 61 73 ly "Release", as
3060: 20 73 65 74 20 62 79 20 74 68 65 20 74 65 73 74 set by the test
3070: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
3080: 20 20 73 75 69 74 65 20 69 74 73 65 6c 66 2e 0d suite itself..
3090: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
30a0: 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 74 65 return $::te
30b0: 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e st_configuration
30c0: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
30d0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
30e0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4e 6f 72 # NOTE: Nor
30f0: 6d 61 6c 6c 79 2c 20 77 65 20 77 69 6c 6c 20 6e mally, we will n
3100: 65 76 65 72 20 68 69 74 20 74 68 69 73 20 63 61 ever hit this ca
3110: 73 65 20 62 65 63 61 75 73 65 20 74 68 65 20 76 se because the v
3120: 61 6c 75 65 20 6f 66 20 74 68 65 0d 0a 20 20 20 alue of the..
3130: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 65 73 # tes
3140: 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 t configuration
3150: 76 61 72 69 61 62 6c 65 20 69 73 20 61 6c 77 61 variable is alwa
3160: 79 73 20 73 65 74 20 62 79 20 74 68 65 20 74 65 ys set by the te
3170: 73 74 20 73 75 69 74 65 0d 0a 20 20 20 20 20 20 st suite..
3180: 20 20 23 20 20 20 20 20 20 20 69 74 73 65 6c 66 # itself
3190: 3b 20 68 6f 77 65 76 65 72 2c 20 69 74 20 63 61 ; however, it ca
31a0: 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 n be overridden
31b0: 75 73 69 6e 67 20 74 68 65 20 75 6e 73 65 74 20 using the unset
31c0: 63 6f 6d 6d 61 6e 64 0d 0a 20 20 20 20 20 20 20 command..
31d0: 20 23 20 20 20 20 20 20 20 66 72 6f 6d 20 74 68 # from th
31e0: 65 20 2d 70 72 65 54 65 73 74 20 6f 70 74 69 6f e -preTest optio
31f0: 6e 20 74 6f 20 74 68 65 20 74 65 73 74 20 73 75 n to the test su
3200: 69 74 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ite... #.
3210: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
3220: 24 3a 3a 65 61 67 6c 65 5f 70 6c 61 74 66 6f 72 $::eagle_platfor
3230: 6d 28 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 29 m(configuration)
3240: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
3250: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
3260: 74 42 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 74 tBuildConfigurat
3270: 69 6f 6e 73 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 ions {} {..
3280: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
3290: 3a 20 53 65 65 20 69 66 20 74 68 65 20 6c 69 73 : See if the lis
32a0: 74 20 6f 66 20 74 65 73 74 20 63 6f 6e 66 69 67 t of test config
32b0: 75 72 61 74 69 6f 6e 73 20 68 61 73 20 62 65 65 urations has bee
32c0: 6e 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 0d n overridden by.
32d0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 . # t
32e0: 68 65 20 75 73 65 72 20 28 65 2e 67 2e 20 6f 6e he user (e.g. on
32f0: 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e the command lin
3300: 65 29 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 e)... #..
3310: 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
3320: 69 73 74 73 20 3a 3a 74 65 73 74 5f 63 6f 6e 66 ists ::test_conf
3330: 69 67 75 72 61 74 69 6f 6e 73 5d 20 26 26 20 5c igurations] && \
3340: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 6c 6c 65 .. [lle
3350: 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 63 6f 6e ngth $::test_con
3360: 66 69 67 75 72 61 74 69 6f 6e 73 5d 20 3e 20 30 figurations] > 0
3370: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
3380: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
3390: 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 OTE: Use the spe
33a0: 63 69 66 69 65 64 20 6c 69 73 74 20 6f 66 20 74 cified list of t
33b0: 65 73 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f est configuratio
33c0: 6e 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ns... #..
33d0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
33e0: 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 ::test_configura
33f0: 74 69 6f 6e 73 0d 0a 20 20 20 20 20 20 7d 20 65 tions.. } e
3400: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 lse {.. #
3410: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
3420: 3a 20 55 73 65 20 74 68 65 20 64 65 66 61 75 6c : Use the defaul
3430: 74 20 6c 69 73 74 20 6f 66 20 74 65 73 74 20 63 t list of test c
3440: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 73 2e 0d 0a onfigurations...
3450: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
3460: 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 return [list
3470: 44 65 62 75 67 20 52 65 6c 65 61 73 65 5d 0d 0a Debug Release]..
3480: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
3490: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 ... proc getB
34a0: 75 69 6c 64 42 61 73 65 44 69 72 65 63 74 6f 72 uildBaseDirector
34b0: 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d y {} {.. #.
34c0: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 . # NOTE: F
34d0: 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 62 61 igure out the ba
34e0: 73 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 se directory whe
34f0: 72 65 20 61 6c 6c 20 74 68 65 20 62 75 69 6c 64 re all the build
3500: 73 20 73 68 6f 75 6c 64 20 62 65 0d 0a 20 20 20 s should be..
3510: 20 20 20 23 20 20 20 20 20 20 20 6c 6f 63 61 74 # locat
3520: 65 64 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 62 ed. This will b
3530: 65 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 e the directory
3540: 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 that contains th
3550: 65 20 61 63 74 75 61 6c 0d 0a 20 20 20 20 20 20 e actual..
3560: 23 20 20 20 20 20 20 20 62 75 69 6c 64 20 6f 75 # build ou
3570: 74 70 75 74 20 64 69 72 65 63 74 6f 72 79 20 28 tput directory (
3580: 65 2e 67 2e 20 70 61 72 65 6e 74 20 6f 66 20 22 e.g. parent of "
3590: 62 69 6e 22 29 2e 0d 0a 20 20 20 20 20 20 23 0d bin")... #.
35a0: 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f . if {[info
35b0: 20 65 78 69 73 74 73 20 3a 3a 62 75 69 6c 64 5f exists ::build_
35c0: 62 61 73 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 base_directory]
35d0: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
35e0: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
35f0: 3a 3a 62 75 69 6c 64 5f 62 61 73 65 5f 64 69 72 ::build_base_dir
3600: 65 63 74 6f 72 79 5d 20 3e 20 30 7d 20 74 68 65 ectory] > 0} the
3610: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
3620: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
3630: 54 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 The location of
3640: 74 68 65 20 62 75 69 6c 64 20 62 61 73 65 20 64 the build base d
3650: 69 72 65 63 74 6f 72 79 20 68 61 73 20 62 65 65 irectory has bee
3660: 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d 0a 20 n overridden;..
3670: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
3680: 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 herefore, use it
3690: 20 76 65 72 62 61 74 69 6d 2e 0d 0a 20 20 20 20 verbatim...
36a0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
36b0: 65 74 75 72 6e 20 24 3a 3a 62 75 69 6c 64 5f 62 eturn $::build_b
36c0: 61 73 65 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 ase_directory..
36d0: 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b } elseif {[
36e0: 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 63 6f info exists ::co
36f0: 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 5d 20 mmon_directory]
3700: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
3710: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
3720: 3a 3a 63 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f ::common_directo
3730: 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d ry] > 0} then {.
3740: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
3750: 20 20 20 20 23 20 4e 4f 54 45 3a 20 4e 65 78 74 # NOTE: Next
3760: 2c 20 66 61 6c 6c 62 61 63 6b 20 74 6f 20 74 68 , fallback to th
3770: 65 20 67 72 61 6e 64 70 61 72 65 6e 74 20 64 69 e grandparent di
3780: 72 65 63 74 6f 72 79 20 6f 66 20 74 68 65 20 6f rectory of the o
3790: 6e 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ne.. #
37a0: 20 20 20 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 containing t
37b0: 68 69 73 20 66 69 6c 65 20 28 69 2e 65 2e 20 22 his file (i.e. "
37c0: 63 6f 6d 6d 6f 6e 2e 65 61 67 6c 65 22 29 2c 20 common.eagle"),
37d0: 69 66 20 61 76 61 69 6c 61 62 6c 65 2e 0d 0a 20 if available...
37e0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
37f0: 20 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 64 return [file d
3800: 69 72 6e 61 6d 65 20 5b 66 69 6c 65 20 64 69 72 irname [file dir
3810: 6e 61 6d 65 20 24 3a 3a 63 6f 6d 6d 6f 6e 5f 64 name $::common_d
3820: 69 72 65 63 74 6f 72 79 5d 5d 0d 0a 20 20 20 20 irectory]]..
3830: 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 } elseif {[inf
3840: 6f 20 65 78 69 73 74 73 20 3a 3a 70 61 74 68 5d o exists ::path]
3850: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
3860: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
3870: 24 3a 3a 70 61 74 68 5d 20 3e 20 30 7d 20 74 68 $::path] > 0} th
3880: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
3890: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
38a0: 20 46 69 6e 61 6c 6c 79 2c 20 66 61 6c 6c 62 61 Finally, fallba
38b0: 63 6b 20 74 6f 20 74 68 65 20 70 61 72 65 6e 74 ck to the parent
38c0: 20 64 69 72 65 63 74 6f 72 79 20 6f 66 20 74 68 directory of th
38d0: 65 20 45 61 67 6c 65 54 65 73 74 0d 0a 20 20 20 e EagleTest..
38e0: 20 20 20 20 20 23 20 20 20 20 20 20 20 70 61 74 # pat
38f0: 68 2e 20 20 54 68 65 20 45 61 67 6c 65 54 65 73 h. The EagleTes
3900: 74 20 70 61 63 6b 61 67 65 20 67 75 61 72 61 6e t package guaran
3910: 74 65 65 73 20 74 68 61 74 20 74 68 69 73 20 76 tees that this v
3920: 61 72 69 61 62 6c 65 0d 0a 20 20 20 20 20 20 20 ariable..
3930: 20 23 20 20 20 20 20 20 20 77 69 6c 6c 20 62 65 # will be
3940: 20 73 65 74 20 74 6f 20 74 68 65 20 64 69 72 65 set to the dire
3950: 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e 67 ctory containing
3960: 20 74 68 65 20 66 69 72 73 74 20 66 69 6c 65 20 the first file
3970: 74 6f 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 to.. #
3980: 20 20 20 20 65 78 65 63 75 74 65 20 74 68 65 20 execute the
3990: 5b 72 75 6e 54 65 73 74 50 72 6f 6c 6f 67 75 65 [runTestPrologue
39a0: 5d 20 73 63 72 69 70 74 20 6c 69 62 72 61 72 79 ] script library
39b0: 20 70 72 6f 63 65 64 75 72 65 2e 0d 0a 20 20 20 procedure...
39c0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
39d0: 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 64 69 72 return [file dir
39e0: 6e 61 6d 65 20 24 3a 3a 70 61 74 68 5d 0d 0a 20 name $::path]..
39f0: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
3a00: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
3a10: 20 20 23 20 4e 4f 54 45 3a 20 4e 6f 20 70 61 74 # NOTE: No pat
3a20: 68 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2c 20 h is available,
3a30: 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 return an empty
3a40: 73 74 72 69 6e 67 2e 20 20 54 68 69 73 20 70 6f string. This po
3a50: 69 6e 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 int.. #
3a60: 20 20 20 20 20 73 68 6f 75 6c 64 20 6e 6f 74 20 should not
3a70: 62 65 20 72 65 61 63 68 65 64 2e 0d 0a 20 20 20 be reached...
3a80: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
3a90: 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 20 return ""..
3aa0: 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
3ab0: 20 20 70 72 6f 63 20 67 65 74 53 51 4c 69 74 65 proc getSQLite
3ac0: 54 65 73 74 44 61 74 61 50 61 74 68 20 7b 7d 20 TestDataPath {}
3ad0: 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
3ae0: 20 20 23 20 4e 4f 54 45 3a 20 46 69 67 75 72 65 # NOTE: Figure
3af0: 20 6f 75 74 20 74 68 65 20 64 69 72 65 63 74 6f out the directo
3b00: 72 79 20 77 68 65 72 65 20 61 6c 6c 20 74 68 65 ry where all the
3b10: 20 74 65 73 74 20 64 61 74 61 20 66 69 6c 65 73 test data files
3b20: 20 73 68 6f 75 6c 64 0d 0a 20 20 20 20 20 20 23 should.. #
3b30: 20 20 20 20 20 20 20 62 65 20 6c 6f 63 61 74 65 be locate
3b40: 64 2e 20 20 54 68 69 73 20 73 68 6f 75 6c 64 20 d. This should
3b50: 62 65 20 74 68 65 20 22 64 61 74 61 22 20 64 69 be the "data" di
3b60: 72 65 63 74 6f 72 79 20 62 65 6e 65 61 74 68 20 rectory beneath
3b70: 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 the.. #
3b80: 20 20 20 64 69 72 65 63 74 6f 72 79 20 63 6f 6e directory con
3b90: 74 61 69 6e 69 6e 67 20 74 68 65 20 61 63 74 75 taining the actu
3ba0: 61 6c 20 74 65 73 74 20 73 63 72 69 70 74 73 2e al test scripts.
3bb0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
3bc0: 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 6a 6f return [file jo
3bd0: 69 6e 20 24 3a 3a 70 61 74 68 20 64 61 74 61 5d in $::path data]
3be0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
3bf0: 70 72 6f 63 20 69 73 52 75 6e 6e 69 6e 67 57 6f proc isRunningWo
3c00: 57 36 34 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 W64 {} {..
3c10: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
3c20: 20 46 6f 72 20 6e 6f 77 2c 20 6a 75 73 74 20 75 For now, just u
3c30: 73 65 20 74 68 65 20 65 78 69 73 74 69 6e 67 20 se the existing
3c40: 74 65 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 20 test constraint
3c50: 66 6f 72 20 64 65 74 65 63 74 69 6e 67 0d 0a 20 for detecting..
3c60: 20 20 20 20 20 23 20 20 20 20 20 20 20 61 20 57 # a W
3c70: 6f 57 36 34 20 70 72 6f 63 65 73 73 2e 0d 0a 20 oW64 process...
3c80: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 #.. re
3c90: 74 75 72 6e 20 5b 68 61 76 65 43 6f 6e 73 74 72 turn [haveConstr
3ca0: 61 69 6e 74 20 77 6f 77 36 34 5d 0d 0a 20 20 20 aint wow64]..
3cb0: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
3cc0: 69 73 4d 69 78 65 64 4d 6f 64 65 41 73 73 65 6d isMixedModeAssem
3cd0: 62 6c 79 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7b bly { fileName {
3ce0: 76 61 72 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d varName ""} } {.
3cf0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
3d00: 23 20 4e 4f 54 45 3a 20 46 69 72 73 74 2c 20 6d # NOTE: First, m
3d10: 61 6b 65 20 73 75 72 65 20 74 68 65 20 74 65 73 ake sure the tes
3d20: 74 20 73 75 69 74 65 20 69 6e 66 72 61 73 74 72 t suite infrastr
3d30: 75 63 74 75 72 65 20 69 73 20 61 6c 6c 6f 77 65 ucture is allowe
3d40: 64 20 74 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 d to.. #
3d50: 20 20 20 20 75 73 65 20 74 68 65 20 5b 65 78 65 use the [exe
3d60: 63 5d 20 63 6f 6d 6d 61 6e 64 2e 0d 0a 20 20 20 c] command...
3d70: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
3d80: 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
3d90: 6e 6f 28 65 78 65 63 29 5d 20 26 26 20 21 5b 69 no(exec)] && ![i
3da0: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
3db0: 63 6f 72 46 6c 61 67 73 29 5d 7d 20 74 68 65 6e corFlags)]} then
3dc0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
3dd0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 # NOTE: I
3de0: 66 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f f the location o
3df0: 66 20 43 6f 72 46 6c 61 67 73 20 69 73 20 70 72 f CorFlags is pr
3e00: 65 73 65 6e 74 20 69 6e 20 74 68 65 20 65 6e 76 esent in the env
3e10: 69 72 6f 6e 6d 65 6e 74 2c 0d 0a 20 20 20 20 20 ironment,..
3e20: 20 20 20 23 20 20 20 20 20 20 20 75 73 65 20 69 # use i
3e30: 74 3b 20 6f 74 68 65 72 77 69 73 65 20 61 73 73 t; otherwise ass
3e40: 75 6d 65 20 69 74 20 69 73 20 69 6e 20 74 68 65 ume it is in the
3e50: 20 50 41 54 48 2e 0d 0a 20 20 20 20 20 20 20 20 PATH...
3e60: 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 63 #.. set c
3e70: 6f 72 46 6c 61 67 73 20 5b 65 78 70 72 20 7b 0d orFlags [expr {.
3e80: 0a 20 20 20 20 20 20 20 20 20 20 5b 69 6e 66 6f . [info
3e90: 20 65 78 69 73 74 73 20 3a 3a 65 6e 76 28 43 6f exists ::env(Co
3ea0: 72 46 6c 61 67 73 29 5d 20 3f 20 24 3a 3a 65 6e rFlags)] ? $::en
3eb0: 76 28 43 6f 72 46 6c 61 67 73 29 20 3a 20 22 43 v(CorFlags) : "C
3ec0: 6f 72 46 6c 61 67 73 22 0d 0a 20 20 20 20 20 20 orFlags"..
3ed0: 20 20 7d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }]....
3ee0: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
3ef0: 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 65 78 E: Attempt to ex
3f00: 65 63 75 74 65 20 43 6f 72 46 6c 61 67 73 20 6f ecute CorFlags o
3f10: 6e 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 n the specified
3f20: 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 file... #
3f30: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 .. if {[c
3f40: 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
3f50: 20 20 65 78 65 63 20 2d 2d 20 24 63 6f 72 46 6c exec -- $corFl
3f60: 61 67 73 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 ags [file native
3f70: 6e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 5d 0d name $fileName].
3f80: 0a 20 20 20 20 20 20 20 20 7d 20 65 78 65 63 5d . } exec]
3f90: 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
3fa0: 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
3fb0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 # NOTE: If
3fc0: 20 72 65 71 75 65 73 74 65 64 20 62 79 20 6f 75 requested by ou
3fd0: 72 20 63 61 6c 6c 65 72 2c 20 61 74 74 65 6d 70 r caller, attemp
3fe0: 74 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 t to determine t
3ff0: 68 65 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 he.. #
4000: 20 20 20 20 20 20 70 6c 61 74 66 6f 72 6d 20 66 platform f
4010: 6f 72 20 74 68 65 20 73 70 65 63 69 66 69 65 64 or the specified
4020: 20 66 69 6c 65 20 61 73 20 77 65 6c 6c 2e 0d 0a file as well...
4030: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
4040: 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 if {[stri
4050: 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 ng length $varNa
4060: 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d me] > 0} then {.
4070: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
4080: 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f # NO
4090: 54 45 3a 20 53 74 6f 72 65 20 74 68 65 20 70 6c TE: Store the pl
40a0: 61 74 66 6f 72 6d 20 69 6e 20 74 68 65 20 6e 61 atform in the na
40b0: 6d 65 64 20 76 61 72 69 61 62 6c 65 20 69 6e 20 med variable in
40c0: 74 68 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 the..
40d0: 20 23 20 20 20 20 20 20 20 63 6f 6e 74 65 78 74 # context
40e0: 20 6f 66 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d of our caller..
40f0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
4100: 20 20 20 20 20 20 20 20 20 20 20 20 75 70 76 61 upva
4110: 72 20 31 20 24 76 61 72 4e 61 6d 65 20 70 6c 61 r 1 $varName pla
4120: 74 66 6f 72 6d 0d 0a 0d 0a 20 20 20 20 20 20 20 tform....
4130: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
4140: 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 # NOTE: Atte
4150: 6d 70 74 20 74 6f 20 65 78 74 72 61 63 74 20 74 mpt to extract t
4160: 68 65 20 50 45 20 6c 69 6e 65 20 66 72 6f 6d 20 he PE line from
4170: 74 68 65 20 63 61 70 74 75 72 65 64 0d 0a 20 20 the captured..
4180: 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
4190: 20 20 6f 75 74 70 75 74 2e 20 20 49 66 20 74 68 output. If th
41a0: 69 73 20 76 61 6c 75 65 20 69 73 20 22 50 45 33 is value is "PE3
41b0: 32 22 20 6f 72 20 22 50 45 33 32 2b 22 2c 20 74 2" or "PE32+", t
41c0: 68 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 he..
41d0: 23 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c 79 # assembly
41e0: 20 66 69 6c 65 20 69 73 20 33 32 2d 62 69 74 20 file is 32-bit
41f0: 6f 72 20 36 34 2d 62 69 74 2c 20 72 65 73 70 65 or 64-bit, respe
4200: 63 74 69 76 65 6c 79 3b 0d 0a 20 20 20 20 20 20 ctively;..
4210: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 74 # ot
4220: 68 65 72 77 69 73 65 2c 20 69 74 73 20 74 79 70 herwise, its typ
4230: 65 20 69 73 20 75 6e 6b 6e 6f 77 6e 2e 0d 0a 20 e is unknown...
4240: 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
4250: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 70 61 set pa
4260: 74 74 65 72 6e 20 7b 5e 50 45 20 20 20 20 20 20 ttern {^PE
4270: 20 20 3a 20 28 50 45 33 32 7c 50 45 33 32 5c 2b : (PE32|PE32\+
4280: 29 5c 73 2b 24 7d 0d 0a 0d 0a 20 20 20 20 20 20 )\s+$}....
4290: 20 20 20 20 20 20 69 66 20 7b 5b 72 65 67 65 78 if {[regex
42a0: 70 20 2d 6c 69 6e 65 20 2d 2d 20 24 70 61 74 74 p -line -- $patt
42b0: 65 72 6e 20 24 65 78 65 63 20 64 75 6d 6d 79 20 ern $exec dummy
42c0: 70 65 33 32 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 pe32]} then {..
42d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
42e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
42f0: 48 41 43 4b 3a 20 54 68 69 73 20 5b 73 77 69 74 HACK: This [swit
4300: 63 68 5d 20 61 73 73 75 6d 65 73 20 74 68 61 74 ch] assumes that
4310: 20 33 32 2d 62 69 74 20 65 78 65 63 75 74 61 62 32-bit executab
4320: 6c 65 73 20 61 72 65 0d 0a 20 20 20 20 20 20 20 les are..
4330: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 # a
4340: 6c 77 61 79 73 20 78 38 36 20 61 6e 64 20 74 68 lways x86 and th
4350: 61 74 20 36 34 2d 62 69 74 20 65 78 65 63 75 74 at 64-bit execut
4360: 61 62 6c 65 73 20 61 72 65 20 61 6c 77 61 79 73 ables are always
4370: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
4380: 23 20 20 20 20 20 20 20 78 36 34 2e 0d 0a 20 20 # x64...
4390: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
43a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 73 77 69 swi
43b0: 74 63 68 20 2d 65 78 61 63 74 20 2d 2d 20 24 70 tch -exact -- $p
43c0: 65 33 32 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 e32 {..
43d0: 20 20 20 20 20 20 20 50 45 33 32 20 7b 0d 0a 20 PE32 {..
43e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
43f0: 20 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 57 69 set platform Wi
4400: 6e 33 32 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n32..
4410: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
4420: 20 20 20 20 20 20 20 20 50 45 33 32 2b 20 7b 0d PE32+ {.
4430: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
4440: 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 set platform
4450: 78 36 34 0d 0a 20 20 20 20 20 20 20 20 20 20 20 x64..
4460: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
4470: 20 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 20 default
4480: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
4490: 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 set platfor
44a0: 6d 20 22 22 0d 0a 20 20 20 20 20 20 20 20 20 20 m ""..
44b0: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
44c0: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
44d0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
44e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 se
44f0: 74 20 70 6c 61 74 66 6f 72 6d 20 22 22 0d 0a 20 t platform ""..
4500: 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
4510: 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
4520: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
4530: 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 # NOTE: Atte
4540: 6d 70 74 20 74 6f 20 65 78 74 72 61 63 74 20 74 mpt to extract t
4550: 68 65 20 49 4c 4f 4e 4c 59 20 6c 69 6e 65 20 66 he ILONLY line f
4560: 72 6f 6d 20 74 68 65 20 63 61 70 74 75 72 65 64 rom the captured
4570: 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 .. #
4580: 20 20 20 20 6f 75 74 70 75 74 2e 20 20 49 66 20 output. If
4590: 74 68 69 73 20 76 61 6c 75 65 20 69 73 20 7a 65 this value is ze
45a0: 72 6f 2c 20 74 68 65 20 73 70 65 63 69 66 69 65 ro, the specifie
45b0: 64 20 66 69 6c 65 20 6d 75 73 74 0d 0a 20 20 20 d file must..
45c0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 # b
45d0: 65 20 61 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 e a mixed-mode a
45e0: 73 73 65 6d 62 6c 79 3b 20 6f 74 68 65 72 77 69 ssembly; otherwi
45f0: 73 65 2c 20 69 74 20 63 6f 6e 74 61 69 6e 73 20 se, it contains
4600: 6f 6e 6c 79 0d 0a 20 20 20 20 20 20 20 20 20 20 only..
4610: 23 20 20 20 20 20 20 20 6d 61 6e 61 67 65 64 20 # managed
4620: 63 6f 6d 70 6f 6e 65 6e 74 73 2e 0d 0a 20 20 20 components...
4630: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
4640: 20 20 20 20 73 65 74 20 70 61 74 74 65 72 6e 20 set pattern
4650: 7b 5e 49 4c 4f 4e 4c 59 20 20 20 20 3a 20 28 30 {^ILONLY : (0
4660: 7c 31 29 5c 73 2b 24 7d 0d 0a 0d 0a 20 20 20 20 |1)\s+$}....
4670: 20 20 20 20 20 20 69 66 20 7b 21 5b 72 65 67 65 if {![rege
4680: 78 70 20 2d 6c 69 6e 65 20 2d 2d 20 24 70 61 74 xp -line -- $pat
4690: 74 65 72 6e 20 24 65 78 65 63 20 64 75 6d 6d 79 tern $exec dummy
46a0: 20 69 6c 4f 6e 6c 79 5d 7d 20 74 68 65 6e 20 7b ilOnly]} then {
46b0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
46c0: 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 turn false..
46d0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
46e0: 20 20 20 20 20 69 66 20 7b 21 24 69 6c 4f 6e 6c if {!$ilOnl
46f0: 79 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 y} then {..
4700: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
4710: 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d ue.. }.
4720: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
4730: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
4740: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 # NOTE: If
4750: 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 20 the test suite
4760: 63 61 6e 6e 6f 74 20 75 73 65 20 5b 65 78 65 63 cannot use [exec
4770: 5d 20 6f 72 20 65 78 65 63 75 74 69 6f 6e 20 6f ] or execution o
4780: 66 20 43 6f 72 46 6c 61 67 73 0d 0a 20 20 20 20 f CorFlags..
4790: 20 20 23 20 20 20 20 20 20 20 66 61 69 6c 65 64 # failed
47a0: 2c 20 72 65 74 75 72 6e 20 66 61 6c 73 65 2e 0d , return false..
47b0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
47c0: 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 return false..
47d0: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
47e0: 20 67 65 74 4e 61 74 69 76 65 4c 69 62 72 61 72 getNativeLibrar
47f0: 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 20 7b yFileNamesOnly {
4800: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
4810: 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 72 73 # NOTE: Firs
4820: 74 2c 20 63 68 65 63 6b 20 69 66 20 74 68 65 20 t, check if the
4830: 6c 69 73 74 20 6f 66 20 6e 61 74 69 76 65 20 6c list of native l
4840: 69 62 72 61 72 79 20 66 69 6c 65 20 6e 61 6d 65 ibrary file name
4850: 73 20 68 61 73 20 62 65 65 6e 0d 0a 20 20 20 20 s has been..
4860: 20 20 23 20 20 20 20 20 20 20 6d 61 6e 75 61 6c # manual
4870: 6c 79 20 6f 76 65 72 72 69 64 64 65 6e 2e 0d 0a ly overridden...
4880: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
4890: 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
48a0: 3a 3a 6e 61 74 69 76 65 5f 6c 69 62 72 61 72 79 ::native_library
48b0: 5f 66 69 6c 65 5f 6e 61 6d 65 73 5d 20 26 26 20 _file_names] &&
48c0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 6c 6c \.. [ll
48d0: 65 6e 67 74 68 20 24 3a 3a 6e 61 74 69 76 65 5f ength $::native_
48e0: 6c 69 62 72 61 72 79 5f 66 69 6c 65 5f 6e 61 6d library_file_nam
48f0: 65 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d es] > 0} then {.
4900: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
4910: 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 # NOTE: The
4920: 6c 69 73 74 20 6f 66 20 6e 61 74 69 76 65 20 6c list of native l
4930: 69 62 72 61 72 79 20 66 69 6c 65 20 6e 61 6d 65 ibrary file name
4940: 73 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 s has been overr
4950: 69 64 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 idden;..
4960: 23 20 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 # therefor
4970: 65 2c 20 75 73 65 20 69 74 20 76 65 72 62 61 74 e, use it verbat
4980: 69 6d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a im... #..
4990: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
49a0: 3a 3a 6e 61 74 69 76 65 5f 6c 69 62 72 61 72 79 ::native_library
49b0: 5f 66 69 6c 65 5f 6e 61 6d 65 73 0d 0a 20 20 20 _file_names..
49c0: 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 73 } elseif {[is
49d0: 57 69 6e 64 6f 77 73 5d 7d 20 74 68 65 6e 20 7b Windows]} then {
49e0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
49f0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4f 74 68 # NOTE: Oth
4a00: 65 72 77 69 73 65 2c 20 6f 6e 20 57 69 6e 64 6f erwise, on Windo
4a10: 77 73 2c 20 61 6c 77 61 79 73 20 75 73 65 20 74 ws, always use t
4a20: 68 65 20 64 65 66 61 75 6c 74 20 66 69 6c 65 20 he default file
4a30: 6e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 23 20 name.. #
4a40: 20 20 20 20 20 20 22 73 71 6c 69 74 65 33 2e 64 "sqlite3.d
4a50: 6c 6c 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ll"... #.
4a60: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
4a70: 5b 6c 69 73 74 20 73 71 6c 69 74 65 33 2e 64 6c [list sqlite3.dl
4a80: 6c 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 l].. } else
4a90: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
4aa0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4f # NOTE: O
4ab0: 74 68 65 72 77 69 73 65 2c 20 72 65 74 75 72 6e therwise, return
4ac0: 20 62 6f 74 68 20 74 68 65 20 67 65 6e 65 72 69 both the generi
4ad0: 63 20 50 4f 53 49 58 20 66 69 6c 65 20 6e 61 6d c POSIX file nam
4ae0: 65 20 61 6e 64 20 74 68 65 0d 0a 20 20 20 20 20 e and the..
4af0: 20 20 20 23 20 20 20 20 20 20 20 4d 61 63 20 4f # Mac O
4b00: 53 20 58 20 66 69 6c 65 20 6e 61 6d 65 2c 20 73 S X file name, s
4b10: 69 6e 63 65 20 77 65 20 64 6f 20 6e 6f 74 20 63 ince we do not c
4b20: 75 72 72 65 6e 74 6c 79 20 68 61 76 65 20 61 6e urrently have an
4b30: 20 65 61 73 79 0d 0a 20 20 20 20 20 20 20 20 23 easy.. #
4b40: 20 20 20 20 20 20 20 77 61 79 20 74 6f 20 64 65 way to de
4b50: 74 65 63 74 20 77 68 69 63 68 20 6f 66 20 74 68 tect which of th
4b60: 6f 73 65 20 70 6c 61 74 66 6f 72 6d 73 20 77 65 ose platforms we
4b70: 20 61 72 65 20 72 75 6e 6e 69 6e 67 20 6f 6e 2e are running on.
4b80: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
4b90: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 return [lis
4ba0: 74 20 6c 69 62 73 71 6c 69 74 65 33 2e 64 79 6c t libsqlite3.dyl
4bb0: 69 62 20 6c 69 62 73 71 6c 69 74 65 33 2e 73 6f ib libsqlite3.so
4bc0: 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 ].. }..
4bd0: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 }..... proc g
4be0: 65 74 49 6e 74 65 72 6f 70 41 73 73 65 6d 62 6c etInteropAssembl
4bf0: 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 20 7b yFileNamesOnly {
4c00: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
4c10: 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 72 73 # NOTE: Firs
4c20: 74 2c 20 63 68 65 63 6b 20 69 66 20 74 68 65 20 t, check if the
4c30: 6c 69 73 74 20 6f 66 20 69 6e 74 65 72 6f 70 20 list of interop
4c40: 61 73 73 65 6d 62 6c 79 20 66 69 6c 65 20 6e 61 assembly file na
4c50: 6d 65 73 20 68 61 73 20 62 65 65 6e 0d 0a 20 20 mes has been..
4c60: 20 20 20 20 23 20 20 20 20 20 20 20 6d 61 6e 75 # manu
4c70: 61 6c 6c 79 20 6f 76 65 72 72 69 64 64 65 6e 2e ally overridden.
4c80: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
4c90: 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
4ca0: 73 20 3a 3a 69 6e 74 65 72 6f 70 5f 61 73 73 65 s ::interop_asse
4cb0: 6d 62 6c 79 5f 66 69 6c 65 5f 6e 61 6d 65 73 5d mbly_file_names]
4cc0: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
4cd0: 20 5b 6c 6c 65 6e 67 74 68 20 24 3a 3a 69 6e 74 [llength $::int
4ce0: 65 72 6f 70 5f 61 73 73 65 6d 62 6c 79 5f 66 69 erop_assembly_fi
4cf0: 6c 65 5f 6e 61 6d 65 73 5d 20 3e 20 30 7d 20 74 le_names] > 0} t
4d00: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
4d10: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
4d20: 3a 20 54 68 65 20 6c 69 73 74 20 6f 66 20 69 6e : The list of in
4d30: 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 66 terop assembly f
4d40: 69 6c 65 20 6e 61 6d 65 73 20 68 61 73 20 62 65 ile names has be
4d50: 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d 0a en overridden;..
4d60: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
4d70: 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 therefore, use i
4d80: 74 20 76 65 72 62 61 74 69 6d 2e 0d 0a 20 20 20 t verbatim...
4d90: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
4da0: 72 65 74 75 72 6e 20 24 3a 3a 69 6e 74 65 72 6f return $::intero
4db0: 70 5f 61 73 73 65 6d 62 6c 79 5f 66 69 6c 65 5f p_assembly_file_
4dc0: 6e 61 6d 65 73 0d 0a 20 20 20 20 20 20 7d 20 65 names.. } e
4dd0: 6c 73 65 69 66 20 7b 5b 69 73 57 69 6e 64 6f 77 lseif {[isWindow
4de0: 73 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 s]} then {..
4df0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
4e00: 20 4e 4f 54 45 3a 20 4f 74 68 65 72 77 69 73 65 NOTE: Otherwise
4e10: 2c 20 6f 6e 20 57 69 6e 64 6f 77 73 2c 20 61 6c , on Windows, al
4e20: 77 61 79 73 20 75 73 65 20 74 68 65 20 64 65 66 ways use the def
4e30: 61 75 6c 74 20 66 69 6c 65 20 6e 61 6d 65 0d 0a ault file name..
4e40: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
4e50: 22 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f 70 2e "SQLite.Interop.
4e60: 64 6c 6c 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 dll"... #
4e70: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
4e80: 20 5b 6c 69 73 74 20 53 51 4c 69 74 65 2e 49 6e [list SQLite.In
4e90: 74 65 72 6f 70 2e 64 6c 6c 5d 0d 0a 20 20 20 20 terop.dll]..
4ea0: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
4eb0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
4ec0: 20 4e 4f 54 45 3a 20 4f 74 68 65 72 77 69 73 65 NOTE: Otherwise
4ed0: 2c 20 72 65 74 75 72 6e 20 62 6f 74 68 20 74 68 , return both th
4ee0: 65 20 67 65 6e 65 72 69 63 20 50 4f 53 49 58 20 e generic POSIX
4ef0: 66 69 6c 65 20 6e 61 6d 65 20 61 6e 64 20 74 68 file name and th
4f00: 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
4f10: 20 20 20 4d 61 63 20 4f 53 20 58 20 66 69 6c 65 Mac OS X file
4f20: 20 6e 61 6d 65 2c 20 73 69 6e 63 65 20 77 65 20 name, since we
4f30: 64 6f 20 6e 6f 74 20 63 75 72 72 65 6e 74 6c 79 do not currently
4f40: 20 68 61 76 65 20 61 6e 20 65 61 73 79 0d 0a 20 have an easy..
4f50: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 77 # w
4f60: 61 79 20 74 6f 20 64 65 74 65 63 74 20 77 68 69 ay to detect whi
4f70: 63 68 20 6f 66 20 74 68 6f 73 65 20 70 6c 61 74 ch of those plat
4f80: 66 6f 72 6d 73 20 77 65 20 61 72 65 20 72 75 6e forms we are run
4f90: 6e 69 6e 67 20 6f 6e 2e 0d 0a 20 20 20 20 20 20 ning on...
4fa0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
4fb0: 75 72 6e 20 5b 6c 69 73 74 20 6c 69 62 53 51 4c urn [list libSQL
4fc0: 69 74 65 2e 49 6e 74 65 72 6f 70 2e 64 79 6c 69 ite.Interop.dyli
4fd0: 62 20 6c 69 62 53 51 4c 69 74 65 2e 49 6e 74 65 b libSQLite.Inte
4fe0: 72 6f 70 2e 73 6f 5d 0d 0a 20 20 20 20 20 20 7d rop.so].. }
4ff0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
5000: 70 72 6f 63 20 67 65 74 43 6f 72 65 45 78 74 65 proc getCoreExte
5010: 6e 73 69 6f 6e 42 69 6e 61 72 79 46 69 6c 65 4e nsionBinaryFileN
5020: 61 6d 65 20 7b 20 7b 64 65 66 61 75 6c 74 20 22 ame { {default "
5030: 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 "} } {.. se
5040: 74 20 66 69 6c 65 4e 61 6d 65 20 5b 67 65 74 43 t fileName [getC
5050: 6f 72 65 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d oreBinaryFileNam
5060: 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b e].... if {
5070: 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 [file exists $fi
5080: 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d leName]} then {.
5090: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
50a0: 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 $fileName..
50b0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 }.... retu
50c0: 72 6e 20 24 64 65 66 61 75 6c 74 0d 0a 20 20 20 rn $default..
50d0: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
50e0: 69 73 42 75 69 6c 64 41 76 61 69 6c 61 62 6c 65 isBuildAvailable
50f0: 20 7b 20 6e 61 74 69 76 65 20 64 69 72 65 63 74 { native direct
5100: 6f 72 79 20 7b 76 61 72 4e 61 6d 65 20 22 22 7d ory {varName ""}
5110: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
5120: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 # NOTE: Bui
5130: 6c 64 20 74 68 65 20 66 75 6c 6c 79 20 71 75 61 ld the fully qua
5140: 6c 69 66 69 65 64 20 66 69 6c 65 20 6e 61 6d 65 lified file name
5150: 20 66 6f 72 20 74 68 65 20 70 72 69 6d 61 72 79 for the primary
5160: 20 61 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 assembly..
5170: 20 23 20 20 20 20 20 20 20 63 6f 6e 74 61 69 6e # contain
5180: 69 6e 67 20 74 68 65 20 53 79 73 74 65 6d 2e 44 ing the System.D
5190: 61 74 61 2e 53 51 4c 69 74 65 20 6d 61 6e 61 67 ata.SQLite manag
51a0: 65 64 20 63 6f 6d 70 6f 6e 65 6e 74 73 2e 20 20 ed components.
51b0: 49 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 It.. #
51c0: 20 20 73 68 6f 75 6c 64 20 62 65 20 6e 6f 74 65 should be note
51d0: 64 20 74 68 61 74 20 74 68 69 73 20 61 73 73 65 d that this asse
51e0: 6d 62 6c 79 20 66 69 6c 65 20 6d 61 79 20 61 6c mbly file may al
51f0: 73 6f 20 63 6f 6e 74 61 69 6e 20 74 68 65 0d 0a so contain the..
5200: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6e 61 # na
5210: 74 69 76 65 20 63 6f 6d 70 6f 6e 65 6e 74 73 2c tive components,
5220: 20 69 66 20 61 20 6e 61 74 69 76 65 20 62 75 69 if a native bui
5230: 6c 64 20 69 73 20 69 6e 20 75 73 65 2e 0d 0a 20 ld is in use...
5240: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 #.. se
5250: 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 t fileName [file
5260: 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c nativename [fil
5270: 65 20 6a 6f 69 6e 20 24 64 69 72 65 63 74 6f 72 e join $director
5280: 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 53 y \.. S
5290: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
52a0: 65 2e 64 6c 6c 5d 5d 0d 0a 0d 0a 20 20 20 20 20 e.dll]]....
52b0: 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 if {![file exis
52c0: 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 ts $fileName]} t
52d0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 hen {.. r
52e0: 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 eturn false..
52f0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
5300: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 . # NOTE: A
5310: 74 74 65 6d 70 74 20 74 6f 20 61 75 74 6f 6d 61 ttempt to automa
5320: 74 69 63 61 6c 6c 79 20 64 65 74 65 63 74 20 69 tically detect i
5330: 66 20 74 68 65 20 70 72 69 6d 61 72 79 20 61 73 f the primary as
5340: 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 20 23 20 sembly.. #
5350: 20 20 20 20 20 20 63 6f 6e 74 61 69 6e 73 20 61 contains a
5360: 6e 79 20 6e 61 74 69 76 65 20 63 6f 6d 70 6f 6e ny native compon
5370: 65 6e 74 73 2c 20 69 66 20 6e 65 63 65 73 73 61 ents, if necessa
5380: 72 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ry... #..
5390: 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
53a0: 6c 65 6e 67 74 68 20 24 6e 61 74 69 76 65 5d 20 length $native]
53b0: 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
53c0: 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
53d0: 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 6d g length $varNam
53e0: 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a e] > 0} then {..
53f0: 20 20 20 20 20 20 20 20 20 20 75 70 76 61 72 20 upvar
5400: 31 20 24 76 61 72 4e 61 6d 65 20 24 76 61 72 4e 1 $varName $varN
5410: 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a ame.. }..
5420: 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 6e 61 .. set na
5430: 74 69 76 65 20 5b 69 73 4d 69 78 65 64 4d 6f 64 tive [isMixedMod
5440: 65 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e eAssembly $fileN
5450: 61 6d 65 20 24 76 61 72 4e 61 6d 65 5d 0d 0a 20 ame $varName]..
5460: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
5470: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
5480: 20 49 66 20 74 68 65 20 70 72 69 6d 61 72 79 20 If the primary
5490: 61 73 73 65 6d 62 6c 79 20 61 6c 73 6f 20 63 6f assembly also co
54a0: 6e 74 61 69 6e 73 20 74 68 65 20 6e 61 74 69 76 ntains the nativ
54b0: 65 20 63 6f 6d 70 6f 6e 65 6e 74 73 2c 0d 0a 20 e components,..
54c0: 20 20 20 20 20 23 20 20 20 20 20 20 20 77 65 20 # we
54d0: 68 61 76 65 20 65 76 65 72 79 74 68 69 6e 67 20 have everything
54e0: 77 65 20 6e 65 65 64 2e 0d 0a 20 20 20 20 20 20 we need...
54f0: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 6e 61 #.. if {$na
5500: 74 69 76 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 tive} then {..
5510: 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
5520: 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 e.. }....
5530: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
5540: 4f 54 45 3a 20 49 66 20 74 68 65 20 6d 61 63 68 OTE: If the mach
5550: 69 6e 65 20 6e 61 6d 65 20 69 73 20 75 6e 61 76 ine name is unav
5560: 61 69 6c 61 62 6c 65 2c 20 74 68 65 72 65 20 69 ailable, there i
5570: 73 20 6e 6f 74 68 69 67 6e 20 65 6c 73 65 20 77 s nothign else w
5580: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
5590: 20 63 61 6e 20 64 6f 2e 0d 0a 20 20 20 20 20 20 can do...
55a0: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 69 #.. if {![i
55b0: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 63 6c nfo exists ::tcl
55c0: 5f 70 6c 61 74 66 6f 72 6d 28 6d 61 63 68 69 6e _platform(machin
55d0: 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 e)]} then {..
55e0: 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 return fals
55f0: 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 e.. }....
5600: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
5610: 4f 54 45 3a 20 57 68 61 74 20 69 73 20 74 68 65 OTE: What is the
5620: 20 61 72 63 68 69 74 65 63 74 75 72 65 20 66 6f architecture fo
5630: 72 20 74 68 69 73 20 6d 61 63 68 69 6e 65 3f 0d r this machine?.
5640: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
5650: 73 65 74 20 61 72 63 68 69 74 65 63 74 75 72 65 set architecture
5660: 20 5b 6d 61 63 68 69 6e 65 54 6f 50 6c 61 74 66 [machineToPlatf
5670: 6f 72 6d 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 orm $::tcl_platf
5680: 6f 72 6d 28 6d 61 63 68 69 6e 65 29 20 74 72 75 orm(machine) tru
5690: 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 e].... #..
56a0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 68 61 # NOTE: Wha
56b0: 74 20 69 73 20 74 68 65 20 70 6c 61 74 66 6f 72 t is the platfor
56c0: 6d 20 66 6f 72 20 74 68 69 73 20 6d 61 63 68 69 m for this machi
56d0: 6e 65 3f 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ne?.. #..
56e0: 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d set platform
56f0: 20 5b 6d 61 63 68 69 6e 65 54 6f 50 6c 61 74 66 [machineToPlatf
5700: 6f 72 6d 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 orm $::tcl_platf
5710: 6f 72 6d 28 6d 61 63 68 69 6e 65 29 5d 0d 0a 0d orm(machine)]...
5720: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
5730: 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 # NOTE: Build th
5740: 65 20 66 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 e fully qualifie
5750: 64 20 66 69 6c 65 20 6e 61 6d 65 20 66 6f 72 20 d file name for
5760: 74 68 65 20 69 6e 74 65 72 6f 70 20 61 73 73 65 the interop asse
5770: 6d 62 6c 79 0d 0a 20 20 20 20 20 20 23 20 20 20 mbly.. #
5780: 20 20 20 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 containing t
5790: 68 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 he System.Data.S
57a0: 51 4c 69 74 65 20 6e 61 74 69 76 65 20 63 6f 6d QLite native com
57b0: 70 6f 6e 65 6e 74 73 2e 20 20 49 66 20 74 68 69 ponents. If thi
57c0: 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 s.. #
57d0: 20 66 69 6c 65 20 65 78 69 73 74 73 2c 20 77 65 file exists, we
57e0: 20 73 68 6f 75 6c 64 20 68 61 76 65 20 65 76 65 should have eve
57f0: 72 79 74 68 69 6e 67 20 77 65 20 6e 65 65 64 2e rything we need.
5800: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
5810: 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d foreach fileNam
5820: 65 4f 6e 6c 79 20 5b 67 65 74 49 6e 74 65 72 6f eOnly [getIntero
5830: 70 41 73 73 65 6d 62 6c 79 46 69 6c 65 4e 61 6d pAssemblyFileNam
5840: 65 73 4f 6e 6c 79 5d 20 7b 0d 0a 20 20 20 20 20 esOnly] {..
5850: 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 set fileName
5860: 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
5870: 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 [file join $dir
5880: 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 ectory \..
5890: 20 20 20 20 20 20 24 61 72 63 68 69 74 65 63 74 $architect
58a0: 75 72 65 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c ure $fileNameOnl
58b0: 79 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 y]].... i
58c0: 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 f {[file exists
58d0: 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e $fileName]} then
58e0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 {.. re
58f0: 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 turn true..
5900: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
5910: 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 set fileName [fi
5920: 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 le nativename [f
5930: 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 65 63 74 ile join $direct
5940: 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ory \..
5950: 20 20 20 24 70 6c 61 74 66 6f 72 6d 20 24 66 69 $platform $fi
5960: 6c 65 4e 61 6d 65 4f 6e 6c 79 5d 5d 0d 0a 0d 0a leNameOnly]]....
5970: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c if {[fil
5980: 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 e exists $fileNa
5990: 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 me]} then {..
59a0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
59b0: 75 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d ue.. }...
59c0: 0a 20 20 20 20 20 20 20 20 73 65 74 20 66 69 6c . set fil
59d0: 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6e 61 74 69 eName [file nati
59e0: 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 vename [file joi
59f0: 6e 20 24 64 69 72 65 63 74 6f 72 79 20 5c 0d 0a n $directory \..
5a00: 20 20 20 20 20 20 20 20 20 20 20 20 24 66 69 6c $fil
5a10: 65 4e 61 6d 65 4f 6e 6c 79 5d 5d 0d 0a 0d 0a 20 eNameOnly]]....
5a20: 20 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 if {[file
5a30: 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d exists $fileNam
5a40: 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
5a50: 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
5a60: 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 e.. }..
5a70: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 }.... #
5a80: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
5a90: 42 75 69 6c 64 20 74 68 65 20 66 75 6c 6c 79 20 Build the fully
5aa0: 71 75 61 6c 69 66 69 65 64 20 66 69 6c 65 20 6e qualified file n
5ab0: 61 6d 65 20 66 6f 72 20 74 68 65 20 53 51 4c 69 ame for the SQLi
5ac0: 74 65 20 63 6f 72 65 0d 0a 20 20 20 20 20 20 23 te core.. #
5ad0: 20 20 20 20 20 20 20 6c 69 62 72 61 72 79 2e 20 library.
5ae0: 20 49 66 20 74 68 69 73 20 66 69 6c 65 20 65 78 If this file ex
5af0: 69 73 74 73 2c 20 77 65 20 73 68 6f 75 6c 64 20 ists, we should
5b00: 68 61 76 65 20 65 76 65 72 79 74 68 69 6e 67 20 have everything
5b10: 77 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 we.. #
5b20: 20 20 6e 65 65 64 2e 0d 0a 20 20 20 20 20 20 23 need... #
5b30: 0d 0a 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 .. foreach
5b40: 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 5b 67 65 fileNameOnly [ge
5b50: 74 4e 61 74 69 76 65 4c 69 62 72 61 72 79 46 69 tNativeLibraryFi
5b60: 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d 20 7b 0d 0a leNamesOnly] {..
5b70: 20 20 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 set file
5b80: 4e 61 6d 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 Name [file nativ
5b90: 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
5ba0: 20 24 64 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 $directory \..
5bb0: 20 20 20 20 20 20 20 20 20 20 20 24 61 72 63 68 $arch
5bc0: 69 74 65 63 74 75 72 65 20 24 66 69 6c 65 4e 61 itecture $fileNa
5bd0: 6d 65 4f 6e 6c 79 5d 5d 0d 0a 0d 0a 20 20 20 20 meOnly]]....
5be0: 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 if {[file ex
5bf0: 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d ists $fileName]}
5c00: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
5c10: 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a return true..
5c20: 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
5c30: 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d set fileNam
5c40: 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 e [file nativena
5c50: 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 me [file join $d
5c60: 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 irectory \..
5c70: 20 20 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 $platfor
5c80: 6d 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d m $fileNameOnly]
5c90: 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 ].... if
5ca0: 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 {[file exists $f
5cb0: 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b ileName]} then {
5cc0: 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 .. retu
5cd0: 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 20 rn true..
5ce0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 }.... se
5cf0: 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 t fileName [file
5d00: 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c nativename [fil
5d10: 65 20 6a 6f 69 6e 20 24 64 69 72 65 63 74 6f 72 e join $director
5d20: 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 y \..
5d30: 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d 5d $fileNameOnly]]
5d40: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
5d50: 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 [file exists $fi
5d60: 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d leName]} then {.
5d70: 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 . retur
5d80: 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 20 20 n true..
5d90: 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
5da0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
5db0: 4f 54 45 3a 20 4f 6e 65 20 6f 72 20 6d 6f 72 65 OTE: One or more
5dc0: 20 6e 61 74 69 76 65 20 63 6f 6d 70 6f 6e 65 6e native componen
5dd0: 74 73 20 6e 65 65 64 65 64 20 62 79 20 53 79 73 ts needed by Sys
5de0: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 0d tem.Data.SQLite.
5df0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 . # a
5e00: 72 65 20 6d 69 73 73 69 6e 67 2e 0d 0a 20 20 20 re missing...
5e10: 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 #.. retu
5e20: 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 7d 0d rn false.. }.
5e30: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 69 73 52 .... proc isR
5e40: 65 6c 65 61 73 65 41 76 61 69 6c 61 62 6c 65 20 eleaseAvailable
5e50: 7b 20 64 69 72 65 63 74 6f 72 79 20 7b 76 61 72 { directory {var
5e60: 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 Name ""} } {..
5e70: 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
5e80: 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 6d 65 5d length $varName]
5e90: 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
5ea0: 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 76 upvar 1 $v
5eb0: 61 72 4e 61 6d 65 20 24 76 61 72 4e 61 6d 65 0d arName $varName.
5ec0: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
5ed0: 20 20 72 65 74 75 72 6e 20 5b 69 73 42 75 69 6c return [isBuil
5ee0: 64 41 76 61 69 6c 61 62 6c 65 20 22 22 20 24 64 dAvailable "" $d
5ef0: 69 72 65 63 74 6f 72 79 20 24 76 61 72 4e 61 6d irectory $varNam
5f00: 65 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 e].. }.....
5f10: 20 20 70 72 6f 63 20 6a 6f 69 6e 42 75 69 6c 64 proc joinBuild
5f20: 44 69 72 65 63 74 6f 72 79 20 7b 20 6e 61 74 69 Directory { nati
5f30: 76 65 20 70 61 74 68 20 79 65 61 72 20 70 6c 61 ve path year pla
5f40: 74 66 6f 72 6d 20 63 6f 6e 66 69 67 75 72 61 74 tform configurat
5f50: 69 6f 6e 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ion } {.. #
5f60: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
5f70: 46 69 67 75 72 65 20 6f 75 74 20 61 6e 64 20 74 Figure out and t
5f80: 68 65 6e 20 72 65 74 75 72 6e 20 74 68 65 20 66 hen return the f
5f90: 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 20 70 ully qualified p
5fa0: 61 74 68 20 74 6f 20 74 68 65 20 62 75 69 6c 64 ath to the build
5fb0: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
5fc0: 64 69 72 65 63 74 6f 72 79 20 62 61 73 65 64 20 directory based
5fd0: 6f 6e 20 61 6c 6c 20 74 68 65 20 61 72 67 75 6d on all the argum
5fe0: 65 6e 74 73 20 70 72 6f 76 69 64 65 64 20 62 79 ents provided by
5ff0: 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d 0a 20 20 our caller...
6000: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
6010: 7b 24 6e 61 74 69 76 65 7d 20 74 68 65 6e 20 7b {$native} then {
6020: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
6030: 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 70 61 74 [file join $pat
6040: 68 20 62 69 6e 20 24 79 65 61 72 20 24 70 6c 61 h bin $year $pla
6050: 74 66 6f 72 6d 20 24 63 6f 6e 66 69 67 75 72 61 tform $configura
6060: 74 69 6f 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 65 tion].. } e
6070: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 lse {.. r
6080: 65 74 75 72 6e 20 5b 66 69 6c 65 20 6a 6f 69 6e eturn [file join
6090: 20 24 70 61 74 68 20 62 69 6e 20 24 79 65 61 72 $path bin $year
60a0: 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 $configuration
60b0: 62 69 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 bin].. }..
60c0: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
60d0: 63 20 67 65 74 42 75 69 6c 64 44 69 72 65 63 74 c getBuildDirect
60e0: 6f 72 79 20 7b 20 6d 61 6e 61 67 65 64 4f 6e 6c ory { managedOnl
60f0: 79 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a y } {.. #..
6100: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 65 # NOTE: Se
6110: 65 20 69 66 20 74 68 65 20 22 6e 61 74 69 76 65 e if the "native
6120: 22 20 72 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e " runtime option
6130: 20 68 61 73 20 62 65 65 6e 20 73 65 74 2e 20 20 has been set.
6140: 49 66 20 73 6f 2c 20 75 73 65 20 74 68 65 0d 0a If so, use the..
6150: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 69 # di
6160: 72 65 63 74 6f 72 79 20 66 6f 72 20 74 68 65 20 rectory for the
6170: 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 65 6d mixed-mode assem
6180: 62 6c 79 20 28 61 2e 6b 2e 61 2e 20 74 68 65 20 bly (a.k.a. the
6190: 6e 61 74 69 76 65 20 69 6e 74 65 72 6f 70 0d 0a native interop..
61a0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 73 # as
61b0: 73 65 6d 62 6c 79 29 2e 20 20 54 6f 20 65 6e 61 sembly). To ena
61c0: 62 6c 65 20 74 68 69 73 20 6f 70 74 69 6f 6e 20 ble this option
61d0: 76 69 61 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 via the command
61e0: 6c 69 6e 65 2c 20 65 6e 74 65 72 20 61 0d 0a 20 line, enter a..
61f0: 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6d # com
6200: 6d 61 6e 64 20 73 69 6d 69 6c 61 72 20 74 6f 20 mand similar to
6210: 6f 6e 65 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f one of the follo
6220: 77 69 6e 67 20 28 61 6c 6c 20 6f 6e 20 6f 6e 65 wing (all on one
6230: 20 6c 69 6e 65 29 3a 0d 0a 20 20 20 20 20 20 23 line):.. #
6240: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
6250: 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d EagleShell.exe -
6260: 69 6e 69 74 69 61 6c 69 7a 65 20 2d 72 75 6e 74 initialize -runt
6270: 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 69 76 65 imeOption native
6280: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
6290: 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 -file .\path\t
62a0: 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 o\all.eagle..
62b0: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 #.. #
62c0: 20 20 20 20 54 6f 20 65 6e 61 62 6c 65 20 74 68 To enable th
62d0: 69 73 20 6f 70 74 69 6f 6e 20 76 69 61 20 74 68 is option via th
62e0: 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20 70 e command line p
62f0: 72 69 6f 72 20 74 6f 20 74 68 65 20 22 62 65 74 rior to the "bet
6300: 61 20 31 36 22 0d 0a 20 20 20 20 20 20 23 20 20 a 16".. #
6310: 20 20 20 20 20 72 65 6c 65 61 73 65 20 6f 66 20 release of
6320: 45 61 67 6c 65 2c 20 74 68 65 20 66 6f 6c 6c 6f Eagle, the follo
6330: 77 69 6e 67 20 63 6f 6d 6d 61 6e 64 20 6d 75 73 wing command mus
6340: 74 20 62 65 20 75 73 65 64 20 69 6e 73 74 65 61 t be used instea
6350: 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 d.. #
6360: 20 28 61 6c 73 6f 20 61 6c 6c 20 6f 6e 20 6f 6e (also all on on
6370: 65 20 6c 69 6e 65 29 3a 0d 0a 20 20 20 20 20 20 e line):..
6380: 23 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 #.. #
6390: 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 20 EagleShell.exe
63a0: 2d 69 6e 69 74 69 61 6c 69 7a 65 20 2d 70 6f 73 -initialize -pos
63b0: 74 49 6e 69 74 69 61 6c 69 7a 65 0d 0a 20 20 20 tInitialize..
63c0: 20 20 20 23 20 20 20 20 20 20 20 20 20 22 6f 62 # "ob
63d0: 6a 65 63 74 20 69 6e 76 6f 6b 65 20 49 6e 74 65 ject invoke Inte
63e0: 72 70 72 65 74 65 72 2e 47 65 74 41 63 74 69 76 rpreter.GetActiv
63f0: 65 20 41 64 64 52 75 6e 74 69 6d 65 4f 70 74 69 e AddRuntimeOpti
6400: 6f 6e 20 6e 61 74 69 76 65 22 0d 0a 20 20 20 20 on native"..
6410: 20 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 6c # -fil
6420: 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e e .\path\to\all.
6430: 65 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a eagle.. #..
6440: 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 if {[info
6450: 65 78 69 73 74 73 20 3a 3a 62 75 69 6c 64 5f 64 exists ::build_d
6460: 69 72 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a irectory] && \..
6470: 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
6480: 67 20 6c 65 6e 67 74 68 20 24 3a 3a 62 75 69 6c g length $::buil
6490: 64 5f 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 30 d_directory] > 0
64a0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
64b0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
64c0: 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 74 69 6f OTE: The locatio
64d0: 6e 20 6f 66 20 74 68 65 20 62 75 69 6c 64 20 64 n of the build d
64e0: 69 72 65 63 74 6f 72 79 20 68 61 73 20 62 65 65 irectory has bee
64f0: 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d 0a 20 n overridden;..
6500: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
6510: 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 herefore, use it
6520: 20 76 65 72 62 61 74 69 6d 2e 0d 0a 20 20 20 20 verbatim...
6530: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
6540: 65 74 75 72 6e 20 24 3a 3a 62 75 69 6c 64 5f 64 eturn $::build_d
6550: 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 irectory..
6560: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
6570: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
6580: 4f 54 45 3a 20 49 66 20 74 68 65 20 22 6e 61 74 OTE: If the "nat
6590: 69 76 65 22 20 72 75 6e 74 69 6d 65 20 6f 70 74 ive" runtime opt
65a0: 69 6f 6e 20 69 73 20 73 65 74 2c 20 74 68 65 20 ion is set, the
65b0: 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 65 6d mixed-mode assem
65c0: 62 6c 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 bly.. #
65d0: 20 20 20 20 20 69 73 20 62 65 69 6e 67 20 74 65 is being te
65e0: 73 74 65 64 2e 20 20 49 6e 20 74 68 61 74 20 63 sted. In that c
65f0: 61 73 65 2c 20 74 68 65 20 70 61 74 68 20 74 6f ase, the path to
6600: 20 74 68 65 20 62 75 69 6c 64 20 64 69 72 65 63 the build direc
6610: 74 6f 72 79 0d 0a 20 20 20 20 20 20 20 20 23 20 tory.. #
6620: 20 20 20 20 20 20 77 69 6c 6c 20 63 6f 6e 74 61 will conta
6630: 69 6e 20 74 68 65 20 70 6c 61 74 66 6f 72 6d 20 in the platform
6640: 6e 61 6d 65 20 61 6e 64 20 61 6c 6c 20 74 68 65 name and all the
6650: 20 62 69 6e 61 72 69 65 73 20 75 6e 64 65 72 20 binaries under
6660: 74 65 73 74 0d 0a 20 20 20 20 20 20 20 20 23 20 test.. #
6670: 20 20 20 20 20 20 73 68 6f 75 6c 64 20 62 65 20 should be
6680: 70 72 65 73 65 6e 74 20 69 6e 20 74 68 61 74 20 present in that
6690: 64 69 72 65 63 74 6f 72 79 2e 20 20 49 66 20 74 directory. If t
66a0: 68 65 20 22 6e 61 74 69 76 65 22 20 72 75 6e 74 he "native" runt
66b0: 69 6d 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ime.. #
66c0: 20 20 20 20 20 6f 70 74 69 6f 6e 20 69 73 20 6e option is n
66d0: 6f 74 20 73 65 74 2c 20 74 68 65 20 62 75 69 6c ot set, the buil
66e0: 64 20 64 69 72 65 63 74 6f 72 79 20 77 69 6c 6c d directory will
66f0: 20 62 65 20 63 6f 6e 73 69 64 65 72 65 64 20 74 be considered t
6700: 6f 20 62 65 0d 0a 20 20 20 20 20 20 20 20 23 20 o be.. #
6710: 20 20 20 20 20 20 22 70 6c 61 74 66 6f 72 6d 2d "platform-
6720: 6e 65 75 74 72 61 6c 22 2c 20 77 69 74 68 20 74 neutral", with t
6730: 68 65 20 6e 6f 74 61 62 6c 65 20 65 78 63 65 70 he notable excep
6740: 74 69 6f 6e 20 6f 66 20 61 6e 79 20 6e 61 74 69 tion of any nati
6750: 76 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ve.. #
6760: 20 20 20 20 61 73 73 65 6d 62 6c 79 20 28 65 2e assembly (e.
6770: 67 2e 20 22 53 51 4c 69 74 65 2e 49 6e 74 65 72 g. "SQLite.Inter
6780: 6f 70 2e 64 6c 6c 22 29 20 63 6f 70 69 65 64 20 op.dll") copied
6790: 74 68 65 72 65 20 64 75 72 69 6e 67 20 74 68 65 there during the
67a0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
67b0: 20 20 62 75 69 6c 64 20 70 72 6f 63 65 73 73 20 build process
67c0: 69 74 73 65 6c 66 2e 20 20 49 66 20 74 68 65 20 itself. If the
67d0: 62 75 69 6c 64 20 70 72 6f 63 65 73 73 20 73 6f build process so
67e0: 6d 65 68 6f 77 20 64 6f 65 73 20 6e 6f 74 0d 0a mehow does not..
67f0: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
6800: 63 6f 70 79 20 74 68 65 20 6e 61 74 69 76 65 20 copy the native
6810: 61 73 73 65 6d 62 6c 79 20 66 6f 72 20 74 68 69 assembly for thi
6820: 73 20 70 6c 61 74 66 6f 72 6d 2c 20 6d 6f 73 74 s platform, most
6830: 20 6f 66 20 74 68 65 20 74 65 73 74 73 0d 0a 20 of the tests..
6840: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 69 # i
6850: 6e 20 74 68 65 20 73 75 69 74 65 20 77 69 6c 6c n the suite will
6860: 20 73 69 6d 70 6c 79 20 62 65 20 73 6b 69 70 70 simply be skipp
6870: 65 64 2e 20 20 47 65 6e 65 72 61 6c 6c 79 20 73 ed. Generally s
6880: 70 65 61 6b 69 6e 67 2c 20 74 68 65 72 65 0d 0a peaking, there..
6890: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
68a0: 61 72 65 20 74 77 6f 20 77 61 79 73 20 74 6f 20 are two ways to
68b0: 62 75 69 6c 64 20 74 68 65 20 62 69 6e 61 72 69 build the binari
68c0: 65 73 20 77 68 65 6e 20 70 72 65 70 61 72 69 6e es when preparin
68d0: 67 20 74 6f 20 72 75 6e 20 74 68 65 0d 0a 20 20 g to run the..
68e0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 65 # te
68f0: 73 74 20 73 75 69 74 65 3a 0d 0a 20 20 20 20 20 st suite:..
6900: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
6910: 20 20 20 20 20 20 31 2e 20 42 75 69 6c 64 20 74 1. Build t
6920: 68 65 20 73 65 70 61 72 61 74 65 20 6d 61 6e 61 he separate mana
6930: 67 65 64 20 61 6e 64 20 6e 61 74 69 76 65 20 61 ged and native a
6940: 73 73 65 6d 62 6c 69 65 73 20 75 73 69 6e 67 20 ssemblies using
6950: 73 6f 6d 65 0d 0a 20 20 20 20 20 20 20 20 23 20 some.. #
6960: 20 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 command
6970: 73 20 73 69 6d 69 6c 61 72 20 74 6f 3a 0d 0a 20 s similar to:..
6980: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
6990: 20 20 23 20 20 20 20 20 20 20 20 20 20 62 75 69 # bui
69a0: 6c 64 2e 62 61 74 20 24 7b 43 6f 6e 66 69 67 75 ld.bat ${Configu
69b0: 72 61 74 69 6f 6e 7d 4d 61 6e 61 67 65 64 4f 6e ration}ManagedOn
69c0: 6c 79 20 24 7b 50 6c 61 74 66 6f 72 6d 7d 0d 0a ly ${Platform}..
69d0: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
69e0: 20 20 20 62 75 69 6c 64 2e 62 61 74 20 24 7b 43 build.bat ${C
69f0: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 7d 4e 61 74 onfiguration}Nat
6a00: 69 76 65 4f 6e 6c 79 20 24 7b 50 6c 61 74 66 6f iveOnly ${Platfo
6a10: 72 6d 7d 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a rm}.. #..
6a20: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
6a30: 20 20 20 57 68 65 72 65 20 24 7b 43 6f 6e 66 69 Where ${Confi
6a40: 67 75 72 61 74 69 6f 6e 7d 20 69 73 20 65 69 74 guration} is eit
6a50: 68 65 72 20 22 44 65 62 75 67 22 20 6f 72 20 22 her "Debug" or "
6a60: 52 65 6c 65 61 73 65 22 20 61 6e 64 0d 0a 20 20 Release" and..
6a70: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 #
6a80: 20 24 7b 50 6c 61 74 66 6f 72 6d 7d 20 69 73 20 ${Platform} is
6a90: 65 69 74 68 65 72 20 22 57 69 6e 33 32 22 20 6f either "Win32" o
6aa0: 72 20 22 78 36 34 22 2e 0d 0a 20 20 20 20 20 20 r "x64"...
6ab0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 20 #.. #
6ac0: 20 20 20 20 20 32 2e 20 42 75 69 6c 64 20 74 68 2. Build th
6ad0: 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 e mixed-mode ass
6ae0: 65 6d 62 6c 79 20 75 73 69 6e 67 20 61 20 63 6f embly using a co
6af0: 6d 6d 61 6e 64 20 73 69 6d 69 6c 61 72 20 74 6f mmand similar to
6b00: 3a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 :.. #..
6b10: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 #
6b20: 20 62 75 69 6c 64 2e 62 61 74 20 24 7b 43 6f 6e build.bat ${Con
6b30: 66 69 67 75 72 61 74 69 6f 6e 7d 20 24 7b 50 6c figuration} ${Pl
6b40: 61 74 66 6f 72 6d 7d 0d 0a 20 20 20 20 20 20 20 atform}..
6b50: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 #.. #
6b60: 20 20 20 20 20 20 20 57 68 65 72 65 20 24 7b 43 Where ${C
6b70: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 7d 20 69 73 onfiguration} is
6b80: 20 65 69 74 68 65 72 20 22 44 65 62 75 67 22 20 either "Debug"
6b90: 6f 72 20 22 52 65 6c 65 61 73 65 22 20 61 6e 64 or "Release" and
6ba0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
6bb0: 20 20 20 20 20 24 7b 50 6c 61 74 66 6f 72 6d 7d ${Platform}
6bc0: 20 69 73 20 65 69 74 68 65 72 20 22 57 69 6e 33 is either "Win3
6bd0: 32 22 20 6f 72 20 22 78 36 34 22 2e 20 20 49 66 2" or "x64". If
6be0: 20 74 68 69 73 20 63 6f 6d 6d 61 6e 64 20 69 73 this command is
6bf0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
6c00: 20 20 20 20 20 75 73 65 64 2c 20 76 61 72 69 6f used, vario
6c10: 75 73 20 74 65 73 74 73 20 74 68 61 74 20 72 65 us tests that re
6c20: 71 75 69 72 65 20 73 75 70 70 6c 65 6d 65 6e 74 quire supplement
6c30: 61 72 79 20 6d 61 6e 61 67 65 64 0d 0a 20 20 20 ary managed..
6c40: 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 #
6c50: 61 73 73 65 6d 62 6c 69 65 73 20 28 65 2e 67 2e assemblies (e.g.
6c60: 20 4c 49 4e 51 29 20 6d 61 79 20 62 65 20 73 6b LINQ) may be sk
6c70: 69 70 70 65 64 20 75 6e 6c 65 73 73 20 74 68 6f ipped unless tho
6c80: 73 65 20 62 69 6e 61 72 69 65 73 0d 0a 20 20 20 se binaries..
6c90: 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 #
6ca0: 61 72 65 20 73 75 62 73 65 71 75 65 6e 74 6c 79 are subsequently
6cb0: 20 63 6f 70 69 65 64 20 69 6e 74 6f 20 74 68 65 copied into the
6cc0: 20 63 6f 72 72 65 63 74 20 64 69 72 65 63 74 6f correct directo
6cd0: 72 79 20 28 69 2e 65 2e 20 62 79 0d 0a 20 20 20 ry (i.e. by..
6ce0: 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 #
6cf0: 22 74 65 73 74 5f 61 6c 6c 2e 62 61 74 22 29 2e "test_all.bat").
6d00: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
6d10: 20 20 20 20 20 23 20 20 20 20 20 20 20 4e 6f 74 # Not
6d20: 65 20 74 68 61 74 20 61 6c 6c 20 6f 66 20 74 68 e that all of th
6d30: 65 20 62 75 69 6c 64 20 63 6f 6d 6d 61 6e 64 73 e build commands
6d40: 20 61 62 6f 76 65 20 77 69 6c 6c 20 64 65 66 61 above will defa
6d50: 75 6c 74 20 74 6f 20 75 73 69 6e 67 0d 0a 20 20 ult to using..
6d60: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 # th
6d70: 65 20 6c 61 74 65 73 74 20 76 65 72 73 69 6f 6e e latest version
6d80: 20 6f 66 20 4d 53 42 75 69 6c 64 20 61 76 61 69 of MSBuild avai
6d90: 6c 61 62 6c 65 20 61 6e 64 20 74 68 65 20 22 74 lable and the "t
6da0: 65 73 74 5f 79 65 61 72 22 20 6d 61 79 0d 0a 20 est_year" may..
6db0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6e # n
6dc0: 65 65 64 20 74 6f 20 62 65 20 61 64 6a 75 73 74 eed to be adjust
6dd0: 65 64 20 61 63 63 6f 72 64 69 6e 67 6c 79 20 74 ed accordingly t
6de0: 6f 20 61 63 74 75 61 6c 6c 79 20 72 75 6e 20 74 o actually run t
6df0: 68 65 20 74 65 73 74 20 73 75 69 74 65 2e 0d 0a he test suite...
6e00: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
6e10: 52 65 66 65 72 20 74 6f 20 74 68 65 20 63 6f 6d Refer to the com
6e20: 6d 65 6e 74 73 20 69 6e 20 5b 67 65 74 42 75 69 ments in [getBui
6e30: 6c 64 59 65 61 72 5d 20 66 6f 72 20 6d 6f 72 65 ldYear] for more
6e40: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 0d information on.
6e50: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
6e60: 20 68 6f 77 20 74 6f 20 73 65 74 20 74 68 69 73 how to set this
6e70: 20 76 61 72 69 61 62 6c 65 2e 0d 0a 20 20 20 20 variable...
6e80: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 #.. s
6e90: 65 74 20 6e 61 74 69 76 65 20 5b 65 78 70 72 20 et native [expr
6ea0: 7b 21 24 6d 61 6e 61 67 65 64 4f 6e 6c 79 20 26 {!$managedOnly &
6eb0: 26 20 5b 68 61 73 52 75 6e 74 69 6d 65 4f 70 74 & [hasRuntimeOpt
6ec0: 69 6f 6e 20 6e 61 74 69 76 65 5d 7d 5d 0d 0a 0d ion native]}]...
6ed0: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
6ee0: 5b 6a 6f 69 6e 42 75 69 6c 64 44 69 72 65 63 74 [joinBuildDirect
6ef0: 6f 72 79 20 24 6e 61 74 69 76 65 20 5b 67 65 74 ory $native [get
6f00: 42 75 69 6c 64 42 61 73 65 44 69 72 65 63 74 6f BuildBaseDirecto
6f10: 72 79 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ry] \..
6f20: 20 20 20 5b 67 65 74 42 75 69 6c 64 59 65 61 72 [getBuildYear
6f30: 5d 20 5b 67 65 74 42 75 69 6c 64 50 6c 61 74 66 ] [getBuildPlatf
6f40: 6f 72 6d 20 24 6e 61 74 69 76 65 5d 20 5b 67 65 orm $native] [ge
6f50: 74 42 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 74 tBuildConfigurat
6f60: 69 6f 6e 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a ion]].. }..
6f70: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
6f80: 6f 63 20 67 65 74 52 65 6c 65 61 73 65 56 65 72 oc getReleaseVer
6f90: 73 69 6f 6e 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 sion {} {..
6fa0: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
6fb0: 3a 20 46 69 67 75 72 65 20 6f 75 74 20 74 68 65 : Figure out the
6fc0: 20 72 65 6c 65 61 73 65 20 76 65 72 73 69 6f 6e release version
6fd0: 20 66 6f 72 20 75 73 65 20 77 69 74 68 20 74 68 for use with th
6fe0: 65 20 62 75 69 6c 64 20 64 69 72 65 63 74 6f 72 e build director
6ff0: 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 y.. #
7000: 20 77 68 65 6e 20 63 68 65 63 6b 69 6e 67 20 66 when checking f
7010: 6f 72 20 61 76 61 69 6c 61 62 6c 65 20 72 65 6c or available rel
7020: 65 61 73 65 73 2e 0d 0a 20 20 20 20 20 20 23 0d eases... #.
7030: 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f . if {[info
7040: 20 65 78 69 73 74 73 20 3a 3a 72 65 6c 65 61 73 exists ::releas
7050: 65 5f 76 65 72 73 69 6f 6e 5d 20 26 26 20 5c 0d e_version] && \.
7060: 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 . [stri
7070: 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 72 65 6c ng length $::rel
7080: 65 61 73 65 5f 76 65 72 73 69 6f 6e 5d 20 3e 20 ease_version] >
7090: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
70a0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
70b0: 4e 4f 54 45 3a 20 54 68 65 20 72 65 6c 65 61 73 NOTE: The releas
70c0: 65 20 76 65 72 73 69 6f 6e 20 68 61 73 20 62 65 e version has be
70d0: 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 20 74 en overridden; t
70e0: 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 herefore, use it
70f0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
7100: 20 20 76 65 72 62 61 74 69 6d 2e 0d 0a 20 20 20 verbatim...
7110: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
7120: 72 65 74 75 72 6e 20 24 3a 3a 72 65 6c 65 61 73 return $::releas
7130: 65 5f 76 65 72 73 69 6f 6e 0d 0a 20 20 20 20 20 e_version..
7140: 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
7150: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
7160: 4e 4f 54 45 3a 20 4e 6f 20 72 65 6c 65 61 73 65 NOTE: No release
7170: 20 76 65 72 73 69 6f 6e 20 69 73 20 61 76 61 69 version is avai
7180: 6c 61 62 6c 65 2c 20 72 65 74 75 72 6e 20 61 6e lable, return an
7190: 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2e 0d 0a empty string...
71a0: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
71b0: 49 74 20 69 73 20 69 6d 70 6f 72 74 61 6e 74 20 It is important
71c0: 74 6f 20 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 to return an emp
71d0: 74 79 20 73 74 72 69 6e 67 20 68 65 72 65 20 62 ty string here b
71e0: 65 63 61 75 73 65 20 74 68 65 0d 0a 20 20 20 20 ecause the..
71f0: 20 20 20 20 23 20 20 20 20 20 20 20 72 65 73 75 # resu
7200: 6c 74 20 6f 66 20 74 68 69 73 20 70 72 6f 63 65 lt of this proce
7210: 64 75 72 65 20 6d 61 79 20 62 65 20 75 73 65 64 dure may be used
7220: 20 77 69 74 68 20 5b 66 69 6c 65 20 6a 6f 69 6e with [file join
7230: 5d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 ]... #..
7240: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 22 22 return ""
7250: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
7260: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
7270: 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 7b tBuildFileName {
7280: 20 66 69 6c 65 4e 61 6d 65 20 6d 61 6e 61 67 65 fileName manage
7290: 64 4f 6e 6c 79 20 7b 70 6c 61 74 66 6f 72 6d 20 dOnly {platform
72a0: 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ""} } {.. #
72b0: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
72c0: 52 65 74 75 72 6e 73 20 74 68 65 20 73 70 65 63 Returns the spec
72d0: 69 66 69 65 64 20 66 69 6c 65 20 6e 61 6d 65 20 ified file name
72e0: 61 73 20 69 66 20 69 74 20 77 65 72 65 20 6c 6f as if it were lo
72f0: 63 61 74 65 64 20 69 6e 20 74 68 65 0d 0a 20 20 cated in the..
7300: 20 20 20 20 23 20 20 20 20 20 20 20 62 75 69 6c # buil
7310: 64 20 64 69 72 65 63 74 6f 72 79 2c 20 64 69 73 d directory, dis
7320: 63 61 72 64 69 6e 67 20 61 6e 79 20 64 69 72 65 carding any dire
7330: 63 74 6f 72 79 20 69 6e 66 6f 72 6d 61 74 69 6f ctory informatio
7340: 6e 20 70 72 65 73 65 6e 74 0d 0a 20 20 20 20 20 n present..
7350: 20 23 20 20 20 20 20 20 20 69 6e 20 74 68 65 20 # in the
7360: 66 69 6c 65 20 6e 61 6d 65 20 61 73 20 70 72 6f file name as pro
7370: 76 69 64 65 64 20 62 79 20 6f 75 72 20 63 61 6c vided by our cal
7380: 6c 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ler... #..
7390: 20 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 20 set result
73a0: 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
73b0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 66 \.. [f
73c0: 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 42 75 69 ile join [getBui
73d0: 6c 64 44 69 72 65 63 74 6f 72 79 20 24 6d 61 6e ldDirectory $man
73e0: 61 67 65 64 4f 6e 6c 79 5d 20 24 70 6c 61 74 66 agedOnly] $platf
73f0: 6f 72 6d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 orm \..
7400: 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6c [file tail $fil
7410: 65 4e 61 6d 65 5d 5d 5d 0d 0a 0d 0a 20 20 20 20 eName]]]....
7420: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 48 41 43 #.. # HAC
7430: 4b 3a 20 57 68 65 6e 20 72 75 6e 6e 69 6e 67 20 K: When running
7440: 6f 6e 20 57 6f 57 36 34 2c 20 61 73 73 75 6d 65 on WoW64, assume
7450: 20 74 68 65 20 74 65 73 74 20 65 78 65 63 75 74 the test execut
7460: 61 62 6c 65 73 20 61 72 65 20 70 72 65 73 65 6e ables are presen
7470: 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 t.. #
7480: 20 77 69 74 68 20 74 68 65 20 22 33 32 22 20 73 with the "32" s
7490: 75 66 66 69 78 20 6f 6e 20 74 68 65 6d 2e 0d 0a uffix on them...
74a0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
74b0: 66 20 7b 5b 69 73 52 75 6e 6e 69 6e 67 57 6f 57 f {[isRunningWoW
74c0: 36 34 5d 20 26 26 20 5b 66 69 6c 65 20 65 78 74 64] && [file ext
74d0: 65 6e 73 69 6f 6e 20 24 72 65 73 75 6c 74 5d 20 ension $result]
74e0: 65 71 20 22 2e 65 78 65 22 7d 20 74 68 65 6e 20 eq ".exe"} then
74f0: 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 72 {.. set r
7500: 65 73 75 6c 74 20 5b 61 70 70 65 6e 64 41 72 67 esult [appendArg
7510: 73 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d 65 s [file rootname
7520: 20 24 72 65 73 75 6c 74 5d 20 33 32 2e 65 78 65 $result] 32.exe
7530: 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 ].. }....
7540: 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 return $resu
7550: 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 lt.. }.....
7560: 20 20 70 72 6f 63 20 67 65 74 45 78 74 65 72 6e proc getExtern
7570: 61 6c 44 69 72 65 63 74 6f 72 79 20 7b 7d 20 7b alDirectory {} {
7580: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
7590: 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 # NOTE: This pr
75a0: 6f 63 65 64 75 72 65 20 72 65 74 75 72 6e 73 20 ocedure returns
75b0: 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 the directory wh
75c0: 65 72 65 20 74 68 65 20 65 78 74 65 72 6e 61 6c ere the external
75d0: 20 62 69 6e 61 72 79 0d 0a 20 20 20 20 20 20 23 binary.. #
75e0: 20 20 20 20 20 20 20 66 69 6c 65 73 20 61 72 65 files are
75f0: 20 6c 6f 63 61 74 65 64 2e 0d 0a 20 20 20 20 20 located...
7600: 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e #.. return
7610: 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d [file nativenam
7620: 65 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 e [file dirname
7630: 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 5b 69 [file dirname [i
7640: 6e 66 6f 20 62 69 6e 61 72 79 5d 5d 5d 5d 0d 0a nfo binary]]]]..
7650: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
7660: 6f 63 20 67 65 74 42 69 6e 61 72 79 44 69 72 65 oc getBinaryDire
7670: 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 ctory {} {..
7680: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
7690: 45 3a 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 E: This procedur
76a0: 65 20 72 65 74 75 72 6e 73 20 74 68 65 20 64 69 e returns the di
76b0: 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 68 rectory where th
76c0: 65 20 74 65 73 74 20 61 70 70 6c 69 63 61 74 69 e test applicati
76d0: 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 on.. #
76e0: 20 20 69 74 73 65 6c 66 20 28 69 2e 65 2e 20 74 itself (i.e. t
76f0: 68 65 20 45 61 67 6c 65 20 73 68 65 6c 6c 29 20 he Eagle shell)
7700: 69 73 20 6c 6f 63 61 74 65 64 2e 20 20 54 68 69 is located. Thi
7710: 73 20 77 69 6c 6c 20 62 65 20 75 73 65 64 20 61 s will be used a
7720: 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 s.. #
7730: 20 74 68 65 20 64 65 73 74 69 6e 61 74 69 6f 6e the destination
7740: 20 66 6f 72 20 74 68 65 20 63 6f 70 69 65 64 20 for the copied
7750: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
7760: 74 65 20 6e 61 74 69 76 65 20 61 6e 64 0d 0a 20 te native and..
7770: 20 20 20 20 20 23 20 20 20 20 20 20 20 6d 61 6e # man
7780: 61 67 65 64 20 61 73 73 65 6d 62 6c 69 65 73 20 aged assemblies
7790: 28 69 2e 65 2e 20 62 65 63 61 75 73 65 20 74 68 (i.e. because th
77a0: 69 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 is is one of the
77b0: 20 66 65 77 20 70 6c 61 63 65 73 0d 0a 20 20 20 few places..
77c0: 20 20 20 23 20 20 20 20 20 20 20 77 68 65 72 65 # where
77d0: 20 74 68 65 20 43 4c 52 20 77 69 6c 6c 20 61 63 the CLR will ac
77e0: 74 75 61 6c 6c 79 20 66 69 6e 64 20 61 6e 64 20 tually find and
77f0: 6c 6f 61 64 20 74 68 65 6d 20 70 72 6f 70 65 72 load them proper
7800: 6c 79 29 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ly)... #..
7810: 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 if {[info e
7820: 78 69 73 74 73 20 3a 3a 62 69 6e 61 72 79 5f 64 xists ::binary_d
7830: 69 72 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a irectory] && \..
7840: 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
7850: 67 20 6c 65 6e 67 74 68 20 24 3a 3a 62 69 6e 61 g length $::bina
7860: 72 79 5f 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 ry_directory] >
7870: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
7880: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
7890: 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 74 69 NOTE: The locati
78a0: 6f 6e 20 6f 66 20 74 68 65 20 62 69 6e 61 72 79 on of the binary
78b0: 20 64 69 72 65 63 74 6f 72 79 20 68 61 73 20 62 directory has b
78c0: 65 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d een overridden;.
78d0: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
78e0: 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 therefore, use
78f0: 69 74 20 76 65 72 62 61 74 69 6d 2e 0d 0a 20 20 it verbatim...
7900: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
7910: 20 72 65 74 75 72 6e 20 24 3a 3a 62 69 6e 61 72 return $::binar
7920: 79 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 y_directory..
7930: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
7940: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 69 6e 66 return [inf
7950: 6f 20 62 69 6e 61 72 79 5d 0d 0a 20 20 20 20 20 o binary]..
7960: 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
7970: 20 20 70 72 6f 63 20 67 65 74 45 78 74 65 72 6e proc getExtern
7980: 61 6c 46 69 6c 65 4e 61 6d 65 20 7b 20 66 69 6c alFileName { fil
7990: 65 4e 61 6d 65 20 7d 20 7b 0d 0a 20 20 20 20 20 eName } {..
79a0: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
79b0: 3a 20 52 65 74 75 72 6e 73 20 74 68 65 20 73 70 : Returns the sp
79c0: 65 63 69 66 69 65 64 20 66 69 6c 65 20 6e 61 6d ecified file nam
79d0: 65 20 61 73 20 69 66 20 69 74 20 77 65 72 65 20 e as if it were
79e0: 6c 6f 63 61 74 65 64 20 69 6e 20 74 68 65 0d 0a located in the..
79f0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 69 # di
7a00: 72 65 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 rectory containi
7a10: 6e 67 20 74 68 65 20 65 78 74 65 72 6e 61 6c 20 ng the external
7a20: 62 69 6e 61 72 69 65 73 2e 0d 0a 20 20 20 20 20 binaries...
7a30: 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e #.. return
7a40: 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d [file nativenam
7a50: 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 e [file join [ge
7a60: 74 45 78 74 65 72 6e 61 6c 44 69 72 65 63 74 6f tExternalDirecto
7a70: 72 79 5d 20 24 66 69 6c 65 4e 61 6d 65 5d 5d 0d ry] $fileName]].
7a80: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
7a90: 72 6f 63 20 67 65 74 42 69 6e 61 72 79 46 69 6c roc getBinaryFil
7aa0: 65 4e 61 6d 65 20 7b 20 66 69 6c 65 4e 61 6d 65 eName { fileName
7ab0: 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7d {platform ""} }
7ac0: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
7ad0: 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 # NOTE: Retur
7ae0: 6e 73 20 74 68 65 20 73 70 65 63 69 66 69 65 64 ns the specified
7af0: 20 66 69 6c 65 20 6e 61 6d 65 20 61 73 20 69 66 file name as if
7b00: 20 69 74 20 77 65 72 65 20 6c 6f 63 61 74 65 64 it were located
7b10: 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 23 in the.. #
7b20: 20 20 20 20 20 20 20 62 69 6e 61 72 79 20 64 69 binary di
7b30: 72 65 63 74 6f 72 79 2c 20 64 69 73 63 61 72 64 rectory, discard
7b40: 69 6e 67 20 61 6e 79 20 64 69 72 65 63 74 6f 72 ing any director
7b50: 79 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 70 72 y information pr
7b60: 65 73 65 6e 74 0d 0a 20 20 20 20 20 20 23 20 20 esent.. #
7b70: 20 20 20 20 20 69 6e 20 74 68 65 20 66 69 6c 65 in the file
7b80: 20 6e 61 6d 65 20 61 73 20 70 72 6f 76 69 64 65 name as provide
7b90: 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 2e d by our caller.
7ba0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
7bb0: 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 6e 61 return [file na
7bc0: 74 69 76 65 6e 61 6d 65 20 5c 0d 0a 20 20 20 20 tivename \..
7bd0: 20 20 20 20 20 20 5b 66 69 6c 65 20 6a 6f 69 6e [file join
7be0: 20 5b 67 65 74 42 69 6e 61 72 79 44 69 72 65 63 [getBinaryDirec
7bf0: 74 6f 72 79 5d 20 24 70 6c 61 74 66 6f 72 6d 20 tory] $platform
7c00: 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 [file tail $file
7c10: 4e 61 6d 65 5d 5d 5d 0d 0a 20 20 20 20 7d 0d 0a Name]]].. }..
7c20: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 43 ... proc getC
7c30: 6f 72 65 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d oreBinaryFileNam
7c40: 65 20 7b 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 e { {platform ""
7c50: 7d 20 7b 73 74 61 6e 64 61 72 64 20 22 22 7d 20 } {standard ""}
7c60: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
7c70: 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 # NOTE: Retu
7c80: 72 6e 73 20 74 68 65 20 66 75 6c 6c 20 70 61 74 rns the full pat
7c90: 68 20 66 6f 72 20 74 68 65 20 66 69 6c 65 20 63 h for the file c
7ca0: 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 53 51 ontaining the SQ
7cb0: 4c 69 74 65 20 63 6f 72 65 0d 0a 20 20 20 20 20 Lite core..
7cc0: 20 23 20 20 20 20 20 20 20 6e 61 74 69 76 65 20 # native
7cd0: 6c 69 62 72 61 72 79 20 63 6f 64 65 20 66 6f 72 library code for
7ce0: 20 74 68 69 73 20 70 6c 61 74 66 6f 72 6d 2e 20 this platform.
7cf0: 20 46 69 72 73 74 2c 20 63 68 65 63 6b 20 61 6e First, check an
7d00: 64 20 73 65 65 20 69 66 0d 0a 20 20 20 20 20 20 d see if..
7d10: 23 20 20 20 20 20 20 20 74 68 65 20 53 51 4c 69 # the SQLi
7d20: 74 65 20 63 6f 72 65 20 6e 61 74 69 76 65 20 6c te core native l
7d30: 69 62 72 61 72 79 20 68 61 73 20 61 6c 72 65 61 ibrary has alrea
7d40: 64 79 20 62 65 65 6e 20 6c 6f 61 64 65 64 2e 20 dy been loaded.
7d50: 20 4e 65 78 74 2c 0d 0a 20 20 20 20 20 20 23 20 Next,.. #
7d60: 20 20 20 20 20 20 66 61 6c 6c 62 61 63 6b 20 74 fallback t
7d70: 6f 20 77 68 61 74 20 74 68 65 20 66 75 6c 6c 20 o what the full
7d80: 70 61 74 68 20 73 68 6f 75 6c 64 20 62 65 2c 20 path should be,
7d90: 62 61 73 65 64 20 6f 6e 20 77 68 65 74 68 65 72 based on whether
7da0: 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 the.. #
7db0: 20 20 20 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 mixed-mode a
7dc0: 73 73 65 6d 62 6c 79 20 69 73 20 62 65 69 6e 67 ssembly is being
7dd0: 20 75 73 65 64 20 61 6e 64 20 74 68 65 20 6e 61 used and the na
7de0: 6d 65 20 6f 66 20 74 68 65 20 63 75 72 72 65 6e me of the curren
7df0: 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 t.. #
7e00: 20 70 6c 61 74 66 6f 72 6d 2e 0d 0a 20 20 20 20 platform...
7e10: 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
7e20: 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
7e30: 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
7e40: 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
7e50: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
7e60: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
7e70: 74 65 2e 55 6e 73 61 66 65 4e 61 74 69 76 65 4d te.UnsafeNativeM
7e80: 65 74 68 6f 64 73 20 5f 53 51 4c 69 74 65 4e 61 ethods _SQLiteNa
7e90: 74 69 76 65 4d 6f 64 75 6c 65 46 69 6c 65 4e 61 tiveModuleFileNa
7ea0: 6d 65 0d 0a 20 20 20 20 20 20 7d 20 66 69 6c 65 me.. } file
7eb0: 4e 61 6d 65 5d 20 3d 3d 20 30 20 26 26 20 5b 73 Name] == 0 && [s
7ec0: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 66 69 tring length $fi
7ed0: 6c 65 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 leName] > 0} the
7ee0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
7ef0: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
7f00: 54 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 20 The SQLite core
7f10: 6e 61 74 69 76 65 20 6c 69 62 72 61 72 79 20 68 native library h
7f20: 61 73 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 as already been
7f30: 6c 6f 61 64 65 64 20 76 69 61 0d 0a 20 20 20 20 loaded via..
7f40: 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 # the
7f50: 6e 61 74 69 76 65 20 6c 69 62 72 61 72 79 20 70 native library p
7f60: 72 65 2d 6c 6f 61 64 65 72 2e 20 20 52 65 74 75 re-loader. Retu
7f70: 72 6e 20 74 68 61 74 20 66 69 6c 65 20 6e 61 6d rn that file nam
7f80: 65 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 e now...
7f90: 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 #.. retur
7fa0: 6e 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 n $fileName..
7fb0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
7fc0: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 . # NOTE: I
7fd0: 66 20 74 68 65 20 22 6e 61 74 69 76 65 22 20 72 f the "native" r
7fe0: 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e 20 68 61 untime option ha
7ff0: 73 20 62 65 65 6e 20 73 65 74 2c 20 61 6c 77 61 s been set, alwa
8000: 79 73 20 72 65 74 75 72 6e 20 74 68 65 0d 0a 20 ys return the..
8010: 20 20 20 20 20 23 20 20 20 20 20 20 20 66 69 6c # fil
8020: 65 20 6e 61 6d 65 20 66 6f 72 20 74 68 65 20 6d e name for the m
8030: 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 65 6d 62 ixed-mode assemb
8040: 6c 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ly... #..
8050: 20 20 20 20 69 66 20 7b 5b 68 61 73 52 75 6e 74 if {[hasRunt
8060: 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 69 76 65 imeOption native
8070: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
8080: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
8090: 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 74 68 65 NOTE: Return the
80a0: 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 65 mixed-mode asse
80b0: 6d 62 6c 79 20 66 69 6c 65 20 6e 61 6d 65 2e 0d mbly file name..
80c0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
80d0: 20 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 return [file
80e0: 20 6e 61 74 69 76 65 6e 61 6d 65 20 5c 0d 0a 20 nativename \..
80f0: 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 [file
8100: 20 6a 6f 69 6e 20 5b 67 65 74 42 69 6e 61 72 79 join [getBinary
8110: 44 69 72 65 63 74 6f 72 79 5d 20 24 70 6c 61 74 Directory] $plat
8120: 66 6f 72 6d 20 53 79 73 74 65 6d 2e 44 61 74 61 form System.Data
8130: 2e 53 51 4c 69 74 65 2e 64 6c 6c 5d 5d 0d 0a 20 .SQLite.dll]]..
8140: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
8150: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
8160: 20 41 72 65 20 77 65 20 61 74 74 65 6d 70 74 69 Are we attempti
8170: 6e 67 20 74 6f 20 61 75 74 6f 6d 61 74 69 63 61 ng to automatica
8180: 6c 6c 79 20 64 65 74 65 63 74 20 77 68 65 74 68 lly detect wheth
8190: 65 72 20 6f 72 20 6e 6f 74 20 74 68 65 0d 0a 20 er or not the..
81a0: 20 20 20 20 20 23 20 20 20 20 20 20 20 69 6e 74 # int
81b0: 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 73 68 erop assembly sh
81c0: 6f 75 6c 64 20 62 65 20 75 73 65 64 3f 0d 0a 20 ould be used?..
81d0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 #.. se
81e0: 74 20 61 75 74 6f 6d 61 74 69 63 20 5b 65 78 70 t automatic [exp
81f0: 72 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 r {[string lengt
8200: 68 20 24 73 74 61 6e 64 61 72 64 5d 20 3d 3d 20 h $standard] ==
8210: 30 7d 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 0}].... #..
8220: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 # NOTE: Fi
8230: 72 73 74 2c 20 69 6e 20 65 69 74 68 65 72 20 22 rst, in either "
8240: 61 75 74 6f 6d 61 74 69 63 22 20 6f 72 20 22 6e automatic" or "n
8250: 6f 6e 2d 73 74 61 6e 64 61 72 64 22 20 6d 6f 64 on-standard" mod
8260: 65 73 2c 20 61 74 74 65 6d 70 74 0d 0a 20 20 20 es, attempt..
8270: 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 66 69 # to fi
8280: 6e 64 20 74 68 65 20 6e 61 74 69 76 65 2d 6f 6e nd the native-on
8290: 6c 79 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d ly interop assem
82a0: 62 6c 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 bly... #..
82b0: 20 20 20 20 20 69 66 20 7b 24 61 75 74 6f 6d 61 if {$automa
82c0: 74 69 63 20 7c 7c 20 21 24 73 74 61 6e 64 61 72 tic || !$standar
82d0: 64 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 d} then {..
82e0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
82f0: 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f NOTE: Attempt to
8300: 20 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 6e determine the n
8310: 61 74 69 76 65 2d 6f 6e 6c 79 20 69 6e 74 65 72 ative-only inter
8320: 6f 70 20 61 73 73 65 6d 62 6c 79 20 66 69 6c 65 op assembly file
8330: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
8340: 20 20 6e 61 6d 65 20 66 6f 72 20 74 68 69 73 20 name for this
8350: 70 6c 61 74 66 6f 72 6d 20 61 6e 64 20 74 68 65 platform and the
8360: 6e 20 72 65 74 75 72 6e 20 69 74 2e 0d 0a 20 20 n return it...
8370: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
8380: 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d foreach fileNam
8390: 65 4f 6e 6c 79 20 5b 67 65 74 49 6e 74 65 72 6f eOnly [getIntero
83a0: 70 41 73 73 65 6d 62 6c 79 46 69 6c 65 4e 61 6d pAssemblyFileNam
83b0: 65 73 4f 6e 6c 79 5d 20 7b 0d 0a 20 20 20 20 20 esOnly] {..
83c0: 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d set fileNam
83d0: 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 e [file nativena
83e0: 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 me \..
83f0: 20 20 20 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b [file join [
8400: 67 65 74 42 69 6e 61 72 79 44 69 72 65 63 74 6f getBinaryDirecto
8410: 72 79 5d 20 24 70 6c 61 74 66 6f 72 6d 20 24 66 ry] $platform $f
8420: 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d 5d 0d 0a 0d ileNameOnly]]...
8430: 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
8440: 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c file exists $fil
8450: 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a eName]} then {..
8460: 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 retu
8470: 72 6e 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 rn $fileName..
8480: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
8490: 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
84a0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
84b0: 23 20 4e 4f 54 45 3a 20 54 68 65 6e 2c 20 69 6e # NOTE: Then, in
84c0: 20 65 69 74 68 65 72 20 22 61 75 74 6f 6d 61 74 either "automat
84d0: 69 63 22 20 6f 72 20 22 73 74 61 6e 64 61 72 64 ic" or "standard
84e0: 22 20 6d 6f 64 65 73 2c 20 61 74 74 65 6d 70 74 " modes, attempt
84f0: 20 74 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 20 to.. #
8500: 20 20 20 66 69 6e 64 20 74 68 65 20 73 74 61 6e find the stan
8510: 64 61 72 64 20 53 51 4c 69 74 65 20 6c 69 62 72 dard SQLite libr
8520: 61 72 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ary... #..
8530: 20 20 20 20 20 69 66 20 7b 24 61 75 74 6f 6d 61 if {$automa
8540: 74 69 63 20 7c 7c 20 24 73 74 61 6e 64 61 72 64 tic || $standard
8550: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
8560: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
8570: 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 OTE: Attempt to
8580: 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 6e 61 determine the na
8590: 74 69 76 65 2d 6f 6e 6c 79 20 73 74 61 6e 64 61 tive-only standa
85a0: 72 64 20 53 51 4c 69 74 65 20 6c 69 62 72 61 72 rd SQLite librar
85b0: 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 y.. #
85c0: 20 20 20 66 69 6c 65 20 6e 61 6d 65 20 66 6f 72 file name for
85d0: 20 74 68 69 73 20 70 6c 61 74 66 6f 72 6d 20 61 this platform a
85e0: 6e 64 20 74 68 65 6e 20 72 65 74 75 72 6e 20 69 nd then return i
85f0: 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 t... #..
8600: 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
8610: 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 5b 67 65 74 ileNameOnly [get
8620: 4e 61 74 69 76 65 4c 69 62 72 61 72 79 46 69 6c NativeLibraryFil
8630: 65 4e 61 6d 65 73 4f 6e 6c 79 5d 20 7b 0d 0a 20 eNamesOnly] {..
8640: 20 20 20 20 20 20 20 20 20 73 65 74 20 66 69 6c set fil
8650: 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6e 61 74 69 eName [file nati
8660: 76 65 6e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 vename \..
8670: 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 6a 6f [file jo
8680: 69 6e 20 5b 67 65 74 42 69 6e 61 72 79 44 69 72 in [getBinaryDir
8690: 65 63 74 6f 72 79 5d 20 24 70 6c 61 74 66 6f 72 ectory] $platfor
86a0: 6d 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d m $fileNameOnly]
86b0: 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 ].... i
86c0: 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 f {[file exists
86d0: 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e $fileName]} then
86e0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
86f0: 72 65 74 75 72 6e 20 24 66 69 6c 65 4e 61 6d 65 return $fileName
8700: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
8710: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
8720: 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
8730: 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 61 73 20 # NOTE: Was
8740: 74 68 65 20 6d 61 6e 61 67 65 64 20 61 73 73 65 the managed asse
8750: 6d 62 6c 79 20 63 6f 6d 70 69 6c 65 64 20 65 78 mbly compiled ex
8760: 70 65 63 74 69 6e 67 20 74 6f 20 64 65 61 6c 20 pecting to deal
8770: 77 69 74 68 20 74 68 65 0d 0a 20 20 20 20 20 20 with the..
8780: 23 20 20 20 20 20 20 20 73 74 61 6e 64 61 72 64 # standard
8790: 20 63 6f 72 65 20 6c 69 62 72 61 72 79 3f 0d 0a core library?..
87a0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
87b0: 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 44 65 f {[haveSQLiteDe
87c0: 66 69 6e 65 43 6f 6e 73 74 61 6e 74 20 53 51 4c fineConstant SQL
87d0: 49 54 45 5f 53 54 41 4e 44 41 52 44 5d 7d 20 74 ITE_STANDARD]} t
87e0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
87f0: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
8800: 3a 20 46 61 6c 6c 62 61 63 6b 20 74 6f 20 72 65 : Fallback to re
8810: 74 75 72 6e 69 6e 67 20 74 68 65 20 6e 61 74 69 turning the nati
8820: 76 65 2d 6f 6e 6c 79 20 73 74 61 6e 64 61 72 64 ve-only standard
8830: 20 53 51 4c 69 74 65 20 6c 69 62 72 61 72 79 0d SQLite library.
8840: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
8850: 20 66 69 6c 65 20 6e 61 6d 65 20 66 6f 72 20 74 file name for t
8860: 68 65 20 70 6c 61 74 66 6f 72 6d 2e 0d 0a 20 20 he platform...
8870: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
8880: 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 73 4f 6e set fileNamesOn
8890: 6c 79 20 5b 67 65 74 4e 61 74 69 76 65 4c 69 62 ly [getNativeLib
88a0: 72 61 72 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c raryFileNamesOnl
88b0: 79 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 y].... if
88c0: 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 66 69 6c 65 {[llength $file
88d0: 4e 61 6d 65 73 4f 6e 6c 79 5d 20 3d 3d 20 30 7d NamesOnly] == 0}
88e0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
88f0: 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 return ""..
8900: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
8910: 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 return [file
8920: 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 nativename [file
8930: 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 join \..
8940: 20 20 20 20 20 5b 67 65 74 42 69 6e 61 72 79 44 [getBinaryD
8950: 69 72 65 63 74 6f 72 79 5d 20 24 70 6c 61 74 66 irectory] $platf
8960: 6f 72 6d 20 5b 6c 69 6e 64 65 78 20 24 66 69 6c orm [lindex $fil
8970: 65 4e 61 6d 65 73 4f 6e 6c 79 20 30 5d 5d 5d 0d eNamesOnly 0]]].
8980: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
8990: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
89a0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 61 6c 6c # NOTE: Fall
89b0: 62 61 63 6b 20 74 6f 20 72 65 74 75 72 6e 69 6e back to returnin
89c0: 67 20 74 68 65 20 6e 61 74 69 76 65 2d 6f 6e 6c g the native-onl
89d0: 79 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 y interop assemb
89e0: 6c 79 20 66 69 6c 65 0d 0a 20 20 20 20 20 20 20 ly file..
89f0: 20 23 20 20 20 20 20 20 20 6e 61 6d 65 20 66 6f # name fo
8a00: 72 20 74 68 65 20 70 6c 61 74 66 6f 72 6d 2e 0d r the platform..
8a10: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
8a20: 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 set fileName
8a30: 73 4f 6e 6c 79 20 5b 67 65 74 49 6e 74 65 72 6f sOnly [getIntero
8a40: 70 41 73 73 65 6d 62 6c 79 46 69 6c 65 4e 61 6d pAssemblyFileNam
8a50: 65 73 4f 6e 6c 79 5d 0d 0a 0d 0a 20 20 20 20 20 esOnly]....
8a60: 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 if {[llength
8a70: 24 66 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d 20 $fileNamesOnly]
8a80: 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
8a90: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 22 return "
8aa0: 22 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a ".. }....
8ab0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b return [
8ac0: 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 file nativename
8ad0: 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 [file join \..
8ae0: 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 69 [getBi
8af0: 6e 61 72 79 44 69 72 65 63 74 6f 72 79 5d 20 24 naryDirectory] $
8b00: 70 6c 61 74 66 6f 72 6d 20 5b 6c 69 6e 64 65 78 platform [lindex
8b10: 20 24 66 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 20 $fileNamesOnly
8b20: 30 5d 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 0]]].. }..
8b30: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
8b40: 63 20 67 65 74 43 6f 6d 6d 6f 6e 44 69 72 65 63 c getCommonDirec
8b50: 74 6f 72 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 tory {} {..
8b60: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
8b70: 3a 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 : This procedure
8b80: 20 72 65 74 75 72 6e 73 20 74 68 65 20 64 69 72 returns the dir
8b90: 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 68 65 ectory where the
8ba0: 20 74 65 73 74 20 73 63 72 69 70 74 73 0d 0a 20 test scripts..
8bb0: 20 20 20 20 20 23 20 20 20 20 20 20 20 73 68 6f # sho
8bc0: 75 6c 64 20 62 65 20 6c 6f 63 61 74 65 64 2e 20 uld be located.
8bd0: 20 42 79 20 64 65 66 61 75 6c 74 2c 20 74 68 69 By default, thi
8be0: 73 20 6a 75 73 74 20 72 65 74 75 72 6e 73 20 74 s just returns t
8bf0: 68 65 20 45 61 67 6c 65 0d 0a 20 20 20 20 20 20 he Eagle..
8c00: 23 20 20 20 20 20 20 20 62 69 6e 61 72 79 20 64 # binary d
8c10: 69 72 65 63 74 6f 72 79 2e 0d 0a 20 20 20 20 20 irectory...
8c20: 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 #.. if {[i
8c30: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 63 6f 6d nfo exists ::com
8c40: 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 mon_directory] &
8c50: 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b & \.. [
8c60: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a string length $:
8c70: 3a 63 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 :common_director
8c80: 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a y] > 0} then {..
8c90: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
8ca0: 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c # NOTE: The l
8cb0: 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 ocation of the c
8cc0: 6f 6d 6d 6f 6e 20 64 69 72 65 63 74 6f 72 79 20 ommon directory
8cd0: 68 61 73 20 62 65 65 6e 20 73 65 74 3b 0d 0a 20 has been set;..
8ce0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
8cf0: 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 herefore, use it
8d00: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
8d10: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
8d20: 63 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 common_directory
8d30: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 .. } elseif
8d40: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {[info exists :
8d50: 3a 76 65 6e 64 6f 72 5f 64 69 72 65 63 74 6f 72 :vendor_director
8d60: 79 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 y] && \..
8d70: 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 [string lengt
8d80: 68 20 24 3a 3a 76 65 6e 64 6f 72 5f 64 69 72 65 h $::vendor_dire
8d90: 63 74 6f 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e ctory] > 0} then
8da0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
8db0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 # NOTE: T
8dc0: 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 he location of t
8dd0: 68 65 20 76 65 6e 64 6f 72 20 64 69 72 65 63 74 he vendor direct
8de0: 6f 72 79 20 68 61 73 20 62 65 65 6e 20 73 65 74 ory has been set
8df0: 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 ;.. #
8e00: 20 20 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 therefore, us
8e10: 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 e it... #
8e20: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
8e30: 20 24 3a 3a 76 65 6e 64 6f 72 5f 64 69 72 65 63 $::vendor_direc
8e40: 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c tory.. } el
8e50: 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 seif {[info exis
8e60: 74 73 20 3a 3a 74 63 6c 5f 6c 69 62 72 61 72 79 ts ::tcl_library
8e70: 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] && \..
8e80: 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
8e90: 20 24 3a 3a 74 63 6c 5f 6c 69 62 72 61 72 79 5d $::tcl_library]
8ea0: 20 3e 20 30 20 26 26 20 5c 0d 0a 20 20 20 20 20 > 0 && \..
8eb0: 20 20 20 20 20 5b 66 69 6c 65 20 69 73 64 69 72 [file isdir
8ec0: 65 63 74 6f 72 79 20 24 3a 3a 74 63 6c 5f 6c 69 ectory $::tcl_li
8ed0: 62 72 61 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a brary]} then {..
8ee0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
8ef0: 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 76 # NOTE: The v
8f00: 61 72 69 61 62 6c 65 20 77 69 74 68 20 74 68 65 ariable with the
8f10: 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 location of the
8f20: 20 73 63 72 69 70 74 20 6c 69 62 72 61 72 79 20 script library
8f30: 69 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 is.. #
8f40: 20 20 20 20 73 65 74 20 61 6e 64 20 61 70 70 65 set and appe
8f50: 61 72 73 20 74 6f 20 62 65 20 61 20 72 65 61 6c ars to be a real
8f60: 20 64 69 72 65 63 74 6f 72 79 20 28 69 2e 65 2e directory (i.e.
8f70: 20 6e 6f 74 20 65 6d 62 65 64 64 65 64 0d 0a 20 not embedded..
8f80: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 77 # w
8f90: 69 74 68 69 6e 20 61 20 66 69 6c 65 29 3b 20 74 ithin a file); t
8fa0: 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 herefore, use it
8fb0: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
8fc0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
8fd0: 74 63 6c 5f 6c 69 62 72 61 72 79 0d 0a 20 20 20 tcl_library..
8fe0: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
8ff0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
9000: 23 20 4e 4f 54 45 3a 20 46 61 6c 6c 62 61 63 6b # NOTE: Fallback
9010: 20 74 6f 20 74 68 65 20 64 69 72 65 63 74 6f 72 to the director
9020: 79 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 y containing the
9030: 20 65 78 65 63 75 74 61 62 6c 65 2e 0d 0a 20 20 executable...
9040: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
9050: 20 72 65 74 75 72 6e 20 5b 69 6e 66 6f 20 62 69 return [info bi
9060: 6e 61 72 79 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a nary].. }..
9070: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
9080: 6f 63 20 67 65 74 44 61 74 61 62 61 73 65 44 69 oc getDatabaseDi
9090: 72 65 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a 20 20 rectory {} {..
90a0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
90b0: 4f 54 45 3a 20 54 68 69 73 20 70 72 6f 63 65 64 OTE: This proced
90c0: 75 72 65 20 72 65 74 75 72 6e 73 20 74 68 65 20 ure returns the
90d0: 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 directory where
90e0: 74 68 65 20 74 65 73 74 20 64 61 74 61 62 61 73 the test databas
90f0: 65 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 es.. #
9100: 20 20 73 68 6f 75 6c 64 20 62 65 20 6c 6f 63 61 should be loca
9110: 74 65 64 2e 20 20 42 79 20 64 65 66 61 75 6c 74 ted. By default
9120: 2c 20 74 68 69 73 20 6a 75 73 74 20 75 73 65 73 , this just uses
9130: 20 74 68 65 20 74 65 6d 70 6f 72 61 72 79 0d 0a the temporary..
9140: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 69 # di
9150: 72 65 63 74 6f 72 79 20 63 6f 6e 66 69 67 75 72 rectory configur
9160: 65 64 20 66 6f 72 20 74 68 69 73 20 73 79 73 74 ed for this syst
9170: 65 6d 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 em... #..
9180: 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
9190: 69 73 74 73 20 3a 3a 64 61 74 61 62 61 73 65 5f ists ::database_
91a0: 64 69 72 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d directory] && \.
91b0: 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 . [stri
91c0: 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 64 61 74 ng length $::dat
91d0: 61 62 61 73 65 5f 64 69 72 65 63 74 6f 72 79 5d abase_directory]
91e0: 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
91f0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
9200: 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 # NOTE: The loc
9210: 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 64 61 74 ation of the dat
9220: 61 62 61 73 65 20 64 69 72 65 63 74 6f 72 79 20 abase directory
9230: 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 has been overrid
9240: 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 den;.. #
9250: 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c therefore,
9260: 20 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 use it...
9270: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
9280: 75 72 6e 20 24 3a 3a 64 61 74 61 62 61 73 65 5f urn $::database_
9290: 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 directory..
92a0: 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 6f } elseif {[info
92b0: 20 65 78 69 73 74 73 20 3a 3a 73 63 72 61 74 63 exists ::scratc
92c0: 68 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 26 20 h_directory] &&
92d0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 \.. [st
92e0: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 73 ring length $::s
92f0: 63 72 61 74 63 68 5f 64 69 72 65 63 74 6f 72 79 cratch_directory
9300: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
9310: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
9320: 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f # NOTE: The lo
9330: 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 63 cation of the sc
9340: 72 61 74 63 68 20 64 69 72 65 63 74 6f 72 79 20 ratch directory
9350: 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 has been overrid
9360: 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 den;.. #
9370: 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c therefore,
9380: 20 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 use it...
9390: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
93a0: 75 72 6e 20 24 3a 3a 73 63 72 61 74 63 68 5f 64 urn $::scratch_d
93b0: 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 irectory..
93c0: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
93d0: 20 20 72 65 74 75 72 6e 20 5b 67 65 74 54 65 6d return [getTem
93e0: 70 6f 72 61 72 79 50 61 74 68 5d 0d 0a 20 20 20 poraryPath]..
93f0: 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
9400: 20 20 20 20 70 72 6f 63 20 67 65 74 54 65 6d 70 proc getTemp
9410: 6f 72 61 72 79 44 69 72 65 63 74 6f 72 79 20 7b oraryDirectory {
9420: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
9430: 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 # NOTE: This
9440: 20 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 72 procedure retur
9450: 6e 73 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 ns the directory
9460: 20 77 68 65 72 65 20 74 68 65 20 74 65 6d 70 6f where the tempo
9470: 72 61 72 79 20 66 69 6c 65 73 0d 0a 20 20 20 20 rary files..
9480: 20 20 23 20 20 20 20 20 20 20 73 68 6f 75 6c 64 # should
9490: 20 62 65 20 6c 6f 63 61 74 65 64 2e 20 20 42 79 be located. By
94a0: 20 64 65 66 61 75 6c 74 2c 20 74 68 69 73 20 6a default, this j
94b0: 75 73 74 20 75 73 65 73 20 74 68 65 20 74 65 6d ust uses the tem
94c0: 70 6f 72 61 72 79 0d 0a 20 20 20 20 20 20 23 20 porary.. #
94d0: 20 20 20 20 20 20 64 69 72 65 63 74 6f 72 79 20 directory
94e0: 63 6f 6e 66 69 67 75 72 65 64 20 66 6f 72 20 74 configured for t
94f0: 68 69 73 20 73 79 73 74 65 6d 2e 0d 0a 20 20 20 his system...
9500: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
9510: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
9520: 65 6d 70 6f 72 61 72 79 5f 64 69 72 65 63 74 6f emporary_directo
9530: 72 79 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 ry] && \..
9540: 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 [string leng
9550: 74 68 20 24 3a 3a 74 65 6d 70 6f 72 61 72 79 5f th $::temporary_
9560: 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 30 7d 20 directory] > 0}
9570: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
9580: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
9590: 45 3a 20 54 68 65 20 6c 6f 63 61 74 69 6f 6e 20 E: The location
95a0: 6f 66 20 74 68 65 20 74 65 6d 70 6f 72 61 72 79 of the temporary
95b0: 20 64 69 72 65 63 74 6f 72 79 20 68 61 73 20 62 directory has b
95c0: 65 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d een overridden;.
95d0: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
95e0: 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 therefore, use
95f0: 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a it... #..
9600: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
9610: 3a 3a 74 65 6d 70 6f 72 61 72 79 5f 64 69 72 65 ::temporary_dire
9620: 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 ctory.. } e
9630: 6c 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 lseif {[info exi
9640: 73 74 73 20 3a 3a 73 63 72 61 74 63 68 5f 64 69 sts ::scratch_di
9650: 72 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a 20 rectory] && \..
9660: 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 [string
9670: 20 6c 65 6e 67 74 68 20 24 3a 3a 73 63 72 61 74 length $::scrat
9680: 63 68 5f 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 ch_directory] >
9690: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
96a0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
96b0: 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 74 69 NOTE: The locati
96c0: 6f 6e 20 6f 66 20 74 68 65 20 73 63 72 61 74 63 on of the scratc
96d0: 68 20 64 69 72 65 63 74 6f 72 79 20 68 61 73 20 h directory has
96e0: 62 65 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b been overridden;
96f0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
9700: 20 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 therefore, use
9710: 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d it... #.
9720: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
9730: 24 3a 3a 73 63 72 61 74 63 68 5f 64 69 72 65 63 $::scratch_direc
9740: 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c tory.. } el
9750: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 se {.. re
9760: 74 75 72 6e 20 5b 67 65 74 54 65 6d 70 6f 72 61 turn [getTempora
9770: 72 79 50 61 74 68 5d 0d 0a 20 20 20 20 20 20 7d ryPath].. }
9780: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
9790: 70 72 6f 63 20 67 65 74 45 78 65 63 75 74 65 4f proc getExecuteO
97a0: 6e 53 65 74 75 70 20 7b 7d 20 7b 0d 0a 20 20 20 nSetup {} {..
97b0: 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 if {[info exi
97c0: 73 74 73 20 3a 3a 65 78 65 63 75 74 65 5f 6f 6e sts ::execute_on
97d0: 5f 73 65 74 75 70 5d 20 26 26 20 5c 0d 0a 20 20 _setup] && \..
97e0: 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
97f0: 6c 65 6e 67 74 68 20 24 3a 3a 65 78 65 63 75 74 length $::execut
9800: 65 5f 6f 6e 5f 73 65 74 75 70 5d 20 3e 20 30 7d e_on_setup] > 0}
9810: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
9820: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
9830: 54 45 3a 20 52 65 74 75 72 6e 20 74 68 65 20 63 TE: Return the c
9840: 6f 6e 66 69 67 75 72 65 64 20 53 51 4c 20 74 6f onfigured SQL to
9850: 20 65 78 65 63 75 74 65 20 64 75 72 69 6e 67 20 execute during
9860: 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 0d 0a the connection..
9870: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
9880: 73 65 74 75 70 20 70 72 6f 63 65 64 75 72 65 20 setup procedure
9890: 28 69 2e 65 2e 20 66 6f 72 20 65 76 65 72 79 20 (i.e. for every
98a0: 74 65 73 74 20 64 61 74 61 62 61 73 65 20 63 6f test database co
98b0: 6e 6e 65 63 74 69 6f 6e 29 2e 0d 0a 20 20 20 20 nnection)...
98c0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
98d0: 65 74 75 72 6e 20 24 3a 3a 65 78 65 63 75 74 65 eturn $::execute
98e0: 5f 6f 6e 5f 73 65 74 75 70 0d 0a 20 20 20 20 20 _on_setup..
98f0: 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
9900: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
9910: 4e 4f 54 45 3a 20 42 79 20 64 65 66 61 75 6c 74 NOTE: By default
9920: 2c 20 74 68 65 72 65 20 69 73 20 6e 6f 20 53 51 , there is no SQ
9930: 4c 20 74 6f 20 65 78 65 63 75 74 65 20 64 75 72 L to execute dur
9940: 69 6e 67 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 ing the connecti
9950: 6f 6e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 on.. #
9960: 20 20 20 20 73 65 74 75 70 20 70 72 6f 63 65 64 setup proced
9970: 75 72 65 20 28 69 2e 65 2e 20 66 6f 72 20 65 76 ure (i.e. for ev
9980: 65 72 79 20 74 65 73 74 20 64 61 74 61 62 61 73 ery test databas
9990: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 29 2e 0d 0a e connection)...
99a0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
99b0: 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 return ""..
99c0: 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
99d0: 0a 20 20 20 20 70 72 6f 63 20 67 65 74 54 65 73 . proc getTes
99e0: 74 4f 76 65 72 72 69 64 65 73 50 72 65 61 6d 62 tOverridesPreamb
99f0: 6c 65 20 7b 20 7b 65 78 74 72 61 56 61 72 4e 61 le { {extraVarNa
9a00: 6d 65 73 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 mes ""} } {..
9a10: 20 20 20 73 65 74 20 76 61 72 4e 61 6d 65 73 20 set varNames
9a20: 5b 6c 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 [list]....
9a30: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
9a40: 20 49 66 20 61 76 61 69 6c 61 62 6c 65 2c 20 73 If available, s
9a50: 74 61 72 74 20 77 69 74 68 20 74 68 65 20 6d 61 tart with the ma
9a60: 73 74 65 72 20 6c 69 73 74 20 6f 66 20 74 65 73 ster list of tes
9a70: 74 20 6f 76 65 72 72 69 64 65 0d 0a 20 20 20 20 t override..
9a80: 20 20 23 20 20 20 20 20 20 20 76 61 72 69 61 62 # variab
9a90: 6c 65 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 les... #..
9aa0: 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 if {[info e
9ab0: 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 6f 76 65 xists ::test_ove
9ac0: 72 72 69 64 65 73 5d 20 26 26 20 5c 0d 0a 20 20 rrides] && \..
9ad0: 20 20 20 20 20 20 20 20 5b 6c 6c 65 6e 67 74 68 [llength
9ae0: 20 24 3a 3a 74 65 73 74 5f 6f 76 65 72 72 69 64 $::test_overrid
9af0: 65 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d es] > 0} then {.
9b00: 0a 20 20 20 20 20 20 20 20 65 76 61 6c 20 6c 61 . eval la
9b10: 70 70 65 6e 64 20 76 61 72 4e 61 6d 65 73 20 24 ppend varNames $
9b20: 3a 3a 74 65 73 74 5f 6f 76 65 72 72 69 64 65 73 ::test_overrides
9b30: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
9b40: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
9b50: 54 45 3a 20 49 66 20 72 65 71 75 65 73 74 65 64 TE: If requested
9b60: 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 2c 20 by our caller,
9b70: 61 64 64 20 61 6e 79 20 61 64 64 69 74 69 6f 6e add any addition
9b80: 61 6c 20 76 61 72 69 61 62 6c 65 0d 0a 20 20 20 al variable..
9b90: 20 20 20 23 20 20 20 20 20 20 20 6e 61 6d 65 73 # names
9ba0: 20 74 6f 20 63 6f 70 79 20 6e 6f 77 2e 0d 0a 20 to copy now...
9bb0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
9bc0: 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 65 78 74 72 {[llength $extr
9bd0: 61 56 61 72 4e 61 6d 65 73 5d 20 3e 20 30 7d 20 aVarNames] > 0}
9be0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
9bf0: 65 76 61 6c 20 6c 61 70 70 65 6e 64 20 76 61 72 eval lappend var
9c00: 4e 61 6d 65 73 20 24 65 78 74 72 61 56 61 72 4e Names $extraVarN
9c10: 61 6d 65 73 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d ames.. }...
9c20: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
9c30: 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 # NOTE: Build th
9c40: 65 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e e script fragmen
9c50: 74 20 74 6f 20 62 65 20 72 65 74 75 72 6e 65 64 t to be returned
9c60: 20 62 79 20 70 72 6f 63 65 73 73 69 6e 67 20 65 by processing e
9c70: 61 63 68 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ach.. #
9c80: 20 20 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 variable name
9c90: 20 61 6e 64 20 61 64 64 69 6e 67 20 74 68 65 20 and adding the
9ca0: 6e 65 63 65 63 65 73 73 61 72 79 20 73 63 72 69 nececessary scri
9cb0: 70 74 20 66 72 61 67 6d 65 6e 74 73 20 66 6f 72 pt fragments for
9cc0: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
9cd0: 65 61 63 68 20 6f 6e 65 2e 0d 0a 20 20 20 20 20 each one...
9ce0: 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 72 65 #.. set re
9cf0: 73 75 6c 74 20 22 22 0d 0a 0d 0a 20 20 20 20 20 sult ""....
9d00: 20 66 6f 72 65 61 63 68 20 76 61 72 4e 61 6d 65 foreach varName
9d10: 20 24 76 61 72 4e 61 6d 65 73 20 7b 0d 0a 20 20 $varNames {..
9d20: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
9d30: 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 # NOTE: Build t
9d40: 68 65 20 71 75 61 6c 69 66 69 65 64 20 67 6c 6f he qualified glo
9d50: 62 61 6c 20 76 61 72 69 61 62 6c 65 20 6e 61 6d bal variable nam
9d60: 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 e... #..
9d70: 20 20 20 20 20 20 20 73 65 74 20 66 75 6c 6c 56 set fullV
9d80: 61 72 4e 61 6d 65 20 5b 61 70 70 65 6e 64 41 72 arName [appendAr
9d90: 67 73 20 3a 3a 20 24 76 61 72 4e 61 6d 65 5d 0d gs :: $varName].
9da0: 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
9db0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 6f # NOTE: Do
9dc0: 65 73 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 es the variable
9dd0: 65 78 69 73 74 20 69 6e 20 74 68 69 73 20 69 6e exist in this in
9de0: 74 65 72 70 72 65 74 65 72 20 63 6f 6e 74 65 78 terpreter contex
9df0: 74 3f 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 t?.. #..
9e00: 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f if {[info
9e10: 20 65 78 69 73 74 73 20 24 66 75 6c 6c 56 61 72 exists $fullVar
9e20: 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 Name]} then {..
9e30: 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
9e40: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 70 # NOTE: Ap
9e50: 70 65 6e 64 20 61 20 73 63 72 69 70 74 20 66 72 pend a script fr
9e60: 61 67 6d 65 6e 74 20 74 6f 20 74 68 65 20 72 65 agment to the re
9e70: 73 75 6c 74 20 74 68 61 74 20 77 69 6c 6c 20 63 sult that will c
9e80: 6f 72 72 65 63 74 6c 79 0d 0a 20 20 20 20 20 20 orrectly..
9e90: 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 70 79 # copy
9ea0: 20 61 6e 79 20 63 6f 6e 74 61 69 6e 65 64 20 76 any contained v
9eb0: 61 6c 75 65 20 74 6f 20 61 6e 6f 74 68 65 72 20 alue to another
9ec0: 69 6e 74 65 72 70 72 65 74 65 72 20 63 6f 6e 74 interpreter cont
9ed0: 65 78 74 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ext...
9ee0: 23 0d 0a 20 20 20 20 20 20 20 20 20 20 61 70 70 #.. app
9ef0: 65 6e 64 20 72 65 73 75 6c 74 20 5c 6e 20 22 73 end result \n "s
9f00: 65 74 20 22 20 24 66 75 6c 6c 56 61 72 4e 61 6d et " $fullVarNam
9f10: 65 20 22 20 5c 7b 22 20 5b 73 65 74 20 24 66 75 e " \{" [set $fu
9f20: 6c 6c 56 61 72 4e 61 6d 65 5d 20 5c 7d 0d 0a 20 llVarName] \}..
9f30: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
9f40: 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
9f50: 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 # NOTE: If t
9f60: 68 65 20 72 65 73 75 6c 74 20 63 6f 6e 74 61 69 he result contai
9f70: 6e 73 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 73 ns one or more s
9f80: 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 73 2c cript fragments,
9f90: 20 61 70 70 65 6e 64 20 61 0d 0a 20 20 20 20 20 append a..
9fa0: 20 23 20 20 20 20 20 20 20 6e 65 77 6c 69 6e 65 # newline
9fb0: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
9fc0: 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
9fd0: 6e 67 74 68 20 24 72 65 73 75 6c 74 5d 20 3e 20 ngth $result] >
9fe0: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
9ff0: 20 20 20 61 70 70 65 6e 64 20 72 65 73 75 6c 74 append result
a000: 20 5c 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a \n.. }....
a010: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 return $re
a020: 73 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a sult.. }.....
a030: 20 20 20 20 70 72 6f 63 20 6d 6f 76 65 53 79 73 proc moveSys
a040: 74 65 6d 44 61 74 61 53 51 4c 69 74 65 44 6c 6c temDataSQLiteDll
a050: 43 6f 6e 66 69 67 20 7b 20 7b 72 65 73 74 6f 72 Config { {restor
a060: 65 20 66 61 6c 73 65 7d 20 7b 76 65 72 62 6f 73 e false} {verbos
a070: 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 e true} } {..
a080: 20 20 20 73 65 74 20 64 69 72 65 63 74 6f 72 79 set directory
a090: 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 [object invoke
a0a0: 41 70 70 44 6f 6d 61 69 6e 20 43 75 72 72 65 6e AppDomain Curren
a0b0: 74 44 6f 6d 61 69 6e 2e 42 61 73 65 44 69 72 65 tDomain.BaseDire
a0c0: 63 74 6f 72 79 5d 0d 0a 0d 0a 20 20 20 20 20 20 ctory]....
a0d0: 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
a0e0: 74 68 20 24 64 69 72 65 63 74 6f 72 79 5d 20 3d th $directory] =
a0f0: 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
a100: 20 20 20 20 20 69 66 20 7b 24 76 65 72 62 6f 73 if {$verbos
a110: 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 e} then {..
a120: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
a130: 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
a140: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
a150: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6b "---- sk
a160: 69 70 70 65 64 20 6d 6f 76 69 6e 67 20 5c 22 53 ipped moving \"S
a170: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
a180: 65 2e 64 6c 6c 2e 63 6f 6e 66 69 67 5c 22 2c 20 e.dll.config\",
a190: 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
a1a0: 20 20 20 22 6e 6f 20 62 61 73 65 20 64 69 72 65 "no base dire
a1b0: 63 74 6f 72 79 5c 6e 22 5d 0d 0a 20 20 20 20 20 ctory\n"]..
a1c0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
a1d0: 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 20 7d 0d return.. }.
a1e0: 0a 0d 0a 20 20 20 20 20 20 73 65 74 20 66 69 6c ... set fil
a1f0: 65 4e 61 6d 65 28 31 29 20 5b 66 69 6c 65 20 6e eName(1) [file n
a200: 6f 72 6d 61 6c 69 7a 65 20 5c 0d 0a 20 20 20 20 ormalize \..
a210: 20 20 20 20 20 20 5b 66 69 6c 65 20 6a 6f 69 6e [file join
a220: 20 24 64 69 72 65 63 74 6f 72 79 20 53 79 73 74 $directory Syst
a230: 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 em.Data.SQLite.d
a240: 6c 6c 2e 63 6f 6e 66 69 67 5d 5d 0d 0a 0d 0a 20 ll.config]]....
a250: 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d set fileNam
a260: 65 28 32 29 20 5b 61 70 70 65 6e 64 41 72 67 73 e(2) [appendArgs
a270: 20 24 66 69 6c 65 4e 61 6d 65 28 31 29 20 2e 6d $fileName(1) .m
a280: 6f 76 65 64 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 oved].... i
a290: 66 20 7b 24 72 65 73 74 6f 72 65 7d 20 74 68 65 f {$restore} the
a2a0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
a2b0: 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 {[file exists $f
a2c0: 69 6c 65 4e 61 6d 65 28 32 29 5d 7d 20 74 68 65 ileName(2)]} the
a2d0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 n {.. f
a2e0: 69 6c 65 20 72 65 6e 61 6d 65 20 24 66 69 6c 65 ile rename $file
a2f0: 4e 61 6d 65 28 32 29 20 24 66 69 6c 65 4e 61 6d Name(2) $fileNam
a300: 65 28 31 29 0d 0a 0d 0a 20 20 20 20 20 20 20 20 e(1)....
a310: 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 if {$verbose}
a320: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
a330: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
a340: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
a350: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
a360: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6d "---- m
a370: 6f 76 65 64 20 5c 22 22 20 24 66 69 6c 65 4e 61 oved \"" $fileNa
a380: 6d 65 28 32 29 20 22 5c 22 20 74 6f 20 5c 22 22 me(2) "\" to \""
a390: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
a3a0: 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 28 31 29 $fileName(1)
a3b0: 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 \"\n]..
a3c0: 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 }.. } e
a3d0: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
a3e0: 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 if {$verbose} t
a3f0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
a400: 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
a410: 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
a420: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
a430: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6b "---- sk
a440: 69 70 70 65 64 20 6d 6f 76 69 6e 67 20 5c 22 22 ipped moving \""
a450: 20 24 66 69 6c 65 4e 61 6d 65 28 32 29 20 5c 0d $fileName(2) \.
a460: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
a470: 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f "\", it does no
a480: 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 t exist\n"]..
a490: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
a4a0: 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 }.. } els
a4b0: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 e {.. if
a4c0: 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 {[file exists $f
a4d0: 69 6c 65 4e 61 6d 65 28 31 29 5d 7d 20 74 68 65 ileName(1)]} the
a4e0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 n {.. f
a4f0: 69 6c 65 20 72 65 6e 61 6d 65 20 24 66 69 6c 65 ile rename $file
a500: 4e 61 6d 65 28 31 29 20 24 66 69 6c 65 4e 61 6d Name(1) $fileNam
a510: 65 28 32 29 0d 0a 0d 0a 20 20 20 20 20 20 20 20 e(2)....
a520: 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 if {$verbose}
a530: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
a540: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
a550: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
a560: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
a570: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6d "---- m
a580: 6f 76 65 64 20 5c 22 22 20 24 66 69 6c 65 4e 61 oved \"" $fileNa
a590: 6d 65 28 31 29 20 22 5c 22 20 74 6f 20 5c 22 22 me(1) "\" to \""
a5a0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
a5b0: 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 28 32 29 $fileName(2)
a5c0: 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 \"\n]..
a5d0: 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 }.. } e
a5e0: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
a5f0: 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 if {$verbose} t
a600: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
a610: 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
a620: 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
a630: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
a640: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6b "---- sk
a650: 69 70 70 65 64 20 6d 6f 76 69 6e 67 20 5c 22 22 ipped moving \""
a660: 20 24 66 69 6c 65 4e 61 6d 65 28 31 29 20 5c 0d $fileName(1) \.
a670: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
a680: 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f "\", it does no
a690: 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 t exist\n"]..
a6a0: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
a6b0: 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
a6c0: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
a6d0: 20 67 65 74 41 70 70 44 6f 6d 61 69 6e 50 72 65 getAppDomainPre
a6e0: 61 6d 62 6c 65 20 7b 20 7b 70 72 65 66 69 78 20 amble { {prefix
a6f0: 22 22 7d 20 7b 73 75 66 66 69 78 20 22 22 7d 20 ""} {suffix ""}
a700: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
a710: 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 # NOTE: This
a720: 20 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 72 procedure retur
a730: 6e 73 20 61 20 74 65 73 74 20 73 65 74 75 70 20 ns a test setup
a740: 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 20 script fragment
a750: 73 75 69 74 61 62 6c 65 20 66 6f 72 0d 0a 20 20 suitable for..
a760: 20 20 20 20 23 20 20 20 20 20 20 20 65 76 61 6c # eval
a770: 75 61 74 69 6f 6e 20 62 79 20 61 6e 20 69 6e 74 uation by an int
a780: 65 72 70 72 65 74 65 72 20 63 72 65 61 74 65 64 erpreter created
a790: 20 69 6e 20 61 6e 20 69 73 6f 6c 61 74 65 64 20 in an isolated
a7a0: 61 70 70 6c 69 63 61 74 69 6f 6e 0d 0a 20 20 20 application..
a7b0: 20 20 20 23 20 20 20 20 20 20 20 64 6f 6d 61 69 # domai
a7c0: 6e 2e 20 20 54 68 65 20 73 63 72 69 70 74 20 66 n. The script f
a7d0: 72 61 67 6d 65 6e 74 20 62 65 69 6e 67 20 72 65 ragment being re
a7e0: 74 75 72 6e 65 64 20 77 69 6c 6c 20 62 65 20 73 turned will be s
a7f0: 75 72 72 6f 75 6e 64 65 64 20 62 79 0d 0a 20 20 urrounded by..
a800: 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 # the
a810: 70 72 65 66 69 78 20 61 6e 64 20 73 75 66 66 69 prefix and suffi
a820: 78 20 22 73 63 72 69 70 74 20 66 72 61 67 6d 65 x "script fragme
a830: 6e 74 73 22 20 73 70 65 63 69 66 69 65 64 20 62 nts" specified b
a840: 79 20 6f 75 72 20 63 61 6c 6c 65 72 2c 0d 0a 20 y our caller,..
a850: 20 20 20 20 20 23 20 20 20 20 20 20 20 69 66 20 # if
a860: 61 6e 79 2e 20 20 54 68 65 20 65 6e 74 69 72 65 any. The entire
a870: 20 73 63 72 69 70 74 20 62 65 69 6e 67 20 72 65 script being re
a880: 74 75 72 6e 65 64 20 77 69 6c 6c 20 62 65 20 73 turned will be s
a890: 75 62 73 74 69 74 75 74 65 64 20 76 69 61 0d 0a ubstituted via..
a8a0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 5b 73 # [s
a8b0: 75 62 73 74 5d 2c 20 69 6e 20 74 68 65 20 63 6f ubst], in the co
a8c0: 6e 74 65 78 74 20 6f 66 20 6f 75 72 20 63 61 6c ntext of our cal
a8d0: 6c 65 72 2c 20 62 65 66 6f 72 65 20 62 65 69 6e ler, before bein
a8e0: 67 20 72 65 74 75 72 6e 65 64 2e 0d 0a 20 20 20 g returned...
a8f0: 20 20 20 23 20 20 20 20 20 20 20 54 68 69 73 20 # This
a900: 73 74 65 70 20 69 73 20 6e 65 63 65 73 73 61 72 step is necessar
a910: 79 20 73 6f 20 74 68 61 74 20 73 6f 6d 65 20 6c y so that some l
a920: 69 6d 69 74 65 64 20 63 6f 6e 74 65 78 74 20 69 imited context i
a930: 6e 66 6f 72 6d 61 74 69 6f 6e 2c 0d 0a 20 20 20 nformation,..
a940: 20 20 20 23 20 20 20 20 20 20 20 70 72 69 6d 61 # prima
a950: 72 69 6c 79 20 72 65 6c 61 74 65 64 20 74 6f 20 rily related to
a960: 74 68 65 20 74 65 73 74 69 6e 67 20 64 69 72 65 the testing dire
a970: 63 74 6f 72 69 65 73 2c 20 63 61 6e 20 62 65 20 ctories, can be
a980: 74 72 61 6e 73 66 65 72 72 65 64 0d 0a 20 20 20 transferred..
a990: 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 74 68 # to th
a9a0: 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 69 6e e interpreter in
a9b0: 20 74 68 65 20 69 73 6f 6c 61 74 65 64 20 61 70 the isolated ap
a9c0: 70 6c 69 63 61 74 69 6f 6e 20 64 6f 6d 61 69 6e plication domain
a9d0: 2c 20 6d 61 6b 69 6e 67 20 69 74 0d 0a 20 20 20 , making it..
a9e0: 20 20 20 23 20 20 20 20 20 20 20 61 62 6c 65 20 # able
a9f0: 74 6f 20 73 75 63 63 65 73 73 66 75 6c 6c 79 20 to successfully
aa00: 72 75 6e 20 74 65 73 74 73 20 74 68 61 74 20 72 run tests that r
aa10: 65 71 75 69 72 65 20 6f 6e 65 20 6f 72 20 6d 6f equire one or mo
aa20: 72 65 20 6f 66 20 74 68 65 0d 0a 20 20 20 20 20 re of the..
aa30: 20 23 20 20 20 20 20 20 20 66 69 6c 65 73 20 69 # files i
aa40: 6e 20 6f 6e 65 20 6f 66 20 74 68 65 20 74 65 73 n one of the tes
aa50: 74 69 6e 67 20 64 69 72 65 63 74 6f 72 69 65 73 ting directories
aa60: 2e 20 20 43 61 6c 6c 65 72 73 20 73 68 6f 75 6c . Callers shoul
aa70: 64 20 6b 65 65 70 20 69 6e 0d 0a 20 20 20 20 20 d keep in..
aa80: 20 23 20 20 20 20 20 20 20 6d 69 6e 64 20 74 68 # mind th
aa90: 61 74 20 74 68 65 20 74 65 73 74 20 73 63 72 69 at the test scri
aaa0: 70 74 20 66 72 61 67 6d 65 6e 74 20 62 65 69 6e pt fragment bein
aab0: 67 20 72 65 74 75 72 6e 65 64 20 63 61 6e 6e 6f g returned canno
aac0: 74 20 72 65 6c 79 20 6f 6e 0d 0a 20 20 20 20 20 t rely on..
aad0: 20 23 20 20 20 20 20 20 20 61 6e 79 20 73 63 72 # any scr
aae0: 69 70 74 20 6c 69 62 72 61 72 79 20 70 72 6f 63 ipt library proc
aaf0: 65 64 75 72 65 73 20 74 68 61 74 20 61 72 65 20 edures that are
ab00: 6e 6f 74 20 70 72 6f 76 69 64 65 64 20 62 79 20 not provided by
ab10: 74 68 65 20 45 61 67 6c 65 0d 0a 20 20 20 20 20 the Eagle..
ab20: 20 23 20 20 20 20 20 20 20 6c 69 62 72 61 72 79 # library
ab30: 20 70 61 63 6b 61 67 65 20 28 69 2e 65 2e 20 22 package (i.e. "
ab40: 69 6e 69 74 2e 65 61 67 6c 65 22 29 2c 20 69 6e init.eagle"), in
ab50: 63 6c 75 64 69 6e 67 20 74 68 6f 73 65 20 70 72 cluding those pr
ab60: 6f 76 69 64 65 64 20 62 79 0d 0a 20 20 20 20 20 ovided by..
ab70: 20 23 20 20 20 20 20 20 20 74 68 65 20 45 61 67 # the Eag
ab80: 6c 65 20 74 65 73 74 20 70 61 63 6b 61 67 65 2c le test package,
ab90: 20 75 6e 6c 65 73 73 20 74 68 65 20 66 69 6c 65 unless the file
aba0: 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 6d containing them
abb0: 20 69 73 20 6c 6f 61 64 65 64 0d 0a 20 20 20 20 is loaded..
abc0: 20 20 23 20 20 20 20 20 20 20 6d 61 6e 75 61 6c # manual
abd0: 6c 79 20 76 69 61 20 73 6f 6d 65 20 6f 74 68 65 ly via some othe
abe0: 72 20 6d 65 63 68 61 6e 69 73 6d 20 28 65 2e 67 r mechanism (e.g
abf0: 2e 20 62 79 20 69 6e 63 6c 75 64 69 6e 67 20 61 . by including a
ac00: 70 70 72 6f 70 72 69 61 74 65 0d 0a 20 20 20 20 ppropriate..
ac10: 20 20 23 20 20 20 20 20 20 20 5b 70 61 63 6b 61 # [packa
ac20: 67 65 20 72 65 71 75 69 72 65 5d 20 6f 72 20 5b ge require] or [
ac30: 73 6f 75 72 63 65 5d 20 63 6f 6d 6d 61 6e 64 73 source] commands
ac40: 20 69 6e 20 74 68 65 20 70 72 65 66 69 78 20 6f in the prefix o
ac50: 72 20 73 75 66 66 69 78 0d 0a 20 20 20 20 20 20 r suffix..
ac60: 23 20 20 20 20 20 20 20 73 63 72 69 70 74 20 66 # script f
ac70: 72 61 67 6d 65 6e 74 73 29 2e 20 20 41 6c 73 6f ragments). Also
ac80: 2c 20 61 6c 6c 20 76 61 72 69 61 62 6c 65 20 72 , all variable r
ac90: 65 66 65 72 65 6e 63 65 73 20 61 6e 64 20 61 6c eferences and al
aca0: 6c 20 6e 65 73 74 65 64 0d 0a 20 20 20 20 20 20 l nested..
acb0: 23 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 73 # commands
acc0: 20 28 69 2e 65 2e 20 74 68 6f 73 65 20 69 6e 20 (i.e. those in
acd0: 73 71 75 61 72 65 20 62 72 61 63 6b 65 74 73 29 square brackets)
ace0: 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e 20 74 68 contained in th
acf0: 65 20 66 69 6e 61 6c 0d 0a 20 20 20 20 20 20 23 e final.. #
ad00: 20 20 20 20 20 20 20 73 63 72 69 70 74 20 66 72 script fr
ad10: 61 67 6d 65 6e 74 20 77 69 6c 6c 20 65 6e 64 20 agment will end
ad20: 75 70 20 62 65 69 6e 67 20 65 76 61 6c 75 61 74 up being evaluat
ad30: 65 64 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 ed in the contex
ad40: 74 20 6f 66 20 74 68 65 0d 0a 20 20 20 20 20 20 t of the..
ad50: 23 20 20 20 20 20 20 20 63 61 6c 6c 69 6e 67 20 # calling
ad60: 69 6e 74 65 72 70 72 65 74 65 72 20 61 6e 64 20 interpreter and
ad70: 6e 6f 74 20 74 68 65 20 74 61 72 67 65 74 20 69 not the target i
ad80: 6e 74 65 72 70 72 65 74 65 72 20 63 72 65 61 74 nterpreter creat
ad90: 65 64 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 ed in the..
ada0: 20 23 20 20 20 20 20 20 20 69 73 6f 6c 61 74 65 # isolate
adb0: 64 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 64 6f d application do
adc0: 6d 61 69 6e 20 75 6e 6c 65 73 73 20 74 68 65 20 main unless the
add0: 64 6f 6c 6c 61 72 20 73 69 67 6e 73 20 61 6e 64 dollar signs and
ade0: 2f 6f 72 20 73 71 75 61 72 65 0d 0a 20 20 20 20 /or square..
adf0: 20 20 23 20 20 20 20 20 20 20 62 72 61 63 6b 65 # bracke
ae00: 74 73 20 61 72 65 20 73 70 65 63 69 61 6c 6c 79 ts are specially
ae10: 20 71 75 6f 74 65 64 20 77 69 74 68 20 62 61 63 quoted with bac
ae20: 6b 73 6c 61 73 68 65 73 2e 0d 0a 20 20 20 20 20 kslashes...
ae30: 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e #.. return
ae40: 20 5b 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 [uplevel 1 [lis
ae50: 74 20 73 75 62 73 74 20 5b 61 70 70 65 6e 64 41 t subst [appendA
ae60: 72 67 73 20 24 70 72 65 66 69 78 20 7b 0d 0a 20 rgs $prefix {..
ae70: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
ae80: 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 5c 5b # NOTE: The \[
ae90: 6f 62 6a 65 63 74 5c 5d 20 63 6f 6d 6d 61 6e 64 object\] command
aea0: 20 6d 61 79 20 62 65 20 6d 69 73 73 69 6e 67 20 may be missing
aeb0: 69 6e 20 73 6f 6d 65 20 45 61 67 6c 65 20 63 6f in some Eagle co
aec0: 72 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 re.. #
aed0: 20 20 20 20 6c 69 62 72 61 72 79 20 63 6f 6e 66 library conf
aee0: 69 67 75 72 61 74 69 6f 6e 73 2e 20 20 43 6c 6f igurations. Clo
aef0: 6e 69 6e 67 20 61 6e 64 20 75 73 69 6e 67 20 74 ning and using t
af00: 68 65 20 70 72 6f 63 65 64 75 72 65 0d 0a 20 20 he procedure..
af10: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 5c 5b # \[
af20: 63 68 61 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 changeNativeRunt
af30: 69 6d 65 4f 70 74 69 6f 6e 5c 5d 20 6d 61 79 20 imeOption\] may
af40: 68 65 6c 70 20 74 6f 20 6d 69 74 69 67 61 74 65 help to mitigate
af50: 20 74 68 69 73 2e 0d 0a 20 20 20 20 20 20 20 20 this...
af60: 23 0d 0a 20 20 20 20 20 20 20 20 70 72 6f 63 20 #.. proc
af70: 63 68 61 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 changeNativeRunt
af80: 69 6d 65 4f 70 74 69 6f 6e 20 5c 0d 0a 20 20 20 imeOption \..
af90: 20 20 20 20 20 20 20 20 20 7b 5b 69 6e 66 6f 20 {[info
afa0: 61 72 67 73 20 63 68 61 6e 67 65 4e 61 74 69 76 args changeNativ
afb0: 65 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 5d 7d eRuntimeOption]}
afc0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
afd0: 7b 5b 69 6e 66 6f 20 62 6f 64 79 20 63 68 61 6e {[info body chan
afe0: 67 65 4e 61 74 69 76 65 52 75 6e 74 69 6d 65 4f geNativeRuntimeO
aff0: 70 74 69 6f 6e 5d 7d 0d 0a 0d 0a 20 20 20 20 20 ption]}....
b000: 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 catch {..
b010: 20 20 20 20 20 20 63 68 61 6e 67 65 4e 61 74 69 changeNati
b020: 76 65 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 veRuntimeOption
b030: 5b 68 61 73 52 75 6e 74 69 6d 65 4f 70 74 69 6f [hasRuntimeOptio
b040: 6e 20 6e 61 74 69 76 65 5d 0d 0a 20 20 20 20 20 n native]..
b050: 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 5b 67 }.. } [g
b060: 65 74 54 65 73 74 4f 76 65 72 72 69 64 65 73 50 etTestOverridesP
b070: 72 65 61 6d 62 6c 65 20 5b 6c 69 73 74 20 70 61 reamble [list pa
b080: 74 68 20 74 65 73 74 5f 63 68 61 6e 6e 65 6c 5d th test_channel]
b090: 5d 20 24 73 75 66 66 69 78 5d 5d 5d 0d 0a 20 20 ] $suffix]]]..
b0a0: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
b0b0: 20 74 72 79 43 6f 70 79 45 78 74 65 72 6e 61 6c tryCopyExternal
b0c0: 46 69 6c 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 File {..
b0d0: 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c fileName {pl
b0e0: 61 74 66 6f 72 6d 20 22 22 7d 20 7b 6e 65 77 46 atform ""} {newF
b0f0: 69 6c 65 4e 61 6d 65 20 22 22 7d 20 7b 76 65 72 ileName ""} {ver
b100: 62 6f 73 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a bose true} } {..
b110: 20 20 20 20 20 20 73 65 74 20 73 6f 75 72 63 65 set source
b120: 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 45 78 74 FileName [getExt
b130: 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 20 24 66 ernalFileName $f
b140: 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 ileName]....
b150: 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 if {![file exi
b160: 73 74 73 20 24 73 6f 75 72 63 65 46 69 6c 65 4e sts $sourceFileN
b170: 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ame]} then {..
b180: 20 20 20 20 20 20 69 66 20 7b 24 76 65 72 62 6f if {$verbo
b190: 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 se} then {..
b1a0: 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
b1b0: 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
b1c0: 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
b1d0: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
b1e0: 6b 69 70 70 65 64 20 63 6f 70 79 69 6e 67 20 65 kipped copying e
b1f0: 78 74 65 72 6e 61 6c 20 66 69 6c 65 20 5c 22 22 xternal file \""
b200: 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 $sourceFileName
b210: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
b220: 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e "\", it does n
b230: 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 ot exist\n"]..
b240: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
b250: 20 20 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 return..
b260: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b }.... if {
b270: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
b280: 6e 65 77 46 69 6c 65 4e 61 6d 65 5d 20 3e 20 30 newFileName] > 0
b290: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
b2a0: 20 20 73 65 74 20 74 61 72 67 65 74 46 69 6c 65 set targetFile
b2b0: 4e 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 46 Name [getBinaryF
b2c0: 69 6c 65 4e 61 6d 65 20 24 6e 65 77 46 69 6c 65 ileName $newFile
b2d0: 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d Name $platform].
b2e0: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
b2f0: 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 61 72 . set tar
b300: 67 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 getFileName [get
b310: 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 BinaryFileName $
b320: 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f fileName $platfo
b330: 72 6d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a rm].. }....
b340: 20 20 20 20 20 20 73 65 74 20 74 61 72 67 65 74 set target
b350: 44 69 72 65 63 74 6f 72 79 20 5b 66 69 6c 65 20 Directory [file
b360: 64 69 72 6e 61 6d 65 20 24 74 61 72 67 65 74 46 dirname $targetF
b370: 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 ileName]....
b380: 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
b390: 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 66 69 if {![fi
b3a0: 6c 65 20 65 78 69 73 74 73 20 24 74 61 72 67 65 le exists $targe
b3b0: 74 44 69 72 65 63 74 6f 72 79 5d 7d 20 74 68 65 tDirectory]} the
b3c0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 n {.. f
b3d0: 69 6c 65 20 6d 6b 64 69 72 20 24 74 61 72 67 65 ile mkdir $targe
b3e0: 74 44 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 tDirectory..
b3f0: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
b400: 20 66 69 6c 65 20 63 6f 70 79 20 2d 66 6f 72 63 file copy -forc
b410: 65 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d e $sourceFileNam
b420: 65 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d e $targetFileNam
b430: 65 0d 0a 20 20 20 20 20 20 7d 5d 20 3d 3d 20 30 e.. }] == 0
b440: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
b450: 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
b460: 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
b470: 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
b480: 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 69 65 64 20 "---- copied
b490: 65 78 74 65 72 6e 61 6c 20 66 69 6c 65 20 66 72 external file fr
b4a0: 6f 6d 20 5c 22 22 20 24 73 6f 75 72 63 65 46 69 om \"" $sourceFi
b4b0: 6c 65 4e 61 6d 65 20 22 5c 22 20 74 6f 20 5c 22 leName "\" to \"
b4c0: 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
b4d0: 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 $targetFileName
b4e0: 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 \"\n].. }
b4f0: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
b500: 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
b510: 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
b520: 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
b530: 20 22 2d 2d 2d 2d 20 66 61 69 6c 65 64 20 74 6f "---- failed to
b540: 20 63 6f 70 79 20 65 78 74 65 72 6e 61 6c 20 66 copy external f
b550: 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 73 6f ile from \"" $so
b560: 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a urceFileName \..
b570: 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 "\"
b580: 74 6f 20 5c 22 22 20 24 74 61 72 67 65 74 46 69 to \"" $targetFi
b590: 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 leName \"\n]..
b5a0: 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
b5b0: 0a 20 20 20 20 70 72 6f 63 20 74 72 79 43 6f 70 . proc tryCop
b5c0: 79 42 69 6e 61 72 79 46 69 6c 65 20 7b 0d 0a 20 yBinaryFile {..
b5d0: 20 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 4e fileN
b5e0: 61 6d 65 20 6d 61 6e 61 67 65 64 4f 6e 6c 79 20 ame managedOnly
b5f0: 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7b 6e {platform ""} {n
b600: 65 77 46 69 6c 65 4e 61 6d 65 20 22 22 7d 0d 0a ewFileName ""}..
b610: 20 20 20 20 20 20 20 20 20 20 20 20 7b 76 65 72 {ver
b620: 62 6f 73 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a bose true} } {..
b630: 20 20 20 20 20 20 73 65 74 20 73 6f 75 72 63 65 set source
b640: 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 69 6e FileName [getBin
b650: 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c aryFileName $fil
b660: 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d eName $platform]
b670: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b .... if {![
b680: 66 69 6c 65 20 65 78 69 73 74 73 20 24 73 6f 75 file exists $sou
b690: 72 63 65 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 rceFileName]} th
b6a0: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 en {.. if
b6b0: 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e {$verbose} then
b6c0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 {.. tp
b6d0: 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
b6e0: 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
b6f0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
b700: 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 63 "---- skipped c
b710: 6f 70 79 69 6e 67 20 62 69 6e 61 72 79 20 66 69 opying binary fi
b720: 6c 65 20 5c 22 22 20 24 73 6f 75 72 63 65 46 69 le \"" $sourceFi
b730: 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 leName \..
b740: 20 20 20 20 20 20 20 20 22 5c 22 2c 20 69 74 20 "\", it
b750: 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 5c 6e does not exist\n
b760: 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d "].. }...
b770: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 0d . return.
b780: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
b790: 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
b7a0: 6e 67 74 68 20 24 6e 65 77 46 69 6c 65 4e 61 6d ngth $newFileNam
b7b0: 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a e] > 0} then {..
b7c0: 20 20 20 20 20 20 20 20 73 65 74 20 74 61 72 67 set targ
b7d0: 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 etFileName [getB
b7e0: 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a uildFileName \..
b7f0: 20 20 20 20 20 20 20 20 20 20 20 20 24 6e 65 77 $new
b800: 46 69 6c 65 4e 61 6d 65 20 24 6d 61 6e 61 67 65 FileName $manage
b810: 64 4f 6e 6c 79 20 24 70 6c 61 74 66 6f 72 6d 5d dOnly $platform]
b820: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
b830: 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 61 .. set ta
b840: 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 65 rgetFileName [ge
b850: 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 5c tBuildFileName \
b860: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 66 .. $f
b870: 69 6c 65 4e 61 6d 65 20 24 6d 61 6e 61 67 65 64 ileName $managed
b880: 4f 6e 6c 79 20 24 70 6c 61 74 66 6f 72 6d 5d 0d Only $platform].
b890: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
b8a0: 20 20 73 65 74 20 74 61 72 67 65 74 44 69 72 65 set targetDire
b8b0: 63 74 6f 72 79 20 5b 66 69 6c 65 20 64 69 72 6e ctory [file dirn
b8c0: 61 6d 65 20 24 74 61 72 67 65 74 46 69 6c 65 4e ame $targetFileN
b8d0: 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 ame].... if
b8e0: 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
b8f0: 20 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 if {![file e
b900: 78 69 73 74 73 20 24 74 61 72 67 65 74 44 69 72 xists $targetDir
b910: 65 63 74 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d ectory]} then {.
b920: 0a 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 20 . file
b930: 6d 6b 64 69 72 20 24 74 61 72 67 65 74 44 69 72 mkdir $targetDir
b940: 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 20 20 ectory..
b950: 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 66 69 6c }.... fil
b960: 65 20 63 6f 70 79 20 2d 66 6f 72 63 65 20 24 73 e copy -force $s
b970: 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 24 74 ourceFileName $t
b980: 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 0d 0a 20 argetFileName..
b990: 20 20 20 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 68 }] == 0} th
b9a0: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 en {.. tp
b9b0: 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
b9c0: 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
b9d0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
b9e0: 2d 2d 2d 2d 20 63 6f 70 69 65 64 20 62 69 6e 61 ---- copied bina
b9f0: 72 79 20 66 69 6c 65 20 66 72 6f 6d 20 5c 22 22 ry file from \""
ba00: 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 $sourceFileName
ba10: 20 22 5c 22 20 74 6f 20 5c 22 22 20 5c 0d 0a 20 "\" to \"" \..
ba20: 20 20 20 20 20 20 20 20 20 20 20 24 74 61 72 67 $targ
ba30: 65 74 46 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d etFileName \"\n]
ba40: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
ba50: 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
ba60: 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
ba70: 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
ba80: 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
ba90: 20 66 61 69 6c 65 64 20 74 6f 20 63 6f 70 79 20 failed to copy
baa0: 62 69 6e 61 72 79 20 66 69 6c 65 20 66 72 6f 6d binary file from
bab0: 20 5c 22 22 20 24 73 6f 75 72 63 65 46 69 6c 65 \"" $sourceFile
bac0: 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 Name \..
bad0: 20 20 20 20 22 5c 22 20 74 6f 20 5c 22 22 20 24 "\" to \"" $
bae0: 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5c targetFileName \
baf0: 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 "\n].. }..
bb00: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
bb10: 63 20 74 72 79 43 6f 70 79 42 75 69 6c 64 46 69 c tryCopyBuildFi
bb20: 6c 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 le {..
bb30: 20 20 66 69 6c 65 4e 61 6d 65 20 6d 61 6e 61 67 fileName manag
bb40: 65 64 4f 6e 6c 79 20 7b 70 6c 61 74 66 6f 72 6d edOnly {platform
bb50: 20 22 22 7d 20 7b 6e 65 77 46 69 6c 65 4e 61 6d ""} {newFileNam
bb60: 65 20 22 22 7d 0d 0a 20 20 20 20 20 20 20 20 20 e ""}..
bb70: 20 20 20 7b 76 65 72 62 6f 73 65 20 74 72 75 65 {verbose true
bb80: 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 } } {.. set
bb90: 20 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 sourceFileName
bba0: 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d [getBuildFileNam
bbb0: 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 6d 61 6e e $fileName $man
bbc0: 61 67 65 64 4f 6e 6c 79 20 24 70 6c 61 74 66 6f agedOnly $platfo
bbd0: 72 6d 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 rm].... if
bbe0: 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {![file exists $
bbf0: 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 5d 7d sourceFileName]}
bc00: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
bc10: 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 if {$verbose} t
bc20: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
bc30: 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
bc40: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
bc50: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
bc60: 20 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 "---- skippe
bc70: 64 20 63 6f 70 79 69 6e 67 20 62 75 69 6c 64 20 d copying build
bc80: 66 69 6c 65 20 5c 22 22 20 24 73 6f 75 72 63 65 file \"" $source
bc90: 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 FileName \..
bca0: 20 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 69 "\", i
bcb0: 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 t does not exist
bcc0: 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d \n"].. }.
bcd0: 0a 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 ... retur
bce0: 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 n.. }....
bcf0: 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
bd00: 6c 65 6e 67 74 68 20 24 6e 65 77 46 69 6c 65 4e length $newFileN
bd10: 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ame] > 0} then {
bd20: 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 61 .. set ta
bd30: 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 65 rgetFileName [ge
bd40: 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 tBinaryFileName
bd50: 24 6e 65 77 46 69 6c 65 4e 61 6d 65 20 24 70 6c $newFileName $pl
bd60: 61 74 66 6f 72 6d 5d 0d 0a 20 20 20 20 20 20 7d atform].. }
bd70: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
bd80: 20 73 65 74 20 74 61 72 67 65 74 46 69 6c 65 4e set targetFileN
bd90: 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 46 69 ame [getBinaryFi
bda0: 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 leName $fileName
bdb0: 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 20 $platform]..
bdc0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 65 }.... se
bdd0: 74 20 74 61 72 67 65 74 44 69 72 65 63 74 6f 72 t targetDirector
bde0: 79 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 y [file dirname
bdf0: 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 5d $targetFileName]
be00: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 .... if {[c
be10: 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
be20: 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 if {![file exist
be30: 73 20 24 74 61 72 67 65 74 44 69 72 65 63 74 6f s $targetDirecto
be40: 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ry]} then {..
be50: 20 20 20 20 20 20 20 66 69 6c 65 20 6d 6b 64 69 file mkdi
be60: 72 20 24 74 61 72 67 65 74 44 69 72 65 63 74 6f r $targetDirecto
be70: 72 79 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d ry.. }...
be80: 0a 20 20 20 20 20 20 20 20 66 69 6c 65 20 63 6f . file co
be90: 70 79 20 2d 66 6f 72 63 65 20 24 73 6f 75 72 63 py -force $sourc
bea0: 65 46 69 6c 65 4e 61 6d 65 20 24 74 61 72 67 65 eFileName $targe
beb0: 74 46 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 tFileName..
bec0: 20 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b }] == 0} then {
bed0: 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
bee0: 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
bef0: 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
bf00: 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
bf10: 20 63 6f 70 69 65 64 20 62 75 69 6c 64 20 66 69 copied build fi
bf20: 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 73 6f 75 le from \"" $sou
bf30: 72 63 65 46 69 6c 65 4e 61 6d 65 20 22 5c 22 20 rceFileName "\"
bf40: 74 6f 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 to \"" \..
bf50: 20 20 20 20 20 20 24 74 61 72 67 65 74 46 69 6c $targetFil
bf60: 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 eName \"\n]..
bf70: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
bf80: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
bf90: 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
bfa0: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
bfb0: 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 61 69 6c "---- fail
bfc0: 65 64 20 74 6f 20 63 6f 70 79 20 62 75 69 6c 64 ed to copy build
bfd0: 20 66 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 file from \"" $
bfe0: 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 5c sourceFileName \
bff0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 5c .. "\
c000: 22 20 74 6f 20 5c 22 22 20 24 74 61 72 67 65 74 " to \"" $target
c010: 46 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a FileName \"\n]..
c020: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
c030: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 79 44 ... proc tryD
c040: 65 6c 65 74 65 42 69 6e 61 72 79 46 69 6c 65 20 eleteBinaryFile
c050: 7b 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 { fileName {plat
c060: 66 6f 72 6d 20 22 22 7d 20 7b 76 65 72 62 6f 73 form ""} {verbos
c070: 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 e true} } {..
c080: 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 set fileName
c090: 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 [getBinaryFileNa
c0a0: 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c me $fileName $pl
c0b0: 61 74 66 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 20 atform]....
c0c0: 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 if {![file exis
c0d0: 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 ts $fileName]} t
c0e0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 hen {.. i
c0f0: 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 f {$verbose} the
c100: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 n {.. t
c110: 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
c120: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
c130: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
c140: 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 "---- skipped
c150: 64 65 6c 65 74 69 6e 67 20 62 69 6e 61 72 79 20 deleting binary
c160: 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 file \"" $fileNa
c170: 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 me \..
c180: 20 20 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 "\", it does
c190: 20 6e 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a not exist\n"]..
c1a0: 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
c1b0: 20 20 20 20 20 72 65 74 75 72 6e 0d 0a 20 20 20 return..
c1c0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 }.... if
c1d0: 20 7b 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 64 {[catch {file d
c1e0: 65 6c 65 74 65 20 24 66 69 6c 65 4e 61 6d 65 7d elete $fileName}
c1f0: 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
c200: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
c210: 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
c220: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
c230: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 64 "---- d
c240: 65 6c 65 74 65 64 20 62 69 6e 61 72 79 20 66 69 eleted binary fi
c250: 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 le \"" $fileName
c260: 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 \"\n].. }
c270: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
c280: 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
c290: 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
c2a0: 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
c2b0: 20 22 2d 2d 2d 2d 20 66 61 69 6c 65 64 20 74 6f "---- failed to
c2c0: 20 64 65 6c 65 74 65 20 62 69 6e 61 72 79 20 66 delete binary f
c2d0: 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d ile \"" $fileNam
c2e0: 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d e \"\n].. }
c2f0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
c300: 70 72 6f 63 20 74 72 79 44 65 6c 65 74 65 42 75 proc tryDeleteBu
c310: 69 6c 64 46 69 6c 65 20 7b 0d 0a 20 20 20 20 20 ildFile {..
c320: 20 20 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 fileName
c330: 6d 61 6e 61 67 65 64 4f 6e 6c 79 20 7b 70 6c 61 managedOnly {pla
c340: 74 66 6f 72 6d 20 22 22 7d 20 7b 76 65 72 62 6f tform ""} {verbo
c350: 73 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 se true} } {..
c360: 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 set fileName
c370: 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 [getBuildFileNa
c380: 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 6d 61 me $fileName $ma
c390: 6e 61 67 65 64 4f 6e 6c 79 20 24 70 6c 61 74 66 nagedOnly $platf
c3a0: 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 orm].... if
c3b0: 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 {![file exists
c3c0: 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e $fileName]} then
c3d0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
c3e0: 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b $verbose} then {
c3f0: 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
c400: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
c410: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
c420: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
c430: 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 64 65 6c ---- skipped del
c440: 65 74 69 6e 67 20 62 75 69 6c 64 20 66 69 6c 65 eting build file
c450: 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c \"" $fileName \
c460: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
c470: 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 "\", it does not
c480: 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 exist\n"]..
c490: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
c4a0: 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 20 7d return.. }
c4b0: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 .... if {[c
c4c0: 61 74 63 68 20 7b 66 69 6c 65 20 64 65 6c 65 74 atch {file delet
c4d0: 65 20 24 66 69 6c 65 4e 61 6d 65 7d 5d 20 3d 3d e $fileName}] ==
c4e0: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
c4f0: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
c500: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
c510: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
c520: 20 20 20 20 20 22 2d 2d 2d 2d 20 64 65 6c 65 74 "---- delet
c530: 65 64 20 62 75 69 6c 64 20 66 69 6c 65 20 5c 22 ed build file \"
c540: 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e " $fileName \"\n
c550: 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 ].. } else
c560: 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
c570: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
c580: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
c590: 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
c5a0: 2d 20 66 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 - failed to dele
c5b0: 74 65 20 62 75 69 6c 64 20 66 69 6c 65 20 5c 22 te build file \"
c5c0: 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e " $fileName \"\n
c5d0: 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 ].. }..
c5e0: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 }..... proc t
c5f0: 72 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 20 7b ryCopyAssembly {
c600: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 66 69 .. fi
c610: 6c 65 4e 61 6d 65 20 6d 61 6e 61 67 65 64 4f 6e leName managedOn
c620: 6c 79 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d ly {platform ""}
c630: 20 7b 70 64 62 20 74 72 75 65 7d 20 7b 76 65 72 {pdb true} {ver
c640: 62 6f 73 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a bose true} } {..
c650: 20 20 20 20 20 20 74 72 79 43 6f 70 79 42 75 69 tryCopyBui
c660: 6c 64 46 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 ldFile $fileName
c670: 20 24 6d 61 6e 61 67 65 64 4f 6e 6c 79 20 24 70 $managedOnly $p
c680: 6c 61 74 66 6f 72 6d 20 22 22 20 24 76 65 72 62 latform "" $verb
c690: 6f 73 65 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 ose.... if
c6a0: 7b 24 70 64 62 7d 20 74 68 65 6e 20 7b 0d 0a 20 {$pdb} then {..
c6b0: 20 20 20 20 20 20 20 74 72 79 43 6f 70 79 42 75 tryCopyBu
c6c0: 69 6c 64 46 69 6c 65 20 5b 61 70 70 65 6e 64 41 ildFile [appendA
c6d0: 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
c6e0: 20 20 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d [file rootnam
c6f0: 65 20 24 66 69 6c 65 4e 61 6d 65 5d 20 2e 70 64 e $fileName] .pd
c700: 62 5d 20 24 6d 61 6e 61 67 65 64 4f 6e 6c 79 20 b] $managedOnly
c710: 24 70 6c 61 74 66 6f 72 6d 20 22 22 20 24 76 65 $platform "" $ve
c720: 72 62 6f 73 65 0d 0a 20 20 20 20 20 20 7d 0d 0a rbose.. }..
c730: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
c740: 6f 63 20 74 72 79 44 65 6c 65 74 65 41 73 73 65 oc tryDeleteAsse
c750: 6d 62 6c 79 20 7b 0d 0a 20 20 20 20 20 20 20 20 mbly {..
c760: 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c fileName {pl
c770: 61 74 66 6f 72 6d 20 22 22 7d 20 7b 70 64 62 20 atform ""} {pdb
c780: 74 72 75 65 7d 20 7b 76 65 72 62 6f 73 65 20 74 true} {verbose t
c790: 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 rue} } {..
c7a0: 74 72 79 44 65 6c 65 74 65 42 69 6e 61 72 79 46 tryDeleteBinaryF
c7b0: 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 ile $fileName $p
c7c0: 6c 61 74 66 6f 72 6d 20 24 76 65 72 62 6f 73 65 latform $verbose
c7d0: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 70 .... if {$p
c7e0: 64 62 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 db} then {..
c7f0: 20 20 20 20 74 72 79 44 65 6c 65 74 65 42 69 6e tryDeleteBin
c800: 61 72 79 46 69 6c 65 20 5b 61 70 70 65 6e 64 41 aryFile [appendA
c810: 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
c820: 20 20 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d [file rootnam
c830: 65 20 24 66 69 6c 65 4e 61 6d 65 5d 20 2e 70 64 e $fileName] .pd
c840: 62 5d 20 24 70 6c 61 74 66 6f 72 6d 20 24 76 65 b] $platform $ve
c850: 72 62 6f 73 65 0d 0a 20 20 20 20 20 20 7d 0d 0a rbose.. }..
c860: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
c870: 6f 63 20 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 oc tryLoadAssemb
c880: 6c 79 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7b 70 ly { fileName {p
c890: 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7d 20 7b 0d latform ""} } {.
c8a0: 0a 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e . set fileN
c8b0: 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 46 69 ame [getBinaryFi
c8c0: 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 leName $fileName
c8d0: 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 0d 0a 20 $platform]....
c8e0: 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
c8f0: 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 61 {.. set a
c900: 73 73 65 6d 62 6c 79 20 5b 6f 62 6a 65 63 74 20 ssembly [object
c910: 6c 6f 61 64 20 2d 6c 6f 61 64 74 79 70 65 20 46 load -loadtype F
c920: 69 6c 65 20 2d 61 6c 69 61 73 20 24 66 69 6c 65 ile -alias $file
c930: 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 7d 5d 20 Name].. }]
c940: 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
c950: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
c960: 20 23 20 4e 4f 54 45 3a 20 4e 6f 77 2c 20 61 64 # NOTE: Now, ad
c970: 64 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 20 d the necessary
c980: 74 65 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 2e test constraint.
c990: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
c9a0: 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 addConstrai
c9b0: 6e 74 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d nt [file rootnam
c9c0: 65 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 e [file tail $fi
c9d0: 6c 65 4e 61 6d 65 5d 5d 0d 0a 0d 0a 20 20 20 20 leName]]....
c9e0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
c9f0: 20 4e 4f 54 45 3a 20 47 72 61 62 20 74 68 65 20 NOTE: Grab the
ca00: 69 6d 61 67 65 20 72 75 6e 74 69 6d 65 20 76 65 image runtime ve
ca10: 72 73 69 6f 6e 20 66 72 6f 6d 20 74 68 65 20 61 rsion from the a
ca20: 73 73 65 6d 62 6c 79 20 62 65 63 61 75 73 65 0d ssembly because.
ca30: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
ca40: 20 73 65 76 65 72 61 6c 20 74 65 73 74 73 20 72 several tests r
ca50: 65 6c 79 20 6f 6e 20 69 74 20 68 61 76 69 6e 67 ely on it having
ca60: 20 61 20 63 65 72 74 61 69 6e 20 76 61 6c 75 65 a certain value
ca70: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
ca80: 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 addConstra
ca90: 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
caa0: 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 [file tail $file
cab0: 4e 61 6d 65 5d 20 5f 20 5c 0d 0a 20 20 20 20 20 Name] _ \..
cac0: 20 20 20 20 20 20 20 5b 24 61 73 73 65 6d 62 6c [$assembl
cad0: 79 20 49 6d 61 67 65 52 75 6e 74 69 6d 65 56 65 y ImageRuntimeVe
cae0: 72 73 69 6f 6e 5d 5d 0d 0a 0d 0a 20 20 20 20 20 rsion]]....
caf0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
cb00: 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 74 68 65 NOTE: Return the
cb10: 20 66 75 6c 6c 20 70 61 74 68 20 6f 66 20 74 68 full path of th
cb20: 65 20 6c 6f 61 64 65 64 20 66 69 6c 65 2e 0d 0a e loaded file...
cb30: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
cb40: 20 20 20 72 65 74 75 72 6e 20 24 66 69 6c 65 4e return $fileN
cb50: 61 6d 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a ame.. }....
cb60: 20 20 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d return "".
cb70: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
cb80: 72 6f 63 20 69 73 53 51 4c 69 74 65 52 65 61 64 roc isSQLiteRead
cb90: 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d y {} {.. #.
cba0: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 . # NOTE: T
cbb0: 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 6d 75 his procedure mu
cbc0: 73 74 20 72 65 74 75 72 6e 20 6e 6f 6e 2d 7a 65 st return non-ze
cbd0: 72 6f 20 6f 6e 6c 79 20 69 66 20 74 68 65 20 53 ro only if the S
cbe0: 51 4c 69 74 65 20 6e 61 74 69 76 65 0d 0a 20 20 QLite native..
cbf0: 20 20 20 20 23 20 20 20 20 20 20 20 6c 69 62 72 # libr
cc00: 61 72 79 20 61 6e 64 20 74 68 65 20 53 79 73 74 ary and the Syst
cc10: 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 6d em.Data.SQLite m
cc20: 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 79 20 anaged assembly
cc30: 61 72 65 20 6c 6f 61 64 65 64 0d 0a 20 20 20 20 are loaded..
cc40: 20 20 23 20 20 20 20 20 20 20 61 6e 64 20 72 65 # and re
cc50: 61 64 79 20 66 6f 72 20 75 73 65 20 62 79 20 74 ady for use by t
cc60: 68 65 20 74 65 73 74 20 73 75 69 74 65 2e 20 20 he test suite.
cc70: 43 75 72 72 65 6e 74 6c 79 2c 20 74 68 69 73 20 Currently, this
cc80: 70 72 6f 63 65 64 75 72 65 0d 0a 20 20 20 20 20 procedure..
cc90: 20 23 20 20 20 20 20 20 20 73 68 6f 75 6c 64 20 # should
cca0: 62 65 20 63 61 6c 6c 65 64 20 6f 6e 6c 79 20 61 be called only a
ccb0: 66 74 65 72 20 74 68 65 20 5b 74 72 79 4c 6f 61 fter the [tryLoa
ccc0: 64 41 73 73 65 6d 62 6c 79 5d 20 70 72 6f 63 65 dAssembly] proce
ccd0: 64 75 72 65 20 68 61 73 0d 0a 20 20 20 20 20 20 dure has..
cce0: 23 20 20 20 20 20 20 20 62 65 65 6e 20 63 61 6c # been cal
ccf0: 6c 65 64 20 74 6f 20 70 72 6f 62 65 20 66 6f 72 led to probe for
cd00: 20 74 68 65 20 53 79 73 74 65 6d 2e 44 61 74 61 the System.Data
cd10: 2e 53 51 4c 69 74 65 20 6d 61 6e 61 67 65 64 20 .SQLite managed
cd20: 61 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 20 assembly..
cd30: 23 20 20 20 20 20 20 20 61 6e 64 20 74 68 65 20 # and the
cd40: 5b 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 5d [checkForSQLite]
cd50: 20 70 72 6f 63 65 64 75 72 65 20 68 61 73 20 62 procedure has b
cd60: 65 65 6e 20 63 61 6c 6c 65 64 20 74 6f 20 70 72 een called to pr
cd70: 6f 62 65 20 66 6f 72 0d 0a 20 20 20 20 20 20 23 obe for.. #
cd80: 20 20 20 20 20 20 20 74 68 65 20 53 51 4c 69 74 the SQLit
cd90: 65 20 6e 61 74 69 76 65 20 6c 69 62 72 61 72 79 e native library
cda0: 3b 20 6f 74 68 65 72 77 69 73 65 2c 20 74 68 69 ; otherwise, thi
cdb0: 73 20 70 72 6f 63 65 64 75 72 65 20 77 69 6c 6c s procedure will
cdc0: 20 73 69 6d 70 6c 79 0d 0a 20 20 20 20 20 20 23 simply.. #
cdd0: 20 20 20 20 20 20 20 61 6c 77 61 79 73 20 72 65 always re
cde0: 74 75 72 6e 20 7a 65 72 6f 2e 0d 0a 20 20 20 20 turn zero...
cdf0: 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 72 #.. retur
ce00: 6e 20 5b 65 78 70 72 20 7b 0d 0a 20 20 20 20 20 n [expr {..
ce10: 20 20 20 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 [haveConstrai
ce20: 6e 74 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 nt System.Data.S
ce30: 51 4c 69 74 65 5d 20 26 26 20 5b 68 61 76 65 43 QLite] && [haveC
ce40: 6f 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 74 65 onstraint SQLite
ce50: 5d 0d 0a 20 20 20 20 20 20 7d 5d 0d 0a 20 20 20 ].. }]..
ce60: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
ce70: 6d 61 74 63 68 50 6c 61 74 66 6f 72 6d 20 7b 20 matchPlatform {
ce80: 70 6c 61 74 66 6f 72 6d 20 7d 20 7b 0d 0a 20 20 platform } {..
ce90: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
cea0: 4f 54 45 3a 20 41 6e 20 65 6d 70 74 79 20 73 74 OTE: An empty st
ceb0: 72 69 6e 67 20 66 6f 72 20 74 68 65 20 70 6c 61 ring for the pla
cec0: 74 66 6f 72 6d 20 6d 65 61 6e 73 20 74 68 61 74 tform means that
ced0: 20 74 68 65 20 62 75 69 6c 64 20 69 73 20 6e 6f the build is no
cee0: 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 t.. #
cef0: 20 5b 70 72 69 6d 61 72 69 6c 79 5d 20 61 20 6e [primarily] a n
cf00: 61 74 69 76 65 20 62 75 69 6c 64 3b 20 74 68 65 ative build; the
cf10: 72 65 66 6f 72 65 2c 20 69 74 20 61 6c 77 61 79 refore, it alway
cf20: 73 20 6d 61 74 63 68 65 73 2e 0d 0a 20 20 20 20 s matches...
cf30: 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
cf40: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 string length $p
cf50: 6c 61 74 66 6f 72 6d 5d 20 3d 3d 20 30 7d 20 74 latform] == 0} t
cf60: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 hen {.. r
cf70: 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 eturn true..
cf80: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
cf90: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 # NOTE: If
cfa0: 20 74 68 65 20 6d 61 63 68 69 6e 65 20 6e 61 6d the machine nam
cfb0: 65 20 69 73 20 75 6e 61 76 61 69 6c 61 62 6c 65 e is unavailable
cfc0: 2c 20 74 68 65 72 65 20 69 73 20 6e 6f 74 68 69 , there is nothi
cfd0: 67 6e 20 65 6c 73 65 20 77 65 0d 0a 20 20 20 20 gn else we..
cfe0: 20 20 23 20 20 20 20 20 20 20 63 61 6e 20 64 6f # can do
cff0: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
d000: 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
d010: 73 74 73 20 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f sts ::tcl_platfo
d020: 72 6d 28 6d 61 63 68 69 6e 65 29 5d 7d 20 74 68 rm(machine)]} th
d030: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 en {.. re
d040: 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 turn false..
d050: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
d060: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 6f # NOTE: Do
d070: 65 73 20 74 68 65 20 73 70 65 63 69 66 69 65 64 es the specified
d080: 20 70 6c 61 74 66 6f 72 6d 20 6d 61 74 63 68 20 platform match
d090: 75 70 20 74 6f 20 74 68 65 20 63 75 72 72 65 6e up to the curren
d0a0: 74 20 70 72 6f 63 65 73 73 3f 0d 0a 20 20 20 20 t process?..
d0b0: 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 #.. if {$
d0c0: 70 6c 61 74 66 6f 72 6d 20 65 71 20 5b 6d 61 63 platform eq [mac
d0d0: 68 69 6e 65 54 6f 50 6c 61 74 66 6f 72 6d 20 24 hineToPlatform $
d0e0: 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 6d ::tcl_platform(m
d0f0: 61 63 68 69 6e 65 29 5d 7d 20 74 68 65 6e 20 7b achine)]} then {
d100: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
d110: 20 74 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a true.. }..
d120: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
d130: 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 73 70 65 # NOTE: The spe
d140: 63 69 66 69 65 64 20 70 6c 61 74 66 6f 72 6d 20 cified platform
d150: 64 6f 65 73 20 6e 6f 74 20 6d 61 74 63 68 20 75 does not match u
d160: 70 20 77 69 74 68 20 74 68 65 20 70 6c 61 74 66 p with the platf
d170: 6f 72 6d 0d 0a 20 20 20 20 20 20 23 20 20 20 20 orm.. #
d180: 20 20 20 66 6f 72 20 74 68 65 20 63 75 72 72 65 for the curre
d190: 6e 74 20 70 72 6f 63 65 73 73 2e 0d 0a 20 20 20 nt process...
d1a0: 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 #.. retu
d1b0: 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 7d 0d rn false.. }.
d1c0: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 68 61 76 .... proc hav
d1d0: 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d eSQLiteObjectCom
d1e0: 6d 61 6e 64 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 mand {} {..
d1f0: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
d200: 3a 20 49 73 20 74 68 65 20 5b 6f 62 6a 65 63 74 : Is the [object
d210: 5d 20 63 6f 6d 6d 61 6e 64 20 63 75 72 72 65 6e ] command curren
d220: 74 6c 79 20 61 76 61 69 6c 61 62 6c 65 3f 0d 0a tly available?..
d230: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 #.. r
d240: 65 74 75 72 6e 20 5b 65 78 70 72 20 7b 5b 6c 6c eturn [expr {[ll
d250: 65 6e 67 74 68 20 5b 69 6e 66 6f 20 63 6f 6d 6d ength [info comm
d260: 61 6e 64 73 20 6f 62 6a 65 63 74 5d 5d 20 3e 20 ands object]] >
d270: 30 7d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 0}].. }.....
d280: 20 20 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 proc checkFor
d290: 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d SQLiteObjectComm
d2a0: 61 6e 64 20 7b 20 63 68 61 6e 6e 65 6c 20 7d 20 and { channel }
d2b0: 7b 0d 0a 20 20 20 20 20 20 74 70 75 74 73 20 24 {.. tputs $
d2c0: 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 68 channel "---- ch
d2d0: 65 63 6b 69 6e 67 20 66 6f 72 20 5c 22 6f 62 6a ecking for \"obj
d2e0: 65 63 74 5c 22 20 63 6f 6d 6d 61 6e 64 20 75 73 ect\" command us
d2f0: 61 67 65 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 age... "....
d300: 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
d310: 73 74 73 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 4f sts ::no(sqliteO
d320: 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 29 5d 20 26 bjectCommand)] &
d330: 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b & \.. [
d340: 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 haveSQLiteObject
d350: 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b Command]} then {
d360: 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
d370: 24 63 68 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a $channel yes\n..
d380: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
d390: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
d3a0: 20 20 20 23 20 4e 4f 54 45 3a 20 55 6e 6c 65 73 # NOTE: Unles
d3b0: 73 20 77 65 20 61 72 65 20 66 6f 72 62 69 64 64 s we are forbidd
d3c0: 65 6e 20 66 72 6f 6d 20 64 6f 69 6e 67 20 73 6f en from doing so
d3d0: 2c 20 61 64 64 20 73 6f 6d 65 20 63 6f 6e 73 74 , add some const
d3e0: 72 61 69 6e 74 73 0d 0a 20 20 20 20 20 20 20 20 raints..
d3f0: 23 20 20 20 20 20 20 20 74 68 61 74 20 77 69 6c # that wil
d400: 6c 20 61 6c 6c 6f 77 20 6d 6f 73 74 20 6f 66 20 l allow most of
d410: 74 68 65 20 74 65 73 74 20 73 75 69 74 65 20 74 the test suite t
d420: 6f 20 72 75 6e 20 28 69 2e 65 2e 20 74 68 6f 73 o run (i.e. thos
d430: 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
d440: 20 20 20 74 65 73 74 73 20 74 68 61 74 20 64 6f tests that do
d450: 20 6e 6f 74 20 64 69 72 65 63 74 6c 79 20 72 65 not directly re
d460: 6c 79 20 75 70 6f 6e 20 74 68 65 20 5b 6f 62 6a ly upon the [obj
d470: 65 63 74 5d 20 63 6f 6d 6d 61 6e 64 29 2e 0d 0a ect] command)...
d480: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
d490: 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
d4a0: 69 73 74 73 20 3a 3a 6e 6f 28 73 68 69 6d 53 51 ists ::no(shimSQ
d4b0: 4c 69 74 65 41 73 73 65 6d 62 6c 79 43 6f 6e 73 LiteAssemblyCons
d4c0: 74 72 61 69 6e 74 73 29 5d 7d 20 74 68 65 6e 20 traints)]} then
d4d0: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 61 64 64 {.. add
d4e0: 43 6f 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 74 Constraint SQLit
d4f0: 65 0d 0a 20 20 20 20 20 20 20 20 20 20 61 64 64 e.. add
d500: 43 6f 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 74 Constraint SQLit
d510: 65 49 6e 74 65 72 6f 70 0d 0a 20 20 20 20 20 20 eInterop..
d520: 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e addConstrain
d530: 74 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 t System.Data.SQ
d540: 4c 69 74 65 0d 0a 20 20 20 20 20 20 20 20 20 20 Lite..
d550: 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 79 addConstraint Sy
d560: 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
d570: 2e 45 6e 63 72 79 70 74 69 6f 6e 0d 0a 20 20 20 .Encryption..
d580: 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 addConstr
d590: 61 69 6e 74 20 53 79 73 74 65 6d 2e 44 61 74 61 aint System.Data
d5a0: 2e 53 51 4c 69 74 65 2e 4c 69 6e 71 0d 0a 0d 0a .SQLite.Linq....
d5b0: 20 20 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e addCon
d5c0: 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
d5d0: 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
d5e0: 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
d5f0: 2e 53 51 4c 69 74 65 2e 64 6c 6c 5f 76 20 5b 67 .SQLite.dll_v [g
d600: 65 74 42 75 69 6c 64 43 6c 72 56 65 72 73 69 6f etBuildClrVersio
d610: 6e 5d 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a n]].. }..
d620: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b .. if {![
d630: 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
d640: 28 73 68 69 6d 53 51 4c 69 74 65 44 65 66 69 6e (shimSQLiteDefin
d650: 65 43 6f 6e 73 74 61 6e 74 43 6f 6e 73 74 72 61 eConstantConstra
d660: 69 6e 74 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a ints)]} then {..
d670: 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 foreac
d680: 68 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 h defineConstant
d690: 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 [list \..
d6a0: 20 20 20 20 20 20 20 20 49 4e 54 45 52 4f 50 5f INTEROP_
d6b0: 45 58 54 45 4e 53 49 4f 4e 5f 46 55 4e 43 54 49 EXTENSION_FUNCTI
d6c0: 4f 4e 53 20 49 4e 54 45 52 4f 50 5f 46 54 53 35 ONS INTEROP_FTS5
d6d0: 5f 45 58 54 45 4e 53 49 4f 4e 20 5c 0d 0a 20 20 _EXTENSION \..
d6e0: 20 20 20 20 20 20 20 20 20 20 20 20 49 4e 54 45 INTE
d6f0: 52 4f 50 5f 4a 53 4f 4e 31 5f 45 58 54 45 4e 53 ROP_JSON1_EXTENS
d700: 49 4f 4e 20 49 4e 54 45 52 4f 50 5f 50 45 52 43 ION INTEROP_PERC
d710: 45 4e 54 49 4c 45 5f 45 58 54 45 4e 53 49 4f 4e ENTILE_EXTENSION
d720: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
d730: 20 20 49 4e 54 45 52 4f 50 5f 52 45 47 45 58 50 INTEROP_REGEXP
d740: 5f 45 58 54 45 4e 53 49 4f 4e 20 49 4e 54 45 52 _EXTENSION INTER
d750: 4f 50 5f 54 45 53 54 5f 45 58 54 45 4e 53 49 4f OP_TEST_EXTENSIO
d760: 4e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 N \..
d770: 20 20 20 49 4e 54 45 52 4f 50 5f 54 4f 54 59 50 INTEROP_TOTYP
d780: 45 5f 45 58 54 45 4e 53 49 4f 4e 20 49 4e 54 45 E_EXTENSION INTE
d790: 52 4f 50 5f 56 49 52 54 55 41 4c 5f 54 41 42 4c ROP_VIRTUAL_TABL
d7a0: 45 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 E \..
d7b0: 20 20 20 55 53 45 5f 49 4e 54 45 52 4f 50 5f 44 USE_INTEROP_D
d7c0: 4c 4c 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 LL] {..
d7d0: 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 addConstraint
d7e0: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
d7f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
d800: 5b 67 65 74 53 51 4c 69 74 65 44 65 66 69 6e 65 [getSQLiteDefine
d810: 43 6f 6e 73 74 61 6e 74 50 72 65 66 69 78 5d 20 ConstantPrefix]
d820: 24 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 5d $defineConstant]
d830: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
d840: 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
d850: 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
d860: 78 69 73 74 73 20 3a 3a 6e 6f 28 73 68 69 6d 53 xists ::no(shimS
d870: 51 4c 69 74 65 56 69 73 75 61 6c 53 74 75 64 69 QLiteVisualStudi
d880: 6f 43 6f 6e 73 74 72 61 69 6e 74 73 29 5d 7d 20 oConstraints)]}
d890: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
d8a0: 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 addConstraint
d8b0: 5b 61 70 70 65 6e 64 41 72 67 73 20 76 69 73 75 [appendArgs visu
d8c0: 61 6c 53 74 75 64 69 6f 20 5b 67 65 74 42 75 69 alStudio [getBui
d8d0: 6c 64 59 65 61 72 5d 5d 0d 0a 20 20 20 20 20 20 ldYear]]..
d8e0: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 }.... t
d8f0: 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e 6f puts $channel no
d900: 5c 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 \n.. }..
d910: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
d920: 63 68 61 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 changeNativeRunt
d930: 69 6d 65 4f 70 74 69 6f 6e 20 7b 20 6e 61 74 69 imeOption { nati
d940: 76 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 ve } {.. if
d950: 20 7b 5b 6c 6c 65 6e 67 74 68 20 5b 69 6e 66 6f {[llength [info
d960: 20 63 6f 6d 6d 61 6e 64 73 20 64 65 62 75 67 5d commands debug]
d970: 5d 20 3e 20 30 20 26 26 20 5c 0d 0a 20 20 20 20 ] > 0 && \..
d980: 20 20 20 20 20 20 5b 6c 6c 65 6e 67 74 68 20 5b [llength [
d990: 69 6e 66 6f 20 73 75 62 63 6f 6d 6d 61 6e 64 73 info subcommands
d9a0: 20 64 65 62 75 67 20 72 75 6e 74 69 6d 65 6f 70 debug runtimeop
d9b0: 74 69 6f 6e 5d 5d 20 3e 20 30 20 26 26 20 5b 63 tion]] > 0 && [c
d9c0: 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
d9d0: 64 65 62 75 67 20 72 75 6e 74 69 6d 65 6f 70 74 debug runtimeopt
d9e0: 69 6f 6e 20 5b 65 78 70 72 20 7b 24 6e 61 74 69 ion [expr {$nati
d9f0: 76 65 20 3f 20 22 61 64 64 22 20 3a 20 22 72 65 ve ? "add" : "re
da00: 6d 6f 76 65 22 7d 5d 20 6e 61 74 69 76 65 0d 0a move"}] native..
da10: 20 20 20 20 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 }] == 0} t
da20: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 hen {.. r
da30: 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 eturn true..
da40: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 }.... if
da50: 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 {[haveSQLiteObje
da60: 63 74 43 6f 6d 6d 61 6e 64 5d 20 26 26 20 5b 63 ctCommand] && [c
da70: 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
da80: 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 49 6e object invoke In
da90: 74 65 72 70 72 65 74 65 72 2e 47 65 74 41 63 74 terpreter.GetAct
daa0: 69 76 65 20 5b 65 78 70 72 20 7b 24 6e 61 74 69 ive [expr {$nati
dab0: 76 65 20 3f 20 5c 0d 0a 20 20 20 20 20 20 20 20 ve ? \..
dac0: 20 20 20 20 22 41 64 64 52 75 6e 74 69 6d 65 4f "AddRuntimeO
dad0: 70 74 69 6f 6e 22 20 3a 20 22 52 65 6d 6f 76 65 ption" : "Remove
dae0: 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 22 7d 5d RuntimeOption"}]
daf0: 20 6e 61 74 69 76 65 0d 0a 20 20 20 20 20 20 7d native.. }
db00: 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
db10: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 return t
db20: 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a rue.. }....
db30: 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c return fal
db40: 73 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 se.. }.....
db50: 20 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 proc checkForS
db60: 51 4c 69 74 65 42 75 69 6c 64 73 20 7b 20 63 68 QLiteBuilds { ch
db70: 61 6e 6e 65 6c 20 7b 73 65 6c 65 63 74 20 66 61 annel {select fa
db80: 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 lse} } {..
db90: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
dba0: 20 43 68 65 63 6b 20 66 6f 72 20 65 76 65 72 79 Check for every
dbb0: 20 70 6f 73 73 69 62 6c 65 20 76 61 6c 69 64 20 possible valid
dbc0: 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 76 combination of v
dbd0: 61 6c 75 65 73 20 75 73 65 64 20 77 68 65 6e 0d alues used when.
dbe0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6c . # l
dbf0: 6f 63 61 74 69 6e 67 20 6f 75 74 20 74 68 65 20 ocating out the
dc00: 62 75 69 6c 64 20 6f 75 74 70 75 74 20 64 69 72 build output dir
dc10: 65 63 74 6f 72 79 2c 20 73 68 6f 77 69 6e 67 20 ectory, showing
dc20: 65 61 63 68 20 61 76 61 69 6c 61 62 6c 65 0d 0a each available..
dc30: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 75 # bu
dc40: 69 6c 64 20 76 61 72 69 61 74 69 6f 6e 20 61 6c ild variation al
dc50: 6f 6e 67 20 74 68 65 20 77 61 79 2e 0d 0a 20 20 ong the way...
dc60: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 66 6f 72 #.. for
dc70: 65 61 63 68 20 6e 61 74 69 76 65 20 5b 6c 69 73 each native [lis
dc80: 74 20 66 61 6c 73 65 20 74 72 75 65 5d 20 7b 0d t false true] {.
dc90: 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 . foreach
dca0: 20 79 65 61 72 20 5b 67 65 74 42 75 69 6c 64 59 year [getBuildY
dcb0: 65 61 72 73 5d 20 7b 0d 0a 20 20 20 20 20 20 20 ears] {..
dcc0: 20 20 20 66 6f 72 65 61 63 68 20 63 6f 6e 66 69 foreach confi
dcd0: 67 75 72 61 74 69 6f 6e 20 5b 67 65 74 42 75 69 guration [getBui
dce0: 6c 64 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 73 ldConfigurations
dcf0: 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ] {..
dd00: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
dd10: 23 20 4e 4f 54 45 3a 20 46 69 67 75 72 65 20 6f # NOTE: Figure o
dd20: 75 74 20 74 68 65 20 65 66 66 65 63 74 69 76 65 ut the effective
dd30: 20 62 75 69 6c 64 20 70 6c 61 74 66 6f 72 6d 2e build platform.
dd40: 20 20 54 68 69 73 20 69 73 0d 0a 20 20 20 20 20 This is..
dd50: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 # b
dd60: 61 73 65 64 20 6f 6e 20 77 68 65 74 68 65 72 20 ased on whether
dd70: 6f 72 20 6e 6f 74 20 61 20 5b 70 72 69 6d 61 72 or not a [primar
dd80: 69 6c 79 5d 20 6e 61 74 69 76 65 20 62 75 69 6c ily] native buil
dd90: 64 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 d.. #
dda0: 20 20 20 20 20 20 20 69 73 20 62 65 69 6e 67 20 is being
ddb0: 75 73 65 64 2e 20 20 46 6f 72 20 5b 70 72 69 6d used. For [prim
ddc0: 61 72 69 6c 79 5d 20 6e 6f 6e 2d 6e 61 74 69 76 arily] non-nativ
ddd0: 65 20 62 75 69 6c 64 73 2c 0d 0a 20 20 20 20 20 e builds,..
dde0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
ddf0: 68 69 73 20 77 69 6c 6c 20 62 65 20 61 6e 20 65 his will be an e
de00: 6d 70 74 79 20 73 74 72 69 6e 67 2e 0d 0a 20 20 mpty string...
de10: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
de20: 20 20 20 20 20 20 20 20 20 73 65 74 20 70 6c 61 set pla
de30: 74 66 6f 72 6d 20 5b 67 65 74 42 75 69 6c 64 50 tform [getBuildP
de40: 6c 61 74 66 6f 72 6d 20 24 6e 61 74 69 76 65 5d latform $native]
de50: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
de60: 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
de70: 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
de80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
de90: 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 --- checking for
dea0: 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
deb0: 69 74 65 20 62 75 69 6c 64 20 5c 22 22 20 5b 65 ite build \"" [e
dec0: 78 70 72 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 xpr \..
ded0: 20 20 20 20 20 20 20 7b 24 6e 61 74 69 76 65 20 {$native
dee0: 3f 20 22 6e 61 74 69 76 65 2f 22 20 3a 20 22 22 ? "native/" : ""
def0: 7d 5d 20 5b 65 78 70 72 20 7b 5b 73 74 72 69 6e }] [expr {[strin
df00: 67 20 6c 65 6e 67 74 68 20 5c 0d 0a 20 20 20 20 g length \..
df10: 20 20 20 20 20 20 20 20 20 20 20 20 24 70 6c 61 $pla
df20: 74 66 6f 72 6d 5d 20 3e 20 30 20 3f 20 5b 61 70 tform] > 0 ? [ap
df30: 70 65 6e 64 41 72 67 73 20 24 70 6c 61 74 66 6f pendArgs $platfo
df40: 72 6d 20 2f 5d 20 3a 20 22 22 7d 5d 20 24 79 65 rm /] : ""}] $ye
df50: 61 72 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ar \..
df60: 20 20 20 20 20 20 2f 20 24 63 6f 6e 66 69 67 75 / $configu
df70: 72 61 74 69 6f 6e 20 22 5c 22 2e 2e 2e 20 22 5d ration "\"... "]
df80: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
df90: 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 #.. #
dfa0: 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 NOTE: Build the
dfb0: 20 66 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 fully qualified
dfc0: 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 65 directory where
dfd0: 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 0d 0a the necessary..
dfe0: 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 #
dff0: 20 20 20 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 66 components f
e000: 6f 72 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 or System.Data.S
e010: 51 4c 69 74 65 20 73 68 6f 75 6c 64 20 62 65 20 QLite should be
e020: 66 6f 75 6e 64 2e 0d 0a 20 20 20 20 20 20 20 20 found...
e030: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
e040: 20 20 20 73 65 74 20 64 69 72 65 63 74 6f 72 79 set directory
e050: 20 5b 6a 6f 69 6e 42 75 69 6c 64 44 69 72 65 63 [joinBuildDirec
e060: 74 6f 72 79 20 24 6e 61 74 69 76 65 20 5c 0d 0a tory $native \..
e070: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
e080: 5b 67 65 74 42 75 69 6c 64 42 61 73 65 44 69 72 [getBuildBaseDir
e090: 65 63 74 6f 72 79 5d 20 24 79 65 61 72 20 24 70 ectory] $year $p
e0a0: 6c 61 74 66 6f 72 6d 20 24 63 6f 6e 66 69 67 75 latform $configu
e0b0: 72 61 74 69 6f 6e 5d 0d 0a 0d 0a 20 20 20 20 20 ration]....
e0c0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
e0d0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 6f # NOTE: Do
e0e0: 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 20 66 the necessary f
e0f0: 69 6c 65 73 20 65 78 69 73 74 3f 20 20 43 75 72 iles exist? Cur
e100: 72 65 6e 74 6c 79 2c 20 6e 6f 20 6f 74 68 65 72 rently, no other
e110: 20 73 74 65 70 73 0d 0a 20 20 20 20 20 20 20 20 steps..
e120: 20 20 20 20 23 20 20 20 20 20 20 20 61 72 65 20 # are
e130: 74 61 6b 65 6e 20 74 6f 20 76 65 72 69 66 79 20 taken to verify
e140: 74 68 69 73 20 62 75 69 6c 64 20 69 73 20 61 63 this build is ac
e150: 74 75 61 6c 6c 79 20 76 69 61 62 6c 65 2e 0d 0a tually viable...
e160: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
e170: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b if {[
e180: 69 73 42 75 69 6c 64 41 76 61 69 6c 61 62 6c 65 isBuildAvailable
e190: 20 24 6e 61 74 69 76 65 20 24 64 69 72 65 63 74 $native $direct
e1a0: 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ory]} then {..
e1b0: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
e1c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e # N
e1d0: 4f 54 45 3a 20 57 68 65 6e 20 69 6e 20 22 73 65 OTE: When in "se
e1e0: 6c 65 63 74 22 20 6d 6f 64 65 2c 20 61 75 74 6f lect" mode, auto
e1f0: 6d 61 74 69 63 61 6c 6c 79 20 73 65 6c 65 63 74 matically select
e200: 20 74 68 65 20 66 69 72 73 74 0d 0a 20 20 20 20 the first..
e210: 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
e220: 20 20 61 76 61 69 6c 61 62 6c 65 20 62 75 69 6c available buil
e230: 64 20 6f 66 20 53 79 73 74 65 6d 2e 44 61 74 61 d of System.Data
e240: 2e 53 51 4c 69 74 65 20 61 6e 64 20 74 68 65 6e .SQLite and then
e250: 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 20 20 return..
e260: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 69 # i
e270: 6d 6d 65 64 69 61 74 65 6c 79 2e 0d 0a 20 20 20 mmediately...
e280: 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
e290: 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
e2a0: 24 73 65 6c 65 63 74 20 26 26 20 5b 6d 61 74 63 $select && [matc
e2b0: 68 50 6c 61 74 66 6f 72 6d 20 24 70 6c 61 74 66 hPlatform $platf
e2c0: 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 orm]} then {..
e2d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
e2e0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
e2f0: 20 23 20 4e 4f 54 45 3a 20 4d 61 6e 75 61 6c 6c # NOTE: Manuall
e300: 79 20 6f 76 65 72 72 69 64 65 20 61 6c 6c 20 74 y override all t
e310: 68 65 20 62 75 69 6c 64 20 64 69 72 65 63 74 6f he build directo
e320: 72 79 20 73 65 6c 65 63 74 69 6f 6e 0d 0a 20 20 ry selection..
e330: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
e340: 20 20 20 20 20 20 72 65 6c 61 74 65 64 20 74 65 related te
e350: 73 74 20 73 65 74 74 69 6e 67 73 20 69 6e 20 6f st settings in o
e360: 72 64 65 72 20 74 6f 20 66 6f 72 63 65 20 74 68 rder to force th
e370: 69 73 20 62 75 69 6c 64 0d 0a 20 20 20 20 20 20 is build..
e380: 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
e390: 20 20 6f 66 20 53 79 73 74 65 6d 2e 44 61 74 61 of System.Data
e3a0: 2e 53 51 4c 69 74 65 20 74 6f 20 62 65 20 75 73 .SQLite to be us
e3b0: 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ed...
e3c0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
e3d0: 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 63 68 if {![ch
e3e0: 61 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 69 6d angeNativeRuntim
e3f0: 65 4f 70 74 69 6f 6e 20 24 6e 61 74 69 76 65 5d eOption $native]
e400: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
e410: 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
e420: 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
e430: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
e440: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
e450: 22 6e 6f 2c 20 66 61 69 6c 65 64 20 74 6f 20 22 "no, failed to "
e460: 20 5b 65 78 70 72 20 7b 24 6e 61 74 69 76 65 20 [expr {$native
e470: 3f 20 22 61 64 64 22 20 3a 20 22 72 65 6d 6f 76 ? "add" : "remov
e480: 65 22 7d 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 e"}] \..
e490: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 20 "
e4a0: 74 68 65 20 5c 22 6e 61 74 69 76 65 5c 22 20 72 the \"native\" r
e4b0: 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e 5c 6e 22 untime option\n"
e4c0: 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ]....
e4d0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 return fa
e4e0: 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 lse..
e4f0: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
e500: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a set ::
e510: 74 65 73 74 5f 79 65 61 72 20 24 79 65 61 72 0d test_year $year.
e520: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
e530: 20 73 65 74 20 3a 3a 74 65 73 74 5f 70 6c 61 74 set ::test_plat
e540: 66 6f 72 6d 20 24 70 6c 61 74 66 6f 72 6d 0d 0a form $platform..
e550: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
e560: 73 65 74 20 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 set ::test_confi
e570: 67 75 72 61 74 69 6f 6e 20 24 63 6f 6e 66 69 67 guration $config
e580: 75 72 61 74 69 6f 6e 0d 0a 0d 0a 20 20 20 20 20 uration....
e590: 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
e5a0: 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
e5b0: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
e5c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 79 65 "ye
e5d0: 73 2c 20 73 65 6c 65 63 74 65 64 20 28 22 20 5b s, selected (" [
e5e0: 65 78 70 72 20 7b 24 6e 61 74 69 76 65 20 3f 20 expr {$native ?
e5f0: 22 6e 61 74 69 76 65 2f 22 20 3a 20 22 22 7d 5d "native/" : ""}]
e600: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
e610: 20 20 20 20 20 20 20 20 5b 65 78 70 72 20 7b 5b [expr {[
e620: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 string length $p
e630: 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 20 3f 20 5b latform] > 0 ? [
e640: 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
e650: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
e660: 20 20 24 70 6c 61 74 66 6f 72 6d 20 2f 5d 20 3a $platform /] :
e670: 20 22 22 7d 5d 20 24 79 65 61 72 20 2f 20 24 63 ""}] $year / $c
e680: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 22 29 5c onfiguration ")\
e690: 6e 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 n"]....
e6a0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
e6b0: 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ue..
e6c0: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
e6d0: 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
e6e0: 73 20 24 63 68 61 6e 6e 65 6c 20 79 65 73 5c 6e s $channel yes\n
e6f0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
e700: 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d }.. }
e710: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
e720: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
e730: 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 20 20 20 annel no\n..
e740: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
e750: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
e760: 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
e770: 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 return false
e780: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
e790: 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 51 4c proc checkForSQL
e7a0: 69 74 65 52 65 6c 65 61 73 65 73 20 7b 20 63 68 iteReleases { ch
e7b0: 61 6e 6e 65 6c 20 7b 73 65 6c 65 63 74 20 66 61 annel {select fa
e7c0: 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 lse} } {..
e7d0: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
e7e0: 20 43 68 65 63 6b 20 66 6f 72 20 70 61 73 74 20 Check for past
e7f0: 72 65 6c 65 61 73 65 73 20 6f 66 20 53 79 73 74 releases of Syst
e800: 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 69 em.Data.SQLite i
e810: 6e 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 0d n the directory.
e820: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 . # c
e830: 6f 6e 74 61 69 6e 65 64 20 69 6e 20 74 68 65 20 ontained in the
e840: 22 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c "System.Data.SQL
e850: 69 74 65 22 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 ite" environment
e860: 20 76 61 72 69 61 62 6c 65 2c 20 69 66 0d 0a 20 variable, if..
e870: 20 20 20 20 20 23 20 20 20 20 20 20 20 70 72 65 # pre
e880: 73 65 6e 74 2e 0d 0a 20 20 20 20 20 20 23 0d 0a sent... #..
e890: 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 if {[info
e8a0: 65 78 69 73 74 73 20 3a 3a 65 6e 76 28 53 79 73 exists ::env(Sys
e8b0: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 29 tem.Data.SQLite)
e8c0: 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] && \..
e8d0: 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
e8e0: 20 24 3a 3a 65 6e 76 28 53 79 73 74 65 6d 2e 44 $::env(System.D
e8f0: 61 74 61 2e 53 51 4c 69 74 65 29 5d 20 3e 20 30 ata.SQLite)] > 0
e900: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
e910: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
e920: 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 20 66 OTE: Build the f
e930: 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 20 64 ully qualified d
e940: 69 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 irectory where t
e950: 68 65 20 6e 65 63 65 73 73 61 72 79 0d 0a 20 20 he necessary..
e960: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
e970: 6d 70 6f 6e 65 6e 74 73 20 66 6f 72 20 53 79 73 mponents for Sys
e980: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
e990: 73 68 6f 75 6c 64 20 62 65 20 66 6f 75 6e 64 2e should be found.
e9a0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
e9b0: 20 20 20 20 20 73 65 74 20 64 69 72 65 63 74 6f set directo
e9c0: 72 79 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e ry [file nativen
e9d0: 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c ame [file join \
e9e0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 3a .. $:
e9f0: 3a 65 6e 76 28 53 79 73 74 65 6d 2e 44 61 74 61 :env(System.Data
ea00: 2e 53 51 4c 69 74 65 29 20 5b 67 65 74 52 65 6c .SQLite) [getRel
ea10: 65 61 73 65 56 65 72 73 69 6f 6e 5d 5d 5d 0d 0a easeVersion]]]..
ea20: 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
ea30: 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
ea40: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
ea50: 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 "---- checki
ea60: 6e 67 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 61 ng for System.Da
ea70: 74 61 2e 53 51 4c 69 74 65 20 72 65 6c 65 61 73 ta.SQLite releas
ea80: 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 e \"" \..
ea90: 20 20 20 20 20 24 64 69 72 65 63 74 6f 72 79 20 $directory
eaa0: 22 5c 22 2e 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 20 "\"... "]....
eab0: 20 20 20 20 20 69 66 20 7b 5b 69 73 52 65 6c 65 if {[isRele
eac0: 61 73 65 41 76 61 69 6c 61 62 6c 65 20 24 64 69 aseAvailable $di
ead0: 72 65 63 74 6f 72 79 20 70 6c 61 74 66 6f 72 6d rectory platform
eae0: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
eaf0: 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
eb00: 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 length $platfor
eb10: 6d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d m] == 0} then {.
eb20: 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 . set
eb30: 20 70 6c 61 74 66 6f 72 6d 20 75 6e 6b 6e 6f 77 platform unknow
eb40: 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a n.. }..
eb50: 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
eb60: 24 73 65 6c 65 63 74 20 26 26 20 5b 6d 61 74 63 $select && [matc
eb70: 68 50 6c 61 74 66 6f 72 6d 20 24 70 6c 61 74 66 hPlatform $platf
eb80: 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 orm]} then {..
eb90: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a set ::
eba0: 62 75 69 6c 64 5f 64 69 72 65 63 74 6f 72 79 20 build_directory
ebb0: 24 64 69 72 65 63 74 6f 72 79 0d 0a 0d 0a 20 20 $directory....
ebc0: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
ebd0: 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
ebe0: 41 72 67 73 20 22 79 65 73 2c 20 73 65 6c 65 63 Args "yes, selec
ebf0: 74 65 64 20 28 22 20 24 70 6c 61 74 66 6f 72 6d ted (" $platform
ec00: 20 22 29 5c 6e 22 5d 0d 0a 0d 0a 20 20 20 20 20 ")\n"]....
ec10: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
ec20: 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 ue.. }
ec30: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
ec40: 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
ec50: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 el [appendArgs "
ec60: 79 65 73 20 28 22 20 24 70 6c 61 74 66 6f 72 6d yes (" $platform
ec70: 20 22 29 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 ")\n"]..
ec80: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 }.. }
ec90: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
eca0: 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
ecb0: 20 6e 6f 5c 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 no\n....
ecc0: 20 20 20 66 6f 72 65 61 63 68 20 70 61 74 68 20 foreach path
ecd0: 5b 6c 73 6f 72 74 20 2d 64 65 63 72 65 61 73 69 [lsort -decreasi
ece0: 6e 67 20 5b 66 69 6c 65 20 6c 69 73 74 20 24 64 ng [file list $d
ecf0: 69 72 65 63 74 6f 72 79 20 2a 5d 5d 20 7b 0d 0a irectory *]] {..
ed00: 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
ed10: 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 70 61 [file exists $pa
ed20: 74 68 5d 20 26 26 20 5b 66 69 6c 65 20 69 73 64 th] && [file isd
ed30: 69 72 65 63 74 6f 72 79 20 24 70 61 74 68 5d 7d irectory $path]}
ed40: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
ed50: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
ed60: 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
ed70: 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
ed80: 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 "---- che
ed90: 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 74 65 6d cking for System
eda0: 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 72 65 6c .Data.SQLite rel
edb0: 65 61 73 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 ease \"" \..
edc0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 70 $p
edd0: 61 74 68 20 22 5c 22 2e 2e 2e 20 22 5d 0d 0a 0d ath "\"... "]...
ede0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 . i
edf0: 66 20 7b 5b 69 73 52 65 6c 65 61 73 65 41 76 61 f {[isReleaseAva
ee00: 69 6c 61 62 6c 65 20 24 70 61 74 68 20 70 6c 61 ilable $path pla
ee10: 74 66 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d 0a tform]} then {..
ee20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
ee30: 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
ee40: 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3d 3d th $platform] ==
ee50: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
ee60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 se
ee70: 74 20 70 6c 61 74 66 6f 72 6d 20 75 6e 6b 6e 6f t platform unkno
ee80: 77 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 wn..
ee90: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
eea0: 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 73 65 if {$se
eeb0: 6c 65 63 74 20 26 26 20 5b 6d 61 74 63 68 50 6c lect && [matchPl
eec0: 61 74 66 6f 72 6d 20 24 70 6c 61 74 66 6f 72 6d atform $platform
eed0: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
eee0: 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 set
eef0: 20 3a 3a 62 75 69 6c 64 5f 64 69 72 65 63 74 6f ::build_directo
ef00: 72 79 20 24 70 61 74 68 0d 0a 0d 0a 20 20 20 20 ry $path....
ef10: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
ef20: 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
ef30: 70 65 6e 64 41 72 67 73 20 22 79 65 73 2c 20 73 pendArgs "yes, s
ef40: 65 6c 65 63 74 65 64 20 28 22 20 24 70 6c 61 74 elected (" $plat
ef50: 66 6f 72 6d 20 22 29 5c 6e 22 5d 0d 0a 0d 0a 20 form ")\n"]....
ef60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
ef70: 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 return true..
ef80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 }
ef90: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
efa0: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
efb0: 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
efc0: 41 72 67 73 20 22 79 65 73 20 28 22 20 24 70 6c Args "yes (" $pl
efd0: 61 74 66 6f 72 6d 20 22 29 5c 6e 22 5d 0d 0a 20 atform ")\n"]..
efe0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
eff0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
f000: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
f010: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
f020: 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 $channel no\n..
f030: 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
f040: 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
f050: 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
f060: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 }.. } e
f070: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 lse {.. t
f080: 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
f090: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
f0a0: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 65 "---- e
f0b0: 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 nvironment varia
f0c0: 62 6c 65 20 5c 22 53 79 73 74 65 6d 2e 44 61 74 ble \"System.Dat
f0d0: 61 2e 53 51 4c 69 74 65 5c 22 20 69 73 20 6e 6f a.SQLite\" is no
f0e0: 74 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 t " \..
f0f0: 20 20 20 22 73 65 74 2c 20 73 6b 69 70 70 69 6e "set, skippin
f100: 67 20 63 68 65 63 6b 20 66 6f 72 20 72 65 6c 65 g check for rele
f110: 61 73 65 73 2e 2e 2e 5c 6e 22 5d 0d 0a 20 20 20 ases...\n"]..
f120: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 }.... re
f130: 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 turn false..
f140: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 }..... proc c
f150: 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 4c 69 62 heckForSQLiteLib
f160: 72 61 72 79 20 7b 20 63 68 61 6e 6e 65 6c 20 7d rary { channel }
f170: 20 7b 0d 0a 20 20 20 20 20 20 74 70 75 74 73 20 {.. tputs
f180: 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 $channel "---- c
f190: 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 51 4c 69 hecking for SQLi
f1a0: 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 2e te core library.
f1b0: 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 69 66 .. ".... if
f1c0: 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
f1d0: 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b object invok
f1e0: 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 e -flags +NonPub
f1f0: 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 lic \..
f200: 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 System.Data.S
f210: 51 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 53 51 QLite.SQLite3 SQ
f220: 4c 69 74 65 56 65 72 73 69 6f 6e 0d 0a 20 20 20 LiteVersion..
f230: 20 20 20 7d 20 76 65 72 73 69 6f 6e 5d 20 3d 3d } version] ==
f240: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
f250: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
f260: 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 NOTE: Check if
f270: 74 68 65 20 72 65 74 75 72 6e 65 64 20 76 65 72 the returned ver
f280: 73 69 6f 6e 20 77 61 73 20 6e 75 6c 6c 2e 20 20 sion was null.
f290: 49 66 20 73 6f 2c 20 6d 61 6b 65 20 69 74 20 65 If so, make it e
f2a0: 61 73 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 asy.. #
f2b0: 20 20 20 20 20 74 6f 20 73 70 6f 74 2e 0d 0a 20 to spot...
f2c0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
f2d0: 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
f2e0: 6e 67 74 68 20 24 76 65 72 73 69 6f 6e 5d 20 3d ngth $version] =
f2f0: 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
f300: 20 20 20 20 20 20 20 73 65 74 20 76 65 72 73 69 set versi
f310: 6f 6e 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 20 on null..
f320: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d }.... #.
f330: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
f340: 20 41 74 74 65 6d 70 74 20 74 6f 20 71 75 65 72 Attempt to quer
f350: 79 20 74 68 65 20 46 6f 73 73 69 6c 20 73 6f 75 y the Fossil sou
f360: 72 63 65 20 69 64 65 6e 74 69 66 69 65 72 20 66 rce identifier f
f370: 6f 72 20 74 68 65 20 53 51 4c 69 74 65 0d 0a 20 or the SQLite..
f380: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 # c
f390: 6f 72 65 20 6c 69 62 72 61 72 79 2e 0d 0a 20 20 ore library...
f3a0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
f3b0: 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
f3c0: 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
f3d0: 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
f3e0: 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
f3f0: 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
f400: 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c .Data.SQLite.SQL
f410: 69 74 65 33 20 53 51 4c 69 74 65 53 6f 75 72 63 ite3 SQLiteSourc
f420: 65 49 64 0d 0a 20 20 20 20 20 20 20 20 7d 20 73 eId.. } s
f430: 6f 75 72 63 65 49 64 5d 7d 20 74 68 65 6e 20 7b ourceId]} then {
f440: 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
f450: 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
f460: 20 57 65 20 66 61 69 6c 65 64 20 74 6f 20 71 75 We failed to qu
f470: 65 72 79 20 74 68 65 20 46 6f 73 73 69 6c 20 73 ery the Fossil s
f480: 6f 75 72 63 65 20 69 64 65 6e 74 69 66 69 65 72 ource identifier
f490: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
f4a0: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73 6f set so
f4b0: 75 72 63 65 49 64 20 75 6e 6b 6e 6f 77 6e 0d 0a urceId unknown..
f4c0: 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
f4d0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
f4e0: 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 # NOTE: Check if
f4f0: 20 74 68 65 20 72 65 74 75 72 6e 65 64 20 46 6f the returned Fo
f500: 73 73 69 6c 20 73 6f 75 72 63 65 20 69 64 65 6e ssil source iden
f510: 74 69 66 69 65 72 20 77 61 73 20 6e 75 6c 6c 2e tifier was null.
f520: 20 20 49 66 0d 0a 20 20 20 20 20 20 20 20 23 20 If.. #
f530: 20 20 20 20 20 20 73 6f 2c 20 6d 61 6b 65 20 69 so, make i
f540: 74 20 65 61 73 79 20 74 6f 20 73 70 6f 74 2e 0d t easy to spot..
f550: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
f560: 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
f570: 6c 65 6e 67 74 68 20 24 73 6f 75 72 63 65 49 64 length $sourceId
f580: 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
f590: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73 6f set so
f5a0: 75 72 63 65 49 64 20 6e 75 6c 6c 0d 0a 20 20 20 urceId null..
f5b0: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
f5c0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
f5d0: 4f 54 45 3a 20 59 65 73 2c 20 74 68 65 20 53 51 OTE: Yes, the SQ
f5e0: 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 Lite core librar
f5f0: 79 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 y appears to be
f600: 61 76 61 69 6c 61 62 6c 65 2e 0d 0a 20 20 20 20 available...
f610: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 61 #.. a
f620: 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 51 4c ddConstraint SQL
f630: 69 74 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 ite.... t
f640: 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
f650: 70 70 65 6e 64 41 72 67 73 20 22 79 65 73 20 28 ppendArgs "yes (
f660: 22 20 24 76 65 72 73 69 6f 6e 20 22 20 22 20 24 " $version " " $
f670: 73 6f 75 72 63 65 49 64 20 22 29 5c 6e 22 5d 0d sourceId ")\n"].
f680: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
f690: 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
f6a0: 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 20 channel no\n..
f6b0: 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
f6c0: 0a 20 20 20 20 70 72 6f 63 20 63 68 65 63 6b 46 . proc checkF
f6d0: 6f 72 53 51 4c 69 74 65 49 6e 74 65 72 6f 70 20 orSQLiteInterop
f6e0: 7b 20 63 68 61 6e 6e 65 6c 20 7d 20 7b 0d 0a 20 { channel } {..
f6f0: 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
f700: 6e 65 6c 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 nel "---- checki
f710: 6e 67 20 66 6f 72 20 53 51 4c 69 74 65 20 69 6e ng for SQLite in
f720: 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 2e 2e terop assembly..
f730: 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 . ".... if
f740: 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
f750: 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
f760: 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c -flags +NonPubl
f770: 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ic \..
f780: 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
f790: 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 49 6e 74 Lite.SQLite3 Int
f7a0: 65 72 6f 70 56 65 72 73 69 6f 6e 0d 0a 20 20 20 eropVersion..
f7b0: 20 20 20 7d 20 76 65 72 73 69 6f 6e 5d 20 3d 3d } version] ==
f7c0: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
f7d0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
f7e0: 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 NOTE: Check if
f7f0: 74 68 65 20 72 65 74 75 72 6e 65 64 20 76 65 72 the returned ver
f800: 73 69 6f 6e 20 77 61 73 20 6e 75 6c 6c 2e 20 20 sion was null.
f810: 49 66 20 73 6f 2c 20 6d 61 6b 65 20 69 74 20 65 If so, make it e
f820: 61 73 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 asy.. #
f830: 20 20 20 20 20 74 6f 20 73 70 6f 74 2e 0d 0a 20 to spot...
f840: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
f850: 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
f860: 6e 67 74 68 20 24 76 65 72 73 69 6f 6e 5d 20 3d ngth $version] =
f870: 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
f880: 20 20 20 20 20 20 20 73 65 74 20 76 65 72 73 69 set versi
f890: 6f 6e 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 20 on null..
f8a0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d }.... #.
f8b0: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
f8c0: 20 41 74 74 65 6d 70 74 20 74 6f 20 71 75 65 72 Attempt to quer
f8d0: 79 20 74 68 65 20 46 6f 73 73 69 6c 20 73 6f 75 y the Fossil sou
f8e0: 72 63 65 20 69 64 65 6e 74 69 66 69 65 72 20 66 rce identifier f
f8f0: 6f 72 20 74 68 65 20 53 51 4c 69 74 65 0d 0a 20 or the SQLite..
f900: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 # c
f910: 6f 72 65 20 6c 69 62 72 61 72 79 2e 0d 0a 20 20 ore library...
f920: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
f930: 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
f940: 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
f950: 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
f960: 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
f970: 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
f980: 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c .Data.SQLite.SQL
f990: 69 74 65 33 20 49 6e 74 65 72 6f 70 53 6f 75 72 ite3 InteropSour
f9a0: 63 65 49 64 0d 0a 20 20 20 20 20 20 20 20 7d 20 ceId.. }
f9b0: 73 6f 75 72 63 65 49 64 5d 7d 20 74 68 65 6e 20 sourceId]} then
f9c0: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a {.. #..
f9d0: 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
f9e0: 3a 20 57 65 20 66 61 69 6c 65 64 20 74 6f 20 71 : We failed to q
f9f0: 75 65 72 79 20 74 68 65 20 46 6f 73 73 69 6c 20 uery the Fossil
fa00: 73 6f 75 72 63 65 20 69 64 65 6e 74 69 66 69 65 source identifie
fa10: 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d r... #.
fa20: 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73 . set s
fa30: 6f 75 72 63 65 49 64 20 75 6e 6b 6e 6f 77 6e 0d ourceId unknown.
fa40: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
fa50: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
fa60: 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 # NOTE: Check i
fa70: 66 20 74 68 65 20 72 65 74 75 72 6e 65 64 20 46 f the returned F
fa80: 6f 73 73 69 6c 20 73 6f 75 72 63 65 20 69 64 65 ossil source ide
fa90: 6e 74 69 66 69 65 72 20 77 61 73 20 6e 75 6c 6c ntifier was null
faa0: 2e 20 20 49 66 0d 0a 20 20 20 20 20 20 20 20 23 . If.. #
fab0: 20 20 20 20 20 20 20 73 6f 2c 20 6d 61 6b 65 20 so, make
fac0: 69 74 20 65 61 73 79 20 74 6f 20 73 70 6f 74 2e it easy to spot.
fad0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
fae0: 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
faf0: 20 6c 65 6e 67 74 68 20 24 73 6f 75 72 63 65 49 length $sourceI
fb00: 64 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d d] == 0} then {.
fb10: 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73 . set s
fb20: 6f 75 72 63 65 49 64 20 6e 75 6c 6c 0d 0a 20 20 ourceId null..
fb30: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
fb40: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
fb50: 4e 4f 54 45 3a 20 42 65 66 6f 72 65 20 61 63 74 NOTE: Before act
fb60: 75 61 6c 6c 79 20 61 64 64 69 6e 67 20 74 68 65 ually adding the
fb70: 20 74 65 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 test constraint
fb80: 2c 20 6d 61 6b 65 20 73 75 72 65 20 74 68 65 0d , make sure the.
fb90: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
fba0: 20 76 65 72 73 69 6f 6e 20 69 73 20 76 61 6c 69 version is vali
fbb0: 64 20 28 69 2e 65 2e 20 6e 6f 74 20 6a 75 73 74 d (i.e. not just
fbc0: 20 74 68 61 74 20 77 65 20 63 6f 75 6c 64 20 71 that we could q
fbd0: 75 65 72 79 20 69 74 29 2e 0d 0a 20 20 20 20 20 uery it)...
fbe0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 #.. if
fbf0: 20 7b 24 76 65 72 73 69 6f 6e 20 6e 65 20 22 6e {$version ne "n
fc00: 75 6c 6c 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ull"} then {..
fc10: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
fc20: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 65 73 # NOTE: Yes
fc30: 2c 20 74 68 65 20 53 51 4c 69 74 65 20 69 6e 74 , the SQLite int
fc40: 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 61 70 erop assembly ap
fc50: 70 65 61 72 73 20 74 6f 20 62 65 20 61 76 61 69 pears to be avai
fc60: 6c 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 lable...
fc70: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 61 #.. a
fc80: 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 51 4c ddConstraint SQL
fc90: 69 74 65 49 6e 74 65 72 6f 70 0d 0a 0d 0a 20 20 iteInterop....
fca0: 20 20 20 20 20 20 20 20 73 65 74 20 61 6e 73 77 set answ
fcb0: 65 72 20 79 65 73 0d 0a 20 20 20 20 20 20 20 20 er yes..
fcc0: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
fcd0: 20 20 20 20 73 65 74 20 61 6e 73 77 65 72 20 6e set answer n
fce0: 6f 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a o.. }....
fcf0: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
fd00: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
fd10: 67 73 20 24 61 6e 73 77 65 72 20 22 20 28 22 20 gs $answer " ("
fd20: 24 76 65 72 73 69 6f 6e 20 22 20 22 20 24 73 6f $version " " $so
fd30: 75 72 63 65 49 64 20 22 29 5c 6e 22 5d 0d 0a 20 urceId ")\n"]..
fd40: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
fd50: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
fd60: 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 20 20 20 annel no\n..
fd70: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
fd80: 20 20 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 proc checkFor
fd90: 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 SQLiteDefineCons
fda0: 74 61 6e 74 20 7b 20 63 68 61 6e 6e 65 6c 20 6e tant { channel n
fdb0: 61 6d 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 ame } {.. t
fdc0: 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
fdd0: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
fde0: 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 "---- che
fdf0: 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 74 65 6d cking for System
fe00: 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 64 65 66 .Data.SQLite def
fe10: 69 6e 65 20 63 6f 6e 73 74 61 6e 74 20 5c 22 22 ine constant \""
fe20: 20 24 6e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 $name \..
fe30: 20 20 20 20 22 5c 22 2e 2e 2e 20 22 5d 0d 0a 0d "\"... "]...
fe40: 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 . if {[catc
fe50: 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a h {.. obj
fe60: 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 ect invoke -flag
fe70: 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a s +NonPublic \..
fe80: 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
fe90: 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 em.Data.SQLite.S
fea0: 51 4c 69 74 65 33 20 44 65 66 69 6e 65 43 6f 6e QLite3 DefineCon
feb0: 73 74 61 6e 74 73 0d 0a 20 20 20 20 20 20 7d 20 stants.. }
fec0: 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 73 5d defineConstants]
fed0: 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
fee0: 20 20 20 20 20 20 20 69 66 20 7b 5b 6c 73 65 61 if {[lsea
fef0: 72 63 68 20 2d 65 78 61 63 74 20 2d 6e 6f 63 61 rch -exact -noca
ff00: 73 65 20 24 64 65 66 69 6e 65 43 6f 6e 73 74 61 se $defineConsta
ff10: 6e 74 73 20 24 6e 61 6d 65 5d 20 21 3d 20 2d 31 nts $name] != -1
ff20: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
ff30: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
ff40: 20 23 20 4e 4f 54 45 3a 20 59 65 73 2c 20 74 68 # NOTE: Yes, th
ff50: 69 73 20 64 65 66 69 6e 65 20 63 6f 6e 73 74 61 is define consta
ff60: 6e 74 20 77 61 73 20 65 6e 61 62 6c 65 64 20 77 nt was enabled w
ff70: 68 65 6e 20 74 68 65 20 6d 61 6e 61 67 65 64 0d hen the managed.
ff80: 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
ff90: 20 20 20 61 73 73 65 6d 62 6c 79 20 77 61 73 20 assembly was
ffa0: 63 6f 6d 70 69 6c 65 64 2e 0d 0a 20 20 20 20 20 compiled...
ffb0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
ffc0: 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 addConstraint
ffd0: 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 67 65 74 [appendArgs [get
ffe0: 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 SQLiteDefineCons
fff0: 74 61 6e 74 50 72 65 66 69 78 5d 20 24 6e 61 6d tantPrefix] $nam
10000 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 e]....
10010 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 79 tputs $channel y
10020 65 73 5c 6e 0d 0a 20 20 20 20 20 20 20 20 7d 20 es\n.. }
10030 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
10040 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
10050 20 6e 6f 5c 6e 0d 0a 20 20 20 20 20 20 20 20 7d no\n.. }
10060 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
10070 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
10080 24 63 68 61 6e 6e 65 6c 20 65 72 72 6f 72 5c 6e $channel error\n
10090 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
100a0 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
100b0 74 44 61 74 65 54 69 6d 65 46 6f 72 6d 61 74 20 tDateTimeFormat
100c0 7b 20 7b 74 69 6d 65 5a 6f 6e 65 20 74 72 75 65 { {timeZone true
100d0 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a } } {.. #..
100e0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 # NOTE: Th
100f0 69 73 20 70 72 6f 63 65 64 75 72 65 20 73 69 6d is procedure sim
10100 70 6c 79 20 72 65 74 75 72 6e 73 20 74 68 65 20 ply returns the
10110 22 64 65 66 61 75 6c 74 22 20 44 61 74 65 54 69 "default" DateTi
10120 6d 65 20 66 6f 72 6d 61 74 20 75 73 65 64 0d 0a me format used..
10130 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 79 # by
10140 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 2e the test suite.
10150 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
10160 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
10170 73 20 3a 3a 64 61 74 65 74 69 6d 65 5f 66 6f 72 s ::datetime_for
10180 6d 61 74 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 mat] && \..
10190 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
101a0 67 74 68 20 24 3a 3a 64 61 74 65 74 69 6d 65 5f gth $::datetime_
101b0 66 6f 72 6d 61 74 5d 20 3e 20 30 7d 20 74 68 65 format] > 0} the
101c0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
101d0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
101e0 52 65 74 75 72 6e 20 74 68 65 20 6d 61 6e 75 61 Return the manua
101f0 6c 6c 79 20 6f 76 65 72 72 69 64 64 65 6e 20 76 lly overridden v
10200 61 6c 75 65 20 66 6f 72 20 74 68 65 20 44 61 74 alue for the Dat
10210 65 54 69 6d 65 20 66 6f 72 6d 61 74 2e 0d 0a 20 eTime format...
10220 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
10230 20 20 72 65 74 75 72 6e 20 24 3a 3a 64 61 74 65 return $::date
10240 74 69 6d 65 5f 66 6f 72 6d 61 74 0d 0a 20 20 20 time_format..
10250 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
10260 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
10270 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 61 # NOTE: Return a
10280 6e 20 49 53 4f 38 36 30 31 20 44 61 74 65 54 69 n ISO8601 DateTi
10290 6d 65 20 66 6f 72 6d 61 74 20 63 6f 6d 70 61 74 me format compat
102a0 69 62 6c 65 20 77 69 74 68 20 53 51 4c 69 74 65 ible with SQLite
102b0 2c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 ,.. #
102c0 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 System.Data.S
102d0 51 4c 69 74 65 2c 20 61 6e 64 20 73 75 69 74 61 QLite, and suita
102e0 62 6c 65 20 66 6f 72 20 72 6f 75 6e 64 2d 74 72 ble for round-tr
102f0 69 70 70 69 6e 67 20 77 69 74 68 20 74 68 65 0d ipping with the.
10300 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
10310 20 44 61 74 65 54 69 6d 65 20 63 6c 61 73 73 20 DateTime class
10320 6f 66 20 74 68 65 20 66 72 61 6d 65 77 6f 72 6b of the framework
10330 2e 20 20 49 66 20 74 68 69 73 20 76 61 6c 75 65 . If this value
10340 20 69 73 20 63 68 61 6e 67 65 64 2c 0d 0a 20 20 is changed,..
10350 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 61 # va
10360 72 69 6f 75 73 20 74 65 73 74 73 20 6d 61 79 20 rious tests may
10370 66 61 69 6c 2e 0d 0a 20 20 20 20 20 20 20 20 23 fail... #
10380 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
10390 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
103a0 20 20 20 20 20 20 20 20 20 20 20 20 22 79 79 79 "yyy
103b0 79 2d 4d 4d 2d 64 64 20 48 48 3a 6d 6d 3a 73 73 y-MM-dd HH:mm:ss
103c0 2e 46 46 46 46 46 46 46 22 20 5b 65 78 70 72 20 .FFFFFFF" [expr
103d0 7b 24 74 69 6d 65 5a 6f 6e 65 20 3f 20 22 4b 22 {$timeZone ? "K"
103e0 20 3a 20 22 22 7d 5d 5d 0d 0a 20 20 20 20 20 20 : ""}]]..
103f0 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
10400 20 70 72 6f 63 20 67 65 74 44 61 74 65 54 69 6d proc getDateTim
10410 65 54 69 63 6b 73 20 7b 20 76 61 6c 75 65 20 7b eTicks { value {
10420 6c 6f 63 61 6c 20 22 22 7d 20 7b 64 65 66 61 75 local ""} {defau
10430 6c 74 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 lt ""} } {..
10440 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
10450 6e 67 74 68 20 24 76 61 6c 75 65 5d 20 3d 3d 20 ngth $value] ==
10460 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
10470 20 20 20 72 65 74 75 72 6e 20 24 64 65 66 61 75 return $defau
10480 6c 74 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 lt.. }....
10490 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
104a0 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 64 {.. set d
104b0 61 74 65 54 69 6d 65 20 5b 6f 62 6a 65 63 74 20 ateTime [object
104c0 69 6e 76 6f 6b 65 20 2d 63 72 65 61 74 65 20 44 invoke -create D
104d0 61 74 65 54 69 6d 65 20 50 61 72 73 65 45 78 61 ateTime ParseExa
104e0 63 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ct \..
104f0 20 20 24 76 61 6c 75 65 20 5b 67 65 74 44 61 74 $value [getDat
10500 65 54 69 6d 65 46 6f 72 6d 61 74 5d 20 6e 75 6c eTimeFormat] nul
10510 6c 20 41 64 6a 75 73 74 54 6f 55 6e 69 76 65 72 l AdjustToUniver
10520 73 61 6c 5d 0d 0a 20 20 20 20 20 20 7d 5d 7d 20 sal].. }]}
10530 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
10540 72 65 74 75 72 6e 20 24 64 65 66 61 75 6c 74 0d return $default.
10550 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
10560 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 69 73 if {[string is
10570 20 62 6f 6f 6c 65 61 6e 20 2d 73 74 72 69 63 74 boolean -strict
10580 20 24 6c 6f 63 61 6c 5d 7d 20 74 68 65 6e 20 7b $local]} then {
10590 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 64 61 .. set da
105a0 74 65 54 69 6d 65 20 5b 6f 62 6a 65 63 74 20 69 teTime [object i
105b0 6e 76 6f 6b 65 20 2d 63 72 65 61 74 65 20 44 61 nvoke -create Da
105c0 74 65 54 69 6d 65 20 53 70 65 63 69 66 79 4b 69 teTime SpecifyKi
105d0 6e 64 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 nd \..
105e0 20 20 24 64 61 74 65 54 69 6d 65 20 55 74 63 5d $dateTime Utc]
105f0 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
10600 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
10610 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 [object invoke
10620 24 64 61 74 65 54 69 6d 65 20 54 69 63 6b 73 5d $dateTime Ticks]
10630 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
10640 20 20 20 69 66 20 7b 24 6c 6f 63 61 6c 7d 20 74 if {$local} t
10650 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 hen {.. r
10660 65 74 75 72 6e 20 5b 6f 62 6a 65 63 74 20 69 6e eturn [object in
10670 76 6f 6b 65 20 24 64 61 74 65 54 69 6d 65 20 54 voke $dateTime T
10680 6f 4c 6f 63 61 6c 54 69 6d 65 2e 54 69 63 6b 73 oLocalTime.Ticks
10690 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 ].. } else
106a0 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 {.. retur
106b0 6e 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 n [object invoke
106c0 20 24 64 61 74 65 54 69 6d 65 20 54 6f 55 6e 69 $dateTime ToUni
106d0 76 65 72 73 61 6c 54 69 6d 65 2e 54 69 63 6b 73 versalTime.Ticks
106e0 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 ].. }..
106f0 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 }..... proc g
10700 65 74 50 72 6f 70 65 72 74 69 65 73 20 7b 20 6f etProperties { o
10710 62 6a 65 63 74 20 76 61 72 4e 61 6d 65 20 7d 20 bject varName }
10720 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 {.. upvar 1
10730 20 24 76 61 72 4e 61 6d 65 20 70 72 6f 70 65 72 $varName proper
10740 74 69 65 73 0d 0a 0d 0a 20 20 20 20 20 20 73 65 ties.... se
10750 74 20 63 6f 75 6e 74 20 30 0d 0a 20 20 20 20 20 t count 0..
10760 20 73 65 74 20 6e 61 6d 65 73 20 5b 6c 69 73 74 set names [list
10770 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b ].... if {[
10780 69 73 4f 62 6a 65 63 74 48 61 6e 64 6c 65 20 24 isObjectHandle $
10790 6f 62 6a 65 63 74 5d 20 26 26 20 24 6f 62 6a 65 object] && $obje
107a0 63 74 20 6e 65 20 22 6e 75 6c 6c 22 7d 20 74 68 ct ne "null"} th
107b0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 65 76 en {.. ev
107c0 61 6c 20 6c 61 70 70 65 6e 64 20 6e 61 6d 65 73 al lappend names
107d0 20 5b 6f 62 6a 65 63 74 20 6d 65 6d 62 65 72 73 [object members
107e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
107f0 2d 6d 65 6d 62 65 72 74 79 70 65 73 20 50 72 6f -membertypes Pro
10800 70 65 72 74 79 20 2d 6e 61 6d 65 6f 6e 6c 79 20 perty -nameonly
10810 24 6f 62 6a 65 63 74 5d 0d 0a 0d 0a 20 20 20 20 $object]....
10820 20 20 20 20 65 76 61 6c 20 6c 61 70 70 65 6e 64 eval lappend
10830 20 6e 61 6d 65 73 20 5b 6f 62 6a 65 63 74 20 6d names [object m
10840 65 6d 62 65 72 73 20 5c 0d 0a 20 20 20 20 20 20 embers \..
10850 20 20 20 20 20 20 2d 6d 65 6d 62 65 72 74 79 70 -membertyp
10860 65 73 20 46 69 65 6c 64 20 2d 6e 61 6d 65 6f 6e es Field -nameon
10870 6c 79 20 24 6f 62 6a 65 63 74 5d 0d 0a 20 20 20 ly $object]..
10880 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 66 6f }.... fo
10890 72 65 61 63 68 20 6e 61 6d 65 20 24 6e 61 6d 65 reach name $name
108a0 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 s {.. if
108b0 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
108c0 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
108d0 6b 65 20 2d 6f 62 6a 65 63 74 66 6c 61 67 73 20 ke -objectflags
108e0 2b 4e 6f 44 69 73 70 6f 73 65 20 24 6f 62 6a 65 +NoDispose $obje
108f0 63 74 20 24 6e 61 6d 65 0d 0a 20 20 20 20 20 20 ct $name..
10900 20 20 7d 20 76 61 6c 75 65 5d 20 3d 3d 20 30 7d } value] == 0}
10910 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
10920 20 20 20 69 66 20 7b 5b 69 73 4f 62 6a 65 63 74 if {[isObject
10930 48 61 6e 64 6c 65 20 24 76 61 6c 75 65 5d 20 26 Handle $value] &
10940 26 20 24 76 61 6c 75 65 20 6e 65 20 22 6e 75 6c & $value ne "nul
10950 6c 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 l"} then {..
10960 20 20 20 20 20 20 20 20 73 65 74 20 65 72 72 6f set erro
10970 72 20 6e 75 6c 6c 3b 20 6f 62 6a 65 63 74 20 69 r null; object i
10980 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f nvoke -flags +No
10990 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 nPublic \..
109a0 20 20 20 20 20 20 20 20 20 20 20 2d 6d 61 72 73 -mars
109b0 68 61 6c 66 6c 61 67 73 20 2b 4e 6f 48 61 6e 64 halflags +NoHand
109c0 6c 65 20 49 6e 74 65 72 70 72 65 74 65 72 2e 47 le Interpreter.G
109d0 65 74 41 63 74 69 76 65 20 5c 0d 0a 20 20 20 20 etActive \..
109e0 20 20 20 20 20 20 20 20 20 20 20 20 41 64 64 4f AddO
109f0 62 6a 65 63 74 52 65 66 65 72 65 6e 63 65 20 4f bjectReference O
10a00 6b 20 24 76 61 6c 75 65 20 65 72 72 6f 72 0d 0a k $value error..
10a10 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 .. la
10a20 70 70 65 6e 64 20 70 72 6f 70 65 72 74 69 65 73 ppend properties
10a30 28 6f 62 6a 65 63 74 73 29 20 5b 6c 69 73 74 20 (objects) [list
10a40 24 6e 61 6d 65 20 24 76 61 6c 75 65 5d 0d 0a 20 $name $value]..
10a50 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 } else
10a60 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c {.. l
10a70 61 70 70 65 6e 64 20 70 72 6f 70 65 72 74 69 65 append propertie
10a80 73 28 76 61 6c 75 65 73 29 20 5b 6c 69 73 74 20 s(values) [list
10a90 24 6e 61 6d 65 20 24 76 61 6c 75 65 5d 0d 0a 20 $name $value]..
10aa0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
10ab0 20 20 20 20 20 20 20 20 69 6e 63 72 20 63 6f 75 incr cou
10ac0 6e 74 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c nt.. } el
10ad0 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
10ae0 6c 61 70 70 65 6e 64 20 70 72 6f 70 65 72 74 69 lappend properti
10af0 65 73 28 65 72 72 6f 72 73 29 20 5b 6c 69 73 74 es(errors) [list
10b00 20 24 6e 61 6d 65 20 24 3a 3a 65 72 72 6f 72 43 $name $::errorC
10b10 6f 64 65 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d ode].. }.
10b20 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
10b30 20 20 72 65 74 75 72 6e 20 24 63 6f 75 6e 74 0d return $count.
10b40 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
10b50 72 6f 63 20 67 65 74 41 6c 6c 50 72 6f 70 65 72 roc getAllProper
10b60 74 69 65 73 20 7b 20 6f 62 6a 65 63 74 20 76 61 ties { object va
10b70 72 4e 61 6d 65 20 7d 20 7b 0d 0a 20 20 20 20 20 rName } {..
10b80 20 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d upvar 1 $varNam
10b90 65 20 70 72 6f 70 65 72 74 69 65 73 0d 0a 20 20 e properties..
10ba0 20 20 20 20 73 65 74 20 76 61 6c 75 65 20 24 6f set value $o
10bb0 62 6a 65 63 74 0d 0a 0d 0a 20 20 20 20 20 20 77 bject.... w
10bc0 68 69 6c 65 20 7b 74 72 75 65 7d 20 7b 0d 0a 20 hile {true} {..
10bd0 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
10be0 6f 20 65 78 69 73 74 73 20 70 72 6f 70 65 72 74 o exists propert
10bf0 69 65 73 28 73 65 65 6e 4f 62 6a 65 63 74 73 29 ies(seenObjects)
10c00 5d 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] || \..
10c10 20 20 20 20 24 76 61 6c 75 65 20 6e 69 20 24 70 $value ni $p
10c20 72 6f 70 65 72 74 69 65 73 28 73 65 65 6e 4f 62 roperties(seenOb
10c30 6a 65 63 74 73 29 7d 20 74 68 65 6e 20 7b 0d 0a jects)} then {..
10c40 20 20 20 20 20 20 20 20 20 20 67 65 74 50 72 6f getPro
10c50 70 65 72 74 69 65 73 20 24 76 61 6c 75 65 20 70 perties $value p
10c60 72 6f 70 65 72 74 69 65 73 0d 0a 20 20 20 20 20 roperties..
10c70 20 20 20 20 20 6c 61 70 70 65 6e 64 20 70 72 6f lappend pro
10c80 70 65 72 74 69 65 73 28 73 65 65 6e 4f 62 6a 65 perties(seenObje
10c90 63 74 73 29 20 24 76 61 6c 75 65 0d 0a 20 20 20 cts) $value..
10ca0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
10cb0 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
10cc0 73 74 73 20 70 72 6f 70 65 72 74 69 65 73 28 6f sts properties(o
10cd0 62 6a 65 63 74 73 29 5d 7d 20 74 68 65 6e 20 7b bjects)]} then {
10ce0 0d 0a 20 20 20 20 20 20 20 20 20 20 62 72 65 61 .. brea
10cf0 6b 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a k.. }....
10d00 20 20 20 20 20 20 20 20 69 66 20 7b 5b 6c 6c 65 if {[lle
10d10 6e 67 74 68 20 24 70 72 6f 70 65 72 74 69 65 73 ngth $properties
10d20 28 6f 62 6a 65 63 74 73 29 5d 20 3d 3d 20 30 7d (objects)] == 0}
10d30 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
10d40 20 20 20 75 6e 73 65 74 20 70 72 6f 70 65 72 74 unset propert
10d50 69 65 73 28 6f 62 6a 65 63 74 73 29 3b 20 62 72 ies(objects); br
10d60 65 61 6b 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a eak.. }..
10d70 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 76 61 .. set va
10d80 6c 75 65 20 5b 6c 69 6e 64 65 78 20 5b 6c 69 6e lue [lindex [lin
10d90 64 65 78 20 24 70 72 6f 70 65 72 74 69 65 73 28 dex $properties(
10da0 6f 62 6a 65 63 74 73 29 20 30 5d 20 65 6e 64 5d objects) 0] end]
10db0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 70 72 .. set pr
10dc0 6f 70 65 72 74 69 65 73 28 6f 62 6a 65 63 74 73 operties(objects
10dd0 29 20 5b 6c 72 61 6e 67 65 20 24 70 72 6f 70 65 ) [lrange $prope
10de0 72 74 69 65 73 28 6f 62 6a 65 63 74 73 29 20 31 rties(objects) 1
10df0 20 65 6e 64 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a end].. }..
10e00 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 .. if {[inf
10e10 6f 20 65 78 69 73 74 73 20 70 72 6f 70 65 72 74 o exists propert
10e20 69 65 73 28 73 65 65 6e 4f 62 6a 65 63 74 73 29 ies(seenObjects)
10e30 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
10e40 20 20 20 66 6f 72 65 61 63 68 20 76 61 6c 75 65 foreach value
10e50 20 24 70 72 6f 70 65 72 74 69 65 73 28 73 65 65 $properties(see
10e60 6e 4f 62 6a 65 63 74 73 29 20 7b 0d 0a 20 20 20 nObjects) {..
10e70 20 20 20 20 20 20 20 69 66 20 7b 24 76 61 6c 75 if {$valu
10e80 65 20 65 71 20 24 6f 62 6a 65 63 74 7d 20 63 6f e eq $object} co
10e90 6e 74 69 6e 75 65 0d 0a 20 20 20 20 20 20 20 20 ntinue..
10ea0 20 20 63 61 74 63 68 20 7b 6f 62 6a 65 63 74 20 catch {object
10eb0 64 69 73 70 6f 73 65 20 24 76 61 6c 75 65 7d 0d dispose $value}.
10ec0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
10ed0 20 20 20 20 20 20 75 6e 73 65 74 20 70 72 6f 70 unset prop
10ee0 65 72 74 69 65 73 28 73 65 65 6e 4f 62 6a 65 63 erties(seenObjec
10ef0 74 73 29 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 ts).. }..
10f00 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
10f10 20 67 65 74 56 61 72 69 61 62 6c 65 73 20 7b 20 getVariables {
10f20 76 61 72 4e 61 6d 65 73 20 7b 6f 62 6a 65 63 74 varNames {object
10f30 73 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 s false} } {..
10f40 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 20 5b set result [
10f50 6c 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 66 list].... f
10f60 6f 72 65 61 63 68 20 76 61 72 4e 61 6d 65 20 24 oreach varName $
10f70 76 61 72 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 varNames {..
10f80 20 20 20 20 69 66 20 7b 5b 75 70 6c 65 76 65 6c if {[uplevel
10f90 20 31 20 5b 6c 69 73 74 20 61 72 72 61 79 20 65 1 [list array e
10fa0 78 69 73 74 73 20 24 76 61 72 4e 61 6d 65 5d 5d xists $varName]]
10fb0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
10fc0 20 20 20 20 73 65 74 20 61 72 72 61 79 4e 61 6d set arrayNam
10fd0 65 20 24 76 61 72 4e 61 6d 65 0d 0a 0d 0a 20 20 e $varName....
10fe0 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
10ff0 65 6c 65 6d 65 6e 74 4e 61 6d 65 20 5b 75 70 6c elementName [upl
11000 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 61 72 72 evel 1 [list arr
11010 61 79 20 6e 61 6d 65 73 20 24 61 72 72 61 79 4e ay names $arrayN
11020 61 6d 65 5d 5d 20 7b 0d 0a 20 20 20 20 20 20 20 ame]] {..
11030 20 20 20 20 20 73 65 74 20 6e 61 6d 65 20 5b 61 set name [a
11040 70 70 65 6e 64 41 72 67 73 20 24 61 72 72 61 79 ppendArgs $array
11050 4e 61 6d 65 20 28 20 24 65 6c 65 6d 65 6e 74 4e Name ( $elementN
11060 61 6d 65 20 29 5d 0d 0a 20 20 20 20 20 20 20 20 ame )]..
11070 20 20 20 20 73 65 74 20 76 61 72 56 61 6c 75 65 set varValue
11080 20 5b 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 [uplevel 1 [lis
11090 74 20 73 65 74 20 24 6e 61 6d 65 5d 5d 0d 0a 0d t set $name]]...
110a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
110b0 7b 24 6f 62 6a 65 63 74 73 20 26 26 20 5b 69 73 {$objects && [is
110c0 4f 62 6a 65 63 74 48 61 6e 64 6c 65 20 24 76 61 ObjectHandle $va
110d0 72 56 61 6c 75 65 5d 7d 20 74 68 65 6e 20 7b 0d rValue]} then {.
110e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 75 . u
110f0 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e nset -nocomplain
11100 20 70 72 6f 70 65 72 74 69 65 73 0d 0a 20 20 20 properties..
11110 20 20 20 20 20 20 20 20 20 20 20 67 65 74 41 6c getAl
11120 6c 50 72 6f 70 65 72 74 69 65 73 20 24 76 61 72 lProperties $var
11130 56 61 6c 75 65 20 70 72 6f 70 65 72 74 69 65 73 Value properties
11140 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
11150 20 20 6c 61 70 70 65 6e 64 20 72 65 73 75 6c 74 lappend result
11160 20 5b 6c 69 73 74 20 24 6e 61 6d 65 20 5b 61 72 [list $name [ar
11170 72 61 79 20 67 65 74 20 70 72 6f 70 65 72 74 69 ray get properti
11180 65 73 5d 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 es]]..
11190 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
111a0 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e lappen
111b0 64 20 72 65 73 75 6c 74 20 5b 6c 69 73 74 20 24 d result [list $
111c0 6e 61 6d 65 20 24 76 61 72 56 61 6c 75 65 5d 0d name $varValue].
111d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
111e0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
111f0 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
11200 20 20 20 20 20 20 20 20 20 73 65 74 20 76 61 72 set var
11210 56 61 6c 75 65 20 5b 75 70 6c 65 76 65 6c 20 31 Value [uplevel 1
11220 20 5b 6c 69 73 74 20 73 65 74 20 24 76 61 72 4e [list set $varN
11230 61 6d 65 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 ame]]....
11240 20 20 20 69 66 20 7b 24 6f 62 6a 65 63 74 73 20 if {$objects
11250 26 26 20 5b 69 73 4f 62 6a 65 63 74 48 61 6e 64 && [isObjectHand
11260 6c 65 20 24 76 61 72 56 61 6c 75 65 5d 7d 20 74 le $varValue]} t
11270 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
11280 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 unset -nocomp
11290 6c 61 69 6e 20 70 72 6f 70 65 72 74 69 65 73 0d lain properties.
112a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 67 65 74 . get
112b0 41 6c 6c 50 72 6f 70 65 72 74 69 65 73 20 24 76 AllProperties $v
112c0 61 72 56 61 6c 75 65 20 70 72 6f 70 65 72 74 69 arValue properti
112d0 65 73 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 es....
112e0 20 20 6c 61 70 70 65 6e 64 20 72 65 73 75 6c 74 lappend result
112f0 20 5b 6c 69 73 74 20 24 76 61 72 4e 61 6d 65 20 [list $varName
11300 5b 61 72 72 61 79 20 67 65 74 20 70 72 6f 70 65 [array get prope
11310 72 74 69 65 73 5d 5d 0d 0a 20 20 20 20 20 20 20 rties]]..
11320 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
11330 20 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 lappend
11340 20 72 65 73 75 6c 74 20 5b 6c 69 73 74 20 24 76 result [list $v
11350 61 72 4e 61 6d 65 20 24 76 61 72 56 61 6c 75 65 arName $varValue
11360 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
11370 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
11380 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 }.... retu
11390 72 6e 20 24 72 65 73 75 6c 74 0d 0a 20 20 20 20 rn $result..
113a0 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 65 }..... proc e
113b0 6e 75 6d 65 72 61 62 6c 65 54 6f 4c 69 73 74 20 numerableToList
113c0 7b 20 65 6e 75 6d 65 72 61 62 6c 65 20 7d 20 7b { enumerable } {
113d0 0d 0a 20 20 20 20 20 20 73 65 74 20 72 65 73 75 .. set resu
113e0 6c 74 20 5b 6c 69 73 74 5d 0d 0a 0d 0a 20 20 20 lt [list]....
113f0 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c if {[string l
11400 65 6e 67 74 68 20 24 65 6e 75 6d 65 72 61 62 6c ength $enumerabl
11410 65 5d 20 3d 3d 20 30 20 7c 7c 20 24 65 6e 75 6d e] == 0 || $enum
11420 65 72 61 62 6c 65 20 65 71 20 22 6e 75 6c 6c 22 erable eq "null"
11430 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
11440 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 6c 74 return $result
11450 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
11460 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 61 63 object foreac
11470 68 20 2d 61 6c 69 61 73 20 69 74 65 6d 20 24 65 h -alias item $e
11480 6e 75 6d 65 72 61 62 6c 65 20 7b 0d 0a 20 20 20 numerable {..
11490 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
114a0 20 6c 65 6e 67 74 68 20 24 69 74 65 6d 5d 20 3e length $item] >
114b0 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
114c0 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 72 65 lappend re
114d0 73 75 6c 74 20 5b 24 69 74 65 6d 20 54 6f 53 74 sult [$item ToSt
114e0 72 69 6e 67 5d 0d 0a 20 20 20 20 20 20 20 20 7d ring].. }
114f0 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
11500 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 6c return $resul
11510 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 t.. }.....
11520 20 70 72 6f 63 20 63 61 74 63 68 41 6e 64 52 65 proc catchAndRe
11530 74 75 72 6e 20 7b 20 73 63 72 69 70 74 20 7b 73 turn { script {s
11540 74 61 63 6b 54 72 61 63 65 20 66 61 6c 73 65 7d tackTrace false}
11550 20 7b 73 74 72 69 63 74 20 74 72 75 65 7d 20 7d {strict true} }
11560 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
11570 20 20 20 23 20 4e 4f 54 45 3a 20 45 76 61 6c 75 # NOTE: Evalu
11580 61 74 65 20 74 68 65 20 73 63 72 69 70 74 20 70 ate the script p
11590 72 6f 76 69 64 65 64 20 62 79 20 6f 75 72 20 63 rovided by our c
115a0 61 6c 6c 65 72 20 69 6e 20 74 68 65 69 72 20 63 aller in their c
115b0 6f 6e 74 65 78 74 2c 0d 0a 20 20 20 20 20 20 23 ontext,.. #
115c0 20 20 20 20 20 20 20 63 61 70 74 75 72 69 6e 67 capturing
115d0 20 62 6f 74 68 20 74 68 65 20 72 65 73 75 6c 74 both the result
115e0 20 61 6e 64 20 74 68 65 20 72 65 74 75 72 6e 20 and the return
115f0 63 6f 64 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a code... #..
11600 20 20 20 20 20 20 73 65 74 20 63 6f 64 65 20 5b set code [
11610 63 61 74 63 68 20 7b 75 70 6c 65 76 65 6c 20 31 catch {uplevel 1
11620 20 24 73 63 72 69 70 74 7d 20 72 65 73 75 6c 74 $script} result
11630 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ].... #..
11640 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 69 64 20 # NOTE: Did
11650 74 68 65 20 73 63 72 69 70 74 20 70 72 6f 76 69 the script provi
11660 64 65 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 ded by our calle
11670 72 20 4e 4f 54 20 72 61 69 73 65 20 61 6e 20 65 r NOT raise an e
11680 72 72 6f 72 3f 0d 0a 20 20 20 20 20 20 23 0d 0a rror?.. #..
11690 20 20 20 20 20 20 69 66 20 7b 24 73 74 72 69 63 if {$stric
116a0 74 20 26 26 20 24 63 6f 64 65 20 3d 3d 20 30 20 t && $code == 0
116b0 7c 7c 20 21 24 73 74 72 69 63 74 20 26 26 20 24 || !$strict && $
116c0 63 6f 64 65 20 21 3d 20 31 7d 20 74 68 65 6e 20 code != 1} then
116d0 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
116e0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 75 # NOTE: Su
116f0 63 63 65 73 73 2e 20 20 52 65 74 75 72 6e 20 61 ccess. Return a
11700 20 6c 69 73 74 20 77 69 74 68 20 74 68 65 20 72 list with the r
11710 65 74 75 72 6e 20 63 6f 64 65 20 61 6e 64 20 74 eturn code and t
11720 68 65 20 72 65 73 75 6c 74 2e 0d 0a 20 20 20 20 he result...
11730 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
11740 65 74 75 72 6e 20 5b 6c 69 73 74 20 24 63 6f 64 eturn [list $cod
11750 65 20 24 72 65 73 75 6c 74 5d 0d 0a 20 20 20 20 e $result]..
11760 20 20 7d 20 65 6c 73 65 69 66 20 7b 24 73 74 61 } elseif {$sta
11770 63 6b 54 72 61 63 65 7d 20 74 68 65 6e 20 7b 0d ckTrace} then {.
11780 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
11790 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 61 69 6c # NOTE: Fail
117a0 75 72 65 2e 20 20 4f 75 72 20 63 61 6c 6c 65 72 ure. Our caller
117b0 20 77 61 6e 74 73 20 61 20 66 75 6c 6c 20 73 74 wants a full st
117c0 61 63 6b 20 74 72 61 63 65 20 28 69 66 20 61 70 ack trace (if ap
117d0 70 6c 69 63 61 62 6c 65 29 2c 0d 0a 20 20 20 20 plicable),..
117e0 20 20 20 20 23 20 20 20 20 20 20 20 72 65 74 75 # retu
117f0 72 6e 20 61 20 6c 69 73 74 20 77 69 74 68 20 74 rn a list with t
11800 68 65 20 72 65 74 75 72 6e 20 63 6f 64 65 20 61 he return code a
11810 6e 64 20 74 68 65 20 72 65 73 75 6c 74 20 76 65 nd the result ve
11820 72 62 61 74 69 6d 2e 0d 0a 20 20 20 20 20 20 20 rbatim...
11830 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 #.. retu
11840 72 6e 20 5b 6c 69 73 74 20 24 63 6f 64 65 20 24 rn [list $code $
11850 72 65 73 75 6c 74 5d 0d 0a 20 20 20 20 20 20 7d result].. }
11860 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
11870 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
11880 54 45 3a 20 46 61 69 6c 75 72 65 2e 20 20 4f 75 TE: Failure. Ou
11890 72 20 63 61 6c 6c 65 72 20 64 6f 65 73 20 6e 6f r caller does no
118a0 74 20 77 61 6e 74 20 61 20 66 75 6c 6c 20 73 74 t want a full st
118b0 61 63 6b 20 74 72 61 63 65 20 28 69 66 0d 0a 20 ack trace (if..
118c0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 # a
118d0 70 70 6c 69 63 61 62 6c 65 29 2c 20 72 65 74 75 pplicable), retu
118e0 72 6e 20 61 20 6c 69 73 74 20 77 69 74 68 20 74 rn a list with t
118f0 68 65 20 72 65 74 75 72 6e 20 63 6f 64 65 2c 20 he return code,
11900 74 68 65 20 65 72 72 6f 72 0d 0a 20 20 20 20 20 the error..
11910 20 20 20 23 20 20 20 20 20 20 20 63 6f 64 65 20 # code
11920 66 6f 72 20 74 68 65 20 69 6e 74 65 72 70 72 65 for the interpre
11930 74 65 72 2c 20 61 6e 64 20 74 68 65 20 65 72 72 ter, and the err
11940 6f 72 20 6d 65 73 73 61 67 65 20 75 70 20 74 6f or message up to
11950 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 the.. #
11960 20 20 20 20 20 20 70 6f 69 6e 74 20 77 68 65 72 point wher
11970 65 20 74 68 65 20 73 74 61 63 6b 20 74 72 61 63 e the stack trac
11980 65 20 73 68 6f 75 6c 64 20 73 74 61 72 74 2e 0d e should start..
11990 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
119a0 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 return [list
119b0 20 24 63 6f 64 65 20 24 3a 3a 65 72 72 6f 72 43 $code $::errorC
119c0 6f 64 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ode \..
119d0 20 20 20 5b 65 78 74 72 61 63 74 53 79 73 74 65 [extractSyste
119e0 6d 44 61 74 61 53 51 4c 69 74 65 45 78 63 65 70 mDataSQLiteExcep
119f0 74 69 6f 6e 4d 65 73 73 61 67 65 20 24 72 65 73 tionMessage $res
11a00 75 6c 74 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a ult]].. }..
11a10 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
11a20 6f 63 20 63 6f 6d 70 69 6c 65 43 53 68 61 72 70 oc compileCSharp
11a30 57 69 74 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 With {..
11a40 20 20 20 20 74 65 78 74 20 6d 65 6d 6f 72 79 20 text memory
11a50 73 79 6d 62 6f 6c 73 20 73 74 72 69 63 74 20 72 symbols strict r
11a60 65 73 75 6c 74 73 56 61 72 4e 61 6d 65 20 65 72 esultsVarName er
11a70 72 6f 72 73 56 61 72 4e 61 6d 65 20 66 69 6c 65 rorsVarName file
11a80 4e 61 6d 65 73 0d 0a 20 20 20 20 20 20 20 20 20 Names..
11a90 20 20 20 61 72 67 73 20 7d 20 7b 0d 0a 20 20 20 args } {..
11aa0 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
11ab0 54 45 3a 20 53 69 6e 63 65 20 77 65 20 61 72 65 TE: Since we are
11ac0 20 67 6f 69 6e 67 20 74 6f 20 75 73 65 20 74 68 going to use th
11ad0 69 73 20 6d 65 74 68 6f 64 20 6e 61 6d 65 20 61 is method name a
11ae0 20 6c 6f 74 2c 20 61 73 73 69 67 6e 20 69 74 20 lot, assign it
11af0 74 6f 20 61 0d 0a 20 20 20 20 20 20 23 20 20 20 to a.. #
11b00 20 20 20 20 76 61 72 69 61 62 6c 65 20 66 69 72 variable fir
11b10 73 74 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 st... #..
11b20 20 20 20 20 73 65 74 20 61 64 64 20 52 65 66 65 set add Refe
11b30 72 65 6e 63 65 64 41 73 73 65 6d 62 6c 69 65 73 rencedAssemblies
11b40 2e 41 64 64 0d 0a 0d 0a 20 20 20 20 20 20 23 0d .Add.... #.
11b50 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 . # NOTE: C
11b60 72 65 61 74 65 20 74 68 65 20 62 61 73 65 20 63 reate the base c
11b70 6f 6d 6d 61 6e 64 20 74 6f 20 65 76 61 6c 75 61 ommand to evalua
11b80 74 65 20 61 6e 64 20 61 64 64 20 74 68 65 20 70 te and add the p
11b90 72 6f 70 65 72 74 79 20 73 65 74 74 69 6e 67 73 roperty settings
11ba0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
11bb0 74 68 61 74 20 61 72 65 20 61 6c 6d 6f 73 74 20 that are almost
11bc0 61 6c 77 61 79 73 20 6e 65 65 64 65 64 20 62 79 always needed by
11bd0 20 6f 75 72 20 75 6e 69 74 20 74 65 73 74 73 20 our unit tests
11be0 28 69 2e 65 2e 20 74 68 65 20 53 79 73 74 65 6d (i.e. the System
11bf0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
11c00 61 6e 64 20 53 79 73 74 65 6d 2e 44 61 74 61 20 and System.Data
11c10 61 73 73 65 6d 62 6c 79 20 72 65 66 65 72 65 6e assembly referen
11c20 63 65 73 29 2e 0d 0a 20 20 20 20 20 20 23 0d 0a ces)... #..
11c30 20 20 20 20 20 20 73 65 74 20 63 6f 6d 6d 61 6e set comman
11c40 64 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 d [list \..
11c50 20 20 20 20 20 63 6f 6d 70 69 6c 65 43 53 68 61 compileCSha
11c60 72 70 20 24 74 65 78 74 20 24 6d 65 6d 6f 72 79 rp $text $memory
11c70 20 24 73 79 6d 62 6f 6c 73 20 24 73 74 72 69 63 $symbols $stric
11c80 74 20 72 65 73 75 6c 74 73 20 65 72 72 6f 72 73 t results errors
11c90 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 24 61 \.. $a
11ca0 64 64 20 53 79 73 74 65 6d 2e 64 6c 6c 20 24 61 dd System.dll $a
11cb0 64 64 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 64 dd System.Data.d
11cc0 6c 6c 20 24 61 64 64 20 53 79 73 74 65 6d 2e 54 ll $add System.T
11cd0 72 61 6e 73 61 63 74 69 6f 6e 73 2e 64 6c 6c 20 ransactions.dll
11ce0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 24 61 64 \.. $ad
11cf0 64 20 53 79 73 74 65 6d 2e 58 6d 6c 2e 64 6c 6c d System.Xml.dll
11d00 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ].... #..
11d10 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 # NOTE: Add
11d20 61 6c 6c 20 74 68 65 20 70 72 6f 76 69 64 65 64 all the provided
11d30 20 66 69 6c 65 20 6e 61 6d 65 73 20 61 73 20 61 file names as a
11d40 73 73 65 6d 62 6c 79 20 72 65 66 65 72 65 6e 63 ssembly referenc
11d50 65 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 es... #..
11d60 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
11d70 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 73 20 Name $fileNames
11d80 7b 0d 0a 20 20 20 20 20 20 20 20 6c 61 70 70 65 {.. lappe
11d90 6e 64 20 63 6f 6d 6d 61 6e 64 20 24 61 64 64 20 nd command $add
11da0 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 [getBinaryFileNa
11db0 6d 65 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 me $fileName]..
11dc0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
11dd0 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
11de0 20 41 64 64 20 74 68 65 20 65 78 74 72 61 20 61 Add the extra a
11df0 72 67 75 6d 65 6e 74 73 2c 20 69 66 20 61 6e 79 rguments, if any
11e00 2c 20 74 6f 20 74 68 65 20 63 6f 6d 6d 61 6e 64 , to the command
11e10 20 74 6f 20 65 76 61 6c 75 61 74 65 2e 0d 0a 20 to evaluate...
11e20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 65 76 #.. ev
11e30 61 6c 20 6c 61 70 70 65 6e 64 20 63 6f 6d 6d 61 al lappend comma
11e40 6e 64 20 24 61 72 67 73 0d 0a 0d 0a 20 20 20 20 nd $args....
11e50 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
11e60 45 3a 20 41 6c 69 61 73 20 74 68 65 20 63 6f 6d E: Alias the com
11e70 70 69 6c 65 72 20 6c 6f 63 61 6c 20 72 65 73 75 piler local resu
11e80 6c 74 73 20 61 6e 64 20 65 72 72 6f 72 73 20 76 lts and errors v
11e90 61 72 69 61 62 6c 65 73 20 74 6f 20 74 68 65 0d ariables to the.
11ea0 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 . # v
11eb0 61 72 69 61 62 6c 65 20 6e 61 6d 65 73 20 70 72 ariable names pr
11ec0 6f 76 69 64 65 64 20 62 79 20 6f 75 72 20 63 61 ovided by our ca
11ed0 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a ller... #..
11ee0 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
11ef0 67 20 6c 65 6e 67 74 68 20 24 72 65 73 75 6c 74 g length $result
11f00 73 56 61 72 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 sVarName] > 0} t
11f10 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 75 hen {.. u
11f20 70 76 61 72 20 31 20 24 72 65 73 75 6c 74 73 56 pvar 1 $resultsV
11f30 61 72 4e 61 6d 65 20 72 65 73 75 6c 74 73 0d 0a arName results..
11f40 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
11f50 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
11f60 67 74 68 20 24 65 72 72 6f 72 73 56 61 72 4e 61 gth $errorsVarNa
11f70 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d me] > 0} then {.
11f80 0a 20 20 20 20 20 20 20 20 75 70 76 61 72 20 31 . upvar 1
11f90 20 24 65 72 72 6f 72 73 56 61 72 4e 61 6d 65 20 $errorsVarName
11fa0 65 72 72 6f 72 73 0d 0a 20 20 20 20 20 20 7d 0d errors.. }.
11fb0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
11fc0 20 20 23 20 4e 4f 54 45 3a 20 45 76 61 6c 75 61 # NOTE: Evalua
11fd0 74 65 20 74 68 65 20 63 6f 6e 73 74 72 75 63 74 te the construct
11fe0 65 64 20 5b 63 6f 6d 70 69 6c 65 43 53 68 61 72 ed [compileCShar
11ff0 70 5d 20 63 6f 6d 6d 61 6e 64 20 61 6e 64 20 72 p] command and r
12000 65 74 75 72 6e 20 74 68 65 0d 0a 20 20 20 20 20 eturn the..
12010 20 23 20 20 20 20 20 20 20 72 65 73 75 6c 74 2e # result.
12020 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
12030 20 65 76 61 6c 20 24 63 6f 6d 6d 61 6e 64 0d 0a eval $command..
12040 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
12050 6f 63 20 69 73 4d 65 6d 6f 72 79 44 62 20 7b 20 oc isMemoryDb {
12060 66 69 6c 65 4e 61 6d 65 20 7d 20 7b 0d 0a 20 20 fileName } {..
12070 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
12080 4f 54 45 3a 20 49 73 20 74 68 65 20 73 70 65 63 OTE: Is the spec
12090 69 66 69 65 64 20 64 61 74 61 62 61 73 65 20 66 ified database f
120a0 69 6c 65 20 6e 61 6d 65 20 72 65 61 6c 6c 79 20 ile name really
120b0 61 6e 20 69 6e 2d 6d 65 6d 6f 72 79 20 64 61 74 an in-memory dat
120c0 61 62 61 73 65 3f 0d 0a 20 20 20 20 20 20 23 0d abase?.. #.
120d0 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 65 . return [e
120e0 78 70 72 20 7b 24 66 69 6c 65 4e 61 6d 65 20 65 xpr {$fileName e
120f0 71 20 22 3a 6d 65 6d 6f 72 79 3a 22 20 7c 7c 20 q ":memory:" ||
12100 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 \.. [st
12110 72 69 6e 67 20 72 61 6e 67 65 20 24 66 69 6c 65 ring range $file
12120 4e 61 6d 65 20 30 20 31 32 5d 20 65 71 20 22 66 Name 0 12] eq "f
12130 69 6c 65 3a 3a 6d 65 6d 6f 72 79 3a 22 7d 5d 0d ile::memory:"}].
12140 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
12150 72 6f 63 20 69 73 54 61 62 6c 65 49 6e 44 62 20 roc isTableInDb
12160 7b 20 6e 61 6d 65 20 7b 76 61 72 4e 61 6d 65 20 { name {varName
12170 64 62 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 db} } {.. #
12180 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
12190 52 65 66 65 72 20 74 6f 20 74 68 65 20 73 70 65 Refer to the spe
121a0 63 69 66 69 65 64 20 76 61 72 69 61 62 6c 65 20 cified variable
121b0 28 65 2e 67 2e 20 22 64 62 22 29 20 69 6e 20 74 (e.g. "db") in t
121c0 68 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 he context of ou
121d0 72 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 r.. #
121e0 20 63 61 6c 6c 65 72 2e 20 20 49 74 20 63 6f 6e caller. It con
121f0 74 61 69 6e 73 20 74 68 65 20 64 61 74 61 62 61 tains the databa
12200 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 68 61 se connection ha
12210 6e 64 6c 65 20 74 68 61 74 20 77 69 6c 6c 20 62 ndle that will b
12220 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
12230 20 75 73 65 64 20 74 6f 20 65 78 65 63 75 74 65 used to execute
12240 20 74 68 65 20 71 75 65 72 79 20 75 73 65 64 20 the query used
12250 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 69 66 20 to determine if
12260 74 68 65 20 6e 61 6d 65 64 20 74 61 62 6c 65 20 the named table
12270 69 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 is.. #
12280 20 20 70 72 65 73 65 6e 74 20 69 6e 20 74 68 61 present in tha
12290 74 20 64 61 74 61 62 61 73 65 2e 0d 0a 20 20 20 t database...
122a0 20 20 20 23 0d 0a 20 20 20 20 20 20 75 70 76 61 #.. upva
122b0 72 20 31 20 24 76 61 72 4e 61 6d 65 20 64 62 0d r 1 $varName db.
122c0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
122d0 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 # NOTE: Use th
122e0 65 20 73 71 6c 69 74 65 5f 6d 61 73 74 65 72 20 e sqlite_master
122f0 74 61 62 6c 65 20 74 6f 20 64 65 74 65 72 6d 69 table to determi
12300 6e 65 20 69 66 20 74 68 65 20 6e 61 6d 65 64 20 ne if the named
12310 74 61 62 6c 65 20 69 73 0d 0a 20 20 20 20 20 20 table is..
12320 23 20 20 20 20 20 20 20 70 72 65 73 65 6e 74 20 # present
12330 69 6e 20 74 68 65 20 64 61 74 61 62 61 73 65 2e in the database.
12340 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
12350 20 73 65 74 20 73 71 6c 20 7b 0d 0a 20 20 20 20 set sql {..
12360 20 20 20 20 53 45 4c 45 43 54 20 43 4f 55 4e 54 SELECT COUNT
12370 28 2a 29 20 46 52 4f 4d 20 73 71 6c 69 74 65 5f (*) FROM sqlite_
12380 6d 61 73 74 65 72 20 57 48 45 52 45 20 74 79 70 master WHERE typ
12390 65 20 3d 20 27 74 61 62 6c 65 27 20 41 4e 44 20 e = 'table' AND
123a0 6e 61 6d 65 20 3d 20 3f 3b 0d 0a 20 20 20 20 20 name = ?;..
123b0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
123c0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 # NOTE: Ret
123d0 75 72 6e 20 6e 6f 6e 2d 7a 65 72 6f 20 69 66 20 urn non-zero if
123e0 74 68 65 20 6e 61 6d 65 64 20 74 61 62 6c 65 20 the named table
123f0 69 73 20 70 72 65 73 65 6e 74 2e 0d 0a 20 20 20 is present...
12400 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 #.. retu
12410 72 6e 20 5b 65 78 70 72 20 7b 0d 0a 20 20 20 20 rn [expr {..
12420 20 20 20 20 5b 73 71 6c 20 65 78 65 63 75 74 65 [sql execute
12430 20 2d 65 78 65 63 75 74 65 20 73 63 61 6c 61 72 -execute scalar
12440 20 24 64 62 20 24 73 71 6c 20 5b 6c 69 73 74 20 $db $sql [list
12450 70 61 72 61 6d 31 20 53 74 72 69 6e 67 20 24 6e param1 String $n
12460 61 6d 65 5d 5d 20 3e 20 30 0d 0a 20 20 20 20 20 ame]] > 0..
12470 20 7d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }].. }.....
12480 20 20 20 70 72 6f 63 20 67 65 74 44 62 44 65 66 proc getDbDef
12490 61 75 6c 74 50 61 67 65 53 69 7a 65 20 7b 7d 20 aultPageSize {}
124a0 7b 0d 0a 20 20 20 20 20 20 74 72 79 20 7b 0d 0a {.. try {..
124b0 20 20 20 20 20 20 20 20 73 65 74 20 64 62 20 5b set db [
124c0 73 71 6c 20 6f 70 65 6e 20 2d 74 79 70 65 20 53 sql open -type S
124d0 51 4c 69 74 65 20 7b 44 61 74 61 20 53 6f 75 72 QLite {Data Sour
124e0 63 65 3d 3a 6d 65 6d 6f 72 79 3a 3b 7d 5d 0d 0a ce=:memory:;}]..
124f0 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b return [
12500 73 71 6c 20 65 78 65 63 75 74 65 20 2d 65 78 65 sql execute -exe
12510 63 75 74 65 20 73 63 61 6c 61 72 20 24 64 62 20 cute scalar $db
12520 22 50 52 41 47 4d 41 20 70 61 67 65 5f 73 69 7a "PRAGMA page_siz
12530 65 3b 22 5d 0d 0a 20 20 20 20 20 20 7d 20 66 69 e;"].. } fi
12540 6e 61 6c 6c 79 20 7b 0d 0a 20 20 20 20 20 20 20 nally {..
12550 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
12560 73 20 64 62 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 s db]} then {..
12570 20 20 20 20 20 20 20 20 20 63 61 74 63 68 20 7b catch {
12580 73 71 6c 20 63 6c 6f 73 65 20 24 64 62 7d 0d 0a sql close $db}..
12590 20 20 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 unset
125a0 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 64 62 0d 0a -nocomplain db..
125b0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
125c0 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
125d0 20 20 70 72 6f 63 20 67 65 74 44 62 44 65 66 61 proc getDbDefa
125e0 75 6c 74 43 61 63 68 65 53 69 7a 65 20 7b 7d 20 ultCacheSize {}
125f0 7b 0d 0a 20 20 20 20 20 20 74 72 79 20 7b 0d 0a {.. try {..
12600 20 20 20 20 20 20 20 20 73 65 74 20 64 62 20 5b set db [
12610 73 71 6c 20 6f 70 65 6e 20 2d 74 79 70 65 20 53 sql open -type S
12620 51 4c 69 74 65 20 7b 44 61 74 61 20 53 6f 75 72 QLite {Data Sour
12630 63 65 3d 3a 6d 65 6d 6f 72 79 3a 3b 7d 5d 0d 0a ce=:memory:;}]..
12640 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b return [
12650 73 71 6c 20 65 78 65 63 75 74 65 20 2d 65 78 65 sql execute -exe
12660 63 75 74 65 20 73 63 61 6c 61 72 20 24 64 62 20 cute scalar $db
12670 22 50 52 41 47 4d 41 20 63 61 63 68 65 5f 73 69 "PRAGMA cache_si
12680 7a 65 3b 22 5d 0d 0a 20 20 20 20 20 20 7d 20 66 ze;"].. } f
12690 69 6e 61 6c 6c 79 20 7b 0d 0a 20 20 20 20 20 20 inally {..
126a0 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
126b0 74 73 20 64 62 5d 7d 20 74 68 65 6e 20 7b 0d 0a ts db]} then {..
126c0 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 20 catch
126d0 7b 73 71 6c 20 63 6c 6f 73 65 20 24 64 62 7d 0d {sql close $db}.
126e0 0a 20 20 20 20 20 20 20 20 20 20 75 6e 73 65 74 . unset
126f0 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 64 62 0d -nocomplain db.
12700 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
12710 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
12720 20 20 20 70 72 6f 63 20 75 73 65 4c 65 67 61 63 proc useLegac
12730 79 44 62 50 61 67 65 41 6e 64 43 61 63 68 65 53 yDbPageAndCacheS
12740 69 7a 65 73 20 7b 20 76 61 72 4e 61 6d 65 20 7d izes { varName }
12750 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
12760 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 # NOTE: Refer
12770 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 to the specifie
12780 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e d variable (e.g.
12790 20 22 64 62 22 29 20 69 6e 20 74 68 65 20 63 6f "db") in the co
127a0 6e 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a 20 20 ntext of our..
127b0 20 20 20 20 23 20 20 20 20 20 20 20 63 61 6c 6c # call
127c0 65 72 2e 20 20 49 74 20 63 6f 6e 74 61 69 6e 73 er. It contains
127d0 20 74 68 65 20 64 61 74 61 62 61 73 65 20 63 6f the database co
127e0 6e 6e 65 63 74 69 6f 6e 20 68 61 6e 64 6c 65 20 nnection handle
127f0 74 68 61 74 20 77 69 6c 6c 20 62 65 0d 0a 20 20 that will be..
12800 20 20 20 20 23 20 20 20 20 20 20 20 75 73 65 64 # used
12810 20 74 6f 20 65 78 65 63 75 74 65 20 71 75 65 72 to execute quer
12820 69 65 73 20 75 73 65 64 20 74 6f 20 73 65 74 20 ies used to set
12830 74 68 65 20 70 61 67 65 20 61 6e 64 20 63 61 63 the page and cac
12840 68 65 20 73 69 7a 65 73 2e 0d 0a 20 20 20 20 20 he sizes...
12850 20 23 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 #.. upvar
12860 31 20 24 76 61 72 4e 61 6d 65 20 64 62 0d 0a 0d 1 $varName db...
12870 0a 20 20 20 20 20 20 73 71 6c 20 65 78 65 63 75 . sql execu
12880 74 65 20 24 64 62 20 7b 0d 0a 20 20 20 20 20 20 te $db {..
12890 20 20 50 52 41 47 4d 41 20 70 61 67 65 5f 73 69 PRAGMA page_si
128a0 7a 65 20 3d 20 31 30 32 34 3b 0d 0a 20 20 20 20 ze = 1024;..
128b0 20 20 20 20 50 52 41 47 4d 41 20 63 61 63 68 65 PRAGMA cache
128c0 5f 73 69 7a 65 20 3d 20 32 30 30 30 3b 0d 0a 20 _size = 2000;..
128d0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
128e0 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 5c 0d 0a return [list \..
128f0 20 20 20 20 20 20 20 20 20 20 5b 73 71 6c 20 65 [sql e
12900 78 65 63 75 74 65 20 2d 65 78 65 63 75 74 65 20 xecute -execute
12910 73 63 61 6c 61 72 20 24 64 62 20 22 50 52 41 47 scalar $db "PRAG
12920 4d 41 20 70 61 67 65 5f 73 69 7a 65 3b 22 5d 20 MA page_size;"]
12930 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 71 \.. [sq
12940 6c 20 65 78 65 63 75 74 65 20 2d 65 78 65 63 75 l execute -execu
12950 74 65 20 73 63 61 6c 61 72 20 24 64 62 20 22 50 te scalar $db "P
12960 52 41 47 4d 41 20 63 61 63 68 65 5f 73 69 7a 65 RAGMA cache_size
12970 3b 22 5d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a ;"]].. }.....
12980 20 20 20 20 70 72 6f 63 20 65 78 74 72 61 63 74 proc extract
12990 53 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 SystemDataSQLite
129a0 45 78 63 65 70 74 69 6f 6e 4d 65 73 73 61 67 65 ExceptionMessage
129b0 20 7b 20 76 61 6c 75 65 20 7d 20 7b 0d 0a 20 20 { value } {..
129c0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
129d0 4f 54 45 3a 20 49 66 20 74 68 65 20 73 74 72 69 OTE: If the stri
129e0 6e 67 20 63 6f 6e 66 6f 72 6d 73 20 74 6f 20 66 ng conforms to f
129f0 6f 72 6d 61 74 20 6f 66 20 74 68 65 20 6e 6f 72 ormat of the nor
12a00 6d 61 6c 20 65 78 63 65 70 74 69 6f 6e 0d 0a 20 mal exception..
12a10 20 20 20 20 20 23 20 20 20 20 20 20 20 65 72 72 # err
12a20 6f 72 20 73 74 72 69 6e 67 73 2c 20 65 78 74 72 or strings, extr
12a30 61 63 74 20 61 6e 64 20 72 65 74 75 72 6e 20 6f act and return o
12a40 6e 6c 79 20 74 68 65 20 65 72 72 6f 72 20 6d 65 nly the error me
12a50 73 73 61 67 65 0d 0a 20 20 20 20 20 20 23 20 20 ssage.. #
12a60 20 20 20 20 20 70 6f 72 74 69 6f 6e 20 69 74 73 portion its
12a70 65 6c 66 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 elf... #..
12a80 20 20 20 20 20 73 65 74 20 70 61 74 74 65 72 6e set pattern
12a90 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 s [list \..
12aa0 20 7b 53 79 73 74 65 6d 5c 2e 44 61 74 61 5c 2e {System\.Data\.
12ab0 53 51 4c 69 74 65 5c 2e 53 51 4c 69 74 65 45 78 SQLite\.SQLiteEx
12ac0 63 65 70 74 69 6f 6e 20 5c 28 30 78 38 30 30 30 ception \(0x8000
12ad0 34 30 30 35 5c 29 3a 20 28 2e 2b 3f 29 20 20 28 4005\): (.+?) (
12ae0 3f 3a 20 29 3f 61 74 7d 20 5c 0d 0a 20 20 20 20 ?: )?at} \..
12af0 20 20 7b 53 79 73 74 65 6d 5c 2e 44 61 74 61 5c {System\.Data\
12b00 2e 53 51 4c 69 74 65 5c 2e 53 51 4c 69 74 65 45 .SQLite\.SQLiteE
12b10 78 63 65 70 74 69 6f 6e 3a 20 28 2e 2b 3f 29 20 xception: (.+?)
12b20 20 28 3f 3a 20 29 3f 61 74 7d 20 5c 0d 0a 20 20 (?: )?at} \..
12b30 20 20 20 20 7b 45 61 67 6c 65 5c 2e 5f 43 6f 6d {Eagle\._Com
12b40 70 6f 6e 65 6e 74 73 5c 2e 50 75 62 6c 69 63 5c ponents\.Public\
12b50 2e 53 63 72 69 70 74 45 78 63 65 70 74 69 6f 6e .ScriptException
12b60 3a 20 28 2e 2b 3f 29 20 20 28 3f 3a 20 29 3f 61 : (.+?) (?: )?a
12b70 74 7d 5d 0d 0a 0d 0a 20 20 20 20 20 20 66 6f 72 t}].... for
12b80 65 61 63 68 20 70 61 74 74 65 72 6e 20 24 70 61 each pattern $pa
12b90 74 74 65 72 6e 73 20 7b 0d 0a 20 20 20 20 20 20 tterns {..
12ba0 20 20 69 66 20 7b 5b 72 65 67 65 78 70 20 2d 2d if {[regexp --
12bb0 20 24 70 61 74 74 65 72 6e 20 24 76 61 6c 75 65 $pattern $value
12bc0 20 64 75 6d 6d 79 20 6d 65 73 73 61 67 65 5d 7d dummy message]}
12bd0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
12be0 20 20 20 73 65 74 20 6d 65 73 73 61 67 65 20 5b set message [
12bf0 73 74 72 69 6e 67 20 6d 61 70 20 5b 6c 69 73 74 string map [list
12c00 20 5c 72 5c 6e 20 5c 6e 5d 20 5b 73 74 72 69 6e \r\n \n] [strin
12c10 67 20 74 72 69 6d 20 24 6d 65 73 73 61 67 65 5d g trim $message]
12c20 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 ].. set
12c30 20 6c 69 6e 65 73 20 5b 73 70 6c 69 74 20 24 6d lines [split $m
12c40 65 73 73 61 67 65 20 5c 6e 5d 0d 0a 0d 0a 20 20 essage \n]....
12c50 20 20 20 20 20 20 20 20 69 66 20 7b 5b 6c 6c 65 if {[lle
12c60 6e 67 74 68 20 24 6c 69 6e 65 73 5d 20 3d 3d 20 ngth $lines] ==
12c70 32 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 2} then {..
12c80 20 20 20 20 20 20 20 69 66 20 7b 5b 6c 69 6e 64 if {[lind
12c90 65 78 20 24 6c 69 6e 65 73 20 30 5d 20 65 71 20 ex $lines 0] eq
12ca0 5b 6c 69 6e 64 65 78 20 24 6c 69 6e 65 73 20 31 [lindex $lines 1
12cb0 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
12cc0 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
12cd0 5b 6c 69 6e 64 65 78 20 24 6c 69 6e 65 73 20 30 [lindex $lines 0
12ce0 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
12cf0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
12d00 72 65 74 75 72 6e 20 5b 61 70 70 65 6e 64 41 72 return [appendAr
12d10 67 73 20 5b 6c 69 6e 64 65 78 20 24 6c 69 6e 65 gs [lindex $line
12d20 73 20 30 5d 20 22 20 2d 2d 20 22 20 5b 6c 69 6e s 0] " -- " [lin
12d30 64 65 78 20 24 6c 69 6e 65 73 20 31 5d 5d 0d 0a dex $lines 1]]..
12d40 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
12d50 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
12d60 24 6d 65 73 73 61 67 65 0d 0a 20 20 20 20 20 20 $message..
12d70 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
12d80 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 76 61 return $va
12d90 6c 75 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 lue.. }.....
12da0 20 20 20 70 72 6f 63 20 74 72 69 6d 53 71 6c 20 proc trimSql
12db0 7b 20 73 71 6c 20 7d 20 7b 0d 0a 20 20 20 20 20 { sql } {..
12dc0 20 72 65 74 75 72 6e 20 5b 72 65 67 73 75 62 20 return [regsub
12dd0 2d 61 6c 6c 20 2d 2d 20 7b 5c 73 2b 7d 20 5b 73 -all -- {\s+} [s
12de0 74 72 69 6e 67 20 74 72 69 6d 20 24 73 71 6c 5d tring trim $sql]
12df0 20 22 20 22 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d " "].. }....
12e00 0a 20 20 20 20 70 72 6f 63 20 65 78 65 63 75 74 . proc execut
12e10 65 53 71 6c 20 7b 20 73 71 6c 20 7b 65 78 65 63 eSql { sql {exec
12e20 75 74 65 20 6e 6f 6e 65 7d 20 7b 66 6f 72 6d 61 ute none} {forma
12e30 74 20 6e 6f 6e 65 7d 20 7b 66 69 6c 65 4e 61 6d t none} {fileNam
12e40 65 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 e ""} } {..
12e50 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
12e60 67 74 68 20 24 66 69 6c 65 4e 61 6d 65 5d 20 3d gth $fileName] =
12e70 3d 20 30 7d 20 74 68 65 6e 20 7b 73 65 74 20 66 = 0} then {set f
12e80 69 6c 65 4e 61 6d 65 20 3a 6d 65 6d 6f 72 79 3a ileName :memory:
12e90 7d 0d 0a 20 20 20 20 20 20 73 65 74 75 70 44 62 }.. setupDb
12ea0 20 24 66 69 6c 65 4e 61 6d 65 20 22 22 20 22 22 $fileName "" ""
12eb0 20 22 22 20 22 22 20 22 22 20 66 61 6c 73 65 20 "" "" "" false
12ec0 66 61 6c 73 65 20 66 61 6c 73 65 20 66 61 6c 73 false false fals
12ed0 65 20 64 62 20 74 72 75 65 0d 0a 0d 0a 20 20 20 e db true....
12ee0 20 20 20 74 72 79 20 7b 0d 0a 20 20 20 20 20 20 try {..
12ef0 20 20 72 65 74 75 72 6e 20 5b 75 70 6c 65 76 65 return [upleve
12f00 6c 20 31 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 l 1 [list \..
12f10 20 20 20 20 20 20 20 20 20 73 71 6c 20 65 78 65 sql exe
12f20 63 75 74 65 20 2d 65 78 65 63 75 74 65 20 24 65 cute -execute $e
12f30 78 65 63 75 74 65 20 2d 66 6f 72 6d 61 74 20 24 xecute -format $
12f40 66 6f 72 6d 61 74 20 24 64 62 20 24 73 71 6c 5d format $db $sql]
12f50 5d 0d 0a 20 20 20 20 20 20 7d 20 66 69 6e 61 6c ].. } final
12f60 6c 79 20 7b 0d 0a 20 20 20 20 20 20 20 20 63 6c ly {.. cl
12f70 65 61 6e 75 70 44 62 20 24 66 69 6c 65 4e 61 6d eanupDb $fileNam
12f80 65 20 64 62 20 66 61 6c 73 65 20 66 61 6c 73 65 e db false false
12f90 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 7d 0d false.. }.
12fa0 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
12fb0 72 6f 63 20 68 61 73 4e 6f 46 6c 61 67 73 20 7b roc hasNoFlags {
12fc0 20 76 61 72 4e 61 6d 65 20 6e 6f 6e 65 20 7d 20 varName none }
12fd0 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 {.. upvar 1
12fe0 20 24 76 61 72 4e 61 6d 65 20 66 6c 61 67 73 0d $varName flags.
12ff0 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 69 ... if {![i
13000 6e 66 6f 20 65 78 69 73 74 73 20 66 6c 61 67 73 nfo exists flags
13010 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
13020 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a return true..
13030 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
13040 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
13050 67 74 68 20 24 66 6c 61 67 73 5d 20 3d 3d 20 30 gth $flags] == 0
13060 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
13070 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 return true..
13080 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
13090 69 66 20 7b 24 6e 6f 6e 65 20 26 26 20 24 66 6c if {$none && $fl
130a0 61 67 73 20 65 71 20 22 4e 6f 6e 65 22 7d 20 74 ags eq "None"} t
130b0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 hen {.. r
130c0 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 eturn true..
130d0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 }.... ret
130e0 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 7d urn false.. }
130f0 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
13100 74 43 6f 6e 6e 65 63 74 69 6f 6e 46 6c 61 67 73 tConnectionFlags
13110 20 7b 20 66 69 6c 65 4e 61 6d 65 20 66 6c 61 67 { fileName flag
13120 73 20 7b 71 75 69 65 74 20 66 61 6c 73 65 7d 20 s {quiet false}
13130 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
13140 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 67 75 # NOTE: Figu
13150 72 65 20 6f 75 74 20 77 68 69 63 68 20 64 61 74 re out which dat
13160 61 62 61 73 65 20 66 69 6c 65 20 6e 61 6d 65 20 abase file name
13170 6f 72 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 or connection st
13180 72 69 6e 67 20 74 68 65 73 65 0d 0a 20 20 20 20 ring these..
13190 20 20 23 20 20 20 20 20 20 20 63 6f 6e 6e 65 63 # connec
131a0 74 69 6f 6e 20 66 6c 61 67 73 20 77 69 6c 6c 20 tion flags will
131b0 61 63 74 75 61 6c 6c 79 20 61 70 70 6c 79 20 74 actually apply t
131c0 6f 2e 20 20 54 68 69 73 20 69 73 20 6e 6f 74 20 o. This is not
131d0 6e 65 63 65 73 73 61 72 79 0d 0a 20 20 20 20 20 necessary..
131e0 20 23 20 20 20 20 20 20 20 69 6e 20 71 75 69 65 # in quie
131f0 74 20 6d 6f 64 65 20 62 65 63 61 75 73 65 20 74 t mode because t
13200 68 69 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 his information
13210 69 73 20 6f 6e 6c 79 20 75 73 65 64 20 66 6f 72 is only used for
13220 20 6c 6f 67 67 69 6e 67 0d 0a 20 20 20 20 20 20 logging..
13230 23 20 20 20 20 20 20 20 61 6e 64 20 72 65 70 6f # and repo
13240 72 74 69 6e 67 20 70 75 72 70 6f 73 65 73 2e 0d rting purposes..
13250 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
13260 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
13270 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
13280 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
13290 24 66 69 6c 65 4e 61 6d 65 5d 20 3e 20 30 7d 20 $fileName] > 0}
132a0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
132b0 20 20 73 65 74 20 64 61 74 61 62 61 73 65 20 5b set database [
132c0 61 70 70 65 6e 64 41 72 67 73 20 22 66 69 6c 65 appendArgs "file
132d0 20 6e 61 6d 65 20 5c 22 22 20 24 66 69 6c 65 4e name \"" $fileN
132e0 61 6d 65 20 5c 22 5d 0d 0a 20 20 20 20 20 20 20 ame \"]..
132f0 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 6f } elseif {[info
13300 20 65 78 69 73 74 73 20 3a 3a 64 61 74 61 53 6f exists ::dataSo
13310 75 72 63 65 5d 20 26 26 20 5c 0d 0a 20 20 20 20 urce] && \..
13320 20 20 20 20 20 20 20 20 21 5b 61 72 72 61 79 20 ![array
13330 65 78 69 73 74 73 20 3a 3a 64 61 74 61 53 6f 75 exists ::dataSou
13340 72 63 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 rce]} then {..
13350 20 20 20 20 20 20 20 20 73 65 74 20 64 61 74 61 set data
13360 62 61 73 65 20 5b 61 70 70 65 6e 64 41 72 67 73 base [appendArgs
13370 20 22 64 61 74 61 20 73 6f 75 72 63 65 20 5c 22 "data source \"
13380 22 20 24 3a 3a 64 61 74 61 53 6f 75 72 63 65 20 " $::dataSource
13390 5c 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 \"].. } e
133a0 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
133b0 20 73 65 74 20 64 61 74 61 62 61 73 65 20 3c 75 set database <u
133c0 6e 6b 6e 6f 77 6e 3e 0d 0a 20 20 20 20 20 20 20 nknown>..
133d0 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }.. }....
133e0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
133f0 4e 4f 54 45 3a 20 45 76 65 6e 20 74 68 6f 75 67 NOTE: Even thoug
13400 68 20 74 68 65 72 65 20 69 73 20 6f 6e 6c 79 20 h there is only
13410 6f 6e 65 20 73 6f 75 72 63 65 20 6f 66 20 66 6c one source of fl
13420 61 67 73 20 73 6f 20 66 61 72 2c 20 74 68 65 79 ags so far, they
13430 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
13440 6d 75 73 74 20 62 65 20 63 6f 6d 62 69 6e 65 64 must be combined
13450 20 75 73 69 6e 67 20 74 68 65 20 63 6f 72 72 65 using the corre
13460 63 74 20 73 79 6e 74 61 78 20 66 6f 72 20 65 6e ct syntax for en
13470 75 6d 65 72 61 74 65 64 0d 0a 20 20 20 20 20 20 umerated..
13480 23 20 20 20 20 20 20 20 66 6c 61 67 20 76 61 6c # flag val
13490 75 65 73 20 66 6f 72 20 74 68 65 20 2e 4e 45 54 ues for the .NET
134a0 20 46 72 61 6d 65 77 6f 72 6b 2e 0d 0a 20 20 20 Framework...
134b0 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 #.. set
134c0 66 6c 61 67 73 20 5b 63 6f 6d 62 69 6e 65 46 6c flags [combineFl
134d0 61 67 73 20 24 66 6c 61 67 73 20 22 22 5d 0d 0a ags $flags ""]..
134e0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
134f0 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 28 61 # NOTE: Show (a
13500 6e 64 20 6c 6f 67 29 20 74 68 65 20 6c 6f 63 61 nd log) the loca
13510 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 l connection fla
13520 67 73 20 61 6e 64 20 74 68 65 20 61 73 73 6f 63 gs and the assoc
13530 69 61 74 65 64 0d 0a 20 20 20 20 20 20 23 20 20 iated.. #
13540 20 20 20 20 20 64 61 74 61 20 73 6f 75 72 63 65 data source
13550 20 6f 72 20 66 69 6c 65 20 6e 61 6d 65 2e 0d 0a or file name...
13560 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
13570 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
13580 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
13590 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
135a0 6e 6f 28 65 6d 69 74 4c 6f 63 61 6c 46 6c 61 67 no(emitLocalFlag
135b0 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 s)] && \..
135c0 20 20 20 20 20 20 28 21 5b 69 6e 66 6f 20 65 78 (![info ex
135d0 69 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 4c 6f ists ::no(emitLo
135e0 63 61 6c 46 6c 61 67 73 49 66 4e 6f 6e 65 29 5d calFlagsIfNone)]
135f0 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 || \..
13600 20 20 20 20 21 5b 68 61 73 4e 6f 46 6c 61 67 73 ![hasNoFlags
13610 20 66 6c 61 67 73 20 66 61 6c 73 65 5d 29 7d 20 flags false])}
13620 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
13630 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
13640 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
13650 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
13660 20 20 20 20 20 22 2d 2d 2d 2d 20 6c 6f 63 61 6c "---- local
13670 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 connection flag
13680 73 20 66 6f 72 20 22 20 24 64 61 74 61 62 61 73 s for " $databas
13690 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
136a0 20 20 20 22 20 61 72 65 3a 20 22 20 5b 65 78 70 " are: " [exp
136b0 72 20 7b 21 5b 68 61 73 4e 6f 46 6c 61 67 73 20 r {![hasNoFlags
136c0 66 6c 61 67 73 20 66 61 6c 73 65 5d 20 3f 20 5c flags false] ? \
136d0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
136e0 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 22 20 24 [appendArgs \" $
136f0 66 6c 61 67 73 20 5c 22 5d 20 3a 20 22 3c 6e 6f flags \"] : "<no
13700 6e 65 3e 22 7d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 ne>"}] \n]..
13710 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
13720 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
13730 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 28 61 # NOTE: Show (a
13740 6e 64 20 6c 6f 67 29 20 74 68 65 20 73 68 61 72 nd log) the shar
13750 65 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c ed connection fl
13760 61 67 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ags... #..
13770 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
13780 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
13790 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
137a0 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
137b0 20 69 6e 76 6f 6b 65 20 53 79 73 74 65 6d 2e 44 invoke System.D
137c0 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 ata.SQLite.SQLit
137d0 65 43 6f 6e 6e 65 63 74 69 6f 6e 20 53 68 61 72 eConnection Shar
137e0 65 64 46 6c 61 67 73 0d 0a 20 20 20 20 20 20 20 edFlags..
137f0 20 7d 20 73 68 61 72 65 64 46 6c 61 67 73 5d 20 } sharedFlags]
13800 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
13810 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
13820 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 fo exists ::no(e
13830 6d 69 74 53 68 61 72 65 64 46 6c 61 67 73 29 5d mitSharedFlags)]
13840 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
13850 20 20 20 20 20 28 21 5b 69 6e 66 6f 20 65 78 69 (![info exi
13860 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 53 68 61 sts ::no(emitSha
13870 72 65 64 46 6c 61 67 73 49 66 4e 6f 6e 65 29 5d redFlagsIfNone)]
13880 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 || \..
13890 20 20 20 20 20 20 21 5b 68 61 73 4e 6f 46 6c 61 ![hasNoFla
138a0 67 73 20 73 68 61 72 65 64 46 6c 61 67 73 20 74 gs sharedFlags t
138b0 72 75 65 5d 29 7d 20 74 68 65 6e 20 7b 0d 0a 20 rue])} then {..
138c0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
138d0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
138e0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
138f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
13900 22 2d 2d 2d 2d 20 73 68 61 72 65 64 20 63 6f 6e "---- shared con
13910 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 66 6f nection flags fo
13920 72 20 22 20 24 64 61 74 61 62 61 73 65 20 5c 0d r " $database \.
13930 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
13940 20 22 20 61 72 65 3a 20 22 20 5b 65 78 70 72 20 " are: " [expr
13950 7b 21 5b 68 61 73 4e 6f 46 6c 61 67 73 20 73 68 {![hasNoFlags sh
13960 61 72 65 64 46 6c 61 67 73 20 74 72 75 65 5d 20 aredFlags true]
13970 3f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ? \..
13980 20 20 20 20 20 5b 61 70 70 65 6e 64 41 72 67 73 [appendArgs
13990 20 5c 22 20 24 73 68 61 72 65 64 46 6c 61 67 73 \" $sharedFlags
139a0 20 5c 22 5d 20 3a 20 22 3c 6e 6f 6e 65 3e 22 7d \"] : "<none>"}
139b0 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 ] \n]..
139c0 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c }.. } el
139d0 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
139e0 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
139f0 73 20 3a 3a 6e 6f 28 65 6d 69 74 53 68 61 72 65 s ::no(emitShare
13a00 64 46 6c 61 67 73 29 5d 20 26 26 20 5c 0d 0a 20 dFlags)] && \..
13a10 20 20 20 20 20 20 20 20 20 20 20 20 20 21 5b 69 ![i
13a20 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
13a30 65 6d 69 74 53 68 61 72 65 64 46 6c 61 67 73 49 emitSharedFlagsI
13a40 66 55 6e 61 76 61 69 6c 61 62 6c 65 29 5d 7d 20 fUnavailable)]}
13a50 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
13a60 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
13a70 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
13a80 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
13a90 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
13aa0 68 61 72 65 64 20 63 6f 6e 6e 65 63 74 69 6f 6e hared connection
13ab0 20 66 6c 61 67 73 20 66 6f 72 20 22 20 24 64 61 flags for " $da
13ac0 74 61 62 61 73 65 20 5c 0d 0a 20 20 20 20 20 20 tabase \..
13ad0 20 20 20 20 20 20 20 20 20 20 22 20 61 72 65 3a " are:
13ae0 20 3c 75 6e 61 76 61 69 6c 61 62 6c 65 3e 5c 6e <unavailable>\n
13af0 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d "].. }.
13b00 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
13b10 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
13b20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 # NOTE: Sh
13b30 6f 77 20 28 61 6e 64 20 6c 6f 67 29 20 74 68 65 ow (and log) the
13b40 20 64 65 74 65 63 74 65 64 20 67 6c 6f 62 61 6c detected global
13b50 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 connection flag
13b60 73 2c 20 69 66 20 61 6e 79 2e 0d 0a 20 20 20 20 s, if any...
13b70 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
13b80 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
13b90 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
13ba0 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 fo exists ::no(e
13bb0 6d 69 74 47 6c 6f 62 61 6c 46 6c 61 67 73 29 5d mitGlobalFlags)]
13bc0 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
13bd0 20 20 20 28 21 5b 69 6e 66 6f 20 65 78 69 73 74 (![info exist
13be0 73 20 3a 3a 6e 6f 28 65 6d 69 74 47 6c 6f 62 61 s ::no(emitGloba
13bf0 6c 46 6c 61 67 73 49 66 4e 6f 6e 65 29 5d 20 7c lFlagsIfNone)] |
13c00 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 | \..
13c10 20 20 21 5b 68 61 73 4e 6f 46 6c 61 67 73 20 3a ![hasNoFlags :
13c20 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 6c 61 67 :connection_flag
13c30 73 20 66 61 6c 73 65 5d 29 7d 20 74 68 65 6e 20 s false])} then
13c40 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 {.. tpu
13c50 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
13c60 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
13c70 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
13c80 22 2d 2d 2d 2d 20 67 6c 6f 62 61 6c 20 63 6f 6e "---- global con
13c90 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 61 72 nection flags ar
13ca0 65 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 e: " \..
13cb0 20 20 20 20 20 20 5b 65 78 70 72 20 7b 21 5b 68 [expr {![h
13cc0 61 73 4e 6f 46 6c 61 67 73 20 3a 3a 63 6f 6e 6e asNoFlags ::conn
13cd0 65 63 74 69 6f 6e 5f 66 6c 61 67 73 20 66 61 6c ection_flags fal
13ce0 73 65 5d 20 3f 20 5c 0d 0a 20 20 20 20 20 20 20 se] ? \..
13cf0 20 20 20 20 20 20 20 5b 61 70 70 65 6e 64 41 72 [appendAr
13d00 67 73 20 5c 22 20 24 3a 3a 63 6f 6e 6e 65 63 74 gs \" $::connect
13d10 69 6f 6e 5f 66 6c 61 67 73 20 5c 22 5d 20 3a 20 ion_flags \"] :
13d20 22 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c 6e 5d 0d 0a "<none>"}] \n]..
13d30 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
13d40 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
13d50 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 # NOTE: If
13d60 74 68 65 72 65 20 61 72 65 20 61 6e 79 20 67 6c there are any gl
13d70 6f 62 61 6c 20 28 70 65 72 20 74 65 73 74 20 72 obal (per test r
13d80 75 6e 29 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 un) connection f
13d90 6c 61 67 73 20 63 75 72 72 65 6e 74 6c 79 0d 0a lags currently..
13da0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 65 # se
13db0 74 2c 20 75 73 65 20 74 68 65 6d 20 6e 6f 77 20 t, use them now
13dc0 28 69 2e 65 2e 20 62 79 20 63 6f 6d 62 69 6e 69 (i.e. by combini
13dd0 6e 67 20 74 68 65 6d 20 77 69 74 68 20 74 68 65 ng them with the
13de0 20 6f 6e 65 73 20 66 6f 72 20 74 68 69 73 0d 0a ones for this..
13df0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
13e00 6e 6e 65 63 74 69 6f 6e 29 2e 0d 0a 20 20 20 20 nnection)...
13e10 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
13e20 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 63 6f info exists ::co
13e30 6e 6e 65 63 74 69 6f 6e 5f 66 6c 61 67 73 5d 7d nnection_flags]}
13e40 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
13e50 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
13e60 54 45 3a 20 43 6f 6d 62 69 6e 65 20 61 6e 64 2f TE: Combine and/
13e70 6f 72 20 72 65 70 6c 61 63 65 20 74 68 65 20 63 or replace the c
13e80 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 onnection flags
13e90 61 6e 64 20 74 68 65 6e 20 73 68 6f 77 20 74 68 and then show th
13ea0 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
13eb0 20 20 20 6e 65 77 20 76 61 6c 75 65 2e 0d 0a 20 new value...
13ec0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
13ed0 20 20 73 65 74 20 66 6c 61 67 73 20 5b 63 6f 6d set flags [com
13ee0 62 69 6e 65 46 6c 61 67 73 20 24 66 6c 61 67 73 bineFlags $flags
13ef0 20 24 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 $::connection_f
13f00 6c 61 67 73 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 lags]....
13f10 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
13f20 54 45 3a 20 53 68 6f 77 20 28 61 6e 64 20 6c 6f TE: Show (and lo
13f30 67 29 20 74 68 65 20 6e 65 77 20 65 66 66 65 63 g) the new effec
13f40 74 69 76 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 tive connection
13f50 66 6c 61 67 73 2e 0d 0a 20 20 20 20 20 20 20 20 flags...
13f60 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
13f70 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
13f80 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
13f90 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
13fa0 28 65 6d 69 74 43 6f 6d 62 69 6e 65 64 46 6c 61 (emitCombinedFla
13fb0 67 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 gs)] && \..
13fc0 20 20 20 20 20 20 20 20 20 28 21 5b 69 6e 66 6f (![info
13fd0 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 exists ::no(emi
13fe0 74 43 6f 6d 62 69 6e 65 64 46 6c 61 67 73 49 66 tCombinedFlagsIf
13ff0 4e 6f 6e 65 29 5d 20 7c 7c 20 5c 0d 0a 20 20 20 None)] || \..
14000 20 20 20 20 20 20 20 20 20 20 20 20 21 5b 68 61 ![ha
14010 73 4e 6f 46 6c 61 67 73 20 66 6c 61 67 73 20 66 sNoFlags flags f
14020 61 6c 73 65 5d 29 7d 20 74 68 65 6e 20 7b 0d 0a alse])} then {..
14030 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
14040 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
14050 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
14060 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
14070 20 22 2d 2d 2d 2d 20 63 6f 6d 62 69 6e 65 64 20 "---- combined
14080 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 connection flags
14090 20 66 6f 72 20 22 20 24 64 61 74 61 62 61 73 65 for " $database
140a0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
140b0 20 20 20 20 22 20 61 72 65 3a 20 22 20 5b 65 78 " are: " [ex
140c0 70 72 20 7b 21 5b 68 61 73 4e 6f 46 6c 61 67 73 pr {![hasNoFlags
140d0 20 66 6c 61 67 73 20 66 61 6c 73 65 5d 20 3f 20 flags false] ?
140e0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
140f0 20 20 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c [appendArgs \
14100 22 20 24 66 6c 61 67 73 20 5c 22 5d 20 3a 20 22 " $flags \"] : "
14110 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c 6e 5d 0d 0a 20 <none>"}] \n]..
14120 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
14130 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
14140 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 .. return $
14150 66 6c 61 67 73 0d 0a 20 20 20 20 7d 0d 0a 0c 0d flags.. }....
14160 0a 20 20 20 20 70 72 6f 63 20 67 65 74 46 6c 61 . proc getFla
14170 67 73 50 72 6f 70 65 72 74 79 20 7b 20 7b 66 6c gsProperty { {fl
14180 61 67 73 20 22 22 7d 20 7b 71 75 69 65 74 20 66 ags ""} {quiet f
14190 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 alse} } {..
141a0 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
141b0 3a 20 44 65 74 65 72 6d 69 6e 65 20 77 68 61 74 : Determine what
141c0 20 74 68 65 20 63 6f 6d 62 69 6e 65 64 20 28 67 the combined (g
141d0 6c 6f 62 61 6c 20 61 6e 64 20 6c 6f 63 61 6c 29 lobal and local)
141e0 20 63 6f 6e 6e 65 63 74 69 6f 6e 0d 0a 20 20 20 connection..
141f0 20 20 20 23 20 20 20 20 20 20 20 66 6c 61 67 73 # flags
14200 20 73 68 6f 75 6c 64 20 62 65 2c 20 70 6f 73 73 should be, poss
14210 69 62 6c 79 20 71 75 69 65 74 6c 79 2e 0d 0a 20 ibly quietly...
14220 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 #.. se
14230 74 20 66 6c 61 67 73 20 5b 67 65 74 43 6f 6e 6e t flags [getConn
14240 65 63 74 69 6f 6e 46 6c 61 67 73 20 22 22 20 24 ectionFlags "" $
14250 66 6c 61 67 73 20 24 71 75 69 65 74 5d 0d 0a 0d flags $quiet]...
14260 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
14270 23 20 4e 4f 54 45 3a 20 49 66 20 6e 6f 20 67 6c # NOTE: If no gl
14280 6f 62 61 6c 20 6f 72 20 6c 6f 63 61 6c 20 63 6f obal or local co
14290 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 77 nnection flags w
142a0 65 72 65 20 73 70 65 63 69 66 69 65 64 2c 20 74 ere specified, t
142b0 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 he.. #
142c0 20 20 64 65 66 61 75 6c 74 20 63 6f 6e 6e 65 63 default connec
142d0 74 69 6f 6e 20 66 6c 61 67 73 20 73 68 6f 75 6c tion flags shoul
142e0 64 20 62 65 20 75 73 65 64 3b 20 74 68 65 72 65 d be used; there
142f0 66 6f 72 65 2c 20 72 65 74 75 72 6e 0d 0a 20 20 fore, return..
14300 20 20 20 20 23 20 20 20 20 20 20 20 61 6e 20 65 # an e
14310 6d 70 74 79 20 73 74 72 69 6e 67 20 69 6e 20 74 mpty string in t
14320 68 61 74 20 63 61 73 65 2e 0d 0a 20 20 20 20 20 hat case...
14330 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 #.. if {[s
14340 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 66 6c tring length $fl
14350 61 67 73 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ags] == 0} then
14360 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 {.. retur
14370 6e 20 22 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d n "".. }...
14380 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
14390 23 20 4e 4f 54 45 3a 20 49 6e 20 6f 72 64 65 72 # NOTE: In order
143a0 20 74 6f 20 63 68 65 63 6b 20 69 66 20 74 68 65 to check if the
143b0 20 64 65 66 61 75 6c 74 20 63 6f 6e 6e 65 63 74 default connect
143c0 69 6f 6e 20 66 6c 61 67 73 20 61 72 65 20 62 65 ion flags are be
143d0 69 6e 67 20 75 73 65 64 0d 0a 20 20 20 20 20 20 ing used..
143e0 23 20 20 20 20 20 20 20 69 74 20 69 73 20 6e 65 # it is ne
143f0 63 65 73 73 61 72 79 20 74 6f 20 61 74 74 65 6d cessary to attem
14400 70 74 20 61 20 63 6f 6e 76 65 72 73 69 6f 6e 20 pt a conversion
14410 74 6f 20 74 68 65 20 61 63 74 75 61 6c 20 65 6e to the actual en
14420 75 6d 65 72 61 74 65 64 0d 0a 20 20 20 20 20 20 umerated..
14430 23 20 20 20 20 20 20 20 74 79 70 65 2e 20 20 46 # type. F
14440 61 69 6c 69 6e 67 20 74 68 61 74 2c 20 74 68 65 ailing that, the
14450 20 63 68 65 63 6b 20 61 67 61 69 6e 73 74 20 74 check against t
14460 68 65 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 he default value
14470 20 77 69 6c 6c 20 62 65 0d 0a 20 20 20 20 20 20 will be..
14480 23 20 20 20 20 20 20 20 73 6b 69 70 70 65 64 2e # skipped.
14490 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
144a0 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
144b0 20 20 20 20 20 20 20 73 65 74 20 65 72 72 6f 72 set error
144c0 20 6e 75 6c 6c 3b 20 23 20 49 47 4e 4f 52 45 44 null; # IGNORED
144d0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 .... obje
144e0 63 74 20 69 6e 76 6f 6b 65 20 55 74 69 6c 69 74 ct invoke Utilit
144f0 79 20 54 72 79 50 61 72 73 65 46 6c 61 67 73 45 y TryParseFlagsE
14500 6e 75 6d 20 22 22 20 5c 0d 0a 20 20 20 20 20 20 num "" \..
14510 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 System.Dat
14520 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 43 a.SQLite.SQLiteC
14530 6f 6e 6e 65 63 74 69 6f 6e 46 6c 61 67 73 20 22 onnectionFlags "
14540 22 20 24 66 6c 61 67 73 20 6e 75 6c 6c 20 74 72 " $flags null tr
14550 75 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ue \..
14560 20 20 74 72 75 65 20 74 72 75 65 20 65 72 72 6f true true erro
14570 72 0d 0a 20 20 20 20 20 20 7d 20 76 61 6c 75 65 r.. } value
14580 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
14590 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
145a0 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 69 6e 67 NOTE: Attempting
145b0 20 74 6f 20 70 61 72 73 65 20 74 68 65 20 63 6f to parse the co
145c0 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 63 nnection flags c
145d0 61 75 73 65 64 20 61 20 73 63 72 69 70 74 0d 0a aused a script..
145e0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
145f0 65 72 72 6f 72 2e 20 20 45 6d 69 74 20 61 20 77 error. Emit a w
14600 61 72 6e 69 6e 67 20 74 6f 20 74 68 65 20 74 65 arning to the te
14610 73 74 20 6c 6f 67 20 66 69 6c 65 20 61 6e 64 20 st log file and
14620 63 6f 6e 74 69 6e 75 65 0d 0a 20 20 20 20 20 20 continue..
14630 20 20 23 20 20 20 20 20 20 20 75 73 69 6e 67 20 # using
14640 61 6e 20 65 6d 74 70 79 20 73 74 72 69 6e 67 20 an emtpy string
14650 69 6e 73 74 65 61 64 2e 0d 0a 20 20 20 20 20 20 instead...
14660 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 6c 6f #.. tlo
14670 67 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d g [appendArgs \.
14680 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d . "==
14690 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c == WARNING: fail
146a0 65 64 20 74 6f 20 70 61 72 73 65 20 63 6f 6e 6e ed to parse conn
146b0 65 63 74 69 6f 6e 20 66 6c 61 67 73 2c 20 65 72 ection flags, er
146c0 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 ror: " \..
146d0 20 20 20 20 20 20 5c 6e 5c 74 20 24 76 61 6c 75 \n\t $valu
146e0 65 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 e \n]....
146f0 20 73 65 74 20 76 61 6c 75 65 20 22 22 0d 0a 20 set value ""..
14700 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
14710 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
14720 20 49 66 20 74 68 65 20 63 6f 6d 62 69 6e 65 64 If the combined
14730 20 66 6c 61 67 73 20 73 74 72 69 6e 67 20 63 6f flags string co
14740 75 6c 64 20 6e 6f 74 20 61 63 74 75 61 6c 6c 79 uld not actually
14750 20 62 65 20 63 6f 6e 76 65 72 74 65 64 0d 0a 20 be converted..
14760 20 20 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 # to
14770 74 68 65 20 65 6e 75 6d 65 72 61 74 65 64 20 74 the enumerated t
14780 79 70 65 20 69 74 20 69 73 20 74 68 65 20 64 65 ype it is the de
14790 66 61 75 6c 74 20 76 61 6c 75 65 2c 20 74 68 65 fault value, the
147a0 6e 20 6a 75 73 74 20 75 73 65 0d 0a 20 20 20 20 n just use..
147b0 20 20 23 20 20 20 20 20 20 20 69 74 20 76 65 72 # it ver
147c0 62 61 74 69 6d 3b 20 6f 74 68 65 72 77 69 73 65 batim; otherwise
147d0 2c 20 6a 75 73 74 20 72 65 74 75 72 6e 20 61 6e , just return an
147e0 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2e 20 20 empty string.
147f0 49 6e 20 74 68 61 74 0d 0a 20 20 20 20 20 20 23 In that.. #
14800 20 20 20 20 20 20 20 63 61 73 65 2c 20 74 68 65 case, the
14810 20 64 65 66 61 75 6c 74 20 63 6f 6e 6e 65 63 74 default connect
14820 69 6f 6e 20 66 6c 61 67 73 20 77 69 6c 6c 20 62 ion flags will b
14830 65 20 75 73 65 64 2e 0d 0a 20 20 20 20 20 20 23 e used... #
14840 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
14850 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 6c 75 ing length $valu
14860 65 5d 20 3d 3d 20 30 20 7c 7c 20 24 76 61 6c 75 e] == 0 || $valu
14870 65 20 6e 65 20 22 44 65 66 61 75 6c 74 22 7d 20 e ne "Default"}
14880 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
14890 23 0d 0a 20 20 20 20 20 20 20 20 23 20 57 41 52 #.. # WAR
148a0 4e 49 4e 47 3a 20 54 68 69 73 20 72 65 74 75 72 NING: This retur
148b0 6e 73 20 74 68 65 20 73 74 72 69 6e 67 20 76 61 ns the string va
148c0 6c 75 65 20 6f 66 20 74 68 65 20 63 6f 6d 62 69 lue of the combi
148d0 6e 65 64 20 66 6c 61 67 73 2c 20 6e 6f 74 0d 0a ned flags, not..
148e0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
148f0 20 20 20 74 68 65 20 65 6e 75 6d 65 72 61 74 65 the enumerate
14900 64 20 76 61 6c 75 65 2e 20 20 54 68 69 73 20 69 d value. This i
14910 73 20 62 79 20 64 65 73 69 67 6e 20 61 6e 64 20 s by design and
14920 73 68 6f 75 6c 64 20 6e 6f 74 0d 0a 20 20 20 20 should not..
14930 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 62 # b
14940 65 20 63 68 61 6e 67 65 64 20 77 69 74 68 6f 75 e changed withou
14950 74 20 63 61 72 65 66 75 6c 20 63 6f 6e 73 69 64 t careful consid
14960 65 72 61 74 69 6f 6e 20 28 65 2e 67 2e 20 69 74 eration (e.g. it
14970 20 77 6f 75 6c 64 0d 0a 20 20 20 20 20 20 20 20 would..
14980 23 20 20 20 20 20 20 20 20 20 20 70 72 65 76 65 # preve
14990 6e 74 20 74 68 65 20 53 51 4c 69 74 65 43 6f 6e nt the SQLiteCon
149a0 6e 65 63 74 69 6f 6e 20 63 6c 61 73 73 20 66 72 nection class fr
149b0 6f 6d 20 61 6c 6c 6f 77 69 6e 67 20 69 6e 76 61 om allowing inva
149c0 6c 69 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 lid.. #
149d0 20 20 20 20 20 20 20 20 5b 22 6d 61 67 69 63 61 ["magica
149e0 6c 22 5d 20 6d 65 74 61 2d 66 6c 61 67 73 29 2e l"] meta-flags).
149f0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
14a00 20 20 20 20 20 72 65 74 75 72 6e 20 5b 61 70 70 return [app
14a10 65 6e 64 41 72 67 73 20 22 46 6c 61 67 73 3d 22 endArgs "Flags="
14a20 20 24 66 6c 61 67 73 20 5c 3b 5d 0d 0a 20 20 20 $flags \;]..
14a30 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 }.... re
14a40 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 7d 0d 0a turn "".. }..
14a50 0c 0d 0a 20 20 20 20 70 72 6f 63 20 65 6e 61 62 ... proc enab
14a60 6c 65 53 68 61 72 65 64 43 61 63 68 65 20 7b 20 leSharedCache {
14a70 63 68 61 6e 6e 65 6c 20 65 6e 61 62 6c 65 20 7b channel enable {
14a80 71 75 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b quiet false} } {
14a90 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 .. if {[cat
14aa0 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 ch {.. ob
14ab0 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 ject invoke -fla
14ac0 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d gs +NonPublic \.
14ad0 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 . Sys
14ae0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
14af0 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 UnsafeNativeMeth
14b00 6f 64 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ods \..
14b10 20 20 20 73 71 6c 69 74 65 33 5f 65 6e 61 62 6c sqlite3_enabl
14b20 65 5f 73 68 61 72 65 64 5f 63 61 63 68 65 20 5b e_shared_cache [
14b30 65 78 70 72 20 69 6e 74 28 24 65 6e 61 62 6c 65 expr int($enable
14b40 29 5d 0d 0a 20 20 20 20 20 20 7d 20 72 65 73 75 )].. } resu
14b50 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b lt] == 0} then {
14b60 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 .. if {!$
14b70 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
14b80 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
14b90 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
14ba0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
14bb0 20 20 20 20 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 "---- call
14bc0 73 71 6c 69 74 65 33 5f 65 6e 61 62 6c 65 5f 73 sqlite3_enable_s
14bd0 68 61 72 65 64 5f 63 61 63 68 65 28 22 20 24 65 hared_cache(" $e
14be0 6e 61 62 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 nable \..
14bf0 20 20 20 20 20 20 20 22 29 2e 2e 2e 20 6f 6b 3a ")... ok:
14c00 20 22 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a " $result \n]..
14c10 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
14c20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
14c30 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
14c40 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
14c50 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
14c60 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
14c70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
14c80 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 --- call sqlite3
14c90 5f 65 6e 61 62 6c 65 5f 73 68 61 72 65 64 5f 63 _enable_shared_c
14ca0 61 63 68 65 28 22 20 24 65 6e 61 62 6c 65 20 5c ache(" $enable \
14cb0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
14cc0 22 29 2e 2e 2e 20 65 72 72 6f 72 3a 20 22 20 5c ")... error: " \
14cd0 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d n\t $result \n].
14ce0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
14cf0 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
14d00 20 20 20 70 72 6f 63 20 73 65 74 75 70 44 62 20 proc setupDb
14d10 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 66 {.. f
14d20 69 6c 65 4e 61 6d 65 20 7b 6d 6f 64 65 20 22 22 ileName {mode ""
14d30 7d 20 7b 64 61 74 65 54 69 6d 65 46 6f 72 6d 61 } {dateTimeForma
14d40 74 20 22 22 7d 20 7b 64 61 74 65 54 69 6d 65 4b t ""} {dateTimeK
14d50 69 6e 64 20 22 22 7d 20 7b 66 6c 61 67 73 20 22 ind ""} {flags "
14d60 22 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 "}..
14d70 7b 65 78 74 72 61 20 22 22 7d 20 7b 71 75 61 6c {extra ""} {qual
14d80 69 66 79 20 74 72 75 65 7d 20 7b 64 65 6c 65 74 ify true} {delet
14d90 65 20 74 72 75 65 7d 20 7b 75 72 69 20 66 61 6c e true} {uri fal
14da0 73 65 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 se}..
14db0 20 7b 74 65 6d 70 6f 72 61 72 79 20 74 72 75 65 {temporary true
14dc0 7d 20 7b 76 61 72 4e 61 6d 65 20 64 62 7d 20 7b } {varName db} {
14dd0 71 75 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b quiet false} } {
14de0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
14df0 20 23 20 4e 4f 54 45 3a 20 46 69 72 73 74 2c 20 # NOTE: First,
14e00 73 65 65 20 69 66 20 6f 75 72 20 63 61 6c 6c 65 see if our calle
14e10 72 20 68 61 73 20 72 65 71 75 65 73 74 65 64 20 r has requested
14e20 61 6e 20 69 6e 2d 6d 65 6d 6f 72 79 20 64 61 74 an in-memory dat
14e30 61 62 61 73 65 2e 0d 0a 20 20 20 20 20 20 23 0d abase... #.
14e40 0a 20 20 20 20 20 20 73 65 74 20 69 73 4d 65 6d . set isMem
14e50 6f 72 79 20 5b 69 73 4d 65 6d 6f 72 79 44 62 20 ory [isMemoryDb
14e60 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 $fileName]....
14e70 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
14e80 4f 54 45 3a 20 46 6f 72 20 6e 6f 77 2c 20 61 6c OTE: For now, al
14e90 6c 20 74 65 73 74 20 64 61 74 61 62 61 73 65 73 l test databases
14ea0 20 75 73 65 64 20 62 79 20 74 68 65 20 74 65 73 used by the tes
14eb0 74 20 73 75 69 74 65 20 61 72 65 20 70 6c 61 63 t suite are plac
14ec0 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ed.. #
14ed0 20 20 69 6e 74 6f 20 74 68 65 20 64 61 74 61 62 into the datab
14ee0 61 73 65 20 64 69 72 65 63 74 6f 72 79 2e 20 20 ase directory.
14ef0 45 61 63 68 20 64 61 74 61 62 61 73 65 20 61 6e Each database an
14f00 64 20 72 65 6c 61 74 65 64 20 66 69 6c 65 73 0d d related files.
14f10 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 75 . # u
14f20 73 65 64 20 62 79 20 61 20 74 65 73 74 20 73 68 sed by a test sh
14f30 6f 75 6c 64 20 62 65 20 63 6c 65 61 6e 65 64 20 ould be cleaned
14f40 75 70 20 62 79 20 74 68 61 74 20 74 65 73 74 20 up by that test
14f50 75 73 69 6e 67 20 74 68 65 0d 0a 20 20 20 20 20 using the..
14f60 20 23 20 20 20 20 20 20 20 22 63 6c 65 61 6e 75 # "cleanu
14f70 70 44 62 22 20 70 72 6f 63 65 64 75 72 65 2c 20 pDb" procedure,
14f80 62 65 6c 6f 77 2e 0d 0a 20 20 20 20 20 20 23 0d below... #.
14f90 0a 20 20 20 20 20 20 69 66 20 7b 21 24 69 73 4d . if {!$isM
14fa0 65 6d 6f 72 79 20 26 26 20 24 71 75 61 6c 69 66 emory && $qualif
14fb0 79 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 y} then {..
14fc0 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 set fileName
14fd0 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 44 [file join [getD
14fe0 61 74 61 62 61 73 65 44 69 72 65 63 74 6f 72 79 atabaseDirectory
14ff0 5d 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 ] [file tail $fi
15000 6c 65 4e 61 6d 65 5d 5d 0d 0a 20 20 20 20 20 20 leName]]..
15010 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
15020 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 79 20 64 # NOTE: By d
15030 65 66 61 75 6c 74 2c 20 64 65 6c 65 74 65 20 61 efault, delete a
15040 6e 79 20 70 72 65 2d 65 78 69 73 74 69 6e 67 20 ny pre-existing
15050 64 61 74 61 62 61 73 65 20 77 69 74 68 20 74 68 database with th
15060 65 20 73 61 6d 65 20 66 69 6c 65 0d 0a 20 20 20 e same file..
15070 20 20 20 23 20 20 20 20 20 20 20 6e 61 6d 65 20 # name
15080 69 66 20 69 74 20 63 75 72 72 65 6e 74 6c 79 20 if it currently
15090 65 78 69 73 74 73 2e 0d 0a 20 20 20 20 20 20 23 exists... #
150a0 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 24 69 73 .. if {!$is
150b0 4d 65 6d 6f 72 79 20 26 26 20 24 64 65 6c 65 74 Memory && $delet
150c0 65 20 26 26 20 5b 66 69 6c 65 20 65 78 69 73 74 e && [file exist
150d0 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 s $fileName]} th
150e0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
150f0 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
15100 20 41 74 74 65 6d 70 74 20 74 6f 20 64 65 6c 65 Attempt to dele
15110 74 65 20 61 6e 79 20 70 72 65 2d 65 78 69 73 74 te any pre-exist
15120 69 6e 67 20 64 61 74 61 62 61 73 65 20 77 69 74 ing database wit
15130 68 20 74 68 65 20 73 61 6d 65 20 66 69 6c 65 0d h the same file.
15140 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
15150 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 20 20 20 name...
15160 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
15170 63 61 74 63 68 20 7b 66 69 6c 65 20 64 65 6c 65 catch {file dele
15180 74 65 20 24 66 69 6c 65 4e 61 6d 65 7d 20 65 72 te $fileName} er
15190 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ror]} then {..
151a0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
151b0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 65 20 # NOTE: We
151c0 73 6f 6d 65 68 6f 77 20 66 61 69 6c 65 64 20 74 somehow failed t
151d0 6f 20 64 65 6c 65 74 65 20 74 68 65 20 66 69 6c o delete the fil
151e0 65 2c 20 72 65 70 6f 72 74 20 77 68 79 2e 0d 0a e, report why...
151f0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
15200 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
15210 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
15220 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
15230 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
15240 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
15250 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d "==
15260 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c == WARNING: fail
15270 65 64 20 74 6f 20 64 65 6c 65 74 65 20 64 61 74 ed to delete dat
15280 61 62 61 73 65 20 66 69 6c 65 20 5c 22 22 20 24 abase file \"" $
15290 66 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 fileName \..
152a0 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 "\"
152b0 64 75 72 69 6e 67 20 73 65 74 75 70 2c 20 65 72 during setup, er
152c0 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 ror: " \n\t $err
152d0 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 or \n]..
152e0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
152f0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
15300 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
15310 3a 20 52 65 66 65 72 20 74 6f 20 74 68 65 20 73 : Refer to the s
15320 70 65 63 69 66 69 65 64 20 76 61 72 69 61 62 6c pecified variabl
15330 65 20 28 65 2e 67 2e 20 22 64 62 22 29 20 69 6e e (e.g. "db") in
15340 20 74 68 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 the context of
15350 6f 75 72 0d 0a 20 20 20 20 20 20 23 20 20 20 20 our.. #
15360 20 20 20 63 61 6c 6c 65 72 2e 20 20 54 68 65 20 caller. The
15370 68 61 6e 64 6c 65 20 74 6f 20 74 68 65 20 6f 70 handle to the op
15380 65 6e 65 64 20 64 61 74 61 62 61 73 65 20 77 69 ened database wi
15390 6c 6c 20 62 65 20 73 74 6f 72 65 64 20 74 68 65 ll be stored the
153a0 72 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 re... #..
153b0 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 upvar 1 $var
153c0 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 20 20 20 Name db....
153d0 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
153e0 3a 20 53 74 61 72 74 20 62 75 69 6c 64 69 6e 67 : Start building
153f0 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 the connection
15400 73 74 72 69 6e 67 2e 20 20 54 68 65 20 6f 6e 6c string. The onl
15410 79 20 72 65 71 75 69 72 65 64 20 70 6f 72 74 69 y required porti
15420 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 on.. #
15430 20 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 of the connect
15440 69 6f 6e 20 73 74 72 69 6e 67 20 69 73 20 74 68 ion string is th
15450 65 20 64 61 74 61 20 73 6f 75 72 63 65 2c 20 77 e data source, w
15460 68 69 63 68 20 63 6f 6e 74 61 69 6e 73 20 74 68 hich contains th
15470 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
15480 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 6e database file n
15490 61 6d 65 20 69 74 73 65 6c 66 2e 20 20 49 66 20 ame itself. If
154a0 6f 75 72 20 63 61 6c 6c 65 72 20 77 61 6e 74 73 our caller wants
154b0 20 74 6f 20 75 73 65 20 61 20 55 52 49 20 61 73 to use a URI as
154c0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
154d0 74 68 65 20 64 61 74 61 20 73 6f 75 72 63 65 2c the data source,
154e0 20 75 73 65 20 74 68 65 20 46 75 6c 6c 55 72 69 use the FullUri
154f0 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 connection stri
15500 6e 67 20 70 72 6f 70 65 72 74 79 20 74 6f 0d 0a ng property to..
15510 20 20 20 20 20 20 23 20 20 20 20 20 20 20 70 72 # pr
15520 65 76 65 6e 74 20 74 68 65 20 64 61 74 61 20 73 event the data s
15530 6f 75 72 63 65 20 73 74 72 69 6e 67 20 66 72 6f ource string fro
15540 6d 20 62 65 69 6e 67 20 6d 61 6e 67 6c 65 64 2e m being mangled.
15550 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
15560 20 69 66 20 7b 24 75 72 69 7d 20 74 68 65 6e 20 if {$uri} then
15570 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 63 {.. set c
15580 6f 6e 6e 65 63 74 69 6f 6e 20 7b 46 75 6c 6c 55 onnection {FullU
15590 72 69 3d 24 7b 66 69 6c 65 4e 61 6d 65 7d 7d 0d ri=${fileName}}.
155a0 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
155b0 0a 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 6e . set con
155c0 6e 65 63 74 69 6f 6e 20 7b 44 61 74 61 20 53 6f nection {Data So
155d0 75 72 63 65 3d 24 7b 66 69 6c 65 4e 61 6d 65 7d urce=${fileName}
155e0 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
155f0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
15600 4f 54 45 3a 20 53 69 6e 63 65 20 74 68 69 73 20 OTE: Since this
15610 70 72 6f 63 65 64 75 72 65 20 68 61 73 20 6e 6f procedure has no
15620 20 73 70 65 63 69 61 6c 20 6b 6e 6f 77 6c 65 64 special knowled
15630 67 65 20 6f 66 20 77 68 61 74 20 74 68 65 20 64 ge of what the d
15640 65 66 61 75 6c 74 0d 0a 20 20 20 20 20 20 23 20 efault.. #
15650 20 20 20 20 20 20 73 65 74 74 69 6e 67 20 69 73 setting is
15660 20 66 6f 72 20 74 68 65 20 54 6f 46 75 6c 6c 50 for the ToFullP
15670 61 74 68 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 ath connection s
15680 74 72 69 6e 67 20 70 72 6f 70 65 72 79 2c 20 61 tring propery, a
15690 6c 77 61 79 73 0d 0a 20 20 20 20 20 20 23 20 20 lways.. #
156a0 20 20 20 20 20 61 64 64 20 74 68 65 20 76 61 6c add the val
156b0 75 65 20 77 65 20 6b 6e 6f 77 20 61 62 6f 75 74 ue we know about
156c0 20 74 6f 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 to the connecti
156d0 6f 6e 20 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 on string...
156e0 20 20 23 0d 0a 20 20 20 20 20 20 61 70 70 65 6e #.. appen
156f0 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 7b 3b 54 d connection {;T
15700 6f 46 75 6c 6c 50 61 74 68 3d 24 7b 71 75 61 6c oFullPath=${qual
15710 69 66 79 7d 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 ify}}.... #
15720 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
15730 49 66 20 6f 75 72 20 63 61 6c 6c 65 72 20 73 70 If our caller sp
15740 65 63 69 66 69 65 64 20 61 20 6a 6f 75 72 6e 61 ecified a journa
15750 6c 20 6d 6f 64 65 2c 20 61 64 64 20 74 68 65 20 l mode, add the
15760 6e 65 63 65 73 73 61 72 79 20 70 6f 72 74 69 6f necessary portio
15770 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 n.. #
15780 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 of the connecti
15790 6f 6e 20 73 74 72 69 6e 67 20 6e 6f 77 2e 0d 0a on string now...
157a0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
157b0 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 f {[string lengt
157c0 68 20 24 6d 6f 64 65 5d 20 3e 20 30 7d 20 74 68 h $mode] > 0} th
157d0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 70 en {.. ap
157e0 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 pend connection
157f0 7b 3b 4a 6f 75 72 6e 61 6c 20 4d 6f 64 65 3d 24 {;Journal Mode=$
15800 7b 6d 6f 64 65 7d 7d 0d 0a 20 20 20 20 20 20 7d {mode}}.. }
15810 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
15820 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 6f 75 # NOTE: If ou
15830 72 20 63 61 6c 6c 65 72 20 73 70 65 63 69 66 69 r caller specifi
15840 65 64 20 61 20 44 61 74 65 54 69 6d 65 20 66 6f ed a DateTime fo
15850 72 6d 61 74 2c 20 61 64 64 20 74 68 65 20 6e 65 rmat, add the ne
15860 63 65 73 73 61 72 79 0d 0a 20 20 20 20 20 20 23 cessary.. #
15870 20 20 20 20 20 20 20 70 6f 72 74 69 6f 6e 20 6f portion o
15880 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e f the connection
15890 20 73 74 72 69 6e 67 20 6e 6f 77 2e 0d 0a 20 20 string now...
158a0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
158b0 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
158c0 24 64 61 74 65 54 69 6d 65 46 6f 72 6d 61 74 5d $dateTimeFormat]
158d0 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
158e0 20 20 20 20 20 20 61 70 70 65 6e 64 20 63 6f 6e append con
158f0 6e 65 63 74 69 6f 6e 20 7b 3b 44 61 74 65 54 69 nection {;DateTi
15900 6d 65 46 6f 72 6d 61 74 3d 24 7b 64 61 74 65 54 meFormat=${dateT
15910 69 6d 65 46 6f 72 6d 61 74 7d 7d 0d 0a 20 20 20 imeFormat}}..
15920 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
15930 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 . # NOTE: I
15940 66 20 6f 75 72 20 63 61 6c 6c 65 72 20 73 70 65 f our caller spe
15950 63 69 66 69 65 64 20 61 20 44 61 74 65 54 69 6d cified a DateTim
15960 65 4b 69 6e 64 2c 20 61 64 64 20 74 68 65 20 6e eKind, add the n
15970 65 63 65 73 73 61 72 79 20 70 6f 72 74 69 6f 6e ecessary portion
15980 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
15990 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f of the connectio
159a0 6e 20 73 74 72 69 6e 67 20 6e 6f 77 2e 0d 0a 20 n string now...
159b0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
159c0 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
159d0 20 24 64 61 74 65 54 69 6d 65 4b 69 6e 64 5d 20 $dateTimeKind]
159e0 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
159f0 20 20 20 20 20 61 70 70 65 6e 64 20 63 6f 6e 6e append conn
15a00 65 63 74 69 6f 6e 20 7b 3b 44 61 74 65 54 69 6d ection {;DateTim
15a10 65 4b 69 6e 64 3d 24 7b 64 61 74 65 54 69 6d 65 eKind=${dateTime
15a20 4b 69 6e 64 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d Kind}}.. }.
15a30 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
15a40 20 20 23 20 4e 4f 54 45 3a 20 46 69 67 75 72 65 # NOTE: Figure
15a50 20 6f 75 74 20 77 68 61 74 20 74 68 65 20 66 69 out what the fi
15a60 6e 61 6c 20 66 6c 61 67 73 20 66 6f 72 20 74 68 nal flags for th
15a70 69 73 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 6e 65 is connection ne
15a80 65 64 20 74 6f 20 62 65 2e 0d 0a 20 20 20 20 20 ed to be...
15a90 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 66 6c #.. set fl
15aa0 61 67 73 20 5b 67 65 74 43 6f 6e 6e 65 63 74 69 ags [getConnecti
15ab0 6f 6e 46 6c 61 67 73 20 24 66 69 6c 65 4e 61 6d onFlags $fileNam
15ac0 65 20 24 66 6c 61 67 73 20 24 71 75 69 65 74 5d e $flags $quiet]
15ad0 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
15ae0 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 6f 75 # NOTE: If ou
15af0 72 20 63 61 6c 6c 65 72 20 73 70 65 63 69 66 69 r caller specifi
15b00 65 64 20 73 6f 6d 65 20 53 51 4c 69 74 65 43 6f ed some SQLiteCo
15b10 6e 6e 65 63 74 69 6f 6e 46 6c 61 67 73 2c 20 61 nnectionFlags, a
15b20 64 64 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 dd the.. #
15b30 20 20 20 20 20 20 6e 65 63 65 73 73 61 72 79 20 necessary
15b40 70 6f 72 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 portion of the c
15b50 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 onnection string
15b60 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 23 0d 0a now... #..
15b70 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
15b80 67 20 6c 65 6e 67 74 68 20 24 66 6c 61 67 73 5d g length $flags]
15b90 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
15ba0 20 20 20 20 20 20 61 70 70 65 6e 64 20 63 6f 6e append con
15bb0 6e 65 63 74 69 6f 6e 20 7b 3b 46 6c 61 67 73 3d nection {;Flags=
15bc0 24 7b 66 6c 61 67 73 7d 7d 0d 0a 20 20 20 20 20 ${flags}}..
15bd0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
15be0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 # NOTE: If
15bf0 6f 75 72 20 63 61 6c 6c 65 72 20 73 70 65 63 69 our caller speci
15c00 66 69 65 64 20 61 6e 20 65 78 74 72 61 20 70 61 fied an extra pa
15c10 79 6c 6f 61 64 20 74 6f 20 74 68 65 20 63 6f 6e yload to the con
15c20 6e 65 63 74 69 6f 6e 0d 0a 20 20 20 20 20 20 23 nection.. #
15c30 20 20 20 20 20 20 20 73 74 72 69 6e 67 2c 20 61 string, a
15c40 70 70 65 6e 64 20 69 74 20 6e 6f 77 2e 0d 0a 20 ppend it now...
15c50 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
15c60 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
15c70 20 24 65 78 74 72 61 5d 20 3e 20 30 7d 20 74 68 $extra] > 0} th
15c80 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 70 en {.. ap
15c90 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 pend connection
15ca0 5c 3b 20 24 65 78 74 72 61 0d 0a 20 20 20 20 20 \; $extra..
15cb0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
15cc0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4f 70 65 # NOTE: Ope
15cd0 6e 20 74 68 65 20 64 61 74 61 62 61 73 65 20 63 n the database c
15ce0 6f 6e 6e 65 63 74 69 6f 6e 20 6e 6f 77 2c 20 70 onnection now, p
15cf0 6c 61 63 69 6e 67 20 74 68 65 20 6f 70 61 71 75 lacing the opaqu
15d00 65 20 68 61 6e 64 6c 65 20 76 61 6c 75 65 0d 0a e handle value..
15d10 20 20 20 20 20 20 23 20 20 20 20 20 20 20 69 6e # in
15d20 74 6f 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 to the variable
15d30 73 70 65 63 69 66 69 65 64 20 62 79 20 6f 75 72 specified by our
15d40 20 63 61 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 caller...
15d50 23 0d 0a 20 20 20 20 20 20 73 65 74 20 64 62 20 #.. set db
15d60 5b 73 71 6c 20 6f 70 65 6e 20 2d 74 79 70 65 20 [sql open -type
15d70 53 51 4c 69 74 65 20 5b 73 75 62 73 74 20 24 63 SQLite [subst $c
15d80 6f 6e 6e 65 63 74 69 6f 6e 5d 5d 0d 0a 0d 0a 20 onnection]]....
15d90 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
15da0 4e 4f 54 45 3a 20 43 6f 6e 66 69 67 75 72 65 20 NOTE: Configure
15db0 74 68 65 20 74 65 6d 70 6f 72 61 72 79 20 64 69 the temporary di
15dc0 72 65 63 74 6f 72 79 20 66 6f 72 20 74 68 65 20 rectory for the
15dd0 6e 65 77 6c 79 20 6f 70 65 6e 65 64 20 64 61 74 newly opened dat
15de0 61 62 61 73 65 0d 0a 20 20 20 20 20 20 23 20 20 abase.. #
15df0 20 20 20 20 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 connection
15e00 6e 6f 77 20 75 6e 6c 65 73 73 20 6f 75 72 20 63 now unless our c
15e10 61 6c 6c 65 72 20 66 6f 72 62 69 64 73 20 69 74 aller forbids it
15e20 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
15e30 20 20 69 66 20 7b 24 74 65 6d 70 6f 72 61 72 79 if {$temporary
15e40 20 26 26 20 21 5b 69 6e 66 6f 20 65 78 69 73 74 && ![info exist
15e50 73 20 3a 3a 6e 6f 28 73 65 74 54 65 6d 70 6f 72 s ::no(setTempor
15e60 61 72 79 44 69 72 65 63 74 6f 72 79 29 5d 7d 20 aryDirectory)]}
15e70 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
15e80 73 71 6c 20 65 78 65 63 75 74 65 20 24 64 62 20 sql execute $db
15e90 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
15ea0 20 20 20 20 20 20 20 20 20 20 20 22 50 52 41 47 "PRAG
15eb0 4d 41 20 74 65 6d 70 5f 73 74 6f 72 65 5f 64 69 MA temp_store_di
15ec0 72 65 63 74 6f 72 79 20 3d 20 5c 22 22 20 5b 67 rectory = \"" [g
15ed0 65 74 54 65 6d 70 6f 72 61 72 79 44 69 72 65 63 etTemporaryDirec
15ee0 74 6f 72 79 5d 20 5c 22 5c 3b 5d 0d 0a 20 20 20 tory] \"\;]..
15ef0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
15f00 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 50 . # NOTE: P
15f10 65 72 66 6f 72 6d 20 61 6e 79 20 65 78 74 72 61 erform any extra
15f20 20 70 65 72 2d 63 6f 6e 6e 65 63 74 69 6f 6e 20 per-connection
15f30 73 65 74 75 70 20 66 6f 72 20 74 68 65 20 6e 65 setup for the ne
15f40 77 6c 79 20 6f 70 65 6e 65 64 0d 0a 20 20 20 20 wly opened..
15f50 20 20 23 20 20 20 20 20 20 20 64 61 74 61 62 61 # databa
15f60 73 65 20 6e 6f 77 20 75 6e 6c 65 73 73 20 6f 75 se now unless ou
15f70 72 20 63 61 6c 6c 65 72 20 66 6f 72 62 69 64 73 r caller forbids
15f80 20 69 74 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 it... #..
15f90 20 20 20 20 20 73 65 74 20 65 78 65 63 75 74 65 set execute
15fa0 4f 6e 53 65 74 75 70 20 5b 67 65 74 45 78 65 63 OnSetup [getExec
15fb0 75 74 65 4f 6e 53 65 74 75 70 5d 0d 0a 0d 0a 20 uteOnSetup]....
15fc0 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
15fd0 20 6c 65 6e 67 74 68 20 24 65 78 65 63 75 74 65 length $execute
15fe0 4f 6e 53 65 74 75 70 5d 20 3e 20 30 20 26 26 20 OnSetup] > 0 &&
15ff0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 21 5b 69 \.. ![i
16000 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
16010 65 78 65 63 75 74 65 4f 6e 53 65 74 75 70 29 5d executeOnSetup)]
16020 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
16030 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
16040 4f 54 45 3a 20 54 68 69 73 20 63 6f 6d 6d 61 6e OTE: This comman
16050 64 20 6d 61 79 20 72 61 69 73 65 20 61 6e 20 65 d may raise an e
16060 72 72 6f 72 3b 20 69 66 20 73 6f 2c 20 74 68 61 rror; if so, tha
16070 74 20 69 73 20 66 69 6e 65 2c 20 61 73 0d 0a 20 t is fine, as..
16080 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
16090 68 65 20 65 6e 63 6c 6f 73 69 6e 67 20 74 65 73 he enclosing tes
160a0 74 20 77 69 6c 6c 20 74 68 65 6e 20 66 61 69 6c t will then fail
160b0 2e 20 20 54 68 65 20 5b 73 75 62 73 74 5d 20 63 . The [subst] c
160c0 6f 6d 6d 61 6e 64 20 69 73 0d 0a 20 20 20 20 20 ommand is..
160d0 20 20 20 23 20 20 20 20 20 20 20 75 73 65 64 20 # used
160e0 6f 6e 20 74 68 65 20 53 51 4c 20 69 6e 20 63 61 on the SQL in ca
160f0 73 65 20 69 74 20 6e 65 65 64 73 20 74 6f 20 72 se it needs to r
16100 65 66 65 72 20 74 6f 20 73 74 61 74 65 20 69 6e efer to state in
16110 20 6f 75 72 0d 0a 20 20 20 20 20 20 20 20 23 20 our.. #
16120 20 20 20 20 20 20 63 6f 6e 74 65 78 74 2e 0d 0a context...
16130 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
16140 20 20 20 73 71 6c 20 65 78 65 63 75 74 65 20 24 sql execute $
16150 64 62 20 5b 73 75 62 73 74 20 24 65 78 65 63 75 db [subst $execu
16160 74 65 4f 6e 53 65 74 75 70 5d 0d 0a 20 20 20 20 teOnSetup]..
16170 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
16180 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 6c # NOTE: Al
16190 77 61 79 73 20 72 65 74 75 72 6e 20 74 68 65 20 ways return the
161a0 63 6f 6e 6e 65 63 74 69 6f 6e 20 68 61 6e 64 6c connection handl
161b0 65 20 75 70 6f 6e 20 73 75 63 63 65 73 73 2e 0d e upon success..
161c0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
161d0 72 65 74 75 72 6e 20 24 64 62 0d 0a 20 20 20 20 return $db..
161e0 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 }..... proc g
161f0 65 74 44 62 43 6f 6e 6e 65 63 74 69 6f 6e 20 7b etDbConnection {
16200 20 7b 76 61 72 4e 61 6d 65 20 64 62 7d 20 7d 20 {varName db} }
16210 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
16220 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 20 # NOTE: Refer
16230 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 64 to the specified
16240 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e 20 variable (e.g.
16250 22 64 62 22 29 20 69 6e 20 74 68 65 20 63 6f 6e "db") in the con
16260 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a 20 20 20 text of our..
16270 20 20 20 23 20 20 20 20 20 20 20 63 61 6c 6c 65 # calle
16280 72 2e 20 20 54 68 65 20 68 61 6e 64 6c 65 20 74 r. The handle t
16290 6f 20 74 68 65 20 64 61 74 61 62 61 73 65 20 70 o the database p
162a0 72 65 76 69 6f 75 73 6c 79 20 6f 70 65 6e 65 64 reviously opened
162b0 20 76 69 61 20 74 68 65 0d 0a 20 20 20 20 20 20 via the..
162c0 23 20 20 20 20 20 20 20 5b 73 65 74 75 70 44 62 # [setupDb
162d0 5d 20 70 72 6f 63 65 64 75 72 65 20 73 68 6f 75 ] procedure shou
162e0 6c 64 20 62 65 20 73 74 6f 72 65 64 20 74 68 65 ld be stored the
162f0 72 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 re... #..
16300 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 upvar 1 $var
16310 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 20 20 20 Name db....
16320 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
16330 3a 20 54 68 69 73 20 72 65 74 75 72 6e 73 20 74 : This returns t
16340 68 65 20 41 44 4f 2e 4e 45 54 20 49 44 62 43 6f he ADO.NET IDbCo
16350 6e 6e 65 63 74 69 6f 6e 20 6f 62 6a 65 63 74 20 nnection object
16360 69 6e 73 74 61 6e 63 65 20 66 6f 72 20 74 68 65 instance for the
16370 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
16380 73 70 65 63 69 66 69 65 64 20 64 61 74 61 62 73 specified databs
16390 65 20 68 61 6e 64 6c 65 2e 20 20 53 69 6e 63 65 e handle. Since
163a0 20 67 65 74 74 69 6e 67 20 74 68 69 73 20 6f 62 getting this ob
163b0 6a 65 63 74 20 72 65 6c 69 65 73 20 75 70 6f 6e ject relies upon
163c0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
163d0 45 61 67 6c 65 20 69 6e 74 65 72 6e 61 6c 73 2c Eagle internals,
163e0 20 67 72 65 61 74 20 63 61 72 65 20 73 68 6f 75 great care shou
163f0 6c 64 20 62 65 20 74 61 6b 65 6e 20 74 6f 20 61 ld be taken to a
16400 76 6f 69 64 20 64 69 73 70 6f 73 69 6e 67 20 6f void disposing o
16410 66 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 f.. #
16420 20 74 68 69 73 20 6f 62 6a 65 63 74 20 6f 72 20 this object or
16430 6f 74 68 65 72 77 69 73 65 20 70 75 74 74 69 6e otherwise puttin
16440 67 20 69 74 20 69 6e 74 6f 20 61 6e 20 69 6e 76 g it into an inv
16450 61 6c 69 64 20 73 74 61 74 65 2e 0d 0a 20 20 20 alid state...
16460 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
16470 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 64 62 5d [info exists db]
16480 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
16490 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
164a0 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
164b0 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
164c0 4e 6f 6e 50 75 62 6c 69 63 20 2d 6f 62 6a 65 63 NonPublic -objec
164d0 74 66 6c 61 67 73 20 2b 4e 6f 44 69 73 70 6f 73 tflags +NoDispos
164e0 65 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 20 20 20 e -alias \..
164f0 20 20 20 20 20 20 20 20 20 20 49 6e 74 65 72 70 Interp
16500 72 65 74 65 72 2e 47 65 74 41 63 74 69 76 65 2e reter.GetActive.
16510 63 6f 6e 6e 65 63 74 69 6f 6e 73 20 49 74 65 6d connections Item
16520 20 24 64 62 0d 0a 20 20 20 20 20 20 20 20 7d 20 $db.. }
16530 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 result] == 0} th
16540 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
16550 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
16560 4f 54 45 3a 20 53 75 63 63 65 73 73 2c 20 72 65 OTE: Success, re
16570 74 75 72 6e 20 74 68 65 20 6f 70 61 71 75 65 20 turn the opaque
16580 6f 62 6a 65 63 74 20 68 61 6e 64 6c 65 2e 0d 0a object handle...
16590 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
165a0 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 72 return $r
165b0 65 73 75 6c 74 0d 0a 20 20 20 20 20 20 20 20 7d esult.. }
165c0 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
165d0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
165e0 23 20 4e 4f 54 45 3a 20 46 61 69 6c 75 72 65 2c # NOTE: Failure,
165f0 20 72 65 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 report why...
16600 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
16610 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
16620 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
16630 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
16640 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 "==== WA
16650 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f RNING: failed to
16660 20 67 65 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 get connection
16670 68 61 6e 64 6c 65 20 66 6f 72 20 64 61 74 61 62 handle for datab
16680 61 73 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 ase \"" \..
16690 20 20 20 20 20 20 20 20 20 24 64 62 20 22 5c 22 $db "\"
166a0 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 , error: " \n\t
166b0 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 $result \n]..
166c0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d }.. }.
166d0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
166e0 20 20 23 20 4e 4f 54 45 3a 20 46 61 69 6c 75 72 # NOTE: Failur
166f0 65 2c 20 72 65 74 75 72 6e 20 61 6e 20 6f 62 76 e, return an obv
16700 69 6f 75 73 6c 79 20 69 6e 76 61 6c 69 64 20 6f iously invalid o
16710 70 61 71 75 65 20 6f 62 6a 65 63 74 20 68 61 6e paque object han
16720 64 6c 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 dle... #..
16730 20 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a return ""..
16740 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
16750 6f 63 20 66 72 65 65 44 62 43 6f 6e 6e 65 63 74 oc freeDbConnect
16760 69 6f 6e 20 7b 20 7b 76 61 72 4e 61 6d 65 20 63 ion { {varName c
16770 6f 6e 6e 65 63 74 69 6f 6e 7d 20 7d 20 7b 0d 0a onnection} } {..
16780 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
16790 20 4e 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 NOTE: Refer to
167a0 74 68 65 20 73 70 65 63 69 66 69 65 64 20 76 61 the specified va
167b0 72 69 61 62 6c 65 20 28 65 2e 67 2e 20 22 63 6f riable (e.g. "co
167c0 6e 6e 65 63 74 69 6f 6e 22 29 20 69 6e 20 74 68 nnection") in th
167d0 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
167e0 20 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 20 context of our
167f0 63 61 6c 6c 65 72 2e 20 20 54 68 65 20 6f 70 61 caller. The opa
16800 71 75 65 20 6f 62 6a 65 63 74 20 68 61 6e 64 6c que object handl
16810 65 20 66 6f 72 20 61 6e 20 41 44 4f 2e 4e 45 54 e for an ADO.NET
16820 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
16830 63 6f 6e 6e 65 63 74 69 6f 6e 20 70 72 65 76 69 connection previ
16840 6f 75 73 6c 79 20 72 65 74 75 72 6e 65 64 20 62 ously returned b
16850 79 20 5b 67 65 74 44 62 43 6f 6e 6e 65 63 74 69 y [getDbConnecti
16860 6f 6e 5d 20 73 68 6f 75 6c 64 20 62 65 0d 0a 20 on] should be..
16870 20 20 20 20 20 23 20 20 20 20 20 20 20 73 74 6f # sto
16880 72 65 64 20 74 68 65 72 65 2e 0d 0a 20 20 20 20 red there...
16890 20 20 23 0d 0a 20 20 20 20 20 20 75 70 76 61 72 #.. upvar
168a0 20 31 20 24 76 61 72 4e 61 6d 65 20 63 6f 6e 6e 1 $varName conn
168b0 65 63 74 69 6f 6e 0d 0a 0d 0a 20 20 20 20 20 20 ection....
168c0 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
168d0 20 41 74 74 65 6d 70 74 20 74 6f 20 72 65 6d 6f Attempt to remo
168e0 76 65 20 74 68 65 20 6f 70 61 71 75 65 20 6f 62 ve the opaque ob
168f0 6a 65 63 74 20 68 61 6e 64 6c 65 20 66 72 6f 6d ject handle from
16900 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 the interpreter
16910 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
16920 6e 6f 77 2e 20 20 54 68 69 73 20 5b 6f 62 6a 65 now. This [obje
16930 63 74 20 64 69 73 70 6f 73 65 5d 20 63 61 6c 6c ct dispose] call
16940 20 77 69 6c 6c 20 6e 6f 74 20 61 63 74 75 61 6c will not actual
16950 6c 79 20 64 69 73 70 6f 73 65 20 6f 66 20 74 68 ly dispose of th
16960 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
16970 20 75 6e 64 65 72 6c 79 69 6e 67 20 6f 62 6a 65 underlying obje
16980 63 74 20 62 65 63 61 75 73 65 20 74 68 65 20 2b ct because the +
16990 4e 6f 44 69 73 70 6f 73 65 20 66 6c 61 67 20 77 NoDispose flag w
169a0 61 73 20 73 65 74 20 6f 6e 20 69 74 0d 0a 20 20 as set on it..
169b0 20 20 20 20 23 20 20 20 20 20 20 20 64 75 72 69 # duri
169c0 6e 67 20 63 72 65 61 74 69 6f 6e 20 6f 66 20 74 ng creation of t
169d0 68 65 20 6f 70 61 71 75 65 20 6f 62 6a 65 63 74 he opaque object
169e0 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 20 handle...
169f0 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e #.. if {[in
16a00 66 6f 20 65 78 69 73 74 73 20 63 6f 6e 6e 65 63 fo exists connec
16a10 74 69 6f 6e 5d 20 26 26 20 5c 0d 0a 20 20 20 20 tion] && \..
16a20 20 20 20 20 20 20 5b 63 61 74 63 68 20 7b 6f 62 [catch {ob
16a30 6a 65 63 74 20 64 69 73 70 6f 73 65 20 24 63 6f ject dispose $co
16a40 6e 6e 65 63 74 69 6f 6e 7d 20 65 72 72 6f 72 5d nnection} error]
16a50 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
16a60 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
16a70 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 20 OTE: We somehow
16a80 66 61 69 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 failed to remove
16a90 20 74 68 65 20 68 61 6e 64 6c 65 2c 20 72 65 70 the handle, rep
16aa0 6f 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 ort why...
16ab0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 70 75 #.. tpu
16ac0 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
16ad0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
16ae0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 3d .. "=
16af0 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 === WARNING: fai
16b00 6c 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 63 6f led to remove co
16b10 6e 6e 65 63 74 69 6f 6e 20 68 61 6e 64 6c 65 20 nnection handle
16b20 5c 22 22 20 24 63 6f 6e 6e 65 63 74 69 6f 6e 20 \"" $connection
16b30 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
16b40 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c \", error: " \n\
16b50 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 t $error \n]..
16b60 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
16b70 0a 20 20 20 20 70 72 6f 63 20 61 64 64 44 62 43 . proc addDbC
16b80 6f 6e 6e 65 63 74 69 6f 6e 20 7b 20 63 6f 6e 6e onnection { conn
16b90 65 63 74 69 6f 6e 20 7b 76 61 72 4e 61 6d 65 20 ection {varName
16ba0 64 62 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 db} } {.. #
16bb0 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
16bc0 52 65 66 65 72 20 74 6f 20 74 68 65 20 73 70 65 Refer to the spe
16bd0 63 69 66 69 65 64 20 76 61 72 69 61 62 6c 65 20 cified variable
16be0 28 65 2e 67 2e 20 22 64 62 22 29 20 69 6e 20 74 (e.g. "db") in t
16bf0 68 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 he context of ou
16c00 72 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 r.. #
16c10 20 63 61 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 caller...
16c20 23 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 #.. upvar 1
16c30 20 24 76 61 72 4e 61 6d 65 20 64 62 0d 0a 0d 0a $varName db....
16c40 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
16c50 20 4e 4f 54 45 3a 20 43 72 65 61 74 65 20 61 20 NOTE: Create a
16c60 63 6f 72 72 65 63 74 6c 79 20 66 6f 72 6d 61 74 correctly format
16c70 74 65 64 20 6e 61 6d 65 20 66 6f 72 20 74 68 65 ted name for the
16c80 20 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 database connec
16c90 74 69 6f 6e 20 74 6f 0d 0a 20 20 20 20 20 20 23 tion to.. #
16ca0 20 20 20 20 20 20 20 62 65 20 61 64 64 65 64 20 be added
16cb0 74 6f 20 74 68 65 20 6c 69 73 74 20 6d 61 6e 61 to the list mana
16cc0 67 65 64 20 62 79 20 74 68 65 20 45 61 67 6c 65 ged by the Eagle
16cd0 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 interpreter...
16ce0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 #.. se
16cf0 74 20 64 62 20 5b 6f 62 6a 65 63 74 20 69 6e 76 t db [object inv
16d00 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 oke -flags +NonP
16d10 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 ublic \..
16d20 20 20 20 45 61 67 6c 65 2e 5f 43 6f 6d 70 6f 6e Eagle._Compon
16d30 65 6e 74 73 2e 50 72 69 76 61 74 65 2e 46 6f 72 ents.Private.For
16d40 6d 61 74 4f 70 73 20 44 61 74 61 62 61 73 65 4f matOps DatabaseO
16d50 62 6a 65 63 74 4e 61 6d 65 20 24 63 6f 6e 6e 65 bjectName $conne
16d60 63 74 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 20 ction \..
16d70 20 20 20 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 SQLiteConnect
16d80 69 6f 6e 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f ion [object invo
16d90 6b 65 20 49 6e 74 65 72 70 72 65 74 65 72 2e 47 ke Interpreter.G
16da0 65 74 41 63 74 69 76 65 20 4e 65 78 74 49 64 5d etActive NextId]
16db0 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ].... #..
16dc0 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 # NOTE: Add
16dd0 74 68 65 20 64 61 74 61 62 61 73 65 20 63 6f 6e the database con
16de0 6e 65 63 74 69 6f 6e 20 70 72 6f 76 69 64 65 64 nection provided
16df0 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 20 74 by our caller t
16e00 6f 20 74 68 65 20 6c 69 73 74 0d 0a 20 20 20 20 o the list..
16e10 20 20 23 20 20 20 20 20 20 20 6f 66 20 74 68 6f # of tho
16e20 73 65 20 6b 6e 6f 77 6e 20 74 6f 20 74 68 65 20 se known to the
16e30 45 61 67 6c 65 20 69 6e 74 65 72 70 72 65 74 65 Eagle interprete
16e40 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 r... #..
16e50 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
16e60 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c -flags +NonPubl
16e70 69 63 20 49 6e 74 65 72 70 72 65 74 65 72 2e 47 ic Interpreter.G
16e80 65 74 41 63 74 69 76 65 2e 63 6f 6e 6e 65 63 74 etActive.connect
16e90 69 6f 6e 73 20 41 64 64 20 5c 0d 0a 20 20 20 20 ions Add \..
16ea0 20 20 20 20 20 20 24 64 62 20 24 63 6f 6e 6e 65 $db $conne
16eb0 63 74 69 6f 6e 0d 0a 20 20 20 20 7d 0d 0a 0c 0d ction.. }....
16ec0 0a 20 20 20 20 70 72 6f 63 20 67 65 74 52 6f 77 . proc getRow
16ed0 73 46 72 6f 6d 44 61 74 61 54 61 62 6c 65 20 7b sFromDataTable {
16ee0 20 64 61 74 61 54 61 62 6c 65 20 7d 20 7b 0d 0a dataTable } {..
16ef0 20 20 20 20 20 20 73 65 74 20 72 6f 77 73 20 5b set rows [
16f00 6c 69 73 74 5d 0d 0a 20 20 20 20 20 20 73 65 74 list].. set
16f10 20 63 6f 75 6e 74 20 5b 24 64 61 74 61 54 61 62 count [$dataTab
16f20 6c 65 20 43 6f 6c 75 6d 6e 73 2e 43 6f 75 6e 74 le Columns.Count
16f30 5d 0d 0a 0d 0a 20 20 20 20 20 20 66 6f 72 20 7b ].... for {
16f40 73 65 74 20 69 6e 64 65 78 20 30 7d 20 7b 24 69 set index 0} {$i
16f50 6e 64 65 78 20 3c 20 24 63 6f 75 6e 74 7d 20 7b ndex < $count} {
16f60 69 6e 63 72 20 69 6e 64 65 78 7d 20 7b 0d 0a 20 incr index} {..
16f70 20 20 20 20 20 20 20 73 65 74 20 64 61 74 61 43 set dataC
16f80 6f 6c 75 6d 6e 20 5b 24 64 61 74 61 54 61 62 6c olumn [$dataTabl
16f90 65 20 2d 61 6c 69 61 73 20 43 6f 6c 75 6d 6e 73 e -alias Columns
16fa0 2e 67 65 74 5f 49 74 65 6d 20 24 69 6e 64 65 78 .get_Item $index
16fb0 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 6e ].. set n
16fc0 61 6d 65 73 28 24 69 6e 64 65 78 29 20 5b 24 64 ames($index) [$d
16fd0 61 74 61 43 6f 6c 75 6d 6e 20 43 6f 6c 75 6d 6e ataColumn Column
16fe0 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a Name].. }..
16ff0 0d 0a 20 20 20 20 20 20 6f 62 6a 65 63 74 20 66 .. object f
17000 6f 72 65 61 63 68 20 2d 61 6c 69 61 73 20 64 61 oreach -alias da
17010 74 61 52 6f 77 20 5b 73 65 74 20 64 61 74 61 52 taRow [set dataR
17020 6f 77 73 20 5b 24 64 61 74 61 54 61 62 6c 65 20 ows [$dataTable
17030 52 6f 77 73 5d 5d 20 7b 0d 0a 20 20 20 20 20 20 Rows]] {..
17040 20 20 73 65 74 20 72 6f 77 20 5b 6c 69 73 74 5d set row [list]
17050 0d 0a 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 20 .... for
17060 7b 73 65 74 20 69 6e 64 65 78 20 30 7d 20 7b 24 {set index 0} {$
17070 69 6e 64 65 78 20 3c 20 24 63 6f 75 6e 74 7d 20 index < $count}
17080 7b 69 6e 63 72 20 69 6e 64 65 78 7d 20 7b 0d 0a {incr index} {..
17090 20 20 20 20 20 20 20 20 20 20 73 65 74 20 76 61 set va
170a0 6c 75 65 20 5b 24 64 61 74 61 52 6f 77 20 2d 63 lue [$dataRow -c
170b0 72 65 61 74 65 20 2d 61 6c 69 61 73 20 67 65 74 reate -alias get
170c0 5f 49 74 65 6d 20 24 69 6e 64 65 78 5d 0d 0a 0d _Item $index]...
170d0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
170e0 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 string length $v
170f0 61 6c 75 65 5d 20 3e 20 30 20 26 26 20 5c 0d 0a alue] > 0 && \..
17100 20 20 20 20 20 20 20 20 20 20 20 20 20 20 21 5b ![
17110 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 43 6f object invoke Co
17120 6e 76 65 72 74 20 49 73 44 42 4e 75 6c 6c 20 24 nvert IsDBNull $
17130 76 61 6c 75 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a value]} then {..
17140 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 lapp
17150 65 6e 64 20 72 6f 77 20 5b 6c 69 73 74 20 24 6e end row [list $n
17160 61 6d 65 73 28 24 69 6e 64 65 78 29 20 5b 24 76 ames($index) [$v
17170 61 6c 75 65 20 54 6f 53 74 72 69 6e 67 5d 5d 0d alue ToString]].
17180 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 . } els
17190 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
171a0 20 6c 61 70 70 65 6e 64 20 72 6f 77 20 5b 6c 69 lappend row [li
171b0 73 74 20 24 6e 61 6d 65 73 28 24 69 6e 64 65 78 st $names($index
171c0 29 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d )].. }.
171d0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
171e0 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 72 6f lappend ro
171f0 77 73 20 24 72 6f 77 0d 0a 20 20 20 20 20 20 7d ws $row.. }
17200 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e .... return
17210 20 24 72 6f 77 73 0d 0a 20 20 20 20 7d 0d 0a 0c $rows.. }...
17220 0d 0a 20 20 20 20 70 72 6f 63 20 64 75 6d 70 52 .. proc dumpR
17230 6f 77 73 46 72 6f 6d 44 61 74 61 54 61 62 6c 65 owsFromDataTable
17240 20 7b 20 63 68 61 6e 6e 65 6c 20 72 6f 77 73 20 { channel rows
17250 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 73 } {.. set s
17260 65 71 75 65 6e 63 65 20 31 0d 0a 0d 0a 20 20 20 equence 1....
17270 20 20 20 66 6f 72 65 61 63 68 20 72 6f 77 20 24 foreach row $
17280 72 6f 77 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 rows {..
17290 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
172a0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
172b0 20 20 20 20 20 20 20 20 20 20 5b 65 78 70 72 20 [expr
172c0 7b 24 73 65 71 75 65 6e 63 65 20 3e 20 31 20 3f {$sequence > 1 ?
172d0 20 22 5c 6e 22 20 3a 20 22 22 7d 5d 20 22 2d 2d "\n" : ""}] "--
172e0 2d 2d 20 52 4f 57 20 23 22 20 24 73 65 71 75 65 -- ROW #" $seque
172f0 6e 63 65 20 3a 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 nce :\n]....
17300 20 20 20 20 66 6f 72 65 61 63 68 20 70 61 69 72 foreach pair
17310 20 24 72 6f 77 20 7b 0d 0a 20 20 20 20 20 20 20 $row {..
17320 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 if {[llength
17330 24 70 61 69 72 5d 20 3e 3d 20 32 7d 20 74 68 65 $pair] >= 2} the
17340 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
17350 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
17360 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 74 20 5c [appendArgs \t \
17370 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
17380 20 20 5b 6c 69 73 74 20 5b 6c 69 6e 64 65 78 20 [list [lindex
17390 24 70 61 69 72 20 30 5d 5d 20 22 3a 20 22 20 5b $pair 0]] ": " [
173a0 6c 69 73 74 20 5b 6c 69 6e 64 65 78 20 24 70 61 list [lindex $pa
173b0 69 72 20 31 5d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 ir 1]] \n]..
173c0 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b } elseif {
173d0 5b 6c 6c 65 6e 67 74 68 20 24 70 61 69 72 5d 20 [llength $pair]
173e0 3d 3d 20 31 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 1} then {..
173f0 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
17400 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
17410 41 72 67 73 20 5c 74 20 5c 0d 0a 20 20 20 20 20 Args \t \..
17420 20 20 20 20 20 20 20 20 20 20 20 5b 6c 69 73 74 [list
17430 20 5b 6c 69 6e 64 65 78 20 24 70 61 69 72 20 30 [lindex $pair 0
17440 5d 5d 20 22 3a 20 3c 6e 75 6c 6c 3e 5c 6e 22 5d ]] ": <null>\n"]
17450 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c .. } el
17460 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
17470 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
17480 20 5c 74 3c 65 6d 70 74 79 3e 5c 6e 3b 20 23 20 \t<empty>\n; #
17490 4e 4f 54 45 3a 20 4e 6f 20 64 61 74 61 3f 0d 0a NOTE: No data?..
174a0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
174b0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
174c0 20 20 69 6e 63 72 20 73 65 71 75 65 6e 63 65 0d incr sequence.
174d0 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d . }.. }.
174e0 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 6c 65 .... proc cle
174f0 61 6e 75 70 44 62 20 7b 20 66 69 6c 65 4e 61 6d anupDb { fileNam
17500 65 20 7b 76 61 72 4e 61 6d 65 20 64 62 7d 20 7b e {varName db} {
17510 63 6f 6c 6c 65 63 74 20 74 72 75 65 7d 20 7b 71 collect true} {q
17520 75 61 6c 69 66 79 20 74 72 75 65 7d 0d 0a 20 20 ualify true}..
17530 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
17540 20 20 20 7b 64 65 6c 65 74 65 20 74 72 75 65 7d {delete true}
17550 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
17560 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 # NOTE: Att
17570 65 6d 70 74 20 74 6f 20 66 6f 72 63 65 20 61 6c empt to force al
17580 6c 20 70 65 6e 64 69 6e 67 20 22 67 61 72 62 61 l pending "garba
17590 67 65 22 20 6f 62 6a 65 63 74 73 20 74 6f 20 62 ge" objects to b
175a0 65 20 63 6f 6c 6c 65 63 74 65 64 2c 0d 0a 20 20 e collected,..
175b0 20 20 20 20 23 20 20 20 20 20 20 20 69 6e 63 6c # incl
175c0 75 64 69 6e 67 20 53 51 4c 69 74 65 20 73 74 61 uding SQLite sta
175d0 74 65 6d 65 6e 74 73 20 61 6e 64 20 62 61 63 6b tements and back
175e0 75 70 20 6f 62 6a 65 63 74 73 3b 20 74 68 69 73 up objects; this
175f0 20 73 68 6f 75 6c 64 20 61 6c 6c 6f 77 0d 0a 20 should allow..
17600 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 # the
17610 20 75 6e 64 65 72 6c 79 69 6e 67 20 64 61 74 61 underlying data
17620 62 61 73 65 20 66 69 6c 65 20 74 6f 20 62 65 20 base file to be
17630 64 65 6c 65 74 65 64 2e 0d 0a 20 20 20 20 20 20 deleted...
17640 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 63 6f #.. if {$co
17650 6c 6c 65 63 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 llect} then {..
17660 20 20 20 20 20 20 20 63 6f 6c 6c 65 63 74 47 61 collectGa
17670 72 62 61 67 65 20 24 3a 3a 74 65 73 74 5f 63 68 rbage $::test_ch
17680 61 6e 6e 65 6c 0d 0a 20 20 20 20 20 20 7d 0d 0a annel.. }..
17690 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
176a0 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 20 74 # NOTE: Refer t
176b0 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 o the specified
176c0 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e 20 22 variable (e.g. "
176d0 64 62 22 29 20 69 6e 20 74 68 65 20 63 6f 6e 74 db") in the cont
176e0 65 78 74 20 6f 66 20 6f 75 72 0d 0a 20 20 20 20 ext of our..
176f0 20 20 23 20 20 20 20 20 20 20 63 61 6c 6c 65 72 # caller
17700 2e 20 20 54 68 65 20 68 61 6e 64 6c 65 20 74 6f . The handle to
17710 20 74 68 65 20 64 61 74 61 62 61 73 65 20 70 72 the database pr
17720 65 76 69 6f 75 73 6c 79 20 6f 70 65 6e 65 64 20 eviously opened
17730 76 69 61 20 74 68 65 0d 0a 20 20 20 20 20 20 23 via the.. #
17740 20 20 20 20 20 20 20 5b 73 65 74 75 70 44 62 5d [setupDb]
17750 20 70 72 6f 63 65 64 75 72 65 20 73 68 6f 75 6c procedure shoul
17760 64 20 62 65 20 73 74 6f 72 65 64 20 74 68 65 72 d be stored ther
17770 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e... #..
17780 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 4e upvar 1 $varN
17790 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 20 20 20 20 ame db....
177a0 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
177b0 20 43 6c 6f 73 65 20 74 68 65 20 63 6f 6e 6e 65 Close the conne
177c0 63 74 69 6f 6e 20 74 6f 20 74 68 65 20 64 61 74 ction to the dat
177d0 61 62 61 73 65 20 6e 6f 77 2e 20 20 54 68 69 73 abase now. This
177e0 20 73 68 6f 75 6c 64 20 61 6c 6c 6f 77 20 75 73 should allow us
177f0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
17800 74 6f 20 64 65 6c 65 74 65 20 74 68 65 20 75 6e to delete the un
17810 64 65 72 6c 79 69 6e 67 20 64 61 74 61 62 61 73 derlying databas
17820 65 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 23 e file... #
17830 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 .. if {[inf
17840 6f 20 65 78 69 73 74 73 20 64 62 5d 20 26 26 20 o exists db] &&
17850 5b 63 61 74 63 68 20 7b 73 71 6c 20 63 6c 6f 73 [catch {sql clos
17860 65 20 24 64 62 7d 20 65 72 72 6f 72 5d 7d 20 74 e $db} error]} t
17870 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
17880 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
17890 3a 20 57 65 20 73 6f 6d 65 68 6f 77 20 66 61 69 : We somehow fai
178a0 6c 65 64 20 74 6f 20 63 6c 6f 73 65 20 74 68 65 led to close the
178b0 20 64 61 74 61 62 61 73 65 2c 20 72 65 70 6f 72 database, repor
178c0 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 20 t why...
178d0 23 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 #.. tputs
178e0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
178f0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
17900 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d "===
17910 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 = WARNING: faile
17920 64 20 74 6f 20 63 6c 6f 73 65 20 64 61 74 61 62 d to close datab
17930 61 73 65 20 5c 22 22 20 24 64 62 20 22 5c 22 2c ase \"" $db "\",
17940 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 error: " \..
17950 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 65 \n\t $e
17960 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 rror \n]..
17970 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
17980 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 72 73 # NOTE: Firs
17990 74 2c 20 73 65 65 20 69 66 20 6f 75 72 20 63 61 t, see if our ca
179a0 6c 6c 65 72 20 68 61 73 20 72 65 71 75 65 73 74 ller has request
179b0 65 64 20 61 6e 20 69 6e 2d 6d 65 6d 6f 72 79 20 ed an in-memory
179c0 64 61 74 61 62 61 73 65 2e 0d 0a 20 20 20 20 20 database...
179d0 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 69 73 #.. set is
179e0 4d 65 6d 6f 72 79 20 5b 69 73 4d 65 6d 6f 72 79 Memory [isMemory
179f0 44 62 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 0d Db $fileName]...
17a00 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
17a10 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 # NOTE: Build th
17a20 65 20 66 75 6c 6c 20 70 61 74 68 20 74 6f 20 74 e full path to t
17a30 68 65 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 he database file
17a40 20 6e 61 6d 65 2e 20 20 46 6f 72 20 6e 6f 77 2c name. For now,
17a50 20 61 6c 6c 20 74 65 73 74 0d 0a 20 20 20 20 20 all test..
17a60 20 23 20 20 20 20 20 20 20 64 61 74 61 62 61 73 # databas
17a70 65 20 66 69 6c 65 73 20 61 72 65 20 73 74 6f 72 e files are stor
17a80 65 64 20 69 6e 20 74 68 65 20 74 65 6d 70 6f 72 ed in the tempor
17a90 61 72 79 20 64 69 72 65 63 74 6f 72 79 2e 0d 0a ary directory...
17aa0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
17ab0 66 20 7b 21 24 69 73 4d 65 6d 6f 72 79 20 26 26 f {!$isMemory &&
17ac0 20 24 71 75 61 6c 69 66 79 7d 20 74 68 65 6e 20 $qualify} then
17ad0 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 66 {.. set f
17ae0 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f ileName [file jo
17af0 69 6e 20 5b 67 65 74 44 61 74 61 62 61 73 65 44 in [getDatabaseD
17b00 69 72 65 63 74 6f 72 79 5d 20 5b 66 69 6c 65 20 irectory] [file
17b10 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d 65 5d 5d tail $fileName]]
17b20 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
17b30 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
17b40 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 65 TE: Check if the
17b50 20 66 69 6c 65 20 73 74 69 6c 6c 20 65 78 69 73 file still exis
17b60 74 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ts... #..
17b70 20 20 20 20 69 66 20 7b 21 24 69 73 4d 65 6d 6f if {!$isMemo
17b80 72 79 20 26 26 20 24 64 65 6c 65 74 65 20 26 26 ry && $delete &&
17b90 20 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 [file exists $f
17ba0 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b ileName]} then {
17bb0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
17bc0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 # NOTE: Ski
17bd0 70 20 64 65 6c 65 74 69 6e 67 20 64 61 74 61 62 p deleting datab
17be0 61 73 65 20 66 69 6c 65 73 20 69 66 20 73 6f 6d ase files if som
17bf0 65 62 6f 64 79 20 73 65 74 73 20 74 68 65 20 67 ebody sets the g
17c00 6c 6f 62 61 6c 0d 0a 20 20 20 20 20 20 20 20 23 lobal.. #
17c10 20 20 20 20 20 20 20 76 61 72 69 61 62 6c 65 20 variable
17c20 74 6f 20 70 72 65 76 65 6e 74 20 69 74 2e 0d 0a to prevent it...
17c30 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
17c40 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
17c50 69 73 74 73 20 3a 3a 6e 6f 28 63 6c 65 61 6e 75 ists ::no(cleanu
17c60 70 44 62 46 69 6c 65 29 5d 7d 20 74 68 65 6e 20 pDbFile)]} then
17c70 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a {.. #..
17c80 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
17c90 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 64 65 6c : Attempt to del
17ca0 65 74 65 20 74 68 65 20 74 65 73 74 20 64 61 74 ete the test dat
17cb0 61 62 61 73 65 20 66 69 6c 65 20 6e 6f 77 2e 0d abase file now..
17cc0 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
17cd0 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 65 74 if {[set
17ce0 20 63 6f 64 65 20 5b 63 61 74 63 68 20 7b 66 69 code [catch {fi
17cf0 6c 65 20 64 65 6c 65 74 65 20 24 66 69 6c 65 4e le delete $fileN
17d00 61 6d 65 7d 20 65 72 72 6f 72 5d 5d 7d 20 74 68 ame} error]]} th
17d10 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
17d20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
17d30 20 23 20 4e 4f 54 45 3a 20 57 65 20 73 6f 6d 65 # NOTE: We some
17d40 68 6f 77 20 66 61 69 6c 65 64 20 74 6f 20 64 65 how failed to de
17d50 6c 65 74 65 20 74 68 65 20 66 69 6c 65 2c 20 72 lete the file, r
17d60 65 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 eport why...
17d70 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
17d80 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
17d90 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
17da0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
17db0 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d "===
17dc0 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 = WARNING: faile
17dd0 64 20 74 6f 20 64 65 6c 65 74 65 20 64 61 74 61 d to delete data
17de0 62 61 73 65 20 66 69 6c 65 20 5c 22 22 20 24 66 base file \"" $f
17df0 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 ileName \..
17e00 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 64 "\" d
17e10 75 72 69 6e 67 20 63 6c 65 61 6e 75 70 2c 20 65 uring cleanup, e
17e20 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 rror: " \n\t $er
17e30 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ror \n]..
17e40 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 }.. }
17e50 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
17e60 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
17e70 20 4e 4f 54 45 3a 20 53 68 6f 77 20 74 68 61 74 NOTE: Show that
17e80 20 77 65 20 73 6b 69 70 70 65 64 20 64 65 6c 65 we skipped dele
17e90 74 69 6e 67 20 74 68 65 20 66 69 6c 65 2e 0d 0a ting the file...
17ea0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
17eb0 20 20 20 20 20 20 20 73 65 74 20 63 6f 64 65 20 set code
17ec0 30 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 74 0.... t
17ed0 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
17ee0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
17ef0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
17f00 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a "==== WARNING:
17f10 20 73 6b 69 70 70 65 64 20 64 65 6c 65 74 69 6e skipped deletin
17f20 67 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 g database file
17f30 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 0d \"" $fileName \.
17f40 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
17f50 5c 22 20 64 75 72 69 6e 67 20 63 6c 65 61 6e 75 \" during cleanu
17f60 70 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d p\n"].. }
17f70 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
17f80 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
17f90 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 # NOTE: The
17fa0 20 66 69 6c 65 20 64 6f 65 73 20 6e 6f 74 20 65 file does not e
17fb0 78 69 73 74 2c 20 73 75 63 63 65 73 73 21 0d 0a xist, success!..
17fc0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
17fd0 20 20 20 73 65 74 20 63 6f 64 65 20 30 0d 0a 20 set code 0..
17fe0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
17ff0 72 65 74 75 72 6e 20 24 63 6f 64 65 0d 0a 20 20 return $code..
18000 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
18010 20 73 61 76 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 saveEnvironment
18020 56 61 72 69 61 62 6c 65 73 20 7b 20 6e 61 6d 65 Variables { name
18030 73 20 7b 76 61 72 4e 61 6d 65 20 22 22 7d 20 7d s {varName ""} }
18040 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
18050 20 20 20 23 20 4e 4f 54 45 3a 20 46 6f 72 20 65 # NOTE: For e
18060 61 63 68 20 6e 61 6d 65 2c 20 64 6f 65 73 20 74 ach name, does t
18070 68 65 20 6c 69 76 65 20 65 6e 76 69 72 6f 6e 6d he live environm
18080 65 6e 74 20 76 61 72 69 61 62 6c 65 20 65 78 69 ent variable exi
18090 73 74 3f 20 20 49 66 0d 0a 20 20 20 20 20 20 23 st? If.. #
180a0 20 20 20 20 20 20 20 73 6f 2c 20 73 61 76 65 20 so, save
180b0 74 68 65 20 76 61 6c 75 65 20 66 6f 72 20 6c 61 the value for la
180c0 74 65 72 3b 20 6f 74 68 65 72 77 69 73 65 2c 20 ter; otherwise,
180d0 6d 61 6b 65 20 73 75 72 65 20 74 68 65 20 73 61 make sure the sa
180e0 76 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ved.. #
180f0 20 20 20 76 61 6c 75 65 20 64 6f 65 73 20 6e 6f value does no
18100 74 20 65 78 69 73 74 20 65 69 74 68 65 72 2e 20 t exist either.
18110 20 54 68 65 20 6c 69 76 65 20 65 6e 76 69 72 6f The live enviro
18120 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 73 0d nment variables.
18130 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 41 . # A
18140 52 45 20 4e 4f 54 20 63 68 61 6e 67 65 64 20 62 RE NOT changed b
18150 79 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 y this procedure
18160 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
18170 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
18180 6e 67 74 68 20 24 76 61 72 4e 61 6d 65 5d 20 3d ngth $varName] =
18190 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
181a0 20 20 20 20 20 73 65 74 20 76 61 72 4e 61 6d 65 set varName
181b0 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 20 savedEnv..
181c0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 75 70 76 61 }.... upva
181d0 72 20 31 20 24 76 61 72 4e 61 6d 65 20 73 61 76 r 1 $varName sav
181e0 65 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 66 edEnv.... f
181f0 6f 72 65 61 63 68 20 6e 61 6d 65 20 24 6e 61 6d oreach name $nam
18200 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 es {.. if
18210 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {[info exists :
18220 3a 65 6e 76 28 24 6e 61 6d 65 29 5d 7d 20 74 68 :env($name)]} th
18230 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
18240 73 65 74 20 73 61 76 65 64 45 6e 76 28 24 6e 61 set savedEnv($na
18250 6d 65 29 20 24 3a 3a 65 6e 76 28 24 6e 61 6d 65 me) $::env($name
18260 29 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 ).. } els
18270 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 75 e {.. u
18280 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e nset -nocomplain
18290 20 73 61 76 65 64 45 6e 76 28 24 6e 61 6d 65 29 savedEnv($name)
182a0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
182b0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
182c0 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 . # NOTE: T
182d0 68 69 73 20 69 73 20 73 65 6c 66 2d 63 6c 65 61 his is self-clea
182e0 6e 69 6e 67 2e 20 20 49 66 20 6e 6f 20 73 61 76 ning. If no sav
182f0 65 64 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 ed environment v
18300 61 72 69 61 62 6c 65 73 20 6e 6f 77 0d 0a 20 20 ariables now..
18310 20 20 20 20 23 20 20 20 20 20 20 20 65 78 69 73 # exis
18320 74 2c 20 72 65 6d 6f 76 65 20 74 68 65 20 61 72 t, remove the ar
18330 72 61 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ray... #..
18340 20 20 20 20 20 69 66 20 7b 5b 61 72 72 61 79 20 if {[array
18350 73 69 7a 65 20 73 61 76 65 64 45 6e 76 5d 20 3d size savedEnv] =
18360 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
18370 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f unset -noco
18380 6d 70 6c 61 69 6e 20 73 61 76 65 64 45 6e 76 0d mplain savedEnv.
18390 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d . }.. }.
183a0 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 65 73 .... proc res
183b0 74 6f 72 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 toreEnvironmentV
183c0 61 72 69 61 62 6c 65 73 20 7b 20 6e 61 6d 65 73 ariables { names
183d0 20 7b 76 61 72 4e 61 6d 65 20 22 22 7d 20 7d 20 {varName ""} }
183e0 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
183f0 20 20 23 20 4e 4f 54 45 3a 20 46 6f 72 20 65 61 # NOTE: For ea
18400 63 68 20 6e 61 6d 65 2c 20 64 6f 65 73 20 74 68 ch name, does th
18410 65 20 73 61 76 65 64 20 65 6e 76 69 72 6f 6e 6d e saved environm
18420 65 6e 74 20 76 61 72 69 61 62 6c 65 20 65 78 69 ent variable exi
18430 73 74 3f 20 20 49 66 0d 0a 20 20 20 20 20 20 23 st? If.. #
18440 20 20 20 20 20 20 20 73 6f 2c 20 72 65 73 74 6f so, resto
18450 72 65 20 74 68 65 20 73 61 76 65 64 20 76 61 6c re the saved val
18460 75 65 20 61 6e 64 20 75 6e 73 65 74 20 69 74 3b ue and unset it;
18470 20 6f 74 68 65 72 77 69 73 65 2c 20 6d 61 6b 65 otherwise, make
18480 20 73 75 72 65 0d 0a 20 20 20 20 20 20 23 20 20 sure.. #
18490 20 20 20 20 20 74 68 65 20 6c 69 76 65 20 65 6e the live en
184a0 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 vironment variab
184b0 6c 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 le does not exis
184c0 74 20 65 69 74 68 65 72 20 28 69 2e 65 2e 20 69 t either (i.e. i
184d0 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 t.. #
184e0 20 77 61 73 20 6e 6f 74 20 73 65 74 20 74 6f 20 was not set to
184f0 62 65 67 69 6e 20 77 69 74 68 29 2e 20 20 42 6f begin with). Bo
18500 74 68 20 73 61 76 65 64 20 61 6e 64 20 6c 69 76 th saved and liv
18510 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0d 0a 20 e environment..
18520 20 20 20 20 20 23 20 20 20 20 20 20 20 76 61 72 # var
18530 69 61 62 6c 65 73 20 41 52 45 20 63 68 61 6e 67 iables ARE chang
18540 65 64 20 62 79 20 74 68 69 73 20 70 72 6f 63 65 ed by this proce
18550 64 75 72 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a dure... #..
18560 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
18570 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 6d g length $varNam
18580 65 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d e] == 0} then {.
18590 0a 20 20 20 20 20 20 20 20 73 65 74 20 76 61 72 . set var
185a0 4e 61 6d 65 20 73 61 76 65 64 45 6e 76 0d 0a 20 Name savedEnv..
185b0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
185c0 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 upvar 1 $varName
185d0 20 73 61 76 65 64 45 6e 76 0d 0a 0d 0a 20 20 20 savedEnv....
185e0 20 20 20 66 6f 72 65 61 63 68 20 6e 61 6d 65 20 foreach name
185f0 24 6e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 $names {..
18600 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
18610 74 73 20 73 61 76 65 64 45 6e 76 28 24 6e 61 6d ts savedEnv($nam
18620 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 e)]} then {..
18630 20 20 20 20 20 20 20 73 65 74 20 3a 3a 65 6e 76 set ::env
18640 28 24 6e 61 6d 65 29 20 24 73 61 76 65 64 45 6e ($name) $savedEn
18650 76 28 24 6e 61 6d 65 29 0d 0a 20 20 20 20 20 20 v($name)..
18660 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d unset -nocom
18670 70 6c 61 69 6e 20 73 61 76 65 64 45 6e 76 28 24 plain savedEnv($
18680 6e 61 6d 65 29 0d 0a 20 20 20 20 20 20 20 20 7d name).. }
18690 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
186a0 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 unset -nocomp
186b0 6c 61 69 6e 20 3a 3a 65 6e 76 28 24 6e 61 6d 65 lain ::env($name
186c0 29 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 ).. }..
186d0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 }.... #
186e0 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
186f0 54 68 69 73 20 69 73 20 73 65 6c 66 2d 63 6c 65 This is self-cle
18700 61 6e 69 6e 67 2e 20 20 49 66 20 6e 6f 20 73 61 aning. If no sa
18710 76 65 64 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 ved environment
18720 76 61 72 69 61 62 6c 65 73 20 6e 6f 77 0d 0a 20 variables now..
18730 20 20 20 20 20 23 20 20 20 20 20 20 20 65 78 69 # exi
18740 73 74 2c 20 72 65 6d 6f 76 65 20 74 68 65 20 61 st, remove the a
18750 72 72 61 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a rray... #..
18760 20 20 20 20 20 20 69 66 20 7b 5b 61 72 72 61 79 if {[array
18770 20 73 69 7a 65 20 73 61 76 65 64 45 6e 76 5d 20 size savedEnv]
18780 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
18790 20 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 unset -noc
187a0 6f 6d 70 6c 61 69 6e 20 73 61 76 65 64 45 6e 76 omplain savedEnv
187b0 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
187c0 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 73 61 ..... proc sa
187d0 76 65 47 65 74 53 65 74 74 69 6e 67 56 61 6c 75 veGetSettingValu
187e0 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 7b 7d 20 eEnvironment {}
187f0 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 {.. upvar 1
18800 20 73 61 76 65 64 45 6e 76 20 73 61 76 65 64 45 savedEnv savedE
18810 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 73 61 76 65 nv.... save
18820 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 61 EnvironmentVaria
18830 62 6c 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 bles [list \..
18840 20 20 20 20 20 20 20 20 4e 6f 5f 45 78 70 61 6e No_Expan
18850 64 20 4e 6f 5f 53 51 4c 69 74 65 47 65 74 53 65 d No_SQLiteGetSe
18860 74 74 69 6e 67 56 61 6c 75 65 20 4e 6f 5f 53 51 ttingValue No_SQ
18870 4c 69 74 65 58 6d 6c 43 6f 6e 66 69 67 46 69 6c LiteXmlConfigFil
18880 65 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 e] \..
18890 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 7d 0d savedEnv.. }.
188a0 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 65 73 .... proc res
188b0 74 6f 72 65 47 65 74 53 65 74 74 69 6e 67 56 61 toreGetSettingVa
188c0 6c 75 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 7b lueEnvironment {
188d0 7d 20 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 72 } {.. upvar
188e0 20 31 20 73 61 76 65 64 45 6e 76 20 73 61 76 65 1 savedEnv save
188f0 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 72 65 dEnv.... re
18900 73 74 6f 72 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 storeEnvironment
18910 56 61 72 69 61 62 6c 65 73 20 5b 6c 69 73 74 20 Variables [list
18920 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 4e 6f 5f \.. No_
18930 45 78 70 61 6e 64 20 4e 6f 5f 53 51 4c 69 74 65 Expand No_SQLite
18940 47 65 74 53 65 74 74 69 6e 67 56 61 6c 75 65 20 GetSettingValue
18950 4e 6f 5f 53 51 4c 69 74 65 58 6d 6c 43 6f 6e 66 No_SQLiteXmlConf
18960 69 67 46 69 6c 65 5d 20 5c 0d 0a 20 20 20 20 20 igFile] \..
18970 20 20 20 20 20 73 61 76 65 64 45 6e 76 0d 0a 20 savedEnv..
18980 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
18990 63 20 73 61 76 65 53 51 4c 69 74 65 43 6f 6e 6e c saveSQLiteConn
189a0 65 63 74 69 6f 6e 45 6e 76 69 72 6f 6e 6d 65 6e ectionEnvironmen
189b0 74 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 75 70 t {} {.. up
189c0 76 61 72 20 31 20 73 61 76 65 64 45 6e 76 20 73 var 1 savedEnv s
189d0 61 76 65 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 avedEnv....
189e0 20 73 61 76 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 saveEnvironment
189f0 56 61 72 69 61 62 6c 65 73 20 5b 6c 69 73 74 20 Variables [list
18a00 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 44 65 66 \.. Def
18a10 61 75 6c 74 46 6c 61 67 73 5f 53 51 4c 69 74 65 aultFlags_SQLite
18a20 43 6f 6e 6e 65 63 74 69 6f 6e 20 4e 6f 5f 53 51 Connection No_SQ
18a30 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 4e 65 LiteConnectionNe
18a40 77 50 61 72 73 65 72 5d 20 5c 0d 0a 20 20 20 20 wParser] \..
18a50 20 20 20 20 20 20 73 61 76 65 64 45 6e 76 0d 0a savedEnv..
18a60 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
18a70 6f 63 20 72 65 73 74 6f 72 65 53 51 4c 69 74 65 oc restoreSQLite
18a80 43 6f 6e 6e 65 63 74 69 6f 6e 45 6e 76 69 72 6f ConnectionEnviro
18a90 6e 6d 65 6e 74 20 7b 7d 20 7b 0d 0a 20 20 20 20 nment {} {..
18aa0 20 20 75 70 76 61 72 20 31 20 73 61 76 65 64 45 upvar 1 savedE
18ab0 6e 76 20 73 61 76 65 64 45 6e 76 0d 0a 0d 0a 20 nv savedEnv....
18ac0 20 20 20 20 20 72 65 73 74 6f 72 65 45 6e 76 69 restoreEnvi
18ad0 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 6c 65 73 ronmentVariables
18ae0 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 [list \..
18af0 20 20 20 20 44 65 66 61 75 6c 74 46 6c 61 67 73 DefaultFlags
18b00 5f 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f _SQLiteConnectio
18b10 6e 20 4e 6f 5f 53 51 4c 69 74 65 43 6f 6e 6e 65 n No_SQLiteConne
18b20 63 74 69 6f 6e 4e 65 77 50 61 72 73 65 72 5d 20 ctionNewParser]
18b30 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 73 61 76 \.. sav
18b40 65 64 45 6e 76 0d 0a 20 20 20 20 7d 0d 0a 0c 0d edEnv.. }....
18b50 0a 20 20 20 20 70 72 6f 63 20 73 61 76 65 53 51 . proc saveSQ
18b60 4c 69 74 65 43 6f 6e 76 65 72 74 45 6e 76 69 72 LiteConvertEnvir
18b70 6f 6e 6d 65 6e 74 20 7b 7d 20 7b 0d 0a 20 20 20 onment {} {..
18b80 20 20 20 75 70 76 61 72 20 31 20 73 61 76 65 64 upvar 1 saved
18b90 45 6e 76 20 73 61 76 65 64 45 6e 76 0d 0a 0d 0a Env savedEnv....
18ba0 20 20 20 20 20 20 73 61 76 65 45 6e 76 69 72 6f saveEnviro
18bb0 6e 6d 65 6e 74 56 61 72 69 61 62 6c 65 73 20 5b nmentVariables [
18bc0 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 list \..
18bd0 20 20 55 73 65 5f 53 51 4c 69 74 65 43 6f 6e 76 Use_SQLiteConv
18be0 65 72 74 5f 44 65 66 61 75 6c 74 44 62 54 79 70 ert_DefaultDbTyp
18bf0 65 20 55 73 65 5f 53 51 4c 69 74 65 43 6f 6e 76 e Use_SQLiteConv
18c00 65 72 74 5f 44 65 66 61 75 6c 74 54 79 70 65 4e ert_DefaultTypeN
18c10 61 6d 65 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 ame] \..
18c20 20 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 savedEnv..
18c30 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 }..... proc r
18c40 65 73 74 6f 72 65 53 51 4c 69 74 65 43 6f 6e 76 estoreSQLiteConv
18c50 65 72 74 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 7b ertEnvironment {
18c60 7d 20 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 72 } {.. upvar
18c70 20 31 20 73 61 76 65 64 45 6e 76 20 73 61 76 65 1 savedEnv save
18c80 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 72 65 dEnv.... re
18c90 73 74 6f 72 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 storeEnvironment
18ca0 56 61 72 69 61 62 6c 65 73 20 5b 6c 69 73 74 20 Variables [list
18cb0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 55 73 65 \.. Use
18cc0 5f 53 51 4c 69 74 65 43 6f 6e 76 65 72 74 5f 44 _SQLiteConvert_D
18cd0 65 66 61 75 6c 74 44 62 54 79 70 65 20 55 73 65 efaultDbType Use
18ce0 5f 53 51 4c 69 74 65 43 6f 6e 76 65 72 74 5f 44 _SQLiteConvert_D
18cf0 65 66 61 75 6c 74 54 79 70 65 4e 61 6d 65 5d 20 efaultTypeName]
18d00 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 73 61 76 \.. sav
18d10 65 64 45 6e 76 0d 0a 20 20 20 20 7d 0d 0a 0c 0d edEnv.. }....
18d20 0a 20 20 20 20 70 72 6f 63 20 73 65 74 75 70 44 . proc setupD
18d30 62 49 6e 74 65 72 72 75 70 74 43 61 6c 6c 62 61 bInterruptCallba
18d40 63 6b 20 7b 20 63 68 61 6e 6e 65 6c 20 6c 6f 67 ck { channel log
18d50 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 70 75 74 } {.. tput
18d60 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d s $channel "----
18d70 20 73 65 74 74 69 6e 67 20 75 70 20 64 65 62 75 setting up debu
18d80 67 67 65 72 20 69 6e 74 65 72 72 75 70 74 20 63 gger interrupt c
18d90 61 6c 6c 62 61 63 6b 2e 2e 2e 20 22 0d 0a 0d 0a allback... "....
18da0 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
18db0 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 61 76 65 {.. save
18dc0 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 61 EnvironmentVaria
18dd0 62 6c 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 bles [list \..
18de0 20 20 20 20 20 20 20 20 20 20 71 75 69 65 74 46 quietF
18df0 69 6e 64 49 6e 74 65 72 70 72 65 74 65 72 54 65 indInterpreterTe
18e00 73 74 50 61 74 68 20 71 75 69 65 74 53 65 74 75 stPath quietSetu
18e10 70 49 6e 74 65 72 70 72 65 74 65 72 54 65 73 74 pInterpreterTest
18e20 50 61 74 68 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 Path]....
18e30 20 74 72 79 20 7b 0d 0a 20 20 20 20 20 20 20 20 try {..
18e40 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
18e50 20 4e 4f 54 45 3a 20 50 72 65 76 65 6e 74 20 74 NOTE: Prevent t
18e60 68 65 20 76 65 6e 64 6f 72 20 73 63 72 69 70 74 he vendor script
18e70 20 66 72 6f 6d 20 62 65 69 6e 67 20 6e 6f 69 73 from being nois
18e80 79 20 77 68 65 6e 20 63 72 65 61 74 69 6e 67 0d y when creating.
18e90 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
18ea0 20 20 20 74 68 65 20 69 73 6f 6c 61 74 65 64 20 the isolated
18eb0 69 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 interpreter...
18ec0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
18ed0 20 20 20 20 20 73 65 74 20 3a 3a 65 6e 76 28 71 set ::env(q
18ee0 75 69 65 74 46 69 6e 64 49 6e 74 65 72 70 72 65 uietFindInterpre
18ef0 74 65 72 54 65 73 74 50 61 74 68 29 20 31 0d 0a terTestPath) 1..
18f00 20 20 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a set ::
18f10 65 6e 76 28 71 75 69 65 74 53 65 74 75 70 49 6e env(quietSetupIn
18f20 74 65 72 70 72 65 74 65 72 54 65 73 74 50 61 74 terpreterTestPat
18f30 68 29 20 31 0d 0a 0d 0a 20 20 20 20 20 20 20 20 h) 1....
18f40 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
18f50 20 4e 4f 54 45 3a 20 4d 61 6b 65 20 73 75 72 65 NOTE: Make sure
18f60 20 74 68 65 20 73 63 72 69 70 74 20 64 65 62 75 the script debu
18f70 67 67 65 72 20 61 6e 64 20 74 68 65 20 69 73 6f gger and the iso
18f80 6c 61 74 65 64 20 69 6e 74 65 72 70 72 65 74 65 lated interprete
18f90 72 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 r.. #
18fa0 20 20 20 20 20 61 72 65 20 73 65 74 75 70 20 61 are setup a
18fb0 6e 64 20 72 65 61 64 79 20 66 6f 72 20 75 73 65 nd ready for use
18fc0 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
18fd0 20 20 20 20 20 20 20 20 20 20 64 65 62 75 67 20 debug
18fe0 73 65 74 75 70 20 74 72 75 65 20 74 72 75 65 0d setup true true.
18ff0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
19000 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
19010 3a 20 4c 6f 61 64 20 74 68 65 20 6e 65 63 65 73 : Load the neces
19020 73 61 72 79 20 70 61 63 6b 61 67 65 73 20 69 6e sary packages in
19030 74 6f 20 74 68 65 20 69 73 6f 6c 61 74 65 64 20 to the isolated
19040 69 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 interpreter...
19050 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
19060 20 20 20 20 20 64 65 62 75 67 20 65 76 61 6c 20 debug eval
19070 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 70 {.. p
19080 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 45 ackage require E
19090 61 67 6c 65 0d 0a 20 20 20 20 20 20 20 20 20 20 agle..
190a0 20 20 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 package requir
190b0 65 20 45 61 67 6c 65 2e 4c 69 62 72 61 72 79 0d e Eagle.Library.
190c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 70 61 63 . pac
190d0 6b 61 67 65 20 72 65 71 75 69 72 65 20 45 61 67 kage require Eag
190e0 6c 65 2e 54 65 73 74 0d 0a 20 20 20 20 20 20 20 le.Test..
190f0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
19100 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
19110 20 4e 4f 54 45 3a 20 43 6f 70 79 20 74 68 65 20 NOTE: Copy the
19120 6e 65 63 65 73 73 61 72 79 20 76 61 72 69 61 62 necessary variab
19130 6c 65 73 20 69 6e 74 6f 20 74 68 65 20 69 73 6f les into the iso
19140 6c 61 74 65 64 20 69 6e 74 65 72 70 72 65 74 65 lated interprete
19150 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d r... #.
19160 0a 20 20 20 20 20 20 20 20 20 20 64 65 62 75 67 . debug
19170 20 69 6e 76 6f 6b 65 20 30 20 73 65 74 20 3a 3a invoke 0 set ::
19180 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 63 68 test_channel $ch
19190 61 6e 6e 65 6c 3b 20 23 20 4e 4f 54 45 3a 20 46 annel; # NOTE: F
191a0 6f 72 20 5b 74 70 75 74 73 5d 2e 0d 0a 20 20 20 or [tputs]...
191b0 20 20 20 20 20 20 20 64 65 62 75 67 20 69 6e 76 debug inv
191c0 6f 6b 65 20 30 20 73 65 74 20 3a 3a 74 65 73 74 oke 0 set ::test
191d0 5f 6c 6f 67 20 24 6c 6f 67 3b 20 23 20 4e 4f 54 _log $log; # NOT
191e0 45 3a 20 46 6f 72 20 5b 74 6c 6f 67 5d 2e 0d 0a E: For [tlog]...
191f0 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
19200 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
19210 20 49 6e 73 74 61 6c 6c 20 74 68 65 20 63 61 6c Install the cal
19220 6c 62 61 63 6b 20 73 63 72 69 70 74 20 74 6f 20 lback script to
19230 62 65 20 65 76 61 6c 75 61 74 65 64 20 69 6e 20 be evaluated in
19240 74 68 65 20 69 73 6f 6c 61 74 65 64 0d 0a 20 20 the isolated..
19250 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
19260 69 6e 74 65 72 70 72 65 74 65 72 20 77 68 65 6e interpreter when
19270 20 74 68 69 73 20 69 6e 74 65 72 70 72 65 74 65 this interprete
19280 72 20 69 73 20 69 6e 74 65 72 72 75 70 74 65 64 r is interrupted
19290 20 62 79 20 73 63 72 69 70 74 0d 0a 20 20 20 20 by script..
192a0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 61 # ca
192b0 6e 63 65 6c 6c 61 74 69 6f 6e 2c 20 65 74 63 2e ncellation, etc.
192c0 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
192d0 20 20 20 20 20 20 20 20 20 64 65 62 75 67 20 63 debug c
192e0 61 6c 6c 62 61 63 6b 20 61 70 70 6c 79 20 7b 7b allback apply {{
192f0 73 65 6e 64 65 72 20 65 7d 20 7b 0d 0a 20 20 20 sender e} {..
19300 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
19310 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
19320 43 68 65 63 6b 20 69 66 20 74 68 69 73 20 64 65 Check if this de
19330 62 75 67 67 65 72 20 63 61 6c 6c 62 61 63 6b 20 bugger callback
19340 69 73 20 6f 6e 65 20 74 68 61 74 20 77 65 20 63 is one that we c
19350 61 72 65 20 61 62 6f 75 74 2e 0d 0a 20 20 20 20 are about...
19360 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
19370 20 20 20 20 20 20 20 73 65 74 20 69 6e 74 65 72 set inter
19380 72 75 70 74 54 79 70 65 73 20 5b 73 70 6c 69 74 ruptTypes [split
19390 20 5b 24 65 20 49 6e 74 65 72 72 75 70 74 54 79 [$e InterruptTy
193a0 70 65 5d 20 22 2c 20 22 5d 0d 0a 0d 0a 20 20 20 pe] ", "]....
193b0 20 20 20 20 20 20 20 20 20 69 66 20 7b 22 43 61 if {"Ca
193c0 6e 63 65 6c 65 64 22 20 69 6e 20 24 69 6e 74 65 nceled" in $inte
193d0 72 72 75 70 74 54 79 70 65 73 20 7c 7c 20 5c 0d rruptTypes || \.
193e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
193f0 20 22 55 6e 77 6f 75 6e 64 22 20 69 6e 20 24 69 "Unwound" in $i
19400 6e 74 65 72 72 75 70 74 54 79 70 65 73 7d 20 74 nterruptTypes} t
19410 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
19420 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
19430 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4d 61 # NOTE: Ma
19440 6b 65 20 73 75 72 65 20 74 68 65 20 5b 6f 62 6a ke sure the [obj
19450 65 63 74 5d 20 63 6f 6d 6d 61 6e 64 20 69 73 20 ect] command is
19460 61 76 61 69 6c 61 62 6c 65 2e 20 20 53 69 6e 63 available. Sinc
19470 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e..
19480 20 23 20 20 20 20 20 20 20 74 68 69 73 20 69 73 # this is
19490 20 61 6e 20 69 73 6f 6c 61 74 65 64 20 69 6e 74 an isolated int
194a0 65 72 70 72 65 74 65 72 2c 20 63 68 65 63 6b 20 erpreter, check
194b0 66 6f 72 20 69 74 20 74 68 65 20 68 61 72 64 0d for it the hard.
194c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
194d0 20 20 20 20 20 20 20 77 61 79 2e 0d 0a 20 20 20 way...
194e0 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
194f0 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
19500 5b 6c 6c 65 6e 67 74 68 20 5b 69 6e 66 6f 20 63 [llength [info c
19510 6f 6d 6d 61 6e 64 73 20 6f 62 6a 65 63 74 5d 5d ommands object]]
19520 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
19530 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
19540 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
19550 20 23 20 4e 4f 54 45 3a 20 49 74 65 72 61 74 65 # NOTE: Iterate
19560 20 74 68 72 6f 75 67 68 20 61 6c 6c 20 64 61 74 through all dat
19570 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e abase connection
19580 73 20 6b 6e 6f 77 6e 20 74 6f 20 74 68 65 0d 0a s known to the..
19590 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
195a0 23 20 20 20 20 20 20 20 70 61 72 65 6e 74 20 69 # parent i
195b0 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 nterpreter...
195c0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
195d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
195e0 6f 62 6a 65 63 74 20 66 6f 72 65 61 63 68 20 2d object foreach -
195f0 61 6c 69 61 73 20 70 61 69 72 20 5b 6f 62 6a 65 alias pair [obje
19600 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
19610 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 +NonPublic \..
19620 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19630 20 20 20 24 65 20 49 6e 74 65 72 70 72 65 74 65 $e Interprete
19640 72 2e 63 6f 6e 6e 65 63 74 69 6f 6e 73 5d 20 7b r.connections] {
19650 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
19660 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
19670 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
19680 20 41 74 74 65 6d 70 74 20 74 6f 20 63 61 6e 63 Attempt to canc
19690 65 6c 20 61 6e 79 20 53 51 4c 20 71 75 65 72 69 el any SQL queri
196a0 65 73 20 69 6e 20 70 72 6f 67 72 65 73 73 20 6f es in progress o
196b0 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 n..
196c0 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 69 # thi
196d0 73 20 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 s database conne
196e0 63 74 69 6f 6e 2e 0d 0a 20 20 20 20 20 20 20 20 ction...
196f0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
19700 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 i
19710 66 20 7b 5b 63 61 74 63 68 20 7b 24 70 61 69 72 f {[catch {$pair
19720 20 56 61 6c 75 65 2e 43 61 6e 63 65 6c 7d 20 65 Value.Cancel} e
19730 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 rror]} then {..
19740 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19750 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
19760 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
19770 41 72 67 73 20 5c 6e 20 5c 0d 0a 20 20 20 20 20 Args \n \..
19780 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19790 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 "==== WARNING
197a0 3a 20 66 61 69 6c 65 64 20 74 6f 20 63 61 6e 63 : failed to canc
197b0 65 6c 20 71 75 65 72 79 20 66 6f 72 20 22 20 5c el query for " \
197c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
197d0 20 20 20 20 20 20 20 20 20 20 22 63 6f 6e 6e 65 "conne
197e0 63 74 69 6f 6e 20 5c 22 22 20 5b 24 70 61 69 72 ction \"" [$pair
197f0 20 4b 65 79 5d 20 22 5c 22 2c 20 65 72 72 6f 72 Key] "\", error
19800 3a 20 22 20 5c 6e 5c 74 20 5c 0d 0a 20 20 20 20 : " \n\t \..
19810 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19820 20 20 20 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a $error \n]..
19830 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19840 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
19850 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
19860 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
19870 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19880 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
19890 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
198a0 73 20 5c 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 s \n \..
198b0 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d "===
198c0 3d 20 57 41 52 4e 49 4e 47 3a 20 63 61 6e 6e 6f = WARNING: canno
198d0 74 20 63 61 6e 63 65 6c 20 61 6e 79 20 71 75 65 t cancel any que
198e0 72 69 65 73 3a 20 22 20 5c 0d 0a 20 20 20 20 20 ries: " \..
198f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
19900 74 68 65 20 5c 22 6f 62 6a 65 63 74 5c 22 20 63 the \"object\" c
19910 6f 6d 6d 61 6e 64 20 69 73 20 6e 6f 74 20 61 76 ommand is not av
19920 61 69 6c 61 62 6c 65 5c 6e 22 5d 0d 0a 20 20 20 ailable\n"]..
19930 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
19940 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
19950 20 20 20 20 20 20 20 7d 7d 0d 0a 20 20 20 20 20 }}..
19960 20 20 20 7d 20 66 69 6e 61 6c 6c 79 20 7b 0d 0a } finally {..
19970 20 20 20 20 20 20 20 20 20 20 72 65 73 74 6f 72 restor
19980 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 eEnvironmentVari
19990 61 62 6c 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 ables [list \..
199a0 20 20 20 20 20 20 20 20 20 20 20 20 20 71 75 69 qui
199b0 65 74 46 69 6e 64 49 6e 74 65 72 70 72 65 74 65 etFindInterprete
199c0 72 54 65 73 74 50 61 74 68 20 71 75 69 65 74 53 rTestPath quietS
199d0 65 74 75 70 49 6e 74 65 72 70 72 65 74 65 72 54 etupInterpreterT
199e0 65 73 74 50 61 74 68 5d 0d 0a 20 20 20 20 20 20 estPath]..
199f0 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 72 72 }.. } err
19a00 6f 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b or] == 0} then {
19a10 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e .. addCon
19a20 73 74 72 61 69 6e 74 20 69 6e 74 65 72 72 75 70 straint interrup
19a30 74 43 61 6c 6c 62 61 63 6b 2e 73 71 6c 69 74 65 tCallback.sqlite
19a40 33 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 75 3.... tpu
19a50 74 73 20 24 63 68 61 6e 6e 65 6c 20 79 65 73 5c ts $channel yes\
19a60 6e 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 n.. } else
19a70 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
19a80 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
19a90 64 41 72 67 73 20 22 6e 6f 2c 20 65 72 72 6f 72 dArgs "no, error
19aa0 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 : " \n\t $error
19ab0 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 \n].. }..
19ac0 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
19ad0 20 63 6c 65 61 6e 75 70 46 69 6c 65 20 7b 20 66 cleanupFile { f
19ae0 69 6c 65 4e 61 6d 65 20 7b 63 6f 6c 6c 65 63 74 ileName {collect
19af0 20 74 72 75 65 7d 20 7b 66 6f 72 63 65 20 66 61 true} {force fa
19b00 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 lse} } {..
19b10 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
19b20 20 41 74 74 65 6d 70 74 20 74 6f 20 66 6f 72 63 Attempt to forc
19b30 65 20 61 6c 6c 20 70 65 6e 64 69 6e 67 20 22 67 e all pending "g
19b40 61 72 62 61 67 65 22 20 6f 62 6a 65 63 74 73 20 arbage" objects
19b50 74 6f 20 62 65 20 63 6f 6c 6c 65 63 74 65 64 2c to be collected,
19b60 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
19b70 69 6e 63 6c 75 64 69 6e 67 20 53 51 4c 69 74 65 including SQLite
19b80 20 73 74 61 74 65 6d 65 6e 74 73 20 61 6e 64 20 statements and
19b90 62 61 63 6b 75 70 20 6f 62 6a 65 63 74 73 3b 20 backup objects;
19ba0 74 68 69 73 20 73 68 6f 75 6c 64 20 61 6c 6c 6f this should allo
19bb0 77 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 w.. #
19bc0 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 the underlying
19bd0 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 74 6f database file to
19be0 20 62 65 20 64 65 6c 65 74 65 64 2e 0d 0a 20 20 be deleted...
19bf0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
19c00 7b 24 63 6f 6c 6c 65 63 74 7d 20 74 68 65 6e 20 {$collect} then
19c10 7b 0d 0a 20 20 20 20 20 20 20 20 63 6f 6c 6c 65 {.. colle
19c20 63 74 47 61 72 62 61 67 65 20 24 3a 3a 74 65 73 ctGarbage $::tes
19c30 74 5f 63 68 61 6e 6e 65 6c 0d 0a 20 20 20 20 20 t_channel..
19c40 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
19c50 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 # NOTE: Che
19c60 63 6b 20 69 66 20 74 68 65 20 66 69 6c 65 20 73 ck if the file s
19c70 74 69 6c 6c 20 65 78 69 73 74 73 2e 0d 0a 20 20 till exists...
19c80 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
19c90 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 {[file exists $f
19ca0 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b ileName]} then {
19cb0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
19cc0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 # NOTE: Ski
19cd0 70 20 64 65 6c 65 74 69 6e 67 20 74 65 73 74 20 p deleting test
19ce0 66 69 6c 65 73 20 69 66 20 73 6f 6d 65 62 6f 64 files if somebod
19cf0 79 20 73 65 74 73 20 74 68 65 20 67 6c 6f 62 61 y sets the globa
19d00 6c 20 76 61 72 69 61 62 6c 65 0d 0a 20 20 20 20 l variable..
19d10 20 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 70 # to p
19d20 72 65 76 65 6e 74 20 69 74 2e 0d 0a 20 20 20 20 revent it...
19d30 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 #.. i
19d40 66 20 7b 24 66 6f 72 63 65 20 7c 7c 20 21 5b 69 f {$force || ![i
19d50 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
19d60 63 6c 65 61 6e 75 70 46 69 6c 65 29 5d 7d 20 74 cleanupFile)]} t
19d70 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
19d80 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 #.. #
19d90 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f NOTE: Attempt to
19da0 20 64 65 6c 65 74 65 20 74 68 65 20 74 65 73 74 delete the test
19db0 20 66 69 6c 65 20 6e 6f 77 2e 0d 0a 20 20 20 20 file now...
19dc0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
19dd0 20 20 20 69 66 20 7b 5b 73 65 74 20 63 6f 64 65 if {[set code
19de0 20 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 64 65 [catch {file de
19df0 6c 65 74 65 20 24 66 69 6c 65 4e 61 6d 65 7d 20 lete $fileName}
19e00 65 72 72 6f 72 5d 5d 7d 20 74 68 65 6e 20 7b 0d error]]} then {.
19e10 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
19e20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f # NO
19e30 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 20 66 TE: We somehow f
19e40 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20 ailed to delete
19e50 74 68 65 20 66 69 6c 65 2c 20 72 65 70 6f 72 74 the file, report
19e60 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 why...
19e70 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
19e80 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
19e90 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
19ea0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
19eb0 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 "==== WAR
19ec0 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 NING: failed to
19ed0 64 65 6c 65 74 65 20 74 65 73 74 20 66 69 6c 65 delete test file
19ee0 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c \"" $fileName \
19ef0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
19f00 20 20 22 5c 22 20 64 75 72 69 6e 67 20 63 6c 65 "\" during cle
19f10 61 6e 75 70 2c 20 65 72 72 6f 72 3a 20 22 20 5c anup, error: " \
19f20 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a n\t $error \n]..
19f30 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
19f40 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
19f50 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
19f60 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 # NOTE: Sh
19f70 6f 77 20 74 68 61 74 20 77 65 20 73 6b 69 70 70 ow that we skipp
19f80 65 64 20 64 65 6c 65 74 69 6e 67 20 74 68 65 20 ed deleting the
19f90 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 file...
19fa0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 #.. se
19fb0 74 20 63 6f 64 65 20 30 0d 0a 0d 0a 20 20 20 20 t code 0....
19fc0 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
19fd0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
19fe0 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
19ff0 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 "==== W
1a000 41 52 4e 49 4e 47 3a 20 73 6b 69 70 70 65 64 20 ARNING: skipped
1a010 64 65 6c 65 74 69 6e 67 20 74 65 73 74 20 66 69 deleting test fi
1a020 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 le \"" $fileName
1a030 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1a040 20 20 22 5c 22 20 64 75 72 69 6e 67 20 63 6c 65 "\" during cle
1a050 61 6e 75 70 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 anup\n"]..
1a060 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 }.. } els
1a070 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a e {.. #..
1a080 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1a090 54 68 65 20 66 69 6c 65 20 64 6f 65 73 20 6e 6f The file does no
1a0a0 74 20 65 78 69 73 74 2c 20 73 75 63 63 65 73 73 t exist, success
1a0b0 21 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 !.. #..
1a0c0 20 20 20 20 20 20 73 65 74 20 63 6f 64 65 20 30 set code 0
1a0d0 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
1a0e0 20 20 20 72 65 74 75 72 6e 20 24 63 6f 64 65 0d return $code.
1a0f0 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
1a100 72 6f 63 20 63 6c 65 61 6e 75 70 4d 65 6d 6f 72 roc cleanupMemor
1a110 79 20 7b 20 76 61 72 4e 61 6d 65 20 7b 71 75 69 y { varName {qui
1a120 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 et false} } {..
1a130 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 if {[haveSQ
1a140 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e LiteObjectComman
1a150 64 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 d] && \..
1a160 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 [string lengt
1a170 68 20 24 76 61 72 4e 61 6d 65 5d 20 3e 20 30 7d h $varName] > 0}
1a180 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1a190 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
1a1a0 54 45 3a 20 52 65 66 65 72 20 74 6f 20 74 68 65 TE: Refer to the
1a1b0 20 73 70 65 63 69 66 69 65 64 20 76 61 72 69 61 specified varia
1a1c0 62 6c 65 20 28 65 2e 67 2e 20 22 63 6f 6e 6e 65 ble (e.g. "conne
1a1d0 63 74 69 6f 6e 22 29 20 69 6e 20 74 68 65 0d 0a ction") in the..
1a1e0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1a1f0 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 20 63 context of our c
1a200 61 6c 6c 65 72 2e 20 20 54 68 65 20 6f 70 61 71 aller. The opaq
1a210 75 65 20 6f 62 6a 65 63 74 20 68 61 6e 64 6c 65 ue object handle
1a220 20 66 6f 72 20 61 6e 0d 0a 20 20 20 20 20 20 20 for an..
1a230 20 23 20 20 20 20 20 20 20 41 44 4f 2e 4e 45 54 # ADO.NET
1a240 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 70 72 65 76 connection prev
1a250 69 6f 75 73 6c 79 20 72 65 74 75 72 6e 65 64 20 iously returned
1a260 62 79 20 5b 67 65 74 44 62 43 6f 6e 6e 65 63 74 by [getDbConnect
1a270 69 6f 6e 5d 0d 0a 20 20 20 20 20 20 20 20 23 20 ion].. #
1a280 20 20 20 20 20 20 73 68 6f 75 6c 64 20 62 65 20 should be
1a290 73 74 6f 72 65 64 20 74 68 65 72 65 2e 0d 0a 20 stored there...
1a2a0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1a2b0 20 20 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 upvar 1 $varNa
1a2c0 6d 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 0d 0a 0d me connection...
1a2d0 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 . if {[ca
1a2e0 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
1a2f0 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 24 object invoke $
1a300 63 6f 6e 6e 65 63 74 69 6f 6e 20 52 65 6c 65 61 connection Relea
1a310 73 65 4d 65 6d 6f 72 79 0d 0a 20 20 20 20 20 20 seMemory..
1a320 20 20 7d 20 72 65 73 75 6c 74 5d 7d 20 74 68 65 } result]} the
1a330 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 n {.. i
1a340 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1a350 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1a360 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
1a370 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
1a380 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
1a390 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 "==== WARNI
1a3a0 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 72 65 NG: failed to re
1a3b0 6c 65 61 73 65 20 64 61 74 61 62 61 73 65 20 6d lease database m
1a3c0 65 6d 6f 72 79 2c 20 65 72 72 6f 72 3a 20 22 20 emory, error: "
1a3d0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1a3e0 20 20 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 \n\t $result
1a3f0 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
1a400 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
1a410 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 }.... if
1a420 20 7b 5b 6c 6c 65 6e 67 74 68 20 5b 69 6e 66 6f {[llength [info
1a430 20 63 6f 6d 6d 61 6e 64 73 20 64 65 62 75 67 5d commands debug]
1a440 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
1a450 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
1a460 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 75 h {.. u
1a470 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 64 plevel 1 [list d
1a480 65 62 75 67 20 70 75 72 67 65 5d 0d 0a 20 20 20 ebug purge]..
1a490 20 20 20 20 20 7d 20 72 65 73 75 6c 74 5d 7d 20 } result]}
1a4a0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1a4b0 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
1a4c0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1a4d0 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
1a4e0 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
1a4f0 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1a500 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 "==== WA
1a510 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f RNING: failed to
1a520 20 70 75 72 67 65 20 63 61 6c 6c 20 66 72 61 6d purge call fram
1a530 65 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 e, error: " \..
1a540 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c \
1a550 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d n\t $result \n].
1a560 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
1a570 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1a580 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
1a590 0a 20 20 20 20 20 20 20 20 20 20 75 70 6c 65 76 . uplev
1a5a0 65 6c 20 31 20 5b 6c 69 73 74 20 64 65 62 75 67 el 1 [list debug
1a5b0 20 63 6c 65 61 6e 75 70 5d 0d 0a 20 20 20 20 20 cleanup]..
1a5c0 20 20 20 7d 20 72 65 73 75 6c 74 5d 7d 20 74 68 } result]} th
1a5d0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1a5e0 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
1a5f0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1a600 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
1a610 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1a620 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1a630 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e "==== WARN
1a640 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 63 ING: failed to c
1a650 6c 65 61 6e 75 70 20 69 6e 74 65 72 70 72 65 74 leanup interpret
1a660 65 72 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a er, error: " \..
1a670 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a680 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d \n\t $result \n]
1a690 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1a6a0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1a6b0 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
1a6c0 0d 0a 20 20 20 20 20 20 20 20 20 20 75 70 6c 65 .. uple
1a6d0 76 65 6c 20 31 20 5b 6c 69 73 74 20 64 65 62 75 vel 1 [list debu
1a6e0 67 20 63 6f 6c 6c 65 63 74 5d 0d 0a 20 20 20 20 g collect]..
1a6f0 20 20 20 20 7d 20 72 65 73 75 6c 74 5d 7d 20 74 } result]} t
1a700 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1a710 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
1a720 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1a730 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1a740 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1a750 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
1a760 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 "==== WAR
1a770 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 NING: failed to
1a780 63 6f 6c 6c 65 63 74 20 67 61 72 62 61 67 65 2c collect garbage,
1a790 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 error: " \..
1a7a0 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 6e 5c \n\
1a7b0 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 t $result \n]..
1a7c0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1a7d0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
1a7e0 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
1a7f0 6f 63 20 73 65 74 75 70 4d 65 6d 6f 72 79 43 6f oc setupMemoryCo
1a800 75 6e 74 65 72 73 20 7b 20 76 61 72 4e 61 6d 65 unters { varName
1a810 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b } {.. if {
1a820 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 [haveSQLiteObjec
1a830 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 tCommand]} then
1a840 7b 0d 0a 20 20 20 20 20 20 20 20 75 70 76 61 72 {.. upvar
1a850 20 31 20 24 76 61 72 4e 61 6d 65 20 63 6f 75 6e 1 $varName coun
1a860 74 65 72 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 ter.... s
1a870 65 74 20 63 6f 75 6e 74 65 72 28 31 29 20 5b 6f et counter(1) [o
1a880 62 6a 65 63 74 20 63 72 65 61 74 65 20 2d 61 6c bject create -al
1a890 69 61 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ias \..
1a8a0 20 20 20 53 79 73 74 65 6d 2e 44 69 61 67 6e 6f System.Diagno
1a8b0 73 74 69 63 73 2e 50 65 72 66 6f 72 6d 61 6e 63 stics.Performanc
1a8c0 65 43 6f 75 6e 74 65 72 20 50 72 6f 63 65 73 73 eCounter Process
1a8d0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1a8e0 22 57 6f 72 6b 69 6e 67 20 53 65 74 22 20 5b 66 "Working Set" [f
1a8f0 69 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 5b 66 69 ile rootname [fi
1a900 6c 65 20 74 61 69 6c 20 24 3a 3a 62 69 6e 5f 66 le tail $::bin_f
1a910 69 6c 65 5d 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 ile]]]....
1a920 20 20 73 65 74 20 63 6f 75 6e 74 65 72 28 32 29 set counter(2)
1a930 20 5b 6f 62 6a 65 63 74 20 63 72 65 61 74 65 20 [object create
1a940 2d 61 6c 69 61 73 20 5c 0d 0a 20 20 20 20 20 20 -alias \..
1a950 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 69 61 System.Dia
1a960 67 6e 6f 73 74 69 63 73 2e 50 65 72 66 6f 72 6d gnostics.Perform
1a970 61 6e 63 65 43 6f 75 6e 74 65 72 20 50 72 6f 63 anceCounter Proc
1a980 65 73 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ess \..
1a990 20 20 20 22 57 6f 72 6b 69 6e 67 20 53 65 74 20 "Working Set
1a9a0 50 65 61 6b 22 20 5b 66 69 6c 65 20 72 6f 6f 74 Peak" [file root
1a9b0 6e 61 6d 65 20 5b 66 69 6c 65 20 74 61 69 6c 20 name [file tail
1a9c0 24 3a 3a 62 69 6e 5f 66 69 6c 65 5d 5d 5d 0d 0a $::bin_file]]]..
1a9d0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 63 6f .. set co
1a9e0 75 6e 74 65 72 28 33 29 20 5b 6f 62 6a 65 63 74 unter(3) [object
1a9f0 20 63 72 65 61 74 65 20 2d 61 6c 69 61 73 20 5c create -alias \
1aa00 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 79 .. Sy
1aa10 73 74 65 6d 2e 44 69 61 67 6e 6f 73 74 69 63 73 stem.Diagnostics
1aa20 2e 50 65 72 66 6f 72 6d 61 6e 63 65 43 6f 75 6e .PerformanceCoun
1aa30 74 65 72 20 50 72 6f 63 65 73 73 20 5c 0d 0a 20 ter Process \..
1aa40 20 20 20 20 20 20 20 20 20 20 20 22 50 72 69 76 "Priv
1aa50 61 74 65 20 42 79 74 65 73 22 20 5b 66 69 6c 65 ate Bytes" [file
1aa60 20 72 6f 6f 74 6e 61 6d 65 20 5b 66 69 6c 65 20 rootname [file
1aa70 74 61 69 6c 20 24 3a 3a 62 69 6e 5f 66 69 6c 65 tail $::bin_file
1aa80 5d 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a ]]].. }....
1aa90 20 20 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d return "".
1aaa0 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
1aab0 72 6f 63 20 72 65 70 6f 72 74 4d 65 6d 6f 72 79 roc reportMemory
1aac0 43 6f 75 6e 74 65 72 73 20 7b 20 63 68 61 6e 6e Counters { chann
1aad0 65 6c 20 76 61 72 4e 61 6d 65 20 70 72 65 66 69 el varName prefi
1aae0 78 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 x } {.. if
1aaf0 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 {[haveSQLiteObje
1ab00 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e ctCommand]} then
1ab10 20 7b 0d 0a 20 20 20 20 20 20 20 20 75 70 76 61 {.. upva
1ab20 72 20 31 20 24 76 61 72 4e 61 6d 65 20 63 6f 75 r 1 $varName cou
1ab30 6e 74 65 72 0d 0a 0d 0a 20 20 20 20 20 20 20 20 nter....
1ab40 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1ab50 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1ab60 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1ab70 22 20 24 70 72 65 66 69 78 20 22 20 63 6f 75 6e " $prefix " coun
1ab80 74 65 72 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 ter \"" \..
1ab90 20 20 20 20 20 20 20 5b 6f 62 6a 65 63 74 20 69 [object i
1aba0 6e 76 6f 6b 65 20 24 63 6f 75 6e 74 65 72 28 31 nvoke $counter(1
1abb0 29 20 43 6f 75 6e 74 65 72 4e 61 6d 65 5d 20 22 ) CounterName] "
1abc0 5c 22 20 76 61 6c 75 65 20 69 73 20 22 20 5c 0d \" value is " \.
1abd0 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 6f 62 . [ob
1abe0 6a 65 63 74 20 69 6e 76 6f 6b 65 20 24 63 6f 75 ject invoke $cou
1abf0 6e 74 65 72 28 31 29 20 52 61 77 56 61 6c 75 65 nter(1) RawValue
1ac00 5d 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 ] \n]....
1ac10 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
1ac20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
1ac30 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
1ac40 20 22 20 24 70 72 65 66 69 78 20 22 20 63 6f 75 " $prefix " cou
1ac50 6e 74 65 72 20 5c 22 22 20 5c 0d 0a 20 20 20 20 nter \"" \..
1ac60 20 20 20 20 20 20 20 20 5b 6f 62 6a 65 63 74 20 [object
1ac70 69 6e 76 6f 6b 65 20 24 63 6f 75 6e 74 65 72 28 invoke $counter(
1ac80 32 29 20 43 6f 75 6e 74 65 72 4e 61 6d 65 5d 20 2) CounterName]
1ac90 22 5c 22 20 76 61 6c 75 65 20 69 73 20 22 20 5c "\" value is " \
1aca0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 6f .. [o
1acb0 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 24 63 6f bject invoke $co
1acc0 75 6e 74 65 72 28 32 29 20 52 61 77 56 61 6c 75 unter(2) RawValu
1acd0 65 5d 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 e] \n]....
1ace0 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1acf0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1ad00 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
1ad10 2d 20 22 20 24 70 72 65 66 69 78 20 22 20 63 6f - " $prefix " co
1ad20 75 6e 74 65 72 20 5c 22 22 20 5c 0d 0a 20 20 20 unter \"" \..
1ad30 20 20 20 20 20 20 20 20 20 5b 6f 62 6a 65 63 74 [object
1ad40 20 69 6e 76 6f 6b 65 20 24 63 6f 75 6e 74 65 72 invoke $counter
1ad50 28 33 29 20 43 6f 75 6e 74 65 72 4e 61 6d 65 5d (3) CounterName]
1ad60 20 22 5c 22 20 76 61 6c 75 65 20 69 73 20 22 20 "\" value is "
1ad70 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
1ad80 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 24 63 object invoke $c
1ad90 6f 75 6e 74 65 72 28 33 29 20 52 61 77 56 61 6c ounter(3) RawVal
1ada0 75 65 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d ue] \n].. }
1adb0 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
1adc0 70 72 6f 63 20 63 6f 6c 6c 65 63 74 47 61 72 62 proc collectGarb
1add0 61 67 65 20 7b 20 63 68 61 6e 6e 65 6c 20 7b 6d age { channel {m
1ade0 69 6c 6c 69 73 65 63 6f 6e 64 73 20 31 30 30 30 illiseconds 1000
1adf0 7d 20 7b 71 75 69 65 74 20 74 72 75 65 7d 20 7d } {quiet true} }
1ae00 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 {.. if {[h
1ae10 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 aveSQLiteObjectC
1ae20 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d ommand]} then {.
1ae30 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 . if {[ca
1ae40 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
1ae50 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 47 object invoke G
1ae60 43 20 47 65 74 54 6f 74 61 6c 4d 65 6d 6f 72 79 C GetTotalMemory
1ae70 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 false..
1ae80 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 } result] == 0}
1ae90 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1aea0 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
1aeb0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1aec0 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
1aed0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
1aee0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1aef0 20 22 2d 2d 2d 2d 20 6d 65 6d 6f 72 79 20 69 6e "---- memory in
1af00 20 75 73 65 20 62 79 20 74 68 65 20 43 4c 52 20 use by the CLR
1af10 62 65 66 6f 72 65 20 63 6f 6c 6c 65 63 74 69 6f before collectio
1af20 6e 2e 2e 2e 20 22 20 5c 0d 0a 20 20 20 20 20 20 n... " \..
1af30 20 20 20 20 20 20 20 20 20 20 24 72 65 73 75 6c $resul
1af40 74 20 22 20 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 t " bytes\n"]..
1af50 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1af60 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
1af70 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
1af80 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1af90 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1afa0 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e "==== WARNIN
1afb0 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 67 65 74 G: failed to get
1afc0 20 43 4c 52 20 6d 65 6d 6f 72 79 20 75 73 61 67 CLR memory usag
1afd0 65 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 e, error: " \..
1afe0 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 6e 5c \n\
1aff0 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 t $result \n]..
1b000 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1b010 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 23 23 23 23 }.... #####
1b020 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b030 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b040 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b050 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b060 23 23 23 23 0d 0a 0d 0a 20 20 20 20 20 20 23 0d ####.... #.
1b070 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 . # NOTE: R
1b080 65 70 65 61 74 65 64 6c 79 20 61 74 74 65 6d 70 epeatedly attemp
1b090 74 20 74 6f 20 63 6f 6c 6c 65 63 74 20 67 61 72 t to collect gar
1b0a0 62 61 67 65 20 75 6e 74 69 6c 20 74 68 65 20 61 bage until the a
1b0b0 6c 6c 6f 74 74 65 64 20 6e 75 6d 62 65 72 0d 0a llotted number..
1b0c0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 66 # of
1b0d0 20 6d 69 6c 6c 69 73 65 63 6f 6e 64 73 20 68 61 milliseconds ha
1b0e0 73 20 65 6c 61 70 73 65 64 2e 20 20 41 6c 77 61 s elapsed. Alwa
1b0f0 79 73 20 61 74 74 65 6d 70 74 20 74 6f 20 63 6f ys attempt to co
1b100 6c 6c 65 63 74 20 67 61 72 62 61 67 65 0d 0a 20 llect garbage..
1b110 20 20 20 20 20 23 20 20 20 20 20 20 20 61 74 20 # at
1b120 6c 65 61 73 74 20 6f 6e 63 65 2e 0d 0a 20 20 20 least once...
1b130 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
1b140 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 [haveSQLiteObjec
1b150 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 tCommand]} then
1b160 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 73 {.. set s
1b170 74 61 72 74 20 5b 63 6c 6f 63 6b 20 73 65 63 6f tart [clock seco
1b180 6e 64 73 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 nds].. se
1b190 74 20 73 74 6f 70 20 5b 65 78 70 72 20 7b 24 73 t stop [expr {$s
1b1a0 74 61 72 74 20 2b 20 28 24 6d 69 6c 6c 69 73 65 tart + ($millise
1b1b0 63 6f 6e 64 73 20 2f 20 31 30 30 30 29 7d 5d 0d conds / 1000)}].
1b1c0 0a 0d 0a 20 20 20 20 20 20 20 20 64 6f 20 7b 0d ... do {.
1b1d0 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
1b1e0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1b1f0 41 74 74 65 6d 70 74 20 74 6f 20 66 6f 72 63 65 Attempt to force
1b200 20 61 20 66 75 6c 6c 20 67 61 72 62 61 67 65 20 a full garbage
1b210 63 6f 6c 6c 65 63 74 69 6f 6e 20 6e 6f 77 2e 20 collection now.
1b220 20 52 65 70 6f 72 74 20 61 6e 79 0d 0a 20 20 20 Report any..
1b230 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 65 # e
1b240 72 72 6f 72 20 74 68 61 74 20 69 73 20 65 6e 63 rror that is enc
1b250 6f 75 6e 74 65 72 65 64 20 69 66 20 77 65 20 66 ountered if we f
1b260 61 69 6c 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ail...
1b270 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 #.. if
1b280 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
1b290 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
1b2a0 76 6f 6b 65 20 47 43 20 47 65 74 54 6f 74 61 6c voke GC GetTotal
1b2b0 4d 65 6d 6f 72 79 20 74 72 75 65 0d 0a 20 20 20 Memory true..
1b2c0 20 20 20 20 20 20 20 7d 20 65 72 72 6f 72 5d 7d } error]}
1b2d0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1b2e0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1b2f0 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1b300 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1b310 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 "==== WARNING
1b320 3a 20 66 61 69 6c 65 64 20 66 75 6c 6c 20 67 61 : failed full ga
1b330 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e rbage collection
1b340 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 , error: " \..
1b350 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 6e \n
1b360 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 \t $error \n]..
1b370 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
1b380 20 20 20 20 20 20 20 20 73 65 74 20 6e 6f 77 20 set now
1b390 5b 63 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d 0d [clock seconds].
1b3a0 0a 20 20 20 20 20 20 20 20 7d 20 77 68 69 6c 65 . } while
1b3b0 20 7b 24 73 74 61 72 74 20 3c 3d 20 24 6e 6f 77 {$start <= $now
1b3c0 20 26 26 20 24 6e 6f 77 20 3c 20 24 73 74 6f 70 && $now < $stop
1b3d0 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
1b3e0 20 20 20 20 23 23 23 23 23 23 23 23 23 23 23 23 ############
1b3f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b400 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b410 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b420 23 23 23 23 23 23 23 23 23 23 23 23 23 0d 0a 0d #############...
1b430 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 . if {[have
1b440 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d SQLiteObjectComm
1b450 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 and]} then {..
1b460 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
1b470 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 {.. ob
1b480 6a 65 63 74 20 69 6e 76 6f 6b 65 20 47 43 20 47 ject invoke GC G
1b490 65 74 54 6f 74 61 6c 4d 65 6d 6f 72 79 20 66 61 etTotalMemory fa
1b4a0 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 7d 20 72 lse.. } r
1b4b0 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 esult] == 0} the
1b4c0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 n {.. i
1b4d0 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1b4e0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1b4f0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1b500 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1b510 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
1b520 2d 2d 2d 20 6d 65 6d 6f 72 79 20 69 6e 20 75 73 --- memory in us
1b530 65 20 62 79 20 74 68 65 20 43 4c 52 20 61 66 74 e by the CLR aft
1b540 65 72 20 63 6f 6c 6c 65 63 74 69 6f 6e 2e 2e 2e er collection...
1b550 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 " \..
1b560 20 20 20 20 20 20 24 72 65 73 75 6c 74 20 22 20 $result "
1b570 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 bytes\n"]..
1b580 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1b590 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
1b5a0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1b5b0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
1b5c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1b5d0 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 "==== WARNING: f
1b5e0 61 69 6c 65 64 20 74 6f 20 67 65 74 20 43 4c 52 ailed to get CLR
1b5f0 20 6d 65 6d 6f 72 79 20 75 73 61 67 65 2c 20 65 memory usage, e
1b600 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 rror: " \..
1b610 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 72 \n\t $r
1b620 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 esult \n]..
1b630 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
1b640 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
1b650 63 20 67 65 74 53 51 4c 69 74 65 48 61 6e 64 6c c getSQLiteHandl
1b660 65 43 6f 75 6e 74 73 20 7b 20 63 68 61 6e 6e 65 eCounts { channe
1b670 6c 20 7b 71 75 69 65 74 20 66 61 6c 73 65 7d 20 l {quiet false}
1b680 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 72 } {.. set r
1b690 65 73 75 6c 74 20 5b 6c 69 73 74 5d 0d 0a 0d 0a esult [list]....
1b6a0 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 if {[haveS
1b6b0 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 QLiteObjectComma
1b6c0 6e 64 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 nd] && \..
1b6d0 20 20 20 20 5b 68 61 76 65 53 51 4c 69 74 65 44 [haveSQLiteD
1b6e0 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 20 43 4f efineConstant CO
1b6f0 55 4e 54 5f 48 41 4e 44 4c 45 5d 7d 20 74 68 65 UNT_HANDLE]} the
1b700 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
1b710 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1b720 41 64 64 20 65 61 63 68 20 63 72 69 74 69 63 61 Add each critica
1b730 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 20 74 l handle count t
1b740 6f 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 o the resulting
1b750 6c 69 73 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 list... #
1b760 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 .. foreac
1b770 68 20 6e 61 6d 65 20 5b 6c 69 73 74 20 5c 0d 0a h name [list \..
1b780 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 6e 6e conn
1b790 65 63 74 69 6f 6e 43 6f 75 6e 74 20 73 74 61 74 ectionCount stat
1b7a0 65 6d 65 6e 74 43 6f 75 6e 74 20 62 61 63 6b 75 ementCount backu
1b7b0 70 43 6f 75 6e 74 20 62 6c 6f 62 43 6f 75 6e 74 pCount blobCount
1b7c0 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 ] {.. i
1b7d0 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
1b7e0 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
1b7f0 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
1b800 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
1b810 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
1b820 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 44 em.Data.SQLite.D
1b830 65 62 75 67 44 61 74 61 20 24 6e 61 6d 65 0d 0a ebugData $name..
1b840 20 20 20 20 20 20 20 20 20 20 7d 20 76 61 6c 75 } valu
1b850 65 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d e] == 0} then {.
1b860 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
1b870 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
1b880 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1b890 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1b8a0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1b8b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1b8c0 22 2d 2d 2d 2d 20 63 72 69 74 69 63 61 6c 20 68 "---- critical h
1b8d0 61 6e 64 6c 65 20 63 6f 75 6e 74 20 5c 22 22 20 andle count \""
1b8e0 24 6e 61 6d 65 20 22 5c 22 20 69 73 20 22 20 24 $name "\" is " $
1b8f0 76 61 6c 75 65 20 5c 6e 5d 0d 0a 20 20 20 20 20 value \n]..
1b900 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1b910 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 lappend
1b920 72 65 73 75 6c 74 20 24 76 61 6c 75 65 0d 0a 20 result $value..
1b930 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 } else
1b940 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
1b950 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
1b960 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
1b970 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d "==
1b980 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c == WARNING: fail
1b990 65 64 20 74 6f 20 67 65 74 20 63 72 69 74 69 63 ed to get critic
1b9a0 61 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 20 al handle count
1b9b0 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 \"" \..
1b9c0 20 20 20 20 20 20 20 24 6e 61 6d 65 20 22 5c 22 $name "\"
1b9d0 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 , error: " \n\t
1b9e0 24 76 61 6c 75 65 20 5c 6e 5d 0d 0a 20 20 20 20 $value \n]..
1b9f0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1ba00 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 }.. } else
1ba10 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
1ba20 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
1ba30 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1ba40 54 68 65 20 61 63 74 75 61 6c 20 68 61 6e 64 6c The actual handl
1ba50 65 20 63 6f 75 6e 74 73 20 61 72 65 20 6e 6f 74 e counts are not
1ba60 20 61 76 61 69 6c 61 62 6c 65 3b 20 74 68 65 72 available; ther
1ba70 65 66 6f 72 65 2c 20 6a 75 73 74 0d 0a 20 20 20 efore, just..
1ba80 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 74 # ret
1ba90 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 6c 69 73 urn an empty lis
1baa0 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 t... #..
1bab0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
1bac0 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 72 69 74 annel "---- crit
1bad0 69 63 61 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e ical handle coun
1bae0 74 73 20 75 6e 61 76 61 69 6c 61 62 6c 65 5c 6e ts unavailable\n
1baf0 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 ".. }....
1bb00 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 return $resu
1bb10 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 lt.. }.....
1bb20 20 20 70 72 6f 63 20 73 68 75 74 64 6f 77 6e 53 proc shutdownS
1bb30 51 4c 69 74 65 20 7b 20 63 68 61 6e 6e 65 6c 20 QLite { channel
1bb40 7b 66 6f 72 63 65 20 66 61 6c 73 65 7d 20 7b 71 {force false} {q
1bb50 75 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d uiet false} } {.
1bb60 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
1bb70 23 20 4e 4f 54 45 3a 20 4d 61 6b 65 20 73 75 72 # NOTE: Make sur
1bb80 65 20 74 68 61 74 20 53 51 4c 69 74 65 20 63 6f e that SQLite co
1bb90 72 65 20 6c 69 62 72 61 72 79 20 69 73 20 63 6f re library is co
1bba0 6d 70 6c 65 74 65 6c 79 20 73 68 75 74 64 6f 77 mpletely shutdow
1bbb0 6e 2e 20 20 54 68 69 73 0d 0a 20 20 20 20 20 20 n. This..
1bbc0 23 20 20 20 20 20 20 20 69 73 20 75 73 65 64 20 # is used
1bbd0 62 79 20 74 65 73 74 73 20 74 68 61 74 20 63 68 by tests that ch
1bbe0 61 6e 67 65 20 63 6f 6e 66 69 67 75 72 61 74 69 ange configurati
1bbf0 6f 6e 20 6f 70 74 69 6f 6e 73 20 61 6e 64 2f 6f on options and/o
1bc00 72 20 74 68 6f 73 65 0d 0a 20 20 20 20 20 20 23 r those.. #
1bc10 20 20 20 20 20 20 20 74 68 61 74 20 6e 65 65 64 that need
1bc20 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 20 6c 6f to make sure lo
1bc30 67 67 69 6e 67 20 69 73 20 69 6e 69 74 69 61 6c gging is initial
1bc40 69 7a 65 64 20 28 69 2e 65 2e 20 6a 75 73 74 20 ized (i.e. just
1bc50 69 6e 20 63 61 73 65 0d 0a 20 20 20 20 20 20 23 in case.. #
1bc60 20 20 20 20 20 20 20 74 68 65 20 53 51 4c 69 74 the SQLit
1bc70 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 20 77 e core library w
1bc80 61 73 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 69 as initialized i
1bc90 6e 20 74 68 65 20 70 72 6f 63 65 73 73 20 70 72 n the process pr
1bca0 69 6f 72 20 74 6f 0d 0a 20 20 20 20 20 20 23 20 ior to.. #
1bcb0 20 20 20 20 20 20 74 68 65 20 53 51 4c 69 74 65 the SQLite
1bcc0 4c 6f 67 20 63 6c 61 73 73 20 62 65 69 6e 67 20 Log class being
1bcd0 61 62 6c 65 20 74 6f 20 73 65 74 75 70 20 69 74 able to setup it
1bce0 73 20 6c 6f 67 67 69 6e 67 20 63 61 6c 6c 62 61 s logging callba
1bcf0 63 6b 29 2e 0d 0a 20 20 20 20 20 20 23 20 20 20 ck)... #
1bd00 20 20 20 20 4e 6f 72 6d 61 6c 6c 79 2c 20 74 68 Normally, th
1bd10 69 73 20 73 68 6f 75 6c 64 20 6f 6e 6c 79 20 62 is should only b
1bd20 65 20 70 65 72 66 6f 72 6d 65 64 20 69 66 20 53 e performed if S
1bd30 51 4c 69 74 65 20 69 73 20 6c 6f 61 64 65 64 20 QLite is loaded
1bd40 61 6e 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 and.. #
1bd50 20 20 20 72 65 61 64 79 20 66 6f 72 20 75 73 65 ready for use
1bd60 20 62 79 20 74 68 65 20 74 65 73 74 20 73 75 69 by the test sui
1bd70 74 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 te... #..
1bd80 20 20 20 20 69 66 20 7b 24 66 6f 72 63 65 20 7c if {$force |
1bd90 7c 20 5b 69 73 53 51 4c 69 74 65 52 65 61 64 79 | [isSQLiteReady
1bda0 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1bdb0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
1bdc0 42 55 47 46 49 58 3a 20 4d 61 6b 65 20 73 75 72 BUGFIX: Make sur
1bdd0 65 20 74 68 61 74 20 61 6e 79 20 22 6c 65 61 6b e that any "leak
1bde0 65 64 22 20 74 72 61 6e 73 61 63 74 69 6f 6e 73 ed" transactions
1bdf0 20 61 6e 64 2f 6f 72 20 63 6f 6e 6e 65 63 74 69 and/or connecti
1be00 6f 6e 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ons.. #
1be10 20 20 20 20 20 20 20 61 72 65 20 63 6c 65 61 6e are clean
1be20 65 64 20 75 70 20 62 65 66 6f 72 65 20 63 61 6c ed up before cal
1be30 6c 69 6e 67 20 74 68 65 20 6e 61 74 69 76 65 20 ling the native
1be40 73 68 75 74 64 6f 77 6e 20 66 75 6e 63 74 69 6f shutdown functio
1be50 6e 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 n... #..
1be60 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 74 foreach t
1be70 72 61 6e 73 61 63 74 69 6f 6e 20 5b 69 6e 66 6f ransaction [info
1be80 20 74 72 61 6e 73 61 63 74 69 6f 6e 73 5d 20 7b transactions] {
1be90 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
1bea0 5b 73 74 72 69 6e 67 20 6d 61 74 63 68 20 5c 0d [string match \.
1beb0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 . S
1bec0 79 73 74 65 6d 23 44 61 74 61 23 53 51 4c 69 74 ystem#Data#SQLit
1bed0 65 23 53 51 4c 69 74 65 54 72 61 6e 73 61 63 74 e#SQLiteTransact
1bee0 69 6f 6e 23 2a 20 24 74 72 61 6e 73 61 63 74 69 ion#* $transacti
1bef0 6f 6e 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 on]} then {..
1bf00 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 if {[ca
1bf10 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
1bf20 20 20 20 20 20 73 71 6c 20 74 72 61 6e 73 61 63 sql transac
1bf30 74 69 6f 6e 20 72 6f 6c 6c 62 61 63 6b 20 24 74 tion rollback $t
1bf40 72 61 6e 73 61 63 74 69 6f 6e 0d 0a 20 20 20 20 ransaction..
1bf50 20 20 20 20 20 20 20 20 7d 20 65 72 72 6f 72 5d } error]
1bf60 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
1bf70 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
1bf80 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
1bf90 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1bfa0 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1bfb0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1bfc0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1bfd0 20 20 20 20 22 2d 2d 2d 2d 20 72 6f 6c 6c 65 64 "---- rolled
1bfe0 20 62 61 63 6b 20 6c 65 61 6b 65 64 20 74 72 61 back leaked tra
1bff0 6e 73 61 63 74 69 6f 6e 20 5c 22 22 20 5c 0d 0a nsaction \"" \..
1c000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1c010 20 20 20 20 24 74 72 61 6e 73 61 63 74 69 6f 6e $transaction
1c020 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 \"\n]..
1c030 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1c040 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
1c050 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
1c060 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
1c070 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c080 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1c090 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1c0a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1c0b0 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e "==== WARNIN
1c0c0 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 72 6f 6c G: failed to rol
1c0d0 6c 62 61 63 6b 20 6c 65 61 6b 65 64 20 74 72 61 lback leaked tra
1c0e0 6e 73 61 63 74 69 6f 6e 20 5c 22 22 20 5c 0d 0a nsaction \"" \..
1c0f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1c100 20 20 20 20 24 74 72 61 6e 73 61 63 74 69 6f 6e $transaction
1c110 20 22 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c "\", error: " \
1c120 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a n\t $error \n]..
1c130 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
1c140 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
1c150 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1c160 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1c170 20 20 66 6f 72 65 61 63 68 20 64 62 20 5b 69 6e foreach db [in
1c180 66 6f 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 5d 20 fo connections]
1c190 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 {.. if
1c1a0 7b 5b 73 74 72 69 6e 67 20 6d 61 74 63 68 20 5c {[string match \
1c1b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c1c0 53 79 73 74 65 6d 23 44 61 74 61 23 53 51 4c 69 System#Data#SQLi
1c1d0 74 65 23 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 te#SQLiteConnect
1c1e0 69 6f 6e 23 2a 20 24 64 62 5d 7d 20 74 68 65 6e ion#* $db]} then
1c1f0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1c200 69 66 20 7b 5b 63 61 74 63 68 20 7b 73 71 6c 20 if {[catch {sql
1c210 63 6c 6f 73 65 20 24 64 62 7d 20 65 72 72 6f 72 close $db} error
1c220 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
1c230 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
1c240 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
1c250 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1c260 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
1c270 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
1c280 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1c290 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6c 6f 73 65 "---- close
1c2a0 64 20 6c 65 61 6b 65 64 20 64 61 74 61 62 61 73 d leaked databas
1c2b0 65 20 5c 22 22 20 24 64 62 20 5c 22 5c 6e 5d 0d e \"" $db \"\n].
1c2c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
1c2d0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 .. }
1c2e0 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
1c2f0 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
1c300 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
1c310 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
1c320 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
1c330 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
1c340 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d "==
1c350 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c == WARNING: fail
1c360 65 64 20 74 6f 20 63 6c 6f 73 65 20 6c 65 61 6b ed to close leak
1c370 65 64 20 64 61 74 61 62 61 73 65 20 5c 22 22 20 ed database \""
1c380 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1c390 20 20 20 20 20 20 20 24 64 62 20 22 5c 22 2c 20 $db "\",
1c3a0 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 error: " \n\t $e
1c3b0 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 rror \n]..
1c3c0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1c3d0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1c3e0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1c3f0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
1c400 20 20 20 20 20 20 20 23 20 42 55 47 46 49 58 3a # BUGFIX:
1c410 20 42 65 66 6f 72 65 20 63 61 6c 6c 69 6e 67 20 Before calling
1c420 74 68 65 20 6e 61 74 69 76 65 20 73 68 75 74 64 the native shutd
1c430 6f 77 6e 20 66 75 6e 63 74 69 6f 6e 2c 20 6d 61 own function, ma
1c440 6b 65 20 73 75 72 65 20 62 6f 74 68 0d 0a 20 20 ke sure both..
1c450 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 #
1c460 6f 66 20 74 68 65 20 50 52 41 47 4d 41 20 72 65 of the PRAGMA re
1c470 6c 61 74 65 64 20 64 69 72 65 63 74 6f 72 79 20 lated directory
1c480 6e 61 6d 65 73 20 61 72 65 20 66 72 65 65 64 2e names are freed.
1c490 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1c4a0 20 20 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c checkForSQL
1c4b0 69 74 65 44 69 72 65 63 74 6f 72 69 65 73 20 24 iteDirectories $
1c4c0 63 68 61 6e 6e 65 6c 20 74 72 75 65 0d 0a 0d 0a channel true....
1c4d0 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
1c4e0 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
1c4f0 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 object invoke -f
1c500 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 lags +NonPublic
1c510 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1c520 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
1c530 69 74 65 2e 55 6e 73 61 66 65 4e 61 74 69 76 65 ite.UnsafeNative
1c540 4d 65 74 68 6f 64 73 20 73 71 6c 69 74 65 33 5f Methods sqlite3_
1c550 73 68 75 74 64 6f 77 6e 0d 0a 20 20 20 20 20 20 shutdown..
1c560 20 20 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 30 } result] == 0
1c570 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1c580 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
1c590 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1c5a0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1c5b0 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1c5c0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1c5d0 20 20 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 71 "---- call sq
1c5e0 6c 69 74 65 33 5f 73 68 75 74 64 6f 77 6e 28 29 lite3_shutdown()
1c5f0 2e 2e 2e 20 6f 6b 3a 20 22 20 24 72 65 73 75 6c ... ok: " $resul
1c600 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 t \n]..
1c610 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c }.. } el
1c620 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
1c630 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
1c640 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1c650 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
1c660 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
1c670 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1c680 2d 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 74 65 ---- call sqlite
1c690 33 5f 73 68 75 74 64 6f 77 6e 28 29 2e 2e 2e 20 3_shutdown()...
1c6a0 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 72 error: " \n\t $r
1c6b0 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 esult \n]..
1c6c0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1c6d0 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }.. }..
1c6e0 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 }..... proc r
1c6f0 65 70 6f 72 74 53 51 4c 69 74 65 52 65 73 6f 75 eportSQLiteResou
1c700 72 63 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 rces {..
1c710 20 20 20 20 63 68 61 6e 6e 65 6c 20 7b 71 75 69 channel {qui
1c720 65 74 20 66 61 6c 73 65 7d 20 7b 72 65 73 65 74 et false} {reset
1c730 20 74 72 75 65 7d 20 7b 63 6f 6c 6c 65 63 74 20 true} {collect
1c740 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 true} } {..
1c750 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
1c760 3a 20 49 66 20 61 76 61 69 6c 61 62 6c 65 2c 20 : If available,
1c770 72 65 70 6f 72 74 20 6f 6e 20 28 61 6e 64 20 70 report on (and p
1c780 6f 73 73 69 62 6c 79 20 72 65 73 65 74 29 20 74 ossibly reset) t
1c790 68 65 20 72 75 6e 74 69 6d 65 0d 0a 20 20 20 20 he runtime..
1c7a0 20 20 23 20 20 20 20 20 20 20 63 6f 6e 66 69 67 # config
1c7b0 75 72 61 74 69 6f 6e 20 73 74 61 74 69 73 74 69 uration statisti
1c7c0 63 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 cs... #..
1c7d0 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c if {[haveSQL
1c7e0 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 iteObjectCommand
1c7f0 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] && \..
1c800 20 20 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e [haveConstrain
1c810 74 20 62 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 t buildConfigura
1c820 74 69 6f 6e 2e 44 65 62 75 67 5d 7d 20 74 68 65 tion.Debug]} the
1c830 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
1c840 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
1c850 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
1c860 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
1c870 62 6c 69 63 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 blic -alias \..
1c880 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 Sys
1c890 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
1c8a0 44 65 62 75 67 44 61 74 61 20 73 65 74 74 69 6e DebugData settin
1c8b0 67 52 65 61 64 43 6f 75 6e 74 73 0d 0a 20 20 20 gReadCounts..
1c8c0 20 20 20 20 20 7d 20 73 65 74 74 69 6e 67 52 65 } settingRe
1c8d0 61 64 43 6f 75 6e 74 73 5d 20 3d 3d 20 30 7d 20 adCounts] == 0}
1c8e0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1c8f0 20 20 73 65 74 20 6e 61 6d 65 43 6f 75 6e 74 20 set nameCount
1c900 5b 24 73 65 74 74 69 6e 67 52 65 61 64 43 6f 75 [$settingReadCou
1c910 6e 74 73 20 43 6f 75 6e 74 5d 0d 0a 20 20 20 20 nts Count]..
1c920 20 20 20 20 20 20 73 65 74 20 76 61 6c 75 65 43 set valueC
1c930 6f 75 6e 74 20 30 0d 0a 0d 0a 20 20 20 20 20 20 ount 0....
1c940 20 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 61 object forea
1c950 63 68 20 2d 61 6c 69 61 73 20 70 61 69 72 20 24 ch -alias pair $
1c960 73 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e 74 settingReadCount
1c970 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
1c980 20 69 6e 63 72 20 76 61 6c 75 65 43 6f 75 6e 74 incr valueCount
1c990 20 5b 24 70 61 69 72 20 56 61 6c 75 65 5d 0d 0a [$pair Value]..
1c9a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
1c9b0 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
1c9c0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1c9d0 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
1c9e0 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
1c9f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ca00 20 22 2d 2d 2d 2d 20 73 65 74 74 69 6e 67 20 5c "---- setting \
1ca10 22 22 20 5b 24 70 61 69 72 20 4b 65 79 5d 20 22 "" [$pair Key] "
1ca20 5c 22 20 77 61 73 20 72 65 61 64 20 22 20 5c 0d \" was read " \.
1ca30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1ca40 20 20 20 5b 24 70 61 69 72 20 56 61 6c 75 65 5d [$pair Value]
1ca50 20 22 20 74 69 6d 65 73 5c 6e 22 5d 0d 0a 20 20 " times\n"]..
1ca60 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1ca70 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1ca80 20 20 20 20 20 20 69 66 20 7b 24 72 65 73 65 74 if {$reset
1ca90 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1caa0 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
1cab0 20 7b 24 73 65 74 74 69 6e 67 52 65 61 64 43 6f {$settingReadCo
1cac0 75 6e 74 73 20 43 6c 65 61 72 7d 20 65 72 72 6f unts Clear} erro
1cad0 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d r] == 0} then {.
1cae0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 . i
1caf0 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1cb00 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1cb10 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1cb20 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
1cb30 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1cb40 20 20 20 20 20 20 22 2d 2d 2d 2d 20 72 65 73 65 "---- rese
1cb50 74 20 73 65 74 74 69 6e 67 20 73 74 61 74 69 73 t setting statis
1cb60 74 69 63 73 20 66 6f 72 20 74 68 65 20 70 72 65 tics for the pre
1cb70 76 69 6f 75 73 20 22 20 5c 0d 0a 20 20 20 20 20 vious " \..
1cb80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 $
1cb90 6e 61 6d 65 43 6f 75 6e 74 20 22 20 6e 61 6d 65 nameCount " name
1cba0 73 20 61 6e 64 20 22 20 24 76 61 6c 75 65 43 6f s and " $valueCo
1cbb0 75 6e 74 20 22 20 76 61 6c 75 65 73 20 72 65 61 unt " values rea
1cbc0 64 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 d\n"]..
1cbd0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1cbe0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
1cbf0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1cc00 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
1cc10 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1cc20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d "===
1cc30 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 = WARNING: faile
1cc40 64 20 74 6f 20 72 65 73 65 74 20 73 65 74 74 69 d to reset setti
1cc50 6e 67 20 73 74 61 74 69 73 74 69 63 73 20 66 6f ng statistics fo
1cc60 72 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 r " \..
1cc70 20 20 20 20 20 20 20 20 20 22 74 68 65 20 70 72 "the pr
1cc80 65 76 69 6f 75 73 20 22 20 24 6e 61 6d 65 43 6f evious " $nameCo
1cc90 75 6e 74 20 22 20 6e 61 6d 65 73 20 61 6e 64 20 unt " names and
1cca0 22 20 24 76 61 6c 75 65 43 6f 75 6e 74 20 5c 0d " $valueCount \.
1ccb0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1ccc0 20 20 20 22 20 76 61 6c 75 65 73 20 72 65 61 64 " values read
1ccd0 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 , error: " \n\t
1cce0 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 $error \n]..
1ccf0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1cd00 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1cd10 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 }.... if
1cd20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
1cd30 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
1cd40 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
1cd50 62 6c 69 63 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 blic -alias \..
1cd60 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 Sys
1cd70 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
1cd80 44 65 62 75 67 44 61 74 61 20 73 65 74 74 69 6e DebugData settin
1cd90 67 46 69 6c 65 52 65 61 64 43 6f 75 6e 74 73 0d gFileReadCounts.
1cda0 0a 20 20 20 20 20 20 20 20 7d 20 73 65 74 74 69 . } setti
1cdb0 6e 67 46 69 6c 65 52 65 61 64 43 6f 75 6e 74 73 ngFileReadCounts
1cdc0 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
1cdd0 20 20 20 20 20 20 20 20 20 20 73 65 74 20 6e 61 set na
1cde0 6d 65 43 6f 75 6e 74 20 5b 24 73 65 74 74 69 6e meCount [$settin
1cdf0 67 46 69 6c 65 52 65 61 64 43 6f 75 6e 74 73 20 gFileReadCounts
1ce00 43 6f 75 6e 74 5d 0d 0a 20 20 20 20 20 20 20 20 Count]..
1ce10 20 20 73 65 74 20 76 61 6c 75 65 43 6f 75 6e 74 set valueCount
1ce20 20 30 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 0....
1ce30 6f 62 6a 65 63 74 20 66 6f 72 65 61 63 68 20 2d object foreach -
1ce40 61 6c 69 61 73 20 70 61 69 72 20 24 73 65 74 74 alias pair $sett
1ce50 69 6e 67 46 69 6c 65 52 65 61 64 43 6f 75 6e 74 ingFileReadCount
1ce60 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
1ce70 20 69 6e 63 72 20 76 61 6c 75 65 43 6f 75 6e 74 incr valueCount
1ce80 20 5b 24 70 61 69 72 20 56 61 6c 75 65 5d 0d 0a [$pair Value]..
1ce90 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
1cea0 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
1ceb0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1cec0 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
1ced0 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
1cee0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1cef0 20 22 2d 2d 2d 2d 20 73 65 74 74 69 6e 67 20 5c "---- setting \
1cf00 22 22 20 5b 24 70 61 69 72 20 4b 65 79 5d 20 22 "" [$pair Key] "
1cf10 5c 22 20 77 61 73 20 72 65 61 64 20 22 20 5c 0d \" was read " \.
1cf20 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1cf30 20 20 20 5b 24 70 61 69 72 20 56 61 6c 75 65 5d [$pair Value]
1cf40 20 22 20 74 69 6d 65 73 20 66 72 6f 6d 20 74 68 " times from th
1cf50 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 e configuration
1cf60 66 69 6c 65 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 file\n"]..
1cf70 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1cf80 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1cf90 20 20 69 66 20 7b 24 72 65 73 65 74 7d 20 74 68 if {$reset} th
1cfa0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1cfb0 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 24 73 if {[catch {$s
1cfc0 65 74 74 69 6e 67 46 69 6c 65 52 65 61 64 43 6f ettingFileReadCo
1cfd0 75 6e 74 73 20 43 6c 65 61 72 7d 20 65 72 72 6f unts Clear} erro
1cfe0 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d r] == 0} then {.
1cff0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 . i
1d000 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1d010 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1d020 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1d030 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
1d040 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1d050 20 20 20 20 20 20 22 2d 2d 2d 2d 20 72 65 73 65 "---- rese
1d060 74 20 73 65 74 74 69 6e 67 20 73 74 61 74 69 73 t setting statis
1d070 74 69 63 73 20 66 6f 72 20 74 68 65 20 70 72 65 tics for the pre
1d080 76 69 6f 75 73 20 22 20 5c 0d 0a 20 20 20 20 20 vious " \..
1d090 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 $
1d0a0 6e 61 6d 65 43 6f 75 6e 74 20 22 20 6e 61 6d 65 nameCount " name
1d0b0 73 20 61 6e 64 20 22 20 24 76 61 6c 75 65 43 6f s and " $valueCo
1d0c0 75 6e 74 20 22 20 76 61 6c 75 65 73 20 72 65 61 unt " values rea
1d0d0 64 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 d " \..
1d0e0 20 20 20 20 20 20 20 20 20 20 20 22 66 72 6f 6d "from
1d0f0 20 74 68 65 20 63 6f 6e 66 69 67 75 72 61 74 69 the configurati
1d100 6f 6e 20 66 69 6c 65 5c 6e 22 5d 0d 0a 20 20 20 on file\n"]..
1d110 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
1d120 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 } else
1d130 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1d140 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1d150 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1d160 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1d170 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a "==== WARNING:
1d180 20 66 61 69 6c 65 64 20 74 6f 20 72 65 73 65 74 failed to reset
1d190 20 73 65 74 74 69 6e 67 20 73 74 61 74 69 73 74 setting statist
1d1a0 69 63 73 20 66 6f 72 20 22 20 5c 0d 0a 20 20 20 ics for " \..
1d1b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1d1c0 74 68 65 20 70 72 65 76 69 6f 75 73 20 22 20 24 the previous " $
1d1d0 6e 61 6d 65 43 6f 75 6e 74 20 22 20 6e 61 6d 65 nameCount " name
1d1e0 73 20 61 6e 64 20 22 20 24 76 61 6c 75 65 43 6f s and " $valueCo
1d1f0 75 6e 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 unt \..
1d200 20 20 20 20 20 20 20 20 20 22 20 76 61 6c 75 65 " value
1d210 73 20 72 65 61 64 20 66 72 6f 6d 20 74 68 65 20 s read from the
1d220 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 69 configuration fi
1d230 6c 65 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c le, error: " \n\
1d240 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 t \..
1d250 20 20 20 20 20 20 20 24 65 72 72 6f 72 20 5c 6e $error \n
1d260 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
1d270 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1d280 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1d290 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b }.... if {[
1d2a0 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 haveSQLiteObject
1d2b0 43 6f 6d 6d 61 6e 64 5d 20 26 26 20 5c 0d 0a 20 Command] && \..
1d2c0 20 20 20 20 20 20 20 20 20 5b 68 61 76 65 53 51 [haveSQ
1d2d0 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 61 LiteDefineConsta
1d2e0 6e 74 20 49 4e 54 45 52 4f 50 5f 56 49 52 54 55 nt INTEROP_VIRTU
1d2f0 41 4c 5f 54 41 42 4c 45 5d 20 26 26 20 5c 0d 0a AL_TABLE] && \..
1d300 20 20 20 20 20 20 20 20 20 20 5b 68 61 76 65 53 [haveS
1d310 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 QLiteDefineConst
1d320 61 6e 74 20 54 52 41 43 4b 5f 4d 45 4d 4f 52 59 ant TRACK_MEMORY
1d330 5f 42 59 54 45 53 5d 7d 20 74 68 65 6e 20 7b 0d _BYTES]} then {.
1d340 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 . if {!$q
1d350 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
1d360 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
1d370 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 75 72 hannel "---- cur
1d380 72 65 6e 74 20 6d 65 6d 6f 72 79 20 69 6e 20 75 rent memory in u
1d390 73 65 20 62 79 20 53 51 4c 69 74 65 4d 65 6d 6f se by SQLiteMemo
1d3a0 72 79 2e 2e 2e 20 22 0d 0a 20 20 20 20 20 20 20 ry... "..
1d3b0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 }.... if
1d3c0 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
1d3d0 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 object inv
1d3e0 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 oke -flags +NonP
1d3f0 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 ublic \..
1d400 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 System.Da
1d410 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 ta.SQLite.SQLite
1d420 4d 65 6d 6f 72 79 20 62 79 74 65 73 41 6c 6c 6f Memory bytesAllo
1d430 63 61 74 65 64 0d 0a 20 20 20 20 20 20 20 20 7d cated.. }
1d440 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 30 7d 20 74 memory] == 0} t
1d450 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1d460 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
1d470 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1d480 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1d490 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 [appendArgs $me
1d4a0 6d 6f 72 79 20 22 20 62 79 74 65 73 5c 6e 22 5d mory " bytes\n"]
1d4b0 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1d4c0 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
1d4d0 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 6d . set m
1d4e0 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e 0d 0a 0d emory unknown...
1d4f0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 . if {!
1d500 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1d510 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1d520 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
1d530 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c ndArgs $memory \
1d540 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d n].. }.
1d550 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
1d560 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
1d570 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
1d580 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1d590 6e 65 6c 20 22 2d 2d 2d 2d 20 6d 61 78 69 6d 75 nel "---- maximu
1d5a0 6d 20 6d 65 6d 6f 72 79 20 69 6e 20 75 73 65 20 m memory in use
1d5b0 62 79 20 53 51 4c 69 74 65 4d 65 6d 6f 72 79 2e by SQLiteMemory.
1d5c0 2e 2e 20 22 0d 0a 20 20 20 20 20 20 20 20 7d 0d .. ".. }.
1d5d0 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b ... if {[
1d5e0 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
1d5f0 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
1d600 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c -flags +NonPubl
1d610 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ic \..
1d620 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e System.Data.
1d630 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 4d 65 6d SQLite.SQLiteMem
1d640 6f 72 79 20 6d 61 78 69 6d 75 6d 42 79 74 65 73 ory maximumBytes
1d650 41 6c 6c 6f 63 61 74 65 64 0d 0a 20 20 20 20 20 Allocated..
1d660 20 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 } memory] ==
1d670 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
1d680 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
1d690 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1d6a0 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1d6b0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1d6c0 20 24 6d 65 6d 6f 72 79 20 22 20 62 79 74 65 73 $memory " bytes
1d6d0 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
1d6e0 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 }.. } els
1d6f0 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 e {.. s
1d700 65 74 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 et memory unknow
1d710 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 n.... i
1d720 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1d730 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1d740 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1d750 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f appendArgs $memo
1d760 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 ry \n]..
1d770 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
1d780 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1d790 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
1d7a0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 en {.. tp
1d7b0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d uts $channel "--
1d7c0 2d 2d 20 63 75 72 72 65 6e 74 20 6d 65 6d 6f 72 -- current memor
1d7d0 79 20 69 6e 20 75 73 65 20 62 79 20 53 51 4c 69 y in use by SQLi
1d7e0 74 65 2e 2e 2e 20 22 0d 0a 20 20 20 20 20 20 7d te... ".. }
1d7f0 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 .... if {[h
1d800 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 aveSQLiteObjectC
1d810 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d ommand]} then {.
1d820 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 . if {[ca
1d830 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
1d840 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
1d850 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
1d860 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1d870 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
1d880 4c 69 74 65 2e 55 6e 73 61 66 65 4e 61 74 69 76 Lite.UnsafeNativ
1d890 65 4d 65 74 68 6f 64 73 20 73 71 6c 69 74 65 33 eMethods sqlite3
1d8a0 5f 6d 65 6d 6f 72 79 5f 75 73 65 64 0d 0a 20 20 _memory_used..
1d8b0 20 20 20 20 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 } memory]
1d8c0 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
1d8d0 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
1d8e0 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
1d8f0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1d900 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1d910 72 67 73 20 24 6d 65 6d 6f 72 79 20 22 20 62 79 rgs $memory " by
1d920 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 tes\n"]..
1d930 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 }.. }
1d940 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
1d950 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
1d960 20 4e 4f 54 45 3a 20 4d 61 79 62 65 20 74 68 65 NOTE: Maybe the
1d970 20 53 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 SQLite core lib
1d980 72 61 72 79 20 69 73 20 75 6e 61 76 61 69 6c 61 rary is unavaila
1d990 62 6c 65 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 ble?..
1d9a0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 #.. set
1d9b0 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e 0d memory unknown.
1d9c0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 ... if
1d9d0 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
1d9e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
1d9f0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
1da00 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 pendArgs $memory
1da10 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
1da20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
1da30 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
1da40 20 20 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 set memory
1da50 20 75 6e 61 76 61 69 6c 61 62 6c 65 0d 0a 0d 0a unavailable....
1da60 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
1da70 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
1da80 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
1da90 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
1daa0 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 s $memory \n]..
1dab0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1dac0 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 65 74 20 72 }.... set r
1dad0 65 73 75 6c 74 20 24 6d 65 6d 6f 72 79 3b 20 23 esult $memory; #
1dae0 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 6d 65 NOTE: Return me
1daf0 6d 6f 72 79 20 69 6e 2d 75 73 65 20 74 6f 20 6f mory in-use to o
1db00 75 72 20 63 61 6c 6c 65 72 2e 0d 0a 0d 0a 20 20 ur caller.....
1db10 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
1db20 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1db30 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
1db40 22 2d 2d 2d 2d 20 6d 61 78 69 6d 75 6d 20 6d 65 "---- maximum me
1db50 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 79 20 53 mory in use by S
1db60 51 4c 69 74 65 2e 2e 2e 20 22 0d 0a 20 20 20 20 QLite... "..
1db70 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 }.... if
1db80 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 {[haveSQLiteObje
1db90 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e ctCommand]} then
1dba0 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
1dbb0 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 [catch {..
1dbc0 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b object invok
1dbd0 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 e -flags +NonPub
1dbe0 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 lic \..
1dbf0 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
1dc00 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e 61 .SQLite.UnsafeNa
1dc10 74 69 76 65 4d 65 74 68 6f 64 73 20 5c 0d 0a 20 tiveMethods \..
1dc20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 71 6c sql
1dc30 69 74 65 33 5f 6d 65 6d 6f 72 79 5f 68 69 67 68 ite3_memory_high
1dc40 77 61 74 65 72 20 30 0d 0a 20 20 20 20 20 20 20 water 0..
1dc50 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 30 7d } memory] == 0}
1dc60 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1dc70 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
1dc80 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1dc90 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1dca0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 el [appendArgs $
1dcb0 6d 65 6d 6f 72 79 20 22 20 62 79 74 65 73 5c 6e memory " bytes\n
1dcc0 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d "].. }.
1dcd0 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 . } else
1dce0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a {.. #..
1dcf0 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
1dd00 3a 20 4d 61 79 62 65 20 74 68 65 20 53 51 4c 69 : Maybe the SQLi
1dd10 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 20 te core library
1dd20 69 73 20 75 6e 61 76 61 69 6c 61 62 6c 65 3f 0d is unavailable?.
1dd30 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
1dd40 20 20 20 20 20 20 20 20 73 65 74 20 6d 65 6d 6f set memo
1dd50 72 79 20 75 6e 6b 6e 6f 77 6e 0d 0a 0d 0a 20 20 ry unknown....
1dd60 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
1dd70 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
1dd80 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1dd90 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1dda0 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d rgs $memory \n].
1ddb0 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
1ddc0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
1ddd0 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
1dde0 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e 61 76 set memory unav
1ddf0 61 69 6c 61 62 6c 65 0d 0a 0d 0a 20 20 20 20 20 ailable....
1de00 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
1de10 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1de20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1de30 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 [appendArgs $me
1de40 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 mory \n]..
1de50 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
1de60 20 20 20 20 20 20 69 66 20 7b 24 63 6f 6c 6c 65 if {$colle
1de70 63 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 ct} then {..
1de80 20 20 20 20 63 6f 6c 6c 65 63 74 47 61 72 62 61 collectGarba
1de90 67 65 20 24 63 68 61 6e 6e 65 6c 0d 0a 20 20 20 ge $channel..
1dea0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 }.... if
1deb0 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
1dec0 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
1ded0 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 $channel "----
1dee0 63 75 72 72 65 6e 74 20 6d 65 6d 6f 72 79 20 69 current memory i
1def0 6e 20 75 73 65 20 62 79 20 74 68 65 20 43 4c 52 n use by the CLR
1df00 2e 2e 2e 20 22 0d 0a 20 20 20 20 20 20 7d 0d 0a ... ".. }..
1df10 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 .. if {[hav
1df20 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d eSQLiteObjectCom
1df30 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 mand]} then {..
1df40 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
1df50 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f h {.. o
1df60 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 47 43 20 bject invoke GC
1df70 47 65 74 54 6f 74 61 6c 4d 65 6d 6f 72 79 20 66 GetTotalMemory f
1df80 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 7d 20 alse.. }
1df90 6d 65 6d 6f 72 79 5d 20 3d 3d 20 30 7d 20 74 68 memory] == 0} th
1dfa0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1dfb0 69 66 20 7b 5b 73 74 72 69 6e 67 20 69 73 20 69 if {[string is i
1dfc0 6e 74 65 67 65 72 20 2d 73 74 72 69 63 74 20 24 nteger -strict $
1dfd0 6d 65 6d 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d memory]} then {.
1dfe0 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
1dff0 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
1e000 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1e010 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1e020 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f appendArgs $memo
1e030 72 79 20 22 20 62 79 74 65 73 5c 6e 22 5d 0d 0a ry " bytes\n"]..
1e040 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
1e050 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 } else
1e060 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 {.. s
1e070 65 74 20 6d 65 6d 6f 72 79 20 69 6e 76 61 6c 69 et memory invali
1e080 64 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 d....
1e090 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
1e0a0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1e0b0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1e0c0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 el [appendArgs $
1e0d0 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 memory \n]..
1e0e0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1e0f0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1e100 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
1e110 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 set memory u
1e120 6e 6b 6e 6f 77 6e 0d 0a 0d 0a 20 20 20 20 20 20 nknown....
1e130 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
1e140 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1e150 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1e160 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1e170 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 $memory \n]..
1e180 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1e190 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 }.. } els
1e1a0 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 e {.. set
1e1b0 20 6d 65 6d 6f 72 79 20 75 6e 61 76 61 69 6c 61 memory unavaila
1e1c0 62 6c 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 ble.... i
1e1d0 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1e1e0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 {.. tp
1e1f0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
1e200 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 pendArgs $memory
1e210 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d \n].. }.
1e220 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
1e230 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 6c 74 return $result
1e240 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
1e250 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 51 4c proc checkForSQL
1e260 69 74 65 44 69 72 65 63 74 6f 72 69 65 73 20 7b iteDirectories {
1e270 20 63 68 61 6e 6e 65 6c 20 7b 72 65 73 65 74 20 channel {reset
1e280 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 false} } {..
1e290 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1e2a0 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 65 20 E: Check if the
1e2b0 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 sqlite3_win32_se
1e2c0 74 5f 64 69 72 65 63 74 6f 72 79 20 66 75 6e 63 t_directory func
1e2d0 74 69 6f 6e 20 69 73 20 61 76 61 69 6c 61 62 6c tion is availabl
1e2e0 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e... #..
1e2f0 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
1e300 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 22 l \.. "
1e310 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f ---- checking fo
1e320 72 20 66 75 6e 63 74 69 6f 6e 20 73 71 6c 69 74 r function sqlit
1e330 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 e3_win32_set_dir
1e340 65 63 74 6f 72 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 ectory... "....
1e350 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
1e360 4e 4f 54 45 3a 20 54 68 69 73 20 63 61 6c 6c 20 NOTE: This call
1e370 74 6f 20 74 68 65 20 73 71 6c 69 74 65 33 5f 77 to the sqlite3_w
1e380 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f in32_set_directo
1e390 72 79 20 66 75 6e 63 74 69 6f 6e 20 75 73 65 73 ry function uses
1e3a0 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 the.. #
1e3b0 20 20 20 20 69 6e 76 61 6c 69 64 20 76 61 6c 75 invalid valu
1e3c0 65 20 30 20 66 6f 72 20 74 68 65 20 66 69 72 73 e 0 for the firs
1e3d0 74 20 61 72 67 75 6d 65 6e 74 2e 20 20 54 68 69 t argument. Thi
1e3e0 73 20 63 6f 64 65 20 69 73 20 64 65 73 69 67 6e s code is design
1e3f0 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ed.. #
1e400 20 20 74 6f 20 63 68 65 63 6b 20 69 66 20 63 61 to check if ca
1e410 6c 6c 69 6e 67 20 74 68 65 20 66 75 6e 63 74 69 lling the functi
1e420 6f 6e 20 77 69 6c 6c 20 72 61 69 73 65 20 61 6e on will raise an
1e430 20 65 78 63 65 70 74 69 6f 6e 20 28 69 2e 65 2e exception (i.e.
1e440 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
1e450 74 68 65 20 61 63 74 75 61 6c 20 72 65 73 75 6c the actual resul
1e460 74 20 6f 66 20 74 68 65 20 66 75 6e 63 74 69 6f t of the functio
1e470 6e 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 74 65 n does not matte
1e480 72 20 61 73 20 6c 6f 6e 67 20 61 73 20 6e 6f 0d r as long as no.
1e490 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 . # d
1e4a0 69 72 65 63 74 6f 72 79 20 69 73 20 63 68 61 6e irectory is chan
1e4b0 67 65 64 29 2e 0d 0a 20 20 20 20 20 20 23 0d 0a ged)... #..
1e4c0 20 20 20 20 20 20 69 66 20 7b 5b 69 73 57 69 6e if {[isWin
1e4d0 64 6f 77 73 5d 20 26 26 20 5b 63 61 74 63 68 20 dows] && [catch
1e4e0 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 {.. objec
1e4f0 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 t invoke -flags
1e500 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 +NonPublic \..
1e510 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
1e520 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 .Data.SQLite.Uns
1e530 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 afeNativeMethods
1e540 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1e550 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 sqlite3_win32_se
1e560 74 5f 64 69 72 65 63 74 6f 72 79 20 30 20 6e 75 t_directory 0 nu
1e570 6c 6c 0d 0a 20 20 20 20 20 20 7d 5d 20 3d 3d 20 ll.. }] ==
1e580 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
1e590 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
1e5a0 4e 4f 54 45 3a 20 43 61 6c 6c 69 6e 67 20 74 68 NOTE: Calling th
1e5b0 65 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f e sqlite3_win32_
1e5c0 73 65 74 5f 64 69 72 65 63 74 6f 72 79 20 66 75 set_directory fu
1e5d0 6e 63 74 69 6f 6e 20 64 6f 65 73 20 6e 6f 74 0d nction does not.
1e5e0 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
1e5f0 20 63 61 75 73 65 20 61 6e 20 65 78 63 65 70 74 cause an except
1e600 69 6f 6e 3b 20 74 68 65 72 65 66 6f 72 65 2c 20 ion; therefore,
1e610 69 74 20 6d 75 73 74 20 62 65 20 61 76 61 69 6c it must be avail
1e620 61 62 6c 65 20 28 69 2e 65 2e 0d 0a 20 20 20 20 able (i.e...
1e630 20 20 20 20 23 20 20 20 20 20 20 20 65 76 65 6e # even
1e640 20 74 68 6f 75 67 68 20 69 74 20 73 68 6f 75 6c though it shoul
1e650 64 20 72 65 74 75 72 6e 20 61 20 66 61 69 6c 75 d return a failu
1e660 72 65 20 72 65 74 75 72 6e 20 63 6f 64 65 20 69 re return code i
1e670 6e 20 74 68 69 73 0d 0a 20 20 20 20 20 20 20 20 n this..
1e680 23 20 20 20 20 20 20 20 63 61 73 65 29 2e 0d 0a # case)...
1e690 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1e6a0 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 addConstraint
1e6b0 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 sqlite3_win32_s
1e6c0 65 74 5f 64 69 72 65 63 74 6f 72 79 0d 0a 0d 0a et_directory....
1e6d0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
1e6e0 68 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a 0d 0a hannel yes\n....
1e6f0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1e700 20 20 20 23 20 4e 4f 54 45 3a 20 44 6f 65 73 20 # NOTE: Does
1e710 6f 75 72 20 63 61 6c 6c 65 72 20 77 61 6e 74 20 our caller want
1e720 74 6f 20 72 65 73 65 74 20 74 68 65 20 64 69 72 to reset the dir
1e730 65 63 74 6f 72 69 65 73 3f 0d 0a 20 20 20 20 20 ectories?..
1e740 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 #.. if
1e750 20 7b 24 72 65 73 65 74 7d 20 74 68 65 6e 20 7b {$reset} then {
1e760 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
1e770 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
1e780 20 4e 6f 77 20 6d 61 6b 65 20 73 75 72 65 20 74 Now make sure t
1e790 68 65 20 64 61 74 61 62 61 73 65 20 61 6e 64 20 he database and
1e7a0 74 65 6d 70 6f 72 61 72 79 20 64 69 72 65 63 74 temporary direct
1e7b0 6f 72 69 65 73 20 61 72 65 0d 0a 20 20 20 20 20 ories are..
1e7c0 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 73 # res
1e7d0 65 74 20 74 68 65 69 72 20 64 65 66 61 75 6c 74 et their default
1e7e0 20 76 61 6c 75 65 73 2c 20 77 68 69 63 68 20 73 values, which s
1e7f0 68 6f 75 6c 64 20 62 65 20 6e 75 6c 6c 20 66 6f hould be null fo
1e800 72 20 62 6f 74 68 2e 0d 0a 20 20 20 20 20 20 20 r both...
1e810 20 20 20 23 20 20 20 20 20 20 20 53 69 6e 63 65 # Since
1e820 20 74 68 65 20 73 71 6c 69 74 65 33 5f 77 69 6e the sqlite3_win
1e830 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 32_set_directory
1e840 20 66 75 6e 63 74 69 6f 6e 20 69 73 20 61 76 61 function is ava
1e850 69 6c 61 62 6c 65 2c 0d 0a 20 20 20 20 20 20 20 ilable,..
1e860 20 20 20 23 20 20 20 20 20 20 20 75 73 65 20 69 # use i
1e870 74 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d t... #.
1e880 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 20 7b . for {
1e890 73 65 74 20 69 6e 64 65 78 20 31 7d 20 7b 24 69 set index 1} {$i
1e8a0 6e 64 65 78 20 3c 20 33 7d 20 7b 69 6e 63 72 20 ndex < 3} {incr
1e8b0 69 6e 64 65 78 7d 20 7b 0d 0a 20 20 20 20 20 20 index} {..
1e8c0 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
1e8d0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1e8e0 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
1e8f0 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
1e900 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
1e910 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 System.Da
1e920 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 ta.SQLite.Unsafe
1e930 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 20 5c 0d NativeMethods \.
1e940 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1e950 20 20 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 sqlite3_win32
1e960 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 20 24 _set_directory $
1e970 69 6e 64 65 78 20 6e 75 6c 6c 0d 0a 20 20 20 20 index null..
1e980 20 20 20 20 20 20 20 20 7d 20 72 65 73 75 6c 74 } result
1e990 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
1e9a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
1e9b0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
1e9c0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
1e9d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
1e9e0 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 --- call sqlite3
1e9f0 5f 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 _win32_set_direc
1ea00 74 6f 72 79 28 22 20 24 69 6e 64 65 78 20 5c 0d tory(" $index \.
1ea10 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1ea20 20 20 20 22 2c 20 6e 75 6c 6c 29 2e 2e 2e 20 6f ", null)... o
1ea30 6b 3a 20 22 20 24 72 65 73 75 6c 74 20 5c 6e 5d k: " $result \n]
1ea40 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 .. }
1ea50 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
1ea60 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1ea70 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1ea80 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1ea90 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 61 6c 6c "---- call
1eaa0 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 sqlite3_win32_s
1eab0 65 74 5f 64 69 72 65 63 74 6f 72 79 28 22 20 24 et_directory(" $
1eac0 69 6e 64 65 78 20 5c 0d 0a 20 20 20 20 20 20 20 index \..
1ead0 20 20 20 20 20 20 20 20 20 20 20 22 2c 20 6e 75 ", nu
1eae0 6c 6c 29 2e 2e 2e 20 65 72 72 6f 72 3a 20 22 20 ll)... error: "
1eaf0 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d \n\t $result \n]
1eb00 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
1eb10 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
1eb20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
1eb30 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
1eb40 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
1eb50 6e 6f 5c 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 no\n....
1eb60 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1eb70 45 3a 20 44 6f 65 73 20 6f 75 72 20 63 61 6c 6c E: Does our call
1eb80 65 72 20 77 61 6e 74 20 74 6f 20 72 65 73 65 74 er want to reset
1eb90 20 74 68 65 20 64 69 72 65 63 74 6f 72 69 65 73 the directories
1eba0 3f 20 20 54 68 69 73 20 63 61 6e 20 6f 6e 6c 79 ? This can only
1ebb0 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
1ebc0 20 20 62 65 20 70 65 72 66 6f 72 6d 65 64 20 69 be performed i
1ebd0 66 20 53 51 4c 69 74 65 20 69 73 20 6c 6f 61 64 f SQLite is load
1ebe0 65 64 20 61 6e 64 20 72 65 61 64 79 20 66 6f 72 ed and ready for
1ebf0 20 75 73 65 20 62 79 20 74 68 65 20 74 65 73 74 use by the test
1ec00 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
1ec10 20 20 73 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 suite...
1ec20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 #.. if
1ec30 7b 24 72 65 73 65 74 20 26 26 20 5b 69 73 53 51 {$reset && [isSQ
1ec40 4c 69 74 65 52 65 61 64 79 5d 7d 20 74 68 65 6e LiteReady]} then
1ec50 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d {.. #.
1ec60 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 . # NOT
1ec70 45 3a 20 4e 6f 77 20 6d 61 6b 65 20 73 75 72 65 E: Now make sure
1ec80 20 74 68 65 20 64 61 74 61 62 61 73 65 20 61 6e the database an
1ec90 64 20 74 65 6d 70 6f 72 61 72 79 20 64 69 72 65 d temporary dire
1eca0 63 74 6f 72 69 65 73 20 61 72 65 0d 0a 20 20 20 ctories are..
1ecb0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 # r
1ecc0 65 73 65 74 20 74 68 65 69 72 20 64 65 66 61 75 eset their defau
1ecd0 6c 74 20 76 61 6c 75 65 73 2c 20 77 68 69 63 68 lt values, which
1ece0 20 73 68 6f 75 6c 64 20 62 65 20 6e 75 6c 6c 20 should be null
1ecf0 66 6f 72 20 62 6f 74 68 2e 0d 0a 20 20 20 20 20 for both...
1ed00 20 20 20 20 20 23 20 20 20 20 20 20 20 53 69 6e # Sin
1ed10 63 65 20 74 68 65 20 73 71 6c 69 74 65 33 5f 77 ce the sqlite3_w
1ed20 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f in32_set_directo
1ed30 72 79 20 66 75 6e 63 74 69 6f 6e 20 64 6f 65 73 ry function does
1ed40 20 6e 6f 74 0d 0a 20 20 20 20 20 20 20 20 20 20 not..
1ed50 23 20 20 20 20 20 20 20 61 70 70 65 61 72 20 74 # appear t
1ed60 6f 20 62 65 20 61 76 61 69 6c 61 62 6c 65 2c 20 o be available,
1ed70 75 73 65 20 74 68 65 20 61 73 73 6f 63 69 61 74 use the associat
1ed80 65 64 20 50 52 41 47 4d 41 20 63 6f 6d 6d 61 6e ed PRAGMA comman
1ed90 64 73 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 ds.. #
1eda0 20 20 20 20 20 20 69 6e 73 74 65 61 64 2e 0d 0a instead...
1edb0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
1edc0 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 64 foreach d
1edd0 69 72 65 63 74 6f 72 79 20 5b 6c 69 73 74 20 64 irectory [list d
1ede0 61 74 61 5f 73 74 6f 72 65 5f 64 69 72 65 63 74 ata_store_direct
1edf0 6f 72 79 20 74 65 6d 70 5f 73 74 6f 72 65 5f 64 ory temp_store_d
1ee00 69 72 65 63 74 6f 72 79 5d 20 7b 0d 0a 20 20 20 irectory] {..
1ee10 20 20 20 20 20 20 20 20 20 73 65 74 20 73 71 6c set sql
1ee20 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 50 52 [appendArgs "PR
1ee30 41 47 4d 41 20 22 20 24 64 69 72 65 63 74 6f 72 AGMA " $director
1ee40 79 20 22 20 3d 20 5c 22 5c 22 3b 22 5d 0d 0a 0d y " = \"\";"]...
1ee50 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
1ee60 7b 5b 63 61 74 63 68 20 7b 65 78 65 63 75 74 65 {[catch {execute
1ee70 53 71 6c 20 24 73 71 6c 7d 20 72 65 73 75 6c 74 Sql $sql} result
1ee80 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
1ee90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
1eea0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
1eeb0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
1eec0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
1eed0 2d 2d 2d 20 65 78 65 63 75 74 65 20 50 52 41 47 --- execute PRAG
1eee0 4d 41 20 22 20 24 64 69 72 65 63 74 6f 72 79 20 MA " $directory
1eef0 22 2e 2e 2e 20 6f 6b 3a 20 5c 22 22 20 5c 0d 0a "... ok: \"" \..
1ef00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ef10 20 20 24 72 65 73 75 6c 74 20 5c 22 5c 6e 5d 0d $result \"\n].
1ef20 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 . } e
1ef30 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
1ef40 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1ef50 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1ef60 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1ef70 20 20 20 20 20 22 2d 2d 2d 2d 20 65 78 65 63 75 "---- execu
1ef80 74 65 20 50 52 41 47 4d 41 20 22 20 24 64 69 72 te PRAGMA " $dir
1ef90 65 63 74 6f 72 79 20 22 2e 2e 2e 20 65 72 72 6f ectory "... erro
1efa0 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 r: " \..
1efb0 20 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 \n\t $
1efc0 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 result \n]..
1efd0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1efe0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1eff0 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
1f000 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
1f010 4f 54 45 3a 20 46 69 6e 61 6c 6c 79 2c 20 73 68 OTE: Finally, sh
1f020 6f 77 20 74 68 65 20 63 75 72 72 65 6e 74 20 76 ow the current v
1f030 61 6c 75 65 20 6f 66 20 74 68 65 20 64 61 74 61 alue of the data
1f040 62 61 73 65 20 61 6e 64 20 74 65 6d 70 6f 72 61 base and tempora
1f050 72 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ry.. #
1f060 20 20 64 69 72 65 63 74 6f 72 69 65 73 2e 20 20 directories.
1f070 54 68 69 73 20 63 61 6e 20 6f 6e 6c 79 20 62 65 This can only be
1f080 20 70 65 72 66 6f 72 6d 65 64 20 69 66 20 53 51 performed if SQ
1f090 4c 69 74 65 20 69 73 20 6c 6f 61 64 65 64 0d 0a Lite is loaded..
1f0a0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 6e # an
1f0b0 64 20 72 65 61 64 79 20 66 6f 72 20 75 73 65 20 d ready for use
1f0c0 62 79 20 74 68 65 20 74 65 73 74 20 73 75 69 74 by the test suit
1f0d0 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e... #..
1f0e0 20 20 20 69 66 20 7b 5b 69 73 53 51 4c 69 74 65 if {[isSQLite
1f0f0 52 65 61 64 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a Ready]} then {..
1f100 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
1f110 64 69 72 65 63 74 6f 72 79 20 5b 6c 69 73 74 20 directory [list
1f120 64 61 74 61 5f 73 74 6f 72 65 5f 64 69 72 65 63 data_store_direc
1f130 74 6f 72 79 20 74 65 6d 70 5f 73 74 6f 72 65 5f tory temp_store_
1f140 64 69 72 65 63 74 6f 72 79 5d 20 7b 0d 0a 20 20 directory] {..
1f150 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
1f160 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1f170 67 73 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e gs "---- checkin
1f180 67 20 22 20 24 64 69 72 65 63 74 6f 72 79 20 22 g " $directory "
1f190 2e 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 ... "]....
1f1a0 20 20 20 20 73 65 74 20 73 71 6c 20 5b 61 70 70 set sql [app
1f1b0 65 6e 64 41 72 67 73 20 22 50 52 41 47 4d 41 20 endArgs "PRAGMA
1f1c0 22 20 24 64 69 72 65 63 74 6f 72 79 20 5c 3b 5d " $directory \;]
1f1d0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 .... if
1f1e0 20 7b 5b 63 61 74 63 68 20 7b 65 78 65 63 75 74 {[catch {execut
1f1f0 65 53 71 6c 20 24 73 71 6c 20 73 63 61 6c 61 72 eSql $sql scalar
1f200 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 } result] == 0}
1f210 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1f220 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1f230 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 el [appendArgs "
1f240 6f 6b 3a 20 5c 22 22 20 24 72 65 73 75 6c 74 20 ok: \"" $result
1f250 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 \"\n]..
1f260 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
1f270 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
1f280 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
1f290 73 20 22 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 s "error: " \n\t
1f2a0 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 $result \n]..
1f2b0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1f2c0 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
1f2d0 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
1f2e0 63 20 6c 6f 61 64 53 51 4c 69 74 65 54 65 73 74 c loadSQLiteTest
1f2f0 53 65 74 74 69 6e 67 73 20 7b 20 63 68 61 6e 6e Settings { chann
1f300 65 6c 20 7b 73 75 66 66 69 78 20 22 22 7d 20 7b el {suffix ""} {
1f310 71 75 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b quiet false} } {
1f320 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
1f330 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 6c 6f # NOTE: Skip lo
1f340 61 64 69 6e 67 20 74 68 65 20 73 65 74 74 69 6e ading the settin
1f350 67 73 20 69 66 20 74 68 65 69 72 20 75 73 61 67 gs if their usag
1f360 65 20 68 61 73 20 62 65 65 6e 20 64 69 73 61 62 e has been disab
1f370 6c 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 led... #..
1f380 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
1f390 65 78 69 73 74 73 20 3a 3a 6e 6f 28 73 71 6c 69 exists ::no(sqli
1f3a0 74 65 54 65 73 74 53 65 74 74 69 6e 67 73 29 5d teTestSettings)]
1f3b0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1f3c0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
1f3d0 4f 54 45 3a 20 4c 6f 61 64 20 63 75 73 74 6f 6d OTE: Load custom
1f3e0 20 70 65 72 2d 75 73 65 72 20 61 6e 64 2f 6f 72 per-user and/or
1f3f0 20 70 65 72 2d 68 6f 73 74 20 74 65 73 74 20 73 per-host test s
1f400 65 74 74 69 6e 67 73 20 6e 6f 77 2e 0d 0a 20 20 ettings now...
1f410 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1f420 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
1f430 73 20 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d s ::tcl_platform
1f440 28 75 73 65 72 29 5d 7d 20 74 68 65 6e 20 7b 0d (user)]} then {.
1f450 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 75 . set u
1f460 73 65 72 53 65 74 74 69 6e 67 73 46 69 6c 65 4e serSettingsFileN
1f470 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b ame [file join [
1f480 67 65 74 43 6f 6d 6d 6f 6e 44 69 72 65 63 74 6f getCommonDirecto
1f490 72 79 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ry] \..
1f4a0 20 20 20 20 20 5b 61 70 70 65 6e 64 41 72 67 73 [appendArgs
1f4b0 20 73 65 74 74 69 6e 67 73 20 24 73 75 66 66 69 settings $suffi
1f4c0 78 20 2e 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 x . $::tcl_platf
1f4d0 6f 72 6d 28 75 73 65 72 29 20 2e 65 61 67 6c 65 orm(user) .eagle
1f4e0 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 ]]....
1f4f0 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 if {[file exists
1f500 20 24 75 73 65 72 53 65 74 74 69 6e 67 73 46 69 $userSettingsFi
1f510 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d leName]} then {.
1f520 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
1f530 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
1f540 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1f550 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1f560 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1f570 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1f580 22 2d 2d 2d 2d 20 6c 6f 61 64 69 6e 67 20 70 65 "---- loading pe
1f590 72 2d 75 73 65 72 20 74 65 73 74 20 73 65 74 74 r-user test sett
1f5a0 69 6e 67 73 20 66 69 6c 65 20 5c 22 22 20 5c 0d ings file \"" \.
1f5b0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1f5c0 20 20 20 24 75 73 65 72 53 65 74 74 69 6e 67 73 $userSettings
1f5d0 46 69 6c 65 4e 61 6d 65 20 5c 22 2e 2e 2e 5c 6e FileName \"...\n
1f5e0 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
1f5f0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
1f600 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 if {[catch {..
1f610 20 20 20 20 20 20 20 20 20 20 20 20 75 70 6c 65 uple
1f620 76 65 6c 20 31 20 5b 6c 69 73 74 20 73 6f 75 72 vel 1 [list sour
1f630 63 65 20 24 75 73 65 72 53 65 74 74 69 6e 67 73 ce $userSettings
1f640 46 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 FileName]..
1f650 20 20 20 20 20 20 20 7d 20 65 72 72 6f 72 5d 7d } error]}
1f660 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1f670 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
1f680 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
1f690 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1f6a0 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
1f6b0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1f6c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d "=
1f6d0 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 === WARNING: fai
1f6e0 6c 65 64 20 74 6f 20 6c 6f 61 64 20 70 65 72 2d led to load per-
1f6f0 75 73 65 72 20 73 65 74 74 69 6e 67 73 20 66 69 user settings fi
1f700 6c 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 le \"" \..
1f710 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 75 $u
1f720 73 65 72 53 65 74 74 69 6e 67 73 46 69 6c 65 4e serSettingsFileN
1f730 61 6d 65 20 22 5c 22 2c 20 65 72 72 6f 72 3a 20 ame "\", error:
1f740 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e " \n\t $error \n
1f750 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ]..
1f760 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
1f770 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 }.. } e
1f780 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
1f790 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
1f7a0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1f7b0 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1f7c0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1f7d0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1f7e0 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 "---- skip
1f7f0 70 65 64 20 6c 6f 61 64 69 6e 67 20 70 65 72 2d ped loading per-
1f800 75 73 65 72 20 74 65 73 74 20 73 65 74 74 69 6e user test settin
1f810 67 73 20 66 69 6c 65 20 5c 22 22 20 5c 0d 0a 20 gs file \"" \..
1f820 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1f830 20 24 75 73 65 72 53 65 74 74 69 6e 67 73 46 69 $userSettingsFi
1f840 6c 65 4e 61 6d 65 20 22 5c 22 2c 20 69 74 20 64 leName "\", it d
1f850 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 5c 6e 22 oes not exist\n"
1f860 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
1f870 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1f880 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1f890 20 20 20 20 23 23 23 23 23 23 23 23 23 23 23 23 ############
1f8a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f8b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f8c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f8d0 23 23 23 23 23 23 23 23 23 23 23 0d 0a 0d 0a 20 ###########....
1f8e0 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f if {[info
1f8f0 20 65 78 69 73 74 73 20 3a 3a 74 63 6c 5f 70 6c exists ::tcl_pl
1f900 61 74 66 6f 72 6d 28 68 6f 73 74 29 5d 7d 20 74 atform(host)]} t
1f910 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1f920 20 73 65 74 20 68 6f 73 74 53 65 74 74 69 6e 67 set hostSetting
1f930 73 46 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 sFileName [file
1f940 6a 6f 69 6e 20 5b 67 65 74 43 6f 6d 6d 6f 6e 44 join [getCommonD
1f950 69 72 65 63 74 6f 72 79 5d 20 5c 0d 0a 20 20 20 irectory] \..
1f960 20 20 20 20 20 20 20 20 20 20 20 5b 61 70 70 65 [appe
1f970 6e 64 41 72 67 73 20 73 65 74 74 69 6e 67 73 20 ndArgs settings
1f980 24 73 75 66 66 69 78 20 2e 20 24 3a 3a 74 63 6c $suffix . $::tcl
1f990 5f 70 6c 61 74 66 6f 72 6d 28 68 6f 73 74 29 20 _platform(host)
1f9a0 2e 65 61 67 6c 65 5d 5d 0d 0a 0d 0a 20 20 20 20 .eagle]]....
1f9b0 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 if {[file
1f9c0 65 78 69 73 74 73 20 24 68 6f 73 74 53 65 74 74 exists $hostSett
1f9d0 69 6e 67 73 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 ingsFileName]} t
1f9e0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1f9f0 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
1fa00 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1fa10 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1fa20 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1fa30 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1fa40 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6c 6f 61 64 "---- load
1fa50 69 6e 67 20 70 65 72 2d 68 6f 73 74 20 74 65 73 ing per-host tes
1fa60 74 20 73 65 74 74 69 6e 67 73 20 66 69 6c 65 20 t settings file
1fa70 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 \"" \..
1fa80 20 20 20 20 20 20 20 20 20 24 68 6f 73 74 53 65 $hostSe
1fa90 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 5c ttingsFileName \
1faa0 22 2e 2e 2e 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 "...\n]..
1fab0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1fac0 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
1fad0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1fae0 20 20 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 uplevel 1 [lis
1faf0 74 20 73 6f 75 72 63 65 20 24 68 6f 73 74 53 65 t source $hostSe
1fb00 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 5d 0d ttingsFileName].
1fb10 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 . } e
1fb20 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 rror]} then {..
1fb30 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
1fb40 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
1fb50 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1fb60 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1fb70 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1fb80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1fb90 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e "==== WARNIN
1fba0 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 6c 6f 61 G: failed to loa
1fbb0 64 20 70 65 72 2d 68 6f 73 74 20 73 65 74 74 69 d per-host setti
1fbc0 6e 67 73 20 66 69 6c 65 20 5c 22 22 20 5c 0d 0a ngs file \"" \..
1fbd0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1fbe0 20 20 20 20 24 68 6f 73 74 53 65 74 74 69 6e 67 $hostSetting
1fbf0 73 46 69 6c 65 4e 61 6d 65 20 22 5c 22 2c 20 65 sFileName "\", e
1fc00 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 rror: " \n\t $er
1fc10 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ror \n]..
1fc20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1fc30 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1fc40 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
1fc50 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
1fc60 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
1fc70 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1fc80 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
1fc90 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1fca0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
1fcb0 2d 20 73 6b 69 70 70 65 64 20 6c 6f 61 64 69 6e - skipped loadin
1fcc0 67 20 70 65 72 2d 68 6f 73 74 20 74 65 73 74 20 g per-host test
1fcd0 73 65 74 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 settings file \"
1fce0 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
1fcf0 20 20 20 20 20 20 20 24 68 6f 73 74 53 65 74 74 $hostSett
1fd00 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 22 5c 22 ingsFileName "\"
1fd10 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 , it does not ex
1fd20 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 ist\n"]..
1fd30 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1fd40 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
1fd50 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
1fd60 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 6f 70 79 ... proc copy
1fd70 53 61 6d 70 6c 65 44 61 74 61 62 61 73 65 46 69 SampleDatabaseFi
1fd80 6c 65 73 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 les {} {..
1fd90 75 70 6c 65 76 65 6c 20 31 20 7b 0d 0a 20 20 20 uplevel 1 {..
1fda0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1fdb0 23 20 4e 4f 54 45 3a 20 43 6f 70 79 20 28 6f 72 # NOTE: Copy (or
1fdc0 20 72 65 2d 63 6f 70 79 29 20 74 68 65 20 72 65 re-copy) the re
1fdd0 66 65 72 65 6e 63 65 20 64 61 74 61 62 61 73 65 ference database
1fde0 20 66 69 6c 65 20 75 73 65 64 20 66 6f 72 20 74 file used for t
1fdf0 68 69 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 his.. #
1fe00 20 20 20 20 20 75 6e 69 74 20 74 65 73 74 20 74 unit test t
1fe10 6f 20 74 68 65 20 62 75 69 6c 64 20 64 69 72 65 o the build dire
1fe20 63 74 6f 72 79 20 69 6e 20 63 61 73 65 20 69 74 ctory in case it
1fe30 20 68 61 73 20 62 65 65 6e 20 63 68 61 6e 67 65 has been change
1fe40 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 d.. #
1fe50 20 20 20 62 79 20 61 20 70 72 65 76 69 6f 75 73 by a previous
1fe60 20 74 65 73 74 20 72 75 6e 2e 0d 0a 20 20 20 20 test run...
1fe70 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 66 #.. f
1fe80 69 6c 65 20 63 6f 70 79 20 2d 66 6f 72 63 65 20 ile copy -force
1fe90 24 6e 6f 72 74 68 77 69 6e 64 45 66 44 62 46 69 $northwindEfDbFi
1fea0 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 le \..
1feb0 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 42 [file join [getB
1fec0 75 69 6c 64 44 69 72 65 63 74 6f 72 79 20 74 72 uildDirectory tr
1fed0 75 65 5d 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 ue] [file tail $
1fee0 6e 6f 72 74 68 77 69 6e 64 45 66 44 62 46 69 6c northwindEfDbFil
1fef0 65 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 e]].. }..
1ff00 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
1ff10 20 72 75 6e 53 51 4c 69 74 65 54 65 73 74 50 72 runSQLiteTestPr
1ff20 6f 6c 6f 67 75 65 20 7b 7d 20 7b 0d 0a 20 20 20 ologue {} {..
1ff30 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
1ff40 54 45 3a 20 53 6b 69 70 20 72 75 6e 6e 69 6e 67 TE: Skip running
1ff50 20 6f 75 72 20 63 75 73 74 6f 6d 20 70 72 6f 6c our custom prol
1ff60 6f 67 75 65 20 69 66 20 74 68 65 20 6d 61 69 6e ogue if the main
1ff70 20 6f 6e 65 20 68 61 73 20 62 65 65 6e 0d 0a 20 one has been..
1ff80 20 20 20 20 20 23 20 20 20 20 20 20 20 73 6b 69 # ski
1ff90 70 70 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a pped... #..
1ffa0 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
1ffb0 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 70 72 6f exists ::no(pro
1ffc0 6c 6f 67 75 65 2e 65 61 67 6c 65 29 5d 7d 20 74 logue.eagle)]} t
1ffd0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
1ffe0 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
1fff0 3a 20 4c 6f 61 64 20 74 68 65 20 22 62 65 66 6f : Load the "befo
20000 72 65 2d 63 6f 6e 73 74 72 61 69 6e 74 73 22 20 re-constraints"
20010 63 75 73 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 custom per-user
20020 61 6e 64 2f 6f 72 20 70 65 72 2d 68 6f 73 74 0d and/or per-host.
20030 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
20040 20 74 65 73 74 20 73 65 74 74 69 6e 67 73 20 6e test settings n
20050 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ow... #..
20060 20 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 uplevel
20070 31 20 5b 6c 69 73 74 20 6c 6f 61 64 53 51 4c 69 1 [list loadSQLi
20080 74 65 54 65 73 74 53 65 74 74 69 6e 67 73 20 24 teTestSettings $
20090 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 2e ::test_channel .
200a0 62 65 66 6f 72 65 5d 0d 0a 0d 0a 20 20 20 20 20 before]....
200b0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
200c0 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 NOTE: Check if t
200d0 68 65 20 5b 6f 62 6a 65 63 74 5d 20 63 6f 6d 6d he [object] comm
200e0 61 6e 64 20 69 73 20 61 76 61 69 6c 61 62 6c 65 and is available
200f0 3b 20 69 66 20 6e 6f 74 2c 20 61 64 64 20 73 6f ; if not, add so
20100 6d 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 me.. #
20110 20 20 20 20 73 68 69 6d 73 20 74 6f 20 6d 61 6b shims to mak
20120 65 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 e the test suite
20130 20 72 75 6e 20 73 6d 6f 6f 74 68 65 72 2e 0d 0a run smoother...
20140 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
20150 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 checkForSQLit
20160 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 20 24 eObjectCommand $
20170 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a ::test_channel..
20180 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
20190 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 65 74 # NOTE: Det
201a0 65 72 6d 69 6e 65 20 74 68 65 20 6e 61 6d 65 73 ermine the names
201b0 20 6f 66 20 74 68 65 20 6e 61 74 69 76 65 20 70 of the native p
201c0 6c 61 74 66 6f 72 6d 20 61 6e 64 20 61 72 63 68 latform and arch
201d0 69 74 65 63 74 75 72 65 2e 0d 0a 20 20 20 20 20 itecture...
201e0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 #.. se
201f0 74 20 70 6c 61 74 66 6f 72 6d 20 5b 67 65 74 42 t platform [getB
20200 75 69 6c 64 50 6c 61 74 66 6f 72 6d 20 74 72 75 uildPlatform tru
20210 65 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 e].. set
20220 61 72 63 68 69 74 65 63 74 75 72 65 20 5b 61 72 architecture [ar
20230 63 68 69 74 65 63 74 75 72 65 46 6f 72 50 6c 61 chitectureForPla
20240 74 66 6f 72 6d 20 24 70 6c 61 74 66 6f 72 6d 5d tform $platform]
20250 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
20260 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 # NOTE: S
20270 68 6f 77 20 74 68 65 20 70 6c 61 74 66 6f 72 6d how the platform
20280 20 61 6e 64 20 61 72 63 68 69 74 65 63 74 75 72 and architectur
20290 65 20 75 73 65 64 20 74 6f 20 68 65 6c 70 20 6c e used to help l
202a0 6f 63 61 74 65 20 74 68 65 0d 0a 20 20 20 20 20 ocate the..
202b0 20 20 20 23 20 20 20 20 20 20 20 6e 61 74 69 76 # nativ
202c0 65 20 62 75 69 6c 64 20 66 69 6c 65 73 2e 0d 0a e build files...
202d0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
202e0 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
202f0 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
20300 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
20310 20 20 20 20 22 2d 2d 2d 2d 20 70 6c 61 74 66 6f "---- platfo
20320 72 6d 20 66 6f 72 20 6c 6f 63 61 74 69 6e 67 20 rm for locating
20330 6e 61 74 69 76 65 20 62 75 69 6c 64 20 66 69 6c native build fil
20340 65 73 20 69 73 20 5c 22 22 20 5c 0d 0a 20 20 20 es is \"" \..
20350 20 20 20 20 20 20 20 20 20 24 70 6c 61 74 66 6f $platfo
20360 72 6d 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 rm \"\n]....
20370 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
20380 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
20390 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
203a0 20 20 20 20 20 22 2d 2d 2d 2d 20 61 72 63 68 69 "---- archi
203b0 74 65 63 74 75 72 65 20 66 6f 72 20 6c 6f 63 61 tecture for loca
203c0 74 69 6e 67 20 6e 61 74 69 76 65 20 62 75 69 6c ting native buil
203d0 64 20 66 69 6c 65 73 20 69 73 20 5c 22 22 20 5c d files is \"" \
203e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 61 .. $a
203f0 72 63 68 69 74 65 63 74 75 72 65 20 5c 22 5c 6e rchitecture \"\n
20400 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ].... #..
20410 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
20420 42 75 69 6c 64 20 61 20 6c 69 73 74 20 6f 66 20 Build a list of
20430 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 69 configuration fi
20440 6c 65 73 20 74 68 61 74 20 77 65 20 68 61 6e 64 les that we hand
20450 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a le... #..
20460 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 6e 66 set conf
20470 69 67 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 igFileNames [lis
20480 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 t \..
20490 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
204a0 69 74 65 2e 64 6c 6c 2e 63 6f 6e 66 69 67 5d 0d ite.dll.config].
204b0 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
204c0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 # NOTE: Bu
204d0 69 6c 64 20 61 20 6c 69 73 74 20 6f 66 20 61 75 ild a list of au
204e0 78 69 6c 69 61 72 79 20 4d 61 6e 61 67 65 64 20 xiliary Managed
204f0 44 65 62 75 67 67 69 6e 67 20 41 73 73 69 73 74 Debugging Assist
20500 61 6e 74 73 20 28 4d 44 41 29 0d 0a 20 20 20 20 ants (MDA)..
20510 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 66 # conf
20520 69 67 75 72 61 74 69 6f 6e 20 66 69 6c 65 73 20 iguration files
20530 74 68 61 74 20 77 65 20 68 61 6e 64 6c 65 2e 0d that we handle..
20540 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
20550 20 20 20 20 73 65 74 20 6d 64 61 43 6f 6e 66 69 set mdaConfi
20560 67 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 gFileNames [list
20570 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
20580 45 61 67 6c 65 53 68 65 6c 6c 33 32 2e 65 78 65 EagleShell32.exe
20590 2e 6d 64 61 2e 63 6f 6e 66 69 67 20 49 6e 73 74 .mda.config Inst
205a0 61 6c 6c 65 72 2e 65 78 65 2e 6d 64 61 2e 63 6f aller.exe.mda.co
205b0 6e 66 69 67 20 5c 0d 0a 20 20 20 20 20 20 20 20 nfig \..
205c0 20 20 20 20 74 65 73 74 2e 65 78 65 2e 6d 64 61 test.exe.mda
205d0 2e 63 6f 6e 66 69 67 20 74 65 73 74 6c 69 6e 71 .config testlinq
205e0 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 69 67 20 .exe.mda.config
205f0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 \.. t
20600 65 73 74 65 66 36 2e 65 78 65 2e 6d 64 61 2e 63 estef6.exe.mda.c
20610 6f 6e 66 69 67 5d 0d 0a 0d 0a 20 20 20 20 20 20 onfig]....
20620 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
20630 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 20 6c OTE: Build the l
20640 69 73 74 20 6f 66 20 65 78 74 65 72 6e 61 6c 20 ist of external
20650 66 69 6c 65 73 20 74 68 61 74 20 77 65 20 68 61 files that we ha
20660 6e 64 6c 65 2e 20 20 53 6f 6d 65 20 6f 66 0d 0a ndle. Some of..
20670 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
20680 74 68 65 73 65 20 66 69 6c 65 73 20 6d 61 79 20 these files may
20690 62 65 20 6e 61 74 69 76 65 20 61 6e 64 2f 6f 72 be native and/or
206a0 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c managed assembl
206b0 69 65 73 20 74 68 61 74 20 61 72 65 0d 0a 20 20 ies that are..
206c0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 # re
206d0 71 75 69 72 65 64 20 74 6f 20 70 65 72 66 6f 72 quired to perfor
206e0 6d 20 76 61 72 69 6f 75 73 20 74 65 73 74 73 2e m various tests.
206f0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
20700 20 20 20 20 20 73 65 74 20 65 78 74 65 72 6e 61 set externa
20710 6c 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 lFileNames [list
20720 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
20730 5b 66 69 6c 65 20 6a 6f 69 6e 20 45 6e 74 69 74 [file join Entit
20740 79 46 72 61 6d 65 77 6f 72 6b 20 6c 69 62 20 5b yFramework lib [
20750 73 74 72 69 6e 67 20 6d 61 70 20 5b 6c 69 73 74 string map [list
20760 20 46 78 20 22 22 5d 20 5c 0d 0a 20 20 20 20 20 Fx ""] \..
20770 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6d [string m
20780 61 70 20 5b 6c 69 73 74 20 6e 65 74 46 78 34 35 ap [list netFx45
20790 31 20 6e 65 74 46 78 34 35 20 6e 65 74 46 78 34 1 netFx45 netFx4
207a0 35 32 20 6e 65 74 46 78 34 35 20 6e 65 74 46 78 52 netFx45 netFx
207b0 34 36 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 46 \..
207c0 20 20 6e 65 74 46 78 34 35 20 6e 65 74 46 78 34 netFx45 netFx4
207d0 36 31 20 6e 65 74 46 78 34 35 20 6e 65 74 46 78 61 netFx45 netFx
207e0 34 36 32 20 6e 65 74 46 78 34 35 5d 20 5b 67 65 462 netFx45] [ge
207f0 74 42 75 69 6c 64 4e 65 74 46 78 5d 5d 5d 20 5c tBuildNetFx]]] \
20800 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 45 6e .. En
20810 74 69 74 79 46 72 61 6d 65 77 6f 72 6b 2e 64 6c tityFramework.dl
20820 6c 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 l]].... #
20830 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
20840 3a 20 42 75 69 6c 64 20 74 68 65 20 6c 69 73 74 : Build the list
20850 20 6f 66 20 6e 61 74 69 76 65 20 61 73 73 65 6d of native assem
20860 62 6c 79 20 66 69 6c 65 73 20 74 68 61 74 20 77 bly files that w
20870 65 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 e handle...
20880 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 #.. se
20890 74 20 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 t nativeFileName
208a0 73 20 5b 6c 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 s [list]....
208b0 20 20 20 20 65 76 61 6c 20 6c 61 70 70 65 6e 64 eval lappend
208c0 20 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 nativeFileNames
208d0 20 5b 67 65 74 4e 61 74 69 76 65 4c 69 62 72 61 [getNativeLibra
208e0 72 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d ryFileNamesOnly]
208f0 0d 0a 20 20 20 20 20 20 20 20 65 76 61 6c 20 6c .. eval l
20900 61 70 70 65 6e 64 20 6e 61 74 69 76 65 46 69 6c append nativeFil
20910 65 4e 61 6d 65 73 20 5b 67 65 74 49 6e 74 65 72 eNames [getInter
20920 6f 70 41 73 73 65 6d 62 6c 79 46 69 6c 65 4e 61 opAssemblyFileNa
20930 6d 65 73 4f 6e 6c 79 5d 0d 0a 0d 0a 20 20 20 20 mesOnly]....
20940 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
20950 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 NOTE: Build the
20960 20 6c 69 73 74 20 6f 66 20 6d 69 78 65 64 2d 6d list of mixed-m
20970 6f 64 65 20 61 73 73 65 6d 62 6c 79 20 66 69 6c ode assembly fil
20980 65 73 20 74 68 61 74 20 77 65 20 68 61 6e 64 6c es that we handl
20990 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 e... #..
209a0 20 20 20 20 20 20 20 73 65 74 20 6d 69 78 65 64 set mixed
209b0 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 5d FileNames [list]
209c0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
209d0 5b 68 61 73 52 75 6e 74 69 6d 65 4f 70 74 69 6f [hasRuntimeOptio
209e0 6e 20 6e 61 74 69 76 65 5d 7d 20 74 68 65 6e 20 n native]} then
209f0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6c 61 70 {.. lap
20a00 70 65 6e 64 20 6d 69 78 65 64 46 69 6c 65 4e 61 pend mixedFileNa
20a10 6d 65 73 20 53 79 73 74 65 6d 2e 44 61 74 61 2e mes System.Data.
20a20 53 51 4c 69 74 65 2e 64 6c 6c 0d 0a 20 20 20 20 SQLite.dll..
20a30 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
20a40 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
20a50 54 45 3a 20 42 75 69 6c 64 20 74 68 65 20 6c 69 TE: Build the li
20a60 73 74 20 6f 66 20 6d 61 6e 61 67 65 64 20 61 73 st of managed as
20a70 73 65 6d 62 6c 79 20 66 69 6c 65 73 20 74 68 61 sembly files tha
20a80 74 20 77 65 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 t we handle...
20a90 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
20aa0 20 73 65 74 20 6d 61 6e 61 67 65 64 46 69 6c 65 set managedFile
20ab0 4e 61 6d 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 Names [list \..
20ac0 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 Syste
20ad0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 4c 69 m.Data.SQLite.Li
20ae0 6e 71 2e 64 6c 6c 20 53 79 73 74 65 6d 2e 44 61 nq.dll System.Da
20af0 74 61 2e 53 51 4c 69 74 65 2e 45 46 36 2e 64 6c ta.SQLite.EF6.dl
20b00 6c 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 l].... if
20b10 20 7b 21 5b 68 61 73 52 75 6e 74 69 6d 65 4f 70 {![hasRuntimeOp
20b20 74 69 6f 6e 20 6e 61 74 69 76 65 5d 7d 20 74 68 tion native]} th
20b30 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
20b40 6c 61 70 70 65 6e 64 20 6d 61 6e 61 67 65 64 46 lappend managedF
20b50 69 6c 65 4e 61 6d 65 73 20 53 79 73 74 65 6d 2e ileNames System.
20b60 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 0d Data.SQLite.dll.
20b70 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
20b80 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
20b90 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 74 68 # NOTE: Show th
20ba0 65 20 76 61 72 69 6f 75 73 20 6c 69 73 74 73 20 e various lists
20bb0 6f 66 20 66 69 6c 65 20 6e 61 6d 65 73 20 74 68 of file names th
20bc0 61 74 20 61 72 65 20 68 61 6e 64 6c 65 64 20 62 at are handled b
20bd0 79 20 74 68 69 73 0d 0a 20 20 20 20 20 20 20 20 y this..
20be0 23 20 20 20 20 20 20 20 70 72 6f 63 65 64 75 72 # procedur
20bf0 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 e... #..
20c00 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
20c10 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
20c20 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
20c30 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6c 69 "---- li
20c40 73 74 20 6f 66 20 5c 22 63 6f 6e 66 69 67 75 72 st of \"configur
20c50 61 74 69 6f 6e 5c 22 20 66 69 6c 65 20 6e 61 6d ation\" file nam
20c60 65 73 20 69 73 3a 20 22 20 5c 0d 0a 20 20 20 20 es is: " \..
20c70 20 20 20 20 20 20 20 20 24 63 6f 6e 66 69 67 46 $configF
20c80 69 6c 65 4e 61 6d 65 73 20 5c 6e 5d 0d 0a 0d 0a ileNames \n]....
20c90 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
20ca0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
20cb0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
20cc0 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6c "---- l
20cd0 69 73 74 20 6f 66 20 5c 22 4d 44 41 20 63 6f 6e ist of \"MDA con
20ce0 66 69 67 75 72 61 74 69 6f 6e 5c 22 20 66 69 6c figuration\" fil
20cf0 65 20 6e 61 6d 65 73 20 69 73 3a 20 22 20 5c 0d e names is: " \.
20d00 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 6d 64 . $md
20d10 61 43 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 aConfigFileNames
20d20 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 \n]....
20d30 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
20d40 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
20d50 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
20d60 20 22 2d 2d 2d 2d 20 6c 69 73 74 20 6f 66 20 5c "---- list of \
20d70 22 65 78 74 65 72 6e 61 6c 5c 22 20 66 69 6c 65 "external\" file
20d80 20 6e 61 6d 65 73 20 69 73 3a 20 22 20 24 65 78 names is: " $ex
20d90 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 73 20 ternalFileNames
20da0 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 \n].... t
20db0 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
20dc0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
20dd0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
20de0 22 2d 2d 2d 2d 20 6c 69 73 74 20 6f 66 20 5c 22 "---- list of \"
20df0 6e 61 74 69 76 65 5c 22 20 66 69 6c 65 20 6e 61 native\" file na
20e00 6d 65 73 20 69 73 3a 20 22 20 24 6e 61 74 69 76 mes is: " $nativ
20e10 65 46 69 6c 65 4e 61 6d 65 73 20 5c 6e 5d 0d 0a eFileNames \n]..
20e20 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
20e30 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
20e40 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
20e50 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
20e60 20 6c 69 73 74 20 6f 66 20 5c 22 6d 69 78 65 64 list of \"mixed
20e70 5c 22 20 66 69 6c 65 20 6e 61 6d 65 73 20 69 73 \" file names is
20e80 3a 20 22 20 24 6d 69 78 65 64 46 69 6c 65 4e 61 : " $mixedFileNa
20e90 6d 65 73 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 mes \n]....
20ea0 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
20eb0 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
20ec0 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
20ed0 20 20 20 20 22 2d 2d 2d 2d 20 6c 69 73 74 20 6f "---- list o
20ee0 66 20 5c 22 6d 61 6e 61 67 65 64 5c 22 20 66 69 f \"managed\" fi
20ef0 6c 65 20 6e 61 6d 65 73 20 69 73 3a 20 22 20 24 le names is: " $
20f00 6d 61 6e 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 managedFileNames
20f10 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 \n]....
20f20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
20f30 45 3a 20 52 65 6d 6f 76 65 20 61 6e 79 20 74 65 E: Remove any te
20f40 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 74 st constraints t
20f50 68 61 74 20 72 65 66 65 72 20 74 6f 20 74 68 65 hat refer to the
20f60 20 6e 61 74 69 76 65 20 61 6e 64 2f 6f 72 0d 0a native and/or..
20f70 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
20f80 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 79 managed assembly
20f90 20 66 69 6c 65 73 20 74 68 61 74 20 77 65 20 68 files that we h
20fa0 61 6e 64 6c 65 20 75 6e 6c 65 73 73 20 66 6f 72 andle unless for
20fb0 62 69 64 64 65 6e 20 66 72 6f 6d 0d 0a 20 20 20 bidden from..
20fc0 20 20 20 20 20 23 20 20 20 20 20 20 20 64 6f 69 # doi
20fd0 6e 67 20 73 6f 2e 0d 0a 20 20 20 20 20 20 20 20 ng so...
20fe0 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
20ff0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
21000 6f 28 73 71 6c 69 74 65 52 65 6d 6f 76 65 43 6f o(sqliteRemoveCo
21010 6e 73 74 72 61 69 6e 74 73 29 5d 7d 20 74 68 65 nstraints)]} the
21020 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 n {.. f
21030 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 oreach fileName
21040 24 63 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 $configFileNames
21050 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
21060 72 65 6d 6f 76 65 43 6f 6e 73 74 72 61 69 6e 74 removeConstraint
21070 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
21080 65 5f 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 e_ $fileName]..
21090 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
210a0 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
210b0 66 69 6c 65 4e 61 6d 65 20 24 6d 64 61 43 6f 6e fileName $mdaCon
210c0 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a figFileNames {..
210d0 20 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 6f remo
210e0 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 veConstraint [ap
210f0 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 24 pendArgs file_ $
21100 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 fileName]..
21110 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
21120 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
21130 4e 61 6d 65 20 24 65 78 74 65 72 6e 61 6c 46 69 Name $externalFi
21140 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
21150 20 20 20 20 20 20 20 72 65 6d 6f 76 65 43 6f 6e removeCon
21160 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
21170 72 67 73 20 66 69 6c 65 5f 20 5b 66 69 6c 65 20 rgs file_ [file
21180 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d 65 5d 5d tail $fileName]]
21190 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d .. }...
211a0 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 . forea
211b0 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6e 61 74 ch fileName $nat
211c0 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a iveFileNames {..
211d0 20 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 6f remo
211e0 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 veConstraint [ap
211f0 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 24 pendArgs file_ $
21200 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 fileName]..
21210 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
21220 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
21230 4e 61 6d 65 20 24 6d 69 78 65 64 46 69 6c 65 4e Name $mixedFileN
21240 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 ames {..
21250 20 20 20 20 72 65 6d 6f 76 65 43 6f 6e 73 74 72 removeConstr
21260 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
21270 20 66 69 6c 65 5f 20 24 66 69 6c 65 4e 61 6d 65 file_ $fileName
21280 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
21290 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 .. fore
212a0 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d 61 ach fileName $ma
212b0 6e 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b nagedFileNames {
212c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
212d0 6d 6f 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b moveConstraint [
212e0 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
212f0 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 $fileName]..
21300 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
21310 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 }.... #
21320 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
21330 3a 20 53 6b 69 70 20 61 6c 6c 20 53 79 73 74 65 : Skip all Syste
21340 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 72 65 m.Data.SQLite re
21350 6c 61 74 65 64 20 66 69 6c 65 20 68 61 6e 64 6c lated file handl
21360 69 6e 67 20 28 64 65 6c 65 74 69 6e 67 2c 0d 0a ing (deleting,..
21370 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
21380 63 6f 70 79 69 6e 67 2c 20 61 6e 64 20 6c 6f 61 copying, and loa
21390 64 69 6e 67 29 20 69 66 20 69 6e 73 74 72 75 63 ding) if instruc
213a0 74 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ted... #.
213b0 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 . if {![i
213c0 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
213d0 73 71 6c 69 74 65 46 69 6c 65 73 29 5d 7d 20 74 sqliteFiles)]} t
213e0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
213f0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 #.. #
21400 4e 4f 54 45 3a 20 53 6b 69 70 20 74 72 79 69 6e NOTE: Skip tryin
21410 67 20 74 6f 20 64 65 6c 65 74 65 20 61 6e 79 20 g to delete any
21420 66 69 6c 65 73 20 69 66 20 69 6e 73 74 72 75 63 files if instruc
21430 74 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ted...
21440 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 #.. if
21450 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
21460 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 65 :no(deleteSqlite
21470 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d Files)]} then {.
21480 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
21490 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
214a0 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 65 :no(deleteSqlite
214b0 43 6f 6e 66 69 67 46 69 6c 65 73 29 5d 7d 20 74 ConfigFiles)]} t
214c0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
214d0 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
214e0 65 4e 61 6d 65 20 24 63 6f 6e 66 69 67 46 69 6c eName $configFil
214f0 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
21500 20 20 20 20 20 20 20 20 20 20 74 72 79 44 65 6c tryDel
21510 65 74 65 42 69 6e 61 72 79 46 69 6c 65 20 24 66 eteBinaryFile $f
21520 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 ileName..
21530 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
21540 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
21550 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
21560 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 o exists ::no(de
21570 6c 65 74 65 53 71 6c 69 74 65 45 78 74 65 72 6e leteSqliteExtern
21580 61 6c 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 alFiles)]} then
21590 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
215a0 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d foreach fileNam
215b0 65 20 24 6d 64 61 43 6f 6e 66 69 67 46 69 6c 65 e $mdaConfigFile
215c0 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 Names {..
215d0 20 20 20 20 20 20 20 20 20 74 72 79 44 65 6c 65 tryDele
215e0 74 65 42 75 69 6c 64 46 69 6c 65 20 24 66 69 6c teBuildFile $fil
215f0 65 4e 61 6d 65 20 66 61 6c 73 65 0d 0a 20 20 20 eName false..
21600 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
21610 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
21620 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
21630 65 78 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 externalFileName
21640 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
21650 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 42 69 tryDeleteBi
21660 6e 61 72 79 46 69 6c 65 20 24 66 69 6c 65 4e 61 naryFile $fileNa
21670 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 me..
21680 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
21690 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
216a0 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
216b0 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 sts ::no(deleteS
216c0 71 6c 69 74 65 4e 61 74 69 76 65 46 69 6c 65 73 qliteNativeFiles
216d0 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 )]} then {..
216e0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
216f0 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
21700 28 64 65 6c 65 74 65 53 71 6c 69 74 65 49 6d 70 (deleteSqliteImp
21710 6c 69 63 69 74 4e 61 74 69 76 65 46 69 6c 65 73 licitNativeFiles
21720 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 )]} then {..
21730 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 fore
21740 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6e 61 ach fileName $na
21750 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d tiveFileNames {.
21760 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
21770 20 20 20 74 72 79 44 65 6c 65 74 65 41 73 73 65 tryDeleteAsse
21780 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 0d 0a mbly $fileName..
21790 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
217a0 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 }..
217b0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
217c0 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
217d0 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 xists ::no(delet
217e0 65 53 71 6c 69 74 65 4e 6f 6e 49 6d 70 6c 69 63 eSqliteNonImplic
217f0 69 74 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 itFiles)]} then
21800 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
21810 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
21820 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 ists ::no(delete
21830 53 71 6c 69 74 65 50 6c 61 74 66 6f 72 6d 46 69 SqlitePlatformFi
21840 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 les)] && \..
21850 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
21860 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
21870 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 7d 20 74 platform] > 0} t
21880 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
21890 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 foreach
218a0 20 66 69 6c 65 4e 61 6d 65 20 24 6e 61 74 69 76 fileName $nativ
218b0 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 eFileNames {..
218c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
218d0 20 20 74 72 79 44 65 6c 65 74 65 41 73 73 65 6d tryDeleteAssem
218e0 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 bly $fileName $p
218f0 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 20 20 20 20 latform..
21900 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
21910 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
21920 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
21930 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
21940 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 ists ::no(delete
21950 53 71 6c 69 74 65 41 72 63 68 69 74 65 63 74 75 SqliteArchitectu
21960 72 65 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a reFiles)] && \..
21970 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
21980 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 [string leng
21990 74 68 20 24 61 72 63 68 69 74 65 63 74 75 72 65 th $architecture
219a0 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
219b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
219c0 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d foreach fileNam
219d0 65 20 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d e $nativeFileNam
219e0 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
219f0 20 20 20 20 20 20 20 20 20 20 74 72 79 44 65 6c tryDel
21a00 65 74 65 41 73 73 65 6d 62 6c 79 20 24 66 69 6c eteAssembly $fil
21a10 65 4e 61 6d 65 20 24 61 72 63 68 69 74 65 63 74 eName $architect
21a20 75 72 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ure..
21a30 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
21a40 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
21a50 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
21a60 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
21a70 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
21a80 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
21a90 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 65 4d 69 o(deleteSqliteMi
21aa0 78 65 64 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e xedFiles)]} then
21ab0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
21ac0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
21ad0 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 # NOTE: If th
21ae0 65 20 22 6e 61 74 69 76 65 22 20 72 75 6e 74 69 e "native" runti
21af0 6d 65 20 6f 70 74 69 6f 6e 20 69 73 20 73 65 74 me option is set
21b00 2c 20 64 65 6c 65 74 65 20 69 6d 70 6c 69 63 69 , delete implici
21b10 74 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 t..
21b20 20 23 20 20 20 20 20 20 20 6d 69 78 65 64 2d 6d # mixed-m
21b30 6f 64 65 20 61 73 73 65 6d 62 6c 79 20 66 69 6c ode assembly fil
21b40 65 73 20 61 73 20 77 65 6c 6c 2e 20 20 54 68 69 es as well. Thi
21b50 73 20 72 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e s runtime option
21b60 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
21b70 23 20 20 20 20 20 20 20 63 68 65 63 6b 20 69 73 # check is
21b80 20 68 61 6e 64 6c 65 64 20 77 68 65 6e 20 62 75 handled when bu
21b90 69 6c 64 69 6e 67 20 74 68 65 20 6c 69 73 74 20 ilding the list
21ba0 6f 66 20 6d 69 78 65 64 2d 6d 6f 64 65 0d 0a 20 of mixed-mode..
21bb0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 #
21bc0 20 20 20 20 20 61 73 73 65 6d 62 6c 79 20 66 69 assembly fi
21bd0 6c 65 20 6e 61 6d 65 73 2e 0d 0a 20 20 20 20 20 le names...
21be0 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
21bf0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
21c00 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
21c10 28 64 65 6c 65 74 65 53 71 6c 69 74 65 49 6d 70 (deleteSqliteImp
21c20 6c 69 63 69 74 4d 69 78 65 64 46 69 6c 65 73 29 licitMixedFiles)
21c30 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
21c40 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 forea
21c50 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d 69 78 ch fileName $mix
21c60 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 edFileNames {..
21c70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
21c80 20 74 72 79 44 65 6c 65 74 65 41 73 73 65 6d 62 tryDeleteAssemb
21c90 6c 79 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 ly $fileName..
21ca0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
21cb0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
21cc0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
21cd0 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
21ce0 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 sts ::no(deleteS
21cf0 71 6c 69 74 65 4e 6f 6e 49 6d 70 6c 69 63 69 74 qliteNonImplicit
21d00 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d Files)]} then {.
21d10 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
21d20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
21d30 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 ts ::no(deleteSq
21d40 6c 69 74 65 50 6c 61 74 66 6f 72 6d 46 69 6c 65 litePlatformFile
21d50 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 s)] && \..
21d60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 73 [s
21d70 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c tring length $pl
21d80 61 74 66 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 65 atform] > 0} the
21d90 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
21da0 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
21db0 69 6c 65 4e 61 6d 65 20 24 6d 69 78 65 64 46 69 ileName $mixedFi
21dc0 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
21dd0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
21de0 72 79 44 65 6c 65 74 65 41 73 73 65 6d 62 6c 79 ryDeleteAssembly
21df0 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 $fileName $plat
21e00 66 6f 72 6d 0d 0a 20 20 20 20 20 20 20 20 20 20 form..
21e10 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
21e20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
21e30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
21e40 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
21e50 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c s ::no(deleteSql
21e60 69 74 65 41 72 63 68 69 74 65 63 74 75 72 65 46 iteArchitectureF
21e70 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 iles)] && \..
21e80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
21e90 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
21ea0 24 61 72 63 68 69 74 65 63 74 75 72 65 5d 20 3e $architecture] >
21eb0 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
21ec0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
21ed0 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
21ee0 6d 69 78 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b mixedFileNames {
21ef0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
21f00 20 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 41 tryDeleteA
21f10 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d ssembly $fileNam
21f20 65 20 24 61 72 63 68 69 74 65 63 74 75 72 65 0d e $architecture.
21f30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
21f40 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
21f50 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
21f60 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
21f70 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
21f80 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
21f90 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 o exists ::no(de
21fa0 6c 65 74 65 53 71 6c 69 74 65 4d 61 6e 61 67 65 leteSqliteManage
21fb0 64 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b dFiles)]} then {
21fc0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
21fd0 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 foreach fileName
21fe0 20 24 6d 61 6e 61 67 65 64 46 69 6c 65 4e 61 6d $managedFileNam
21ff0 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
22000 20 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 41 tryDeleteA
22010 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d ssembly $fileNam
22020 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e..
22030 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
22040 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
22050 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
22060 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
22070 20 43 68 65 63 6b 20 66 6f 72 20 74 68 65 20 22 Check for the "
22080 61 75 74 6f 53 65 6c 65 63 74 22 20 72 75 6e 74 autoSelect" runt
22090 69 6d 65 20 6f 70 74 69 6f 6e 2e 20 20 49 66 20 ime option. If
220a0 70 72 65 73 65 6e 74 2c 0d 0a 20 20 20 20 20 20 present,..
220b0 20 20 20 20 23 20 20 20 20 20 20 20 61 74 74 65 # atte
220c0 6d 70 74 20 74 6f 20 61 75 74 6f 6d 61 74 69 63 mpt to automatic
220d0 61 6c 6c 79 20 73 65 6c 65 63 74 20 74 68 65 20 ally select the
220e0 66 69 72 73 74 20 61 76 61 69 6c 61 62 6c 65 0d first available.
220f0 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
22100 20 20 20 62 75 69 6c 64 20 28 6f 72 20 22 72 65 build (or "re
22110 6c 65 61 73 65 22 29 20 6f 66 20 53 51 4c 69 74 lease") of SQLit
22120 65 20 61 6e 64 20 53 79 73 74 65 6d 2e 44 61 74 e and System.Dat
22130 61 2e 53 51 4c 69 74 65 0d 0a 20 20 20 20 20 20 a.SQLite..
22140 20 20 20 20 23 20 20 20 20 20 20 20 66 6f 72 20 # for
22150 75 73 65 20 77 69 74 68 20 74 68 65 20 74 65 73 use with the tes
22160 74 20 73 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 t suite...
22170 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
22180 20 69 66 20 7b 5b 68 61 73 52 75 6e 74 69 6d 65 if {[hasRuntime
22190 4f 70 74 69 6f 6e 20 61 75 74 6f 53 65 6c 65 63 Option autoSelec
221a0 74 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 t]} then {..
221b0 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 63 68 if {![ch
221c0 65 63 6b 46 6f 72 53 51 4c 69 74 65 42 75 69 6c eckForSQLiteBuil
221d0 64 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ds $::test_chann
221e0 65 6c 20 74 72 75 65 5d 7d 20 74 68 65 6e 20 7b el true]} then {
221f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
22200 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 52 65 checkForSQLiteRe
22210 6c 65 61 73 65 73 20 24 3a 3a 74 65 73 74 5f 63 leases $::test_c
22220 68 61 6e 6e 65 6c 20 74 72 75 65 0d 0a 20 20 20 hannel true..
22230 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
22240 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
22250 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
22260 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 74 # NOTE: Skip t
22270 72 79 69 6e 67 20 74 6f 20 76 65 72 69 66 79 20 rying to verify
22280 74 68 65 20 62 75 69 6c 64 20 64 69 72 65 63 74 the build direct
22290 6f 72 79 20 69 66 20 69 6e 73 74 72 75 63 74 65 ory if instructe
222a0 64 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 d;.. #
222b0 20 20 20 20 20 20 6f 74 68 65 72 77 69 73 65 2c otherwise,
222c0 20 6d 61 6b 65 20 73 75 72 65 20 69 74 20 61 63 make sure it ac
222d0 74 75 61 6c 6c 79 20 65 78 69 73 74 73 20 6f 72 tually exists or
222e0 20 68 61 6c 74 20 74 68 65 20 65 6e 74 69 72 65 halt the entire
222f0 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 .. #
22300 20 20 20 20 74 65 73 74 69 6e 67 20 70 72 6f 63 testing proc
22310 65 73 73 20 69 66 20 69 74 20 64 6f 65 73 20 6e ess if it does n
22320 6f 74 20 65 78 69 73 74 2e 0d 0a 20 20 20 20 20 ot exist...
22330 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
22340 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
22350 73 74 73 20 3a 3a 6e 6f 28 76 65 72 69 66 79 42 sts ::no(verifyB
22360 75 69 6c 64 44 69 72 65 63 74 6f 72 79 29 5d 7d uildDirectory)]}
22370 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
22380 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
22390 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 20 74 # NOTE: At t
223a0 68 69 73 20 70 6f 69 6e 74 2c 20 74 68 65 20 62 his point, the b
223b0 75 69 6c 64 20 64 69 72 65 63 74 6f 72 79 20 4d uild directory M
223c0 55 53 54 20 65 78 69 73 74 20 61 73 20 61 0d 0a UST exist as a..
223d0 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 #
223e0 20 20 20 20 76 61 6c 69 64 20 64 69 72 65 63 74 valid direct
223f0 6f 72 79 20 66 6f 72 20 74 68 65 20 74 65 73 74 ory for the test
22400 69 6e 67 20 70 72 6f 63 65 73 73 20 74 6f 20 63 ing process to c
22410 6f 6e 74 69 6e 75 65 2e 0d 0a 20 20 20 20 20 20 ontinue...
22420 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
22430 20 20 20 20 20 73 65 74 20 64 69 72 65 63 74 6f set directo
22440 72 79 20 5b 67 65 74 42 75 69 6c 64 44 69 72 65 ry [getBuildDire
22450 63 74 6f 72 79 20 66 61 6c 73 65 5d 0d 0a 0d 0a ctory false]....
22460 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
22470 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 64 ![file exists $d
22480 69 72 65 63 74 6f 72 79 5d 20 7c 7c 20 5c 0d 0a irectory] || \..
22490 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
224a0 21 5b 66 69 6c 65 20 69 73 64 69 72 65 63 74 6f ![file isdirecto
224b0 72 79 20 24 64 69 72 65 63 74 6f 72 79 5d 7d 20 ry $directory]}
224c0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
224d0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
224e0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4a # NOTE: J
224f0 75 73 74 20 70 72 69 6f 72 20 74 6f 20 61 63 74 ust prior to act
22500 75 61 6c 6c 79 20 68 61 6c 74 69 6e 67 20 74 68 ually halting th
22510 65 20 74 65 73 74 69 6e 67 20 70 72 6f 63 65 73 e testing proces
22520 73 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 s,..
22530 20 20 23 20 20 20 20 20 20 20 61 64 64 20 61 6e # add an
22540 20 65 72 72 6f 72 20 74 6f 20 74 68 65 20 74 65 error to the te
22550 73 74 20 6c 6f 67 20 66 69 6c 65 2e 0d 0a 20 20 st log file...
22560 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
22570 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 tpu
22580 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
22590 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
225a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
225b0 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 75 6c 64 20 "---- could
225c0 6e 6f 74 20 76 65 72 69 66 79 20 62 75 69 6c 64 not verify build
225d0 20 64 69 72 65 63 74 6f 72 79 20 5c 22 22 20 24 directory \"" $
225e0 64 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 directory \..
225f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
22600 5c 22 2c 20 61 6c 6c 20 74 65 73 74 69 6e 67 20 \", all testing
22610 68 61 6c 74 65 64 5c 6e 22 5d 0d 0a 0d 0a 20 20 halted\n"]....
22620 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
22630 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e # N
22640 4f 54 45 3a 20 52 61 69 73 69 6e 67 20 61 20 73 OTE: Raising a s
22650 63 72 69 70 74 20 65 72 72 6f 72 20 66 72 6f 6d cript error from
22660 20 74 68 69 73 20 70 6f 69 6e 74 20 73 68 6f 75 this point shou
22670 6c 64 20 68 61 6c 74 0d 0a 20 20 20 20 20 20 20 ld halt..
22680 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
22690 68 65 20 74 65 73 74 69 6e 67 20 70 72 6f 63 65 he testing proce
226a0 73 73 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ss...
226b0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
226c0 20 20 20 20 65 72 72 6f 72 20 5b 61 70 70 65 6e error [appen
226d0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
226e0 20 20 20 20 20 20 20 20 20 20 20 22 63 6f 75 6c "coul
226f0 64 20 6e 6f 74 20 76 65 72 69 66 79 20 62 75 69 d not verify bui
22700 6c 64 20 64 69 72 65 63 74 6f 72 79 20 5c 22 22 ld directory \""
22710 20 24 64 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 $directory \..
22720 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
22730 20 22 5c 22 2c 20 61 6c 6c 20 74 65 73 74 69 6e "\", all testin
22740 67 20 68 61 6c 74 65 64 22 5d 0d 0a 20 20 20 20 g halted"]..
22750 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
22760 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
22770 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
22780 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 74 72 # NOTE: Skip tr
22790 79 69 6e 67 20 74 6f 20 63 6f 70 79 20 61 6e 79 ying to copy any
227a0 20 66 69 6c 65 73 20 69 66 20 69 6e 73 74 72 75 files if instru
227b0 63 74 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 cted...
227c0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 #.. if
227d0 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
227e0 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 46 ::no(copySqliteF
227f0 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
22800 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
22810 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
22820 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 43 6f 6e no(copySqliteCon
22830 66 69 67 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e figFiles)]} then
22840 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
22850 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
22860 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 channel \..
22870 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
22880 2d 2d 20 63 6f 70 79 69 6e 67 20 5c 22 63 6f 6e -- copying \"con
22890 66 69 67 75 72 61 74 69 6f 6e 5c 22 20 66 69 6c figuration\" fil
228a0 65 73 2e 2e 2e 5c 6e 22 0d 0a 0d 0a 20 20 20 20 es...\n"....
228b0 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 foreac
228c0 68 20 66 69 6c 65 4e 61 6d 65 20 24 63 6f 6e 66 h fileName $conf
228d0 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 igFileNames {..
228e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
228f0 72 79 43 6f 70 79 42 75 69 6c 64 46 69 6c 65 20 ryCopyBuildFile
22900 24 66 69 6c 65 4e 61 6d 65 20 66 61 6c 73 65 0d $fileName false.
22910 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
22920 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
22930 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 ... i
22940 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
22950 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 ::no(copySqlite
22960 45 78 74 65 72 6e 61 6c 46 69 6c 65 73 29 5d 7d ExternalFiles)]}
22970 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
22980 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
22990 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
229a0 43 6f 70 79 20 74 68 65 20 4d 61 6e 61 67 65 64 Copy the Managed
229b0 20 44 65 62 75 67 67 69 6e 67 20 41 73 73 69 73 Debugging Assis
229c0 74 61 6e 74 73 20 28 4d 44 41 29 20 63 6f 6e 66 tants (MDA) conf
229d0 69 67 75 72 61 74 69 6f 6e 0d 0a 20 20 20 20 20 iguration..
229e0 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
229f0 20 66 69 6c 65 20 66 6f 72 20 74 68 65 20 45 61 file for the Ea
22a00 67 6c 65 20 73 68 65 6c 6c 20 74 6f 20 74 68 65 gle shell to the
22a10 20 62 75 69 6c 64 20 6f 75 74 70 75 74 20 64 69 build output di
22a20 72 65 63 74 6f 72 79 2c 0d 0a 20 20 20 20 20 20 rectory,..
22a30 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
22a40 77 68 69 6c 65 20 75 73 69 6e 67 20 65 61 63 68 while using each
22a50 20 6f 66 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 of the names of
22a60 20 74 68 65 20 76 61 72 69 6f 75 73 20 6c 65 67 the various leg
22a70 61 63 79 20 74 65 73 74 0d 0a 20 20 20 20 20 20 acy test..
22a80 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
22a90 65 78 65 63 75 74 61 62 6c 65 73 2e 20 20 54 68 executables. Th
22aa0 69 73 20 77 69 6c 6c 20 68 65 6c 70 20 74 6f 20 is will help to
22ab0 6d 61 6b 65 20 73 75 72 65 20 74 68 61 74 20 61 make sure that a
22ac0 6c 6c 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 ll the..
22ad0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6c 65 # le
22ae0 67 61 63 79 20 74 65 73 74 73 20 72 75 6e 20 77 gacy tests run w
22af0 69 74 68 20 65 78 61 63 74 6c 79 20 74 68 65 20 ith exactly the
22b00 73 61 6d 65 20 73 65 74 20 6f 66 20 4d 61 6e 61 same set of Mana
22b10 67 65 64 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ged..
22b20 20 20 20 23 20 20 20 20 20 20 20 44 65 62 75 67 # Debug
22b30 67 69 6e 67 20 41 73 73 69 73 74 61 6e 74 73 20 ging Assistants
22b40 63 6f 6e 66 69 67 75 72 65 64 2e 0d 0a 20 20 20 configured...
22b50 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
22b60 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
22b70 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
22b80 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 l \..
22b90 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 "---- cop
22ba0 79 69 6e 67 20 5c 22 4d 44 41 20 63 6f 6e 66 69 ying \"MDA confi
22bb0 67 75 72 61 74 69 6f 6e 5c 22 20 66 69 6c 65 73 guration\" files
22bc0 2e 2e 2e 5c 6e 22 0d 0a 0d 0a 20 20 20 20 20 20 ...\n"....
22bd0 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
22be0 66 69 6c 65 4e 61 6d 65 20 24 6d 64 61 43 6f 6e fileName $mdaCon
22bf0 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a figFileNames {..
22c00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
22c10 74 72 79 43 6f 70 79 42 69 6e 61 72 79 46 69 6c tryCopyBinaryFil
22c20 65 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 e EagleShell.exe
22c30 2e 6d 64 61 2e 63 6f 6e 66 69 67 20 74 72 75 65 .mda.config true
22c40 20 22 22 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 "" $fileName..
22c50 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
22c60 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
22c70 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 #..
22c80 20 23 20 4e 4f 54 45 3a 20 43 6f 70 79 20 74 68 # NOTE: Copy th
22c90 65 20 65 78 74 65 72 6e 61 6c 20 62 69 6e 61 72 e external binar
22ca0 69 65 73 2c 20 69 66 20 61 6e 79 2c 20 74 6f 20 ies, if any, to
22cb0 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 74 68 the directory th
22cc0 61 74 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 at..
22cd0 20 20 23 20 20 20 20 20 20 20 63 6f 6e 74 61 69 # contai
22ce0 6e 73 20 74 68 65 20 45 61 67 6c 65 20 73 68 65 ns the Eagle she
22cf0 6c 6c 2e 20 20 54 68 69 73 20 69 73 20 74 79 70 ll. This is typ
22d00 69 63 61 6c 6c 79 20 75 73 65 64 20 74 6f 20 6d ically used to m
22d10 61 6b 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ake..
22d20 20 20 20 23 20 20 20 20 20 20 20 73 75 72 65 20 # sure
22d30 61 73 73 65 6d 62 6c 69 65 73 20 72 65 66 65 72 assemblies refer
22d40 65 6e 63 65 64 20 62 79 20 74 68 65 20 6f 6e 65 enced by the one
22d50 73 20 62 65 69 6e 67 20 74 65 73 74 65 64 20 61 s being tested a
22d60 72 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 re..
22d70 20 20 23 20 20 20 20 20 20 20 61 76 61 69 6c 61 # availa
22d80 62 6c 65 20 64 75 72 69 6e 67 20 74 68 65 20 74 ble during the t
22d90 65 73 74 69 6e 67 20 70 72 6f 63 65 73 73 2e 0d esting process..
22da0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
22db0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
22dc0 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
22dd0 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 6f 70 79 annel "---- copy
22de0 69 6e 67 20 5c 22 65 78 74 65 72 6e 61 6c 5c 22 ing \"external\"
22df0 20 66 69 6c 65 73 2e 2e 2e 5c 6e 22 0d 0a 0d 0a files...\n"....
22e00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
22e10 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
22e20 65 78 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 externalFileName
22e30 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
22e40 20 20 20 20 20 74 72 79 43 6f 70 79 45 78 74 65 tryCopyExte
22e50 72 6e 61 6c 46 69 6c 65 20 24 66 69 6c 65 4e 61 rnalFile $fileNa
22e60 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 me..
22e70 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
22e80 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
22e90 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
22ea0 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c sts ::no(copySql
22eb0 69 74 65 4e 61 74 69 76 65 46 69 6c 65 73 29 5d iteNativeFiles)]
22ec0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
22ed0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
22ee0 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
22ef0 20 49 66 20 74 68 65 20 74 65 73 74 20 70 6c 61 If the test pla
22f00 74 66 6f 72 6d 20 69 73 20 6c 69 6b 65 6c 79 20 tform is likely
22f10 74 68 65 20 64 65 66 61 75 6c 74 20 66 6f 72 20 the default for
22f20 74 68 69 73 0d 0a 20 20 20 20 20 20 20 20 20 20 this..
22f30 20 20 20 20 23 20 20 20 20 20 20 20 6d 61 63 68 # mach
22f40 69 6e 65 2c 20 61 6c 73 6f 20 74 72 79 20 74 6f ine, also try to
22f50 20 63 6f 70 79 20 74 68 65 20 6e 61 74 69 76 65 copy the native
22f60 20 66 69 6c 65 73 20 74 6f 20 74 68 65 0d 0a 20 files to the..
22f70 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 #
22f80 20 20 20 20 20 62 69 6e 61 72 79 20 6c 6f 63 61 binary loca
22f90 74 69 6f 6e 2e 0d 0a 20 20 20 20 20 20 20 20 20 tion...
22fa0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
22fb0 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
22fc0 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 exists ::no(cop
22fd0 79 53 71 6c 69 74 65 49 6d 70 6c 69 63 69 74 4e ySqliteImplicitN
22fe0 61 74 69 76 65 46 69 6c 65 73 29 5d 20 26 26 20 ativeFiles)] &&
22ff0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
23000 20 20 20 20 20 5b 69 73 44 65 66 61 75 6c 74 42 [isDefaultB
23010 75 69 6c 64 50 6c 61 74 66 6f 72 6d 5d 7d 20 74 uildPlatform]} t
23020 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
23030 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
23040 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a test_channel \..
23050 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23060 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 79 69 6e "---- copyin
23070 67 20 69 6d 70 6c 69 63 69 74 20 5c 22 6e 61 74 g implicit \"nat
23080 69 76 65 5c 22 20 66 69 6c 65 73 2e 2e 2e 5c 6e ive\" files...\n
23090 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 "....
230a0 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
230b0 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 46 69 6c eName $nativeFil
230c0 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
230d0 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 43 tryC
230e0 6f 70 79 41 73 73 65 6d 62 6c 79 20 24 66 69 6c opyAssembly $fil
230f0 65 4e 61 6d 65 20 66 61 6c 73 65 0d 0a 20 20 20 eName false..
23100 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
23110 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
23120 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
23130 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
23140 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 ts ::no(copySqli
23150 74 65 4e 6f 6e 49 6d 70 6c 69 63 69 74 46 69 6c teNonImplicitFil
23160 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 es)]} then {..
23170 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
23180 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
23190 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 50 ::no(copySqliteP
231a0 6c 61 74 66 6f 72 6d 46 69 6c 65 73 29 5d 20 26 latformFiles)] &
231b0 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 & \..
231c0 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 [string
231d0 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 length $platfor
231e0 6d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a m] > 0} then {..
231f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23200 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
23210 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
23220 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
23230 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
23240 2d 2d 20 63 6f 70 79 69 6e 67 20 5c 22 6e 61 74 -- copying \"nat
23250 69 76 65 5c 22 20 66 69 6c 65 73 20 66 6f 72 20 ive\" files for
23260 70 6c 61 74 66 6f 72 6d 20 5c 22 22 20 5c 0d 0a platform \"" \..
23270 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23280 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 6d 20 $platform
23290 5c 22 2e 2e 2e 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 \"...\n]....
232a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
232b0 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
232c0 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 nativeFileNames
232d0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
232e0 20 20 20 20 20 20 20 74 72 79 43 6f 70 79 41 73 tryCopyAs
232f0 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 sembly $fileName
23300 20 66 61 6c 73 65 20 24 70 6c 61 74 66 6f 72 6d false $platform
23310 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
23320 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
23330 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
23340 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
23350 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
23360 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 41 72 63 no(copySqliteArc
23370 68 69 74 65 63 74 75 72 65 46 69 6c 65 73 29 5d hitectureFiles)]
23380 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
23390 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 [stri
233a0 6e 67 20 6c 65 6e 67 74 68 20 24 61 72 63 68 69 ng length $archi
233b0 74 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 74 68 tecture] > 0} th
233c0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
233d0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
233e0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
233f0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
23400 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23410 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 79 69 6e 67 "---- copying
23420 20 5c 22 6e 61 74 69 76 65 5c 22 20 66 69 6c 65 \"native\" file
23430 73 20 66 6f 72 20 61 72 63 68 69 74 65 63 74 75 s for architectu
23440 72 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 re \"" \..
23450 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23460 24 61 72 63 68 69 74 65 63 74 75 72 65 20 5c 22 $architecture \"
23470 2e 2e 2e 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 ...\n]....
23480 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 fore
23490 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6e 61 ach fileName $na
234a0 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d tiveFileNames {.
234b0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
234c0 20 20 20 20 20 74 72 79 43 6f 70 79 41 73 73 65 tryCopyAsse
234d0 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 66 mbly $fileName f
234e0 61 6c 73 65 20 24 61 72 63 68 69 74 65 63 74 75 alse $architectu
234f0 72 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 re..
23500 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
23510 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
23520 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
23530 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
23540 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
23550 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
23560 28 63 6f 70 79 53 71 6c 69 74 65 4d 69 78 65 64 (copySqliteMixed
23570 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d Files)]} then {.
23580 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
23590 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
235a0 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 22 # NOTE: If the "
235b0 6e 61 74 69 76 65 22 20 72 75 6e 74 69 6d 65 20 native" runtime
235c0 6f 70 74 69 6f 6e 20 69 73 20 73 65 74 2c 20 63 option is set, c
235d0 6f 70 79 20 69 6d 70 6c 69 63 69 74 0d 0a 20 20 opy implicit..
235e0 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 #
235f0 20 20 20 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 mixed-mode a
23600 73 73 65 6d 62 6c 79 20 66 69 6c 65 73 20 61 73 ssembly files as
23610 20 77 65 6c 6c 2e 20 20 54 68 65 20 72 75 6e 74 well. The runt
23620 69 6d 65 20 6f 70 74 69 6f 6e 0d 0a 20 20 20 20 ime option..
23630 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
23640 20 20 63 68 65 63 6b 20 69 73 20 68 61 6e 64 6c check is handl
23650 65 64 20 77 68 65 6e 20 62 75 69 6c 64 69 6e 67 ed when building
23660 20 74 68 65 20 6c 69 73 74 20 6f 66 20 6d 69 78 the list of mix
23670 65 64 2d 6d 6f 64 65 0d 0a 20 20 20 20 20 20 20 ed-mode..
23680 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 # a
23690 73 73 65 6d 62 6c 79 20 66 69 6c 65 20 6e 61 6d ssembly file nam
236a0 65 73 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 es...
236b0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
236c0 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
236d0 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 xists ::no(copyS
236e0 71 6c 69 74 65 49 6d 70 6c 69 63 69 74 4d 69 78 qliteImplicitMix
236f0 65 64 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 edFiles)]} then
23700 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
23710 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
23720 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 _channel \..
23730 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23740 22 2d 2d 2d 2d 20 63 6f 70 79 69 6e 67 20 69 6d "---- copying im
23750 70 6c 69 63 69 74 20 5c 22 6d 69 78 65 64 5c 22 plicit \"mixed\"
23760 20 66 69 6c 65 73 2e 2e 2e 5c 6e 22 0d 0a 0d 0a files...\n"....
23770 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23780 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 foreach fileName
23790 20 24 6d 69 78 65 64 46 69 6c 65 4e 61 6d 65 73 $mixedFileNames
237a0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
237b0 20 20 20 20 20 20 74 72 79 43 6f 70 79 41 73 73 tryCopyAss
237c0 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 embly $fileName
237d0 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 20 false..
237e0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
237f0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
23800 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
23810 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
23820 6f 28 63 6f 70 79 53 71 6c 69 74 65 4e 6f 6e 49 o(copySqliteNonI
23830 6d 70 6c 69 63 69 74 46 69 6c 65 73 29 5d 7d 20 mplicitFiles)]}
23840 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
23850 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
23860 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 fo exists ::no(c
23870 6f 70 79 53 71 6c 69 74 65 50 6c 61 74 66 6f 72 opySqlitePlatfor
23880 6d 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 mFiles)] && \..
23890 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
238a0 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 [string lengt
238b0 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 h $platform] > 0
238c0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
238d0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
238e0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
238f0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
23900 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
23910 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 "---- cop
23920 79 69 6e 67 20 5c 22 6d 69 78 65 64 5c 22 20 66 ying \"mixed\" f
23930 69 6c 65 73 20 66 6f 72 20 70 6c 61 74 66 6f 72 iles for platfor
23940 6d 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 m \"" \..
23950 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 $
23960 70 6c 61 74 66 6f 72 6d 20 5c 22 2e 2e 2e 5c 6e platform \"...\n
23970 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ]....
23980 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
23990 69 6c 65 4e 61 6d 65 20 24 6d 69 78 65 64 46 69 ileName $mixedFi
239a0 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
239b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
239c0 72 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 20 24 ryCopyAssembly $
239d0 66 69 6c 65 4e 61 6d 65 20 66 61 6c 73 65 20 24 fileName false $
239e0 70 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 20 20 20 platform..
239f0 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
23a00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
23a10 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
23a20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
23a30 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 xists ::no(copyS
23a40 71 6c 69 74 65 41 72 63 68 69 74 65 63 74 75 72 qliteArchitectur
23a50 65 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 eFiles)] && \..
23a60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23a70 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 [string lengt
23a80 68 20 24 61 72 63 68 69 74 65 63 74 75 72 65 5d h $architecture]
23a90 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
23aa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23ab0 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
23ac0 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
23ad0 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
23ae0 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
23af0 20 63 6f 70 79 69 6e 67 20 5c 22 6d 69 78 65 64 copying \"mixed
23b00 5c 22 20 66 69 6c 65 73 20 66 6f 72 20 61 72 63 \" files for arc
23b10 68 69 74 65 63 74 75 72 65 20 5c 22 22 20 5c 0d hitecture \"" \.
23b20 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
23b30 20 20 20 20 20 20 20 24 61 72 63 68 69 74 65 63 $architec
23b40 74 75 72 65 20 5c 22 2e 2e 2e 5c 6e 5d 0d 0a 0d ture \"...\n]...
23b50 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
23b60 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e foreach fileN
23b70 61 6d 65 20 24 6d 69 78 65 64 46 69 6c 65 4e 61 ame $mixedFileNa
23b80 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 mes {..
23b90 20 20 20 20 20 20 20 20 20 20 20 74 72 79 43 6f tryCo
23ba0 70 79 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 pyAssembly $file
23bb0 4e 61 6d 65 20 66 61 6c 73 65 20 24 61 72 63 68 Name false $arch
23bc0 69 74 65 63 74 75 72 65 0d 0a 20 20 20 20 20 20 itecture..
23bd0 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
23be0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
23bf0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
23c00 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d }.. }
23c10 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
23c20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
23c30 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 s ::no(copySqlit
23c40 65 4d 61 6e 61 67 65 64 46 69 6c 65 73 29 5d 7d eManagedFiles)]}
23c50 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
23c60 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
23c70 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 22 2d 2d test_channel "--
23c80 2d 2d 20 63 6f 70 79 69 6e 67 20 5c 22 6d 61 6e -- copying \"man
23c90 61 67 65 64 5c 22 20 66 69 6c 65 73 2e 2e 2e 5c aged\" files...\
23ca0 6e 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 n"....
23cb0 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
23cc0 4e 61 6d 65 20 24 6d 61 6e 61 67 65 64 46 69 6c Name $managedFil
23cd0 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
23ce0 20 20 20 20 20 20 20 20 20 20 74 72 79 43 6f 70 tryCop
23cf0 79 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e yAssembly $fileN
23d00 61 6d 65 20 74 72 75 65 0d 0a 20 20 20 20 20 20 ame true..
23d10 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
23d20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
23d30 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
23d40 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
23d50 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 74 72 79 # NOTE: Skip try
23d60 69 6e 67 20 74 6f 20 6c 6f 61 64 20 61 6e 79 20 ing to load any
23d70 66 69 6c 65 73 20 69 66 20 69 6e 73 74 72 75 63 files if instruc
23d80 74 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ted...
23d90 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 #.. if
23da0 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
23db0 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 65 46 69 :no(loadSqliteFi
23dc0 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 les)]} then {..
23dd0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
23de0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
23df0 6f 28 6c 6f 61 64 53 71 6c 69 74 65 49 6d 70 6c o(loadSqliteImpl
23e00 69 63 69 74 46 69 6c 65 73 29 5d 7d 20 74 68 65 icitFiles)]} the
23e10 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
23e20 20 20 20 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 tryLoadAssemb
23e30 6c 79 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 ly System.Data.S
23e40 51 4c 69 74 65 2e 64 6c 6c 0d 0a 20 20 20 20 20 QLite.dll..
23e50 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
23e60 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
23e70 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 6c fo exists ::no(l
23e80 6f 61 64 53 71 6c 69 74 65 4c 69 6e 71 46 69 6c oadSqliteLinqFil
23e90 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 es)]} then {..
23ea0 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 4c tryL
23eb0 6f 61 64 41 73 73 65 6d 62 6c 79 20 53 79 73 74 oadAssembly Syst
23ec0 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 4c em.Data.SQLite.L
23ed0 69 6e 71 2e 64 6c 6c 0d 0a 20 20 20 20 20 20 20 inq.dll..
23ee0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
23ef0 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
23f00 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 exists ::no(loa
23f10 64 53 71 6c 69 74 65 45 66 36 46 69 6c 65 73 29 dSqliteEf6Files)
23f20 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
23f30 20 20 20 20 20 20 20 20 20 74 72 79 4c 6f 61 64 tryLoad
23f40 41 73 73 65 6d 62 6c 79 20 53 79 73 74 65 6d 2e Assembly System.
23f50 44 61 74 61 2e 53 51 4c 69 74 65 2e 45 46 36 2e Data.SQLite.EF6.
23f60 64 6c 6c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 dll..
23f70 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
23f80 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
23f90 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c sts ::no(loadSql
23fa0 69 74 65 4e 6f 6e 49 6d 70 6c 69 63 69 74 46 69 iteNonImplicitFi
23fb0 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 les)]} then {..
23fc0 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
23fd0 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
23fe0 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 65 50 6c :no(loadSqlitePl
23ff0 61 74 66 6f 72 6d 46 69 6c 65 73 29 5d 20 26 26 atformFiles)] &&
24000 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
24010 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 [string le
24020 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 ngth $platform]
24030 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
24040 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 try
24050 4c 6f 61 64 41 73 73 65 6d 62 6c 79 20 53 79 73 LoadAssembly Sys
24060 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
24070 64 6c 6c 20 24 70 6c 61 74 66 6f 72 6d 0d 0a 20 dll $platform..
24080 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
24090 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
240a0 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
240b0 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 s ::no(loadSqlit
240c0 65 41 72 63 68 69 74 65 63 74 75 72 65 46 69 6c eArchitectureFil
240d0 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 es)] && \..
240e0 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 [st
240f0 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 61 72 63 ring length $arc
24100 68 69 74 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 hitecture] > 0}
24110 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
24120 20 20 20 20 20 20 20 20 74 72 79 4c 6f 61 64 41 tryLoadA
24130 73 73 65 6d 62 6c 79 20 53 79 73 74 65 6d 2e 44 ssembly System.D
24140 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 20 24 ata.SQLite.dll $
24150 61 72 63 68 69 74 65 63 74 75 72 65 0d 0a 20 20 architecture..
24160 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
24170 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
24180 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
24190 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
241a0 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 foreach fileName
241b0 4f 6e 6c 79 20 24 6e 61 74 69 76 65 46 69 6c 65 Only $nativeFile
241c0 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 Names {..
241d0 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 catch {..
241e0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
241f0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
24200 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
24210 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
24220 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 -- file version
24230 6f 66 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 of \"" $fileName
24240 4f 6e 6c 79 20 22 5c 22 2e 2e 2e 20 5c 22 22 20 Only "\"... \""
24250 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
24260 20 20 20 5b 66 69 6c 65 20 76 65 72 73 69 6f 6e [file version
24270 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e [getBinaryFileN
24280 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c ame $fileNameOnl
24290 79 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 y]] \"\n]..
242a0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
242b0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 }.... for
242c0 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c each fileNameOnl
242d0 79 20 24 6d 69 78 65 64 46 69 6c 65 4e 61 6d 65 y $mixedFileName
242e0 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 s {.. c
242f0 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
24300 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
24310 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
24320 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
24330 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 "---- f
24340 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c ile version of \
24350 22 22 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 "" $fileNameOnly
24360 20 22 5c 22 2e 2e 2e 20 5c 22 22 20 5c 0d 0a 20 "\"... \"" \..
24370 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b [
24380 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 5b 67 65 file version [ge
24390 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 tBinaryFileName
243a0 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d 5d 20 $fileNameOnly]]
243b0 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 \"\n]..
243c0 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
243d0 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 . foreach
243e0 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 6d fileNameOnly $m
243f0 61 6e 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 20 anagedFileNames
24400 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 61 74 {.. cat
24410 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
24420 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
24430 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
24440 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
24450 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c "---- fil
24460 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 e version of \""
24470 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 22 $fileNameOnly "
24480 5c 22 2e 2e 2e 20 5c 22 22 20 5c 0d 0a 20 20 20 \"... \"" \..
24490 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 [fi
244a0 6c 65 20 76 65 72 73 69 6f 6e 20 5b 67 65 74 42 le version [getB
244b0 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 inaryFileName $f
244c0 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d 5d 20 5c 22 ileNameOnly]] \"
244d0 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
244e0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
244f0 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 if {[stri
24500 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 ng length $platf
24510 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b orm] > 0} then {
24520 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 .. fore
24530 61 63 68 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 ach fileNameOnly
24540 20 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 $nativeFileName
24550 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
24560 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 catch {..
24570 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
24580 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
24590 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
245a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
245b0 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 6f ---- file versio
245c0 6e 20 6f 66 20 5c 22 22 20 24 70 6c 61 74 66 6f n of \"" $platfo
245d0 72 6d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 rm \..
245e0 20 20 20 20 20 20 20 20 2f 20 24 66 69 6c 65 4e / $fileN
245f0 61 6d 65 4f 6e 6c 79 20 22 5c 22 2e 2e 2e 20 5c ameOnly "\"... \
24600 22 22 20 5b 66 69 6c 65 20 76 65 72 73 69 6f 6e "" [file version
24610 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
24620 20 20 20 20 20 20 5b 67 65 74 42 69 6e 61 72 79 [getBinary
24630 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 FileName $fileNa
24640 6d 65 4f 6e 6c 79 20 24 70 6c 61 74 66 6f 72 6d meOnly $platform
24650 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 ]] \"\n]..
24660 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
24670 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
24680 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
24690 6d 65 4f 6e 6c 79 20 24 6d 69 78 65 64 46 69 6c meOnly $mixedFil
246a0 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
246b0 20 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 catch {..
246c0 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 tpu
246d0 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
246e0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
246f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
24700 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 "---- file v
24710 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 20 24 70 ersion of \"" $p
24720 6c 61 74 66 6f 72 6d 20 5c 0d 0a 20 20 20 20 20 latform \..
24730 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 24 / $
24740 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 22 5c 22 fileNameOnly "\"
24750 2e 2e 2e 20 5c 22 22 20 5b 66 69 6c 65 20 76 65 ... \"" [file ve
24760 72 73 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 20 rsion \..
24770 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 [getB
24780 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 inaryFileName $f
24790 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 70 6c 61 ileNameOnly $pla
247a0 74 66 6f 72 6d 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 tform]] \"\n]..
247b0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
247c0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
247d0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
247e0 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
247f0 74 68 20 24 61 72 63 68 69 74 65 63 74 75 72 65 th $architecture
24800 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
24810 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 foreach
24820 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 6e fileNameOnly $n
24830 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b ativeFileNames {
24840 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 61 .. ca
24850 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
24860 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
24870 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
24880 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
24890 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
248a0 2d 20 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f - file version o
248b0 66 20 5c 22 22 20 24 61 72 63 68 69 74 65 63 74 f \"" $architect
248c0 75 72 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ure \..
248d0 20 20 20 20 20 20 20 20 20 2f 20 24 66 69 6c 65 / $file
248e0 4e 61 6d 65 4f 6e 6c 79 20 22 5c 22 2e 2e 2e 20 NameOnly "\"...
248f0 5c 22 22 20 5b 66 69 6c 65 20 76 65 72 73 69 6f \"" [file versio
24900 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n \..
24910 20 20 20 20 20 20 20 5b 67 65 74 42 69 6e 61 72 [getBinar
24920 79 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e yFileName $fileN
24930 61 6d 65 4f 6e 6c 79 20 24 61 72 63 68 69 74 65 ameOnly $archite
24940 63 74 75 72 65 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 cture]] \"\n]..
24950 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
24960 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
24970 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
24980 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 6d 69 78 ileNameOnly $mix
24990 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 edFileNames {..
249a0 20 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 catch
249b0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
249c0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
249d0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
249e0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
249f0 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 "---- f
24a00 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c ile version of \
24a10 22 22 20 24 61 72 63 68 69 74 65 63 74 75 72 65 "" $architecture
24a20 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
24a30 20 20 20 20 20 20 2f 20 24 66 69 6c 65 4e 61 6d / $fileNam
24a40 65 4f 6e 6c 79 20 22 5c 22 2e 2e 2e 20 5c 22 22 eOnly "\"... \""
24a50 20 5b 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 5c [file version \
24a60 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
24a70 20 20 20 20 5b 67 65 74 42 69 6e 61 72 79 46 69 [getBinaryFi
24a80 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 leName $fileName
24a90 4f 6e 6c 79 20 24 61 72 63 68 69 74 65 63 74 75 Only $architectu
24aa0 72 65 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 re]] \"\n]..
24ab0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
24ac0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
24ad0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a }.... #..
24ae0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
24af0 47 72 61 62 20 74 68 65 20 6c 69 73 74 20 6f 66 Grab the list of
24b00 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c managed assembl
24b10 69 65 73 20 66 6f 72 20 74 68 65 20 63 75 72 72 ies for the curr
24b20 65 6e 74 20 70 72 6f 63 65 73 73 0d 0a 20 20 20 ent process..
24b30 20 20 20 20 20 23 20 20 20 20 20 20 20 61 6e 64 # and
24b40 20 72 65 70 6f 72 74 20 6f 6e 20 74 68 65 20 53 report on the S
24b50 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
24b60 65 20 72 65 6c 61 74 65 64 20 6f 6e 65 73 2e 0d e related ones..
24b70 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
24b80 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c if {[haveSQL
24b90 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 iteObjectCommand
24ba0 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
24bb0 20 20 20 20 20 73 65 74 20 61 73 73 65 6d 62 6c set assembl
24bc0 69 65 73 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f ies [object invo
24bd0 6b 65 20 41 70 70 44 6f 6d 61 69 6e 2e 43 75 72 ke AppDomain.Cur
24be0 72 65 6e 74 44 6f 6d 61 69 6e 20 47 65 74 41 73 rentDomain GetAs
24bf0 73 65 6d 62 6c 69 65 73 5d 0d 0a 0d 0a 20 20 20 semblies]....
24c00 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 66 6f object fo
24c10 72 65 61 63 68 20 61 73 73 65 6d 62 6c 79 20 24 reach assembly $
24c20 61 73 73 65 6d 62 6c 69 65 73 20 7b 0d 0a 20 20 assemblies {..
24c30 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 if {[s
24c40 74 72 69 6e 67 20 6d 61 74 63 68 20 5c 7b 53 79 tring match \{Sy
24c50 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
24c60 2a 20 24 61 73 73 65 6d 62 6c 79 5d 7d 20 74 68 * $assembly]} th
24c70 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
24c80 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
24c90 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
24ca0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
24cb0 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
24cc0 20 66 6f 75 6e 64 20 6c 6f 61 64 65 64 20 61 73 found loaded as
24cd0 73 65 6d 62 6c 79 3a 20 22 20 24 61 73 73 65 6d sembly: " $assem
24ce0 62 6c 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 bly \n]..
24cf0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
24d00 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
24d10 0d 0a 20 20 20 20 20 20 20 20 63 61 74 63 68 20 .. catch
24d20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 {.. tpu
24d30 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
24d40 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 el \..
24d50 20 20 20 20 22 2d 2d 2d 2d 20 64 65 66 69 6e 65 "---- define
24d60 20 63 6f 6e 73 74 61 6e 74 73 20 66 6f 72 20 5c constants for \
24d70 22 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c "System.Data.SQL
24d80 69 74 65 5c 22 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 ite\"... "....
24d90 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
24da0 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
24db0 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
24dc0 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
24dd0 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
24de0 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
24df0 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 .SQLite.SQLite3
24e00 44 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 73 0d DefineConstants.
24e10 0a 20 20 20 20 20 20 20 20 20 20 7d 20 64 65 66 . } def
24e20 69 6e 65 43 6f 6e 73 74 61 6e 74 73 5d 20 3d 3d ineConstants] ==
24e30 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
24e40 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
24e50 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
24e60 70 70 65 6e 64 41 72 67 73 20 5b 66 6f 72 6d 61 ppendArgs [forma
24e70 74 4c 69 73 74 20 5b 6c 73 6f 72 74 20 5c 0d 0a tList [lsort \..
24e80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
24e90 24 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 73 $defineConstants
24ea0 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d 0d 0a 20 ] <none>] \n]..
24eb0 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 } else
24ec0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
24ed0 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
24ee0 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d 0a nnel unknown\n..
24ef0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
24f00 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
24f10 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 catch {..
24f20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
24f30 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 st_channel \..
24f40 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
24f50 2d 20 73 6f 75 72 63 65 20 76 65 72 73 69 6f 6e - source version
24f60 20 6f 66 20 5c 22 53 79 73 74 65 6d 2e 44 61 74 of \"System.Dat
24f70 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5c 22 2e 2e a.SQLite.dll\"..
24f80 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 . "....
24f90 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
24fa0 20 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 objec
24fb0 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 t invoke -flags
24fc0 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 +NonPublic \..
24fd0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 Sy
24fe0 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
24ff0 2e 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f .SQLiteConnectio
25000 6e 20 50 72 6f 76 69 64 65 72 56 65 72 73 69 6f n ProviderVersio
25010 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 76 n.. } v
25020 65 72 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 ersion] == 0} th
25030 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
25040 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
25050 6e 67 74 68 20 24 76 65 72 73 69 6f 6e 5d 20 3d ngth $version] =
25060 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
25070 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 76 set v
25080 65 72 73 69 6f 6e 20 6e 75 6c 6c 0d 0a 20 20 20 ersion null..
25090 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
250a0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
250b0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
250c0 70 70 65 6e 64 41 72 67 73 20 24 76 65 72 73 69 ppendArgs $versi
250d0 6f 6e 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 on \n]..
250e0 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
250f0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
25100 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 75 6e :test_channel un
25110 6b 6e 6f 77 6e 5c 6e 0d 0a 20 20 20 20 20 20 20 known\n..
25120 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
25130 0a 0d 0a 20 20 20 20 20 20 20 20 63 61 74 63 68 ... catch
25140 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 {.. tp
25150 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
25160 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 nel \..
25170 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6f 75 72 63 "---- sourc
25180 65 20 63 68 65 63 6b 6f 75 74 20 6f 66 20 5c 22 e checkout of \"
25190 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
251a0 74 65 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 0d 0a 0d te.dll\"... "...
251b0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
251c0 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
251d0 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
251e0 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
251f0 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 blic \..
25200 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
25210 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 ata.SQLite.SQLit
25220 65 43 6f 6e 6e 65 63 74 69 6f 6e 20 50 72 6f 76 eConnection Prov
25230 69 64 65 72 53 6f 75 72 63 65 49 64 0d 0a 20 20 iderSourceId..
25240 20 20 20 20 20 20 20 20 7d 20 73 6f 75 72 63 65 } source
25250 49 64 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b Id] == 0} then {
25260 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
25270 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
25280 20 24 73 6f 75 72 63 65 49 64 5d 20 3d 3d 20 30 $sourceId] == 0
25290 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
252a0 20 20 20 20 20 20 20 20 73 65 74 20 73 6f 75 72 set sour
252b0 63 65 49 64 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 ceId null..
252c0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
252d0 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
252e0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
252f0 65 6e 64 41 72 67 73 20 24 73 6f 75 72 63 65 49 endArgs $sourceI
25300 64 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 d \n]..
25310 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
25320 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
25330 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 75 6e 6b test_channel unk
25340 6e 6f 77 6e 5c 6e 0d 0a 20 20 20 20 20 20 20 20 nown\n..
25350 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
25360 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
25370 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 # NOTE: Che
25380 63 6b 20 74 68 65 20 61 76 61 69 6c 61 62 6c 65 ck the available
25390 20 62 75 69 6c 64 73 20 28 61 6e 64 20 22 72 65 builds (and "re
253a0 6c 65 61 73 65 73 22 29 20 6f 66 20 53 51 4c 69 leases") of SQLi
253b0 74 65 20 61 6e 64 0d 0a 20 20 20 20 20 20 20 20 te and..
253c0 23 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 # System.D
253d0 61 74 61 2e 53 51 4c 69 74 65 2e 0d 0a 20 20 20 ata.SQLite...
253e0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
253f0 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 42 75 checkForSQLiteBu
25400 69 6c 64 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 ilds $::test_cha
25410 6e 6e 65 6c 0d 0a 20 20 20 20 20 20 20 20 63 68 nnel.. ch
25420 65 63 6b 46 6f 72 53 51 4c 69 74 65 52 65 6c 65 eckForSQLiteRele
25430 61 73 65 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 ases $::test_cha
25440 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 20 nnel....
25450 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
25460 45 3a 20 4e 6f 77 2c 20 77 65 20 6e 65 65 64 20 E: Now, we need
25470 74 6f 20 6b 6e 6f 77 20 69 66 20 74 68 65 20 53 to know if the S
25480 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 QLite core libra
25490 72 79 20 69 73 20 61 76 61 69 6c 61 62 6c 65 0d ry is available.
254a0 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
254b0 20 28 69 2e 65 2e 20 62 65 63 61 75 73 65 20 74 (i.e. because t
254c0 68 65 20 6d 61 6e 61 67 65 64 2d 6f 6e 6c 79 20 he managed-only
254d0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
254e0 74 65 20 61 73 73 65 6d 62 6c 79 20 63 61 6e 0d te assembly can.
254f0 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
25500 20 6c 6f 61 64 20 77 69 74 68 6f 75 74 20 69 74 load without it
25510 3b 20 68 6f 77 65 76 65 72 2c 20 69 74 20 63 61 ; however, it ca
25520 6e 6e 6f 74 20 64 6f 20 61 6e 79 74 68 69 6e 67 nnot do anything
25530 20 75 73 65 66 75 6c 20 77 69 74 68 6f 75 74 0d useful without.
25540 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
25550 20 69 74 29 2e 20 20 49 66 20 77 65 20 61 72 65 it). If we are
25560 20 75 73 69 6e 67 20 74 68 65 20 6d 69 78 65 64 using the mixed
25570 2d 6d 6f 64 65 20 61 73 73 65 6d 62 6c 79 20 61 -mode assembly a
25580 6e 64 20 77 65 20 61 6c 72 65 61 64 79 0d 0a 20 nd we already..
25590 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 66 # f
255a0 6f 75 6e 64 20 69 74 20 28 61 62 6f 76 65 29 2c ound it (above),
255b0 20 74 68 69 73 20 73 68 6f 75 6c 64 20 61 6c 77 this should alw
255c0 61 79 73 20 73 75 63 63 65 65 64 2e 0d 0a 20 20 ays succeed...
255d0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
255e0 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 4c checkForSQLiteL
255f0 69 62 72 61 72 79 20 24 3a 3a 74 65 73 74 5f 63 ibrary $::test_c
25600 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 hannel....
25610 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
25620 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 OTE: Check if th
25630 65 20 53 51 4c 69 74 65 20 69 6e 74 65 72 6f 70 e SQLite interop
25640 20 61 73 73 65 6d 62 6c 79 20 69 73 20 61 76 61 assembly is ava
25650 69 6c 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 20 ilable...
25660 20 23 0d 0a 20 20 20 20 20 20 20 20 63 68 65 63 #.. chec
25670 6b 46 6f 72 53 51 4c 69 74 65 49 6e 74 65 72 6f kForSQLiteIntero
25680 70 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 p $::test_channe
25690 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a l.... #..
256a0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
256b0 43 68 65 63 6b 20 74 68 65 20 53 51 4c 69 74 65 Check the SQLite
256c0 20 64 61 74 61 62 61 73 65 20 61 6e 64 20 74 65 database and te
256d0 6d 70 6f 72 61 72 79 20 64 69 72 65 63 74 6f 72 mporary director
256e0 69 65 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ies... #.
256f0 0a 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f . checkFo
25700 72 53 51 4c 69 74 65 44 69 72 65 63 74 6f 72 69 rSQLiteDirectori
25710 65 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e es $::test_chann
25720 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d el.... #.
25730 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
25740 20 41 74 74 65 6d 70 74 20 74 6f 20 64 65 74 65 Attempt to dete
25750 72 6d 69 6e 65 20 69 66 20 76 61 72 69 6f 75 73 rmine if various
25760 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 6f 70 compile-time op
25770 74 69 6f 6e 73 20 6e 65 65 64 65 64 20 66 6f 72 tions needed for
25780 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
25790 20 20 74 65 73 74 20 63 6f 6e 73 74 72 61 69 6e test constrain
257a0 74 73 20 77 65 72 65 20 65 6e 61 62 6c 65 64 20 ts were enabled
257b0 66 6f 72 20 74 68 65 20 6d 61 6e 61 67 65 64 20 for the managed
257c0 61 73 73 65 6d 62 6c 79 2e 20 20 54 68 65 72 65 assembly. There
257d0 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
257e0 20 20 61 72 65 20 73 6f 6d 65 20 63 6f 6d 70 69 are some compi
257f0 6c 65 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 73 20 le-time options
25800 74 68 61 74 20 6d 75 73 74 20 61 6c 73 6f 20 68 that must also h
25810 61 76 65 20 62 65 65 6e 20 65 6e 61 62 6c 65 64 ave been enabled
25820 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
25830 20 20 66 6f 72 20 74 68 65 20 69 6e 74 65 72 6f for the intero
25840 70 20 61 73 73 65 6d 62 6c 79 20 69 6e 20 6f 72 p assembly in or
25850 64 65 72 20 74 6f 20 62 65 20 65 66 66 65 63 74 der to be effect
25860 69 76 65 2e 20 20 46 6f 72 20 74 68 6f 73 65 0d ive. For those.
25870 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
25880 20 6f 70 74 69 6f 6e 73 2c 20 69 74 20 77 69 6c options, it wil
25890 6c 20 62 65 20 61 73 73 75 6d 65 64 20 74 68 61 l be assumed tha
258a0 74 20 69 74 20 77 61 73 20 65 6e 61 62 6c 65 64 t it was enabled
258b0 20 66 6f 72 20 74 68 65 20 69 6e 74 65 72 6f 70 for the interop
258c0 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
258d0 20 20 61 73 73 65 6d 62 6c 79 20 69 66 20 69 74 assembly if it
258e0 20 77 61 73 20 65 6e 61 62 6c 65 64 20 66 6f 72 was enabled for
258f0 20 74 68 65 20 6d 61 6e 61 67 65 64 20 61 73 73 the managed ass
25900 65 6d 62 6c 79 2e 0d 0a 20 20 20 20 20 20 20 20 embly...
25910 23 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 #.. forea
25920 63 68 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e ch defineConstan
25930 74 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 t [list \..
25940 20 20 20 20 20 20 20 43 48 45 43 4b 5f 53 54 41 CHECK_STA
25950 54 45 20 43 4f 55 4e 54 5f 48 41 4e 44 4c 45 20 TE COUNT_HANDLE
25960 44 45 42 55 47 20 49 4e 54 45 52 4f 50 5f 43 4f DEBUG INTEROP_CO
25970 44 45 43 20 49 4e 54 45 52 4f 50 5f 44 45 42 55 DEC INTEROP_DEBU
25980 47 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 G \..
25990 20 49 4e 54 45 52 4f 50 5f 45 58 54 45 4e 53 49 INTEROP_EXTENSI
259a0 4f 4e 5f 46 55 4e 43 54 49 4f 4e 53 20 49 4e 54 ON_FUNCTIONS INT
259b0 45 52 4f 50 5f 46 54 53 35 5f 45 58 54 45 4e 53 EROP_FTS5_EXTENS
259c0 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ION \..
259d0 20 20 20 49 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 INTEROP_INCLU
259e0 44 45 5f 43 45 52 4f 44 20 49 4e 54 45 52 4f 50 DE_CEROD INTEROP
259f0 5f 49 4e 43 4c 55 44 45 5f 45 58 54 52 41 20 49 _INCLUDE_EXTRA I
25a00 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 44 45 5f 53 NTEROP_INCLUDE_S
25a10 45 45 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 EE \..
25a20 20 20 49 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 44 INTEROP_INCLUD
25a30 45 5f 5a 49 50 56 46 53 20 49 4e 54 45 52 4f 50 E_ZIPVFS INTEROP
25a40 5f 4a 53 4f 4e 31 5f 45 58 54 45 4e 53 49 4f 4e _JSON1_EXTENSION
25a50 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
25a60 49 4e 54 45 52 4f 50 5f 4c 45 47 41 43 59 5f 43 INTEROP_LEGACY_C
25a70 4c 4f 53 45 20 49 4e 54 45 52 4f 50 5f 4c 4f 47 LOSE INTEROP_LOG
25a80 20 49 4e 54 45 52 4f 50 5f 50 45 52 43 45 4e 54 INTEROP_PERCENT
25a90 49 4c 45 5f 45 58 54 45 4e 53 49 4f 4e 20 5c 0d ILE_EXTENSION \.
25aa0 0a 20 20 20 20 20 20 20 20 20 20 20 20 49 4e 54 . INT
25ab0 45 52 4f 50 5f 52 45 47 45 58 50 5f 45 58 54 45 EROP_REGEXP_EXTE
25ac0 4e 53 49 4f 4e 20 49 4e 54 45 52 4f 50 5f 54 45 NSION INTEROP_TE
25ad0 53 54 5f 45 58 54 45 4e 53 49 4f 4e 20 5c 0d 0a ST_EXTENSION \..
25ae0 20 20 20 20 20 20 20 20 20 20 20 20 49 4e 54 45 INTE
25af0 52 4f 50 5f 54 4f 54 59 50 45 5f 45 58 54 45 4e ROP_TOTYPE_EXTEN
25b00 53 49 4f 4e 20 49 4e 54 45 52 4f 50 5f 56 49 52 SION INTEROP_VIR
25b10 54 55 41 4c 5f 54 41 42 4c 45 20 4e 45 54 5f 32 TUAL_TABLE NET_2
25b20 30 20 4e 45 54 5f 33 35 20 5c 0d 0a 20 20 20 20 0 NET_35 \..
25b30 20 20 20 20 20 20 20 20 4e 45 54 5f 34 30 20 4e NET_40 N
25b40 45 54 5f 34 35 20 4e 45 54 5f 34 35 31 20 4e 45 ET_45 NET_451 NE
25b50 54 5f 34 35 32 20 4e 45 54 5f 34 36 20 4e 45 54 T_452 NET_46 NET
25b60 5f 34 36 31 20 4e 45 54 5f 34 36 32 20 5c 0d 0a _461 NET_462 \..
25b70 20 20 20 20 20 20 20 20 20 20 20 20 4e 45 54 5f NET_
25b80 43 4f 4d 50 41 43 54 5f 32 30 20 50 4c 41 54 46 COMPACT_20 PLATF
25b90 4f 52 4d 5f 43 4f 4d 50 41 43 54 46 52 41 4d 45 ORM_COMPACTFRAME
25ba0 57 4f 52 4b 20 50 52 45 4c 4f 41 44 5f 4e 41 54 WORK PRELOAD_NAT
25bb0 49 56 45 5f 4c 49 42 52 41 52 59 20 5c 0d 0a 20 IVE_LIBRARY \..
25bc0 20 20 20 20 20 20 20 20 20 20 20 52 45 54 41 52 RETAR
25bd0 47 45 54 41 42 4c 45 20 53 51 4c 49 54 45 5f 53 GETABLE SQLITE_S
25be0 54 41 4e 44 41 52 44 20 54 48 52 4f 57 5f 4f 4e TANDARD THROW_ON
25bf0 5f 44 49 53 50 4f 53 45 44 20 54 52 41 43 45 20 _DISPOSED TRACE
25c00 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 54 \.. T
25c10 52 41 43 45 5f 43 4f 4e 4e 45 43 54 49 4f 4e 20 RACE_CONNECTION
25c20 54 52 41 43 45 5f 44 45 54 45 43 54 49 4f 4e 20 TRACE_DETECTION
25c30 54 52 41 43 45 5f 48 41 4e 44 4c 45 20 54 52 41 TRACE_HANDLE TRA
25c40 43 45 5f 50 52 45 4c 4f 41 44 20 5c 0d 0a 20 20 CE_PRELOAD \..
25c50 20 20 20 20 20 20 20 20 20 20 54 52 41 43 45 5f TRACE_
25c60 53 48 41 52 45 44 20 54 52 41 43 45 5f 53 54 41 SHARED TRACE_STA
25c70 54 45 4d 45 4e 54 20 54 52 41 43 45 5f 57 41 52 TEMENT TRACE_WAR
25c80 4e 49 4e 47 20 54 52 41 43 4b 5f 4d 45 4d 4f 52 NING TRACK_MEMOR
25c90 59 5f 42 59 54 45 53 20 5c 0d 0a 20 20 20 20 20 Y_BYTES \..
25ca0 20 20 20 20 20 20 20 55 53 45 5f 45 4e 54 49 54 USE_ENTIT
25cb0 59 5f 46 52 41 4d 45 57 4f 52 4b 5f 36 20 55 53 Y_FRAMEWORK_6 US
25cc0 45 5f 49 4e 54 45 52 4f 50 5f 44 4c 4c 20 55 53 E_INTEROP_DLL US
25cd0 45 5f 50 52 45 50 41 52 45 5f 56 32 20 57 49 4e E_PREPARE_V2 WIN
25ce0 44 4f 57 53 5d 20 7b 0d 0a 20 20 20 20 20 20 20 DOWS] {..
25cf0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
25d00 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 # NOTE: Check if
25d10 20 74 68 65 20 63 6f 6d 70 69 6c 65 2d 74 69 6d the compile-tim
25d20 65 20 6f 70 74 69 6f 6e 20 69 73 20 6c 69 73 74 e option is list
25d30 65 64 20 69 6e 20 74 68 65 20 6c 69 73 74 20 6f ed in the list o
25d40 66 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 f.. #
25d50 20 20 20 20 20 22 64 65 66 69 6e 65 20 63 6f 6e "define con
25d60 73 74 61 6e 74 73 22 20 6b 65 70 74 20 74 72 61 stants" kept tra
25d70 63 6b 20 6f 66 20 62 79 20 74 68 65 20 6d 61 6e ck of by the man
25d80 61 67 65 64 20 61 73 73 65 6d 62 6c 79 2e 0d 0a aged assembly...
25d90 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
25da0 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 53 checkForS
25db0 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 QLiteDefineConst
25dc0 61 6e 74 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e ant $::test_chan
25dd0 6e 65 6c 20 24 64 65 66 69 6e 65 43 6f 6e 73 74 nel $defineConst
25de0 61 6e 74 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a ant.. }..
25df0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
25e00 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 # NOTE: Che
25e10 63 6b 20 69 66 20 74 68 65 20 53 79 73 74 65 6d ck if the System
25e20 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 70 72 6f .Data.SQLite pro
25e30 76 69 64 65 72 20 77 61 73 20 63 6f 6d 70 69 6c vider was compil
25e40 65 64 20 77 69 74 68 0d 0a 20 20 20 20 20 20 20 ed with..
25e50 20 23 20 20 20 20 20 20 20 73 75 70 70 6f 72 74 # support
25e60 20 66 6f 72 20 61 6e 79 20 65 6e 63 72 79 70 74 for any encrypt
25e70 65 64 20 64 61 74 61 62 61 73 65 73 2e 0d 0a 20 ed databases...
25e80 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
25e90 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 if {[haveSQLit
25ea0 65 44 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 20 eDefineConstant
25eb0 49 4e 54 45 52 4f 50 5f 43 4f 44 45 43 5d 20 7c INTEROP_CODEC] |
25ec0 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 | \..
25ed0 20 5b 68 61 76 65 53 51 4c 69 74 65 44 65 66 69 [haveSQLiteDefi
25ee0 6e 65 43 6f 6e 73 74 61 6e 74 20 49 4e 54 45 52 neConstant INTER
25ef0 4f 50 5f 49 4e 43 4c 55 44 45 5f 53 45 45 5d 7d OP_INCLUDE_SEE]}
25f00 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
25f10 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
25f20 23 20 4e 4f 54 45 3a 20 59 65 73 2c 20 61 64 64 # NOTE: Yes, add
25f30 20 67 65 6e 65 72 69 63 20 63 6f 6e 73 74 72 61 generic constra
25f40 69 6e 74 20 66 6f 72 20 75 73 65 20 62 79 20 74 int for use by t
25f50 68 65 20 74 65 73 74 20 73 75 69 74 65 2e 0d 0a he test suite...
25f60 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
25f70 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 addConstr
25f80 61 69 6e 74 20 53 79 73 74 65 6d 2e 44 61 74 61 aint System.Data
25f90 2e 53 51 4c 69 74 65 2e 45 6e 63 72 79 70 74 69 .SQLite.Encrypti
25fa0 6f 6e 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d on.. }...
25fb0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
25fc0 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 # NOTE: Chec
25fd0 6b 20 74 68 65 20 63 75 72 72 65 6e 74 20 62 75 k the current bu
25fe0 69 6c 64 20 79 65 61 72 2e 20 20 42 61 73 69 63 ild year. Basic
25ff0 61 6c 6c 79 2c 20 74 68 69 73 20 69 6e 64 69 63 ally, this indic
26000 61 74 65 73 0d 0a 20 20 20 20 20 20 20 20 23 20 ates.. #
26010 20 20 20 20 20 20 77 68 69 63 68 20 76 65 72 73 which vers
26020 69 6f 6e 20 6f 66 20 4d 53 42 75 69 6c 64 20 61 ion of MSBuild a
26030 6e 64 2f 6f 72 20 56 69 73 75 61 6c 20 53 74 75 nd/or Visual Stu
26040 64 69 6f 20 77 61 73 20 75 73 65 64 20 74 6f 0d dio was used to.
26050 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
26060 20 63 6f 6d 70 69 6c 65 20 74 68 65 20 61 73 73 compile the ass
26070 65 6d 62 6c 79 20 62 69 6e 61 72 69 65 73 20 75 embly binaries u
26080 6e 64 65 72 20 74 65 73 74 2e 0d 0a 20 20 20 20 nder test...
26090 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 #.. t
260a0 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
260b0 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 nnel \..
260c0 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 "---- checki
260d0 6e 67 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 61 ng for System.Da
260e0 74 61 2e 53 51 4c 69 74 65 20 62 75 69 6c 64 20 ta.SQLite build
260f0 79 65 61 72 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 year... "....
26100 20 20 20 20 20 73 65 74 20 79 65 61 72 20 5b 67 set year [g
26110 65 74 42 75 69 6c 64 59 65 61 72 5d 0d 0a 20 20 etBuildYear]..
26120 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 addConstra
26130 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
26140 62 75 69 6c 64 59 65 61 72 2e 20 24 79 65 61 72 buildYear. $year
26150 5d 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 ].. tputs
26160 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
26170 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 22 20 [appendArgs \"
26180 24 79 65 61 72 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 $year \"\n]....
26190 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
261a0 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 # NOTE: Check
261b0 74 68 65 20 63 75 72 72 65 6e 74 20 62 75 69 6c the current buil
261c0 64 20 2e 4e 45 54 20 46 72 61 6d 65 77 6f 72 6b d .NET Framework
261d0 2e 20 20 42 61 73 69 63 61 6c 6c 79 2c 20 74 68 . Basically, th
261e0 69 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 is.. #
261f0 20 20 20 20 69 6e 64 69 63 61 74 65 73 20 77 68 indicates wh
26200 69 63 68 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 ich version of t
26210 68 65 20 2e 4e 45 54 20 46 72 61 6d 65 77 6f 72 he .NET Framewor
26220 6b 20 69 73 20 62 65 69 6e 67 0d 0a 20 20 20 20 k is being..
26230 20 20 20 20 23 20 20 20 20 20 20 20 75 73 65 64 # used
26240 20 62 79 20 74 68 65 20 61 73 73 65 6d 62 6c 79 by the assembly
26250 20 62 69 6e 61 72 69 65 73 20 75 6e 64 65 72 20 binaries under
26260 74 65 73 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 test... #
26270 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
26280 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
26290 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
262a0 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f ---- checking fo
262b0 72 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 r System.Data.SQ
262c0 4c 69 74 65 20 62 75 69 6c 64 20 2e 4e 45 54 20 Lite build .NET
262d0 46 72 61 6d 65 77 6f 72 6b 2e 2e 2e 20 22 0d 0a Framework... "..
262e0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 6e 65 .. set ne
262f0 74 46 78 20 5b 67 65 74 42 75 69 6c 64 4e 65 74 tFx [getBuildNet
26300 46 78 5d 0d 0a 20 20 20 20 20 20 20 20 61 64 64 Fx].. add
26310 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
26320 6e 64 41 72 67 73 20 62 75 69 6c 64 46 72 61 6d ndArgs buildFram
26330 65 77 6f 72 6b 2e 20 24 6e 65 74 46 78 5d 0d 0a ework. $netFx]..
26340 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
26350 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
26360 70 70 65 6e 64 41 72 67 73 20 5c 22 20 24 6e 65 ppendArgs \" $ne
26370 74 46 78 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 tFx \"\n]....
26380 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
26390 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 # NOTE: Check th
263a0 65 20 63 75 72 72 65 6e 74 20 62 75 69 6c 64 20 e current build
263b0 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2e 20 20 configuration.
263c0 54 68 69 73 20 73 68 6f 75 6c 64 20 6e 6f 72 6d This should norm
263d0 61 6c 6c 79 0d 0a 20 20 20 20 20 20 20 20 23 20 ally.. #
263e0 20 20 20 20 20 20 62 65 20 65 69 74 68 65 72 20 be either
263f0 22 44 65 62 75 67 22 20 6f 72 20 22 52 65 6c 65 "Debug" or "Rele
26400 61 73 65 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 ase"... #
26410 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
26420 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
26430 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
26440 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f ---- checking fo
26450 72 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 r System.Data.SQ
26460 4c 69 74 65 20 62 75 69 6c 64 20 63 6f 6e 66 69 Lite build confi
26470 67 75 72 61 74 69 6f 6e 2e 2e 2e 20 22 0d 0a 0d guration... "...
26480 0a 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 6e . set con
26490 66 69 67 75 72 61 74 69 6f 6e 20 5b 67 65 74 42 figuration [getB
264a0 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 74 69 6f uildConfiguratio
264b0 6e 5d 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 n].. addC
264c0 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e onstraint [appen
264d0 64 41 72 67 73 20 62 75 69 6c 64 43 6f 6e 66 69 dArgs buildConfi
264e0 67 75 72 61 74 69 6f 6e 2e 20 24 63 6f 6e 66 69 guration. $confi
264f0 67 75 72 61 74 69 6f 6e 5d 0d 0a 20 20 20 20 20 guration]..
26500 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
26510 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
26520 41 72 67 73 20 5c 22 20 24 63 6f 6e 66 69 67 75 Args \" $configu
26530 72 61 74 69 6f 6e 20 5c 22 5c 6e 5d 0d 0a 0d 0a ration \"\n]....
26540 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
26550 20 20 20 23 20 4e 4f 54 45 3a 20 54 72 79 20 74 # NOTE: Try t
26560 6f 20 73 65 74 75 70 20 61 6e 20 69 6e 74 65 72 o setup an inter
26570 72 75 70 74 20 63 61 6c 6c 62 61 63 6b 20 75 73 rupt callback us
26580 69 6e 67 20 74 68 65 20 73 63 72 69 70 74 20 64 ing the script d
26590 65 62 75 67 67 65 72 0d 0a 20 20 20 20 20 20 20 ebugger..
265a0 20 23 20 20 20 20 20 20 20 74 68 61 74 20 77 69 # that wi
265b0 6c 6c 20 63 61 6e 63 65 6c 20 61 6c 6c 20 53 51 ll cancel all SQ
265c0 4c 20 71 75 65 72 69 65 73 20 69 6e 20 70 72 6f L queries in pro
265d0 67 72 65 73 73 20 66 6f 72 20 61 6c 6c 20 64 61 gress for all da
265e0 74 61 62 61 73 65 0d 0a 20 20 20 20 20 20 20 20 tabase..
265f0 23 20 20 20 20 20 20 20 63 6f 6e 6e 65 63 74 69 # connecti
26600 6f 6e 73 20 6b 6e 6f 77 6e 20 74 6f 20 74 68 69 ons known to thi
26610 73 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a s interpreter...
26620 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
26630 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
26640 69 73 74 73 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 ists ::no(sqlite
26650 49 6e 74 65 72 72 75 70 74 43 61 6c 6c 62 61 63 InterruptCallbac
26660 6b 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 k)]} then {..
26670 20 20 20 20 20 20 20 73 65 74 75 70 44 62 49 6e setupDbIn
26680 74 65 72 72 75 70 74 43 61 6c 6c 62 61 63 6b 20 terruptCallback
26690 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
266a0 24 3a 3a 74 65 73 74 5f 6c 6f 67 0d 0a 20 20 20 $::test_log..
266b0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
266c0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
266d0 4f 54 45 3a 20 43 68 65 63 6b 20 66 6f 72 20 74 OTE: Check for t
266e0 68 65 20 6e 61 74 69 76 65 20 72 75 6e 74 69 6d he native runtim
266f0 65 20 6f 70 74 69 6f 6e 2c 20 77 68 69 63 68 20 e option, which
26700 77 6f 75 6c 64 20 6d 65 61 6e 20 77 65 20 61 72 would mean we ar
26710 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
26720 20 20 20 75 73 69 6e 67 20 74 68 65 20 6d 69 78 using the mix
26730 65 64 2d 6d 6f 64 65 20 61 73 73 65 6d 62 6c 79 ed-mode assembly
26740 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
26750 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 52 75 checkForRu
26760 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 24 3a 3a 74 ntimeOption $::t
26770 65 73 74 5f 63 68 61 6e 6e 65 6c 20 6e 61 74 69 est_channel nati
26780 76 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d ve.... #.
26790 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
267a0 20 43 68 65 63 6b 20 69 66 20 74 68 65 20 74 65 Check if the te
267b0 73 74 20 73 75 69 74 65 20 73 68 6f 75 6c 64 20 st suite should
267c0 63 6f 75 6e 74 20 74 68 65 20 6e 75 6d 62 65 72 count the number
267d0 20 6f 66 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 0d of connections.
267e0 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
267f0 20 22 6f 70 65 6e 65 64 22 20 61 6e 64 20 22 63 "opened" and "c
26800 6c 6f 73 65 64 22 20 66 72 6f 6d 20 74 68 65 20 losed" from the
26810 70 6f 6f 6c 20 77 68 65 6e 20 64 65 74 65 72 6d pool when determ
26820 69 6e 69 6e 67 20 69 66 20 61 20 74 65 73 74 0d ining if a test.
26830 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
26840 20 70 61 73 73 65 64 2e 20 20 44 69 73 61 62 6c passed. Disabl
26850 69 6e 67 20 74 68 69 73 20 62 65 68 61 76 69 6f ing this behavio
26860 72 20 69 73 20 73 6f 6d 65 74 69 6d 65 73 20 6e r is sometimes n
26870 65 63 65 73 73 61 72 79 20 28 65 2e 67 2e 0d 0a ecessary (e.g...
26880 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
26890 64 75 72 69 6e 67 20 74 68 65 20 72 65 6c 65 61 during the relea
268a0 73 65 20 74 65 73 74 69 6e 67 20 70 72 6f 63 65 se testing proce
268b0 73 73 29 20 62 65 63 61 75 73 65 20 74 68 65 72 ss) because ther
268c0 65 20 61 72 65 20 73 65 76 65 72 61 6c 0d 0a 20 e are several..
268d0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
268e0 65 73 74 73 20 74 68 61 74 20 72 65 6c 79 20 6f ests that rely o
268f0 6e 20 74 68 65 20 22 6f 70 65 6e 65 64 20 66 72 n the "opened fr
26900 6f 6d 20 70 6f 6f 6c 22 20 63 6f 75 6e 74 20 62 om pool" count b
26910 65 69 6e 67 20 67 72 65 61 74 65 72 0d 0a 20 20 eing greater..
26920 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 # th
26930 61 6e 20 7a 65 72 6f 2e 20 20 54 68 65 73 65 20 an zero. These
26940 74 65 73 74 73 20 6d 61 79 20 66 61 69 6c 20 64 tests may fail d
26950 75 65 20 74 6f 20 74 68 65 20 6e 6f 6e 2d 64 65 ue to the non-de
26960 74 65 72 6d 69 6e 69 73 74 69 63 0d 0a 20 20 20 terministic..
26970 20 20 20 20 20 23 20 20 20 20 20 20 20 62 65 68 # beh
26980 61 76 69 6f 72 20 6f 66 20 74 68 65 20 43 4c 52 avior of the CLR
26990 20 47 43 2c 20 65 76 65 6e 20 77 68 65 6e 20 74 GC, even when t
269a0 68 65 72 65 20 69 73 20 6e 6f 20 62 75 67 20 69 here is no bug i
269b0 6e 20 74 68 65 20 63 6f 64 65 0d 0a 20 20 20 20 n the code..
269c0 20 20 20 20 23 20 20 20 20 20 20 20 62 65 69 6e # bein
269d0 67 20 74 65 73 74 65 64 2e 0d 0a 20 20 20 20 20 g tested...
269e0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 63 68 #.. ch
269f0 65 63 6b 46 6f 72 52 75 6e 74 69 6d 65 4f 70 74 eckForRuntimeOpt
26a00 69 6f 6e 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e ion $::test_chan
26a10 6e 65 6c 20 6e 6f 50 6f 6f 6c 43 6f 75 6e 74 73 nel noPoolCounts
26a20 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
26a30 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 # NOTE: C
26a40 68 65 63 6b 20 69 66 20 74 68 65 20 74 65 73 74 heck if the test
26a50 20 73 75 69 74 65 20 73 68 6f 75 6c 64 20 75 73 suite should us
26a60 65 20 73 68 61 72 65 64 2d 63 61 63 68 65 20 6d e shared-cache m
26a70 6f 64 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ode... #.
26a80 0a 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f . checkFo
26a90 72 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 24 rRuntimeOption $
26aa0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 73 ::test_channel s
26ab0 68 61 72 65 64 43 61 63 68 65 0d 0a 0d 0a 20 20 haredCache....
26ac0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
26ad0 20 23 20 4e 4f 54 45 3a 20 52 65 70 6f 72 74 20 # NOTE: Report
26ae0 74 68 65 20 72 65 73 6f 75 72 63 65 20 75 73 61 the resource usa
26af0 67 65 20 70 72 69 6f 72 20 74 6f 20 72 75 6e 6e ge prior to runn
26b00 69 6e 67 20 61 6e 79 20 74 65 73 74 73 2e 0d 0a ing any tests...
26b10 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
26b20 20 20 20 72 65 70 6f 72 74 53 51 4c 69 74 65 52 reportSQLiteR
26b30 65 73 6f 75 72 63 65 73 20 24 3a 3a 74 65 73 74 esources $::test
26b40 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 _channel....
26b50 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
26b60 20 4e 4f 54 45 3a 20 47 72 61 62 20 74 68 65 20 NOTE: Grab the
26b70 6c 69 73 74 20 6f 66 20 6e 61 74 69 76 65 20 6d list of native m
26b80 6f 64 75 6c 65 73 20 66 6f 72 20 74 68 65 20 63 odules for the c
26b90 75 72 72 65 6e 74 20 70 72 6f 63 65 73 73 20 61 urrent process a
26ba0 6e 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 nd.. #
26bb0 20 20 20 20 72 65 70 6f 72 74 20 6f 6e 20 74 68 report on th
26bc0 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 e System.Data.SQ
26bd0 4c 69 74 65 20 72 65 6c 61 74 65 64 20 6f 6e 65 Lite related one
26be0 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 s... #..
26bf0 20 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 if {[have
26c00 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d SQLiteObjectComm
26c10 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 and]} then {..
26c20 20 20 20 20 20 20 20 20 73 65 74 20 6d 6f 64 75 set modu
26c30 6c 65 73 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f les [object invo
26c40 6b 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ke \..
26c50 20 20 20 20 53 79 73 74 65 6d 2e 44 69 61 67 6e System.Diagn
26c60 6f 73 74 69 63 73 2e 50 72 6f 63 65 73 73 2e 47 ostics.Process.G
26c70 65 74 43 75 72 72 65 6e 74 50 72 6f 63 65 73 73 etCurrentProcess
26c80 20 4d 6f 64 75 6c 65 73 5d 0d 0a 0d 0a 20 20 20 Modules]....
26c90 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 66 6f object fo
26ca0 72 65 61 63 68 20 2d 61 6c 69 61 73 20 6d 6f 64 reach -alias mod
26cb0 75 6c 65 20 24 6d 6f 64 75 6c 65 73 20 7b 0d 0a ule $modules {..
26cc0 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
26cd0 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 # NOT
26ce0 45 3a 20 54 68 65 20 6d 6f 64 75 6c 65 20 66 69 E: The module fi
26cf0 6c 65 20 6e 61 6d 65 20 68 65 72 65 20 6d 75 73 le name here mus
26d00 74 20 62 65 20 6e 6f 72 6d 61 6c 69 7a 65 64 2e t be normalized.
26d10 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d .. #.
26d20 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 . set
26d30 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 fileName [file
26d40 6e 6f 72 6d 61 6c 69 7a 65 20 5b 24 6d 6f 64 75 normalize [$modu
26d50 6c 65 20 46 69 6c 65 4e 61 6d 65 5d 5d 0d 0a 20 le FileName]]..
26d60 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 66 set f
26d70 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 5b 66 69 6c ileNameOnly [fil
26d80 65 20 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d 65 e tail $fileName
26d90 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ]....
26da0 20 69 66 20 7b 5b 6c 73 65 61 72 63 68 20 2d 65 if {[lsearch -e
26db0 78 61 63 74 20 2d 6e 6f 63 61 73 65 20 2d 2d 20 xact -nocase --
26dc0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
26dd0 20 20 20 5b 67 65 74 4e 61 74 69 76 65 4c 69 62 [getNativeLib
26de0 72 61 72 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c raryFileNamesOnl
26df0 79 5d 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 y] $fileNameOnly
26e00 5d 20 21 3d 20 2d 31 7d 20 74 68 65 6e 20 7b 0d ] != -1} then {.
26e10 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 . t
26e20 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
26e30 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
26e40 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
26e50 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 6f 75 6e "---- foun
26e60 64 20 6c 6f 61 64 65 64 20 53 51 4c 69 74 65 20 d loaded SQLite
26e70 6e 61 74 69 76 65 20 6c 69 62 72 61 72 79 20 6d native library m
26e80 6f 64 75 6c 65 3a 20 22 20 5c 0d 0a 20 20 20 20 odule: " \..
26e90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 66 $f
26ea0 69 6c 65 4e 61 6d 65 20 5c 6e 5d 0d 0a 20 20 20 ileName \n]..
26eb0 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 69 } elsei
26ec0 66 20 7b 5b 6c 73 65 61 72 63 68 20 2d 65 78 61 f {[lsearch -exa
26ed0 63 74 20 2d 6e 6f 63 61 73 65 20 2d 2d 20 5c 0d ct -nocase -- \.
26ee0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
26ef0 20 5b 67 65 74 49 6e 74 65 72 6f 70 41 73 73 65 [getInteropAsse
26f00 6d 62 6c 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c mblyFileNamesOnl
26f10 79 5d 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 y] $fileNameOnly
26f20 5d 20 21 3d 20 2d 31 7d 20 74 68 65 6e 20 7b 0d ] != -1} then {.
26f30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 . t
26f40 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
26f50 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
26f60 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
26f70 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 6f 75 6e "---- foun
26f80 64 20 6c 6f 61 64 65 64 20 53 51 4c 69 74 65 20 d loaded SQLite
26f90 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 interop assembly
26fa0 20 6d 6f 64 75 6c 65 3a 20 22 20 5c 0d 0a 20 20 module: " \..
26fb0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
26fc0 24 66 69 6c 65 4e 61 6d 65 20 5c 6e 5d 0d 0a 20 $fileName \n]..
26fd0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
26fe0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
26ff0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
27000 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
27010 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
27020 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 _channel \..
27030 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
27040 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 6f 70 74 compile-time opt
27050 69 6f 6e 73 20 66 6f 72 20 53 51 4c 69 74 65 20 ions for SQLite
27060 63 6f 72 65 20 6c 69 62 72 61 72 79 2e 2e 2e 20 core library...
27070 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 ".... i
27080 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
27090 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
270a0 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
270b0 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
270c0 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
270d0 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 em.Data.SQLite.S
270e0 51 4c 69 74 65 33 20 53 51 4c 69 74 65 43 6f 6d QLite3 SQLiteCom
270f0 70 69 6c 65 4f 70 74 69 6f 6e 73 0d 0a 20 20 20 pileOptions..
27100 20 20 20 20 20 20 20 7d 20 63 6f 6d 70 69 6c 65 } compile
27110 4f 70 74 69 6f 6e 73 5d 20 3d 3d 20 30 7d 20 74 Options] == 0} t
27120 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
27130 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
27140 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
27150 41 72 67 73 20 5b 66 6f 72 6d 61 74 4c 69 73 74 Args [formatList
27160 20 5b 6c 73 6f 72 74 20 5c 0d 0a 20 20 20 20 20 [lsort \..
27170 20 20 20 20 20 20 20 20 20 20 20 24 63 6f 6d 70 $comp
27180 69 6c 65 4f 70 74 69 6f 6e 73 5d 20 3c 6e 6f 6e ileOptions] <non
27190 65 3e 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 e>] \n]..
271a0 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
271b0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
271c0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 75 ::test_channel u
271d0 6e 6b 6e 6f 77 6e 5c 6e 0d 0a 20 20 20 20 20 20 nknown\n..
271e0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
271f0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 63 61 74 63 .... catc
27200 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 h {.. t
27210 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
27220 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 nnel \..
27230 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 6d 70 "---- comp
27240 69 6c 65 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 73 ile-time options
27250 20 66 6f 72 20 53 51 4c 69 74 65 20 69 6e 74 65 for SQLite inte
27260 72 6f 70 20 61 73 73 65 6d 62 6c 79 2e 2e 2e 20 rop assembly...
27270 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 ".... i
27280 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
27290 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
272a0 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
272b0 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
272c0 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
272d0 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 em.Data.SQLite.S
272e0 51 4c 69 74 65 33 20 49 6e 74 65 72 6f 70 43 6f QLite3 InteropCo
272f0 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 0d 0a 20 20 mpileOptions..
27300 20 20 20 20 20 20 20 20 7d 20 63 6f 6d 70 69 6c } compil
27310 65 4f 70 74 69 6f 6e 73 5d 20 3d 3d 20 30 7d 20 eOptions] == 0}
27320 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
27330 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
27340 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
27350 64 41 72 67 73 20 5b 66 6f 72 6d 61 74 4c 69 73 dArgs [formatLis
27360 74 20 5b 6c 73 6f 72 74 20 5c 0d 0a 20 20 20 20 t [lsort \..
27370 20 20 20 20 20 20 20 20 20 20 20 20 24 63 6f 6d $com
27380 70 69 6c 65 4f 70 74 69 6f 6e 73 5d 20 3c 6e 6f pileOptions] <no
27390 6e 65 3e 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 ne>] \n]..
273a0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
273b0 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
273c0 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
273d0 75 6e 6b 6e 6f 77 6e 5c 6e 0d 0a 20 20 20 20 20 unknown\n..
273e0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
273f0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a }.... #..
27400 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
27410 53 68 6f 77 20 74 68 65 20 61 63 74 69 76 65 20 Show the active
27420 74 65 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 73 test constraints
27430 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
27440 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
27450 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
27460 65 6e 64 41 72 67 73 20 22 2d 2d 2d 2d 20 63 6f endArgs "---- co
27470 6e 73 74 72 61 69 6e 74 73 3a 20 22 20 5c 0d 0a nstraints: " \..
27480 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 6f 72 [for
27490 6d 61 74 4c 69 73 74 20 5b 6c 73 6f 72 74 20 5b matList [lsort [
274a0 67 65 74 43 6f 6e 73 74 72 61 69 6e 74 73 5d 5d getConstraints]]
274b0 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d 0d 0a 0d 0a <none>] \n]....
274c0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
274d0 20 20 20 23 20 4e 4f 54 45 3a 20 53 61 76 65 20 # NOTE: Save
274e0 74 68 65 20 74 65 73 74 20 63 6f 6e 73 74 72 61 the test constra
274f0 69 6e 74 73 20 66 6f 72 20 75 73 65 20 62 79 20 ints for use by
27500 74 68 72 65 61 64 73 20 63 72 65 61 74 65 64 20 threads created
27510 69 6e 20 74 68 69 73 0d 0a 20 20 20 20 20 20 20 in this..
27520 20 23 20 20 20 20 20 20 20 61 70 70 6c 69 63 61 # applica
27530 74 69 6f 6e 20 64 6f 6d 61 69 6e 2e 20 20 54 68 tion domain. Th
27540 69 73 20 69 73 20 6e 65 63 65 73 73 61 72 79 20 is is necessary
27550 62 65 63 61 75 73 65 20 61 6c 6c 20 74 68 65 20 because all the
27560 45 61 67 6c 65 0d 0a 20 20 20 20 20 20 20 20 23 Eagle.. #
27570 20 20 20 20 20 20 20 22 74 65 73 74 20 63 6f 6e "test con
27580 74 65 78 74 22 20 69 6e 66 6f 72 6d 61 74 69 6f text" informatio
27590 6e 20 69 73 20 70 65 72 2d 74 68 72 65 61 64 2e n is per-thread.
275a0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
275b0 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
275c0 65 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 63 6f exists ::test_co
275d0 6e 73 74 72 61 69 6e 74 73 5d 7d 20 74 68 65 6e nstraints]} then
275e0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 {.. se
275f0 74 20 3a 3a 74 65 73 74 5f 63 6f 6e 73 74 72 61 t ::test_constra
27600 69 6e 74 73 20 24 3a 3a 65 61 67 6c 65 5f 74 65 ints $::eagle_te
27610 73 74 73 28 63 6f 6e 73 74 72 61 69 6e 74 73 29 sts(constraints)
27620 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
27630 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
27640 20 20 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 20 74 # NOTE: Load t
27650 68 65 20 22 61 66 74 65 72 2d 63 6f 6e 73 74 72 he "after-constr
27660 61 69 6e 74 73 22 20 63 75 73 74 6f 6d 20 70 65 aints" custom pe
27670 72 2d 75 73 65 72 20 61 6e 64 2f 6f 72 20 70 65 r-user and/or pe
27680 72 2d 68 6f 73 74 0d 0a 20 20 20 20 20 20 20 20 r-host..
27690 23 20 20 20 20 20 20 20 74 65 73 74 20 73 65 74 # test set
276a0 74 69 6e 67 73 20 6e 6f 77 2e 0d 0a 20 20 20 20 tings now...
276b0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 75 #.. u
276c0 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 6c plevel 1 [list l
276d0 6f 61 64 53 51 4c 69 74 65 54 65 73 74 53 65 74 oadSQLiteTestSet
276e0 74 69 6e 67 73 20 24 3a 3a 74 65 73 74 5f 63 68 tings $::test_ch
276f0 61 6e 6e 65 6c 20 2e 61 66 74 65 72 5d 0d 0a 0d annel .after]...
27700 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
27710 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 6e # NOTE: If n
27720 65 63 65 73 73 61 72 79 2c 20 65 6e 61 62 6c 65 ecessary, enable
27730 20 73 68 61 72 65 64 2d 63 61 63 68 65 20 6d 6f shared-cache mo
27740 64 65 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 20 de now...
27750 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b #.. if {
27760 5b 68 61 73 52 75 6e 74 69 6d 65 4f 70 74 69 6f [hasRuntimeOptio
27770 6e 20 73 68 61 72 65 64 43 61 63 68 65 5d 7d 20 n sharedCache]}
27780 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
27790 20 20 65 6e 61 62 6c 65 53 68 61 72 65 64 43 61 enableSharedCa
277a0 63 68 65 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e che $::test_chan
277b0 6e 65 6c 20 74 72 75 65 0d 0a 20 20 20 20 20 20 nel true..
277c0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 }.... #
277d0 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
277e0 3a 20 53 68 6f 77 20 77 68 65 6e 20 6f 75 72 20 : Show when our
277f0 74 65 73 74 73 20 61 63 74 75 61 6c 6c 79 20 62 tests actually b
27800 65 67 61 6e 20 28 6e 6f 77 29 2e 0d 0a 20 20 20 egan (now)...
27810 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
27820 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
27830 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
27840 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
27850 20 22 2d 2d 2d 2d 20 53 79 73 74 65 6d 2e 44 61 "---- System.Da
27860 74 61 2e 53 51 4c 69 74 65 20 74 65 73 74 73 20 ta.SQLite tests
27870 62 65 67 61 6e 20 61 74 20 22 20 5c 0d 0a 20 20 began at " \..
27880 20 20 20 20 20 20 20 20 20 20 5b 63 6c 6f 63 6b [clock
27890 20 66 6f 72 6d 61 74 20 5b 63 6c 6f 63 6b 20 73 format [clock s
278a0 65 63 6f 6e 64 73 5d 5d 20 5c 6e 5d 0d 0a 20 20 econds]] \n]..
278b0 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
278c0 0a 20 20 20 20 70 72 6f 63 20 72 75 6e 53 51 4c . proc runSQL
278d0 69 74 65 54 65 73 74 46 69 6c 65 73 50 72 6f 6c iteTestFilesProl
278e0 6f 67 75 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 ogue {} {..
278f0 20 75 70 6c 65 76 65 6c 20 31 20 7b 0d 0a 20 20 uplevel 1 {..
27900 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
27910 20 23 20 4e 4f 54 45 3a 20 53 65 74 75 70 20 74 # NOTE: Setup t
27920 68 65 20 76 61 72 69 61 62 6c 65 73 20 74 68 61 he variables tha
27930 74 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 76 t refer to the v
27940 61 72 69 6f 75 73 20 6e 6f 6e 2d 64 61 74 61 20 arious non-data
27950 66 69 6c 65 73 0d 0a 20 20 20 20 20 20 20 20 23 files.. #
27960 20 20 20 20 20 20 20 72 65 71 75 69 72 65 64 20 required
27970 62 79 20 74 68 65 20 74 65 73 74 73 20 69 6e 20 by the tests in
27980 74 68 69 73 20 66 69 6c 65 2e 0d 0a 20 20 20 20 this file...
27990 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 #.. s
279a0 65 74 20 65 6e 74 69 74 79 46 72 61 6d 65 77 6f et entityFramewo
279b0 72 6b 44 6c 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 rkDllFile \..
279c0 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 75 69 [getBui
279d0 6c 64 46 69 6c 65 4e 61 6d 65 20 45 6e 74 69 74 ldFileName Entit
279e0 79 46 72 61 6d 65 77 6f 72 6b 2e 64 6c 6c 20 66 yFramework.dll f
279f0 61 6c 73 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 alse]....
27a00 20 73 65 74 20 69 6e 73 74 61 6c 6c 65 72 45 78 set installerEx
27a10 65 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 eFile \..
27a20 20 20 20 20 20 5b 67 65 74 42 75 69 6c 64 46 69 [getBuildFi
27a30 6c 65 4e 61 6d 65 20 49 6e 73 74 61 6c 6c 65 72 leName Installer
27a40 2e 65 78 65 20 66 61 6c 73 65 5d 0d 0a 0d 0a 20 .exe false]....
27a50 20 20 20 20 20 20 20 73 65 74 20 73 71 6c 69 74 set sqlit
27a60 65 44 65 73 69 67 6e 65 72 44 6c 6c 46 69 6c 65 eDesignerDllFile
27a70 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
27a80 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d [getBuildFileNam
27a90 65 20 53 51 4c 69 74 65 2e 44 65 73 69 67 6e 65 e SQLite.Designe
27aa0 72 2e 64 6c 6c 20 66 61 6c 73 65 5d 0d 0a 0d 0a r.dll false]....
27ab0 20 20 20 20 20 20 20 20 73 65 74 20 73 79 73 74 set syst
27ac0 65 6d 44 61 74 61 53 51 4c 69 74 65 44 6c 6c 46 emDataSQLiteDllF
27ad0 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ile \..
27ae0 20 20 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 [getBuildFile
27af0 4e 61 6d 65 20 53 79 73 74 65 6d 2e 44 61 74 61 Name System.Data
27b00 2e 53 51 4c 69 74 65 2e 64 6c 6c 20 66 61 6c 73 .SQLite.dll fals
27b10 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 e].... se
27b20 74 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 t systemDataSQLi
27b30 74 65 4c 69 6e 71 44 6c 6c 46 69 6c 65 20 5c 0d teLinqDllFile \.
27b40 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 . [ge
27b50 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 53 tBuildFileName S
27b60 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
27b70 65 2e 4c 69 6e 71 2e 64 6c 6c 20 66 61 6c 73 65 e.Linq.dll false
27b80 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 ].... set
27b90 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 systemDataSQLit
27ba0 65 45 66 36 44 6c 6c 46 69 6c 65 20 5c 0d 0a 20 eEf6DllFile \..
27bb0 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 [getB
27bc0 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 53 79 73 uildFileName Sys
27bd0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
27be0 45 46 36 2e 64 6c 6c 20 66 61 6c 73 65 5d 0d 0a EF6.dll false]..
27bf0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 65 .. set te
27c00 73 74 45 78 65 46 69 6c 65 20 5b 67 65 74 42 75 stExeFile [getBu
27c10 69 6c 64 46 69 6c 65 4e 61 6d 65 20 74 65 73 74 ildFileName test
27c20 2e 65 78 65 20 66 61 6c 73 65 5d 0d 0a 20 20 20 .exe false]..
27c30 20 20 20 20 20 73 65 74 20 74 65 73 74 4c 69 6e set testLin
27c40 71 45 78 65 46 69 6c 65 20 5b 67 65 74 42 75 69 qExeFile [getBui
27c50 6c 64 46 69 6c 65 4e 61 6d 65 20 74 65 73 74 6c ldFileName testl
27c60 69 6e 71 2e 65 78 65 20 66 61 6c 73 65 5d 0d 0a inq.exe false]..
27c70 20 20 20 20 20 20 20 20 73 65 74 20 74 65 73 74 set test
27c80 45 66 36 45 78 65 46 69 6c 65 20 5b 67 65 74 42 Ef6ExeFile [getB
27c90 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 74 65 73 uildFileName tes
27ca0 74 65 66 36 2e 65 78 65 20 66 61 6c 73 65 5d 0d tef6.exe false].
27cb0 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
27cc0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 65 # NOTE: Se
27cd0 74 75 70 20 74 68 65 20 76 61 72 69 61 62 6c 65 tup the variable
27ce0 73 20 74 68 61 74 20 72 65 66 65 72 20 74 6f 20 s that refer to
27cf0 74 68 65 20 76 61 72 69 6f 75 73 20 64 61 74 61 the various data
27d00 20 66 69 6c 65 73 0d 0a 20 20 20 20 20 20 20 20 files..
27d10 23 20 20 20 20 20 20 20 72 65 71 75 69 72 65 64 # required
27d20 20 62 79 20 74 68 65 20 74 65 73 74 73 20 69 6e by the tests in
27d30 20 74 68 69 73 20 66 69 6c 65 2e 0d 0a 20 20 20 this file...
27d40 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
27d50 73 65 74 20 74 65 73 74 4c 69 6e 71 4f 75 74 46 set testLinqOutF
27d60 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 ile [file native
27d70 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 name [file join
27d80 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
27d90 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 getSQLiteTestDat
27da0 61 50 61 74 68 5d 20 74 65 73 74 6c 69 6e 71 2e aPath] testlinq.
27db0 6f 75 74 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 out]]....
27dc0 20 73 65 74 20 6e 6f 72 74 68 77 69 6e 64 45 66 set northwindEf
27dd0 44 62 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 DbFile [file nat
27de0 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f ivename [file jo
27df0 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 in \..
27e00 20 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 [file dirname
27e10 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 5b 67 [file dirname [g
27e20 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 etSQLiteTestData
27e30 50 61 74 68 5d 5d 5d 20 5c 0d 0a 20 20 20 20 20 Path]]] \..
27e40 20 20 20 20 20 20 20 74 65 73 74 6c 69 6e 71 20 testlinq
27e50 6e 6f 72 74 68 77 69 6e 64 45 46 2e 64 62 5d 5d northwindEF.db]]
27e60 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 .... set
27e70 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 20 5b 66 69 nonWalDbFile [fi
27e80 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 le nativename [f
27e90 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 ile join \..
27ea0 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 [getSQLi
27eb0 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 teTestDataPath]
27ec0 6e 6f 6e 57 61 6c 2e 64 62 5d 5d 0d 0a 0d 0a 20 nonWal.db]]....
27ed0 20 20 20 20 20 20 20 73 65 74 20 77 61 6c 44 62 set walDb
27ee0 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 File [file nativ
27ef0 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
27f00 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
27f10 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 [getSQLiteTestDa
27f20 74 61 50 61 74 68 5d 20 77 61 6c 2e 64 62 5d 5d taPath] wal.db]]
27f30 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
27f40 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 # NOTE: T
27f50 68 65 20 76 61 72 69 6f 75 73 20 69 6e 73 74 61 he various insta
27f60 6c 6c 2f 75 6e 69 6e 73 74 61 6c 6c 20 6c 6f 67 ll/uninstall log
27f70 20 66 69 6c 65 73 20 75 73 65 64 20 74 6f 20 74 files used to t
27f80 65 73 74 20 74 68 65 0d 0a 20 20 20 20 20 20 20 est the..
27f90 20 23 20 20 20 20 20 20 20 64 65 73 69 67 6e 2d # design-
27fa0 74 69 6d 65 20 63 6f 6d 70 6f 6e 65 6e 74 20 69 time component i
27fb0 6e 73 74 61 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 nstaller...
27fc0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 #.. se
27fd0 74 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 t testInstallVs2
27fe0 30 30 35 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 005LogFile [file
27ff0 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c nativename [fil
28000 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 e join \..
28010 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 [getSQLite
28020 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 49 6e TestDataPath] In
28030 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 staller_Test_Vs2
28040 30 30 35 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 005.log]]....
28050 20 20 20 20 20 73 65 74 20 74 65 73 74 49 6e 73 set testIns
28060 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c tallVs2008LogFil
28070 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 e [file nativena
28080 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d me [file join \.
28090 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 . [ge
280a0 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 tSQLiteTestDataP
280b0 61 74 68 5d 20 49 6e 73 74 61 6c 6c 65 72 5f 54 ath] Installer_T
280c0 65 73 74 5f 56 73 32 30 30 38 2e 6c 6f 67 5d 5d est_Vs2008.log]]
280d0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 .... set
280e0 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 testInstallVs201
280f0 30 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 0LogFile [file n
28100 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 ativename [file
28110 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 join \..
28120 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 [getSQLiteTe
28130 73 74 44 61 74 61 50 61 74 68 5d 20 49 6e 73 74 stDataPath] Inst
28140 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 31 aller_Test_Vs201
28150 30 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 0.log]]....
28160 20 20 20 73 65 74 20 74 65 73 74 49 6e 73 74 61 set testInsta
28170 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 20 llVs2012LogFile
28180 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
28190 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 [file join \..
281a0 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 [getS
281b0 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 74 QLiteTestDataPat
281c0 68 5d 20 49 6e 73 74 61 6c 6c 65 72 5f 54 65 73 h] Installer_Tes
281d0 74 5f 56 73 32 30 31 32 2e 6c 6f 67 5d 5d 0d 0a t_Vs2012.log]]..
281e0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 65 .. set te
281f0 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c stInstallVs2013L
28200 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 ogFile [file nat
28210 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f ivename [file jo
28220 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 in \..
28230 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 [getSQLiteTest
28240 44 61 74 61 50 61 74 68 5d 20 49 6e 73 74 61 6c DataPath] Instal
28250 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 31 33 2e ler_Test_Vs2013.
28260 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 log]]....
28270 20 73 65 74 20 74 65 73 74 49 6e 73 74 61 6c 6c set testInstall
28280 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 20 5b 66 Vs2015LogFile [f
28290 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b ile nativename [
282a0 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 file join \..
282b0 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c [getSQL
282c0 69 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d iteTestDataPath]
282d0 20 49 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f Installer_Test_
282e0 56 73 32 30 31 35 2e 6c 6f 67 5d 5d 0d 0a 0d 0a Vs2015.log]]....
282f0 20 20 20 20 20 20 20 20 73 65 74 20 74 65 73 74 set test
28300 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c UninstallVs2005L
28310 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 ogFile [file nat
28320 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f ivename [file jo
28330 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 in \..
28340 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 [getSQLiteTest
28350 44 61 74 61 50 61 74 68 5d 20 55 6e 69 6e 73 74 DataPath] Uninst
28360 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 30 aller_Test_Vs200
28370 35 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 5.log]]....
28380 20 20 20 73 65 74 20 74 65 73 74 55 6e 69 6e 73 set testUnins
28390 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c tallVs2008LogFil
283a0 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 e [file nativena
283b0 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d me [file join \.
283c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 . [ge
283d0 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 tSQLiteTestDataP
283e0 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 72 ath] Uninstaller
283f0 5f 54 65 73 74 5f 56 73 32 30 30 38 2e 6c 6f 67 _Test_Vs2008.log
28400 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 ]].... se
28410 74 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 t testUninstallV
28420 73 32 30 31 30 4c 6f 67 46 69 6c 65 20 5b 66 69 s2010LogFile [fi
28430 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 le nativename [f
28440 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 ile join \..
28450 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 [getSQLi
28460 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 teTestDataPath]
28470 55 6e 69 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 Uninstaller_Test
28480 5f 56 73 32 30 31 30 2e 6c 6f 67 5d 5d 0d 0a 0d _Vs2010.log]]...
28490 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 65 73 . set tes
284a0 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 32 tUninstallVs2012
284b0 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 LogFile [file na
284c0 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a tivename [file j
284d0 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 oin \..
284e0 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 [getSQLiteTes
284f0 74 44 61 74 61 50 61 74 68 5d 20 55 6e 69 6e 73 tDataPath] Unins
28500 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 taller_Test_Vs20
28510 31 32 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 12.log]]....
28520 20 20 20 20 73 65 74 20 74 65 73 74 55 6e 69 6e set testUnin
28530 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f 67 46 69 stallVs2013LogFi
28540 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e le [file nativen
28550 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c ame [file join \
28560 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 .. [g
28570 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 etSQLiteTestData
28580 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 Path] Uninstalle
28590 72 5f 54 65 73 74 5f 56 73 32 30 31 33 2e 6c 6f r_Test_Vs2013.lo
285a0 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 g]].... s
285b0 65 74 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c et testUninstall
285c0 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 20 5b 66 Vs2015LogFile [f
285d0 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b ile nativename [
285e0 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 file join \..
285f0 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c [getSQL
28600 69 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d iteTestDataPath]
28610 20 55 6e 69 6e 73 74 61 6c 6c 65 72 5f 54 65 73 Uninstaller_Tes
28620 74 5f 56 73 32 30 31 35 2e 6c 6f 67 5d 5d 0d 0a t_Vs2015.log]]..
28630 0d 0a 20 20 20 20 20 20 20 20 23 23 23 23 23 23 .. ######
28640 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28650 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28660 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28670 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
28680 23 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 #.... if
28690 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e {![haveConstrain
286a0 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 t [appendArgs fi
286b0 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 le_ \..
286c0 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 65 [file tail $e
286d0 6e 74 69 74 79 46 72 61 6d 65 77 6f 72 6b 44 6c ntityFrameworkDl
286e0 6c 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b lFile]]]} then {
286f0 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
28700 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
28710 68 61 6e 6e 65 6c 20 24 65 6e 74 69 74 79 46 72 hannel $entityFr
28720 61 6d 65 77 6f 72 6b 44 6c 6c 46 69 6c 65 0d 0a ameworkDllFile..
28730 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
28740 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 if {![haveC
28750 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e onstraint [appen
28760 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 dArgs file_ \..
28770 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 [file
28780 20 74 61 69 6c 20 24 69 6e 73 74 61 6c 6c 65 72 tail $installer
28790 45 78 65 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e ExeFile]]]} then
287a0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 {.. ch
287b0 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 eckForFile $test
287c0 5f 63 68 61 6e 6e 65 6c 20 24 69 6e 73 74 61 6c _channel $instal
287d0 6c 65 72 45 78 65 46 69 6c 65 20 49 6e 73 74 61 lerExeFile Insta
287e0 6c 6c 65 72 2e 65 78 65 0d 0a 20 20 20 20 20 20 ller.exe..
287f0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
28800 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
28810 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
28820 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
28830 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
28840 24 73 71 6c 69 74 65 44 65 73 69 67 6e 65 72 44 $sqliteDesignerD
28850 6c 6c 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 llFile]]]} then
28860 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 {.. che
28870 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f ckForFile $test_
28880 63 68 61 6e 6e 65 6c 20 24 73 71 6c 69 74 65 44 channel $sqliteD
28890 65 73 69 67 6e 65 72 44 6c 6c 46 69 6c 65 0d 0a esignerDllFile..
288a0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
288b0 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 if {![haveC
288c0 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e onstraint [appen
288d0 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 dArgs file_ \..
288e0 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 [file
288f0 20 74 61 69 6c 20 24 73 79 73 74 65 6d 44 61 74 tail $systemDat
28900 61 53 51 4c 69 74 65 44 6c 6c 46 69 6c 65 5d 5d aSQLiteDllFile]]
28910 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
28920 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
28930 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
28940 24 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 $systemDataSQLit
28950 65 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 20 20 20 eDllFile..
28960 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
28970 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
28980 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
28990 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
289a0 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
289b0 24 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 $systemDataSQLit
289c0 65 4c 69 6e 71 44 6c 6c 46 69 6c 65 5d 5d 5d 7d eLinqDllFile]]]}
289d0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
289e0 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 checkForFile
289f0 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 73 $test_channel $s
28a00 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 4c ystemDataSQLiteL
28a10 69 6e 71 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 20 inqDllFile..
28a20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
28a30 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 if {![haveConst
28a40 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
28a50 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 s file_ \..
28a60 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 [file tai
28a70 6c 20 24 73 79 73 74 65 6d 44 61 74 61 53 51 4c l $systemDataSQL
28a80 69 74 65 45 66 36 44 6c 6c 46 69 6c 65 5d 5d 5d iteEf6DllFile]]]
28a90 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
28aa0 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 checkForFile
28ab0 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 $test_channel $
28ac0 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 systemDataSQLite
28ad0 45 66 36 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 20 Ef6DllFile..
28ae0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
28af0 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 if {![haveConst
28b00 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
28b10 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 s file_ \..
28b20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 [file tai
28b30 6c 20 24 74 65 73 74 45 78 65 46 69 6c 65 5d 5d l $testExeFile]]
28b40 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
28b50 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
28b60 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
28b70 24 74 65 73 74 45 78 65 46 69 6c 65 20 74 65 73 $testExeFile tes
28b80 74 2e 65 78 65 0d 0a 20 20 20 20 20 20 20 20 7d t.exe.. }
28b90 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
28ba0 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 ![haveConstraint
28bb0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
28bc0 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 e_ \..
28bd0 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 [file tail $te
28be0 73 74 4c 69 6e 71 45 78 65 46 69 6c 65 5d 5d 5d stLinqExeFile]]]
28bf0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
28c00 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 checkForFile
28c10 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 $test_channel $
28c20 74 65 73 74 4c 69 6e 71 45 78 65 46 69 6c 65 20 testLinqExeFile
28c30 74 65 73 74 6c 69 6e 71 2e 65 78 65 0d 0a 20 20 testlinq.exe..
28c40 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
28c50 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e if {![haveCon
28c60 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
28c70 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 rgs file_ \..
28c80 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 [file t
28c90 61 69 6c 20 24 74 65 73 74 45 66 36 45 78 65 46 ail $testEf6ExeF
28ca0 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
28cb0 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
28cc0 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
28cd0 6e 6e 65 6c 20 24 74 65 73 74 45 66 36 45 78 65 nnel $testEf6Exe
28ce0 46 69 6c 65 20 74 65 73 74 65 66 36 2e 65 78 65 File testef6.exe
28cf0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
28d00 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
28d10 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
28d20 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
28d30 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
28d40 6c 65 20 74 61 69 6c 20 24 74 65 73 74 4c 69 6e le tail $testLin
28d50 71 4f 75 74 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 qOutFile]]]} the
28d60 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 n {.. c
28d70 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
28d80 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 4c t_channel $testL
28d90 69 6e 71 4f 75 74 46 69 6c 65 0d 0a 20 20 20 20 inqOutFile..
28da0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
28db0 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 if {![haveConst
28dc0 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
28dd0 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 s file_ \..
28de0 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 [file tai
28df0 6c 20 24 6e 6f 72 74 68 77 69 6e 64 45 66 44 62 l $northwindEfDb
28e00 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d File]]]} then {.
28e10 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b . check
28e20 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 ForFile $test_ch
28e30 61 6e 6e 65 6c 20 24 6e 6f 72 74 68 77 69 6e 64 annel $northwind
28e40 45 66 44 62 46 69 6c 65 0d 0a 20 20 20 20 20 20 EfDbFile..
28e50 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
28e60 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
28e70 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
28e80 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
28e90 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
28ea0 24 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 5d 5d 5d $nonWalDbFile]]]
28eb0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
28ec0 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 checkForFile
28ed0 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 $test_channel $
28ee0 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 0d 0a 20 20 nonWalDbFile..
28ef0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
28f00 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e if {![haveCon
28f10 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
28f20 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 rgs file_ \..
28f30 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 [file t
28f40 61 69 6c 20 24 77 61 6c 44 62 46 69 6c 65 5d 5d ail $walDbFile]]
28f50 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
28f60 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
28f70 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
28f80 24 77 61 6c 44 62 46 69 6c 65 0d 0a 20 20 20 20 $walDbFile..
28f90 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
28fa0 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 if {![haveConst
28fb0 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
28fc0 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 s file_ \..
28fd0 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 [file tai
28fe0 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 l $testInstallVs
28ff0 32 30 30 35 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 2005LogFile]]]}
29000 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
29010 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
29020 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 test_channel $te
29030 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c stInstallVs2005L
29040 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 ogFile..
29050 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 }.... if
29060 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e {![haveConstrain
29070 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 t [appendArgs fi
29080 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 le_ \..
29090 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 [file tail $t
290a0 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 30 38 estInstallVs2008
290b0 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e LogFile]]]} then
290c0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 {.. ch
290d0 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 eckForFile $test
290e0 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 49 6e _channel $testIn
290f0 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 stallVs2008LogFi
29100 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d le.. }...
29110 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 . if {![h
29120 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 aveConstraint [a
29130 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 ppendArgs file_
29140 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
29150 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 49 file tail $testI
29160 6e 73 74 61 6c 6c 56 73 32 30 31 30 4c 6f 67 46 nstallVs2010LogF
29170 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
29180 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
29190 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
291a0 6e 6e 65 6c 20 24 74 65 73 74 49 6e 73 74 61 6c nnel $testInstal
291b0 6c 56 73 32 30 31 30 4c 6f 67 46 69 6c 65 0d 0a lVs2010LogFile..
291c0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
291d0 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 if {![haveC
291e0 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e onstraint [appen
291f0 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 dArgs file_ \..
29200 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 [file
29210 20 74 61 69 6c 20 24 74 65 73 74 49 6e 73 74 61 tail $testInsta
29220 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 5d llVs2012LogFile]
29230 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 ]]} then {..
29240 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 checkForFi
29250 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c le $test_channel
29260 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 $testInstallVs2
29270 30 31 32 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 012LogFile..
29280 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
29290 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 if {![haveConst
292a0 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
292b0 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 s file_ \..
292c0 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 [file tai
292d0 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 l $testInstallVs
292e0 32 30 31 33 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 2013LogFile]]]}
292f0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
29300 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
29310 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 test_channel $te
29320 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c stInstallVs2013L
29330 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 ogFile..
29340 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 }.... if
29350 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e {![haveConstrain
29360 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 t [appendArgs fi
29370 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 le_ \..
29380 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 [file tail $t
29390 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 35 estInstallVs2015
293a0 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e LogFile]]]} then
293b0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 {.. ch
293c0 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 eckForFile $test
293d0 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 49 6e _channel $testIn
293e0 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 stallVs2015LogFi
293f0 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d le.. }...
29400 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 . if {![h
29410 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 aveConstraint [a
29420 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 ppendArgs file_
29430 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
29440 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 file tail $testU
29450 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f ninstallVs2005Lo
29460 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b gFile]]]} then {
29470 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
29480 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
29490 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e hannel $testUnin
294a0 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 69 stallVs2005LogFi
294b0 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d le.. }...
294c0 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 . if {![h
294d0 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 aveConstraint [a
294e0 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 ppendArgs file_
294f0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
29500 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 file tail $testU
29510 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f ninstallVs2008Lo
29520 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b gFile]]]} then {
29530 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
29540 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
29550 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e hannel $testUnin
29560 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 stallVs2008LogFi
29570 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d le.. }...
29580 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 . if {![h
29590 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 aveConstraint [a
295a0 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 ppendArgs file_
295b0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
295c0 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 file tail $testU
295d0 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 30 4c 6f ninstallVs2010Lo
295e0 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b gFile]]]} then {
295f0 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
29600 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
29610 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e hannel $testUnin
29620 73 74 61 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 stallVs2010LogFi
29630 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d le.. }...
29640 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 . if {![h
29650 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 aveConstraint [a
29660 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 ppendArgs file_
29670 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
29680 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 file tail $testU
29690 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f ninstallVs2012Lo
296a0 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b gFile]]]} then {
296b0 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
296c0 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
296d0 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e hannel $testUnin
296e0 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 stallVs2012LogFi
296f0 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d le.. }...
29700 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 . if {![h
29710 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 aveConstraint [a
29720 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 ppendArgs file_
29730 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
29740 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 file tail $testU
29750 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f ninstallVs2013Lo
29760 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b gFile]]]} then {
29770 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
29780 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
29790 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e hannel $testUnin
297a0 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f 67 46 69 stallVs2013LogFi
297b0 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d le.. }...
297c0 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 . if {![h
297d0 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 aveConstraint [a
297e0 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 ppendArgs file_
297f0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
29800 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 file tail $testU
29810 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f ninstallVs2015Lo
29820 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b gFile]]]} then {
29830 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
29840 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
29850 68 61 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e hannel $testUnin
29860 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 stallVs2015LogFi
29870 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 le.. }..
29880 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
29890 0d 0a 20 20 20 20 70 72 6f 63 20 72 75 6e 53 51 .. proc runSQ
298a0 4c 69 74 65 54 65 73 74 46 69 6c 65 73 45 70 69 LiteTestFilesEpi
298b0 6c 6f 67 75 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 logue {} {..
298c0 20 20 75 70 6c 65 76 65 6c 20 31 20 7b 0d 0a 20 uplevel 1 {..
298d0 20 20 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f unset -no
298e0 63 6f 6d 70 6c 61 69 6e 20 5c 0d 0a 20 20 20 20 complain \..
298f0 20 20 20 20 20 20 20 20 74 65 73 74 55 6e 69 6e testUnin
29900 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 stallVs2015LogFi
29910 6c 65 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c le testUninstall
29920 56 73 32 30 31 33 4c 6f 67 46 69 6c 65 20 5c 0d Vs2013LogFile \.
29930 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 65 73 . tes
29940 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 32 tUninstallVs2012
29950 4c 6f 67 46 69 6c 65 20 74 65 73 74 55 6e 69 6e LogFile testUnin
29960 73 74 61 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 stallVs2010LogFi
29970 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 le \..
29980 20 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 testUninstallV
29990 73 32 30 30 38 4c 6f 67 46 69 6c 65 20 74 65 73 s2008LogFile tes
299a0 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 35 tUninstallVs2005
299b0 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 LogFile \..
299c0 20 20 20 20 20 20 20 74 65 73 74 49 6e 73 74 61 testInsta
299d0 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 20 llVs2015LogFile
299e0 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 testInstallVs201
299f0 33 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 20 20 20 3LogFile \..
29a00 20 20 20 20 20 20 20 20 74 65 73 74 49 6e 73 74 testInst
29a10 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 allVs2012LogFile
29a20 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 testInstallVs20
29a30 31 30 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 20 20 10LogFile \..
29a40 20 20 20 20 20 20 20 20 20 74 65 73 74 49 6e 73 testIns
29a50 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c tallVs2008LogFil
29a60 65 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 e testInstallVs2
29a70 30 30 35 4c 6f 67 46 69 6c 65 0d 0a 0d 0a 20 20 005LogFile....
29a80 20 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 unset -noc
29a90 6f 6d 70 6c 61 69 6e 20 5c 0d 0a 20 20 20 20 20 omplain \..
29aa0 20 20 20 20 20 20 20 6e 6f 72 74 68 77 69 6e 64 northwind
29ab0 45 66 44 62 46 69 6c 65 20 74 65 73 74 4c 69 6e EfDbFile testLin
29ac0 71 4f 75 74 46 69 6c 65 20 5c 0d 0a 20 20 20 20 qOutFile \..
29ad0 20 20 20 20 20 20 20 20 77 61 6c 44 62 46 69 6c walDbFil
29ae0 65 20 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 0d 0a e nonWalDbFile..
29af0 0d 0a 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 .. unset
29b00 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 5c 0d 0a 20 -nocomplain \..
29b10 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 45 testE
29b20 66 36 45 78 65 46 69 6c 65 20 74 65 73 74 4c 69 f6ExeFile testLi
29b30 6e 71 45 78 65 46 69 6c 65 20 5c 0d 0a 20 20 20 nqExeFile \..
29b40 20 20 20 20 20 20 20 20 20 74 65 73 74 45 78 65 testExe
29b50 46 69 6c 65 20 73 79 73 74 65 6d 44 61 74 61 53 File systemDataS
29b60 51 4c 69 74 65 45 66 36 44 6c 6c 46 69 6c 65 20 QLiteEf6DllFile
29b70 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 \.. s
29b80 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 4c ystemDataSQLiteL
29b90 69 6e 71 44 6c 6c 46 69 6c 65 20 73 79 73 74 65 inqDllFile syste
29ba0 6d 44 61 74 61 53 51 4c 69 74 65 44 6c 6c 46 69 mDataSQLiteDllFi
29bb0 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 le \..
29bc0 20 20 73 71 6c 69 74 65 44 65 73 69 67 6e 65 72 sqliteDesigner
29bd0 44 6c 6c 46 69 6c 65 20 69 6e 73 74 61 6c 6c 65 DllFile installe
29be0 72 45 78 65 46 69 6c 65 20 5c 0d 0a 20 20 20 20 rExeFile \..
29bf0 20 20 20 20 20 20 20 20 65 6e 74 69 74 79 46 72 entityFr
29c00 61 6d 65 77 6f 72 6b 44 6c 6c 46 69 6c 65 0d 0a ameworkDllFile..
29c10 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
29c20 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 75 6e 53 ... proc runS
29c30 51 4c 69 74 65 54 65 73 74 45 70 69 6c 6f 67 75 QLiteTestEpilogu
29c40 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d e {} {.. #.
29c50 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 . # NOTE: S
29c60 6b 69 70 20 72 75 6e 6e 69 6e 67 20 6f 75 72 20 kip running our
29c70 63 75 73 74 6f 6d 20 65 70 69 6c 6f 67 75 65 20 custom epilogue
29c80 69 66 20 74 68 65 20 6d 61 69 6e 20 6f 6e 65 20 if the main one
29c90 68 61 73 20 62 65 65 6e 0d 0a 20 20 20 20 20 20 has been..
29ca0 23 20 20 20 20 20 20 20 73 6b 69 70 70 65 64 2e # skipped.
29cb0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
29cc0 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
29cd0 74 73 20 3a 3a 6e 6f 28 65 70 69 6c 6f 67 75 65 ts ::no(epilogue
29ce0 2e 65 61 67 6c 65 29 5d 7d 20 74 68 65 6e 20 7b .eagle)]} then {
29cf0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
29d00 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f # NOTE: Sho
29d10 77 20 77 68 65 6e 20 6f 75 72 20 74 65 73 74 73 w when our tests
29d20 20 61 63 74 75 61 6c 6c 79 20 65 6e 64 65 64 20 actually ended
29d30 28 6e 6f 77 29 2e 0d 0a 20 20 20 20 20 20 20 20 (now)...
29d40 23 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 #.. tputs
29d50 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
29d60 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
29d70 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
29d80 2d 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 - System.Data.SQ
29d90 4c 69 74 65 20 74 65 73 74 73 20 65 6e 64 65 64 Lite tests ended
29da0 20 61 74 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 at " \..
29db0 20 20 20 20 20 5b 63 6c 6f 63 6b 20 66 6f 72 6d [clock form
29dc0 61 74 20 5b 63 6c 6f 63 6b 20 73 65 63 6f 6e 64 at [clock second
29dd0 73 5d 5d 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 s]] \n]....
29de0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
29df0 4e 4f 54 45 3a 20 4c 6f 61 64 20 74 68 65 20 22 NOTE: Load the "
29e00 65 70 69 6c 6f 67 75 65 22 20 63 75 73 74 6f 6d epilogue" custom
29e10 20 70 65 72 2d 75 73 65 72 20 61 6e 64 2f 6f 72 per-user and/or
29e20 20 70 65 72 2d 68 6f 73 74 20 74 65 73 74 0d 0a per-host test..
29e30 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
29e40 73 65 74 74 69 6e 67 73 20 6e 6f 77 2e 0d 0a 20 settings now...
29e50 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
29e60 20 20 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 uplevel 1 [lis
29e70 74 20 6c 6f 61 64 53 51 4c 69 74 65 54 65 73 74 t loadSQLiteTest
29e80 53 65 74 74 69 6e 67 73 20 24 3a 3a 74 65 73 74 Settings $::test
29e90 5f 63 68 61 6e 6e 65 6c 20 2e 65 70 69 6c 6f 67 _channel .epilog
29ea0 75 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 ue].... #
29eb0 0d 0a 20 20 20 20 20 20 20 20 23 20 42 55 47 46 .. # BUGF
29ec0 49 58 3a 20 42 65 66 6f 72 65 20 63 68 65 63 6b IX: Before check
29ed0 69 6e 67 20 74 68 65 20 66 69 6e 61 6c 20 72 65 ing the final re
29ee0 73 6f 75 72 63 65 73 20 69 6e 20 75 73 65 20 62 sources in use b
29ef0 79 20 53 51 4c 69 74 65 2c 20 6d 61 6b 65 0d 0a y SQLite, make..
29f00 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
29f10 20 20 73 75 72 65 20 62 6f 74 68 20 6f 66 20 74 sure both of t
29f20 68 65 20 50 52 41 47 4d 41 20 72 65 6c 61 74 65 he PRAGMA relate
29f30 64 20 64 69 72 65 63 74 6f 72 79 20 6e 61 6d 65 d directory name
29f40 73 20 61 72 65 20 66 72 65 65 64 2e 0d 0a 20 20 s are freed...
29f50 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
29f60 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 44 checkForSQLiteD
29f70 69 72 65 63 74 6f 72 69 65 73 20 24 3a 3a 74 65 irectories $::te
29f80 73 74 5f 63 68 61 6e 6e 65 6c 20 74 72 75 65 0d st_channel true.
29f90 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
29fa0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 6c # NOTE: Al
29fb0 73 6f 20 72 65 70 6f 72 74 20 74 68 65 20 72 65 so report the re
29fc0 73 6f 75 72 63 65 20 75 73 61 67 65 20 61 66 74 source usage aft
29fd0 65 72 20 72 75 6e 6e 69 6e 67 20 74 68 65 20 74 er running the t
29fe0 65 73 74 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 ests... #
29ff0 0d 0a 20 20 20 20 20 20 20 20 72 65 70 6f 72 74 .. report
2a000 53 51 4c 69 74 65 52 65 73 6f 75 72 63 65 73 20 SQLiteResources
2a010 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d $::test_channel.
2a020 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
2a030 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 # NOTE: Re
2a040 70 6f 72 74 20 74 68 65 20 63 72 69 74 69 63 61 port the critica
2a050 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 73 20 l handle counts
2a060 61 66 74 65 72 20 72 75 6e 6e 69 6e 67 20 74 68 after running th
2a070 65 20 74 65 73 74 73 2e 0d 0a 20 20 20 20 20 20 e tests...
2a080 20 20 23 0d 0a 20 20 20 20 20 20 20 20 67 65 74 #.. get
2a090 53 51 4c 69 74 65 48 61 6e 64 6c 65 43 6f 75 6e SQLiteHandleCoun
2a0a0 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
2a0b0 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d el.... #.
2a0c0 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
2a0d0 20 49 66 20 6e 65 63 65 73 73 61 72 79 2c 20 64 If necessary, d
2a0e0 69 73 61 62 6c 65 20 73 68 61 72 65 64 2d 63 61 isable shared-ca
2a0f0 63 68 65 20 6d 6f 64 65 20 6e 6f 77 2e 0d 0a 20 che mode now...
2a100 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
2a110 20 20 69 66 20 7b 5b 68 61 73 52 75 6e 74 69 6d if {[hasRuntim
2a120 65 4f 70 74 69 6f 6e 20 73 68 61 72 65 64 43 61 eOption sharedCa
2a130 63 68 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 che]} then {..
2a140 20 20 20 20 20 20 20 20 65 6e 61 62 6c 65 53 68 enableSh
2a150 61 72 65 64 43 61 63 68 65 20 24 3a 3a 74 65 73 aredCache $::tes
2a160 74 5f 63 68 61 6e 6e 65 6c 20 66 61 6c 73 65 0d t_channel false.
2a170 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
2a180 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
2a190 20 20 20 23 23 23 23 23 23 23 23 23 23 23 23 23 #############
2a1a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a1b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a1c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a1d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0d 0a ##############..
2a1e0 20 20 20 20 23 23 23 23 23 23 23 23 23 23 23 23 ############
2a1f0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a200 23 20 45 4e 44 20 45 61 67 6c 65 20 4f 4e 4c 59 # END Eagle ONLY
2a210 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ###############
2a220 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0d ###############.
2a230 0a 20 20 20 20 23 23 23 23 23 23 23 23 23 23 23 . ###########
2a240 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a250 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a260 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a270 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a280 0d 0a 20 20 7d 0d 0a 0d 0a 20 20 23 0d 0a 20 20 .. }.... #..
2a290 23 20 4e 4f 54 45 3a 20 53 61 76 65 20 74 68 65 # NOTE: Save the
2a2a0 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 64 69 72 name of the dir
2a2b0 65 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e ectory containin
2a2c0 67 20 74 68 69 73 20 66 69 6c 65 2e 0d 0a 20 20 g this file...
2a2d0 23 0d 0a 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 #.. if {![info
2a2e0 65 78 69 73 74 73 20 63 6f 6d 6d 6f 6e 5f 64 69 exists common_di
2a2f0 72 65 63 74 6f 72 79 5d 7d 20 74 68 65 6e 20 7b rectory]} then {
2a300 0d 0a 20 20 20 20 73 65 74 20 63 6f 6d 6d 6f 6e .. set common
2a310 5f 64 69 72 65 63 74 6f 72 79 20 5b 66 69 6c 65 _directory [file
2a320 20 64 69 72 6e 61 6d 65 20 5b 69 6e 66 6f 20 73 dirname [info s
2a330 63 72 69 70 74 5d 5d 0d 0a 20 20 7d 0d 0a 0d 0a cript]].. }....
2a340 20 20 23 0d 0a 20 20 23 20 4e 4f 54 45 3a 20 50 #.. # NOTE: P
2a350 72 6f 76 69 64 65 20 74 68 65 20 53 79 73 74 65 rovide the Syste
2a360 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 74 65 m.Data.SQLite te
2a370 73 74 20 70 61 63 6b 61 67 65 20 74 6f 20 74 68 st package to th
2a380 65 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a e interpreter...
2a390 20 20 23 0d 0a 20 20 70 61 63 6b 61 67 65 20 70 #.. package p
2a3a0 72 6f 76 69 64 65 20 53 79 73 74 65 6d 2e 44 61 rovide System.Da
2a3b0 74 61 2e 53 51 4c 69 74 65 2e 54 65 73 74 20 31 ta.SQLite.Test 1
2a3c0 2e 30 0d 0a 7d 0d 0a .0..}..