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 53 74 72 . proc getStr
99e0: 69 6e 67 4d 61 70 46 6f 72 54 63 6c 45 73 63 61 ingMapForTclEsca
99f0: 70 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 72 pe {} {.. r
9a00: 65 74 75 72 6e 20 5b 6c 69 73 74 20 5c 5c 20 5c eturn [list \\ \
9a10: 5c 5c 5c 20 5c 5b 20 5c 5c 5c 5b 20 5c 5d 20 5c \\\ \[ \\\[ \] \
9a20: 5c 5c 5d 20 5c 24 20 5c 5c 5c 24 5d 0d 0a 20 20 \\] \$ \\\$]..
9a30: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
9a40: 20 67 65 74 54 65 73 74 4f 76 65 72 72 69 64 65 getTestOverride
9a50: 73 50 72 65 61 6d 62 6c 65 20 7b 20 7b 65 78 74 sPreamble { {ext
9a60: 72 61 56 61 72 4e 61 6d 65 73 20 22 22 7d 20 7d raVarNames ""} }
9a70: 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 76 61 {.. set va
9a80: 72 4e 61 6d 65 73 20 5b 6c 69 73 74 5d 0d 0a 0d rNames [list]...
9a90: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
9aa0: 23 20 4e 4f 54 45 3a 20 49 66 20 61 76 61 69 6c # NOTE: If avail
9ab0: 61 62 6c 65 2c 20 73 74 61 72 74 20 77 69 74 68 able, start with
9ac0: 20 74 68 65 20 6d 61 73 74 65 72 20 6c 69 73 74 the master list
9ad0: 20 6f 66 20 74 65 73 74 20 6f 76 65 72 72 69 64 of test overrid
9ae0: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
9af0: 20 76 61 72 69 61 62 6c 65 73 2e 0d 0a 20 20 20 variables...
9b00: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
9b10: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
9b20: 65 73 74 5f 6f 76 65 72 72 69 64 65 73 5d 20 26 est_overrides] &
9b30: 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b & \.. [
9b40: 6c 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f llength $::test_
9b50: 6f 76 65 72 72 69 64 65 73 5d 20 3e 20 30 7d 20 overrides] > 0}
9b60: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
9b70: 65 76 61 6c 20 6c 61 70 70 65 6e 64 20 76 61 72 eval lappend var
9b80: 4e 61 6d 65 73 20 24 3a 3a 74 65 73 74 5f 6f 76 Names $::test_ov
9b90: 65 72 72 69 64 65 73 0d 0a 20 20 20 20 20 20 7d errides.. }
9ba0: 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
9bb0: 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 72 65 # NOTE: If re
9bc0: 71 75 65 73 74 65 64 20 62 79 20 6f 75 72 20 63 quested by our c
9bd0: 61 6c 6c 65 72 2c 20 61 64 64 20 61 6e 79 20 61 aller, add any a
9be0: 64 64 69 74 69 6f 6e 61 6c 20 76 61 72 69 61 62 dditional variab
9bf0: 6c 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 le.. #
9c00: 20 20 6e 61 6d 65 73 20 74 6f 20 63 6f 70 79 20 names to copy
9c10: 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 now... #..
9c20: 20 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 if {[llengt
9c30: 68 20 24 65 78 74 72 61 56 61 72 4e 61 6d 65 73 h $extraVarNames
9c40: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
9c50: 20 20 20 20 20 20 20 65 76 61 6c 20 6c 61 70 70 eval lapp
9c60: 65 6e 64 20 76 61 72 4e 61 6d 65 73 20 24 65 78 end varNames $ex
9c70: 74 72 61 56 61 72 4e 61 6d 65 73 0d 0a 20 20 20 traVarNames..
9c80: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
9c90: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 . # NOTE: B
9ca0: 75 69 6c 64 20 74 68 65 20 73 63 72 69 70 74 20 uild the script
9cb0: 66 72 61 67 6d 65 6e 74 20 74 6f 20 62 65 20 72 fragment to be r
9cc0: 65 74 75 72 6e 65 64 20 62 79 20 70 72 6f 63 65 eturned by proce
9cd0: 73 73 69 6e 67 20 65 61 63 68 0d 0a 20 20 20 20 ssing each..
9ce0: 20 20 23 20 20 20 20 20 20 20 76 61 72 69 61 62 # variab
9cf0: 6c 65 20 6e 61 6d 65 20 61 6e 64 20 61 64 64 69 le name and addi
9d00: 6e 67 20 74 68 65 20 6e 65 63 65 63 65 73 73 61 ng the nececessa
9d10: 72 79 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 ry script fragme
9d20: 6e 74 73 20 66 6f 72 0d 0a 20 20 20 20 20 20 23 nts for.. #
9d30: 20 20 20 20 20 20 20 65 61 63 68 20 6f 6e 65 2e each one.
9d40: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
9d50: 20 73 65 74 20 72 65 73 75 6c 74 20 22 22 0d 0a set result ""..
9d60: 0d 0a 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 .. foreach
9d70: 76 61 72 4e 61 6d 65 20 24 76 61 72 4e 61 6d 65 varName $varName
9d80: 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a s {.. #..
9d90: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
9da0: 42 75 69 6c 64 20 74 68 65 20 71 75 61 6c 69 66 Build the qualif
9db0: 69 65 64 20 67 6c 6f 62 61 6c 20 76 61 72 69 61 ied global varia
9dc0: 62 6c 65 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 ble name...
9dd0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 #.. se
9de0: 74 20 66 75 6c 6c 56 61 72 4e 61 6d 65 20 5b 61 t fullVarName [a
9df0: 70 70 65 6e 64 41 72 67 73 20 3a 3a 20 24 76 61 ppendArgs :: $va
9e00: 72 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 rName]....
9e10: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
9e20: 4f 54 45 3a 20 44 6f 65 73 20 74 68 65 20 76 61 OTE: Does the va
9e30: 72 69 61 62 6c 65 20 65 78 69 73 74 20 69 6e 20 riable exist in
9e40: 74 68 69 73 20 69 6e 74 65 72 70 72 65 74 65 72 this interpreter
9e50: 20 63 6f 6e 74 65 78 74 3f 0d 0a 20 20 20 20 20 context?..
9e60: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 #.. if
9e70: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 24 {[info exists $
9e80: 66 75 6c 6c 56 61 72 4e 61 6d 65 5d 7d 20 74 68 fullVarName]} th
9e90: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
9ea0: 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
9eb0: 4f 54 45 3a 20 41 70 70 65 6e 64 20 61 20 73 63 OTE: Append a sc
9ec0: 72 69 70 74 20 66 72 61 67 6d 65 6e 74 20 74 6f ript fragment to
9ed0: 20 74 68 65 20 72 65 73 75 6c 74 20 74 68 61 74 the result that
9ee0: 20 77 69 6c 6c 20 63 6f 72 72 65 63 74 6c 79 0d will correctly.
9ef0: 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
9f00: 20 20 20 63 6f 70 79 20 61 6e 79 20 63 6f 6e 74 copy any cont
9f10: 61 69 6e 65 64 20 76 61 6c 75 65 20 74 6f 20 61 ained value to a
9f20: 6e 6f 74 68 65 72 20 69 6e 74 65 72 70 72 65 74 nother interpret
9f30: 65 72 20 63 6f 6e 74 65 78 74 2e 0d 0a 20 20 20 er context...
9f40: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
9f50: 20 20 20 20 61 70 70 65 6e 64 20 72 65 73 75 6c append resul
9f60: 74 20 5c 6e 20 22 73 65 74 20 22 20 24 66 75 6c t \n "set " $ful
9f70: 6c 56 61 72 4e 61 6d 65 20 22 20 5c 7b 22 20 5b lVarName " \{" [
9f80: 73 74 72 69 6e 67 20 6d 61 70 20 5c 0d 0a 20 20 string map \..
9f90: 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
9fa0: 53 74 72 69 6e 67 4d 61 70 46 6f 72 54 63 6c 45 StringMapForTclE
9fb0: 73 63 61 70 65 5d 20 5b 73 65 74 20 24 66 75 6c scape] [set $ful
9fc0: 6c 56 61 72 4e 61 6d 65 5d 5d 20 5c 7d 0d 0a 20 lVarName]] \}..
9fd0: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
9fe0: 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
9ff0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 # NOTE: If t
a000: 68 65 20 72 65 73 75 6c 74 20 63 6f 6e 74 61 69 he result contai
a010: 6e 73 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 73 ns one or more s
a020: 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 73 2c cript fragments,
a030: 20 61 70 70 65 6e 64 20 61 0d 0a 20 20 20 20 20 append a..
a040: 20 23 20 20 20 20 20 20 20 6e 65 77 6c 69 6e 65 # newline
a050: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
a060: 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
a070: 6e 67 74 68 20 24 72 65 73 75 6c 74 5d 20 3e 20 ngth $result] >
a080: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
a090: 20 20 20 61 70 70 65 6e 64 20 72 65 73 75 6c 74 append result
a0a0: 20 5c 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a \n.. }....
a0b0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 return $re
a0c0: 73 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a sult.. }.....
a0d0: 20 20 20 20 70 72 6f 63 20 6d 6f 76 65 53 79 73 proc moveSys
a0e0: 74 65 6d 44 61 74 61 53 51 4c 69 74 65 44 6c 6c temDataSQLiteDll
a0f0: 43 6f 6e 66 69 67 20 7b 20 7b 72 65 73 74 6f 72 Config { {restor
a100: 65 20 66 61 6c 73 65 7d 20 7b 76 65 72 62 6f 73 e false} {verbos
a110: 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 e true} } {..
a120: 20 20 20 73 65 74 20 64 69 72 65 63 74 6f 72 79 set directory
a130: 20 5b 67 65 74 42 69 6e 61 72 79 44 69 72 65 63 [getBinaryDirec
a140: 74 6f 72 79 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 tory].... i
a150: 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 f {[string lengt
a160: 68 20 24 64 69 72 65 63 74 6f 72 79 5d 20 3d 3d h $directory] ==
a170: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
a180: 20 20 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 if {$verbose
a190: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
a1a0: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
a1b0: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
a1c0: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
a1d0: 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 "---- ski
a1e0: 70 70 65 64 20 6d 6f 76 69 6e 67 20 5c 22 53 79 pped moving \"Sy
a1f0: 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
a200: 2e 64 6c 6c 2e 63 6f 6e 66 69 67 5c 22 2c 20 22 .dll.config\", "
a210: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
a220: 20 20 22 6e 6f 20 62 69 6e 61 72 79 20 64 69 72 "no binary dir
a230: 65 63 74 6f 72 79 5c 6e 22 5d 0d 0a 20 20 20 20 ectory\n"]..
a240: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
a250: 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 20 7d return.. }
a260: 0d 0a 0d 0a 20 20 20 20 20 20 73 65 74 20 66 69 .... set fi
a270: 6c 65 4e 61 6d 65 28 31 29 20 5b 66 69 6c 65 20 leName(1) [file
a280: 6e 6f 72 6d 61 6c 69 7a 65 20 5c 0d 0a 20 20 20 normalize \..
a290: 20 20 20 20 20 20 20 5b 66 69 6c 65 20 6a 6f 69 [file joi
a2a0: 6e 20 24 64 69 72 65 63 74 6f 72 79 20 53 79 73 n $directory Sys
a2b0: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
a2c0: 64 6c 6c 2e 63 6f 6e 66 69 67 5d 5d 0d 0a 0d 0a dll.config]]....
a2d0: 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 set fileNa
a2e0: 6d 65 28 32 29 20 5b 61 70 70 65 6e 64 41 72 67 me(2) [appendArg
a2f0: 73 20 24 66 69 6c 65 4e 61 6d 65 28 31 29 20 2e s $fileName(1) .
a300: 6d 6f 76 65 64 5d 0d 0a 0d 0a 20 20 20 20 20 20 moved]....
a310: 69 66 20 7b 24 72 65 73 74 6f 72 65 7d 20 74 68 if {$restore} th
a320: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 en {.. if
a330: 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {[file exists $
a340: 66 69 6c 65 4e 61 6d 65 28 32 29 5d 7d 20 74 68 fileName(2)]} th
a350: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
a360: 66 69 6c 65 20 72 65 6e 61 6d 65 20 24 66 69 6c file rename $fil
a370: 65 4e 61 6d 65 28 32 29 20 24 66 69 6c 65 4e 61 eName(2) $fileNa
a380: 6d 65 28 31 29 0d 0a 0d 0a 20 20 20 20 20 20 20 me(1)....
a390: 20 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d if {$verbose}
a3a0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
a3b0: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
a3c0: 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
a3d0: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
a3e0: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
a3f0: 6d 6f 76 65 64 20 5c 22 22 20 24 66 69 6c 65 4e moved \"" $fileN
a400: 61 6d 65 28 32 29 20 22 5c 22 20 74 6f 20 5c 22 ame(2) "\" to \"
a410: 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
a420: 20 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 28 31 $fileName(1
a430: 29 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ) \"\n]..
a440: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 }.. }
a450: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
a460: 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 if {$verbose}
a470: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
a480: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
a490: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
a4a0: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
a4b0: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
a4c0: 6b 69 70 70 65 64 20 6d 6f 76 69 6e 67 20 5c 22 kipped moving \"
a4d0: 22 20 24 66 69 6c 65 4e 61 6d 65 28 32 29 20 5c " $fileName(2) \
a4e0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
a4f0: 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e "\", it does n
a500: 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 ot exist\n"]..
a510: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
a520: 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c }.. } el
a530: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 se {.. if
a540: 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {[file exists $
a550: 66 69 6c 65 4e 61 6d 65 28 31 29 5d 7d 20 74 68 fileName(1)]} th
a560: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
a570: 66 69 6c 65 20 72 65 6e 61 6d 65 20 24 66 69 6c file rename $fil
a580: 65 4e 61 6d 65 28 31 29 20 24 66 69 6c 65 4e 61 eName(1) $fileNa
a590: 6d 65 28 32 29 0d 0a 0d 0a 20 20 20 20 20 20 20 me(2)....
a5a0: 20 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d if {$verbose}
a5b0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
a5c0: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
a5d0: 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
a5e0: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
a5f0: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
a600: 6d 6f 76 65 64 20 5c 22 22 20 24 66 69 6c 65 4e moved \"" $fileN
a610: 61 6d 65 28 31 29 20 22 5c 22 20 74 6f 20 5c 22 ame(1) "\" to \"
a620: 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
a630: 20 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 28 32 $fileName(2
a640: 29 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ) \"\n]..
a650: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 }.. }
a660: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
a670: 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 if {$verbose}
a680: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
a690: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
a6a0: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
a6b0: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
a6c0: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
a6d0: 6b 69 70 70 65 64 20 6d 6f 76 69 6e 67 20 5c 22 kipped moving \"
a6e0: 22 20 24 66 69 6c 65 4e 61 6d 65 28 31 29 20 5c " $fileName(1) \
a6f0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
a700: 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e "\", it does n
a710: 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 ot exist\n"]..
a720: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
a730: 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
a740: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
a750: 63 20 67 65 74 41 70 70 44 6f 6d 61 69 6e 50 72 c getAppDomainPr
a760: 65 61 6d 62 6c 65 20 7b 20 7b 70 72 65 66 69 78 eamble { {prefix
a770: 20 22 22 7d 20 7b 73 75 66 66 69 78 20 22 22 7d ""} {suffix ""}
a780: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
a790: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 # NOTE: Thi
a7a0: 73 20 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 s procedure retu
a7b0: 72 6e 73 20 61 20 74 65 73 74 20 73 65 74 75 70 rns a test setup
a7c0: 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 script fragment
a7d0: 20 73 75 69 74 61 62 6c 65 20 66 6f 72 0d 0a 20 suitable for..
a7e0: 20 20 20 20 20 23 20 20 20 20 20 20 20 65 76 61 # eva
a7f0: 6c 75 61 74 69 6f 6e 20 62 79 20 61 6e 20 69 6e luation by an in
a800: 74 65 72 70 72 65 74 65 72 20 63 72 65 61 74 65 terpreter create
a810: 64 20 69 6e 20 61 6e 20 69 73 6f 6c 61 74 65 64 d in an isolated
a820: 20 61 70 70 6c 69 63 61 74 69 6f 6e 0d 0a 20 20 application..
a830: 20 20 20 20 23 20 20 20 20 20 20 20 64 6f 6d 61 # doma
a840: 69 6e 2e 20 20 54 68 65 20 73 63 72 69 70 74 20 in. The script
a850: 66 72 61 67 6d 65 6e 74 20 62 65 69 6e 67 20 72 fragment being r
a860: 65 74 75 72 6e 65 64 20 77 69 6c 6c 20 62 65 20 eturned will be
a870: 73 75 72 72 6f 75 6e 64 65 64 20 62 79 0d 0a 20 surrounded by..
a880: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 # the
a890: 20 70 72 65 66 69 78 20 61 6e 64 20 73 75 66 66 prefix and suff
a8a0: 69 78 20 22 73 63 72 69 70 74 20 66 72 61 67 6d ix "script fragm
a8b0: 65 6e 74 73 22 20 73 70 65 63 69 66 69 65 64 20 ents" specified
a8c0: 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 2c 0d 0a by our caller,..
a8d0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 69 66 # if
a8e0: 20 61 6e 79 2e 20 20 54 68 65 20 65 6e 74 69 72 any. The entir
a8f0: 65 20 73 63 72 69 70 74 20 62 65 69 6e 67 20 72 e script being r
a900: 65 74 75 72 6e 65 64 20 77 69 6c 6c 20 62 65 20 eturned will be
a910: 73 75 62 73 74 69 74 75 74 65 64 20 76 69 61 0d substituted via.
a920: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 5b . # [
a930: 73 75 62 73 74 5d 2c 20 69 6e 20 74 68 65 20 63 subst], in the c
a940: 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 20 63 61 ontext of our ca
a950: 6c 6c 65 72 2c 20 62 65 66 6f 72 65 20 62 65 69 ller, before bei
a960: 6e 67 20 72 65 74 75 72 6e 65 64 2e 0d 0a 20 20 ng returned...
a970: 20 20 20 20 23 20 20 20 20 20 20 20 54 68 69 73 # This
a980: 20 73 74 65 70 20 69 73 20 6e 65 63 65 73 73 61 step is necessa
a990: 72 79 20 73 6f 20 74 68 61 74 20 73 6f 6d 65 20 ry so that some
a9a0: 6c 69 6d 69 74 65 64 20 63 6f 6e 74 65 78 74 20 limited context
a9b0: 69 6e 66 6f 72 6d 61 74 69 6f 6e 2c 0d 0a 20 20 information,..
a9c0: 20 20 20 20 23 20 20 20 20 20 20 20 70 72 69 6d # prim
a9d0: 61 72 69 6c 79 20 72 65 6c 61 74 65 64 20 74 6f arily related to
a9e0: 20 74 68 65 20 74 65 73 74 69 6e 67 20 64 69 72 the testing dir
a9f0: 65 63 74 6f 72 69 65 73 2c 20 63 61 6e 20 62 65 ectories, can be
aa00: 20 74 72 61 6e 73 66 65 72 72 65 64 0d 0a 20 20 transferred..
aa10: 20 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 74 # to t
aa20: 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 69 he interpreter i
aa30: 6e 20 74 68 65 20 69 73 6f 6c 61 74 65 64 20 61 n the isolated a
aa40: 70 70 6c 69 63 61 74 69 6f 6e 20 64 6f 6d 61 69 pplication domai
aa50: 6e 2c 20 6d 61 6b 69 6e 67 20 69 74 0d 0a 20 20 n, making it..
aa60: 20 20 20 20 23 20 20 20 20 20 20 20 61 62 6c 65 # able
aa70: 20 74 6f 20 73 75 63 63 65 73 73 66 75 6c 6c 79 to successfully
aa80: 20 72 75 6e 20 74 65 73 74 73 20 74 68 61 74 20 run tests that
aa90: 72 65 71 75 69 72 65 20 6f 6e 65 20 6f 72 20 6d require one or m
aaa0: 6f 72 65 20 6f 66 20 74 68 65 0d 0a 20 20 20 20 ore of the..
aab0: 20 20 23 20 20 20 20 20 20 20 66 69 6c 65 73 20 # files
aac0: 69 6e 20 6f 6e 65 20 6f 66 20 74 68 65 20 74 65 in one of the te
aad0: 73 74 69 6e 67 20 64 69 72 65 63 74 6f 72 69 65 sting directorie
aae0: 73 2e 20 20 43 61 6c 6c 65 72 73 20 73 68 6f 75 s. Callers shou
aaf0: 6c 64 20 6b 65 65 70 20 69 6e 0d 0a 20 20 20 20 ld keep in..
ab00: 20 20 23 20 20 20 20 20 20 20 6d 69 6e 64 20 74 # mind t
ab10: 68 61 74 20 74 68 65 20 74 65 73 74 20 73 63 72 hat the test scr
ab20: 69 70 74 20 66 72 61 67 6d 65 6e 74 20 62 65 69 ipt fragment bei
ab30: 6e 67 20 72 65 74 75 72 6e 65 64 20 63 61 6e 6e ng returned cann
ab40: 6f 74 20 72 65 6c 79 20 6f 6e 0d 0a 20 20 20 20 ot rely on..
ab50: 20 20 23 20 20 20 20 20 20 20 61 6e 79 20 73 63 # any sc
ab60: 72 69 70 74 20 6c 69 62 72 61 72 79 20 70 72 6f ript library pro
ab70: 63 65 64 75 72 65 73 20 74 68 61 74 20 61 72 65 cedures that are
ab80: 20 6e 6f 74 20 70 72 6f 76 69 64 65 64 20 62 79 not provided by
ab90: 20 74 68 65 20 45 61 67 6c 65 0d 0a 20 20 20 20 the Eagle..
aba0: 20 20 23 20 20 20 20 20 20 20 6c 69 62 72 61 72 # librar
abb0: 79 20 70 61 63 6b 61 67 65 20 28 69 2e 65 2e 20 y package (i.e.
abc0: 22 69 6e 69 74 2e 65 61 67 6c 65 22 29 2c 20 69 "init.eagle"), i
abd0: 6e 63 6c 75 64 69 6e 67 20 74 68 6f 73 65 20 70 ncluding those p
abe0: 72 6f 76 69 64 65 64 20 62 79 0d 0a 20 20 20 20 rovided by..
abf0: 20 20 23 20 20 20 20 20 20 20 74 68 65 20 45 61 # the Ea
ac00: 67 6c 65 20 74 65 73 74 20 70 61 63 6b 61 67 65 gle test package
ac10: 2c 20 75 6e 6c 65 73 73 20 74 68 65 20 66 69 6c , unless the fil
ac20: 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 e containing the
ac30: 6d 20 69 73 20 6c 6f 61 64 65 64 0d 0a 20 20 20 m is loaded..
ac40: 20 20 20 23 20 20 20 20 20 20 20 6d 61 6e 75 61 # manua
ac50: 6c 6c 79 20 76 69 61 20 73 6f 6d 65 20 6f 74 68 lly via some oth
ac60: 65 72 20 6d 65 63 68 61 6e 69 73 6d 20 28 65 2e er mechanism (e.
ac70: 67 2e 20 62 79 20 69 6e 63 6c 75 64 69 6e 67 20 g. by including
ac80: 61 70 70 72 6f 70 72 69 61 74 65 0d 0a 20 20 20 appropriate..
ac90: 20 20 20 23 20 20 20 20 20 20 20 5b 70 61 63 6b # [pack
aca0: 61 67 65 20 72 65 71 75 69 72 65 5d 20 6f 72 20 age require] or
acb0: 5b 73 6f 75 72 63 65 5d 20 63 6f 6d 6d 61 6e 64 [source] command
acc0: 73 20 69 6e 20 74 68 65 20 70 72 65 66 69 78 20 s in the prefix
acd0: 6f 72 20 73 75 66 66 69 78 0d 0a 20 20 20 20 20 or suffix..
ace0: 20 23 20 20 20 20 20 20 20 73 63 72 69 70 74 20 # script
acf0: 66 72 61 67 6d 65 6e 74 73 29 2e 20 20 41 6c 73 fragments). Als
ad00: 6f 2c 20 61 6c 6c 20 76 61 72 69 61 62 6c 65 20 o, all variable
ad10: 72 65 66 65 72 65 6e 63 65 73 20 61 6e 64 20 61 references and a
ad20: 6c 6c 20 6e 65 73 74 65 64 0d 0a 20 20 20 20 20 ll nested..
ad30: 20 23 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 # command
ad40: 73 20 28 69 2e 65 2e 20 74 68 6f 73 65 20 69 6e s (i.e. those in
ad50: 20 73 71 75 61 72 65 20 62 72 61 63 6b 65 74 73 square brackets
ad60: 29 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e 20 74 ) contained in t
ad70: 68 65 20 66 69 6e 61 6c 0d 0a 20 20 20 20 20 20 he final..
ad80: 23 20 20 20 20 20 20 20 73 63 72 69 70 74 20 66 # script f
ad90: 72 61 67 6d 65 6e 74 20 77 69 6c 6c 20 65 6e 64 ragment will end
ada0: 20 75 70 20 62 65 69 6e 67 20 65 76 61 6c 75 61 up being evalua
adb0: 74 65 64 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 ted in the conte
adc0: 78 74 20 6f 66 20 74 68 65 0d 0a 20 20 20 20 20 xt of the..
add0: 20 23 20 20 20 20 20 20 20 63 61 6c 6c 69 6e 67 # calling
ade0: 20 69 6e 74 65 72 70 72 65 74 65 72 20 61 6e 64 interpreter and
adf0: 20 6e 6f 74 20 74 68 65 20 74 61 72 67 65 74 20 not the target
ae00: 69 6e 74 65 72 70 72 65 74 65 72 20 63 72 65 61 interpreter crea
ae10: 74 65 64 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 ted in the..
ae20: 20 20 23 20 20 20 20 20 20 20 69 73 6f 6c 61 74 # isolat
ae30: 65 64 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 64 ed application d
ae40: 6f 6d 61 69 6e 20 75 6e 6c 65 73 73 20 74 68 65 omain unless the
ae50: 20 64 6f 6c 6c 61 72 20 73 69 67 6e 73 20 61 6e dollar signs an
ae60: 64 2f 6f 72 20 73 71 75 61 72 65 0d 0a 20 20 20 d/or square..
ae70: 20 20 20 23 20 20 20 20 20 20 20 62 72 61 63 6b # brack
ae80: 65 74 73 20 61 72 65 20 73 70 65 63 69 61 6c 6c ets are speciall
ae90: 79 20 71 75 6f 74 65 64 20 77 69 74 68 20 62 61 y quoted with ba
aea0: 63 6b 73 6c 61 73 68 65 73 2e 0d 0a 20 20 20 20 ckslashes...
aeb0: 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 72 #.. retur
aec0: 6e 20 5b 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 n [uplevel 1 [li
aed0: 73 74 20 73 75 62 73 74 20 5b 61 70 70 65 6e 64 st subst [append
aee0: 41 72 67 73 20 24 70 72 65 66 69 78 20 7b 0d 0a Args $prefix {..
aef0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
af00: 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 5c # NOTE: The \
af10: 5b 6f 62 6a 65 63 74 5c 5d 20 63 6f 6d 6d 61 6e [object\] comman
af20: 64 20 6d 61 79 20 62 65 20 6d 69 73 73 69 6e 67 d may be missing
af30: 20 69 6e 20 73 6f 6d 65 20 45 61 67 6c 65 20 63 in some Eagle c
af40: 6f 72 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ore.. #
af50: 20 20 20 20 20 6c 69 62 72 61 72 79 20 63 6f 6e library con
af60: 66 69 67 75 72 61 74 69 6f 6e 73 2e 20 20 43 6c figurations. Cl
af70: 6f 6e 69 6e 67 20 61 6e 64 20 75 73 69 6e 67 20 oning and using
af80: 74 68 65 20 70 72 6f 63 65 64 75 72 65 0d 0a 20 the procedure..
af90: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 5c # \
afa0: 5b 63 68 61 6e 67 65 4e 61 74 69 76 65 52 75 6e [changeNativeRun
afb0: 74 69 6d 65 4f 70 74 69 6f 6e 5c 5d 20 6d 61 79 timeOption\] may
afc0: 20 68 65 6c 70 20 74 6f 20 6d 69 74 69 67 61 74 help to mitigat
afd0: 65 20 74 68 69 73 2e 0d 0a 20 20 20 20 20 20 20 e this...
afe0: 20 23 0d 0a 20 20 20 20 20 20 20 20 70 72 6f 63 #.. proc
aff0: 20 63 68 61 6e 67 65 4e 61 74 69 76 65 52 75 6e changeNativeRun
b000: 74 69 6d 65 4f 70 74 69 6f 6e 20 5c 0d 0a 20 20 timeOption \..
b010: 20 20 20 20 20 20 20 20 20 20 7b 5b 69 6e 66 6f {[info
b020: 20 61 72 67 73 20 63 68 61 6e 67 65 4e 61 74 69 args changeNati
b030: 76 65 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 5d veRuntimeOption]
b040: 7d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 } \..
b050: 20 7b 5b 69 6e 66 6f 20 62 6f 64 79 20 63 68 61 {[info body cha
b060: 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 69 6d 65 ngeNativeRuntime
b070: 4f 70 74 69 6f 6e 5d 7d 0d 0a 0d 0a 20 20 20 20 Option]}....
b080: 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 catch {..
b090: 20 20 20 20 20 20 20 63 68 61 6e 67 65 4e 61 74 changeNat
b0a0: 69 76 65 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e iveRuntimeOption
b0b0: 20 5b 68 61 73 52 75 6e 74 69 6d 65 4f 70 74 69 [hasRuntimeOpti
b0c0: 6f 6e 20 6e 61 74 69 76 65 5d 0d 0a 20 20 20 20 on native]..
b0d0: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 5b }.. } [
b0e0: 67 65 74 54 65 73 74 4f 76 65 72 72 69 64 65 73 getTestOverrides
b0f0: 50 72 65 61 6d 62 6c 65 20 5b 6c 69 73 74 20 70 Preamble [list p
b100: 61 74 68 20 74 65 73 74 5f 63 68 61 6e 6e 65 6c ath test_channel
b110: 5d 5d 20 24 73 75 66 66 69 78 5d 5d 5d 0d 0a 20 ]] $suffix]]]..
b120: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
b130: 63 20 74 72 79 43 6f 70 79 45 78 74 65 72 6e 61 c tryCopyExterna
b140: 6c 46 69 6c 65 20 7b 0d 0a 20 20 20 20 20 20 20 lFile {..
b150: 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 7b 70 fileName {p
b160: 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7b 6e 65 77 latform ""} {new
b170: 46 69 6c 65 4e 61 6d 65 20 22 22 7d 20 7b 76 65 FileName ""} {ve
b180: 72 62 6f 73 65 20 74 72 75 65 7d 20 7d 20 7b 0d rbose true} } {.
b190: 0a 20 20 20 20 20 20 73 65 74 20 73 6f 75 72 63 . set sourc
b1a0: 65 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 45 78 eFileName [getEx
b1b0: 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 20 24 ternalFileName $
b1c0: 66 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 fileName]....
b1d0: 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 if {![file ex
b1e0: 69 73 74 73 20 24 73 6f 75 72 63 65 46 69 6c 65 ists $sourceFile
b1f0: 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 Name]} then {..
b200: 20 20 20 20 20 20 20 69 66 20 7b 24 76 65 72 62 if {$verb
b210: 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ose} then {..
b220: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
b230: 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
b240: 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
b250: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
b260: 73 6b 69 70 70 65 64 20 63 6f 70 79 69 6e 67 20 skipped copying
b270: 65 78 74 65 72 6e 61 6c 20 66 69 6c 65 20 5c 22 external file \"
b280: 22 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d " $sourceFileNam
b290: 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
b2a0: 20 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 "\", it does
b2b0: 6e 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 not exist\n"]..
b2c0: 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
b2d0: 20 20 20 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 return..
b2e0: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 }.... if
b2f0: 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
b300: 24 6e 65 77 46 69 6c 65 4e 61 6d 65 5d 20 3e 20 $newFileName] >
b310: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
b320: 20 20 20 73 65 74 20 74 61 72 67 65 74 46 69 6c set targetFil
b330: 65 4e 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 eName [getBinary
b340: 46 69 6c 65 4e 61 6d 65 20 24 6e 65 77 46 69 6c FileName $newFil
b350: 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d eName $platform]
b360: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
b370: 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 61 .. set ta
b380: 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 65 rgetFileName [ge
b390: 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 tBinaryFileName
b3a0: 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 $fileName $platf
b3b0: 6f 72 6d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d orm].. }...
b3c0: 0a 20 20 20 20 20 20 73 65 74 20 74 61 72 67 65 . set targe
b3d0: 74 44 69 72 65 63 74 6f 72 79 20 5b 66 69 6c 65 tDirectory [file
b3e0: 20 64 69 72 6e 61 6d 65 20 24 74 61 72 67 65 74 dirname $target
b3f0: 46 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 FileName]....
b400: 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
b410: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 66 . if {![f
b420: 69 6c 65 20 65 78 69 73 74 73 20 24 74 61 72 67 ile exists $targ
b430: 65 74 44 69 72 65 63 74 6f 72 79 5d 7d 20 74 68 etDirectory]} th
b440: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
b450: 66 69 6c 65 20 6d 6b 64 69 72 20 24 74 61 72 67 file mkdir $targ
b460: 65 74 44 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 etDirectory..
b470: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
b480: 20 20 66 69 6c 65 20 63 6f 70 79 20 2d 66 6f 72 file copy -for
b490: 63 65 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 ce $sourceFileNa
b4a0: 6d 65 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 me $targetFileNa
b4b0: 6d 65 0d 0a 20 20 20 20 20 20 7d 5d 20 3d 3d 20 me.. }] ==
b4c0: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
b4d0: 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
b4e0: 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
b4f0: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
b500: 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 69 65 64 "---- copied
b510: 20 65 78 74 65 72 6e 61 6c 20 66 69 6c 65 20 66 external file f
b520: 72 6f 6d 20 5c 22 22 20 24 73 6f 75 72 63 65 46 rom \"" $sourceF
b530: 69 6c 65 4e 61 6d 65 20 22 5c 22 20 74 6f 20 5c ileName "\" to \
b540: 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 "" \..
b550: 20 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d $targetFileNam
b560: 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d e \"\n].. }
b570: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
b580: 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
b590: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
b5a0: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
b5b0: 20 20 22 2d 2d 2d 2d 20 66 61 69 6c 65 64 20 74 "---- failed t
b5c0: 6f 20 63 6f 70 79 20 65 78 74 65 72 6e 61 6c 20 o copy external
b5d0: 66 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 73 file from \"" $s
b5e0: 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 5c 0d ourceFileName \.
b5f0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 . "\"
b600: 20 74 6f 20 5c 22 22 20 24 74 61 72 67 65 74 46 to \"" $targetF
b610: 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 ileName \"\n]..
b620: 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
b630: 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 79 43 6f .. proc tryCo
b640: 70 79 42 69 6e 61 72 79 46 69 6c 65 20 7b 0d 0a pyBinaryFile {..
b650: 20 20 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 file
b660: 4e 61 6d 65 20 6d 61 6e 61 67 65 64 4f 6e 6c 79 Name managedOnly
b670: 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7b {platform ""} {
b680: 6e 65 77 46 69 6c 65 4e 61 6d 65 20 22 22 7d 0d newFileName ""}.
b690: 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 76 65 . {ve
b6a0: 72 62 6f 73 65 20 74 72 75 65 7d 20 7d 20 7b 0d rbose true} } {.
b6b0: 0a 20 20 20 20 20 20 73 65 74 20 73 6f 75 72 63 . set sourc
b6c0: 65 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 69 eFileName [getBi
b6d0: 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 69 naryFileName $fi
b6e0: 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d leName $platform
b6f0: 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 ].... if {!
b700: 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 73 6f [file exists $so
b710: 75 72 63 65 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 urceFileName]} t
b720: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 hen {.. i
b730: 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 f {$verbose} the
b740: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 n {.. t
b750: 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
b760: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
b770: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
b780: 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 "---- skipped
b790: 63 6f 70 79 69 6e 67 20 62 69 6e 61 72 79 20 66 copying binary f
b7a0: 69 6c 65 20 5c 22 22 20 24 73 6f 75 72 63 65 46 ile \"" $sourceF
b7b0: 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 ileName \..
b7c0: 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 69 74 "\", it
b7d0: 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 5c does not exist\
b7e0: 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a n"].. }..
b7f0: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
b800: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
b810: 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c if {[string l
b820: 65 6e 67 74 68 20 24 6e 65 77 46 69 6c 65 4e 61 ength $newFileNa
b830: 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d me] > 0} then {.
b840: 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 61 72 . set tar
b850: 67 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 getFileName [get
b860: 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 5c 0d BuildFileName \.
b870: 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 6e 65 . $ne
b880: 77 46 69 6c 65 4e 61 6d 65 20 24 6d 61 6e 61 67 wFileName $manag
b890: 65 64 4f 6e 6c 79 20 24 70 6c 61 74 66 6f 72 6d edOnly $platform
b8a0: 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 ].. } else
b8b0: 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 {.. set t
b8c0: 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 argetFileName [g
b8d0: 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 etBuildFileName
b8e0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 \.. $
b8f0: 66 69 6c 65 4e 61 6d 65 20 24 6d 61 6e 61 67 65 fileName $manage
b900: 64 4f 6e 6c 79 20 24 70 6c 61 74 66 6f 72 6d 5d dOnly $platform]
b910: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
b920: 20 20 20 73 65 74 20 74 61 72 67 65 74 44 69 72 set targetDir
b930: 65 63 74 6f 72 79 20 5b 66 69 6c 65 20 64 69 72 ectory [file dir
b940: 6e 61 6d 65 20 24 74 61 72 67 65 74 46 69 6c 65 name $targetFile
b950: 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 Name].... i
b960: 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
b970: 20 20 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 if {![file
b980: 65 78 69 73 74 73 20 24 74 61 72 67 65 74 44 69 exists $targetDi
b990: 72 65 63 74 6f 72 79 5d 7d 20 74 68 65 6e 20 7b rectory]} then {
b9a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 .. file
b9b0: 20 6d 6b 64 69 72 20 24 74 61 72 67 65 74 44 69 mkdir $targetDi
b9c0: 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 20 rectory..
b9d0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 66 69 }.... fi
b9e0: 6c 65 20 63 6f 70 79 20 2d 66 6f 72 63 65 20 24 le copy -force $
b9f0: 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 24 sourceFileName $
ba00: 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 0d 0a targetFileName..
ba10: 20 20 20 20 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 }] == 0} t
ba20: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 hen {.. t
ba30: 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
ba40: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
ba50: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
ba60: 22 2d 2d 2d 2d 20 63 6f 70 69 65 64 20 62 69 6e "---- copied bin
ba70: 61 72 79 20 66 69 6c 65 20 66 72 6f 6d 20 5c 22 ary file from \"
ba80: 22 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d " $sourceFileNam
ba90: 65 20 22 5c 22 20 74 6f 20 5c 22 22 20 5c 0d 0a e "\" to \"" \..
baa0: 20 20 20 20 20 20 20 20 20 20 20 20 24 74 61 72 $tar
bab0: 67 65 74 46 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e getFileName \"\n
bac0: 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 ].. } else
bad0: 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
bae0: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
baf0: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
bb00: 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
bb10: 2d 20 66 61 69 6c 65 64 20 74 6f 20 63 6f 70 79 - failed to copy
bb20: 20 62 69 6e 61 72 79 20 66 69 6c 65 20 66 72 6f binary file fro
bb30: 6d 20 5c 22 22 20 24 73 6f 75 72 63 65 46 69 6c m \"" $sourceFil
bb40: 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 eName \..
bb50: 20 20 20 20 20 22 5c 22 20 74 6f 20 5c 22 22 20 "\" to \""
bb60: 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 $targetFileName
bb70: 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a \"\n].. }..
bb80: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
bb90: 6f 63 20 74 72 79 43 6f 70 79 42 75 69 6c 64 46 oc tryCopyBuildF
bba0: 69 6c 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 ile {..
bbb0: 20 20 20 66 69 6c 65 4e 61 6d 65 20 6d 61 6e 61 fileName mana
bbc0: 67 65 64 4f 6e 6c 79 20 7b 70 6c 61 74 66 6f 72 gedOnly {platfor
bbd0: 6d 20 22 22 7d 20 7b 6e 65 77 46 69 6c 65 4e 61 m ""} {newFileNa
bbe0: 6d 65 20 22 22 7d 0d 0a 20 20 20 20 20 20 20 20 me ""}..
bbf0: 20 20 20 20 7b 76 65 72 62 6f 73 65 20 74 72 75 {verbose tru
bc00: 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 e} } {.. se
bc10: 74 20 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 t sourceFileName
bc20: 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 [getBuildFileNa
bc30: 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 6d 61 me $fileName $ma
bc40: 6e 61 67 65 64 4f 6e 6c 79 20 24 70 6c 61 74 66 nagedOnly $platf
bc50: 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 orm].... if
bc60: 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 {![file exists
bc70: 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 5d $sourceFileName]
bc80: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
bc90: 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 if {$verbose}
bca0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
bcb0: 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
bcc0: 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
bcd0: 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
bce0: 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 "---- skipp
bcf0: 65 64 20 63 6f 70 79 69 6e 67 20 62 75 69 6c 64 ed copying build
bd00: 20 66 69 6c 65 20 5c 22 22 20 24 73 6f 75 72 63 file \"" $sourc
bd10: 65 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 eFileName \..
bd20: 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 "\",
bd30: 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 it does not exis
bd40: 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d t\n"].. }
bd50: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 .... retu
bd60: 72 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 rn.. }....
bd70: 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
bd80: 20 6c 65 6e 67 74 68 20 24 6e 65 77 46 69 6c 65 length $newFile
bd90: 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 Name] > 0} then
bda0: 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 {.. set t
bdb0: 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 argetFileName [g
bdc0: 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 etBinaryFileName
bdd0: 20 24 6e 65 77 46 69 6c 65 4e 61 6d 65 20 24 70 $newFileName $p
bde0: 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 20 20 20 20 latform]..
bdf0: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
be00: 20 20 73 65 74 20 74 61 72 67 65 74 46 69 6c 65 set targetFile
be10: 4e 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 46 Name [getBinaryF
be20: 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d ileName $fileNam
be30: 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 e $platform]..
be40: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 }.... s
be50: 65 74 20 74 61 72 67 65 74 44 69 72 65 63 74 6f et targetDirecto
be60: 72 79 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 ry [file dirname
be70: 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 $targetFileName
be80: 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b ].... if {[
be90: 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
bea0: 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 if {![file exis
beb0: 74 73 20 24 74 61 72 67 65 74 44 69 72 65 63 74 ts $targetDirect
bec0: 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ory]} then {..
bed0: 20 20 20 20 20 20 20 20 66 69 6c 65 20 6d 6b 64 file mkd
bee0: 69 72 20 24 74 61 72 67 65 74 44 69 72 65 63 74 ir $targetDirect
bef0: 6f 72 79 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a ory.. }..
bf00: 0d 0a 20 20 20 20 20 20 20 20 66 69 6c 65 20 63 .. file c
bf10: 6f 70 79 20 2d 66 6f 72 63 65 20 24 73 6f 75 72 opy -force $sour
bf20: 63 65 46 69 6c 65 4e 61 6d 65 20 24 74 61 72 67 ceFileName $targ
bf30: 65 74 46 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 etFileName..
bf40: 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 }] == 0} then
bf50: 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
bf60: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
bf70: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
bf80: 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
bf90: 2d 20 63 6f 70 69 65 64 20 62 75 69 6c 64 20 66 - copied build f
bfa0: 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 73 6f ile from \"" $so
bfb0: 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 22 5c 22 urceFileName "\"
bfc0: 20 74 6f 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 to \"" \..
bfd0: 20 20 20 20 20 20 20 24 74 61 72 67 65 74 46 69 $targetFi
bfe0: 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 leName \"\n]..
bff0: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
c000: 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
c010: 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
c020: 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
c030: 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 61 69 "---- fai
c040: 6c 65 64 20 74 6f 20 63 6f 70 79 20 62 75 69 6c led to copy buil
c050: 64 20 66 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 d file from \""
c060: 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 $sourceFileName
c070: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
c080: 5c 22 20 74 6f 20 5c 22 22 20 24 74 61 72 67 65 \" to \"" $targe
c090: 74 46 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d tFileName \"\n].
c0a0: 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d . }.. }.
c0b0: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 79 .... proc try
c0c0: 44 65 6c 65 74 65 42 69 6e 61 72 79 46 69 6c 65 DeleteBinaryFile
c0d0: 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 { fileName {pla
c0e0: 74 66 6f 72 6d 20 22 22 7d 20 7b 76 65 72 62 6f tform ""} {verbo
c0f0: 73 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 se true} } {..
c100: 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 set fileName
c110: 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e [getBinaryFileN
c120: 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 ame $fileName $p
c130: 6c 61 74 66 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 latform]....
c140: 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 if {![file exi
c150: 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 sts $fileName]}
c160: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
c170: 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 if {$verbose} th
c180: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
c190: 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
c1a0: 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
c1b0: 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
c1c0: 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 "---- skipped
c1d0: 20 64 65 6c 65 74 69 6e 67 20 62 69 6e 61 72 79 deleting binary
c1e0: 20 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e file \"" $fileN
c1f0: 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ame \..
c200: 20 20 20 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 "\", it doe
c210: 73 20 6e 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d s not exist\n"].
c220: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
c230: 20 20 20 20 20 20 72 65 74 75 72 6e 0d 0a 20 20 return..
c240: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 }.... i
c250: 66 20 7b 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 f {[catch {file
c260: 64 65 6c 65 74 65 20 24 66 69 6c 65 4e 61 6d 65 delete $fileName
c270: 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d }] == 0} then {.
c280: 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
c290: 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
c2a0: 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
c2b0: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
c2c0: 64 65 6c 65 74 65 64 20 62 69 6e 61 72 79 20 66 deleted 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: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
c300: 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
c310: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
c320: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
c330: 20 20 22 2d 2d 2d 2d 20 66 61 69 6c 65 64 20 74 "---- failed t
c340: 6f 20 64 65 6c 65 74 65 20 62 69 6e 61 72 79 20 o delete binary
c350: 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 file \"" $fileNa
c360: 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 me \"\n]..
c370: 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
c380: 20 70 72 6f 63 20 74 72 79 44 65 6c 65 74 65 42 proc tryDeleteB
c390: 75 69 6c 64 46 69 6c 65 20 7b 0d 0a 20 20 20 20 uildFile {..
c3a0: 20 20 20 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 fileName
c3b0: 20 6d 61 6e 61 67 65 64 4f 6e 6c 79 20 7b 70 6c managedOnly {pl
c3c0: 61 74 66 6f 72 6d 20 22 22 7d 20 7b 76 65 72 62 atform ""} {verb
c3d0: 6f 73 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 ose true} } {..
c3e0: 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d set fileNam
c3f0: 65 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e e [getBuildFileN
c400: 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 6d ame $fileName $m
c410: 61 6e 61 67 65 64 4f 6e 6c 79 20 24 70 6c 61 74 anagedOnly $plat
c420: 66 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 form].... i
c430: 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 f {![file exists
c440: 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 $fileName]} the
c450: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
c460: 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 {$verbose} then
c470: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 {.. tpu
c480: 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
c490: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
c4a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
c4b0: 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 64 65 "---- skipped de
c4c0: 6c 65 74 69 6e 67 20 62 75 69 6c 64 20 66 69 6c leting build fil
c4d0: 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 e \"" $fileName
c4e0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
c4f0: 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f "\", it does no
c500: 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 t exist\n"]..
c510: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
c520: 20 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 20 return..
c530: 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b }.... if {[
c540: 63 61 74 63 68 20 7b 66 69 6c 65 20 64 65 6c 65 catch {file dele
c550: 74 65 20 24 66 69 6c 65 4e 61 6d 65 7d 5d 20 3d te $fileName}] =
c560: 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
c570: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
c580: 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
c590: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
c5a0: 20 20 20 20 20 20 22 2d 2d 2d 2d 20 64 65 6c 65 "---- dele
c5b0: 74 65 64 20 62 75 69 6c 64 20 66 69 6c 65 20 5c ted build file \
c5c0: 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 22 5c "" $fileName \"\
c5d0: 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 n].. } else
c5e0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 {.. tput
c5f0: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
c600: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
c610: 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d . "--
c620: 2d 2d 20 66 61 69 6c 65 64 20 74 6f 20 64 65 6c -- failed to del
c630: 65 74 65 20 62 75 69 6c 64 20 66 69 6c 65 20 5c ete build file \
c640: 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 22 5c "" $fileName \"\
c650: 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 n].. }..
c660: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
c670: 74 72 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 20 tryCopyAssembly
c680: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 66 {.. f
c690: 69 6c 65 4e 61 6d 65 20 6d 61 6e 61 67 65 64 4f ileName managedO
c6a0: 6e 6c 79 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 nly {platform ""
c6b0: 7d 20 7b 70 64 62 20 74 72 75 65 7d 20 7b 76 65 } {pdb true} {ve
c6c0: 72 62 6f 73 65 20 74 72 75 65 7d 20 7d 20 7b 0d rbose true} } {.
c6d0: 0a 20 20 20 20 20 20 74 72 79 43 6f 70 79 42 75 . tryCopyBu
c6e0: 69 6c 64 46 69 6c 65 20 24 66 69 6c 65 4e 61 6d ildFile $fileNam
c6f0: 65 20 24 6d 61 6e 61 67 65 64 4f 6e 6c 79 20 24 e $managedOnly $
c700: 70 6c 61 74 66 6f 72 6d 20 22 22 20 24 76 65 72 platform "" $ver
c710: 62 6f 73 65 0d 0a 0d 0a 20 20 20 20 20 20 69 66 bose.... if
c720: 20 7b 24 70 64 62 7d 20 74 68 65 6e 20 7b 0d 0a {$pdb} then {..
c730: 20 20 20 20 20 20 20 20 74 72 79 43 6f 70 79 42 tryCopyB
c740: 75 69 6c 64 46 69 6c 65 20 5b 61 70 70 65 6e 64 uildFile [append
c750: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
c760: 20 20 20 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 [file rootna
c770: 6d 65 20 24 66 69 6c 65 4e 61 6d 65 5d 20 2e 70 me $fileName] .p
c780: 64 62 5d 20 24 6d 61 6e 61 67 65 64 4f 6e 6c 79 db] $managedOnly
c790: 20 24 70 6c 61 74 66 6f 72 6d 20 22 22 20 24 76 $platform "" $v
c7a0: 65 72 62 6f 73 65 0d 0a 20 20 20 20 20 20 7d 0d erbose.. }.
c7b0: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
c7c0: 72 6f 63 20 74 72 79 44 65 6c 65 74 65 41 73 73 roc tryDeleteAss
c7d0: 65 6d 62 6c 79 20 7b 0d 0a 20 20 20 20 20 20 20 embly {..
c7e0: 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 7b 70 fileName {p
c7f0: 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7b 70 64 62 latform ""} {pdb
c800: 20 74 72 75 65 7d 20 7b 76 65 72 62 6f 73 65 20 true} {verbose
c810: 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 true} } {..
c820: 20 74 72 79 44 65 6c 65 74 65 42 69 6e 61 72 79 tryDeleteBinary
c830: 46 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 File $fileName $
c840: 70 6c 61 74 66 6f 72 6d 20 24 76 65 72 62 6f 73 platform $verbos
c850: 65 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 e.... if {$
c860: 70 64 62 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 pdb} then {..
c870: 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 42 69 tryDeleteBi
c880: 6e 61 72 79 46 69 6c 65 20 5b 61 70 70 65 6e 64 naryFile [append
c890: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
c8a0: 20 20 20 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 [file rootna
c8b0: 6d 65 20 24 66 69 6c 65 4e 61 6d 65 5d 20 2e 70 me $fileName] .p
c8c0: 64 62 5d 20 24 70 6c 61 74 66 6f 72 6d 20 24 76 db] $platform $v
c8d0: 65 72 62 6f 73 65 0d 0a 20 20 20 20 20 20 7d 0d erbose.. }.
c8e0: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
c8f0: 72 6f 63 20 74 72 79 4c 6f 61 64 41 73 73 65 6d roc tryLoadAssem
c900: 62 6c 79 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7b bly { fileName {
c910: 70 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7d 20 7b platform ""} } {
c920: 0d 0a 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 .. set file
c930: 4e 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 46 Name [getBinaryF
c940: 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d ileName $fileNam
c950: 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 0d 0a e $platform]....
c960: 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
c970: 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 {.. set
c980: 61 73 73 65 6d 62 6c 79 20 5b 6f 62 6a 65 63 74 assembly [object
c990: 20 6c 6f 61 64 20 2d 6c 6f 61 64 74 79 70 65 20 load -loadtype
c9a0: 46 69 6c 65 20 2d 61 6c 69 61 73 20 24 66 69 6c File -alias $fil
c9b0: 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 7d 5d eName].. }]
c9c0: 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
c9d0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
c9e0: 20 20 23 20 4e 4f 54 45 3a 20 4e 6f 77 2c 20 61 # NOTE: Now, a
c9f0: 64 64 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 dd the necessary
ca00: 20 74 65 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 test constraint
ca10: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
ca20: 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 addConstra
ca30: 69 6e 74 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 int [file rootna
ca40: 6d 65 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 me [file tail $f
ca50: 69 6c 65 4e 61 6d 65 5d 5d 0d 0a 0d 0a 20 20 20 ileName]]....
ca60: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
ca70: 23 20 4e 4f 54 45 3a 20 47 72 61 62 20 74 68 65 # NOTE: Grab the
ca80: 20 69 6d 61 67 65 20 72 75 6e 74 69 6d 65 20 76 image runtime v
ca90: 65 72 73 69 6f 6e 20 66 72 6f 6d 20 74 68 65 20 ersion from the
caa0: 61 73 73 65 6d 62 6c 79 20 62 65 63 61 75 73 65 assembly because
cab0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
cac0: 20 20 73 65 76 65 72 61 6c 20 74 65 73 74 73 20 several tests
cad0: 72 65 6c 79 20 6f 6e 20 69 74 20 68 61 76 69 6e rely on it havin
cae0: 67 20 61 20 63 65 72 74 61 69 6e 20 76 61 6c 75 g a certain valu
caf0: 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 e... #..
cb00: 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 addConstr
cb10: 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
cb20: 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6c [file tail $fil
cb30: 65 4e 61 6d 65 5d 20 5f 20 5c 0d 0a 20 20 20 20 eName] _ \..
cb40: 20 20 20 20 20 20 20 20 5b 24 61 73 73 65 6d 62 [$assemb
cb50: 6c 79 20 49 6d 61 67 65 52 75 6e 74 69 6d 65 56 ly ImageRuntimeV
cb60: 65 72 73 69 6f 6e 5d 5d 0d 0a 0d 0a 20 20 20 20 ersion]]....
cb70: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
cb80: 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 74 68 NOTE: Return th
cb90: 65 20 66 75 6c 6c 20 70 61 74 68 20 6f 66 20 74 e full path of t
cba0: 68 65 20 6c 6f 61 64 65 64 20 66 69 6c 65 2e 0d he loaded file..
cbb0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
cbc0: 20 20 20 20 72 65 74 75 72 6e 20 24 66 69 6c 65 return $file
cbd0: 4e 61 6d 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d Name.. }...
cbe0: 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 22 22 . return ""
cbf0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
cc00: 70 72 6f 63 20 69 73 53 51 4c 69 74 65 52 65 61 proc isSQLiteRea
cc10: 64 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 dy {} {.. #
cc20: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
cc30: 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 6d This procedure m
cc40: 75 73 74 20 72 65 74 75 72 6e 20 6e 6f 6e 2d 7a ust return non-z
cc50: 65 72 6f 20 6f 6e 6c 79 20 69 66 20 74 68 65 20 ero only if the
cc60: 53 51 4c 69 74 65 20 6e 61 74 69 76 65 0d 0a 20 SQLite native..
cc70: 20 20 20 20 20 23 20 20 20 20 20 20 20 6c 69 62 # lib
cc80: 72 61 72 79 20 61 6e 64 20 74 68 65 20 53 79 73 rary and the Sys
cc90: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
cca0: 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 79 managed assembly
ccb0: 20 61 72 65 20 6c 6f 61 64 65 64 0d 0a 20 20 20 are loaded..
ccc0: 20 20 20 23 20 20 20 20 20 20 20 61 6e 64 20 72 # and r
ccd0: 65 61 64 79 20 66 6f 72 20 75 73 65 20 62 79 20 eady for use by
cce0: 74 68 65 20 74 65 73 74 20 73 75 69 74 65 2e 20 the test suite.
ccf0: 20 43 75 72 72 65 6e 74 6c 79 2c 20 74 68 69 73 Currently, this
cd00: 20 70 72 6f 63 65 64 75 72 65 0d 0a 20 20 20 20 procedure..
cd10: 20 20 23 20 20 20 20 20 20 20 73 68 6f 75 6c 64 # should
cd20: 20 62 65 20 63 61 6c 6c 65 64 20 6f 6e 6c 79 20 be called only
cd30: 61 66 74 65 72 20 74 68 65 20 5b 74 72 79 4c 6f after the [tryLo
cd40: 61 64 41 73 73 65 6d 62 6c 79 5d 20 70 72 6f 63 adAssembly] proc
cd50: 65 64 75 72 65 20 68 61 73 0d 0a 20 20 20 20 20 edure has..
cd60: 20 23 20 20 20 20 20 20 20 62 65 65 6e 20 63 61 # been ca
cd70: 6c 6c 65 64 20 74 6f 20 70 72 6f 62 65 20 66 6f lled to probe fo
cd80: 72 20 74 68 65 20 53 79 73 74 65 6d 2e 44 61 74 r the System.Dat
cd90: 61 2e 53 51 4c 69 74 65 20 6d 61 6e 61 67 65 64 a.SQLite managed
cda0: 20 61 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 assembly..
cdb0: 20 23 20 20 20 20 20 20 20 61 6e 64 20 74 68 65 # and the
cdc0: 20 5b 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 [checkForSQLite
cdd0: 5d 20 70 72 6f 63 65 64 75 72 65 20 68 61 73 20 ] procedure has
cde0: 62 65 65 6e 20 63 61 6c 6c 65 64 20 74 6f 20 70 been called to p
cdf0: 72 6f 62 65 20 66 6f 72 0d 0a 20 20 20 20 20 20 robe for..
ce00: 23 20 20 20 20 20 20 20 74 68 65 20 53 51 4c 69 # the SQLi
ce10: 74 65 20 6e 61 74 69 76 65 20 6c 69 62 72 61 72 te native librar
ce20: 79 3b 20 6f 74 68 65 72 77 69 73 65 2c 20 74 68 y; otherwise, th
ce30: 69 73 20 70 72 6f 63 65 64 75 72 65 20 77 69 6c is procedure wil
ce40: 6c 20 73 69 6d 70 6c 79 0d 0a 20 20 20 20 20 20 l simply..
ce50: 23 20 20 20 20 20 20 20 61 6c 77 61 79 73 20 72 # always r
ce60: 65 74 75 72 6e 20 7a 65 72 6f 2e 0d 0a 20 20 20 eturn zero...
ce70: 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 #.. retu
ce80: 72 6e 20 5b 65 78 70 72 20 7b 0d 0a 20 20 20 20 rn [expr {..
ce90: 20 20 20 20 5b 68 61 76 65 43 6f 6e 73 74 72 61 [haveConstra
cea0: 69 6e 74 20 53 79 73 74 65 6d 2e 44 61 74 61 2e int System.Data.
ceb0: 53 51 4c 69 74 65 5d 20 26 26 20 5b 68 61 76 65 SQLite] && [have
cec0: 43 6f 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 74 Constraint SQLit
ced0: 65 5d 0d 0a 20 20 20 20 20 20 7d 5d 0d 0a 20 20 e].. }]..
cee0: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
cef0: 20 6d 61 74 63 68 50 6c 61 74 66 6f 72 6d 20 7b matchPlatform {
cf00: 20 70 6c 61 74 66 6f 72 6d 20 7d 20 7b 0d 0a 20 platform } {..
cf10: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
cf20: 4e 4f 54 45 3a 20 41 6e 20 65 6d 70 74 79 20 73 NOTE: An empty s
cf30: 74 72 69 6e 67 20 66 6f 72 20 74 68 65 20 70 6c tring for the pl
cf40: 61 74 66 6f 72 6d 20 6d 65 61 6e 73 20 74 68 61 atform means tha
cf50: 74 20 74 68 65 20 62 75 69 6c 64 20 69 73 20 6e t the build is n
cf60: 6f 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ot.. #
cf70: 20 20 5b 70 72 69 6d 61 72 69 6c 79 5d 20 61 20 [primarily] a
cf80: 6e 61 74 69 76 65 20 62 75 69 6c 64 3b 20 74 68 native build; th
cf90: 65 72 65 66 6f 72 65 2c 20 69 74 20 61 6c 77 61 erefore, it alwa
cfa0: 79 73 20 6d 61 74 63 68 65 73 2e 0d 0a 20 20 20 ys matches...
cfb0: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
cfc0: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
cfd0: 70 6c 61 74 66 6f 72 6d 5d 20 3d 3d 20 30 7d 20 platform] == 0}
cfe0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
cff0: 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 return true..
d000: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
d010: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 . # NOTE: I
d020: 66 20 74 68 65 20 6d 61 63 68 69 6e 65 20 6e 61 f the machine na
d030: 6d 65 20 69 73 20 75 6e 61 76 61 69 6c 61 62 6c me is unavailabl
d040: 65 2c 20 74 68 65 72 65 20 69 73 20 6e 6f 74 68 e, there is noth
d050: 69 67 6e 20 65 6c 73 65 20 77 65 0d 0a 20 20 20 ign else we..
d060: 20 20 20 23 20 20 20 20 20 20 20 63 61 6e 20 64 # can d
d070: 6f 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 o... #..
d080: 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
d090: 69 73 74 73 20 3a 3a 74 63 6c 5f 70 6c 61 74 66 ists ::tcl_platf
d0a0: 6f 72 6d 28 6d 61 63 68 69 6e 65 29 5d 7d 20 74 orm(machine)]} t
d0b0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 hen {.. r
d0c0: 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 eturn false..
d0d0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
d0e0: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 . # NOTE: D
d0f0: 6f 65 73 20 74 68 65 20 73 70 65 63 69 66 69 65 oes the specifie
d100: 64 20 70 6c 61 74 66 6f 72 6d 20 6d 61 74 63 68 d platform match
d110: 20 75 70 20 74 6f 20 74 68 65 20 63 75 72 72 65 up to the curre
d120: 6e 74 20 70 72 6f 63 65 73 73 3f 0d 0a 20 20 20 nt process?..
d130: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
d140: 24 70 6c 61 74 66 6f 72 6d 20 65 71 20 5b 6d 61 $platform eq [ma
d150: 63 68 69 6e 65 54 6f 50 6c 61 74 66 6f 72 6d 20 chineToPlatform
d160: 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 $::tcl_platform(
d170: 6d 61 63 68 69 6e 65 29 5d 7d 20 74 68 65 6e 20 machine)]} then
d180: 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 {.. retur
d190: 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d n true.. }.
d1a0: 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
d1b0: 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 73 70 # NOTE: The sp
d1c0: 65 63 69 66 69 65 64 20 70 6c 61 74 66 6f 72 6d ecified platform
d1d0: 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 63 68 20 does not match
d1e0: 75 70 20 77 69 74 68 20 74 68 65 20 70 6c 61 74 up with the plat
d1f0: 66 6f 72 6d 0d 0a 20 20 20 20 20 20 23 20 20 20 form.. #
d200: 20 20 20 20 66 6f 72 20 74 68 65 20 63 75 72 72 for the curr
d210: 65 6e 74 20 70 72 6f 63 65 73 73 2e 0d 0a 20 20 ent process...
d220: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 #.. ret
d230: 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 7d urn false.. }
d240: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 68 61 ..... proc ha
d250: 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f veSQLiteObjectCo
d260: 6d 6d 61 6e 64 20 7b 7d 20 7b 0d 0a 20 20 20 20 mmand {} {..
d270: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
d280: 45 3a 20 49 73 20 74 68 65 20 5b 6f 62 6a 65 63 E: Is the [objec
d290: 74 5d 20 63 6f 6d 6d 61 6e 64 20 63 75 72 72 65 t] command curre
d2a0: 6e 74 6c 79 20 61 76 61 69 6c 61 62 6c 65 3f 0d ntly available?.
d2b0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
d2c0: 72 65 74 75 72 6e 20 5b 65 78 70 72 20 7b 5b 6c return [expr {[l
d2d0: 6c 65 6e 67 74 68 20 5b 69 6e 66 6f 20 63 6f 6d length [info com
d2e0: 6d 61 6e 64 73 20 6f 62 6a 65 63 74 5d 5d 20 3e mands object]] >
d2f0: 20 30 7d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 0}].. }.....
d300: 20 20 20 20 70 72 6f 63 20 63 68 65 63 6b 46 6f proc checkFo
d310: 72 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d rSQLiteObjectCom
d320: 6d 61 6e 64 20 7b 20 63 68 61 6e 6e 65 6c 20 7d mand { channel }
d330: 20 7b 0d 0a 20 20 20 20 20 20 74 70 75 74 73 20 {.. tputs
d340: 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 $channel "---- c
d350: 68 65 63 6b 69 6e 67 20 66 6f 72 20 5c 22 6f 62 hecking for \"ob
d360: 6a 65 63 74 5c 22 20 63 6f 6d 6d 61 6e 64 20 75 ject\" command u
d370: 73 61 67 65 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 sage... "....
d380: 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
d390: 69 73 74 73 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 ists ::no(sqlite
d3a0: 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 29 5d 20 ObjectCommand)]
d3b0: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
d3c0: 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 [haveSQLiteObjec
d3d0: 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 tCommand]} then
d3e0: 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
d3f0: 20 24 63 68 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d $channel yes\n.
d400: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
d410: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
d420: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 6e 6c 65 # NOTE: Unle
d430: 73 73 20 77 65 20 61 72 65 20 66 6f 72 62 69 64 ss we are forbid
d440: 64 65 6e 20 66 72 6f 6d 20 64 6f 69 6e 67 20 73 den from doing s
d450: 6f 2c 20 61 64 64 20 73 6f 6d 65 20 63 6f 6e 73 o, add some cons
d460: 74 72 61 69 6e 74 73 0d 0a 20 20 20 20 20 20 20 traints..
d470: 20 23 20 20 20 20 20 20 20 74 68 61 74 20 77 69 # that wi
d480: 6c 6c 20 61 6c 6c 6f 77 20 6d 6f 73 74 20 6f 66 ll allow most of
d490: 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 20 the test suite
d4a0: 74 6f 20 72 75 6e 20 28 69 2e 65 2e 20 74 68 6f to run (i.e. tho
d4b0: 73 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 se.. #
d4c0: 20 20 20 20 74 65 73 74 73 20 74 68 61 74 20 64 tests that d
d4d0: 6f 20 6e 6f 74 20 64 69 72 65 63 74 6c 79 20 72 o not directly r
d4e0: 65 6c 79 20 75 70 6f 6e 20 74 68 65 20 5b 6f 62 ely upon the [ob
d4f0: 6a 65 63 74 5d 20 63 6f 6d 6d 61 6e 64 29 2e 0d ject] command)..
d500: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
d510: 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
d520: 78 69 73 74 73 20 3a 3a 6e 6f 28 73 68 69 6d 53 xists ::no(shimS
d530: 51 4c 69 74 65 41 73 73 65 6d 62 6c 79 43 6f 6e QLiteAssemblyCon
d540: 73 74 72 61 69 6e 74 73 29 5d 7d 20 74 68 65 6e straints)]} then
d550: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 61 64 {.. ad
d560: 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 dConstraint SQLi
d570: 74 65 0d 0a 20 20 20 20 20 20 20 20 20 20 61 64 te.. ad
d580: 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 dConstraint SQLi
d590: 74 65 49 6e 74 65 72 6f 70 0d 0a 20 20 20 20 20 teInterop..
d5a0: 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 addConstrai
d5b0: 6e 74 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 nt System.Data.S
d5c0: 51 4c 69 74 65 0d 0a 20 20 20 20 20 20 20 20 20 QLite..
d5d0: 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 addConstraint S
d5e0: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
d5f0: 65 2e 45 6e 63 72 79 70 74 69 6f 6e 0d 0a 20 20 e.Encryption..
d600: 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 addConst
d610: 72 61 69 6e 74 20 53 79 73 74 65 6d 2e 44 61 74 raint System.Dat
d620: 61 2e 53 51 4c 69 74 65 2e 4c 69 6e 71 0d 0a 0d a.SQLite.Linq...
d630: 0a 20 20 20 20 20 20 20 20 20 20 61 64 64 43 6f . addCo
d640: 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
d650: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
d660: 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 System.Dat
d670: 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5f 76 20 5b a.SQLite.dll_v [
d680: 67 65 74 42 75 69 6c 64 43 6c 72 56 65 72 73 69 getBuildClrVersi
d690: 6f 6e 5d 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d on]].. }.
d6a0: 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 ... if {!
d6b0: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
d6c0: 6f 28 73 68 69 6d 53 51 4c 69 74 65 44 65 66 69 o(shimSQLiteDefi
d6d0: 6e 65 43 6f 6e 73 74 61 6e 74 43 6f 6e 73 74 72 neConstantConstr
d6e0: 61 69 6e 74 73 29 5d 7d 20 74 68 65 6e 20 7b 0d aints)]} then {.
d6f0: 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 . forea
d700: 63 68 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e ch defineConstan
d710: 74 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 t [list \..
d720: 20 20 20 20 20 20 20 20 20 49 4e 54 45 52 4f 50 INTEROP
d730: 5f 45 58 54 45 4e 53 49 4f 4e 5f 46 55 4e 43 54 _EXTENSION_FUNCT
d740: 49 4f 4e 53 20 49 4e 54 45 52 4f 50 5f 46 54 53 IONS INTEROP_FTS
d750: 35 5f 45 58 54 45 4e 53 49 4f 4e 20 5c 0d 0a 20 5_EXTENSION \..
d760: 20 20 20 20 20 20 20 20 20 20 20 20 20 49 4e 54 INT
d770: 45 52 4f 50 5f 4a 53 4f 4e 31 5f 45 58 54 45 4e EROP_JSON1_EXTEN
d780: 53 49 4f 4e 20 49 4e 54 45 52 4f 50 5f 50 45 52 SION INTEROP_PER
d790: 43 45 4e 54 49 4c 45 5f 45 58 54 45 4e 53 49 4f CENTILE_EXTENSIO
d7a0: 4e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 N \..
d7b0: 20 20 20 49 4e 54 45 52 4f 50 5f 52 45 47 45 58 INTEROP_REGEX
d7c0: 50 5f 45 58 54 45 4e 53 49 4f 4e 20 49 4e 54 45 P_EXTENSION INTE
d7d0: 52 4f 50 5f 54 45 53 54 5f 45 58 54 45 4e 53 49 ROP_TEST_EXTENSI
d7e0: 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ON \..
d7f0: 20 20 20 20 49 4e 54 45 52 4f 50 5f 53 45 53 53 INTEROP_SESS
d800: 49 4f 4e 5f 45 58 54 45 4e 53 49 4f 4e 20 49 4e ION_EXTENSION IN
d810: 54 45 52 4f 50 5f 53 48 41 31 5f 45 58 54 45 4e TEROP_SHA1_EXTEN
d820: 53 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 20 20 SION \..
d830: 20 20 20 20 20 20 49 4e 54 45 52 4f 50 5f 54 4f INTEROP_TO
d840: 54 59 50 45 5f 45 58 54 45 4e 53 49 4f 4e 20 49 TYPE_EXTENSION I
d850: 4e 54 45 52 4f 50 5f 56 49 52 54 55 41 4c 5f 54 NTEROP_VIRTUAL_T
d860: 41 42 4c 45 20 5c 0d 0a 20 20 20 20 20 20 20 20 ABLE \..
d870: 20 20 20 20 20 20 55 53 45 5f 49 4e 54 45 52 4f USE_INTERO
d880: 50 5f 44 4c 4c 5d 20 7b 0d 0a 20 20 20 20 20 20 P_DLL] {..
d890: 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 addConstra
d8a0: 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
d8b0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
d8c0: 20 20 20 5b 67 65 74 53 51 4c 69 74 65 44 65 66 [getSQLiteDef
d8d0: 69 6e 65 43 6f 6e 73 74 61 6e 74 50 72 65 66 69 ineConstantPrefi
d8e0: 78 5d 20 24 64 65 66 69 6e 65 43 6f 6e 73 74 61 x] $defineConsta
d8f0: 6e 74 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d nt].. }
d900: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
d910: 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
d920: 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 73 68 o exists ::no(sh
d930: 69 6d 53 51 4c 69 74 65 56 69 73 75 61 6c 53 74 imSQLiteVisualSt
d940: 75 64 69 6f 43 6f 6e 73 74 72 61 69 6e 74 73 29 udioConstraints)
d950: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
d960: 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 addConstrai
d970: 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 76 nt [appendArgs v
d980: 69 73 75 61 6c 53 74 75 64 69 6f 20 5b 67 65 74 isualStudio [get
d990: 42 75 69 6c 64 59 65 61 72 5d 5d 0d 0a 20 20 20 BuildYear]]..
d9a0: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
d9b0: 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
d9c0: 20 6e 6f 5c 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a no\n.. }..
d9d0: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
d9e0: 6f 63 20 63 68 61 6e 67 65 4e 61 74 69 76 65 52 oc changeNativeR
d9f0: 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 7b 20 6e untimeOption { n
da00: 61 74 69 76 65 20 7d 20 7b 0d 0a 20 20 20 20 20 ative } {..
da10: 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 5b 69 if {[llength [i
da20: 6e 66 6f 20 63 6f 6d 6d 61 6e 64 73 20 64 65 62 nfo commands deb
da30: 75 67 5d 5d 20 3e 20 30 20 26 26 20 5c 0d 0a 20 ug]] > 0 && \..
da40: 20 20 20 20 20 20 20 20 20 5b 6c 6c 65 6e 67 74 [llengt
da50: 68 20 5b 69 6e 66 6f 20 73 75 62 63 6f 6d 6d 61 h [info subcomma
da60: 6e 64 73 20 64 65 62 75 67 20 72 75 6e 74 69 6d nds debug runtim
da70: 65 6f 70 74 69 6f 6e 5d 5d 20 3e 20 30 20 26 26 eoption]] > 0 &&
da80: 20 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 [catch {..
da90: 20 20 20 64 65 62 75 67 20 72 75 6e 74 69 6d 65 debug runtime
daa0: 6f 70 74 69 6f 6e 20 5b 65 78 70 72 20 7b 24 6e option [expr {$n
dab0: 61 74 69 76 65 20 3f 20 22 61 64 64 22 20 3a 20 ative ? "add" :
dac0: 22 72 65 6d 6f 76 65 22 7d 5d 20 6e 61 74 69 76 "remove"}] nativ
dad0: 65 0d 0a 20 20 20 20 20 20 7d 5d 20 3d 3d 20 30 e.. }] == 0
dae0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
daf0: 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 return true..
db00: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
db10: 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f if {[haveSQLiteO
db20: 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 20 26 26 bjectCommand] &&
db30: 20 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 [catch {..
db40: 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
db50: 20 49 6e 74 65 72 70 72 65 74 65 72 2e 47 65 74 Interpreter.Get
db60: 41 63 74 69 76 65 20 5b 65 78 70 72 20 7b 24 6e Active [expr {$n
db70: 61 74 69 76 65 20 3f 20 5c 0d 0a 20 20 20 20 20 ative ? \..
db80: 20 20 20 20 20 20 20 22 41 64 64 52 75 6e 74 69 "AddRunti
db90: 6d 65 4f 70 74 69 6f 6e 22 20 3a 20 22 52 65 6d meOption" : "Rem
dba0: 6f 76 65 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e oveRuntimeOption
dbb0: 22 7d 5d 20 6e 61 74 69 76 65 0d 0a 20 20 20 20 "}] native..
dbc0: 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 }] == 0} then
dbd0: 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 {.. retur
dbe0: 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d n true.. }.
dbf0: 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 ... return
dc00: 66 61 6c 73 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d false.. }....
dc10: 0a 20 20 20 20 70 72 6f 63 20 63 68 65 63 6b 46 . proc checkF
dc20: 6f 72 53 51 4c 69 74 65 42 75 69 6c 64 73 20 7b orSQLiteBuilds {
dc30: 20 63 68 61 6e 6e 65 6c 20 7b 73 65 6c 65 63 74 channel {select
dc40: 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 false} } {..
dc50: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
dc60: 54 45 3a 20 43 68 65 63 6b 20 66 6f 72 20 65 76 TE: Check for ev
dc70: 65 72 79 20 70 6f 73 73 69 62 6c 65 20 76 61 6c ery possible val
dc80: 69 64 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f id combination o
dc90: 66 20 76 61 6c 75 65 73 20 75 73 65 64 20 77 68 f values used wh
dca0: 65 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 en.. #
dcb0: 20 20 6c 6f 63 61 74 69 6e 67 20 6f 75 74 20 74 locating out t
dcc0: 68 65 20 62 75 69 6c 64 20 6f 75 74 70 75 74 20 he build output
dcd0: 64 69 72 65 63 74 6f 72 79 2c 20 73 68 6f 77 69 directory, showi
dce0: 6e 67 20 65 61 63 68 20 61 76 61 69 6c 61 62 6c ng each availabl
dcf0: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
dd00: 20 62 75 69 6c 64 20 76 61 72 69 61 74 69 6f 6e build variation
dd10: 20 61 6c 6f 6e 67 20 74 68 65 20 77 61 79 2e 0d along the way..
dd20: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
dd30: 66 6f 72 65 61 63 68 20 6e 61 74 69 76 65 20 5b foreach native [
dd40: 6c 69 73 74 20 66 61 6c 73 65 20 74 72 75 65 5d list false true]
dd50: 20 7b 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 {.. fore
dd60: 61 63 68 20 79 65 61 72 20 5b 67 65 74 42 75 69 ach year [getBui
dd70: 6c 64 59 65 61 72 73 5d 20 7b 0d 0a 20 20 20 20 ldYears] {..
dd80: 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 63 6f foreach co
dd90: 6e 66 69 67 75 72 61 74 69 6f 6e 20 5b 67 65 74 nfiguration [get
dda0: 42 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 74 69 BuildConfigurati
ddb0: 6f 6e 73 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 ons] {..
ddc0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
ddd0: 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 67 75 72 # NOTE: Figur
dde0: 65 20 6f 75 74 20 74 68 65 20 65 66 66 65 63 74 e out the effect
ddf0: 69 76 65 20 62 75 69 6c 64 20 70 6c 61 74 66 6f ive build platfo
de00: 72 6d 2e 20 20 54 68 69 73 20 69 73 0d 0a 20 20 rm. This is..
de10: 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
de20: 20 20 62 61 73 65 64 20 6f 6e 20 77 68 65 74 68 based on wheth
de30: 65 72 20 6f 72 20 6e 6f 74 20 61 20 5b 70 72 69 er or not a [pri
de40: 6d 61 72 69 6c 79 5d 20 6e 61 74 69 76 65 20 62 marily] native b
de50: 75 69 6c 64 0d 0a 20 20 20 20 20 20 20 20 20 20 uild..
de60: 20 20 23 20 20 20 20 20 20 20 69 73 20 62 65 69 # is bei
de70: 6e 67 20 75 73 65 64 2e 20 20 46 6f 72 20 5b 70 ng used. For [p
de80: 72 69 6d 61 72 69 6c 79 5d 20 6e 6f 6e 2d 6e 61 rimarily] non-na
de90: 74 69 76 65 20 62 75 69 6c 64 73 2c 0d 0a 20 20 tive builds,..
dea0: 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
deb0: 20 20 74 68 69 73 20 77 69 6c 6c 20 62 65 20 61 this will be a
dec0: 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2e 0d n empty string..
ded0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
dee0: 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 set
def0: 70 6c 61 74 66 6f 72 6d 20 5b 67 65 74 42 75 69 platform [getBui
df00: 6c 64 50 6c 61 74 66 6f 72 6d 20 24 6e 61 74 69 ldPlatform $nati
df10: 76 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 ve]....
df20: 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
df30: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
df40: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
df50: 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 "---- checking
df60: 66 6f 72 20 53 79 73 74 65 6d 2e 44 61 74 61 2e for System.Data.
df70: 53 51 4c 69 74 65 20 62 75 69 6c 64 20 5c 22 22 SQLite build \""
df80: 20 5b 65 78 70 72 20 5c 0d 0a 20 20 20 20 20 20 [expr \..
df90: 20 20 20 20 20 20 20 20 20 20 7b 24 6e 61 74 69 {$nati
dfa0: 76 65 20 3f 20 22 6e 61 74 69 76 65 2f 22 20 3a ve ? "native/" :
dfb0: 20 22 22 7d 5d 20 5b 65 78 70 72 20 7b 5b 73 74 ""}] [expr {[st
dfc0: 72 69 6e 67 20 6c 65 6e 67 74 68 20 5c 0d 0a 20 ring length \..
dfd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 $
dfe0: 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 20 3f 20 platform] > 0 ?
dff0: 5b 61 70 70 65 6e 64 41 72 67 73 20 24 70 6c 61 [appendArgs $pla
e000: 74 66 6f 72 6d 20 2f 5d 20 3a 20 22 22 7d 5d 20 tform /] : ""}]
e010: 24 79 65 61 72 20 5c 0d 0a 20 20 20 20 20 20 20 $year \..
e020: 20 20 20 20 20 20 20 20 20 2f 20 24 63 6f 6e 66 / $conf
e030: 69 67 75 72 61 74 69 6f 6e 20 22 5c 22 2e 2e 2e iguration "\"...
e040: 20 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 "]....
e050: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
e060: 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 # NOTE: Build
e070: 74 68 65 20 66 75 6c 6c 79 20 71 75 61 6c 69 66 the fully qualif
e080: 69 65 64 20 64 69 72 65 63 74 6f 72 79 20 77 68 ied directory wh
e090: 65 72 65 20 74 68 65 20 6e 65 63 65 73 73 61 72 ere the necessar
e0a0: 79 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 y.. #
e0b0: 20 20 20 20 20 20 20 63 6f 6d 70 6f 6e 65 6e 74 component
e0c0: 73 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 61 74 s for System.Dat
e0d0: 61 2e 53 51 4c 69 74 65 20 73 68 6f 75 6c 64 20 a.SQLite should
e0e0: 62 65 20 66 6f 75 6e 64 2e 0d 0a 20 20 20 20 20 be found...
e0f0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
e100: 20 20 20 20 20 20 73 65 74 20 64 69 72 65 63 74 set direct
e110: 6f 72 79 20 5b 6a 6f 69 6e 42 75 69 6c 64 44 69 ory [joinBuildDi
e120: 72 65 63 74 6f 72 79 20 24 6e 61 74 69 76 65 20 rectory $native
e130: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
e140: 20 20 20 5b 67 65 74 42 75 69 6c 64 42 61 73 65 [getBuildBase
e150: 44 69 72 65 63 74 6f 72 79 5d 20 24 79 65 61 72 Directory] $year
e160: 20 24 70 6c 61 74 66 6f 72 6d 20 24 63 6f 6e 66 $platform $conf
e170: 69 67 75 72 61 74 69 6f 6e 5d 0d 0a 0d 0a 20 20 iguration]....
e180: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
e190: 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
e1a0: 20 44 6f 20 74 68 65 20 6e 65 63 65 73 73 61 72 Do the necessar
e1b0: 79 20 66 69 6c 65 73 20 65 78 69 73 74 3f 20 20 y files exist?
e1c0: 43 75 72 72 65 6e 74 6c 79 2c 20 6e 6f 20 6f 74 Currently, no ot
e1d0: 68 65 72 20 73 74 65 70 73 0d 0a 20 20 20 20 20 her steps..
e1e0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 # a
e1f0: 72 65 20 74 61 6b 65 6e 20 74 6f 20 76 65 72 69 re taken to veri
e200: 66 79 20 74 68 69 73 20 62 75 69 6c 64 20 69 73 fy this build is
e210: 20 61 63 74 75 61 6c 6c 79 20 76 69 61 62 6c 65 actually viable
e220: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 ... #
e230: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
e240: 20 7b 5b 69 73 42 75 69 6c 64 41 76 61 69 6c 61 {[isBuildAvaila
e250: 62 6c 65 20 24 6e 61 74 69 76 65 20 24 64 69 72 ble $native $dir
e260: 65 63 74 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d ectory]} then {.
e270: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
e280: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
e290: 23 20 4e 4f 54 45 3a 20 57 68 65 6e 20 69 6e 20 # NOTE: When in
e2a0: 22 73 65 6c 65 63 74 22 20 6d 6f 64 65 2c 20 61 "select" mode, a
e2b0: 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 73 65 6c utomatically sel
e2c0: 65 63 74 20 74 68 65 20 66 69 72 73 74 0d 0a 20 ect the first..
e2d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 #
e2e0: 20 20 20 20 20 61 76 61 69 6c 61 62 6c 65 20 62 available b
e2f0: 75 69 6c 64 20 6f 66 20 53 79 73 74 65 6d 2e 44 uild of System.D
e300: 61 74 61 2e 53 51 4c 69 74 65 20 61 6e 64 20 74 ata.SQLite and t
e310: 68 65 6e 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 hen return..
e320: 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
e330: 20 20 69 6d 6d 65 64 69 61 74 65 6c 79 2e 0d 0a immediately...
e340: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
e350: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 . i
e360: 66 20 7b 24 73 65 6c 65 63 74 20 26 26 20 5b 6d f {$select && [m
e370: 61 74 63 68 50 6c 61 74 66 6f 72 6d 20 24 70 6c atchPlatform $pl
e380: 61 74 66 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d atform]} then {.
e390: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
e3a0: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
e3b0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 4d 61 6e 75 # NOTE: Manu
e3c0: 61 6c 6c 79 20 6f 76 65 72 72 69 64 65 20 61 6c ally override al
e3d0: 6c 20 74 68 65 20 62 75 69 6c 64 20 64 69 72 65 l the build dire
e3e0: 63 74 6f 72 79 20 73 65 6c 65 63 74 69 6f 6e 0d ctory selection.
e3f0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
e400: 20 23 20 20 20 20 20 20 20 72 65 6c 61 74 65 64 # related
e410: 20 74 65 73 74 20 73 65 74 74 69 6e 67 73 20 69 test settings i
e420: 6e 20 6f 72 64 65 72 20 74 6f 20 66 6f 72 63 65 n order to force
e430: 20 74 68 69 73 20 62 75 69 6c 64 0d 0a 20 20 20 this build..
e440: 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 #
e450: 20 20 20 20 20 6f 66 20 53 79 73 74 65 6d 2e 44 of System.D
e460: 61 74 61 2e 53 51 4c 69 74 65 20 74 6f 20 62 65 ata.SQLite to be
e470: 20 75 73 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 used...
e480: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
e490: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
e4a0: 5b 63 68 61 6e 67 65 4e 61 74 69 76 65 52 75 6e [changeNativeRun
e4b0: 74 69 6d 65 4f 70 74 69 6f 6e 20 24 6e 61 74 69 timeOption $nati
e4c0: 76 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ve]} then {..
e4d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
e4e0: 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
e4f0: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
e500: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
e510: 20 20 20 22 6e 6f 2c 20 66 61 69 6c 65 64 20 74 "no, failed t
e520: 6f 20 22 20 5b 65 78 70 72 20 7b 24 6e 61 74 69 o " [expr {$nati
e530: 76 65 20 3f 20 22 61 64 64 22 20 3a 20 22 72 65 ve ? "add" : "re
e540: 6d 6f 76 65 22 7d 5d 20 5c 0d 0a 20 20 20 20 20 move"}] \..
e550: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
e560: 20 22 20 74 68 65 20 5c 22 6e 61 74 69 76 65 5c " the \"native\
e570: 22 20 72 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e " runtime option
e580: 5c 6e 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 \n"]....
e590: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
e5a0: 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 false..
e5b0: 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
e5c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 set
e5d0: 20 3a 3a 74 65 73 74 5f 79 65 61 72 20 24 79 65 ::test_year $ye
e5e0: 61 72 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ar..
e5f0: 20 20 20 20 73 65 74 20 3a 3a 74 65 73 74 5f 70 set ::test_p
e600: 6c 61 74 66 6f 72 6d 20 24 70 6c 61 74 66 6f 72 latform $platfor
e610: 6d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 m..
e620: 20 20 20 73 65 74 20 3a 3a 74 65 73 74 5f 63 6f set ::test_co
e630: 6e 66 69 67 75 72 61 74 69 6f 6e 20 24 63 6f 6e nfiguration $con
e640: 66 69 67 75 72 61 74 69 6f 6e 0d 0a 0d 0a 20 20 figuration....
e650: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
e660: 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
e670: 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
e680: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
e690: 22 79 65 73 2c 20 73 65 6c 65 63 74 65 64 20 28 "yes, selected (
e6a0: 22 20 5b 65 78 70 72 20 7b 24 6e 61 74 69 76 65 " [expr {$native
e6b0: 20 3f 20 22 6e 61 74 69 76 65 2f 22 20 3a 20 22 ? "native/" : "
e6c0: 22 7d 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 "}] \..
e6d0: 20 20 20 20 20 20 20 20 20 20 20 5b 65 78 70 72 [expr
e6e0: 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
e6f0: 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 20 $platform] > 0
e700: 3f 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d ? [appendArgs \.
e710: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
e720: 20 20 20 20 20 24 70 6c 61 74 66 6f 72 6d 20 2f $platform /
e730: 5d 20 3a 20 22 22 7d 5d 20 24 79 65 61 72 20 2f ] : ""}] $year /
e740: 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 $configuration
e750: 22 29 5c 6e 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 ")\n"]....
e760: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
e770: 20 74 72 75 65 0d 0a 20 20 20 20 20 20 20 20 20 true..
e780: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
e790: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
e7a0: 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 79 65 puts $channel ye
e7b0: 73 5c 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s\n..
e7c0: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
e7d0: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
e7e0: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
e7f0: 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 $channel no\n..
e800: 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
e810: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
e820: 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
e830: 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 . return fa
e840: 6c 73 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 lse.. }.....
e850: 20 20 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 proc checkFor
e860: 53 51 4c 69 74 65 52 65 6c 65 61 73 65 73 20 7b SQLiteReleases {
e870: 20 63 68 61 6e 6e 65 6c 20 7b 73 65 6c 65 63 74 channel {select
e880: 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 false} } {..
e890: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
e8a0: 54 45 3a 20 43 68 65 63 6b 20 66 6f 72 20 70 61 TE: Check for pa
e8b0: 73 74 20 72 65 6c 65 61 73 65 73 20 6f 66 20 53 st releases of S
e8c0: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
e8d0: 65 20 69 6e 20 74 68 65 20 64 69 72 65 63 74 6f e in the directo
e8e0: 72 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ry.. #
e8f0: 20 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e 20 74 contained in t
e900: 68 65 20 22 53 79 73 74 65 6d 2e 44 61 74 61 2e he "System.Data.
e910: 53 51 4c 69 74 65 22 20 65 6e 76 69 72 6f 6e 6d SQLite" environm
e920: 65 6e 74 20 76 61 72 69 61 62 6c 65 2c 20 69 66 ent variable, if
e930: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
e940: 70 72 65 73 65 6e 74 2e 0d 0a 20 20 20 20 20 20 present...
e950: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e #.. if {[in
e960: 66 6f 20 65 78 69 73 74 73 20 3a 3a 65 6e 76 28 fo exists ::env(
e970: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
e980: 74 65 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 te)] && \..
e990: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
e9a0: 67 74 68 20 24 3a 3a 65 6e 76 28 53 79 73 74 65 gth $::env(Syste
e9b0: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 29 5d 20 m.Data.SQLite)]
e9c0: 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
e9d0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
e9e0: 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 # NOTE: Build th
e9f0: 65 20 66 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 e fully qualifie
ea00: 64 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 d directory wher
ea10: 65 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 0d e the necessary.
ea20: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
ea30: 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 66 6f 72 20 components for
ea40: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
ea50: 74 65 20 73 68 6f 75 6c 64 20 62 65 20 66 6f 75 te should be fou
ea60: 6e 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a nd... #..
ea70: 20 20 20 20 20 20 20 20 73 65 74 20 64 69 72 65 set dire
ea80: 63 74 6f 72 79 20 5b 66 69 6c 65 20 6e 61 74 69 ctory [file nati
ea90: 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 vename [file joi
eaa0: 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n \..
eab0: 20 24 3a 3a 65 6e 76 28 53 79 73 74 65 6d 2e 44 $::env(System.D
eac0: 61 74 61 2e 53 51 4c 69 74 65 29 20 5b 67 65 74 ata.SQLite) [get
ead0: 52 65 6c 65 61 73 65 56 65 72 73 69 6f 6e 5d 5d ReleaseVersion]]
eae0: 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 75 ].... tpu
eaf0: 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
eb00: 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
eb10: 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 "---- che
eb20: 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 74 65 6d cking for System
eb30: 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 72 65 6c .Data.SQLite rel
eb40: 65 61 73 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 ease \"" \..
eb50: 20 20 20 20 20 20 20 20 24 64 69 72 65 63 74 6f $directo
eb60: 72 79 20 22 5c 22 2e 2e 2e 20 22 5d 0d 0a 0d 0a ry "\"... "]....
eb70: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 73 52 if {[isR
eb80: 65 6c 65 61 73 65 41 76 61 69 6c 61 62 6c 65 20 eleaseAvailable
eb90: 24 64 69 72 65 63 74 6f 72 79 20 70 6c 61 74 66 $directory platf
eba0: 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 orm]} then {..
ebb0: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 if {[str
ebc0: 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 ing length $plat
ebd0: 66 6f 72 6d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e form] == 0} then
ebe0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
ebf0: 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 75 6e 6b set platform unk
ec00: 6e 6f 77 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 nown..
ec10: 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 }.... i
ec20: 66 20 7b 24 73 65 6c 65 63 74 20 26 26 20 5b 6d f {$select && [m
ec30: 61 74 63 68 50 6c 61 74 66 6f 72 6d 20 24 70 6c atchPlatform $pl
ec40: 61 74 66 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d atform]} then {.
ec50: 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 . set
ec60: 20 3a 3a 62 75 69 6c 64 5f 64 69 72 65 63 74 6f ::build_directo
ec70: 72 79 20 24 64 69 72 65 63 74 6f 72 79 0d 0a 0d ry $directory...
ec80: 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
ec90: 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
eca0: 65 6e 64 41 72 67 73 20 22 79 65 73 2c 20 73 65 endArgs "yes, se
ecb0: 6c 65 63 74 65 64 20 28 22 20 24 70 6c 61 74 66 lected (" $platf
ecc0: 6f 72 6d 20 22 29 5c 6e 22 5d 0d 0a 0d 0a 20 20 orm ")\n"]....
ecd0: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
ece0: 20 74 72 75 65 0d 0a 20 20 20 20 20 20 20 20 20 true..
ecf0: 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
ed00: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
ed10: 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
ed20: 73 20 22 79 65 73 20 28 22 20 24 70 6c 61 74 66 s "yes (" $platf
ed30: 6f 72 6d 20 22 29 5c 6e 22 5d 0d 0a 20 20 20 20 orm ")\n"]..
ed40: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
ed50: 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
ed60: 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
ed70: 6e 65 6c 20 6e 6f 5c 6e 0d 0a 0d 0a 20 20 20 20 nel no\n....
ed80: 20 20 20 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 if {![file
ed90: 20 65 78 69 73 74 73 20 24 64 69 72 65 63 74 6f exists $directo
eda0: 72 79 5d 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 ry] || \..
edb0: 20 20 20 20 20 20 20 20 21 5b 66 69 6c 65 20 69 ![file i
edc0: 73 64 69 72 65 63 74 6f 72 79 20 24 64 69 72 65 sdirectory $dire
edd0: 63 74 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a ctory]} then {..
ede0: 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
edf0: 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
ee00: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
ee10: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
ee20: 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 environment vari
ee30: 61 62 6c 65 20 5c 22 53 79 73 74 65 6d 2e 44 61 able \"System.Da
ee40: 74 61 2e 53 51 4c 69 74 65 5c 22 20 69 73 20 61 ta.SQLite\" is a
ee50: 6e 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 n " \..
ee60: 20 20 20 20 20 20 20 22 69 6e 76 61 6c 69 64 20 "invalid
ee70: 64 69 72 65 63 74 6f 72 79 2c 20 73 6b 69 70 70 directory, skipp
ee80: 69 6e 67 20 63 68 65 63 6b 20 66 6f 72 20 72 65 ing check for re
ee90: 6c 65 61 73 65 73 2e 2e 2e 5c 6e 22 5d 0d 0a 0d leases...\n"]...
eea0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 . ret
eeb0: 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 urn false..
eec0: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
eed0: 20 20 20 20 66 6f 72 65 61 63 68 20 70 61 74 68 foreach path
eee0: 20 5b 6c 73 6f 72 74 20 2d 64 65 63 72 65 61 73 [lsort -decreas
eef0: 69 6e 67 20 5b 66 69 6c 65 20 6c 69 73 74 20 24 ing [file list $
ef00: 64 69 72 65 63 74 6f 72 79 20 2a 5d 5d 20 7b 0d directory *]] {.
ef10: 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
ef20: 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 70 {[file exists $p
ef30: 61 74 68 5d 20 26 26 20 5b 66 69 6c 65 20 69 73 ath] && [file is
ef40: 64 69 72 65 63 74 6f 72 79 20 24 70 61 74 68 5d directory $path]
ef50: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
ef60: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
ef70: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
ef80: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
ef90: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 "---- ch
efa0: 65 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 74 65 ecking for Syste
efb0: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 72 65 m.Data.SQLite re
efc0: 6c 65 61 73 65 20 5c 22 22 20 5c 0d 0a 20 20 20 lease \"" \..
efd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 $
efe0: 70 61 74 68 20 22 5c 22 2e 2e 2e 20 22 5d 0d 0a path "\"... "]..
eff0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
f000: 69 66 20 7b 5b 69 73 52 65 6c 65 61 73 65 41 76 if {[isReleaseAv
f010: 61 69 6c 61 62 6c 65 20 24 70 61 74 68 20 70 6c ailable $path pl
f020: 61 74 66 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d atform]} then {.
f030: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
f040: 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
f050: 67 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3d gth $platform] =
f060: 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
f070: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 s
f080: 65 74 20 70 6c 61 74 66 6f 72 6d 20 75 6e 6b 6e et platform unkn
f090: 6f 77 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 own..
f0a0: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
f0b0: 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 73 if {$s
f0c0: 65 6c 65 63 74 20 26 26 20 5b 6d 61 74 63 68 50 elect && [matchP
f0d0: 6c 61 74 66 6f 72 6d 20 24 70 6c 61 74 66 6f 72 latform $platfor
f0e0: 6d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 m]} then {..
f0f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 se
f100: 74 20 3a 3a 62 75 69 6c 64 5f 64 69 72 65 63 74 t ::build_direct
f110: 6f 72 79 20 24 70 61 74 68 0d 0a 0d 0a 20 20 20 ory $path....
f120: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
f130: 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
f140: 70 70 65 6e 64 41 72 67 73 20 22 79 65 73 2c 20 ppendArgs "yes,
f150: 73 65 6c 65 63 74 65 64 20 28 22 20 24 70 6c 61 selected (" $pla
f160: 74 66 6f 72 6d 20 22 29 5c 6e 22 5d 0d 0a 0d 0a tform ")\n"]....
f170: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
f180: 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 return true..
f190: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
f1a0: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
f1b0: 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
f1c0: 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
f1d0: 64 41 72 67 73 20 22 79 65 73 20 28 22 20 24 70 dArgs "yes (" $p
f1e0: 6c 61 74 66 6f 72 6d 20 22 29 5c 6e 22 5d 0d 0a latform ")\n"]..
f1f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
f200: 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 }..
f210: 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
f220: 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
f230: 20 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a $channel no\n..
f240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
f250: 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
f260: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
f270: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 }.. }
f280: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
f290: 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
f2a0: 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
f2b0: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
f2c0: 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 environment vari
f2d0: 61 62 6c 65 20 5c 22 53 79 73 74 65 6d 2e 44 61 able \"System.Da
f2e0: 74 61 2e 53 51 4c 69 74 65 5c 22 20 69 73 20 6e ta.SQLite\" is n
f2f0: 6f 74 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 ot " \..
f300: 20 20 20 20 22 73 65 74 2c 20 73 6b 69 70 70 69 "set, skippi
f310: 6e 67 20 63 68 65 63 6b 20 66 6f 72 20 72 65 6c ng check for rel
f320: 65 61 73 65 73 2e 2e 2e 5c 6e 22 5d 0d 0a 20 20 eases...\n"]..
f330: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 }.... r
f340: 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 eturn false..
f350: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
f360: 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 4c 69 checkForSQLiteLi
f370: 62 72 61 72 79 20 7b 20 63 68 61 6e 6e 65 6c 20 brary { channel
f380: 7d 20 7b 0d 0a 20 20 20 20 20 20 74 70 75 74 73 } {.. tputs
f390: 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 $channel "----
f3a0: 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 51 4c checking for SQL
f3b0: 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 ite core library
f3c0: 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 69 ... ".... i
f3d0: 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
f3e0: 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
f3f0: 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
f400: 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 blic \..
f410: 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e System.Data.
f420: 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 53 SQLite.SQLite3 S
f430: 51 4c 69 74 65 56 65 72 73 69 6f 6e 0d 0a 20 20 QLiteVersion..
f440: 20 20 20 20 7d 20 76 65 72 73 69 6f 6e 5d 20 3d } version] =
f450: 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
f460: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
f470: 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 # NOTE: Check if
f480: 20 74 68 65 20 72 65 74 75 72 6e 65 64 20 76 65 the returned ve
f490: 72 73 69 6f 6e 20 77 61 73 20 6e 75 6c 6c 2e 20 rsion was null.
f4a0: 20 49 66 20 73 6f 2c 20 6d 61 6b 65 20 69 74 20 If so, make it
f4b0: 65 61 73 79 0d 0a 20 20 20 20 20 20 20 20 23 20 easy.. #
f4c0: 20 20 20 20 20 20 74 6f 20 73 70 6f 74 2e 0d 0a to spot...
f4d0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
f4e0: 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c if {[string l
f4f0: 65 6e 67 74 68 20 24 76 65 72 73 69 6f 6e 5d 20 ength $version]
f500: 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
f510: 20 20 20 20 20 20 20 20 73 65 74 20 76 65 72 73 set vers
f520: 69 6f 6e 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 ion null..
f530: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 }.... #
f540: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
f550: 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 71 75 65 : Attempt to que
f560: 72 79 20 74 68 65 20 46 6f 73 73 69 6c 20 73 6f ry the Fossil so
f570: 75 72 63 65 20 69 64 65 6e 74 69 66 69 65 72 20 urce identifier
f580: 66 6f 72 20 74 68 65 20 53 51 4c 69 74 65 0d 0a for the SQLite..
f590: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
f5a0: 63 6f 72 65 20 6c 69 62 72 61 72 79 2e 0d 0a 20 core library...
f5b0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
f5c0: 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
f5d0: 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
f5e0: 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
f5f0: 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 NonPublic \..
f600: 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 Syste
f610: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 m.Data.SQLite.SQ
f620: 4c 69 74 65 33 20 53 51 4c 69 74 65 53 6f 75 72 Lite3 SQLiteSour
f630: 63 65 49 64 0d 0a 20 20 20 20 20 20 20 20 7d 20 ceId.. }
f640: 73 6f 75 72 63 65 49 64 5d 7d 20 74 68 65 6e 20 sourceId]} then
f650: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a {.. #..
f660: 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
f670: 3a 20 57 65 20 66 61 69 6c 65 64 20 74 6f 20 71 : We failed to q
f680: 75 65 72 79 20 74 68 65 20 46 6f 73 73 69 6c 20 uery the Fossil
f690: 73 6f 75 72 63 65 20 69 64 65 6e 74 69 66 69 65 source identifie
f6a0: 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d r... #.
f6b0: 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73 . set s
f6c0: 6f 75 72 63 65 49 64 20 75 6e 6b 6e 6f 77 6e 0d ourceId unknown.
f6d0: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
f6e0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
f6f0: 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 # NOTE: Check i
f700: 66 20 74 68 65 20 72 65 74 75 72 6e 65 64 20 46 f the returned F
f710: 6f 73 73 69 6c 20 73 6f 75 72 63 65 20 69 64 65 ossil source ide
f720: 6e 74 69 66 69 65 72 20 77 61 73 20 6e 75 6c 6c ntifier was null
f730: 2e 20 20 49 66 0d 0a 20 20 20 20 20 20 20 20 23 . If.. #
f740: 20 20 20 20 20 20 20 73 6f 2c 20 6d 61 6b 65 20 so, make
f750: 69 74 20 65 61 73 79 20 74 6f 20 73 70 6f 74 2e it easy to spot.
f760: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
f770: 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
f780: 20 6c 65 6e 67 74 68 20 24 73 6f 75 72 63 65 49 length $sourceI
f790: 64 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d d] == 0} then {.
f7a0: 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73 . set s
f7b0: 6f 75 72 63 65 49 64 20 6e 75 6c 6c 0d 0a 20 20 ourceId null..
f7c0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
f7d0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
f7e0: 4e 4f 54 45 3a 20 59 65 73 2c 20 74 68 65 20 53 NOTE: Yes, the S
f7f0: 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 QLite core libra
f800: 72 79 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 ry appears to be
f810: 20 61 76 61 69 6c 61 62 6c 65 2e 0d 0a 20 20 20 available...
f820: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
f830: 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 51 addConstraint SQ
f840: 4c 69 74 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 Lite....
f850: 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
f860: 61 70 70 65 6e 64 41 72 67 73 20 22 79 65 73 20 appendArgs "yes
f870: 28 22 20 24 76 65 72 73 69 6f 6e 20 22 20 22 20 (" $version " "
f880: 24 73 6f 75 72 63 65 49 64 20 22 29 5c 6e 22 5d $sourceId ")\n"]
f890: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
f8a0: 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
f8b0: 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 $channel no\n..
f8c0: 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
f8d0: 0d 0a 20 20 20 20 70 72 6f 63 20 63 68 65 63 6b .. proc check
f8e0: 46 6f 72 53 51 4c 69 74 65 49 6e 74 65 72 6f 70 ForSQLiteInterop
f8f0: 20 7b 20 63 68 61 6e 6e 65 6c 20 7d 20 7b 0d 0a { channel } {..
f900: 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
f910: 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 68 65 63 6b nnel "---- check
f920: 69 6e 67 20 66 6f 72 20 53 51 4c 69 74 65 20 69 ing for SQLite i
f930: 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 2e nterop assembly.
f940: 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 69 66 .. ".... if
f950: 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
f960: 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b object invok
f970: 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 e -flags +NonPub
f980: 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 lic \..
f990: 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 System.Data.S
f9a0: 51 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 49 6e QLite.SQLite3 In
f9b0: 74 65 72 6f 70 56 65 72 73 69 6f 6e 0d 0a 20 20 teropVersion..
f9c0: 20 20 20 20 7d 20 76 65 72 73 69 6f 6e 5d 20 3d } version] =
f9d0: 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
f9e0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
f9f0: 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 # NOTE: Check if
fa00: 20 74 68 65 20 72 65 74 75 72 6e 65 64 20 76 65 the returned ve
fa10: 72 73 69 6f 6e 20 77 61 73 20 6e 75 6c 6c 2e 20 rsion was null.
fa20: 20 49 66 20 73 6f 2c 20 6d 61 6b 65 20 69 74 20 If so, make it
fa30: 65 61 73 79 0d 0a 20 20 20 20 20 20 20 20 23 20 easy.. #
fa40: 20 20 20 20 20 20 74 6f 20 73 70 6f 74 2e 0d 0a to spot...
fa50: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
fa60: 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c if {[string l
fa70: 65 6e 67 74 68 20 24 76 65 72 73 69 6f 6e 5d 20 ength $version]
fa80: 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
fa90: 20 20 20 20 20 20 20 20 73 65 74 20 76 65 72 73 set vers
faa0: 69 6f 6e 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 ion null..
fab0: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 }.... #
fac0: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
fad0: 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 71 75 65 : Attempt to que
fae0: 72 79 20 74 68 65 20 46 6f 73 73 69 6c 20 73 6f ry the Fossil so
faf0: 75 72 63 65 20 69 64 65 6e 74 69 66 69 65 72 20 urce identifier
fb00: 66 6f 72 20 74 68 65 20 53 51 4c 69 74 65 0d 0a for the SQLite..
fb10: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
fb20: 63 6f 72 65 20 6c 69 62 72 61 72 79 2e 0d 0a 20 core library...
fb30: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
fb40: 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
fb50: 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
fb60: 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
fb70: 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 NonPublic \..
fb80: 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 Syste
fb90: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 m.Data.SQLite.SQ
fba0: 4c 69 74 65 33 20 49 6e 74 65 72 6f 70 53 6f 75 Lite3 InteropSou
fbb0: 72 63 65 49 64 0d 0a 20 20 20 20 20 20 20 20 7d rceId.. }
fbc0: 20 73 6f 75 72 63 65 49 64 5d 7d 20 74 68 65 6e sourceId]} then
fbd0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d {.. #.
fbe0: 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 . # NOT
fbf0: 45 3a 20 57 65 20 66 61 69 6c 65 64 20 74 6f 20 E: We failed to
fc00: 71 75 65 72 79 20 74 68 65 20 46 6f 73 73 69 6c query the Fossil
fc10: 20 73 6f 75 72 63 65 20 69 64 65 6e 74 69 66 69 source identifi
fc20: 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 er... #
fc30: 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
fc40: 73 6f 75 72 63 65 49 64 20 75 6e 6b 6e 6f 77 6e sourceId unknown
fc50: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
fc60: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
fc70: 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 # NOTE: Check
fc80: 69 66 20 74 68 65 20 72 65 74 75 72 6e 65 64 20 if the returned
fc90: 46 6f 73 73 69 6c 20 73 6f 75 72 63 65 20 69 64 Fossil source id
fca0: 65 6e 74 69 66 69 65 72 20 77 61 73 20 6e 75 6c entifier was nul
fcb0: 6c 2e 20 20 49 66 0d 0a 20 20 20 20 20 20 20 20 l. If..
fcc0: 23 20 20 20 20 20 20 20 73 6f 2c 20 6d 61 6b 65 # so, make
fcd0: 20 69 74 20 65 61 73 79 20 74 6f 20 73 70 6f 74 it easy to spot
fce0: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
fcf0: 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
fd00: 67 20 6c 65 6e 67 74 68 20 24 73 6f 75 72 63 65 g length $source
fd10: 49 64 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b Id] == 0} then {
fd20: 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
fd30: 73 6f 75 72 63 65 49 64 20 6e 75 6c 6c 0d 0a 20 sourceId null..
fd40: 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
fd50: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
fd60: 20 4e 4f 54 45 3a 20 42 65 66 6f 72 65 20 61 63 NOTE: Before ac
fd70: 74 75 61 6c 6c 79 20 61 64 64 69 6e 67 20 74 68 tually adding th
fd80: 65 20 74 65 73 74 20 63 6f 6e 73 74 72 61 69 6e e test constrain
fd90: 74 2c 20 6d 61 6b 65 20 73 75 72 65 20 74 68 65 t, make sure the
fda0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
fdb0: 20 20 76 65 72 73 69 6f 6e 20 69 73 20 76 61 6c version is val
fdc0: 69 64 20 28 69 2e 65 2e 20 6e 6f 74 20 6a 75 73 id (i.e. not jus
fdd0: 74 20 74 68 61 74 20 77 65 20 63 6f 75 6c 64 20 t that we could
fde0: 71 75 65 72 79 20 69 74 29 2e 0d 0a 20 20 20 20 query it)...
fdf0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 #.. i
fe00: 66 20 7b 24 76 65 72 73 69 6f 6e 20 6e 65 20 22 f {$version ne "
fe10: 6e 75 6c 6c 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 null"} then {..
fe20: 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
fe30: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 65 # NOTE: Ye
fe40: 73 2c 20 74 68 65 20 53 51 4c 69 74 65 20 69 6e s, the SQLite in
fe50: 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 61 terop assembly a
fe60: 70 70 65 61 72 73 20 74 6f 20 62 65 20 61 76 61 ppears to be ava
fe70: 69 6c 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 20 ilable...
fe80: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
fe90: 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 51 addConstraint SQ
fea0: 4c 69 74 65 49 6e 74 65 72 6f 70 0d 0a 0d 0a 20 LiteInterop....
feb0: 20 20 20 20 20 20 20 20 20 73 65 74 20 61 6e 73 set ans
fec0: 77 65 72 20 79 65 73 0d 0a 20 20 20 20 20 20 20 wer yes..
fed0: 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
fee0: 20 20 20 20 20 73 65 74 20 61 6e 73 77 65 72 20 set answer
fef0: 6e 6f 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d no.. }...
ff00: 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
ff10: 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
ff20: 72 67 73 20 24 61 6e 73 77 65 72 20 22 20 28 22 rgs $answer " ("
ff30: 20 24 76 65 72 73 69 6f 6e 20 22 20 22 20 24 73 $version " " $s
ff40: 6f 75 72 63 65 49 64 20 22 29 5c 6e 22 5d 0d 0a ourceId ")\n"]..
ff50: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
ff60: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
ff70: 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 20 20 hannel no\n..
ff80: 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
ff90: 20 20 20 20 70 72 6f 63 20 63 68 65 63 6b 46 6f proc checkFo
ffa0: 72 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e rSQLiteDefineCon
ffb0: 73 74 61 6e 74 20 7b 20 63 68 61 6e 6e 65 6c 20 stant { channel
ffc0: 6e 61 6d 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 name } {..
ffd0: 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
ffe0: 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
fff0: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 "---- ch
10000 65 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 74 65 ecking for Syste
10010 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 64 65 m.Data.SQLite de
10020 66 69 6e 65 20 63 6f 6e 73 74 61 6e 74 20 5c 22 fine constant \"
10030 22 20 24 6e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 " $name \..
10040 20 20 20 20 20 22 5c 22 2e 2e 2e 20 22 5d 0d 0a "\"... "]..
10050 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 .. if {[cat
10060 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 ch {.. ob
10070 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 ject invoke -fla
10080 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d gs +NonPublic \.
10090 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 . Sys
100a0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
100b0 53 51 4c 69 74 65 33 20 44 65 66 69 6e 65 43 6f SQLite3 DefineCo
100c0 6e 73 74 61 6e 74 73 0d 0a 20 20 20 20 20 20 7d nstants.. }
100d0 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 73 defineConstants
100e0 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
100f0 20 20 20 20 20 20 20 20 69 66 20 7b 5b 6c 73 65 if {[lse
10100 61 72 63 68 20 2d 65 78 61 63 74 20 2d 6e 6f 63 arch -exact -noc
10110 61 73 65 20 24 64 65 66 69 6e 65 43 6f 6e 73 74 ase $defineConst
10120 61 6e 74 73 20 24 6e 61 6d 65 5d 20 21 3d 20 2d ants $name] != -
10130 31 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 1} then {..
10140 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
10150 20 20 23 20 4e 4f 54 45 3a 20 59 65 73 2c 20 74 # NOTE: Yes, t
10160 68 69 73 20 64 65 66 69 6e 65 20 63 6f 6e 73 74 his define const
10170 61 6e 74 20 77 61 73 20 65 6e 61 62 6c 65 64 20 ant was enabled
10180 77 68 65 6e 20 74 68 65 20 6d 61 6e 61 67 65 64 when the managed
10190 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 .. #
101a0 20 20 20 20 61 73 73 65 6d 62 6c 79 20 77 61 73 assembly was
101b0 20 63 6f 6d 70 69 6c 65 64 2e 0d 0a 20 20 20 20 compiled...
101c0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
101d0 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 addConstraint
101e0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 67 65 [appendArgs [ge
101f0 74 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e tSQLiteDefineCon
10200 73 74 61 6e 74 50 72 65 66 69 78 5d 20 24 6e 61 stantPrefix] $na
10210 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 me]....
10220 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
10230 79 65 73 5c 6e 0d 0a 20 20 20 20 20 20 20 20 7d yes\n.. }
10240 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
10250 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
10260 6c 20 6e 6f 5c 6e 0d 0a 20 20 20 20 20 20 20 20 l no\n..
10270 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 }.. } else
10280 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
10290 20 24 63 68 61 6e 6e 65 6c 20 65 72 72 6f 72 5c $channel error\
102a0 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 n.. }..
102b0 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 }..... proc g
102c0 65 74 44 61 74 65 54 69 6d 65 46 6f 72 6d 61 74 etDateTimeFormat
102d0 20 7b 20 7b 74 69 6d 65 5a 6f 6e 65 20 74 72 75 { {timeZone tru
102e0 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d e} } {.. #.
102f0 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 . # NOTE: T
10300 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 73 69 his procedure si
10310 6d 70 6c 79 20 72 65 74 75 72 6e 73 20 74 68 65 mply returns the
10320 20 22 64 65 66 61 75 6c 74 22 20 44 61 74 65 54 "default" DateT
10330 69 6d 65 20 66 6f 72 6d 61 74 20 75 73 65 64 0d ime format used.
10340 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 . # b
10350 79 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 y the test suite
10360 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
10370 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
10380 74 73 20 3a 3a 64 61 74 65 74 69 6d 65 5f 66 6f ts ::datetime_fo
10390 72 6d 61 74 5d 20 26 26 20 5c 0d 0a 20 20 20 20 rmat] && \..
103a0 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 [string le
103b0 6e 67 74 68 20 24 3a 3a 64 61 74 65 74 69 6d 65 ngth $::datetime
103c0 5f 66 6f 72 6d 61 74 5d 20 3e 20 30 7d 20 74 68 _format] > 0} th
103d0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
103e0 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
103f0 20 52 65 74 75 72 6e 20 74 68 65 20 6d 61 6e 75 Return the manu
10400 61 6c 6c 79 20 6f 76 65 72 72 69 64 64 65 6e 20 ally overridden
10410 76 61 6c 75 65 20 66 6f 72 20 74 68 65 20 44 61 value for the Da
10420 74 65 54 69 6d 65 20 66 6f 72 6d 61 74 2e 0d 0a teTime format...
10430 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
10440 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 64 61 74 return $::dat
10450 65 74 69 6d 65 5f 66 6f 72 6d 61 74 0d 0a 20 20 etime_format..
10460 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
10470 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
10480 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 # NOTE: Return
10490 61 6e 20 49 53 4f 38 36 30 31 20 44 61 74 65 54 an ISO8601 DateT
104a0 69 6d 65 20 66 6f 72 6d 61 74 20 63 6f 6d 70 61 ime format compa
104b0 74 69 62 6c 65 20 77 69 74 68 20 53 51 4c 69 74 tible with SQLit
104c0 65 2c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 e,.. #
104d0 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e System.Data.
104e0 53 51 4c 69 74 65 2c 20 61 6e 64 20 73 75 69 74 SQLite, and suit
104f0 61 62 6c 65 20 66 6f 72 20 72 6f 75 6e 64 2d 74 able for round-t
10500 72 69 70 70 69 6e 67 20 77 69 74 68 20 74 68 65 ripping with the
10510 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
10520 20 20 44 61 74 65 54 69 6d 65 20 63 6c 61 73 73 DateTime class
10530 20 6f 66 20 74 68 65 20 66 72 61 6d 65 77 6f 72 of the framewor
10540 6b 2e 20 20 49 66 20 74 68 69 73 20 76 61 6c 75 k. If this valu
10550 65 20 69 73 20 63 68 61 6e 67 65 64 2c 0d 0a 20 e is changed,..
10560 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 # v
10570 61 72 69 6f 75 73 20 74 65 73 74 73 20 6d 61 79 arious tests may
10580 20 66 61 69 6c 2e 0d 0a 20 20 20 20 20 20 20 20 fail...
10590 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 #.. retur
105a0 6e 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d n [appendArgs \.
105b0 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 79 79 . "yy
105c0 79 79 2d 4d 4d 2d 64 64 20 48 48 3a 6d 6d 3a 73 yy-MM-dd HH:mm:s
105d0 73 2e 46 46 46 46 46 46 46 22 20 5b 65 78 70 72 s.FFFFFFF" [expr
105e0 20 7b 24 74 69 6d 65 5a 6f 6e 65 20 3f 20 22 4b {$timeZone ? "K
105f0 22 20 3a 20 22 22 7d 5d 5d 0d 0a 20 20 20 20 20 " : ""}]]..
10600 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
10610 20 20 70 72 6f 63 20 67 65 74 44 61 74 65 54 69 proc getDateTi
10620 6d 65 54 69 63 6b 73 20 7b 20 76 61 6c 75 65 20 meTicks { value
10630 7b 6c 6f 63 61 6c 20 22 22 7d 20 7b 64 65 66 61 {local ""} {defa
10640 75 6c 74 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 ult ""} } {..
10650 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c if {[string l
10660 65 6e 67 74 68 20 24 76 61 6c 75 65 5d 20 3d 3d ength $value] ==
10670 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
10680 20 20 20 20 72 65 74 75 72 6e 20 24 64 65 66 61 return $defa
10690 75 6c 74 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a ult.. }....
106a0 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
106b0 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 {.. set
106c0 64 61 74 65 54 69 6d 65 20 5b 6f 62 6a 65 63 74 dateTime [object
106d0 20 69 6e 76 6f 6b 65 20 2d 63 72 65 61 74 65 20 invoke -create
106e0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 2d \.. -
106f0 70 61 72 61 6d 65 74 65 72 74 79 70 65 73 20 5b parametertypes [
10700 6c 69 73 74 20 53 74 72 69 6e 67 20 53 74 72 69 list String Stri
10710 6e 67 20 49 46 6f 72 6d 61 74 50 72 6f 76 69 64 ng IFormatProvid
10720 65 72 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 er \..
10730 20 20 53 79 73 74 65 6d 2e 47 6c 6f 62 61 6c 69 System.Globali
10740 7a 61 74 69 6f 6e 2e 44 61 74 65 54 69 6d 65 53 zation.DateTimeS
10750 74 79 6c 65 73 5d 20 44 61 74 65 54 69 6d 65 20 tyles] DateTime
10760 50 61 72 73 65 45 78 61 63 74 20 5c 0d 0a 20 20 ParseExact \..
10770 20 20 20 20 20 20 20 20 20 20 24 76 61 6c 75 65 $value
10780 20 5b 67 65 74 44 61 74 65 54 69 6d 65 46 6f 72 [getDateTimeFor
10790 6d 61 74 5d 20 6e 75 6c 6c 20 41 64 6a 75 73 74 mat] null Adjust
107a0 54 6f 55 6e 69 76 65 72 73 61 6c 5d 0d 0a 20 20 ToUniversal]..
107b0 20 20 20 20 7d 5d 7d 20 74 68 65 6e 20 7b 0d 0a }]} then {..
107c0 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
107d0 64 65 66 61 75 6c 74 0d 0a 20 20 20 20 20 20 7d default.. }
107e0 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 .... if {[s
107f0 74 72 69 6e 67 20 69 73 20 62 6f 6f 6c 65 61 6e tring is boolean
10800 20 2d 73 74 72 69 63 74 20 24 6c 6f 63 61 6c 5d -strict $local]
10810 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
10820 20 20 73 65 74 20 64 61 74 65 54 69 6d 65 20 5b set dateTime [
10830 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 63 object invoke -c
10840 72 65 61 74 65 20 44 61 74 65 54 69 6d 65 20 53 reate DateTime S
10850 70 65 63 69 66 79 4b 69 6e 64 20 5c 0d 0a 20 20 pecifyKind \..
10860 20 20 20 20 20 20 20 20 20 20 24 64 61 74 65 54 $dateT
10870 69 6d 65 20 55 74 63 5d 0d 0a 20 20 20 20 20 20 ime Utc]..
10880 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
10890 20 20 72 65 74 75 72 6e 20 5b 6f 62 6a 65 63 74 return [object
108a0 20 69 6e 76 6f 6b 65 20 24 64 61 74 65 54 69 6d invoke $dateTim
108b0 65 20 54 69 63 6b 73 5d 0d 0a 20 20 20 20 20 20 e Ticks]..
108c0 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 }.... if {$
108d0 6c 6f 63 61 6c 7d 20 74 68 65 6e 20 7b 0d 0a 20 local} then {..
108e0 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6f return [o
108f0 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 24 64 61 bject invoke $da
10900 74 65 54 69 6d 65 20 54 6f 4c 6f 63 61 6c 54 69 teTime ToLocalTi
10910 6d 65 2e 54 69 63 6b 73 5d 0d 0a 20 20 20 20 20 me.Ticks]..
10920 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
10930 20 20 20 72 65 74 75 72 6e 20 5b 6f 62 6a 65 63 return [objec
10940 74 20 69 6e 76 6f 6b 65 20 24 64 61 74 65 54 69 t invoke $dateTi
10950 6d 65 20 54 6f 55 6e 69 76 65 72 73 61 6c 54 69 me ToUniversalTi
10960 6d 65 2e 54 69 63 6b 73 5d 0d 0a 20 20 20 20 20 me.Ticks]..
10970 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
10980 20 20 70 72 6f 63 20 67 65 74 50 72 6f 70 65 72 proc getProper
10990 74 69 65 73 20 7b 20 6f 62 6a 65 63 74 20 76 61 ties { object va
109a0 72 4e 61 6d 65 20 7d 20 7b 0d 0a 20 20 20 20 20 rName } {..
109b0 20 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d upvar 1 $varNam
109c0 65 20 70 72 6f 70 65 72 74 69 65 73 0d 0a 0d 0a e properties....
109d0 20 20 20 20 20 20 73 65 74 20 63 6f 75 6e 74 20 set count
109e0 30 0d 0a 20 20 20 20 20 20 73 65 74 20 6e 61 6d 0.. set nam
109f0 65 73 20 5b 6c 69 73 74 5d 0d 0a 0d 0a 20 20 20 es [list]....
10a00 20 20 20 69 66 20 7b 5b 69 73 4f 62 6a 65 63 74 if {[isObject
10a10 48 61 6e 64 6c 65 20 24 6f 62 6a 65 63 74 5d 20 Handle $object]
10a20 26 26 20 24 6f 62 6a 65 63 74 20 6e 65 20 22 6e && $object ne "n
10a30 75 6c 6c 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ull"} then {..
10a40 20 20 20 20 20 20 65 76 61 6c 20 6c 61 70 70 65 eval lappe
10a50 6e 64 20 6e 61 6d 65 73 20 5b 6f 62 6a 65 63 74 nd names [object
10a60 20 6d 65 6d 62 65 72 73 20 5c 0d 0a 20 20 20 20 members \..
10a70 20 20 20 20 20 20 20 20 2d 6d 65 6d 62 65 72 74 -membert
10a80 79 70 65 73 20 50 72 6f 70 65 72 74 79 20 2d 6e ypes Property -n
10a90 61 6d 65 6f 6e 6c 79 20 24 6f 62 6a 65 63 74 5d ameonly $object]
10aa0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 65 76 61 6c .... eval
10ab0 20 6c 61 70 70 65 6e 64 20 6e 61 6d 65 73 20 5b lappend names [
10ac0 6f 62 6a 65 63 74 20 6d 65 6d 62 65 72 73 20 5c object members \
10ad0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 2d 6d .. -m
10ae0 65 6d 62 65 72 74 79 70 65 73 20 46 69 65 6c 64 embertypes Field
10af0 20 2d 6e 61 6d 65 6f 6e 6c 79 20 24 6f 62 6a 65 -nameonly $obje
10b00 63 74 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a ct].. }....
10b10 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 6e 61 foreach na
10b20 6d 65 20 24 6e 61 6d 65 73 20 7b 0d 0a 20 20 20 me $names {..
10b30 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
10b40 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a {.. obj
10b50 65 63 74 20 69 6e 76 6f 6b 65 20 2d 6f 62 6a 65 ect invoke -obje
10b60 63 74 66 6c 61 67 73 20 2b 4e 6f 44 69 73 70 6f ctflags +NoDispo
10b70 73 65 20 24 6f 62 6a 65 63 74 20 24 6e 61 6d 65 se $object $name
10b80 0d 0a 20 20 20 20 20 20 20 20 7d 20 76 61 6c 75 .. } valu
10b90 65 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d e] == 0} then {.
10ba0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
10bb0 69 73 4f 62 6a 65 63 74 48 61 6e 64 6c 65 20 24 isObjectHandle $
10bc0 76 61 6c 75 65 5d 20 26 26 20 24 76 61 6c 75 65 value] && $value
10bd0 20 6e 65 20 22 6e 75 6c 6c 22 7d 20 74 68 65 6e ne "null"} then
10be0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
10bf0 73 65 74 20 65 72 72 6f 72 20 6e 75 6c 6c 3b 20 set error null;
10c00 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 object invoke -f
10c10 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 lags +NonPublic
10c20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
10c30 20 20 20 2d 6d 61 72 73 68 61 6c 66 6c 61 67 73 -marshalflags
10c40 20 2b 4e 6f 48 61 6e 64 6c 65 20 49 6e 74 65 72 +NoHandle Inter
10c50 70 72 65 74 65 72 2e 47 65 74 41 63 74 69 76 65 preter.GetActive
10c60 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
10c70 20 20 20 20 41 64 64 4f 62 6a 65 63 74 52 65 66 AddObjectRef
10c80 65 72 65 6e 63 65 20 4f 6b 20 24 76 61 6c 75 65 erence Ok $value
10c90 20 65 72 72 6f 72 0d 0a 0d 0a 20 20 20 20 20 20 error....
10ca0 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 70 72 lappend pr
10cb0 6f 70 65 72 74 69 65 73 28 6f 62 6a 65 63 74 73 operties(objects
10cc0 29 20 5b 6c 69 73 74 20 24 6e 61 6d 65 20 24 76 ) [list $name $v
10cd0 61 6c 75 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 alue]..
10ce0 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
10cf0 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 70 lappend p
10d00 72 6f 70 65 72 74 69 65 73 28 76 61 6c 75 65 73 roperties(values
10d10 29 20 5b 6c 69 73 74 20 24 6e 61 6d 65 20 24 76 ) [list $name $v
10d20 61 6c 75 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 alue]..
10d30 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
10d40 69 6e 63 72 20 63 6f 75 6e 74 0d 0a 20 20 20 20 incr count..
10d50 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
10d60 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 lappend
10d70 70 72 6f 70 65 72 74 69 65 73 28 65 72 72 6f 72 properties(error
10d80 73 29 20 5b 6c 69 73 74 20 24 6e 61 6d 65 20 24 s) [list $name $
10d90 3a 3a 65 72 72 6f 72 43 6f 64 65 5d 0d 0a 20 20 ::errorCode]..
10da0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
10db0 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e .... return
10dc0 20 24 63 6f 75 6e 74 0d 0a 20 20 20 20 7d 0d 0a $count.. }..
10dd0 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 41 ... proc getA
10de0 6c 6c 50 72 6f 70 65 72 74 69 65 73 20 7b 20 6f llProperties { o
10df0 62 6a 65 63 74 20 76 61 72 4e 61 6d 65 20 7d 20 bject varName }
10e00 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 {.. upvar 1
10e10 20 24 76 61 72 4e 61 6d 65 20 70 72 6f 70 65 72 $varName proper
10e20 74 69 65 73 0d 0a 20 20 20 20 20 20 73 65 74 20 ties.. set
10e30 76 61 6c 75 65 20 24 6f 62 6a 65 63 74 0d 0a 0d value $object...
10e40 0a 20 20 20 20 20 20 77 68 69 6c 65 20 7b 74 72 . while {tr
10e50 75 65 7d 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 ue} {.. i
10e60 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
10e70 20 70 72 6f 70 65 72 74 69 65 73 28 73 65 65 6e properties(seen
10e80 4f 62 6a 65 63 74 73 29 5d 20 7c 7c 20 5c 0d 0a Objects)] || \..
10e90 20 20 20 20 20 20 20 20 20 20 20 20 24 76 61 6c $val
10ea0 75 65 20 6e 69 20 24 70 72 6f 70 65 72 74 69 65 ue ni $propertie
10eb0 73 28 73 65 65 6e 4f 62 6a 65 63 74 73 29 7d 20 s(seenObjects)}
10ec0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
10ed0 20 20 67 65 74 50 72 6f 70 65 72 74 69 65 73 20 getProperties
10ee0 24 76 61 6c 75 65 20 70 72 6f 70 65 72 74 69 65 $value propertie
10ef0 73 0d 0a 20 20 20 20 20 20 20 20 20 20 6c 61 70 s.. lap
10f00 70 65 6e 64 20 70 72 6f 70 65 72 74 69 65 73 28 pend properties(
10f10 73 65 65 6e 4f 62 6a 65 63 74 73 29 20 24 76 61 seenObjects) $va
10f20 6c 75 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a lue.. }..
10f30 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b .. if {![
10f40 69 6e 66 6f 20 65 78 69 73 74 73 20 70 72 6f 70 info exists prop
10f50 65 72 74 69 65 73 28 6f 62 6a 65 63 74 73 29 5d erties(objects)]
10f60 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
10f70 20 20 20 20 62 72 65 61 6b 0d 0a 20 20 20 20 20 break..
10f80 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
10f90 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 70 72 if {[llength $pr
10fa0 6f 70 65 72 74 69 65 73 28 6f 62 6a 65 63 74 73 operties(objects
10fb0 29 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d )] == 0} then {.
10fc0 0a 20 20 20 20 20 20 20 20 20 20 75 6e 73 65 74 . unset
10fd0 20 70 72 6f 70 65 72 74 69 65 73 28 6f 62 6a 65 properties(obje
10fe0 63 74 73 29 3b 20 62 72 65 61 6b 0d 0a 20 20 20 cts); break..
10ff0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
11000 20 20 73 65 74 20 76 61 6c 75 65 20 5b 6c 69 6e set value [lin
11010 64 65 78 20 5b 6c 69 6e 64 65 78 20 24 70 72 6f dex [lindex $pro
11020 70 65 72 74 69 65 73 28 6f 62 6a 65 63 74 73 29 perties(objects)
11030 20 30 5d 20 65 6e 64 5d 0d 0a 20 20 20 20 20 20 0] end]..
11040 20 20 73 65 74 20 70 72 6f 70 65 72 74 69 65 73 set properties
11050 28 6f 62 6a 65 63 74 73 29 20 5b 6c 72 61 6e 67 (objects) [lrang
11060 65 20 24 70 72 6f 70 65 72 74 69 65 73 28 6f 62 e $properties(ob
11070 6a 65 63 74 73 29 20 31 20 65 6e 64 5d 0d 0a 20 jects) 1 end]..
11080 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
11090 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
110a0 20 70 72 6f 70 65 72 74 69 65 73 28 73 65 65 6e properties(seen
110b0 4f 62 6a 65 63 74 73 29 5d 7d 20 74 68 65 6e 20 Objects)]} then
110c0 7b 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 {.. forea
110d0 63 68 20 76 61 6c 75 65 20 24 70 72 6f 70 65 72 ch value $proper
110e0 74 69 65 73 28 73 65 65 6e 4f 62 6a 65 63 74 73 ties(seenObjects
110f0 29 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 ) {.. i
11100 66 20 7b 24 76 61 6c 75 65 20 65 71 20 24 6f 62 f {$value eq $ob
11110 6a 65 63 74 7d 20 63 6f 6e 74 69 6e 75 65 0d 0a ject} continue..
11120 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 20 catch
11130 7b 6f 62 6a 65 63 74 20 64 69 73 70 6f 73 65 20 {object dispose
11140 24 76 61 6c 75 65 7d 0d 0a 20 20 20 20 20 20 20 $value}..
11150 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 75 6e }.... un
11160 73 65 74 20 70 72 6f 70 65 72 74 69 65 73 28 73 set properties(s
11170 65 65 6e 4f 62 6a 65 63 74 73 29 0d 0a 20 20 20 eenObjects)..
11180 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
11190 20 20 20 20 70 72 6f 63 20 67 65 74 56 61 72 69 proc getVari
111a0 61 62 6c 65 73 20 7b 20 76 61 72 4e 61 6d 65 73 ables { varNames
111b0 20 7b 6f 62 6a 65 63 74 73 20 66 61 6c 73 65 7d {objects false}
111c0 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 } {.. set
111d0 72 65 73 75 6c 74 20 5b 6c 69 73 74 5d 0d 0a 0d result [list]...
111e0 0a 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 76 . foreach v
111f0 61 72 4e 61 6d 65 20 24 76 61 72 4e 61 6d 65 73 arName $varNames
11200 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
11210 5b 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 [uplevel 1 [list
11220 20 61 72 72 61 79 20 65 78 69 73 74 73 20 24 76 array exists $v
11230 61 72 4e 61 6d 65 5d 5d 7d 20 74 68 65 6e 20 7b arName]]} then {
11240 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
11250 61 72 72 61 79 4e 61 6d 65 20 24 76 61 72 4e 61 arrayName $varNa
11260 6d 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 me....
11270 66 6f 72 65 61 63 68 20 65 6c 65 6d 65 6e 74 4e foreach elementN
11280 61 6d 65 20 5b 75 70 6c 65 76 65 6c 20 31 20 5b ame [uplevel 1 [
11290 6c 69 73 74 20 61 72 72 61 79 20 6e 61 6d 65 73 list array names
112a0 20 24 61 72 72 61 79 4e 61 6d 65 5d 5d 20 7b 0d $arrayName]] {.
112b0 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 . set
112c0 20 6e 61 6d 65 20 5b 61 70 70 65 6e 64 41 72 67 name [appendArg
112d0 73 20 24 61 72 72 61 79 4e 61 6d 65 20 28 20 24 s $arrayName ( $
112e0 65 6c 65 6d 65 6e 74 4e 61 6d 65 20 29 5d 0d 0a elementName )]..
112f0 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 set
11300 76 61 72 56 61 6c 75 65 20 5b 75 70 6c 65 76 65 varValue [upleve
11310 6c 20 31 20 5b 6c 69 73 74 20 73 65 74 20 24 6e l 1 [list set $n
11320 61 6d 65 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 ame]]....
11330 20 20 20 20 20 69 66 20 7b 24 6f 62 6a 65 63 74 if {$object
11340 73 20 26 26 20 5b 69 73 4f 62 6a 65 63 74 48 61 s && [isObjectHa
11350 6e 64 6c 65 20 24 76 61 72 56 61 6c 75 65 5d 7d ndle $varValue]}
11360 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
11370 20 20 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f unset -no
11380 63 6f 6d 70 6c 61 69 6e 20 70 72 6f 70 65 72 74 complain propert
11390 69 65 73 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ies..
113a0 20 20 20 67 65 74 41 6c 6c 50 72 6f 70 65 72 74 getAllPropert
113b0 69 65 73 20 24 76 61 72 56 61 6c 75 65 20 70 72 ies $varValue pr
113c0 6f 70 65 72 74 69 65 73 0d 0a 0d 0a 20 20 20 20 operties....
113d0 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e lappen
113e0 64 20 72 65 73 75 6c 74 20 5b 6c 69 73 74 20 24 d result [list $
113f0 6e 61 6d 65 20 5b 61 72 72 61 79 20 67 65 74 20 name [array get
11400 70 72 6f 70 65 72 74 69 65 73 5d 5d 0d 0a 20 20 properties]]..
11410 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 } else
11420 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
11430 20 20 6c 61 70 70 65 6e 64 20 72 65 73 75 6c 74 lappend result
11440 20 5b 6c 69 73 74 20 24 6e 61 6d 65 20 24 76 61 [list $name $va
11450 72 56 61 6c 75 65 5d 0d 0a 20 20 20 20 20 20 20 rValue]..
11460 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
11470 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 }.. } e
11480 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
11490 20 73 65 74 20 76 61 72 56 61 6c 75 65 20 5b 75 set varValue [u
114a0 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 73 plevel 1 [list s
114b0 65 74 20 24 76 61 72 4e 61 6d 65 5d 5d 0d 0a 0d et $varName]]...
114c0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 . if {$
114d0 6f 62 6a 65 63 74 73 20 26 26 20 5b 69 73 4f 62 objects && [isOb
114e0 6a 65 63 74 48 61 6e 64 6c 65 20 24 76 61 72 56 jectHandle $varV
114f0 61 6c 75 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 alue]} then {..
11500 20 20 20 20 20 20 20 20 20 20 20 75 6e 73 65 74 unset
11510 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 70 72 6f -nocomplain pro
11520 70 65 72 74 69 65 73 0d 0a 20 20 20 20 20 20 20 perties..
11530 20 20 20 20 20 67 65 74 41 6c 6c 50 72 6f 70 65 getAllPrope
11540 72 74 69 65 73 20 24 76 61 72 56 61 6c 75 65 20 rties $varValue
11550 70 72 6f 70 65 72 74 69 65 73 0d 0a 0d 0a 20 20 properties....
11560 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e lappen
11570 64 20 72 65 73 75 6c 74 20 5b 6c 69 73 74 20 24 d result [list $
11580 76 61 72 4e 61 6d 65 20 5b 61 72 72 61 79 20 67 varName [array g
11590 65 74 20 70 72 6f 70 65 72 74 69 65 73 5d 5d 0d et properties]].
115a0 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 . } els
115b0 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
115c0 20 6c 61 70 70 65 6e 64 20 72 65 73 75 6c 74 20 lappend result
115d0 5b 6c 69 73 74 20 24 76 61 72 4e 61 6d 65 20 24 [list $varName $
115e0 76 61 72 56 61 6c 75 65 5d 0d 0a 20 20 20 20 20 varValue]..
115f0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
11600 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
11610 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 return $resu
11620 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 lt.. }.....
11630 20 20 70 72 6f 63 20 65 6e 75 6d 65 72 61 62 6c proc enumerabl
11640 65 54 6f 4c 69 73 74 20 7b 20 65 6e 75 6d 65 72 eToList { enumer
11650 61 62 6c 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 able } {..
11660 73 65 74 20 72 65 73 75 6c 74 20 5b 6c 69 73 74 set result [list
11670 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b ].... if {[
11680 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 65 string length $e
11690 6e 75 6d 65 72 61 62 6c 65 5d 20 3d 3d 20 30 20 numerable] == 0
116a0 7c 7c 20 24 65 6e 75 6d 65 72 61 62 6c 65 20 65 || $enumerable e
116b0 71 20 22 6e 75 6c 6c 22 7d 20 74 68 65 6e 20 7b q "null"} then {
116c0 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
116d0 20 24 72 65 73 75 6c 74 0d 0a 20 20 20 20 20 20 $result..
116e0 7d 0d 0a 0d 0a 20 20 20 20 20 20 6f 62 6a 65 63 }.... objec
116f0 74 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 61 73 t foreach -alias
11700 20 69 74 65 6d 20 24 65 6e 75 6d 65 72 61 62 6c item $enumerabl
11710 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 e {.. if
11720 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
11730 24 69 74 65 6d 5d 20 3e 20 30 7d 20 74 68 65 6e $item] > 0} then
11740 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6c 61 {.. la
11750 70 70 65 6e 64 20 72 65 73 75 6c 74 20 5b 24 69 ppend result [$i
11760 74 65 6d 20 54 6f 53 74 72 69 6e 67 5d 0d 0a 20 tem ToString]..
11770 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
11780 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 }.... retur
11790 6e 20 24 72 65 73 75 6c 74 0d 0a 20 20 20 20 7d n $result.. }
117a0 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 61 ..... proc ca
117b0 74 63 68 41 6e 64 52 65 74 75 72 6e 20 7b 20 73 tchAndReturn { s
117c0 63 72 69 70 74 20 7b 73 74 61 63 6b 54 72 61 63 cript {stackTrac
117d0 65 20 66 61 6c 73 65 7d 20 7b 73 74 72 69 63 74 e false} {strict
117e0 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 true} } {..
117f0 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
11800 45 3a 20 45 76 61 6c 75 61 74 65 20 74 68 65 20 E: Evaluate the
11810 73 63 72 69 70 74 20 70 72 6f 76 69 64 65 64 20 script provided
11820 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 20 69 6e by our caller in
11830 20 74 68 65 69 72 20 63 6f 6e 74 65 78 74 2c 0d their context,.
11840 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 . # c
11850 61 70 74 75 72 69 6e 67 20 62 6f 74 68 20 74 68 apturing both th
11860 65 20 72 65 73 75 6c 74 20 61 6e 64 20 74 68 65 e result and the
11870 20 72 65 74 75 72 6e 20 63 6f 64 65 2e 0d 0a 20 return code...
11880 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 #.. se
11890 74 20 63 6f 64 65 20 5b 63 61 74 63 68 20 7b 75 t code [catch {u
118a0 70 6c 65 76 65 6c 20 31 20 24 73 63 72 69 70 74 plevel 1 $script
118b0 7d 20 72 65 73 75 6c 74 5d 0d 0a 0d 0a 20 20 20 } result]....
118c0 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
118d0 54 45 3a 20 44 69 64 20 74 68 65 20 73 63 72 69 TE: Did the scri
118e0 70 74 20 70 72 6f 76 69 64 65 64 20 62 79 20 6f pt provided by o
118f0 75 72 20 63 61 6c 6c 65 72 20 4e 4f 54 20 72 61 ur caller NOT ra
11900 69 73 65 20 61 6e 20 65 72 72 6f 72 3f 0d 0a 20 ise an error?..
11910 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
11920 20 7b 24 73 74 72 69 63 74 20 26 26 20 24 63 6f {$strict && $co
11930 64 65 20 3d 3d 20 30 20 7c 7c 20 21 24 73 74 72 de == 0 || !$str
11940 69 63 74 20 26 26 20 24 63 6f 64 65 20 21 3d 20 ict && $code !=
11950 31 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 1} then {..
11960 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
11970 4e 4f 54 45 3a 20 53 75 63 63 65 73 73 2e 20 20 NOTE: Success.
11980 52 65 74 75 72 6e 20 61 20 6c 69 73 74 20 77 69 Return a list wi
11990 74 68 20 74 68 65 20 72 65 74 75 72 6e 20 63 6f th the return co
119a0 64 65 20 61 6e 64 20 74 68 65 20 72 65 73 75 6c de and the resul
119b0 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 t... #..
119c0 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c return [l
119d0 69 73 74 20 24 63 6f 64 65 20 24 72 65 73 75 6c ist $code $resul
119e0 74 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 t].. } else
119f0 69 66 20 7b 24 73 74 61 63 6b 54 72 61 63 65 7d if {$stackTrace}
11a00 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
11a10 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
11a20 54 45 3a 20 46 61 69 6c 75 72 65 2e 20 20 4f 75 TE: Failure. Ou
11a30 72 20 63 61 6c 6c 65 72 20 77 61 6e 74 73 20 61 r caller wants a
11a40 20 66 75 6c 6c 20 73 74 61 63 6b 20 74 72 61 63 full stack trac
11a50 65 20 28 69 66 20 61 70 70 6c 69 63 61 62 6c 65 e (if applicable
11a60 29 2c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ),.. #
11a70 20 20 20 20 72 65 74 75 72 6e 20 61 20 6c 69 73 return a lis
11a80 74 20 77 69 74 68 20 74 68 65 20 72 65 74 75 72 t with the retur
11a90 6e 20 63 6f 64 65 20 61 6e 64 20 74 68 65 20 72 n code and the r
11aa0 65 73 75 6c 74 20 76 65 72 62 61 74 69 6d 2e 0d esult verbatim..
11ab0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
11ac0 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 return [list
11ad0 20 24 63 6f 64 65 20 24 72 65 73 75 6c 74 5d 0d $code $result].
11ae0 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
11af0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
11b00 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 61 69 6c # NOTE: Fail
11b10 75 72 65 2e 20 20 4f 75 72 20 63 61 6c 6c 65 72 ure. Our caller
11b20 20 64 6f 65 73 20 6e 6f 74 20 77 61 6e 74 20 61 does not want a
11b30 20 66 75 6c 6c 20 73 74 61 63 6b 20 74 72 61 63 full stack trac
11b40 65 20 28 69 66 0d 0a 20 20 20 20 20 20 20 20 23 e (if.. #
11b50 20 20 20 20 20 20 20 61 70 70 6c 69 63 61 62 6c applicabl
11b60 65 29 2c 20 72 65 74 75 72 6e 20 61 20 6c 69 73 e), return a lis
11b70 74 20 77 69 74 68 20 74 68 65 20 72 65 74 75 72 t with the retur
11b80 6e 20 63 6f 64 65 2c 20 74 68 65 20 65 72 72 6f n code, the erro
11b90 72 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 r.. #
11ba0 20 20 20 63 6f 64 65 20 66 6f 72 20 74 68 65 20 code for the
11bb0 69 6e 74 65 72 70 72 65 74 65 72 2c 20 61 6e 64 interpreter, and
11bc0 20 74 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61 the error messa
11bd0 67 65 20 75 70 20 74 6f 20 74 68 65 0d 0a 20 20 ge up to the..
11be0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 70 6f # po
11bf0 69 6e 74 20 77 68 65 72 65 20 74 68 65 20 73 74 int where the st
11c00 61 63 6b 20 74 72 61 63 65 20 73 68 6f 75 6c 64 ack trace should
11c10 20 73 74 61 72 74 2e 0d 0a 20 20 20 20 20 20 20 start...
11c20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 #.. retu
11c30 72 6e 20 5b 6c 69 73 74 20 24 63 6f 64 65 20 24 rn [list $code $
11c40 3a 3a 65 72 72 6f 72 43 6f 64 65 20 5c 0d 0a 20 ::errorCode \..
11c50 20 20 20 20 20 20 20 20 20 20 20 5b 65 78 74 72 [extr
11c60 61 63 74 53 79 73 74 65 6d 44 61 74 61 53 51 4c actSystemDataSQL
11c70 69 74 65 45 78 63 65 70 74 69 6f 6e 4d 65 73 73 iteExceptionMess
11c80 61 67 65 20 24 72 65 73 75 6c 74 5d 5d 0d 0a 20 age $result]]..
11c90 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
11ca0 0d 0a 20 20 20 20 70 72 6f 63 20 63 6f 6d 70 69 .. proc compi
11cb0 6c 65 43 53 68 61 72 70 57 69 74 68 20 7b 0d 0a leCSharpWith {..
11cc0 20 20 20 20 20 20 20 20 20 20 20 20 74 65 78 74 text
11cd0 20 6d 65 6d 6f 72 79 20 73 79 6d 62 6f 6c 73 20 memory symbols
11ce0 73 74 72 69 63 74 20 72 65 73 75 6c 74 73 56 61 strict resultsVa
11cf0 72 4e 61 6d 65 20 65 72 72 6f 72 73 56 61 72 4e rName errorsVarN
11d00 61 6d 65 20 66 69 6c 65 4e 61 6d 65 73 0d 0a 20 ame fileNames..
11d10 20 20 20 20 20 20 20 20 20 20 20 61 72 67 73 20 args
11d20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
11d30 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 69 6e 63 # NOTE: Sinc
11d40 65 20 77 65 20 61 72 65 20 67 6f 69 6e 67 20 74 e we are going t
11d50 6f 20 75 73 65 20 74 68 69 73 20 6d 65 74 68 6f o use this metho
11d60 64 20 6e 61 6d 65 20 61 20 6c 6f 74 2c 20 61 73 d name a lot, as
11d70 73 69 67 6e 20 69 74 20 74 6f 20 61 0d 0a 20 20 sign it to a..
11d80 20 20 20 20 23 20 20 20 20 20 20 20 76 61 72 69 # vari
11d90 61 62 6c 65 20 66 69 72 73 74 2e 0d 0a 20 20 20 able first...
11da0 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 #.. set
11db0 61 64 64 20 52 65 66 65 72 65 6e 63 65 64 41 73 add ReferencedAs
11dc0 73 65 6d 62 6c 69 65 73 2e 41 64 64 0d 0a 0d 0a semblies.Add....
11dd0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
11de0 20 4e 4f 54 45 3a 20 43 72 65 61 74 65 20 74 68 NOTE: Create th
11df0 65 20 62 61 73 65 20 63 6f 6d 6d 61 6e 64 20 74 e base command t
11e00 6f 20 65 76 61 6c 75 61 74 65 20 61 6e 64 20 61 o evaluate and a
11e10 64 64 20 74 68 65 20 70 72 6f 70 65 72 74 79 20 dd the property
11e20 73 65 74 74 69 6e 67 73 0d 0a 20 20 20 20 20 20 settings..
11e30 23 20 20 20 20 20 20 20 74 68 61 74 20 61 72 65 # that are
11e40 20 61 6c 6d 6f 73 74 20 61 6c 77 61 79 73 20 6e almost always n
11e50 65 65 64 65 64 20 62 79 20 6f 75 72 20 75 6e 69 eeded by our uni
11e60 74 20 74 65 73 74 73 20 28 69 2e 65 2e 20 74 68 t tests (i.e. th
11e70 65 20 53 79 73 74 65 6d 0d 0a 20 20 20 20 20 20 e System..
11e80 23 20 20 20 20 20 20 20 61 6e 64 20 53 79 73 74 # and Syst
11e90 65 6d 2e 44 61 74 61 20 61 73 73 65 6d 62 6c 79 em.Data assembly
11ea0 20 72 65 66 65 72 65 6e 63 65 73 29 2e 0d 0a 20 references)...
11eb0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 #.. se
11ec0 74 20 63 6f 6d 6d 61 6e 64 20 5b 6c 69 73 74 20 t command [list
11ed0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d \.. com
11ee0 70 69 6c 65 43 53 68 61 72 70 20 24 74 65 78 74 pileCSharp $text
11ef0 20 24 6d 65 6d 6f 72 79 20 24 73 79 6d 62 6f 6c $memory $symbol
11f00 73 20 24 73 74 72 69 63 74 20 72 65 73 75 6c 74 s $strict result
11f10 73 20 65 72 72 6f 72 73 20 5c 0d 0a 20 20 20 20 s errors \..
11f20 20 20 20 20 20 20 24 61 64 64 20 53 79 73 74 65 $add Syste
11f30 6d 2e 64 6c 6c 20 24 61 64 64 20 53 79 73 74 65 m.dll $add Syste
11f40 6d 2e 44 61 74 61 2e 64 6c 6c 20 24 61 64 64 20 m.Data.dll $add
11f50 53 79 73 74 65 6d 2e 54 72 61 6e 73 61 63 74 69 System.Transacti
11f60 6f 6e 73 2e 64 6c 6c 20 5c 0d 0a 20 20 20 20 20 ons.dll \..
11f70 20 20 20 20 20 24 61 64 64 20 53 79 73 74 65 6d $add System
11f80 2e 58 6d 6c 2e 64 6c 6c 5d 0d 0a 0d 0a 20 20 20 .Xml.dll]....
11f90 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
11fa0 54 45 3a 20 41 64 64 20 61 6c 6c 20 74 68 65 20 TE: Add all the
11fb0 70 72 6f 76 69 64 65 64 20 66 69 6c 65 20 6e 61 provided file na
11fc0 6d 65 73 20 61 73 20 61 73 73 65 6d 62 6c 79 20 mes as assembly
11fd0 72 65 66 65 72 65 6e 63 65 73 2e 0d 0a 20 20 20 references...
11fe0 20 20 20 23 0d 0a 20 20 20 20 20 20 66 6f 72 65 #.. fore
11ff0 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 66 69 ach fileName $fi
12000 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
12010 20 20 20 6c 61 70 70 65 6e 64 20 63 6f 6d 6d 61 lappend comma
12020 6e 64 20 24 61 64 64 20 5b 67 65 74 42 69 6e 61 nd $add [getBina
12030 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 ryFileName $file
12040 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a Name].. }..
12050 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
12060 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 74 68 65 # NOTE: Add the
12070 20 65 78 74 72 61 20 61 72 67 75 6d 65 6e 74 73 extra arguments
12080 2c 20 69 66 20 61 6e 79 2c 20 74 6f 20 74 68 65 , if any, to the
12090 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 65 76 61 6c command to eval
120a0 75 61 74 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a uate... #..
120b0 20 20 20 20 20 20 65 76 61 6c 20 6c 61 70 70 65 eval lappe
120c0 6e 64 20 63 6f 6d 6d 61 6e 64 20 24 61 72 67 73 nd command $args
120d0 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
120e0 20 20 20 23 20 4e 4f 54 45 3a 20 41 6c 69 61 73 # NOTE: Alias
120f0 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 6c 6f the compiler lo
12100 63 61 6c 20 72 65 73 75 6c 74 73 20 61 6e 64 20 cal results and
12110 65 72 72 6f 72 73 20 76 61 72 69 61 62 6c 65 73 errors variables
12120 20 74 6f 20 74 68 65 0d 0a 20 20 20 20 20 20 23 to the.. #
12130 20 20 20 20 20 20 20 76 61 72 69 61 62 6c 65 20 variable
12140 6e 61 6d 65 73 20 70 72 6f 76 69 64 65 64 20 62 names provided b
12150 79 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d 0a 20 y our caller...
12160 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
12170 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
12180 20 24 72 65 73 75 6c 74 73 56 61 72 4e 61 6d 65 $resultsVarName
12190 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
121a0 20 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 upvar 1 $
121b0 72 65 73 75 6c 74 73 56 61 72 4e 61 6d 65 20 72 resultsVarName r
121c0 65 73 75 6c 74 73 0d 0a 20 20 20 20 20 20 7d 0d esults.. }.
121d0 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 ... if {[st
121e0 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 65 72 72 ring length $err
121f0 6f 72 73 56 61 72 4e 61 6d 65 5d 20 3e 20 30 7d orsVarName] > 0}
12200 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
12210 20 75 70 76 61 72 20 31 20 24 65 72 72 6f 72 73 upvar 1 $errors
12220 56 61 72 4e 61 6d 65 20 65 72 72 6f 72 73 0d 0a VarName errors..
12230 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
12240 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
12250 3a 20 45 76 61 6c 75 61 74 65 20 74 68 65 20 63 : Evaluate the c
12260 6f 6e 73 74 72 75 63 74 65 64 20 5b 63 6f 6d 70 onstructed [comp
12270 69 6c 65 43 53 68 61 72 70 5d 20 63 6f 6d 6d 61 ileCSharp] comma
12280 6e 64 20 61 6e 64 20 72 65 74 75 72 6e 20 74 68 nd and return th
12290 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
122a0 20 72 65 73 75 6c 74 2e 0d 0a 20 20 20 20 20 20 result...
122b0 23 0d 0a 20 20 20 20 20 20 65 76 61 6c 20 24 63 #.. eval $c
122c0 6f 6d 6d 61 6e 64 0d 0a 20 20 20 20 7d 0d 0a 0c ommand.. }...
122d0 0d 0a 20 20 20 20 70 72 6f 63 20 69 73 4d 65 6d .. proc isMem
122e0 6f 72 79 44 62 20 7b 20 66 69 6c 65 4e 61 6d 65 oryDb { fileName
122f0 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
12300 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 73 20 # NOTE: Is
12310 74 68 65 20 73 70 65 63 69 66 69 65 64 20 64 61 the specified da
12320 74 61 62 61 73 65 20 66 69 6c 65 20 6e 61 6d 65 tabase file name
12330 20 72 65 61 6c 6c 79 20 61 6e 20 69 6e 2d 6d 65 really an in-me
12340 6d 6f 72 79 20 64 61 74 61 62 61 73 65 3f 0d 0a mory database?..
12350 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 #.. r
12360 65 74 75 72 6e 20 5b 65 78 70 72 20 7b 24 66 69 eturn [expr {$fi
12370 6c 65 4e 61 6d 65 20 65 71 20 22 3a 6d 65 6d 6f leName eq ":memo
12380 72 79 3a 22 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 ry:" || \..
12390 20 20 20 20 20 5b 73 74 72 69 6e 67 20 72 61 6e [string ran
123a0 67 65 20 24 66 69 6c 65 4e 61 6d 65 20 30 20 31 ge $fileName 0 1
123b0 32 5d 20 65 71 20 22 66 69 6c 65 3a 3a 6d 65 6d 2] eq "file::mem
123c0 6f 72 79 3a 22 7d 5d 0d 0a 20 20 20 20 7d 0d 0a ory:"}].. }..
123d0 0c 0d 0a 20 20 20 20 70 72 6f 63 20 69 73 54 61 ... proc isTa
123e0 62 6c 65 49 6e 44 62 20 7b 20 6e 61 6d 65 20 7b bleInDb { name {
123f0 76 61 72 4e 61 6d 65 20 64 62 7d 20 7d 20 7b 0d varName db} } {.
12400 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
12410 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 20 74 6f # NOTE: Refer to
12420 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 76 the specified v
12430 61 72 69 61 62 6c 65 20 28 65 2e 67 2e 20 22 64 ariable (e.g. "d
12440 62 22 29 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 b") in the conte
12450 78 74 20 6f 66 20 6f 75 72 0d 0a 20 20 20 20 20 xt of our..
12460 20 23 20 20 20 20 20 20 20 63 61 6c 6c 65 72 2e # caller.
12470 20 20 49 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 It contains th
12480 65 20 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 e database conne
12490 63 74 69 6f 6e 20 68 61 6e 64 6c 65 20 74 68 61 ction handle tha
124a0 74 20 77 69 6c 6c 20 62 65 0d 0a 20 20 20 20 20 t will be..
124b0 20 23 20 20 20 20 20 20 20 75 73 65 64 20 74 6f # used to
124c0 20 65 78 65 63 75 74 65 20 74 68 65 20 71 75 65 execute the que
124d0 72 79 20 75 73 65 64 20 74 6f 20 64 65 74 65 72 ry used to deter
124e0 6d 69 6e 65 20 69 66 20 74 68 65 20 6e 61 6d 65 mine if the name
124f0 64 20 74 61 62 6c 65 20 69 73 0d 0a 20 20 20 20 d table is..
12500 20 20 23 20 20 20 20 20 20 20 70 72 65 73 65 6e # presen
12510 74 20 69 6e 20 74 68 61 74 20 64 61 74 61 62 61 t in that databa
12520 73 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 se... #..
12530 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 upvar 1 $var
12540 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 20 20 20 Name db....
12550 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
12560 3a 20 55 73 65 20 74 68 65 20 73 71 6c 69 74 65 : Use the sqlite
12570 5f 6d 61 73 74 65 72 20 74 61 62 6c 65 20 74 6f _master table to
12580 20 64 65 74 65 72 6d 69 6e 65 20 69 66 20 74 68 determine if th
12590 65 20 6e 61 6d 65 64 20 74 61 62 6c 65 20 69 73 e named table is
125a0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
125b0 70 72 65 73 65 6e 74 20 69 6e 20 74 68 65 20 64 present in the d
125c0 61 74 61 62 61 73 65 2e 0d 0a 20 20 20 20 20 20 atabase...
125d0 23 0d 0a 20 20 20 20 20 20 73 65 74 20 73 71 6c #.. set sql
125e0 20 7b 0d 0a 20 20 20 20 20 20 20 20 53 45 4c 45 {.. SELE
125f0 43 54 20 43 4f 55 4e 54 28 2a 29 20 46 52 4f 4d CT COUNT(*) FROM
12600 20 73 71 6c 69 74 65 5f 6d 61 73 74 65 72 20 57 sqlite_master W
12610 48 45 52 45 20 74 79 70 65 20 3d 20 27 74 61 62 HERE type = 'tab
12620 6c 65 27 20 41 4e 44 20 6e 61 6d 65 20 3d 20 3f le' AND name = ?
12630 3b 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 ;.. }....
12640 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
12650 4f 54 45 3a 20 52 65 74 75 72 6e 20 6e 6f 6e 2d OTE: Return non-
12660 7a 65 72 6f 20 69 66 20 74 68 65 20 6e 61 6d 65 zero if the name
12670 64 20 74 61 62 6c 65 20 69 73 20 70 72 65 73 65 d table is prese
12680 6e 74 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 nt... #..
12690 20 20 20 20 72 65 74 75 72 6e 20 5b 65 78 70 72 return [expr
126a0 20 7b 0d 0a 20 20 20 20 20 20 20 20 5b 73 71 6c {.. [sql
126b0 20 65 78 65 63 75 74 65 20 2d 65 78 65 63 75 74 execute -execut
126c0 65 20 73 63 61 6c 61 72 20 24 64 62 20 24 73 71 e scalar $db $sq
126d0 6c 20 5b 6c 69 73 74 20 70 61 72 61 6d 31 20 53 l [list param1 S
126e0 74 72 69 6e 67 20 24 6e 61 6d 65 5d 5d 20 3e 20 tring $name]] >
126f0 30 0d 0a 20 20 20 20 20 20 7d 5d 0d 0a 20 20 20 0.. }]..
12700 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
12710 67 65 74 44 62 44 65 66 61 75 6c 74 50 61 67 65 getDbDefaultPage
12720 53 69 7a 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 Size {} {..
12730 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 65 78 65 if {[catch {exe
12740 63 75 74 65 53 71 6c 20 22 50 52 41 47 4d 41 20 cuteSql "PRAGMA
12750 70 61 67 65 5f 73 69 7a 65 3b 22 20 73 63 61 6c page_size;" scal
12760 61 72 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 30 ar} result] == 0
12770 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
12780 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 6c 74 return $result
12790 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
127a0 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
127b0 20 30 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 0.. }..
127c0 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
127d0 67 65 74 44 62 44 65 66 61 75 6c 74 43 61 63 68 getDbDefaultCach
127e0 65 53 69 7a 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 eSize {} {..
127f0 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 65 78 if {[catch {ex
12800 65 63 75 74 65 53 71 6c 20 22 50 52 41 47 4d 41 ecuteSql "PRAGMA
12810 20 63 61 63 68 65 5f 73 69 7a 65 3b 22 20 73 63 cache_size;" sc
12820 61 6c 61 72 7d 20 72 65 73 75 6c 74 5d 20 3d 3d alar} result] ==
12830 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
12840 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 return $resu
12850 6c 74 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 lt.. } else
12860 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 {.. retu
12870 72 6e 20 30 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 rn 0.. }..
12880 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
12890 63 20 75 73 65 4c 65 67 61 63 79 44 62 50 61 67 c useLegacyDbPag
128a0 65 41 6e 64 43 61 63 68 65 53 69 7a 65 73 20 7b eAndCacheSizes {
128b0 20 76 61 72 4e 61 6d 65 20 7d 20 7b 0d 0a 20 20 varName } {..
128c0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
128d0 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 74 68 OTE: Refer to th
128e0 65 20 73 70 65 63 69 66 69 65 64 20 76 61 72 69 e specified vari
128f0 61 62 6c 65 20 28 65 2e 67 2e 20 22 64 62 22 29 able (e.g. "db")
12900 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 20 in the context
12910 6f 66 20 6f 75 72 0d 0a 20 20 20 20 20 20 23 20 of our.. #
12920 20 20 20 20 20 20 63 61 6c 6c 65 72 2e 20 20 49 caller. I
12930 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 64 t contains the d
12940 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 atabase connecti
12950 6f 6e 20 68 61 6e 64 6c 65 20 74 68 61 74 20 77 on handle that w
12960 69 6c 6c 20 62 65 0d 0a 20 20 20 20 20 20 23 20 ill be.. #
12970 20 20 20 20 20 20 75 73 65 64 20 74 6f 20 65 78 used to ex
12980 65 63 75 74 65 20 71 75 65 72 69 65 73 20 75 73 ecute queries us
12990 65 64 20 74 6f 20 73 65 74 20 74 68 65 20 70 61 ed to set the pa
129a0 67 65 20 61 6e 64 20 63 61 63 68 65 20 73 69 7a ge and cache siz
129b0 65 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 es... #..
129c0 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 upvar 1 $var
129d0 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 20 20 20 Name db....
129e0 20 73 71 6c 20 65 78 65 63 75 74 65 20 24 64 62 sql execute $db
129f0 20 7b 0d 0a 20 20 20 20 20 20 20 20 50 52 41 47 {.. PRAG
12a00 4d 41 20 70 61 67 65 5f 73 69 7a 65 20 3d 20 31 MA page_size = 1
12a10 30 32 34 3b 0d 0a 20 20 20 20 20 20 20 20 50 52 024;.. PR
12a20 41 47 4d 41 20 63 61 63 68 65 5f 73 69 7a 65 20 AGMA cache_size
12a30 3d 20 32 30 30 30 3b 0d 0a 20 20 20 20 20 20 7d = 2000;.. }
12a40 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e .... return
12a50 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 [list \..
12a60 20 20 20 20 5b 73 71 6c 20 65 78 65 63 75 74 65 [sql execute
12a70 20 2d 65 78 65 63 75 74 65 20 73 63 61 6c 61 72 -execute scalar
12a80 20 24 64 62 20 22 50 52 41 47 4d 41 20 70 61 67 $db "PRAGMA pag
12a90 65 5f 73 69 7a 65 3b 22 5d 20 5c 0d 0a 20 20 20 e_size;"] \..
12aa0 20 20 20 20 20 20 20 5b 73 71 6c 20 65 78 65 63 [sql exec
12ab0 75 74 65 20 2d 65 78 65 63 75 74 65 20 73 63 61 ute -execute sca
12ac0 6c 61 72 20 24 64 62 20 22 50 52 41 47 4d 41 20 lar $db "PRAGMA
12ad0 63 61 63 68 65 5f 73 69 7a 65 3b 22 5d 5d 0d 0a cache_size;"]]..
12ae0 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
12af0 6f 63 20 65 78 74 72 61 63 74 53 79 73 74 65 6d oc extractSystem
12b00 44 61 74 61 53 51 4c 69 74 65 45 78 63 65 70 74 DataSQLiteExcept
12b10 69 6f 6e 4d 65 73 73 61 67 65 20 7b 20 76 61 6c ionMessage { val
12b20 75 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d ue } {.. #.
12b30 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 . # NOTE: I
12b40 66 20 74 68 65 20 73 74 72 69 6e 67 20 63 6f 6e f the string con
12b50 66 6f 72 6d 73 20 74 6f 20 66 6f 72 6d 61 74 20 forms to format
12b60 6f 66 20 74 68 65 20 6e 6f 72 6d 61 6c 20 65 78 of the normal ex
12b70 63 65 70 74 69 6f 6e 0d 0a 20 20 20 20 20 20 23 ception.. #
12b80 20 20 20 20 20 20 20 65 72 72 6f 72 20 73 74 72 error str
12b90 69 6e 67 73 2c 20 65 78 74 72 61 63 74 20 61 6e ings, extract an
12ba0 64 20 72 65 74 75 72 6e 20 6f 6e 6c 79 20 74 68 d return only th
12bb0 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65 0d e error message.
12bc0 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 70 . # p
12bd0 6f 72 74 69 6f 6e 20 69 74 73 65 6c 66 2e 0d 0a ortion itself...
12be0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 #.. s
12bf0 65 74 20 70 61 74 74 65 72 6e 73 20 5b 6c 69 73 et patterns [lis
12c00 74 20 5c 0d 0a 20 20 20 20 20 20 7b 53 79 73 74 t \.. {Syst
12c10 65 6d 5c 2e 44 61 74 61 5c 2e 53 51 4c 69 74 65 em\.Data\.SQLite
12c20 5c 2e 53 51 4c 69 74 65 45 78 63 65 70 74 69 6f \.SQLiteExceptio
12c30 6e 20 5c 28 30 78 38 30 30 30 34 30 30 35 5c 29 n \(0x80004005\)
12c40 3a 20 28 2e 2b 3f 29 20 20 28 3f 3a 20 29 3f 61 : (.+?) (?: )?a
12c50 74 7d 20 5c 0d 0a 20 20 20 20 20 20 7b 53 79 73 t} \.. {Sys
12c60 74 65 6d 5c 2e 44 61 74 61 5c 2e 53 51 4c 69 74 tem\.Data\.SQLit
12c70 65 5c 2e 53 51 4c 69 74 65 45 78 63 65 70 74 69 e\.SQLiteExcepti
12c80 6f 6e 3a 20 28 2e 2b 3f 29 20 20 28 3f 3a 20 29 on: (.+?) (?: )
12c90 3f 61 74 7d 20 5c 0d 0a 20 20 20 20 20 20 7b 45 ?at} \.. {E
12ca0 61 67 6c 65 5c 2e 5f 43 6f 6d 70 6f 6e 65 6e 74 agle\._Component
12cb0 73 5c 2e 50 75 62 6c 69 63 5c 2e 53 63 72 69 70 s\.Public\.Scrip
12cc0 74 45 78 63 65 70 74 69 6f 6e 3a 20 28 2e 2b 3f tException: (.+?
12cd0 29 20 20 28 3f 3a 20 29 3f 61 74 7d 5d 0d 0a 0d ) (?: )?at}]...
12ce0 0a 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 70 . foreach p
12cf0 61 74 74 65 72 6e 20 24 70 61 74 74 65 72 6e 73 attern $patterns
12d00 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
12d10 5b 72 65 67 65 78 70 20 2d 2d 20 24 70 61 74 74 [regexp -- $patt
12d20 65 72 6e 20 24 76 61 6c 75 65 20 64 75 6d 6d 79 ern $value dummy
12d30 20 6d 65 73 73 61 67 65 5d 7d 20 74 68 65 6e 20 message]} then
12d40 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 {.. set
12d50 20 6d 65 73 73 61 67 65 20 5b 73 74 72 69 6e 67 message [string
12d60 20 6d 61 70 20 5b 6c 69 73 74 20 5c 72 5c 6e 20 map [list \r\n
12d70 5c 6e 5d 20 5b 73 74 72 69 6e 67 20 74 72 69 6d \n] [string trim
12d80 20 24 6d 65 73 73 61 67 65 5d 5d 0d 0a 20 20 20 $message]]..
12d90 20 20 20 20 20 20 20 73 65 74 20 6c 69 6e 65 73 set lines
12da0 20 5b 73 70 6c 69 74 20 24 6d 65 73 73 61 67 65 [split $message
12db0 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 \n]....
12dc0 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 if {[llength $
12dd0 6c 69 6e 65 73 5d 20 3d 3d 20 32 7d 20 74 68 65 lines] == 2} the
12de0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
12df0 20 69 66 20 7b 5b 6c 69 6e 64 65 78 20 24 6c 69 if {[lindex $li
12e00 6e 65 73 20 30 5d 20 65 71 20 5b 6c 69 6e 64 65 nes 0] eq [linde
12e10 78 20 24 6c 69 6e 65 73 20 31 5d 7d 20 74 68 65 x $lines 1]} the
12e20 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
12e30 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 6e 64 65 return [linde
12e40 78 20 24 6c 69 6e 65 73 20 30 5d 0d 0a 20 20 20 x $lines 0]..
12e50 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
12e60 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
12e70 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 6c 69 [appendArgs [li
12e80 6e 64 65 78 20 24 6c 69 6e 65 73 20 30 5d 20 22 ndex $lines 0] "
12e90 20 2d 2d 20 22 20 5b 6c 69 6e 64 65 78 20 24 6c -- " [lindex $l
12ea0 69 6e 65 73 20 31 5d 5d 0d 0a 20 20 20 20 20 20 ines 1]]..
12eb0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
12ec0 20 20 20 72 65 74 75 72 6e 20 24 6d 65 73 73 61 return $messa
12ed0 67 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 ge.. }..
12ee0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
12ef0 72 65 74 75 72 6e 20 24 76 61 6c 75 65 0d 0a 20 return $value..
12f00 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
12f10 63 20 74 72 69 6d 53 71 6c 20 7b 20 73 71 6c 20 c trimSql { sql
12f20 7d 20 7b 0d 0a 20 20 20 20 20 20 72 65 74 75 72 } {.. retur
12f30 6e 20 5b 72 65 67 73 75 62 20 2d 61 6c 6c 20 2d n [regsub -all -
12f40 2d 20 7b 5c 73 2b 7d 20 5b 73 74 72 69 6e 67 20 - {\s+} [string
12f50 74 72 69 6d 20 24 73 71 6c 5d 20 22 20 22 5d 0d trim $sql] " "].
12f60 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
12f70 72 6f 63 20 65 78 65 63 75 74 65 53 71 6c 20 7b roc executeSql {
12f80 20 73 71 6c 20 7b 65 78 65 63 75 74 65 20 6e 6f sql {execute no
12f90 6e 65 7d 20 7b 66 6f 72 6d 61 74 20 6e 6f 6e 65 ne} {format none
12fa0 7d 20 7b 66 69 6c 65 4e 61 6d 65 20 22 22 7d 20 } {fileName ""}
12fb0 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b } {.. if {[
12fc0 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 66 string length $f
12fd0 69 6c 65 4e 61 6d 65 5d 20 3d 3d 20 30 7d 20 74 ileName] == 0} t
12fe0 68 65 6e 20 7b 73 65 74 20 66 69 6c 65 4e 61 6d hen {set fileNam
12ff0 65 20 3a 6d 65 6d 6f 72 79 3a 7d 0d 0a 20 20 20 e :memory:}..
13000 20 20 20 73 65 74 75 70 44 62 20 24 66 69 6c 65 setupDb $file
13010 4e 61 6d 65 20 22 22 20 22 22 20 22 22 20 22 22 Name "" "" "" ""
13020 20 22 22 20 66 61 6c 73 65 20 66 61 6c 73 65 20 "" false false
13030 66 61 6c 73 65 20 66 61 6c 73 65 20 64 62 20 74 false false db t
13040 72 75 65 0d 0a 0d 0a 20 20 20 20 20 20 74 72 79 rue.... try
13050 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 {.. retu
13060 72 6e 20 5b 75 70 6c 65 76 65 6c 20 31 20 5b 6c rn [uplevel 1 [l
13070 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ist \..
13080 20 20 20 73 71 6c 20 65 78 65 63 75 74 65 20 2d sql execute -
13090 65 78 65 63 75 74 65 20 24 65 78 65 63 75 74 65 execute $execute
130a0 20 2d 66 6f 72 6d 61 74 20 24 66 6f 72 6d 61 74 -format $format
130b0 20 24 64 62 20 24 73 71 6c 5d 5d 0d 0a 20 20 20 $db $sql]]..
130c0 20 20 20 7d 20 66 69 6e 61 6c 6c 79 20 7b 0d 0a } finally {..
130d0 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 6e 6e set conn
130e0 65 63 74 69 6f 6e 20 5b 67 65 74 44 62 43 6f 6e ection [getDbCon
130f0 6e 65 63 74 69 6f 6e 5d 0d 0a 0d 0a 20 20 20 20 nection]....
13100 20 20 20 20 74 72 79 20 7b 0d 0a 20 20 20 20 20 try {..
13110 20 20 20 20 20 63 6c 65 61 6e 75 70 44 62 20 24 cleanupDb $
13120 66 69 6c 65 4e 61 6d 65 20 64 62 20 66 61 6c 73 fileName db fals
13130 65 20 66 61 6c 73 65 20 66 61 6c 73 65 0d 0a 20 e false false..
13140 20 20 20 20 20 20 20 7d 20 66 69 6e 61 6c 6c 79 } finally
13150 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 {.. ob
13160 6a 65 63 74 20 66 6c 61 67 73 20 24 63 6f 6e 6e ject flags $conn
13170 65 63 74 69 6f 6e 20 2d 4e 6f 44 69 73 70 6f 73 ection -NoDispos
13180 65 3b 20 66 72 65 65 44 62 43 6f 6e 6e 65 63 74 e; freeDbConnect
13190 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a ion.. }..
131a0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
131b0 0c 0d 0a 20 20 20 20 70 72 6f 63 20 68 61 73 4e ... proc hasN
131c0 6f 46 6c 61 67 73 20 7b 20 76 61 72 4e 61 6d 65 oFlags { varName
131d0 20 6e 6f 6e 65 20 7d 20 7b 0d 0a 20 20 20 20 20 none } {..
131e0 20 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d upvar 1 $varNam
131f0 65 20 66 6c 61 67 73 0d 0a 0d 0a 20 20 20 20 20 e flags....
13200 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
13210 74 73 20 66 6c 61 67 73 5d 7d 20 74 68 65 6e 20 ts flags]} then
13220 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 {.. retur
13230 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d n true.. }.
13240 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 ... if {[st
13250 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 66 6c 61 ring length $fla
13260 67 73 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b gs] == 0} then {
13270 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
13280 20 74 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a true.. }..
13290 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 6e 6f 6e .. if {$non
132a0 65 20 26 26 20 24 66 6c 61 67 73 20 65 71 20 22 e && $flags eq "
132b0 4e 6f 6e 65 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 None"} then {..
132c0 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
132d0 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 ue.. }....
132e0 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 return fals
132f0 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 e.. }.....
13300 20 70 72 6f 63 20 67 65 74 43 6f 6e 6e 65 63 74 proc getConnect
13310 69 6f 6e 46 6c 61 67 73 20 7b 20 66 69 6c 65 4e ionFlags { fileN
13320 61 6d 65 20 66 6c 61 67 73 20 7b 71 75 69 65 74 ame flags {quiet
13330 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 false} } {..
13340 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
13350 54 45 3a 20 46 69 67 75 72 65 20 6f 75 74 20 77 TE: Figure out w
13360 68 69 63 68 20 64 61 74 61 62 61 73 65 20 66 69 hich database fi
13370 6c 65 20 6e 61 6d 65 20 6f 72 20 63 6f 6e 6e 65 le name or conne
13380 63 74 69 6f 6e 20 73 74 72 69 6e 67 20 74 68 65 ction string the
13390 73 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 se.. #
133a0 20 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 connection fla
133b0 67 73 20 77 69 6c 6c 20 61 63 74 75 61 6c 6c 79 gs will actually
133c0 20 61 70 70 6c 79 20 74 6f 2e 20 20 54 68 69 73 apply to. This
133d0 20 69 73 20 6e 6f 74 20 6e 65 63 65 73 73 61 72 is not necessar
133e0 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 y.. #
133f0 20 69 6e 20 71 75 69 65 74 20 6d 6f 64 65 20 62 in quiet mode b
13400 65 63 61 75 73 65 20 74 68 69 73 20 69 6e 66 6f ecause this info
13410 72 6d 61 74 69 6f 6e 20 69 73 20 6f 6e 6c 79 20 rmation is only
13420 75 73 65 64 20 66 6f 72 20 6c 6f 67 67 69 6e 67 used for logging
13430 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
13440 61 6e 64 20 72 65 70 6f 72 74 69 6e 67 20 70 75 and reporting pu
13450 72 70 6f 73 65 73 2e 0d 0a 20 20 20 20 20 20 23 rposes... #
13460 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 .. if {!$qu
13470 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
13480 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
13490 20 6c 65 6e 67 74 68 20 24 66 69 6c 65 4e 61 6d length $fileNam
134a0 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a e] > 0} then {..
134b0 20 20 20 20 20 20 20 20 20 20 73 65 74 20 64 61 set da
134c0 74 61 62 61 73 65 20 5b 61 70 70 65 6e 64 41 72 tabase [appendAr
134d0 67 73 20 22 66 69 6c 65 20 6e 61 6d 65 20 5c 22 gs "file name \"
134e0 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 22 5d 0d " $fileName \"].
134f0 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 69 . } elsei
13500 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
13510 3a 3a 64 61 74 61 53 6f 75 72 63 65 5d 20 26 26 ::dataSource] &&
13520 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
13530 21 5b 61 72 72 61 79 20 65 78 69 73 74 73 20 3a ![array exists :
13540 3a 64 61 74 61 53 6f 75 72 63 65 5d 7d 20 74 68 :dataSource]} th
13550 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
13560 73 65 74 20 64 61 74 61 62 61 73 65 20 5b 61 70 set database [ap
13570 70 65 6e 64 41 72 67 73 20 22 64 61 74 61 20 73 pendArgs "data s
13580 6f 75 72 63 65 20 5c 22 22 20 24 3a 3a 64 61 74 ource \"" $::dat
13590 61 53 6f 75 72 63 65 20 5c 22 5d 0d 0a 20 20 20 aSource \"]..
135a0 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
135b0 20 20 20 20 20 20 20 20 20 73 65 74 20 64 61 74 set dat
135c0 61 62 61 73 65 20 3c 75 6e 6b 6e 6f 77 6e 3e 0d abase <unknown>.
135d0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
135e0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
135f0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 45 76 # NOTE: Ev
13600 65 6e 20 74 68 6f 75 67 68 20 74 68 65 72 65 20 en though there
13610 69 73 20 6f 6e 6c 79 20 6f 6e 65 20 73 6f 75 72 is only one sour
13620 63 65 20 6f 66 20 66 6c 61 67 73 20 73 6f 20 66 ce of flags so f
13630 61 72 2c 20 74 68 65 79 0d 0a 20 20 20 20 20 20 ar, they..
13640 23 20 20 20 20 20 20 20 6d 75 73 74 20 62 65 20 # must be
13650 63 6f 6d 62 69 6e 65 64 20 75 73 69 6e 67 20 74 combined using t
13660 68 65 20 63 6f 72 72 65 63 74 20 73 79 6e 74 61 he correct synta
13670 78 20 66 6f 72 20 65 6e 75 6d 65 72 61 74 65 64 x for enumerated
13680 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
13690 66 6c 61 67 20 76 61 6c 75 65 73 20 66 6f 72 20 flag values for
136a0 74 68 65 20 2e 4e 45 54 20 46 72 61 6d 65 77 6f the .NET Framewo
136b0 72 6b 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 rk... #..
136c0 20 20 20 20 73 65 74 20 66 6c 61 67 73 20 5b 63 set flags [c
136d0 6f 6d 62 69 6e 65 46 6c 61 67 73 20 24 66 6c 61 ombineFlags $fla
136e0 67 73 20 22 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 gs ""]....
136f0 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
13700 20 53 68 6f 77 20 28 61 6e 64 20 6c 6f 67 29 20 Show (and log)
13710 74 68 65 20 6c 6f 63 61 6c 20 63 6f 6e 6e 65 63 the local connec
13720 74 69 6f 6e 20 66 6c 61 67 73 20 61 6e 64 20 74 tion flags and t
13730 68 65 20 61 73 73 6f 63 69 61 74 65 64 0d 0a 20 he associated..
13740 20 20 20 20 20 23 20 20 20 20 20 20 20 64 61 74 # dat
13750 61 20 73 6f 75 72 63 65 20 6f 72 20 66 69 6c 65 a source or file
13760 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 20 23 0d name... #.
13770 0a 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 . if {!$qui
13780 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
13790 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
137a0 78 69 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 4c xists ::no(emitL
137b0 6f 63 61 6c 46 6c 61 67 73 29 5d 20 26 26 20 5c ocalFlags)] && \
137c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 21 .. (!
137d0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
137e0 6f 28 65 6d 69 74 4c 6f 63 61 6c 46 6c 61 67 73 o(emitLocalFlags
137f0 49 66 4e 6f 6e 65 29 5d 20 7c 7c 20 5c 0d 0a 20 IfNone)] || \..
13800 20 20 20 20 20 20 20 20 20 20 20 20 21 5b 68 61 ![ha
13810 73 4e 6f 46 6c 61 67 73 20 66 6c 61 67 73 20 66 sNoFlags flags f
13820 61 6c 73 65 5d 29 7d 20 74 68 65 6e 20 7b 0d 0a alse])} then {..
13830 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
13840 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
13850 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
13860 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
13870 2d 2d 20 6c 6f 63 61 6c 20 63 6f 6e 6e 65 63 74 -- local connect
13880 69 6f 6e 20 66 6c 61 67 73 20 66 6f 72 20 22 20 ion flags for "
13890 24 64 61 74 61 62 61 73 65 20 5c 0d 0a 20 20 20 $database \..
138a0 20 20 20 20 20 20 20 20 20 20 20 22 20 61 72 65 " are
138b0 3a 20 22 20 5b 65 78 70 72 20 7b 21 5b 68 61 73 : " [expr {![has
138c0 4e 6f 46 6c 61 67 73 20 66 6c 61 67 73 20 66 61 NoFlags flags fa
138d0 6c 73 65 5d 20 3f 20 5c 0d 0a 20 20 20 20 20 20 lse] ? \..
138e0 20 20 20 20 20 20 20 20 5b 61 70 70 65 6e 64 41 [appendA
138f0 72 67 73 20 5c 22 20 24 66 6c 61 67 73 20 5c 22 rgs \" $flags \"
13900 5d 20 3a 20 22 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c ] : "<none>"}] \
13910 6e 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 n].. }..
13920 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
13930 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
13940 20 53 68 6f 77 20 28 61 6e 64 20 6c 6f 67 29 20 Show (and log)
13950 74 68 65 20 73 68 61 72 65 64 20 63 6f 6e 6e 65 the shared conne
13960 63 74 69 6f 6e 20 66 6c 61 67 73 2e 0d 0a 20 20 ction flags...
13970 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
13980 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
13990 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 .. if {[c
139a0 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
139b0 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
139c0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
139d0 74 65 2e 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 te.SQLiteConnect
139e0 69 6f 6e 20 53 68 61 72 65 64 46 6c 61 67 73 0d ion SharedFlags.
139f0 0a 20 20 20 20 20 20 20 20 7d 20 73 68 61 72 65 . } share
13a00 64 46 6c 61 67 73 5d 20 3d 3d 20 30 7d 20 74 68 dFlags] == 0} th
13a10 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
13a20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
13a30 73 20 3a 3a 6e 6f 28 65 6d 69 74 53 68 61 72 65 s ::no(emitShare
13a40 64 46 6c 61 67 73 29 5d 20 26 26 20 5c 0d 0a 20 dFlags)] && \..
13a50 20 20 20 20 20 20 20 20 20 20 20 20 20 28 21 5b (![
13a60 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
13a70 28 65 6d 69 74 53 68 61 72 65 64 46 6c 61 67 73 (emitSharedFlags
13a80 49 66 4e 6f 6e 65 29 5d 20 7c 7c 20 5c 0d 0a 20 IfNone)] || \..
13a90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 21 5b ![
13aa0 68 61 73 4e 6f 46 6c 61 67 73 20 73 68 61 72 65 hasNoFlags share
13ab0 64 46 6c 61 67 73 20 74 72 75 65 5d 29 7d 20 74 dFlags true])} t
13ac0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
13ad0 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
13ae0 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
13af0 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
13b00 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 68 "---- sh
13b10 61 72 65 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 ared connection
13b20 66 6c 61 67 73 20 66 6f 72 20 22 20 24 64 61 74 flags for " $dat
13b30 61 62 61 73 65 20 5c 0d 0a 20 20 20 20 20 20 20 abase \..
13b40 20 20 20 20 20 20 20 20 20 22 20 61 72 65 3a 20 " are:
13b50 22 20 5b 65 78 70 72 20 7b 21 5b 68 61 73 4e 6f " [expr {![hasNo
13b60 46 6c 61 67 73 20 73 68 61 72 65 64 46 6c 61 67 Flags sharedFlag
13b70 73 20 74 72 75 65 5d 20 3f 20 5c 0d 0a 20 20 20 s true] ? \..
13b80 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 61 70 [ap
13b90 70 65 6e 64 41 72 67 73 20 5c 22 20 24 73 68 61 pendArgs \" $sha
13ba0 72 65 64 46 6c 61 67 73 20 5c 22 5d 20 3a 20 22 redFlags \"] : "
13bb0 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c 6e 5d 0d 0a 20 <none>"}] \n]..
13bc0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
13bd0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
13be0 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
13bf0 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 fo exists ::no(e
13c00 6d 69 74 53 68 61 72 65 64 46 6c 61 67 73 29 5d mitSharedFlags)]
13c10 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
13c20 20 20 20 20 20 21 5b 69 6e 66 6f 20 65 78 69 73 ![info exis
13c30 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 53 68 61 72 ts ::no(emitShar
13c40 65 64 46 6c 61 67 73 49 66 55 6e 61 76 61 69 6c edFlagsIfUnavail
13c50 61 62 6c 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a able)]} then {..
13c60 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
13c70 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
13c80 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
13c90 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
13ca0 20 22 2d 2d 2d 2d 20 73 68 61 72 65 64 20 63 6f "---- shared co
13cb0 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 66 nnection flags f
13cc0 6f 72 20 22 20 24 64 61 74 61 62 61 73 65 20 5c or " $database \
13cd0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
13ce0 20 20 22 20 61 72 65 3a 20 3c 75 6e 61 76 61 69 " are: <unavai
13cf0 6c 61 62 6c 65 3e 5c 6e 22 5d 0d 0a 20 20 20 20 lable>\n"]..
13d00 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
13d10 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }.. }....
13d20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
13d30 4e 4f 54 45 3a 20 53 68 6f 77 20 28 61 6e 64 20 NOTE: Show (and
13d40 6c 6f 67 29 20 74 68 65 20 64 65 74 65 63 74 65 log) the detecte
13d50 64 20 67 6c 6f 62 61 6c 20 63 6f 6e 6e 65 63 74 d global connect
13d60 69 6f 6e 20 66 6c 61 67 73 2c 20 69 66 20 61 6e ion flags, if an
13d70 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 y... #..
13d80 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
13d90 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
13da0 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
13db0 73 20 3a 3a 6e 6f 28 65 6d 69 74 47 6c 6f 62 61 s ::no(emitGloba
13dc0 6c 46 6c 61 67 73 29 5d 20 26 26 20 5c 0d 0a 20 lFlags)] && \..
13dd0 20 20 20 20 20 20 20 20 20 20 20 28 21 5b 69 6e (![in
13de0 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 fo exists ::no(e
13df0 6d 69 74 47 6c 6f 62 61 6c 46 6c 61 67 73 49 66 mitGlobalFlagsIf
13e00 4e 6f 6e 65 29 5d 20 7c 7c 20 5c 0d 0a 20 20 20 None)] || \..
13e10 20 20 20 20 20 20 20 20 20 20 21 5b 68 61 73 4e ![hasN
13e20 6f 46 6c 61 67 73 20 3a 3a 63 6f 6e 6e 65 63 74 oFlags ::connect
13e30 69 6f 6e 5f 66 6c 61 67 73 20 66 61 6c 73 65 5d ion_flags false]
13e40 29 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 )} then {..
13e50 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
13e60 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
13e70 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
13e80 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 67 6c "---- gl
13e90 6f 62 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 obal connection
13ea0 66 6c 61 67 73 20 61 72 65 3a 20 22 20 5c 0d 0a flags are: " \..
13eb0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 65 [e
13ec0 78 70 72 20 7b 21 5b 68 61 73 4e 6f 46 6c 61 67 xpr {![hasNoFlag
13ed0 73 20 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 s ::connection_f
13ee0 6c 61 67 73 20 66 61 6c 73 65 5d 20 3f 20 5c 0d lags false] ? \.
13ef0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b . [
13f00 61 70 70 65 6e 64 41 72 67 73 20 5c 22 20 24 3a appendArgs \" $:
13f10 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 6c 61 67 :connection_flag
13f20 73 20 5c 22 5d 20 3a 20 22 3c 6e 6f 6e 65 3e 22 s \"] : "<none>"
13f30 7d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 }] \n]..
13f40 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
13f50 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
13f60 4f 54 45 3a 20 49 66 20 74 68 65 72 65 20 61 72 OTE: If there ar
13f70 65 20 61 6e 79 20 67 6c 6f 62 61 6c 20 28 70 65 e any global (pe
13f80 72 20 74 65 73 74 20 72 75 6e 29 20 63 6f 6e 6e r test run) conn
13f90 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 63 75 72 ection flags cur
13fa0 72 65 6e 74 6c 79 0d 0a 20 20 20 20 20 20 23 20 rently.. #
13fb0 20 20 20 20 20 20 73 65 74 2c 20 75 73 65 20 74 set, use t
13fc0 68 65 6d 20 6e 6f 77 20 28 69 2e 65 2e 20 62 79 hem now (i.e. by
13fd0 20 63 6f 6d 62 69 6e 69 6e 67 20 74 68 65 6d 20 combining them
13fe0 77 69 74 68 20 74 68 65 20 6f 6e 65 73 20 66 6f with the ones fo
13ff0 72 20 74 68 69 73 0d 0a 20 20 20 20 20 20 23 20 r this.. #
14000 20 20 20 20 20 20 63 6f 6e 6e 65 63 74 69 6f 6e connection
14010 29 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 )... #..
14020 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 if {[info exi
14030 73 74 73 20 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e sts ::connection
14040 5f 66 6c 61 67 73 5d 7d 20 74 68 65 6e 20 7b 0d _flags]} then {.
14050 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
14060 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 6f 6d 62 # NOTE: Comb
14070 69 6e 65 20 61 6e 64 2f 6f 72 20 72 65 70 6c 61 ine and/or repla
14080 63 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f ce the connectio
14090 6e 20 66 6c 61 67 73 20 61 6e 64 20 74 68 65 6e n flags and then
140a0 20 73 68 6f 77 20 74 68 65 0d 0a 20 20 20 20 20 show the..
140b0 20 20 20 23 20 20 20 20 20 20 20 6e 65 77 20 76 # new v
140c0 61 6c 75 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 alue... #
140d0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 66 6c .. set fl
140e0 61 67 73 20 5b 63 6f 6d 62 69 6e 65 46 6c 61 67 ags [combineFlag
140f0 73 20 24 66 6c 61 67 73 20 24 3a 3a 63 6f 6e 6e s $flags $::conn
14100 65 63 74 69 6f 6e 5f 66 6c 61 67 73 5d 0d 0a 0d ection_flags]...
14110 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
14120 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 # NOTE: Show
14130 20 28 61 6e 64 20 6c 6f 67 29 20 74 68 65 20 6e (and log) the n
14140 65 77 20 65 66 66 65 63 74 69 76 65 20 63 6f 6e ew effective con
14150 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 2e 0d 0a nection flags...
14160 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
14170 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
14180 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
14190 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
141a0 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 43 6f 6d sts ::no(emitCom
141b0 62 69 6e 65 64 46 6c 61 67 73 29 5d 20 26 26 20 binedFlags)] &&
141c0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
141d0 20 28 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 (![info exists
141e0 3a 3a 6e 6f 28 65 6d 69 74 43 6f 6d 62 69 6e 65 ::no(emitCombine
141f0 64 46 6c 61 67 73 49 66 4e 6f 6e 65 29 5d 20 7c dFlagsIfNone)] |
14200 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 | \..
14210 20 20 20 20 21 5b 68 61 73 4e 6f 46 6c 61 67 73 ![hasNoFlags
14220 20 66 6c 61 67 73 20 66 61 6c 73 65 5d 29 7d 20 flags false])}
14230 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
14240 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
14250 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
14260 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
14270 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 "---- c
14280 6f 6d 62 69 6e 65 64 20 63 6f 6e 6e 65 63 74 69 ombined connecti
14290 6f 6e 20 66 6c 61 67 73 20 66 6f 72 20 22 20 24 on flags for " $
142a0 64 61 74 61 62 61 73 65 20 5c 0d 0a 20 20 20 20 database \..
142b0 20 20 20 20 20 20 20 20 20 20 20 20 22 20 61 72 " ar
142c0 65 3a 20 22 20 5b 65 78 70 72 20 7b 21 5b 68 61 e: " [expr {![ha
142d0 73 4e 6f 46 6c 61 67 73 20 66 6c 61 67 73 20 66 sNoFlags flags f
142e0 61 6c 73 65 5d 20 3f 20 5c 0d 0a 20 20 20 20 20 alse] ? \..
142f0 20 20 20 20 20 20 20 20 20 20 20 5b 61 70 70 65 [appe
14300 6e 64 41 72 67 73 20 5c 22 20 24 66 6c 61 67 73 ndArgs \" $flags
14310 20 5c 22 5d 20 3a 20 22 3c 6e 6f 6e 65 3e 22 7d \"] : "<none>"}
14320 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 ] \n]..
14330 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
14340 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
14350 72 65 74 75 72 6e 20 24 66 6c 61 67 73 0d 0a 20 return $flags..
14360 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
14370 63 20 67 65 74 46 6c 61 67 73 50 72 6f 70 65 72 c getFlagsProper
14380 74 79 20 7b 20 7b 66 6c 61 67 73 20 22 22 7d 20 ty { {flags ""}
14390 7b 71 75 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 {quiet false} }
143a0 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
143b0 20 20 23 20 4e 4f 54 45 3a 20 44 65 74 65 72 6d # NOTE: Determ
143c0 69 6e 65 20 77 68 61 74 20 74 68 65 20 63 6f 6d ine what the com
143d0 62 69 6e 65 64 20 28 67 6c 6f 62 61 6c 20 61 6e bined (global an
143e0 64 20 6c 6f 63 61 6c 29 20 63 6f 6e 6e 65 63 74 d local) connect
143f0 69 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ion.. #
14400 20 20 20 66 6c 61 67 73 20 73 68 6f 75 6c 64 20 flags should
14410 62 65 2c 20 70 6f 73 73 69 62 6c 79 20 71 75 69 be, possibly qui
14420 65 74 6c 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a etly... #..
14430 20 20 20 20 20 20 73 65 74 20 66 6c 61 67 73 20 set flags
14440 5b 67 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 46 6c [getConnectionFl
14450 61 67 73 20 22 22 20 24 66 6c 61 67 73 20 24 71 ags "" $flags $q
14460 75 69 65 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 uiet].... #
14470 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
14480 49 66 20 6e 6f 20 67 6c 6f 62 61 6c 20 6f 72 20 If no global or
14490 6c 6f 63 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e local connection
144a0 20 66 6c 61 67 73 20 77 65 72 65 20 73 70 65 63 flags were spec
144b0 69 66 69 65 64 2c 20 74 68 65 0d 0a 20 20 20 20 ified, the..
144c0 20 20 23 20 20 20 20 20 20 20 64 65 66 61 75 6c # defaul
144d0 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 t connection fla
144e0 67 73 20 73 68 6f 75 6c 64 20 62 65 20 75 73 65 gs should be use
144f0 64 3b 20 74 68 65 72 65 66 6f 72 65 2c 20 72 65 d; therefore, re
14500 74 75 72 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 turn.. #
14510 20 20 20 20 61 6e 20 65 6d 70 74 79 20 73 74 72 an empty str
14520 69 6e 67 20 69 6e 20 74 68 61 74 20 63 61 73 65 ing in that case
14530 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
14540 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
14550 6e 67 74 68 20 24 66 6c 61 67 73 5d 20 3d 3d 20 ngth $flags] ==
14560 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
14570 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 return ""..
14580 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 }.... #
14590 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
145a0 49 6e 20 6f 72 64 65 72 20 74 6f 20 63 68 65 63 In order to chec
145b0 6b 20 69 66 20 74 68 65 20 64 65 66 61 75 6c 74 k if the default
145c0 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 connection flag
145d0 73 20 61 72 65 20 62 65 69 6e 67 20 75 73 65 64 s are being used
145e0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
145f0 69 74 20 69 73 20 6e 65 63 65 73 73 61 72 79 20 it is necessary
14600 74 6f 20 61 74 74 65 6d 70 74 20 61 20 63 6f 6e to attempt a con
14610 76 65 72 73 69 6f 6e 20 74 6f 20 74 68 65 20 61 version to the a
14620 63 74 75 61 6c 20 65 6e 75 6d 65 72 61 74 65 64 ctual enumerated
14630 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
14640 74 79 70 65 2e 20 20 46 61 69 6c 69 6e 67 20 74 type. Failing t
14650 68 61 74 2c 20 74 68 65 20 63 68 65 63 6b 20 61 hat, the check a
14660 67 61 69 6e 73 74 20 74 68 65 20 64 65 66 61 75 gainst the defau
14670 6c 74 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 65 lt value will be
14680 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
14690 73 6b 69 70 70 65 64 2e 0d 0a 20 20 20 20 20 20 skipped...
146a0 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 #.. if {[ca
146b0 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 tch {.. s
146c0 65 74 20 65 72 72 6f 72 20 6e 75 6c 6c 3b 20 23 et error null; #
146d0 20 49 47 4e 4f 52 45 44 0d 0a 0d 0a 20 20 20 20 IGNORED....
146e0 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b object invok
146f0 65 20 55 74 69 6c 69 74 79 20 54 72 79 50 61 72 e Utility TryPar
14700 73 65 46 6c 61 67 73 45 6e 75 6d 20 22 22 20 5c seFlagsEnum "" \
14710 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 79 .. Sy
14720 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
14730 2e 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f .SQLiteConnectio
14740 6e 46 6c 61 67 73 20 22 22 20 24 66 6c 61 67 73 nFlags "" $flags
14750 20 6e 75 6c 6c 20 74 72 75 65 20 5c 0d 0a 20 20 null true \..
14760 20 20 20 20 20 20 20 20 20 20 74 72 75 65 20 74 true t
14770 72 75 65 20 65 72 72 6f 72 0d 0a 20 20 20 20 20 rue error..
14780 20 7d 20 76 61 6c 75 65 5d 7d 20 74 68 65 6e 20 } value]} then
14790 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
147a0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 # NOTE: At
147b0 74 65 6d 70 74 69 6e 67 20 74 6f 20 70 61 72 73 tempting to pars
147c0 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e e the connection
147d0 20 66 6c 61 67 73 20 63 61 75 73 65 64 20 61 20 flags caused a
147e0 73 63 72 69 70 74 0d 0a 20 20 20 20 20 20 20 20 script..
147f0 23 20 20 20 20 20 20 20 65 72 72 6f 72 2e 20 20 # error.
14800 45 6d 69 74 20 61 20 77 61 72 6e 69 6e 67 20 74 Emit a warning t
14810 6f 20 74 68 65 20 74 65 73 74 20 6c 6f 67 20 66 o the test log f
14820 69 6c 65 20 61 6e 64 20 63 6f 6e 74 69 6e 75 65 ile and continue
14830 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
14840 20 20 75 73 69 6e 67 20 61 6e 20 65 6d 74 70 79 using an emtpy
14850 20 73 74 72 69 6e 67 20 69 6e 73 74 65 61 64 2e string instead.
14860 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
14870 20 20 20 20 20 74 6c 6f 67 20 5b 61 70 70 65 6e tlog [appen
14880 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
14890 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 "==== WARNI
148a0 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 70 61 NG: failed to pa
148b0 72 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 rse connection f
148c0 6c 61 67 73 2c 20 65 72 72 6f 72 3a 20 22 20 5c lags, error: " \
148d0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5c 6e .. \n
148e0 5c 74 20 24 76 61 6c 75 65 20 5c 6e 5d 0d 0a 0d \t $value \n]...
148f0 0a 20 20 20 20 20 20 20 20 73 65 74 20 76 61 6c . set val
14900 75 65 20 22 22 0d 0a 20 20 20 20 20 20 7d 0d 0a ue "".. }..
14910 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
14920 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 # NOTE: If the
14930 63 6f 6d 62 69 6e 65 64 20 66 6c 61 67 73 20 73 combined flags s
14940 74 72 69 6e 67 20 63 6f 75 6c 64 20 6e 6f 74 20 tring could not
14950 61 63 74 75 61 6c 6c 79 20 62 65 20 63 6f 6e 76 actually be conv
14960 65 72 74 65 64 0d 0a 20 20 20 20 20 20 23 20 20 erted.. #
14970 20 20 20 20 20 74 6f 20 74 68 65 20 65 6e 75 6d to the enum
14980 65 72 61 74 65 64 20 74 79 70 65 20 69 74 20 69 erated type it i
14990 73 20 74 68 65 20 64 65 66 61 75 6c 74 20 76 61 s the default va
149a0 6c 75 65 2c 20 74 68 65 6e 20 6a 75 73 74 20 75 lue, then just u
149b0 73 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 se.. #
149c0 20 20 69 74 20 76 65 72 62 61 74 69 6d 3b 20 6f it verbatim; o
149d0 74 68 65 72 77 69 73 65 2c 20 6a 75 73 74 20 72 therwise, just r
149e0 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 73 eturn an empty s
149f0 74 72 69 6e 67 2e 20 20 49 6e 20 74 68 61 74 0d tring. In that.
14a00 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 . # c
14a10 61 73 65 2c 20 74 68 65 20 64 65 66 61 75 6c 74 ase, the default
14a20 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 connection flag
14a30 73 20 77 69 6c 6c 20 62 65 20 75 73 65 64 2e 0d s will be used..
14a40 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
14a50 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
14a60 74 68 20 24 76 61 6c 75 65 5d 20 3d 3d 20 30 20 th $value] == 0
14a70 7c 7c 20 24 76 61 6c 75 65 20 6e 65 20 22 44 65 || $value ne "De
14a80 66 61 75 6c 74 22 7d 20 74 68 65 6e 20 7b 0d 0a fault"} then {..
14a90 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
14aa0 20 20 20 23 20 57 41 52 4e 49 4e 47 3a 20 54 68 # WARNING: Th
14ab0 69 73 20 72 65 74 75 72 6e 73 20 74 68 65 20 73 is returns the s
14ac0 74 72 69 6e 67 20 76 61 6c 75 65 20 6f 66 20 74 tring value of t
14ad0 68 65 20 63 6f 6d 62 69 6e 65 64 20 66 6c 61 67 he combined flag
14ae0 73 2c 20 6e 6f 74 0d 0a 20 20 20 20 20 20 20 20 s, not..
14af0 23 20 20 20 20 20 20 20 20 20 20 74 68 65 20 65 # the e
14b00 6e 75 6d 65 72 61 74 65 64 20 76 61 6c 75 65 2e numerated value.
14b10 20 20 54 68 69 73 20 69 73 20 62 79 20 64 65 73 This is by des
14b20 69 67 6e 20 61 6e 64 20 73 68 6f 75 6c 64 20 6e ign and should n
14b30 6f 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ot.. #
14b40 20 20 20 20 20 20 20 62 65 20 63 68 61 6e 67 65 be change
14b50 64 20 77 69 74 68 6f 75 74 20 63 61 72 65 66 75 d without carefu
14b60 6c 20 63 6f 6e 73 69 64 65 72 61 74 69 6f 6e 20 l consideration
14b70 28 65 2e 67 2e 20 69 74 20 77 6f 75 6c 64 0d 0a (e.g. it would..
14b80 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
14b90 20 20 20 70 72 65 76 65 6e 74 20 74 68 65 20 53 prevent the S
14ba0 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 20 QLiteConnection
14bb0 63 6c 61 73 73 20 66 72 6f 6d 20 61 6c 6c 6f 77 class from allow
14bc0 69 6e 67 20 69 6e 76 61 6c 69 64 0d 0a 20 20 20 ing invalid..
14bd0 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 #
14be0 5b 22 6d 61 67 69 63 61 6c 22 5d 20 6d 65 74 61 ["magical"] meta
14bf0 2d 66 6c 61 67 73 29 2e 0d 0a 20 20 20 20 20 20 -flags)...
14c00 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
14c10 75 72 6e 20 5b 61 70 70 65 6e 64 41 72 67 73 20 urn [appendArgs
14c20 22 46 6c 61 67 73 3d 22 20 24 66 6c 61 67 73 20 "Flags=" $flags
14c30 5c 3b 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a \;].. }....
14c40 20 20 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d return "".
14c50 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
14c60 72 6f 63 20 65 6e 61 62 6c 65 53 68 61 72 65 64 roc enableShared
14c70 43 61 63 68 65 20 7b 20 63 68 61 6e 6e 65 6c 20 Cache { channel
14c80 65 6e 61 62 6c 65 20 7b 71 75 69 65 74 20 66 61 enable {quiet fa
14c90 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 lse} } {..
14ca0 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 if {[catch {..
14cb0 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 object inv
14cc0 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 oke -flags +NonP
14cd0 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 ublic \..
14ce0 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
14cf0 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e 61 .SQLite.UnsafeNa
14d00 74 69 76 65 4d 65 74 68 6f 64 73 20 5c 0d 0a 20 tiveMethods \..
14d10 20 20 20 20 20 20 20 20 20 20 20 73 71 6c 69 74 sqlit
14d20 65 33 5f 65 6e 61 62 6c 65 5f 73 68 61 72 65 64 e3_enable_shared
14d30 5f 63 61 63 68 65 20 5b 65 78 70 72 20 69 6e 74 _cache [expr int
14d40 28 24 65 6e 61 62 6c 65 29 5d 0d 0a 20 20 20 20 ($enable)]..
14d50 20 20 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 30 } result] == 0
14d60 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
14d70 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
14d80 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
14d90 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
14da0 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
14db0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
14dc0 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 5f -- call sqlite3_
14dd0 65 6e 61 62 6c 65 5f 73 68 61 72 65 64 5f 63 61 enable_shared_ca
14de0 63 68 65 28 22 20 24 65 6e 61 62 6c 65 20 5c 0d che(" $enable \.
14df0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
14e00 29 2e 2e 2e 20 6f 6b 3a 20 22 20 24 72 65 73 75 )... ok: " $resu
14e10 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 lt \n]..
14e20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 }.. } else
14e30 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 {.. if {!
14e40 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
14e50 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
14e60 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
14e70 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
14e80 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 61 6c 6c "---- call
14e90 20 73 71 6c 69 74 65 33 5f 65 6e 61 62 6c 65 5f sqlite3_enable_
14ea0 73 68 61 72 65 64 5f 63 61 63 68 65 28 22 20 24 shared_cache(" $
14eb0 65 6e 61 62 6c 65 20 5c 0d 0a 20 20 20 20 20 20 enable \..
14ec0 20 20 20 20 20 20 20 20 22 29 2e 2e 2e 20 65 72 ")... er
14ed0 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 72 65 73 ror: " \n\t $res
14ee0 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ult \n]..
14ef0 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 }.. }..
14f00 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
14f10 73 65 74 75 70 44 62 20 7b 0d 0a 20 20 20 20 20 setupDb {..
14f20 20 20 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 fileName
14f30 7b 6d 6f 64 65 20 22 22 7d 20 7b 64 61 74 65 54 {mode ""} {dateT
14f40 69 6d 65 46 6f 72 6d 61 74 20 22 22 7d 20 7b 64 imeFormat ""} {d
14f50 61 74 65 54 69 6d 65 4b 69 6e 64 20 22 22 7d 20 ateTimeKind ""}
14f60 7b 66 6c 61 67 73 20 22 22 7d 0d 0a 20 20 20 20 {flags ""}..
14f70 20 20 20 20 20 20 20 20 7b 65 78 74 72 61 20 22 {extra "
14f80 22 7d 20 7b 71 75 61 6c 69 66 79 20 74 72 75 65 "} {qualify true
14f90 7d 20 7b 64 65 6c 65 74 65 20 74 72 75 65 7d 20 } {delete true}
14fa0 7b 75 72 69 20 66 61 6c 73 65 7d 0d 0a 20 20 20 {uri false}..
14fb0 20 20 20 20 20 20 20 20 20 7b 74 65 6d 70 6f 72 {tempor
14fc0 61 72 79 20 74 72 75 65 7d 20 7b 76 61 72 4e 61 ary true} {varNa
14fd0 6d 65 20 64 62 7d 20 7b 71 75 69 65 74 20 66 61 me db} {quiet fa
14fe0 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 lse} } {..
14ff0 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
15000 20 46 69 72 73 74 2c 20 73 65 65 20 69 66 20 6f First, see if o
15010 75 72 20 63 61 6c 6c 65 72 20 68 61 73 20 72 65 ur caller has re
15020 71 75 65 73 74 65 64 20 61 6e 20 69 6e 2d 6d 65 quested an in-me
15030 6d 6f 72 79 20 64 61 74 61 62 61 73 65 2e 0d 0a mory database...
15040 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 #.. s
15050 65 74 20 69 73 4d 65 6d 6f 72 79 20 5b 69 73 4d et isMemory [isM
15060 65 6d 6f 72 79 44 62 20 24 66 69 6c 65 4e 61 6d emoryDb $fileNam
15070 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 e].... #..
15080 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 6f 72 # NOTE: For
15090 20 6e 6f 77 2c 20 61 6c 6c 20 74 65 73 74 20 64 now, all test d
150a0 61 74 61 62 61 73 65 73 20 75 73 65 64 20 62 79 atabases used by
150b0 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 20 the test suite
150c0 61 72 65 20 70 6c 61 63 65 64 0d 0a 20 20 20 20 are placed..
150d0 20 20 23 20 20 20 20 20 20 20 69 6e 74 6f 20 74 # into t
150e0 68 65 20 64 61 74 61 62 61 73 65 20 64 69 72 65 he database dire
150f0 63 74 6f 72 79 2e 20 20 45 61 63 68 20 64 61 74 ctory. Each dat
15100 61 62 61 73 65 20 61 6e 64 20 72 65 6c 61 74 65 abase and relate
15110 64 20 66 69 6c 65 73 0d 0a 20 20 20 20 20 20 23 d files.. #
15120 20 20 20 20 20 20 20 75 73 65 64 20 62 79 20 61 used by a
15130 20 74 65 73 74 20 73 68 6f 75 6c 64 20 62 65 20 test should be
15140 63 6c 65 61 6e 65 64 20 75 70 20 62 79 20 74 68 cleaned up by th
15150 61 74 20 74 65 73 74 20 75 73 69 6e 67 20 74 68 at test using th
15160 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
15170 20 22 63 6c 65 61 6e 75 70 44 62 22 20 70 72 6f "cleanupDb" pro
15180 63 65 64 75 72 65 2c 20 62 65 6c 6f 77 2e 0d 0a cedure, below...
15190 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
151a0 66 20 7b 21 24 69 73 4d 65 6d 6f 72 79 20 26 26 f {!$isMemory &&
151b0 20 24 71 75 61 6c 69 66 79 7d 20 74 68 65 6e 20 $qualify} then
151c0 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 66 {.. set f
151d0 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f ileName [file jo
151e0 69 6e 20 5b 67 65 74 44 61 74 61 62 61 73 65 44 in [getDatabaseD
151f0 69 72 65 63 74 6f 72 79 5d 20 5b 66 69 6c 65 20 irectory] [file
15200 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d 65 5d 5d tail $fileName]]
15210 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
15220 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
15230 54 45 3a 20 42 79 20 64 65 66 61 75 6c 74 2c 20 TE: By default,
15240 64 65 6c 65 74 65 20 61 6e 79 20 70 72 65 2d 65 delete any pre-e
15250 78 69 73 74 69 6e 67 20 64 61 74 61 62 61 73 65 xisting database
15260 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 66 with the same f
15270 69 6c 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ile.. #
15280 20 20 20 6e 61 6d 65 20 69 66 20 69 74 20 63 75 name if it cu
15290 72 72 65 6e 74 6c 79 20 65 78 69 73 74 73 2e 0d rrently exists..
152a0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
152b0 69 66 20 7b 21 24 69 73 4d 65 6d 6f 72 79 20 26 if {!$isMemory &
152c0 26 20 24 64 65 6c 65 74 65 20 26 26 20 5b 66 69 & $delete && [fi
152d0 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e le exists $fileN
152e0 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ame]} then {..
152f0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
15300 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 # NOTE: Attempt
15310 20 74 6f 20 64 65 6c 65 74 65 20 61 6e 79 20 70 to delete any p
15320 72 65 2d 65 78 69 73 74 69 6e 67 20 64 61 74 61 re-existing data
15330 62 61 73 65 20 77 69 74 68 20 74 68 65 20 73 61 base with the sa
15340 6d 65 20 66 69 6c 65 0d 0a 20 20 20 20 20 20 20 me file..
15350 20 23 20 20 20 20 20 20 20 6e 61 6d 65 2e 0d 0a # name...
15360 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
15370 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 66 if {[catch {f
15380 69 6c 65 20 64 65 6c 65 74 65 20 24 66 69 6c 65 ile delete $file
15390 4e 61 6d 65 7d 20 65 72 72 6f 72 5d 7d 20 74 68 Name} error]} th
153a0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
153b0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
153c0 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 20 OTE: We somehow
153d0 66 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 failed to delete
153e0 20 74 68 65 20 66 69 6c 65 2c 20 72 65 70 6f 72 the file, repor
153f0 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 20 t why...
15400 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 #.. i
15410 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
15420 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
15430 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
15440 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
15450 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
15460 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 "==== WARNI
15470 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 64 65 NG: failed to de
15480 6c 65 74 65 20 64 61 74 61 62 61 73 65 20 66 69 lete database fi
15490 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 le \"" $fileName
154a0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
154b0 20 20 20 20 22 5c 22 20 64 75 72 69 6e 67 20 73 "\" during s
154c0 65 74 75 70 2c 20 65 72 72 6f 72 3a 20 22 20 5c etup, error: " \
154d0 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a n\t $error \n]..
154e0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
154f0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d }.. }.
15500 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
15510 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 20 # NOTE: Refer
15520 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 64 to the specified
15530 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e 20 variable (e.g.
15540 22 64 62 22 29 20 69 6e 20 74 68 65 20 63 6f 6e "db") in the con
15550 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a 20 20 20 text of our..
15560 20 20 20 23 20 20 20 20 20 20 20 63 61 6c 6c 65 # calle
15570 72 2e 20 20 54 68 65 20 68 61 6e 64 6c 65 20 74 r. The handle t
15580 6f 20 74 68 65 20 6f 70 65 6e 65 64 20 64 61 74 o the opened dat
15590 61 62 61 73 65 20 77 69 6c 6c 20 62 65 20 73 74 abase will be st
155a0 6f 72 65 64 20 74 68 65 72 65 2e 0d 0a 20 20 20 ored there...
155b0 20 20 20 23 0d 0a 20 20 20 20 20 20 75 70 76 61 #.. upva
155c0 72 20 31 20 24 76 61 72 4e 61 6d 65 20 64 62 0d r 1 $varName db.
155d0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
155e0 20 20 23 20 4e 4f 54 45 3a 20 53 74 61 72 74 20 # NOTE: Start
155f0 62 75 69 6c 64 69 6e 67 20 74 68 65 20 63 6f 6e building the con
15600 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 2e 20 nection string.
15610 20 54 68 65 20 6f 6e 6c 79 20 72 65 71 75 69 72 The only requir
15620 65 64 20 70 6f 72 74 69 6f 6e 0d 0a 20 20 20 20 ed portion..
15630 20 20 23 20 20 20 20 20 20 20 6f 66 20 74 68 65 # of the
15640 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 connection stri
15650 6e 67 20 69 73 20 74 68 65 20 64 61 74 61 20 73 ng is the data s
15660 6f 75 72 63 65 2c 20 77 68 69 63 68 20 63 6f 6e ource, which con
15670 74 61 69 6e 73 20 74 68 65 0d 0a 20 20 20 20 20 tains the..
15680 20 23 20 20 20 20 20 20 20 64 61 74 61 62 61 73 # databas
15690 65 20 66 69 6c 65 20 6e 61 6d 65 20 69 74 73 65 e file name itse
156a0 6c 66 2e 20 20 49 66 20 6f 75 72 20 63 61 6c 6c lf. If our call
156b0 65 72 20 77 61 6e 74 73 20 74 6f 20 75 73 65 20 er wants to use
156c0 61 20 55 52 49 20 61 73 0d 0a 20 20 20 20 20 20 a URI as..
156d0 23 20 20 20 20 20 20 20 74 68 65 20 64 61 74 61 # the data
156e0 20 73 6f 75 72 63 65 2c 20 75 73 65 20 74 68 65 source, use the
156f0 20 46 75 6c 6c 55 72 69 20 63 6f 6e 6e 65 63 74 FullUri connect
15700 69 6f 6e 20 73 74 72 69 6e 67 20 70 72 6f 70 65 ion string prope
15710 72 74 79 20 74 6f 0d 0a 20 20 20 20 20 20 23 20 rty to.. #
15720 20 20 20 20 20 20 70 72 65 76 65 6e 74 20 74 68 prevent th
15730 65 20 64 61 74 61 20 73 6f 75 72 63 65 20 73 74 e data source st
15740 72 69 6e 67 20 66 72 6f 6d 20 62 65 69 6e 67 20 ring from being
15750 6d 61 6e 67 6c 65 64 2e 0d 0a 20 20 20 20 20 20 mangled...
15760 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 75 72 #.. if {$ur
15770 69 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 i} then {..
15780 20 20 20 73 65 74 20 63 6f 6e 6e 65 63 74 69 6f set connectio
15790 6e 20 7b 46 75 6c 6c 55 72 69 3d 24 7b 66 69 6c n {FullUri=${fil
157a0 65 4e 61 6d 65 7d 7d 0d 0a 20 20 20 20 20 20 7d eName}}.. }
157b0 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
157c0 20 73 65 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 set connection
157d0 7b 44 61 74 61 20 53 6f 75 72 63 65 3d 24 7b 66 {Data Source=${f
157e0 69 6c 65 4e 61 6d 65 7d 7d 0d 0a 20 20 20 20 20 ileName}}..
157f0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
15800 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 69 6e # NOTE: Sin
15810 63 65 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 ce this procedur
15820 65 20 68 61 73 20 6e 6f 20 73 70 65 63 69 61 6c e has no special
15830 20 6b 6e 6f 77 6c 65 64 67 65 20 6f 66 20 77 68 knowledge of wh
15840 61 74 20 74 68 65 20 64 65 66 61 75 6c 74 0d 0a at the default..
15850 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 65 # se
15860 74 74 69 6e 67 20 69 73 20 66 6f 72 20 74 68 65 tting is for the
15870 20 54 6f 46 75 6c 6c 50 61 74 68 20 63 6f 6e 6e ToFullPath conn
15880 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 20 70 72 ection string pr
15890 6f 70 65 72 79 2c 20 61 6c 77 61 79 73 0d 0a 20 opery, always..
158a0 20 20 20 20 20 23 20 20 20 20 20 20 20 61 64 64 # add
158b0 20 74 68 65 20 76 61 6c 75 65 20 77 65 20 6b 6e the value we kn
158c0 6f 77 20 61 62 6f 75 74 20 74 6f 20 74 68 65 20 ow about to the
158d0 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e connection strin
158e0 67 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 g... #..
158f0 20 20 20 61 70 70 65 6e 64 20 63 6f 6e 6e 65 63 append connec
15900 74 69 6f 6e 20 7b 3b 54 6f 46 75 6c 6c 50 61 74 tion {;ToFullPat
15910 68 3d 24 7b 71 75 61 6c 69 66 79 7d 7d 0d 0a 0d h=${qualify}}...
15920 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
15930 23 20 4e 4f 54 45 3a 20 49 66 20 6f 75 72 20 63 # NOTE: If our c
15940 61 6c 6c 65 72 20 73 70 65 63 69 66 69 65 64 20 aller specified
15950 61 20 6a 6f 75 72 6e 61 6c 20 6d 6f 64 65 2c 20 a journal mode,
15960 61 64 64 20 74 68 65 20 6e 65 63 65 73 73 61 72 add the necessar
15970 79 20 70 6f 72 74 69 6f 6e 0d 0a 20 20 20 20 20 y portion..
15980 20 23 20 20 20 20 20 20 20 6f 66 20 74 68 65 20 # of the
15990 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e connection strin
159a0 67 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 23 0d g now... #.
159b0 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 . if {[stri
159c0 6e 67 20 6c 65 6e 67 74 68 20 24 6d 6f 64 65 5d ng length $mode]
159d0 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
159e0 20 20 20 20 20 20 61 70 70 65 6e 64 20 63 6f 6e append con
159f0 6e 65 63 74 69 6f 6e 20 7b 3b 4a 6f 75 72 6e 61 nection {;Journa
15a00 6c 20 4d 6f 64 65 3d 24 7b 6d 6f 64 65 7d 7d 0d l Mode=${mode}}.
15a10 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
15a20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
15a30 45 3a 20 49 66 20 6f 75 72 20 63 61 6c 6c 65 72 E: If our caller
15a40 20 73 70 65 63 69 66 69 65 64 20 61 20 44 61 74 specified a Dat
15a50 65 54 69 6d 65 20 66 6f 72 6d 61 74 2c 20 61 64 eTime format, ad
15a60 64 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 0d d the necessary.
15a70 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 70 . # p
15a80 6f 72 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 6f ortion of the co
15a90 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 20 nnection string
15aa0 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 now... #..
15ab0 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
15ac0 20 6c 65 6e 67 74 68 20 24 64 61 74 65 54 69 6d length $dateTim
15ad0 65 46 6f 72 6d 61 74 5d 20 3e 20 30 7d 20 74 68 eFormat] > 0} th
15ae0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 70 en {.. ap
15af0 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 pend connection
15b00 7b 3b 44 61 74 65 54 69 6d 65 46 6f 72 6d 61 74 {;DateTimeFormat
15b10 3d 24 7b 64 61 74 65 54 69 6d 65 46 6f 72 6d 61 =${dateTimeForma
15b20 74 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a t}}.. }....
15b30 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
15b40 20 4e 4f 54 45 3a 20 49 66 20 6f 75 72 20 63 61 NOTE: If our ca
15b50 6c 6c 65 72 20 73 70 65 63 69 66 69 65 64 20 61 ller specified a
15b60 20 44 61 74 65 54 69 6d 65 4b 69 6e 64 2c 20 61 DateTimeKind, a
15b70 64 64 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 dd the necessary
15b80 20 70 6f 72 74 69 6f 6e 0d 0a 20 20 20 20 20 20 portion..
15b90 23 20 20 20 20 20 20 20 6f 66 20 74 68 65 20 63 # of the c
15ba0 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 onnection string
15bb0 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 23 0d 0a now... #..
15bc0 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
15bd0 67 20 6c 65 6e 67 74 68 20 24 64 61 74 65 54 69 g length $dateTi
15be0 6d 65 4b 69 6e 64 5d 20 3e 20 30 7d 20 74 68 65 meKind] > 0} the
15bf0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 70 70 n {.. app
15c00 65 6e 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 7b end connection {
15c10 3b 44 61 74 65 54 69 6d 65 4b 69 6e 64 3d 24 7b ;DateTimeKind=${
15c20 64 61 74 65 54 69 6d 65 4b 69 6e 64 7d 7d 0d 0a dateTimeKind}}..
15c30 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
15c40 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
15c50 3a 20 46 69 67 75 72 65 20 6f 75 74 20 77 68 61 : Figure out wha
15c60 74 20 74 68 65 20 66 69 6e 61 6c 20 66 6c 61 67 t the final flag
15c70 73 20 66 6f 72 20 74 68 69 73 20 63 6f 6e 6e 65 s for this conne
15c80 63 74 69 6f 6e 20 6e 65 65 64 20 74 6f 20 62 65 ction need to be
15c90 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
15ca0 20 20 73 65 74 20 66 6c 61 67 73 20 5b 67 65 74 set flags [get
15cb0 43 6f 6e 6e 65 63 74 69 6f 6e 46 6c 61 67 73 20 ConnectionFlags
15cc0 24 66 69 6c 65 4e 61 6d 65 20 24 66 6c 61 67 73 $fileName $flags
15cd0 20 24 71 75 69 65 74 5d 0d 0a 0d 0a 20 20 20 20 $quiet]....
15ce0 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
15cf0 45 3a 20 49 66 20 6f 75 72 20 63 61 6c 6c 65 72 E: If our caller
15d00 20 73 70 65 63 69 66 69 65 64 20 73 6f 6d 65 20 specified some
15d10 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e SQLiteConnection
15d20 46 6c 61 67 73 2c 20 61 64 64 20 74 68 65 0d 0a Flags, add the..
15d30 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6e 65 # ne
15d40 63 65 73 73 61 72 79 20 70 6f 72 74 69 6f 6e 20 cessary portion
15d50 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f of the connectio
15d60 6e 20 73 74 72 69 6e 67 20 6e 6f 77 2e 0d 0a 20 n string now...
15d70 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
15d80 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
15d90 20 24 66 6c 61 67 73 5d 20 3e 20 30 7d 20 74 68 $flags] > 0} th
15da0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 70 en {.. ap
15db0 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 pend connection
15dc0 7b 3b 46 6c 61 67 73 3d 24 7b 66 6c 61 67 73 7d {;Flags=${flags}
15dd0 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
15de0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
15df0 4f 54 45 3a 20 49 66 20 6f 75 72 20 63 61 6c 6c OTE: If our call
15e00 65 72 20 73 70 65 63 69 66 69 65 64 20 61 6e 20 er specified an
15e10 65 78 74 72 61 20 70 61 79 6c 6f 61 64 20 74 6f extra payload to
15e20 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 0d the connection.
15e30 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 . # s
15e40 74 72 69 6e 67 2c 20 61 70 70 65 6e 64 20 69 74 tring, append it
15e50 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 23 0d 0a now... #..
15e60 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
15e70 67 20 6c 65 6e 67 74 68 20 24 65 78 74 72 61 5d g length $extra]
15e80 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
15e90 20 20 20 20 20 20 61 70 70 65 6e 64 20 63 6f 6e append con
15ea0 6e 65 63 74 69 6f 6e 20 5c 3b 20 24 65 78 74 72 nection \; $extr
15eb0 61 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 a.. }....
15ec0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
15ed0 4f 54 45 3a 20 46 6f 72 20 63 6c 61 72 69 74 79 OTE: For clarity
15ee0 2c 20 61 70 70 65 6e 64 20 61 20 66 69 6e 61 6c , append a final
15ef0 20 73 65 6d 69 63 6f 6c 6f 6e 20 74 6f 20 74 68 semicolon to th
15f00 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 e connection str
15f10 69 6e 67 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ing... #..
15f20 20 20 20 20 20 61 70 70 65 6e 64 20 63 6f 6e 6e append conn
15f30 65 63 74 69 6f 6e 20 5c 3b 0d 0a 0d 0a 20 20 20 ection \;....
15f40 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
15f50 54 45 3a 20 4f 70 65 6e 20 74 68 65 20 64 61 74 TE: Open the dat
15f60 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e abase connection
15f70 20 6e 6f 77 2c 20 70 6c 61 63 69 6e 67 20 74 68 now, placing th
15f80 65 20 6f 70 61 71 75 65 20 68 61 6e 64 6c 65 20 e opaque handle
15f90 76 61 6c 75 65 0d 0a 20 20 20 20 20 20 23 20 20 value.. #
15fa0 20 20 20 20 20 69 6e 74 6f 20 74 68 65 20 76 61 into the va
15fb0 72 69 61 62 6c 65 20 73 70 65 63 69 66 69 65 64 riable specified
15fc0 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d by our caller..
15fd0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
15fe0 73 65 74 20 64 62 20 5b 73 71 6c 20 6f 70 65 6e set db [sql open
15ff0 20 2d 74 79 70 65 20 53 51 4c 69 74 65 20 5b 73 -type SQLite [s
16000 75 62 73 74 20 24 63 6f 6e 6e 65 63 74 69 6f 6e ubst $connection
16010 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ]].... #..
16020 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 6f 6e # NOTE: Con
16030 66 69 67 75 72 65 20 74 68 65 20 74 65 6d 70 6f figure the tempo
16040 72 61 72 79 20 64 69 72 65 63 74 6f 72 79 20 66 rary directory f
16050 6f 72 20 74 68 65 20 6e 65 77 6c 79 20 6f 70 65 or the newly ope
16060 6e 65 64 20 64 61 74 61 62 61 73 65 0d 0a 20 20 ned database..
16070 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 6e # conn
16080 65 63 74 69 6f 6e 20 6e 6f 77 20 75 6e 6c 65 73 ection now unles
16090 73 20 6f 75 72 20 63 61 6c 6c 65 72 20 66 6f 72 s our caller for
160a0 62 69 64 73 20 69 74 2e 0d 0a 20 20 20 20 20 20 bids it...
160b0 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 74 65 #.. if {$te
160c0 6d 70 6f 72 61 72 79 20 26 26 20 21 5b 69 6e 66 mporary && ![inf
160d0 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 73 65 o exists ::no(se
160e0 74 54 65 6d 70 6f 72 61 72 79 44 69 72 65 63 74 tTemporaryDirect
160f0 6f 72 79 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 ory)]} then {..
16100 20 20 20 20 20 20 20 73 71 6c 20 65 78 65 63 75 sql execu
16110 74 65 20 24 64 62 20 5b 61 70 70 65 6e 64 41 72 te $db [appendAr
16120 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
16130 20 20 22 50 52 41 47 4d 41 20 74 65 6d 70 5f 73 "PRAGMA temp_s
16140 74 6f 72 65 5f 64 69 72 65 63 74 6f 72 79 20 3d tore_directory =
16150 20 5c 22 22 20 5b 67 65 74 54 65 6d 70 6f 72 61 \"" [getTempora
16160 72 79 44 69 72 65 63 74 6f 72 79 5d 20 5c 22 5c ryDirectory] \"\
16170 3b 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 ;].. }....
16180 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
16190 4e 4f 54 45 3a 20 50 65 72 66 6f 72 6d 20 61 6e NOTE: Perform an
161a0 79 20 65 78 74 72 61 20 70 65 72 2d 63 6f 6e 6e y extra per-conn
161b0 65 63 74 69 6f 6e 20 73 65 74 75 70 20 66 6f 72 ection setup for
161c0 20 74 68 65 20 6e 65 77 6c 79 20 6f 70 65 6e 65 the newly opene
161d0 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 d.. #
161e0 20 64 61 74 61 62 61 73 65 20 6e 6f 77 20 75 6e database now un
161f0 6c 65 73 73 20 6f 75 72 20 63 61 6c 6c 65 72 20 less our caller
16200 66 6f 72 62 69 64 73 20 69 74 2e 0d 0a 20 20 20 forbids it...
16210 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 #.. set
16220 65 78 65 63 75 74 65 4f 6e 53 65 74 75 70 20 5b executeOnSetup [
16230 67 65 74 45 78 65 63 75 74 65 4f 6e 53 65 74 75 getExecuteOnSetu
16240 70 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b p].... if {
16250 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
16260 65 78 65 63 75 74 65 4f 6e 53 65 74 75 70 5d 20 executeOnSetup]
16270 3e 20 30 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 > 0 && \..
16280 20 20 20 20 21 5b 69 6e 66 6f 20 65 78 69 73 74 ![info exist
16290 73 20 3a 3a 6e 6f 28 65 78 65 63 75 74 65 4f 6e s ::no(executeOn
162a0 53 65 74 75 70 29 5d 7d 20 74 68 65 6e 20 7b 0d Setup)]} then {.
162b0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
162c0 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 # NOTE: This
162d0 20 63 6f 6d 6d 61 6e 64 20 6d 61 79 20 72 61 69 command may rai
162e0 73 65 20 61 6e 20 65 72 72 6f 72 3b 20 69 66 20 se an error; if
162f0 73 6f 2c 20 74 68 61 74 20 69 73 20 66 69 6e 65 so, that is fine
16300 2c 20 61 73 0d 0a 20 20 20 20 20 20 20 20 23 20 , as.. #
16310 20 20 20 20 20 20 74 68 65 20 65 6e 63 6c 6f 73 the enclos
16320 69 6e 67 20 74 65 73 74 20 77 69 6c 6c 20 74 68 ing test will th
16330 65 6e 20 66 61 69 6c 2e 20 20 54 68 65 20 5b 73 en fail. The [s
16340 75 62 73 74 5d 20 63 6f 6d 6d 61 6e 64 20 69 73 ubst] command is
16350 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
16360 20 20 75 73 65 64 20 6f 6e 20 74 68 65 20 53 51 used on the SQ
16370 4c 20 69 6e 20 63 61 73 65 20 69 74 20 6e 65 65 L in case it nee
16380 64 73 20 74 6f 20 72 65 66 65 72 20 74 6f 20 73 ds to refer to s
16390 74 61 74 65 20 69 6e 20 6f 75 72 0d 0a 20 20 20 tate in our..
163a0 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e # con
163b0 74 65 78 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 text... #
163c0 0d 0a 20 20 20 20 20 20 20 20 73 71 6c 20 65 78 .. sql ex
163d0 65 63 75 74 65 20 24 64 62 20 5b 73 75 62 73 74 ecute $db [subst
163e0 20 24 65 78 65 63 75 74 65 4f 6e 53 65 74 75 70 $executeOnSetup
163f0 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 ].. }....
16400 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
16410 4f 54 45 3a 20 41 6c 77 61 79 73 20 72 65 74 75 OTE: Always retu
16420 72 6e 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f rn the connectio
16430 6e 20 68 61 6e 64 6c 65 20 75 70 6f 6e 20 73 75 n handle upon su
16440 63 63 65 73 73 2e 0d 0a 20 20 20 20 20 20 23 0d ccess... #.
16450 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 64 . return $d
16460 62 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 b.. }.....
16470 20 70 72 6f 63 20 67 65 74 44 62 43 6f 6e 6e 65 proc getDbConne
16480 63 74 69 6f 6e 20 7b 20 7b 76 61 72 4e 61 6d 65 ction { {varName
16490 20 64 62 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 db} } {..
164a0 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
164b0 20 52 65 66 65 72 20 74 6f 20 74 68 65 20 73 70 Refer to the sp
164c0 65 63 69 66 69 65 64 20 76 61 72 69 61 62 6c 65 ecified variable
164d0 20 28 65 2e 67 2e 20 22 64 62 22 29 20 69 6e 20 (e.g. "db") in
164e0 74 68 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 6f the context of o
164f0 75 72 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ur.. #
16500 20 20 63 61 6c 6c 65 72 2e 20 20 54 68 65 20 68 caller. The h
16510 61 6e 64 6c 65 20 74 6f 20 74 68 65 20 64 61 74 andle to the dat
16520 61 62 61 73 65 20 70 72 65 76 69 6f 75 73 6c 79 abase previously
16530 20 6f 70 65 6e 65 64 20 76 69 61 20 74 68 65 0d opened via the.
16540 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 5b . # [
16550 73 65 74 75 70 44 62 5d 20 70 72 6f 63 65 64 75 setupDb] procedu
16560 72 65 20 73 68 6f 75 6c 64 20 62 65 20 73 74 6f re should be sto
16570 72 65 64 20 74 68 65 72 65 2e 0d 0a 20 20 20 20 red there...
16580 20 20 23 0d 0a 20 20 20 20 20 20 75 70 76 61 72 #.. upvar
16590 20 31 20 24 76 61 72 4e 61 6d 65 20 64 62 0d 0a 1 $varName db..
165a0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
165b0 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 72 65 # NOTE: This re
165c0 74 75 72 6e 73 20 74 68 65 20 41 44 4f 2e 4e 45 turns the ADO.NE
165d0 54 20 49 44 62 43 6f 6e 6e 65 63 74 69 6f 6e 20 T IDbConnection
165e0 6f 62 6a 65 63 74 20 69 6e 73 74 61 6e 63 65 20 object instance
165f0 66 6f 72 20 74 68 65 0d 0a 20 20 20 20 20 20 23 for the.. #
16600 20 20 20 20 20 20 20 73 70 65 63 69 66 69 65 64 specified
16610 20 64 61 74 61 62 73 65 20 68 61 6e 64 6c 65 2e databse handle.
16620 20 20 53 69 6e 63 65 20 67 65 74 74 69 6e 67 20 Since getting
16630 74 68 69 73 20 6f 62 6a 65 63 74 20 72 65 6c 69 this object reli
16640 65 73 20 75 70 6f 6e 0d 0a 20 20 20 20 20 20 23 es upon.. #
16650 20 20 20 20 20 20 20 45 61 67 6c 65 20 69 6e 74 Eagle int
16660 65 72 6e 61 6c 73 2c 20 67 72 65 61 74 20 63 61 ernals, great ca
16670 72 65 20 73 68 6f 75 6c 64 20 62 65 20 74 61 6b re should be tak
16680 65 6e 20 74 6f 20 61 76 6f 69 64 20 64 69 73 70 en to avoid disp
16690 6f 73 69 6e 67 20 6f 66 0d 0a 20 20 20 20 20 20 osing of..
166a0 23 20 20 20 20 20 20 20 74 68 69 73 20 6f 62 6a # this obj
166b0 65 63 74 20 6f 72 20 6f 74 68 65 72 77 69 73 65 ect or otherwise
166c0 20 70 75 74 74 69 6e 67 20 69 74 20 69 6e 74 6f putting it into
166d0 20 61 6e 20 69 6e 76 61 6c 69 64 20 73 74 61 74 an invalid stat
166e0 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e... #..
166f0 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 if {[info exi
16700 73 74 73 20 64 62 5d 7d 20 74 68 65 6e 20 7b 0d sts db]} then {.
16710 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 . if {[ca
16720 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
16730 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
16740 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
16750 20 2d 6f 62 6a 65 63 74 66 6c 61 67 73 20 2b 4e -objectflags +N
16760 6f 44 69 73 70 6f 73 65 20 2d 61 6c 69 61 73 20 oDispose -alias
16770 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
16780 20 49 6e 74 65 72 70 72 65 74 65 72 2e 47 65 74 Interpreter.Get
16790 41 63 74 69 76 65 2e 63 6f 6e 6e 65 63 74 69 6f Active.connectio
167a0 6e 73 20 49 74 65 6d 20 24 64 62 0d 0a 20 20 20 ns Item $db..
167b0 20 20 20 20 20 7d 20 72 65 73 75 6c 74 5d 20 3d } result] =
167c0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
167d0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
167e0 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 75 63 63 # NOTE: Succ
167f0 65 73 73 2c 20 72 65 74 75 72 6e 20 74 68 65 20 ess, return the
16800 6f 70 61 71 75 65 20 6f 62 6a 65 63 74 20 68 61 opaque object ha
16810 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 ndle...
16820 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 #.. re
16830 74 75 72 6e 20 24 72 65 73 75 6c 74 0d 0a 20 20 turn $result..
16840 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
16850 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
16860 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 # NOTE: F
16870 61 69 6c 75 72 65 2c 20 72 65 70 6f 72 74 20 77 ailure, report w
16880 68 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 hy... #
16890 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
168a0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
168b0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
168c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
168d0 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 ==== WARNING: fa
168e0 69 6c 65 64 20 74 6f 20 67 65 74 20 63 6f 6e 6e iled to get conn
168f0 65 63 74 69 6f 6e 20 68 61 6e 64 6c 65 20 66 6f ection handle fo
16900 72 20 64 61 74 61 62 61 73 65 20 5c 22 22 20 5c r database \"" \
16910 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
16920 24 64 62 20 22 5c 22 2c 20 65 72 72 6f 72 3a 20 $db "\", error:
16930 22 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c " \n\t $result \
16940 6e 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 n].. }..
16950 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
16960 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
16970 20 46 61 69 6c 75 72 65 2c 20 72 65 74 75 72 6e Failure, return
16980 20 61 6e 20 6f 62 76 69 6f 75 73 6c 79 20 69 6e an obviously in
16990 76 61 6c 69 64 20 6f 70 61 71 75 65 20 6f 62 6a valid opaque obj
169a0 65 63 74 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 20 ect handle...
169b0 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 #.. retu
169c0 72 6e 20 22 22 0d 0a 20 20 20 20 7d 0d 0a 0c 0d rn "".. }....
169d0 0a 20 20 20 20 70 72 6f 63 20 66 72 65 65 44 62 . proc freeDb
169e0 43 6f 6e 6e 65 63 74 69 6f 6e 20 7b 20 7b 76 61 Connection { {va
169f0 72 4e 61 6d 65 20 63 6f 6e 6e 65 63 74 69 6f 6e rName connection
16a00 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a } } {.. #..
16a10 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 # NOTE: Re
16a20 66 65 72 20 74 6f 20 74 68 65 20 73 70 65 63 69 fer to the speci
16a30 66 69 65 64 20 76 61 72 69 61 62 6c 65 20 28 65 fied variable (e
16a40 2e 67 2e 20 22 63 6f 6e 6e 65 63 74 69 6f 6e 22 .g. "connection"
16a50 29 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 ) in the..
16a60 23 20 20 20 20 20 20 20 63 6f 6e 74 65 78 74 20 # context
16a70 6f 66 20 6f 75 72 20 63 61 6c 6c 65 72 2e 20 20 of our caller.
16a80 54 68 65 20 6f 70 61 71 75 65 20 6f 62 6a 65 63 The opaque objec
16a90 74 20 68 61 6e 64 6c 65 20 66 6f 72 20 61 6e 20 t handle for an
16aa0 41 44 4f 2e 4e 45 54 0d 0a 20 20 20 20 20 20 23 ADO.NET.. #
16ab0 20 20 20 20 20 20 20 63 6f 6e 6e 65 63 74 69 6f connectio
16ac0 6e 20 70 72 65 76 69 6f 75 73 6c 79 20 72 65 74 n previously ret
16ad0 75 72 6e 65 64 20 62 79 20 5b 67 65 74 44 62 43 urned by [getDbC
16ae0 6f 6e 6e 65 63 74 69 6f 6e 5d 20 73 68 6f 75 6c onnection] shoul
16af0 64 20 62 65 0d 0a 20 20 20 20 20 20 23 20 20 20 d be.. #
16b00 20 20 20 20 73 74 6f 72 65 64 20 74 68 65 72 65 stored there
16b10 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
16b20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 upvar 1 $varNa
16b30 6d 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 0d 0a 0d me connection...
16b40 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
16b50 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
16b60 74 6f 20 72 65 6d 6f 76 65 20 74 68 65 20 6f 70 to remove the op
16b70 61 71 75 65 20 6f 62 6a 65 63 74 20 68 61 6e 64 aque object hand
16b80 6c 65 20 66 72 6f 6d 20 74 68 65 20 69 6e 74 65 le from the inte
16b90 72 70 72 65 74 65 72 0d 0a 20 20 20 20 20 20 23 rpreter.. #
16ba0 20 20 20 20 20 20 20 6e 6f 77 2e 20 20 54 68 69 now. Thi
16bb0 73 20 5b 6f 62 6a 65 63 74 20 64 69 73 70 6f 73 s [object dispos
16bc0 65 5d 20 63 61 6c 6c 20 77 69 6c 6c 20 6e 6f 74 e] call will not
16bd0 20 61 63 74 75 61 6c 6c 79 20 64 69 73 70 6f 73 actually dispos
16be0 65 20 6f 66 20 74 68 65 0d 0a 20 20 20 20 20 20 e of the..
16bf0 23 20 20 20 20 20 20 20 75 6e 64 65 72 6c 79 69 # underlyi
16c00 6e 67 20 6f 62 6a 65 63 74 20 62 65 63 61 75 73 ng object becaus
16c10 65 20 74 68 65 20 2b 4e 6f 44 69 73 70 6f 73 65 e the +NoDispose
16c20 20 66 6c 61 67 20 77 61 73 20 73 65 74 20 6f 6e flag was set on
16c30 20 69 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 it.. #
16c40 20 20 20 64 75 72 69 6e 67 20 63 72 65 61 74 69 during creati
16c50 6f 6e 20 6f 66 20 74 68 65 20 6f 70 61 71 75 65 on of the opaque
16c60 20 6f 62 6a 65 63 74 20 68 61 6e 64 6c 65 2e 0d object handle..
16c70 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
16c80 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
16c90 20 63 6f 6e 6e 65 63 74 69 6f 6e 5d 20 26 26 20 connection] &&
16ca0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 63 61 \.. [ca
16cb0 74 63 68 20 7b 6f 62 6a 65 63 74 20 64 69 73 70 tch {object disp
16cc0 6f 73 65 20 24 63 6f 6e 6e 65 63 74 69 6f 6e 7d ose $connection}
16cd0 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d error]} then {.
16ce0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
16cf0 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 65 20 73 # NOTE: We s
16d00 6f 6d 65 68 6f 77 20 66 61 69 6c 65 64 20 74 6f omehow failed to
16d10 20 72 65 6d 6f 76 65 20 74 68 65 20 68 61 6e 64 remove the hand
16d20 6c 65 2c 20 72 65 70 6f 72 74 20 77 68 79 2e 0d le, report why..
16d30 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
16d40 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
16d50 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
16d60 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
16d70 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 "==== WARNI
16d80 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 72 65 NG: failed to re
16d90 6d 6f 76 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 move connection
16da0 68 61 6e 64 6c 65 20 5c 22 22 20 24 63 6f 6e 6e handle \"" $conn
16db0 65 63 74 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 ection \..
16dc0 20 20 20 20 20 20 22 5c 22 2c 20 65 72 72 6f 72 "\", error
16dd0 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 : " \n\t $error
16de0 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 \n].. }..
16df0 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
16e00 20 61 64 64 44 62 43 6f 6e 6e 65 63 74 69 6f 6e addDbConnection
16e10 20 7b 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 7b 76 { connection {v
16e20 61 72 4e 61 6d 65 20 64 62 7d 20 7d 20 7b 0d 0a arName db} } {..
16e30 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
16e40 20 4e 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 NOTE: Refer to
16e50 74 68 65 20 73 70 65 63 69 66 69 65 64 20 76 61 the specified va
16e60 72 69 61 62 6c 65 20 28 65 2e 67 2e 20 22 64 62 riable (e.g. "db
16e70 22 29 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 ") in the contex
16e80 74 20 6f 66 20 6f 75 72 0d 0a 20 20 20 20 20 20 t of our..
16e90 23 20 20 20 20 20 20 20 63 61 6c 6c 65 72 2e 0d # caller..
16ea0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
16eb0 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 upvar 1 $varName
16ec0 20 64 62 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a db.... #..
16ed0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 72 # NOTE: Cr
16ee0 65 61 74 65 20 61 20 63 6f 72 72 65 63 74 6c 79 eate a correctly
16ef0 20 66 6f 72 6d 61 74 74 65 64 20 6e 61 6d 65 20 formatted name
16f00 66 6f 72 20 74 68 65 20 64 61 74 61 62 61 73 65 for the database
16f10 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 74 6f 0d 0a connection to..
16f20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 65 # be
16f30 20 61 64 64 65 64 20 74 6f 20 74 68 65 20 6c 69 added to the li
16f40 73 74 20 6d 61 6e 61 67 65 64 20 62 79 20 74 68 st managed by th
16f50 65 20 45 61 67 6c 65 20 69 6e 74 65 72 70 72 65 e Eagle interpre
16f60 74 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ter... #..
16f70 20 20 20 20 20 73 65 74 20 64 62 20 5b 6f 62 6a set db [obj
16f80 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 ect invoke -flag
16f90 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a s +NonPublic \..
16fa0 20 20 20 20 20 20 20 20 20 20 45 61 67 6c 65 2e Eagle.
16fb0 5f 43 6f 6d 70 6f 6e 65 6e 74 73 2e 50 72 69 76 _Components.Priv
16fc0 61 74 65 2e 46 6f 72 6d 61 74 4f 70 73 20 44 61 ate.FormatOps Da
16fd0 74 61 62 61 73 65 4f 62 6a 65 63 74 4e 61 6d 65 tabaseObjectName
16fe0 20 24 63 6f 6e 6e 65 63 74 69 6f 6e 20 5c 0d 0a $connection \..
16ff0 20 20 20 20 20 20 20 20 20 20 53 51 4c 69 74 65 SQLite
17000 43 6f 6e 6e 65 63 74 69 6f 6e 20 5b 6f 62 6a 65 Connection [obje
17010 63 74 20 69 6e 76 6f 6b 65 20 49 6e 74 65 72 70 ct invoke Interp
17020 72 65 74 65 72 2e 47 65 74 41 63 74 69 76 65 20 reter.GetActive
17030 4e 65 78 74 49 64 5d 5d 0d 0a 0d 0a 20 20 20 20 NextId]]....
17040 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
17050 45 3a 20 41 64 64 20 74 68 65 20 64 61 74 61 62 E: Add the datab
17060 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 70 ase connection p
17070 72 6f 76 69 64 65 64 20 62 79 20 6f 75 72 20 63 rovided by our c
17080 61 6c 6c 65 72 20 74 6f 20 74 68 65 20 6c 69 73 aller to the lis
17090 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 t.. #
170a0 20 6f 66 20 74 68 6f 73 65 20 6b 6e 6f 77 6e 20 of those known
170b0 74 6f 20 74 68 65 20 45 61 67 6c 65 20 69 6e 74 to the Eagle int
170c0 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 20 20 erpreter...
170d0 20 23 0d 0a 20 20 20 20 20 20 6f 62 6a 65 63 74 #.. object
170e0 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
170f0 4e 6f 6e 50 75 62 6c 69 63 20 49 6e 74 65 72 70 NonPublic Interp
17100 72 65 74 65 72 2e 47 65 74 41 63 74 69 76 65 2e reter.GetActive.
17110 63 6f 6e 6e 65 63 74 69 6f 6e 73 20 41 64 64 20 connections Add
17120 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 24 64 62 \.. $db
17130 20 24 63 6f 6e 6e 65 63 74 69 6f 6e 0d 0a 20 20 $connection..
17140 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
17150 20 72 65 6d 6f 76 65 44 62 54 72 61 6e 73 61 63 removeDbTransac
17160 74 69 6f 6e 20 7b 20 74 72 61 6e 73 61 63 74 69 tion { transacti
17170 6f 6e 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d on } {.. #.
17180 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 . # NOTE: R
17190 65 6d 6f 76 65 20 74 68 65 20 64 61 74 61 62 61 emove the databa
171a0 73 65 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 70 se transaction p
171b0 72 6f 76 69 64 65 64 20 62 79 20 6f 75 72 20 63 rovided by our c
171c0 61 6c 6c 65 72 20 66 72 6f 6d 20 74 68 65 0d 0a aller from the..
171d0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6c 69 # li
171e0 73 74 20 6f 66 20 74 68 6f 73 65 20 6b 6e 6f 77 st of those know
171f0 6e 20 74 6f 20 74 68 65 20 45 61 67 6c 65 20 69 n to the Eagle i
17200 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 nterpreter...
17210 20 20 20 23 0d 0a 20 20 20 20 20 20 6f 62 6a 65 #.. obje
17220 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
17230 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 49 6e 74 65 +NonPublic Inte
17240 72 70 72 65 74 65 72 2e 47 65 74 41 63 74 69 76 rpreter.GetActiv
17250 65 2e 74 72 61 6e 73 61 63 74 69 6f 6e 73 20 5c e.transactions \
17260 0d 0a 20 20 20 20 20 20 20 20 20 20 52 65 6d 6f .. Remo
17270 76 65 20 24 74 72 61 6e 73 61 63 74 69 6f 6e 0d ve $transaction.
17280 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
17290 72 6f 63 20 67 65 74 52 6f 77 73 46 72 6f 6d 44 roc getRowsFromD
172a0 61 74 61 54 61 62 6c 65 20 7b 20 64 61 74 61 54 ataTable { dataT
172b0 61 62 6c 65 20 7b 76 61 6c 75 65 43 61 6c 6c 62 able {valueCallb
172c0 61 63 6b 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 ack ""} } {..
172d0 20 20 20 73 65 74 20 72 6f 77 73 20 5b 6c 69 73 set rows [lis
172e0 74 5d 0d 0a 20 20 20 20 20 20 73 65 74 20 63 6f t].. set co
172f0 75 6e 74 20 5b 24 64 61 74 61 54 61 62 6c 65 20 unt [$dataTable
17300 43 6f 6c 75 6d 6e 73 2e 43 6f 75 6e 74 5d 0d 0a Columns.Count]..
17310 0d 0a 20 20 20 20 20 20 66 6f 72 20 7b 73 65 74 .. for {set
17320 20 69 6e 64 65 78 20 30 7d 20 7b 24 69 6e 64 65 index 0} {$inde
17330 78 20 3c 20 24 63 6f 75 6e 74 7d 20 7b 69 6e 63 x < $count} {inc
17340 72 20 69 6e 64 65 78 7d 20 7b 0d 0a 20 20 20 20 r index} {..
17350 20 20 20 20 73 65 74 20 64 61 74 61 43 6f 6c 75 set dataColu
17360 6d 6e 20 5b 24 64 61 74 61 54 61 62 6c 65 20 2d mn [$dataTable -
17370 61 6c 69 61 73 20 43 6f 6c 75 6d 6e 73 2e 67 65 alias Columns.ge
17380 74 5f 49 74 65 6d 20 24 69 6e 64 65 78 5d 0d 0a t_Item $index]..
17390 20 20 20 20 20 20 20 20 73 65 74 20 6e 61 6d 65 set name
173a0 73 28 24 69 6e 64 65 78 29 20 5b 24 64 61 74 61 s($index) [$data
173b0 43 6f 6c 75 6d 6e 20 43 6f 6c 75 6d 6e 4e 61 6d Column ColumnNam
173c0 65 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 e].. }....
173d0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
173e0 4e 4f 54 45 3a 20 53 65 74 75 70 20 73 6f 6d 65 NOTE: Setup some
173f0 20 54 63 6c 20 72 65 74 75 72 6e 20 63 6f 64 65 Tcl return code
17400 20 63 6f 6e 73 74 61 6e 74 73 2e 0d 0a 20 20 20 constants...
17410 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 #.. set
17420 4f 6b 20 30 3b 20 73 65 74 20 45 72 72 6f 72 20 Ok 0; set Error
17430 31 3b 20 73 65 74 20 52 65 74 75 72 6e 20 32 3b 1; set Return 2;
17440 20 73 65 74 20 42 72 65 61 6b 20 33 3b 20 73 65 set Break 3; se
17450 74 20 43 6f 6e 74 69 6e 75 65 20 34 0d 0a 0d 0a t Continue 4....
17460 20 20 20 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 object for
17470 65 61 63 68 20 2d 61 6c 69 61 73 20 64 61 74 61 each -alias data
17480 52 6f 77 20 5b 73 65 74 20 64 61 74 61 52 6f 77 Row [set dataRow
17490 73 20 5b 24 64 61 74 61 54 61 62 6c 65 20 52 6f s [$dataTable Ro
174a0 77 73 5d 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 ws]] {..
174b0 73 65 74 20 72 6f 77 20 5b 6c 69 73 74 5d 0d 0a set row [list]..
174c0 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 20 7b 73 .. for {s
174d0 65 74 20 69 6e 64 65 78 20 30 7d 20 7b 24 69 6e et index 0} {$in
174e0 64 65 78 20 3c 20 24 63 6f 75 6e 74 7d 20 7b 69 dex < $count} {i
174f0 6e 63 72 20 69 6e 64 65 78 7d 20 7b 0d 0a 20 20 ncr index} {..
17500 20 20 20 20 20 20 20 20 73 65 74 20 76 61 6c 75 set valu
17510 65 20 5b 24 64 61 74 61 52 6f 77 20 2d 63 72 65 e [$dataRow -cre
17520 61 74 65 20 2d 61 6c 69 61 73 20 67 65 74 5f 49 ate -alias get_I
17530 74 65 6d 20 24 69 6e 64 65 78 5d 0d 0a 0d 0a 20 tem $index]....
17540 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 if {[st
17550 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 6c ring length $val
17560 75 65 43 61 6c 6c 62 61 63 6b 5d 20 3e 20 30 7d ueCallback] > 0}
17570 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
17580 20 20 20 20 20 73 65 74 20 63 6f 64 65 20 5b 63 set code [c
17590 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
175a0 20 20 20 20 20 20 24 76 61 6c 75 65 43 61 6c 6c $valueCall
175b0 62 61 63 6b 20 24 64 61 74 61 54 61 62 6c 65 20 back $dataTable
175c0 24 64 61 74 61 52 6f 77 20 24 69 6e 64 65 78 20 $dataRow $index
175d0 24 76 61 6c 75 65 0d 0a 20 20 20 20 20 20 20 20 $value..
175e0 20 20 20 20 7d 20 6e 65 77 56 61 6c 75 65 5d 0d } newValue].
175f0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 ... i
17600 66 20 7b 24 63 6f 64 65 20 3d 3d 20 24 4f 6b 7d f {$code == $Ok}
17610 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
17620 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
17630 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
17640 55 73 65 20 74 68 65 20 73 70 65 63 69 66 69 65 Use the specifie
17650 64 20 28 6e 65 77 3f 29 20 72 6f 77 20 76 61 6c d (new?) row val
17660 75 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ue...
17670 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
17680 20 20 20 20 6c 61 70 70 65 6e 64 20 72 6f 77 20 lappend row
17690 5b 6c 69 73 74 20 24 6e 61 6d 65 73 28 24 69 6e [list $names($in
176a0 64 65 78 29 20 24 6e 65 77 56 61 6c 75 65 5d 0d dex) $newValue].
176b0 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 . } e
176c0 6c 73 65 69 66 20 7b 24 63 6f 64 65 20 3d 3d 20 lseif {$code ==
176d0 24 45 72 72 6f 72 7d 20 74 68 65 6e 20 7b 0d 0a $Error} then {..
176e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
176f0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
17700 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 28 NOTE: Use the (
17710 6e 65 77 3f 29 20 4e 55 4c 4c 20 72 6f 77 20 76 new?) NULL row v
17720 61 6c 75 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 alue...
17730 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
17740 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 72 6f lappend ro
17750 77 20 5b 6c 69 73 74 20 24 6e 61 6d 65 73 28 24 w [list $names($
17760 69 6e 64 65 78 29 5d 0d 0a 20 20 20 20 20 20 20 index)]..
17770 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 24 } elseif {$
17780 63 6f 64 65 20 3d 3d 20 24 52 65 74 75 72 6e 7d code == $Return}
17790 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
177a0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
177b0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
177c0 53 6b 69 70 20 72 65 6d 61 69 6e 69 6e 67 20 76 Skip remaining v
177d0 61 6c 75 65 73 20 66 6f 72 20 74 68 69 73 20 72 alues for this r
177e0 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ow...
177f0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
17800 20 20 20 20 62 72 65 61 6b 0d 0a 20 20 20 20 20 break..
17810 20 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 } elseif
17820 7b 24 63 6f 64 65 20 3d 3d 20 24 42 72 65 61 6b {$code == $Break
17830 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
17840 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
17850 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
17860 20 53 6b 69 70 20 70 72 6f 63 65 73 73 69 6e 67 Skip processing
17870 20 74 68 69 73 20 72 6f 77 20 76 61 6c 75 65 2e this row value.
17880 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
17890 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d #.. }
178a0 20 65 6c 73 65 69 66 20 7b 24 63 6f 64 65 20 3d elseif {$code =
178b0 3d 20 24 43 6f 6e 74 69 6e 75 65 7d 20 74 68 65 = $Continue} the
178c0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
178d0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
178e0 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
178f0 64 65 66 61 75 6c 74 20 72 6f 77 20 76 61 6c 75 default row valu
17900 65 20 68 61 6e 64 6c 69 6e 67 2e 0d 0a 20 20 20 e handling...
17910 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
17920 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
17930 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
17940 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 . set
17950 20 63 6f 64 65 20 24 43 6f 6e 74 69 6e 75 65 0d code $Continue.
17960 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a . }....
17970 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 63 if {$c
17980 6f 64 65 20 3d 3d 20 24 43 6f 6e 74 69 6e 75 65 ode == $Continue
17990 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
179a0 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
179b0 67 20 6c 65 6e 67 74 68 20 24 76 61 6c 75 65 5d g length $value]
179c0 20 3e 20 30 20 26 26 20 5c 0d 0a 20 20 20 20 20 > 0 && \..
179d0 20 20 20 20 20 20 20 20 20 20 20 21 5b 6f 62 6a ![obj
179e0 65 63 74 20 69 6e 76 6f 6b 65 20 43 6f 6e 76 65 ect invoke Conve
179f0 72 74 20 49 73 44 42 4e 75 6c 6c 20 24 76 61 6c rt IsDBNull $val
17a00 75 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ue]} then {..
17a10 20 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 65 lappe
17a20 6e 64 20 72 6f 77 20 5b 6c 69 73 74 20 24 6e 61 nd row [list $na
17a30 6d 65 73 28 24 69 6e 64 65 78 29 20 5b 24 76 61 mes($index) [$va
17a40 6c 75 65 20 54 6f 53 74 72 69 6e 67 5d 5d 0d 0a lue ToString]]..
17a50 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c } el
17a60 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
17a70 20 20 20 20 6c 61 70 70 65 6e 64 20 72 6f 77 20 lappend row
17a80 5b 6c 69 73 74 20 24 6e 61 6d 65 73 28 24 69 6e [list $names($in
17a90 64 65 78 29 5d 0d 0a 20 20 20 20 20 20 20 20 20 dex)]..
17aa0 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
17ab0 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
17ac0 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 lappend
17ad0 72 6f 77 73 20 24 72 6f 77 0d 0a 20 20 20 20 20 rows $row..
17ae0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 }.... retu
17af0 72 6e 20 24 72 6f 77 73 0d 0a 20 20 20 20 7d 0d rn $rows.. }.
17b00 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 64 75 6d .... proc dum
17b10 70 52 6f 77 73 46 72 6f 6d 44 61 74 61 54 61 62 pRowsFromDataTab
17b20 6c 65 20 7b 20 63 68 61 6e 6e 65 6c 20 72 6f 77 le { channel row
17b30 73 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 s } {.. set
17b40 20 73 65 71 75 65 6e 63 65 20 31 0d 0a 0d 0a 20 sequence 1....
17b50 20 20 20 20 20 66 6f 72 65 61 63 68 20 72 6f 77 foreach row
17b60 20 24 72 6f 77 73 20 7b 0d 0a 20 20 20 20 20 20 $rows {..
17b70 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
17b80 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
17b90 20 20 20 20 20 20 20 20 20 20 20 20 5b 65 78 70 [exp
17ba0 72 20 7b 24 73 65 71 75 65 6e 63 65 20 3e 20 31 r {$sequence > 1
17bb0 20 3f 20 22 5c 6e 22 20 3a 20 22 22 7d 5d 20 22 ? "\n" : ""}] "
17bc0 2d 2d 2d 2d 20 52 4f 57 20 23 22 20 24 73 65 71 ---- ROW #" $seq
17bd0 75 65 6e 63 65 20 3a 5c 6e 5d 0d 0a 0d 0a 20 20 uence :\n]....
17be0 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 70 61 foreach pa
17bf0 69 72 20 24 72 6f 77 20 7b 0d 0a 20 20 20 20 20 ir $row {..
17c00 20 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 if {[llengt
17c10 68 20 24 70 61 69 72 5d 20 3e 3d 20 32 7d 20 74 h $pair] >= 2} t
17c20 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
17c30 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
17c40 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 74 l [appendArgs \t
17c50 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
17c60 20 20 20 20 5b 6c 69 73 74 20 5b 6c 69 6e 64 65 [list [linde
17c70 78 20 24 70 61 69 72 20 30 5d 5d 20 22 3a 20 22 x $pair 0]] ": "
17c80 20 5b 6c 69 73 74 20 5b 6c 69 6e 64 65 78 20 24 [list [lindex $
17c90 70 61 69 72 20 31 5d 5d 20 5c 6e 5d 0d 0a 20 20 pair 1]] \n]..
17ca0 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 } elseif
17cb0 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 70 61 69 72 {[llength $pair
17cc0 5d 20 3d 3d 20 31 7d 20 74 68 65 6e 20 7b 0d 0a ] == 1} then {..
17cd0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
17ce0 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
17cf0 6e 64 41 72 67 73 20 5c 74 20 5c 0d 0a 20 20 20 ndArgs \t \..
17d00 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 6c 69 [li
17d10 73 74 20 5b 6c 69 6e 64 65 78 20 24 70 61 69 72 st [lindex $pair
17d20 20 30 5d 5d 20 22 3a 20 3c 6e 75 6c 6c 3e 5c 6e 0]] ": <null>\n
17d30 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 "].. }
17d40 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
17d50 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
17d60 65 6c 20 5c 74 3c 65 6d 70 74 79 3e 5c 6e 3b 20 el \t<empty>\n;
17d70 23 20 4e 4f 54 45 3a 20 4e 6f 20 64 61 74 61 3f # NOTE: No data?
17d80 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
17d90 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
17da0 20 20 20 20 69 6e 63 72 20 73 65 71 75 65 6e 63 incr sequenc
17db0 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 e.. }..
17dc0 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 }..... proc c
17dd0 6c 65 61 6e 75 70 44 62 20 7b 20 66 69 6c 65 4e leanupDb { fileN
17de0 61 6d 65 20 7b 76 61 72 4e 61 6d 65 20 64 62 7d ame {varName db}
17df0 20 7b 63 6f 6c 6c 65 63 74 20 74 72 75 65 7d 20 {collect true}
17e00 7b 71 75 61 6c 69 66 79 20 74 72 75 65 7d 0d 0a {qualify true}..
17e10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
17e20 20 20 20 20 20 7b 64 65 6c 65 74 65 20 74 72 75 {delete tru
17e30 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d e} } {.. #.
17e40 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 . # NOTE: A
17e50 74 74 65 6d 70 74 20 74 6f 20 66 6f 72 63 65 20 ttempt to force
17e60 61 6c 6c 20 70 65 6e 64 69 6e 67 20 22 67 61 72 all pending "gar
17e70 62 61 67 65 22 20 6f 62 6a 65 63 74 73 20 74 6f bage" objects to
17e80 20 62 65 20 63 6f 6c 6c 65 63 74 65 64 2c 0d 0a be collected,..
17e90 20 20 20 20 20 20 23 20 20 20 20 20 20 20 69 6e # in
17ea0 63 6c 75 64 69 6e 67 20 53 51 4c 69 74 65 20 73 cluding SQLite s
17eb0 74 61 74 65 6d 65 6e 74 73 20 61 6e 64 20 62 61 tatements and ba
17ec0 63 6b 75 70 20 6f 62 6a 65 63 74 73 3b 20 74 68 ckup objects; th
17ed0 69 73 20 73 68 6f 75 6c 64 20 61 6c 6c 6f 77 0d is should allow.
17ee0 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 . # t
17ef0 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 64 61 he underlying da
17f00 74 61 62 61 73 65 20 66 69 6c 65 20 74 6f 20 62 tabase file to b
17f10 65 20 64 65 6c 65 74 65 64 2e 0d 0a 20 20 20 20 e deleted...
17f20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 #.. if {$
17f30 63 6f 6c 6c 65 63 74 7d 20 74 68 65 6e 20 7b 0d collect} then {.
17f40 0a 20 20 20 20 20 20 20 20 63 6f 6c 6c 65 63 74 . collect
17f50 47 61 72 62 61 67 65 20 24 3a 3a 74 65 73 74 5f Garbage $::test_
17f60 63 68 61 6e 6e 65 6c 0d 0a 20 20 20 20 20 20 7d channel.. }
17f70 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
17f80 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 # NOTE: Refer
17f90 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 to the specifie
17fa0 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e d variable (e.g.
17fb0 20 22 64 62 22 29 20 69 6e 20 74 68 65 20 63 6f "db") in the co
17fc0 6e 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a 20 20 ntext of our..
17fd0 20 20 20 20 23 20 20 20 20 20 20 20 63 61 6c 6c # call
17fe0 65 72 2e 20 20 54 68 65 20 68 61 6e 64 6c 65 20 er. The handle
17ff0 74 6f 20 74 68 65 20 64 61 74 61 62 61 73 65 20 to the database
18000 70 72 65 76 69 6f 75 73 6c 79 20 6f 70 65 6e 65 previously opene
18010 64 20 76 69 61 20 74 68 65 0d 0a 20 20 20 20 20 d via the..
18020 20 23 20 20 20 20 20 20 20 5b 73 65 74 75 70 44 # [setupD
18030 62 5d 20 70 72 6f 63 65 64 75 72 65 20 73 68 6f b] procedure sho
18040 75 6c 64 20 62 65 20 73 74 6f 72 65 64 20 74 68 uld be stored th
18050 65 72 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ere... #..
18060 20 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 upvar 1 $va
18070 72 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 20 20 rName db....
18080 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
18090 45 3a 20 43 6c 6f 73 65 20 74 68 65 20 63 6f 6e E: Close the con
180a0 6e 65 63 74 69 6f 6e 20 74 6f 20 74 68 65 20 64 nection to the d
180b0 61 74 61 62 61 73 65 20 6e 6f 77 2e 20 20 54 68 atabase now. Th
180c0 69 73 20 73 68 6f 75 6c 64 20 61 6c 6c 6f 77 20 is should allow
180d0 75 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 us.. #
180e0 20 20 74 6f 20 64 65 6c 65 74 65 20 74 68 65 20 to delete the
180f0 75 6e 64 65 72 6c 79 69 6e 67 20 64 61 74 61 62 underlying datab
18100 61 73 65 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 ase file...
18110 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 #.. if {[i
18120 6e 66 6f 20 65 78 69 73 74 73 20 64 62 5d 20 26 nfo exists db] &
18130 26 20 5b 63 61 74 63 68 20 7b 73 71 6c 20 63 6c & [catch {sql cl
18140 6f 73 65 20 24 64 62 7d 20 65 72 72 6f 72 5d 7d ose $db} error]}
18150 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
18160 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
18170 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 20 66 TE: We somehow f
18180 61 69 6c 65 64 20 74 6f 20 63 6c 6f 73 65 20 74 ailed to close t
18190 68 65 20 64 61 74 61 62 61 73 65 2c 20 72 65 70 he database, rep
181a0 6f 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 ort why...
181b0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 70 75 #.. tpu
181c0 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
181d0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
181e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 3d .. "=
181f0 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 === WARNING: fai
18200 6c 65 64 20 74 6f 20 63 6c 6f 73 65 20 64 61 74 led to close dat
18210 61 62 61 73 65 20 5c 22 22 20 24 64 62 20 22 5c abase \"" $db "\
18220 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 ", error: " \..
18230 20 20 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 \n\t
18240 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 $error \n]..
18250 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
18260 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 # NOTE: Fi
18270 72 73 74 2c 20 73 65 65 20 69 66 20 6f 75 72 20 rst, see if our
18280 63 61 6c 6c 65 72 20 68 61 73 20 72 65 71 75 65 caller has reque
18290 73 74 65 64 20 61 6e 20 69 6e 2d 6d 65 6d 6f 72 sted an in-memor
182a0 79 20 64 61 74 61 62 61 73 65 2e 0d 0a 20 20 20 y database...
182b0 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 #.. set
182c0 69 73 4d 65 6d 6f 72 79 20 5b 69 73 4d 65 6d 6f isMemory [isMemo
182d0 72 79 44 62 20 24 66 69 6c 65 4e 61 6d 65 5d 0d ryDb $fileName].
182e0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
182f0 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 # NOTE: Build
18300 74 68 65 20 66 75 6c 6c 20 70 61 74 68 20 74 6f the full path to
18310 20 74 68 65 20 64 61 74 61 62 61 73 65 20 66 69 the database fi
18320 6c 65 20 6e 61 6d 65 2e 20 20 46 6f 72 20 6e 6f le name. For no
18330 77 2c 20 61 6c 6c 20 74 65 73 74 0d 0a 20 20 20 w, all test..
18340 20 20 20 23 20 20 20 20 20 20 20 64 61 74 61 62 # datab
18350 61 73 65 20 66 69 6c 65 73 20 61 72 65 20 73 74 ase files are st
18360 6f 72 65 64 20 69 6e 20 74 68 65 20 74 65 6d 70 ored in the temp
18370 6f 72 61 72 79 20 64 69 72 65 63 74 6f 72 79 2e orary directory.
18380 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
18390 20 69 66 20 7b 21 24 69 73 4d 65 6d 6f 72 79 20 if {!$isMemory
183a0 26 26 20 24 71 75 61 6c 69 66 79 7d 20 74 68 65 && $qualify} the
183b0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 n {.. set
183c0 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 fileName [file
183d0 6a 6f 69 6e 20 5b 67 65 74 44 61 74 61 62 61 73 join [getDatabas
183e0 65 44 69 72 65 63 74 6f 72 79 5d 20 5b 66 69 6c eDirectory] [fil
183f0 65 20 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d 65 e tail $fileName
18400 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 ]].. }....
18410 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
18420 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 NOTE: Check if t
18430 68 65 20 66 69 6c 65 20 73 74 69 6c 6c 20 65 78 he file still ex
18440 69 73 74 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a ists... #..
18450 20 20 20 20 20 20 69 66 20 7b 21 24 69 73 4d 65 if {!$isMe
18460 6d 6f 72 79 20 26 26 20 24 64 65 6c 65 74 65 20 mory && $delete
18470 26 26 20 5b 66 69 6c 65 20 65 78 69 73 74 73 20 && [file exists
18480 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e $fileName]} then
18490 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
184a0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 # NOTE: S
184b0 6b 69 70 20 64 65 6c 65 74 69 6e 67 20 64 61 74 kip deleting dat
184c0 61 62 61 73 65 20 66 69 6c 65 73 20 69 66 20 73 abase files if s
184d0 6f 6d 65 62 6f 64 79 20 73 65 74 73 20 74 68 65 omebody sets the
184e0 20 67 6c 6f 62 61 6c 0d 0a 20 20 20 20 20 20 20 global..
184f0 20 23 20 20 20 20 20 20 20 76 61 72 69 61 62 6c # variabl
18500 65 20 74 6f 20 70 72 65 76 65 6e 74 20 69 74 2e e to prevent it.
18510 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
18520 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
18530 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6c 65 61 exists ::no(clea
18540 6e 75 70 44 62 46 69 6c 65 29 5d 7d 20 74 68 65 nupDbFile)]} the
18550 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 n {.. #
18560 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f .. # NO
18570 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 64 TE: Attempt to d
18580 65 6c 65 74 65 20 74 68 65 20 74 65 73 74 20 64 elete the test d
18590 61 74 61 62 61 73 65 20 66 69 6c 65 20 6e 6f 77 atabase file now
185a0 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
185b0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 if {[s
185c0 65 74 20 63 6f 64 65 20 5b 63 61 74 63 68 20 7b et code [catch {
185d0 66 69 6c 65 20 64 65 6c 65 74 65 20 24 66 69 6c file delete $fil
185e0 65 4e 61 6d 65 7d 20 65 72 72 6f 72 5d 5d 7d 20 eName} error]]}
185f0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
18600 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
18610 20 20 20 23 20 4e 4f 54 45 3a 20 57 65 20 73 6f # NOTE: We so
18620 6d 65 68 6f 77 20 66 61 69 6c 65 64 20 74 6f 20 mehow failed to
18630 64 65 6c 65 74 65 20 74 68 65 20 66 69 6c 65 2c delete the file,
18640 20 72 65 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 report why...
18650 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
18660 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
18670 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
18680 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
18690 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d "=
186a0 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 === WARNING: fai
186b0 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20 64 61 led to delete da
186c0 74 61 62 61 73 65 20 66 69 6c 65 20 5c 22 22 20 tabase file \""
186d0 24 66 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 $fileName \..
186e0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 "\"
186f0 20 64 75 72 69 6e 67 20 63 6c 65 61 6e 75 70 2c during cleanup,
18700 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 error: " \n\t $
18710 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 error \n]..
18720 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
18730 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
18740 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
18750 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 74 68 # NOTE: Show th
18760 61 74 20 77 65 20 73 6b 69 70 70 65 64 20 64 65 at we skipped de
18770 6c 65 74 69 6e 67 20 74 68 65 20 66 69 6c 65 2e leting the file.
18780 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
18790 20 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 64 set cod
187a0 65 20 30 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 e 0....
187b0 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
187c0 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
187d0 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
187e0 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e "==== WARNIN
187f0 47 3a 20 73 6b 69 70 70 65 64 20 64 65 6c 65 74 G: skipped delet
18800 69 6e 67 20 64 61 74 61 62 61 73 65 20 66 69 6c ing database fil
18810 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 e \"" $fileName
18820 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
18830 20 22 5c 22 20 64 75 72 69 6e 67 20 63 6c 65 61 "\" during clea
18840 6e 75 70 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 nup\n"]..
18850 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 }.. } else
18860 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
18870 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 # NOTE: T
18880 68 65 20 66 69 6c 65 20 64 6f 65 73 20 6e 6f 74 he file does not
18890 20 65 78 69 73 74 2c 20 73 75 63 63 65 73 73 21 exist, success!
188a0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
188b0 20 20 20 20 20 73 65 74 20 63 6f 64 65 20 30 0d set code 0.
188c0 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
188d0 20 20 72 65 74 75 72 6e 20 24 63 6f 64 65 0d 0a return $code..
188e0 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
188f0 6f 63 20 73 61 76 65 45 6e 76 69 72 6f 6e 6d 65 oc saveEnvironme
18900 6e 74 56 61 72 69 61 62 6c 65 73 20 7b 20 6e 61 ntVariables { na
18910 6d 65 73 20 7b 76 61 72 4e 61 6d 65 20 22 22 7d mes {varName ""}
18920 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
18930 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 6f 72 # NOTE: For
18940 20 65 61 63 68 20 6e 61 6d 65 2c 20 64 6f 65 73 each name, does
18950 20 74 68 65 20 6c 69 76 65 20 65 6e 76 69 72 6f the live enviro
18960 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 20 65 nment variable e
18970 78 69 73 74 3f 20 20 49 66 0d 0a 20 20 20 20 20 xist? If..
18980 20 23 20 20 20 20 20 20 20 73 6f 2c 20 73 61 76 # so, sav
18990 65 20 74 68 65 20 76 61 6c 75 65 20 66 6f 72 20 e the value for
189a0 6c 61 74 65 72 3b 20 6f 74 68 65 72 77 69 73 65 later; otherwise
189b0 2c 20 6d 61 6b 65 20 73 75 72 65 20 74 68 65 20 , make sure the
189c0 73 61 76 65 64 0d 0a 20 20 20 20 20 20 23 20 20 saved.. #
189d0 20 20 20 20 20 76 61 6c 75 65 20 64 6f 65 73 20 value does
189e0 6e 6f 74 20 65 78 69 73 74 20 65 69 74 68 65 72 not exist either
189f0 2e 20 20 54 68 65 20 6c 69 76 65 20 65 6e 76 69 . The live envi
18a00 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 ronment variable
18a10 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 s.. #
18a20 20 41 52 45 20 4e 4f 54 20 63 68 61 6e 67 65 64 ARE NOT changed
18a30 20 62 79 20 74 68 69 73 20 70 72 6f 63 65 64 75 by this procedu
18a40 72 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 re... #..
18a50 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
18a60 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 6d 65 5d length $varName]
18a70 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
18a80 20 20 20 20 20 20 20 73 65 74 20 76 61 72 4e 61 set varNa
18a90 6d 65 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 me savedEnv..
18aa0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 75 70 }.... up
18ab0 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 73 var 1 $varName s
18ac0 61 76 65 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 avedEnv....
18ad0 20 66 6f 72 65 61 63 68 20 6e 61 6d 65 20 24 6e foreach name $n
18ae0 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 ames {..
18af0 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
18b00 20 3a 3a 65 6e 76 28 24 6e 61 6d 65 29 5d 7d 20 ::env($name)]}
18b10 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
18b20 20 20 73 65 74 20 73 61 76 65 64 45 6e 76 28 24 set savedEnv($
18b30 6e 61 6d 65 29 20 24 3a 3a 65 6e 76 28 24 6e 61 name) $::env($na
18b40 6d 65 29 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 me).. } e
18b50 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
18b60 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 unset -nocompla
18b70 69 6e 20 73 61 76 65 64 45 6e 76 28 24 6e 61 6d in savedEnv($nam
18b80 65 29 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 e).. }..
18b90 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
18ba0 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
18bb0 20 54 68 69 73 20 69 73 20 73 65 6c 66 2d 63 6c This is self-cl
18bc0 65 61 6e 69 6e 67 2e 20 20 49 66 20 6e 6f 20 73 eaning. If no s
18bd0 61 76 65 64 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 aved environment
18be0 20 76 61 72 69 61 62 6c 65 73 20 6e 6f 77 0d 0a variables now..
18bf0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 65 78 # ex
18c00 69 73 74 2c 20 72 65 6d 6f 76 65 20 74 68 65 20 ist, remove the
18c10 61 72 72 61 79 2e 0d 0a 20 20 20 20 20 20 23 0d array... #.
18c20 0a 20 20 20 20 20 20 69 66 20 7b 5b 61 72 72 61 . if {[arra
18c30 79 20 73 69 7a 65 20 73 61 76 65 64 45 6e 76 5d y size savedEnv]
18c40 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
18c50 20 20 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f unset -no
18c60 63 6f 6d 70 6c 61 69 6e 20 73 61 76 65 64 45 6e complain savedEn
18c70 76 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 v.. }..
18c80 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 }..... proc r
18c90 65 73 74 6f 72 65 45 6e 76 69 72 6f 6e 6d 65 6e estoreEnvironmen
18ca0 74 56 61 72 69 61 62 6c 65 73 20 7b 20 6e 61 6d tVariables { nam
18cb0 65 73 20 7b 76 61 72 4e 61 6d 65 20 22 22 7d 20 es {varName ""}
18cc0 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
18cd0 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 6f 72 20 # NOTE: For
18ce0 65 61 63 68 20 6e 61 6d 65 2c 20 64 6f 65 73 20 each name, does
18cf0 74 68 65 20 73 61 76 65 64 20 65 6e 76 69 72 6f the saved enviro
18d00 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 20 65 nment variable e
18d10 78 69 73 74 3f 20 20 49 66 0d 0a 20 20 20 20 20 xist? If..
18d20 20 23 20 20 20 20 20 20 20 73 6f 2c 20 72 65 73 # so, res
18d30 74 6f 72 65 20 74 68 65 20 73 61 76 65 64 20 76 tore the saved v
18d40 61 6c 75 65 20 61 6e 64 20 75 6e 73 65 74 20 69 alue and unset i
18d50 74 3b 20 6f 74 68 65 72 77 69 73 65 2c 20 6d 61 t; otherwise, ma
18d60 6b 65 20 73 75 72 65 0d 0a 20 20 20 20 20 20 23 ke sure.. #
18d70 20 20 20 20 20 20 20 74 68 65 20 6c 69 76 65 20 the live
18d80 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 environment vari
18d90 61 62 6c 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 able does not ex
18da0 69 73 74 20 65 69 74 68 65 72 20 28 69 2e 65 2e ist either (i.e.
18db0 20 69 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 it.. #
18dc0 20 20 20 77 61 73 20 6e 6f 74 20 73 65 74 20 74 was not set t
18dd0 6f 20 62 65 67 69 6e 20 77 69 74 68 29 2e 20 20 o begin with).
18de0 42 6f 74 68 20 73 61 76 65 64 20 61 6e 64 20 6c Both saved and l
18df0 69 76 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0d ive environment.
18e00 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 . # v
18e10 61 72 69 61 62 6c 65 73 20 41 52 45 20 63 68 61 ariables ARE cha
18e20 6e 67 65 64 20 62 79 20 74 68 69 73 20 70 72 6f nged by this pro
18e30 63 65 64 75 72 65 2e 0d 0a 20 20 20 20 20 20 23 cedure... #
18e40 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
18e50 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e ing length $varN
18e60 61 6d 65 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ame] == 0} then
18e70 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 76 {.. set v
18e80 61 72 4e 61 6d 65 20 73 61 76 65 64 45 6e 76 0d arName savedEnv.
18e90 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
18ea0 20 20 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 upvar 1 $varNa
18eb0 6d 65 20 73 61 76 65 64 45 6e 76 0d 0a 0d 0a 20 me savedEnv....
18ec0 20 20 20 20 20 66 6f 72 65 61 63 68 20 6e 61 6d foreach nam
18ed0 65 20 24 6e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 e $names {..
18ee0 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
18ef0 69 73 74 73 20 73 61 76 65 64 45 6e 76 28 24 6e ists savedEnv($n
18f00 61 6d 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 ame)]} then {..
18f10 20 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a 65 set ::e
18f20 6e 76 28 24 6e 61 6d 65 29 20 24 73 61 76 65 64 nv($name) $saved
18f30 45 6e 76 28 24 6e 61 6d 65 29 0d 0a 20 20 20 20 Env($name)..
18f40 20 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 unset -noc
18f50 6f 6d 70 6c 61 69 6e 20 73 61 76 65 64 45 6e 76 omplain savedEnv
18f60 28 24 6e 61 6d 65 29 0d 0a 20 20 20 20 20 20 20 ($name)..
18f70 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
18f80 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f unset -noco
18f90 6d 70 6c 61 69 6e 20 3a 3a 65 6e 76 28 24 6e 61 mplain ::env($na
18fa0 6d 65 29 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a me).. }..
18fb0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
18fc0 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
18fd0 3a 20 54 68 69 73 20 69 73 20 73 65 6c 66 2d 63 : This is self-c
18fe0 6c 65 61 6e 69 6e 67 2e 20 20 49 66 20 6e 6f 20 leaning. If no
18ff0 73 61 76 65 64 20 65 6e 76 69 72 6f 6e 6d 65 6e saved environmen
19000 74 20 76 61 72 69 61 62 6c 65 73 20 6e 6f 77 0d t variables now.
19010 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 65 . # e
19020 78 69 73 74 2c 20 72 65 6d 6f 76 65 20 74 68 65 xist, remove the
19030 20 61 72 72 61 79 2e 0d 0a 20 20 20 20 20 20 23 array... #
19040 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 61 72 72 .. if {[arr
19050 61 79 20 73 69 7a 65 20 73 61 76 65 64 45 6e 76 ay size savedEnv
19060 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
19070 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 2d 6e unset -n
19080 6f 63 6f 6d 70 6c 61 69 6e 20 73 61 76 65 64 45 ocomplain savedE
19090 6e 76 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 nv.. }..
190a0 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
190b0 73 61 76 65 47 65 74 53 65 74 74 69 6e 67 56 61 saveGetSettingVa
190c0 6c 75 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 7b lueEnvironment {
190d0 7d 20 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 72 } {.. upvar
190e0 20 31 20 73 61 76 65 64 45 6e 76 20 73 61 76 65 1 savedEnv save
190f0 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 73 61 dEnv.... sa
19100 76 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 veEnvironmentVar
19110 69 61 62 6c 65 73 20 5b 6c 69 73 74 20 5c 0d 0a iables [list \..
19120 20 20 20 20 20 20 20 20 20 20 4e 6f 5f 45 78 70 No_Exp
19130 61 6e 64 20 4e 6f 5f 53 51 4c 69 74 65 47 65 74 and No_SQLiteGet
19140 53 65 74 74 69 6e 67 56 61 6c 75 65 20 4e 6f 5f SettingValue No_
19150 53 51 4c 69 74 65 58 6d 6c 43 6f 6e 66 69 67 46 SQLiteXmlConfigF
19160 69 6c 65 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 ile] \..
19170 20 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 savedEnv..
19180 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 }..... proc r
19190 65 73 74 6f 72 65 47 65 74 53 65 74 74 69 6e 67 estoreGetSetting
191a0 56 61 6c 75 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 ValueEnvironment
191b0 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 75 70 76 {} {.. upv
191c0 61 72 20 31 20 73 61 76 65 64 45 6e 76 20 73 61 ar 1 savedEnv sa
191d0 76 65 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 vedEnv....
191e0 72 65 73 74 6f 72 65 45 6e 76 69 72 6f 6e 6d 65 restoreEnvironme
191f0 6e 74 56 61 72 69 61 62 6c 65 73 20 5b 6c 69 73 ntVariables [lis
19200 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 4e t \.. N
19210 6f 5f 45 78 70 61 6e 64 20 4e 6f 5f 53 51 4c 69 o_Expand No_SQLi
19220 74 65 47 65 74 53 65 74 74 69 6e 67 56 61 6c 75 teGetSettingValu
19230 65 20 4e 6f 5f 53 51 4c 69 74 65 58 6d 6c 43 6f e No_SQLiteXmlCo
19240 6e 66 69 67 46 69 6c 65 5d 20 5c 0d 0a 20 20 20 nfigFile] \..
19250 20 20 20 20 20 20 20 73 61 76 65 64 45 6e 76 0d savedEnv.
19260 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
19270 72 6f 63 20 73 61 76 65 53 51 4c 69 74 65 43 6f roc saveSQLiteCo
19280 6e 6e 65 63 74 69 6f 6e 45 6e 76 69 72 6f 6e 6d nnectionEnvironm
19290 65 6e 74 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 ent {} {..
192a0 75 70 76 61 72 20 31 20 73 61 76 65 64 45 6e 76 upvar 1 savedEnv
192b0 20 73 61 76 65 64 45 6e 76 0d 0a 0d 0a 20 20 20 savedEnv....
192c0 20 20 20 73 61 76 65 45 6e 76 69 72 6f 6e 6d 65 saveEnvironme
192d0 6e 74 56 61 72 69 61 62 6c 65 73 20 5b 6c 69 73 ntVariables [lis
192e0 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 44 t \.. D
192f0 65 66 61 75 6c 74 46 6c 61 67 73 5f 53 51 4c 69 efaultFlags_SQLi
19300 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 20 4e 6f 5f teConnection No_
19310 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e SQLiteConnection
19320 4e 65 77 50 61 72 73 65 72 5d 20 5c 0d 0a 20 20 NewParser] \..
19330 20 20 20 20 20 20 20 20 73 61 76 65 64 45 6e 76 savedEnv
19340 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
19350 70 72 6f 63 20 72 65 73 74 6f 72 65 53 51 4c 69 proc restoreSQLi
19360 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 45 6e 76 69 teConnectionEnvi
19370 72 6f 6e 6d 65 6e 74 20 7b 7d 20 7b 0d 0a 20 20 ronment {} {..
19380 20 20 20 20 75 70 76 61 72 20 31 20 73 61 76 65 upvar 1 save
19390 64 45 6e 76 20 73 61 76 65 64 45 6e 76 0d 0a 0d dEnv savedEnv...
193a0 0a 20 20 20 20 20 20 72 65 73 74 6f 72 65 45 6e . restoreEn
193b0 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 6c vironmentVariabl
193c0 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 es [list \..
193d0 20 20 20 20 20 20 44 65 66 61 75 6c 74 46 6c 61 DefaultFla
193e0 67 73 5f 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 gs_SQLiteConnect
193f0 69 6f 6e 20 4e 6f 5f 53 51 4c 69 74 65 43 6f 6e ion No_SQLiteCon
19400 6e 65 63 74 69 6f 6e 4e 65 77 50 61 72 73 65 72 nectionNewParser
19410 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 73 ] \.. s
19420 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 7d 0d 0a avedEnv.. }..
19430 0c 0d 0a 20 20 20 20 70 72 6f 63 20 73 61 76 65 ... proc save
19440 53 51 4c 69 74 65 43 6f 6e 76 65 72 74 45 6e 76 SQLiteConvertEnv
19450 69 72 6f 6e 6d 65 6e 74 20 7b 7d 20 7b 0d 0a 20 ironment {} {..
19460 20 20 20 20 20 75 70 76 61 72 20 31 20 73 61 76 upvar 1 sav
19470 65 64 45 6e 76 20 73 61 76 65 64 45 6e 76 0d 0a edEnv savedEnv..
19480 0d 0a 20 20 20 20 20 20 73 61 76 65 45 6e 76 69 .. saveEnvi
19490 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 6c 65 73 ronmentVariables
194a0 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 [list \..
194b0 20 20 20 20 55 73 65 5f 53 51 4c 69 74 65 43 6f Use_SQLiteCo
194c0 6e 76 65 72 74 5f 44 65 66 61 75 6c 74 44 62 54 nvert_DefaultDbT
194d0 79 70 65 20 55 73 65 5f 53 51 4c 69 74 65 43 6f ype Use_SQLiteCo
194e0 6e 76 65 72 74 5f 44 65 66 61 75 6c 74 54 79 70 nvert_DefaultTyp
194f0 65 4e 61 6d 65 5d 20 5c 0d 0a 20 20 20 20 20 20 eName] \..
19500 20 20 20 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 savedEnv..
19510 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
19520 20 72 65 73 74 6f 72 65 53 51 4c 69 74 65 43 6f restoreSQLiteCo
19530 6e 76 65 72 74 45 6e 76 69 72 6f 6e 6d 65 6e 74 nvertEnvironment
19540 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 75 70 76 {} {.. upv
19550 61 72 20 31 20 73 61 76 65 64 45 6e 76 20 73 61 ar 1 savedEnv sa
19560 76 65 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 vedEnv....
19570 72 65 73 74 6f 72 65 45 6e 76 69 72 6f 6e 6d 65 restoreEnvironme
19580 6e 74 56 61 72 69 61 62 6c 65 73 20 5b 6c 69 73 ntVariables [lis
19590 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 55 t \.. U
195a0 73 65 5f 53 51 4c 69 74 65 43 6f 6e 76 65 72 74 se_SQLiteConvert
195b0 5f 44 65 66 61 75 6c 74 44 62 54 79 70 65 20 55 _DefaultDbType U
195c0 73 65 5f 53 51 4c 69 74 65 43 6f 6e 76 65 72 74 se_SQLiteConvert
195d0 5f 44 65 66 61 75 6c 74 54 79 70 65 4e 61 6d 65 _DefaultTypeName
195e0 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 73 ] \.. s
195f0 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 7d 0d 0a avedEnv.. }..
19600 0c 0d 0a 20 20 20 20 70 72 6f 63 20 73 65 74 75 ... proc setu
19610 70 44 62 49 6e 74 65 72 72 75 70 74 43 61 6c 6c pDbInterruptCall
19620 62 61 63 6b 20 7b 20 63 68 61 6e 6e 65 6c 20 6c back { channel l
19630 6f 67 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 70 og } {.. tp
19640 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d uts $channel "--
19650 2d 2d 20 73 65 74 74 69 6e 67 20 75 70 20 64 65 -- setting up de
19660 62 75 67 67 65 72 20 69 6e 74 65 72 72 75 70 74 bugger interrupt
19670 20 63 61 6c 6c 62 61 63 6b 2e 2e 2e 20 22 0d 0a callback... "..
19680 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 .. if {[cat
19690 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 61 ch {.. sa
196a0 76 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 veEnvironmentVar
196b0 69 61 62 6c 65 73 20 5b 6c 69 73 74 20 5c 0d 0a iables [list \..
196c0 20 20 20 20 20 20 20 20 20 20 20 20 71 75 69 65 quie
196d0 74 46 69 6e 64 49 6e 74 65 72 70 72 65 74 65 72 tFindInterpreter
196e0 54 65 73 74 50 61 74 68 20 71 75 69 65 74 53 65 TestPath quietSe
196f0 74 75 70 49 6e 74 65 72 70 72 65 74 65 72 54 65 tupInterpreterTe
19700 73 74 50 61 74 68 5d 0d 0a 0d 0a 20 20 20 20 20 stPath]....
19710 20 20 20 74 72 79 20 7b 0d 0a 20 20 20 20 20 20 try {..
19720 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
19730 20 23 20 4e 4f 54 45 3a 20 50 72 65 76 65 6e 74 # NOTE: Prevent
19740 20 74 68 65 20 76 65 6e 64 6f 72 20 73 63 72 69 the vendor scri
19750 70 74 20 66 72 6f 6d 20 62 65 69 6e 67 20 6e 6f pt from being no
19760 69 73 79 20 77 68 65 6e 20 63 72 65 61 74 69 6e isy when creatin
19770 67 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 g.. #
19780 20 20 20 20 20 74 68 65 20 69 73 6f 6c 61 74 65 the isolate
19790 64 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a d interpreter...
197a0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
197b0 20 20 20 20 20 20 20 73 65 74 20 3a 3a 65 6e 76 set ::env
197c0 28 71 75 69 65 74 46 69 6e 64 49 6e 74 65 72 70 (quietFindInterp
197d0 72 65 74 65 72 54 65 73 74 50 61 74 68 29 20 31 reterTestPath) 1
197e0 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
197f0 3a 3a 65 6e 76 28 71 75 69 65 74 53 65 74 75 70 ::env(quietSetup
19800 49 6e 74 65 72 70 72 65 74 65 72 54 65 73 74 50 InterpreterTestP
19810 61 74 68 29 20 31 0d 0a 0d 0a 20 20 20 20 20 20 ath) 1....
19820 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
19830 20 23 20 4e 4f 54 45 3a 20 4d 61 6b 65 20 73 75 # NOTE: Make su
19840 72 65 20 74 68 65 20 73 63 72 69 70 74 20 64 65 re the script de
19850 62 75 67 67 65 72 20 61 6e 64 20 74 68 65 20 69 bugger and the i
19860 73 6f 6c 61 74 65 64 20 69 6e 74 65 72 70 72 65 solated interpre
19870 74 65 72 0d 0a 20 20 20 20 20 20 20 20 20 20 23 ter.. #
19880 20 20 20 20 20 20 20 61 72 65 20 73 65 74 75 70 are setup
19890 20 61 6e 64 20 72 65 61 64 79 20 66 6f 72 20 75 and ready for u
198a0 73 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 se... #
198b0 0d 0a 20 20 20 20 20 20 20 20 20 20 64 65 62 75 .. debu
198c0 67 20 73 65 74 75 70 20 74 72 75 65 20 74 72 75 g setup true tru
198d0 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 23 e.... #
198e0 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f .. # NO
198f0 54 45 3a 20 4c 6f 61 64 20 74 68 65 20 6e 65 63 TE: Load the nec
19900 65 73 73 61 72 79 20 70 61 63 6b 61 67 65 73 20 essary packages
19910 69 6e 74 6f 20 74 68 65 20 69 73 6f 6c 61 74 65 into the isolate
19920 64 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a d interpreter...
19930 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
19940 20 20 20 20 20 20 20 64 65 62 75 67 20 65 76 61 debug eva
19950 6c 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 l {..
19960 20 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 package require
19970 20 45 61 67 6c 65 0d 0a 20 20 20 20 20 20 20 20 Eagle..
19980 20 20 20 20 70 61 63 6b 61 67 65 20 72 65 71 75 package requ
19990 69 72 65 20 45 61 67 6c 65 2e 4c 69 62 72 61 72 ire Eagle.Librar
199a0 79 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 70 y.. p
199b0 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 45 ackage require E
199c0 61 67 6c 65 2e 54 65 73 74 0d 0a 20 20 20 20 20 agle.Test..
199d0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
199e0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
199f0 20 23 20 4e 4f 54 45 3a 20 43 6f 70 79 20 74 68 # NOTE: Copy th
19a00 65 20 6e 65 63 65 73 73 61 72 79 20 76 61 72 69 e necessary vari
19a10 61 62 6c 65 73 20 69 6e 74 6f 20 74 68 65 20 69 ables into the i
19a20 73 6f 6c 61 74 65 64 20 69 6e 74 65 72 70 72 65 solated interpre
19a30 74 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ter...
19a40 23 0d 0a 20 20 20 20 20 20 20 20 20 20 64 65 62 #.. deb
19a50 75 67 20 69 6e 76 6f 6b 65 20 30 20 73 65 74 20 ug invoke 0 set
19a60 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 ::test_channel $
19a70 63 68 61 6e 6e 65 6c 3b 20 23 20 4e 4f 54 45 3a channel; # NOTE:
19a80 20 46 6f 72 20 5b 74 70 75 74 73 5d 2e 0d 0a 20 For [tputs]...
19a90 20 20 20 20 20 20 20 20 20 64 65 62 75 67 20 69 debug i
19aa0 6e 76 6f 6b 65 20 30 20 73 65 74 20 3a 3a 74 65 nvoke 0 set ::te
19ab0 73 74 5f 6c 6f 67 20 24 6c 6f 67 3b 20 23 20 4e st_log $log; # N
19ac0 4f 54 45 3a 20 46 6f 72 20 5b 74 6c 6f 67 5d 2e OTE: For [tlog].
19ad0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d .... #.
19ae0 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 . # NOT
19af0 45 3a 20 49 6e 73 74 61 6c 6c 20 74 68 65 20 63 E: Install the c
19b00 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 20 74 allback script t
19b10 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 20 69 o be evaluated i
19b20 6e 20 74 68 65 20 69 73 6f 6c 61 74 65 64 0d 0a n the isolated..
19b30 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
19b40 20 20 69 6e 74 65 72 70 72 65 74 65 72 20 77 68 interpreter wh
19b50 65 6e 20 74 68 69 73 20 69 6e 74 65 72 70 72 65 en this interpre
19b60 74 65 72 20 69 73 20 69 6e 74 65 72 72 75 70 74 ter is interrupt
19b70 65 64 20 62 79 20 73 63 72 69 70 74 0d 0a 20 20 ed by script..
19b80 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
19b90 63 61 6e 63 65 6c 6c 61 74 69 6f 6e 2c 20 65 74 cancellation, et
19ba0 63 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d c... #.
19bb0 0a 20 20 20 20 20 20 20 20 20 20 64 65 62 75 67 . debug
19bc0 20 63 61 6c 6c 62 61 63 6b 20 61 70 70 6c 79 20 callback apply
19bd0 7b 7b 73 65 6e 64 65 72 20 65 7d 20 7b 0d 0a 20 {{sender e} {..
19be0 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
19bf0 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
19c00 3a 20 43 68 65 63 6b 20 69 66 20 74 68 69 73 20 : Check if this
19c10 64 65 62 75 67 67 65 72 20 63 61 6c 6c 62 61 63 debugger callbac
19c20 6b 20 69 73 20 6f 6e 65 20 74 68 61 74 20 77 65 k is one that we
19c30 20 63 61 72 65 20 61 62 6f 75 74 2e 0d 0a 20 20 care about...
19c40 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
19c50 20 20 20 20 20 20 20 20 20 73 65 74 20 69 6e 74 set int
19c60 65 72 72 75 70 74 54 79 70 65 73 20 5b 73 70 6c erruptTypes [spl
19c70 69 74 20 5b 24 65 20 49 6e 74 65 72 72 75 70 74 it [$e Interrupt
19c80 54 79 70 65 5d 20 22 2c 20 22 5d 0d 0a 0d 0a 20 Type] ", "]....
19c90 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 22 if {"
19ca0 43 61 6e 63 65 6c 65 64 22 20 69 6e 20 24 69 6e Canceled" in $in
19cb0 74 65 72 72 75 70 74 54 79 70 65 73 20 7c 7c 20 terruptTypes ||
19cc0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
19cd0 20 20 20 22 55 6e 77 6f 75 6e 64 22 20 69 6e 20 "Unwound" in
19ce0 24 69 6e 74 65 72 72 75 70 74 54 79 70 65 73 7d $interruptTypes}
19cf0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
19d00 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
19d10 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
19d20 4d 61 6b 65 20 73 75 72 65 20 74 68 65 20 5b 6f Make sure the [o
19d30 62 6a 65 63 74 5d 20 63 6f 6d 6d 61 6e 64 20 69 bject] command i
19d40 73 20 61 76 61 69 6c 61 62 6c 65 2e 20 20 53 69 s available. Si
19d50 6e 63 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 nce..
19d60 20 20 20 23 20 20 20 20 20 20 20 74 68 69 73 20 # this
19d70 69 73 20 61 6e 20 69 73 6f 6c 61 74 65 64 20 69 is an isolated i
19d80 6e 74 65 72 70 72 65 74 65 72 2c 20 63 68 65 63 nterpreter, chec
19d90 6b 20 66 6f 72 20 69 74 20 74 68 65 20 68 61 72 k for it the har
19da0 64 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 d..
19db0 20 23 20 20 20 20 20 20 20 77 61 79 2e 0d 0a 20 # way...
19dc0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
19dd0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
19de0 20 7b 5b 6c 6c 65 6e 67 74 68 20 5b 69 6e 66 6f {[llength [info
19df0 20 63 6f 6d 6d 61 6e 64 73 20 6f 62 6a 65 63 74 commands object
19e00 5d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ]] > 0} then {..
19e10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19e20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 #..
19e30 20 20 20 23 20 4e 4f 54 45 3a 20 49 74 65 72 61 # NOTE: Itera
19e40 74 65 20 74 68 72 6f 75 67 68 20 61 6c 6c 20 64 te through all d
19e50 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 atabase connecti
19e60 6f 6e 73 20 6b 6e 6f 77 6e 20 74 6f 20 74 68 65 ons known to the
19e70 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
19e80 20 20 23 20 20 20 20 20 20 20 70 61 72 65 6e 74 # parent
19e90 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 interpreter...
19ea0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 #
19eb0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
19ec0 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 61 63 68 object foreach
19ed0 20 2d 61 6c 69 61 73 20 70 61 69 72 20 5b 6f 62 -alias pair [ob
19ee0 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 ject invoke -fla
19ef0 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d gs +NonPublic \.
19f00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
19f10 20 20 20 20 20 24 65 20 49 6e 74 65 72 70 72 65 $e Interpre
19f20 74 65 72 2e 63 6f 6e 6e 65 63 74 69 6f 6e 73 5d ter.connections]
19f30 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
19f40 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
19f50 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 # NOT
19f60 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 63 61 E: Attempt to ca
19f70 6e 63 65 6c 20 61 6e 79 20 53 51 4c 20 71 75 65 ncel any SQL que
19f80 72 69 65 73 20 69 6e 20 70 72 6f 67 72 65 73 73 ries in progress
19f90 20 6f 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 on..
19fa0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
19fb0 68 69 73 20 64 61 74 61 62 61 73 65 20 63 6f 6e his database con
19fc0 6e 65 63 74 69 6f 6e 2e 0d 0a 20 20 20 20 20 20 nection...
19fd0 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
19fe0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19ff0 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 24 70 61 if {[catch {$pa
1a000 69 72 20 56 61 6c 75 65 2e 43 61 6e 63 65 6c 7d ir Value.Cancel}
1a010 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d error]} then {.
1a020 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1a030 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1a040 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
1a050 6e 64 41 72 67 73 20 5c 6e 20 5c 0d 0a 20 20 20 ndArgs \n \..
1a060 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a070 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 "==== WARNI
1a080 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 63 61 NG: failed to ca
1a090 6e 63 65 6c 20 71 75 65 72 79 20 66 6f 72 20 22 ncel query for "
1a0a0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1a0b0 20 20 20 20 20 20 20 20 20 20 20 20 22 63 6f 6e "con
1a0c0 6e 65 63 74 69 6f 6e 20 5c 22 22 20 5b 24 70 61 nection \"" [$pa
1a0d0 69 72 20 4b 65 79 5d 20 22 5c 22 2c 20 65 72 72 ir Key] "\", err
1a0e0 6f 72 3a 20 22 20 5c 6e 5c 74 20 5c 0d 0a 20 20 or: " \n\t \..
1a0f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a100 20 20 20 20 20 20 24 65 72 72 6f 72 20 5c 6e 5d $error \n]
1a110 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1a120 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
1a130 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1a140 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
1a150 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1a160 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1a170 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1a180 72 67 73 20 5c 6e 20 5c 0d 0a 20 20 20 20 20 20 rgs \n \..
1a190 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d "=
1a1a0 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 63 61 6e === WARNING: can
1a1b0 6e 6f 74 20 63 61 6e 63 65 6c 20 61 6e 79 20 71 not cancel any q
1a1c0 75 65 72 69 65 73 3a 20 22 20 5c 0d 0a 20 20 20 ueries: " \..
1a1d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1a1e0 20 22 74 68 65 20 5c 22 6f 62 6a 65 63 74 5c 22 "the \"object\"
1a1f0 20 63 6f 6d 6d 61 6e 64 20 69 73 20 6e 6f 74 20 command is not
1a200 61 76 61 69 6c 61 62 6c 65 5c 6e 22 5d 0d 0a 20 available\n"]..
1a210 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
1a220 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
1a230 20 20 20 20 20 20 20 20 20 7d 7d 0d 0a 20 20 20 }}..
1a240 20 20 20 20 20 7d 20 66 69 6e 61 6c 6c 79 20 7b } finally {
1a250 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 73 74 .. rest
1a260 6f 72 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 oreEnvironmentVa
1a270 72 69 61 62 6c 65 73 20 5b 6c 69 73 74 20 5c 0d riables [list \.
1a280 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 71 . q
1a290 75 69 65 74 46 69 6e 64 49 6e 74 65 72 70 72 65 uietFindInterpre
1a2a0 74 65 72 54 65 73 74 50 61 74 68 20 71 75 69 65 terTestPath quie
1a2b0 74 53 65 74 75 70 49 6e 74 65 72 70 72 65 74 65 tSetupInterprete
1a2c0 72 54 65 73 74 50 61 74 68 5d 0d 0a 20 20 20 20 rTestPath]..
1a2d0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 }.. } e
1a2e0 72 72 6f 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e rror] == 0} then
1a2f0 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 {.. addC
1a300 6f 6e 73 74 72 61 69 6e 74 20 69 6e 74 65 72 72 onstraint interr
1a310 75 70 74 43 61 6c 6c 62 61 63 6b 2e 73 71 6c 69 uptCallback.sqli
1a320 74 65 33 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 te3.... t
1a330 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 79 65 puts $channel ye
1a340 73 5c 6e 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 s\n.. } els
1a350 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 e {.. tpu
1a360 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
1a370 65 6e 64 41 72 67 73 20 22 6e 6f 2c 20 65 72 72 endArgs "no, err
1a380 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f or: " \n\t $erro
1a390 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a r \n].. }..
1a3a0 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
1a3b0 6f 63 20 63 6c 65 61 6e 75 70 46 69 6c 65 20 7b oc cleanupFile {
1a3c0 20 66 69 6c 65 4e 61 6d 65 20 7b 63 6f 6c 6c 65 fileName {colle
1a3d0 63 74 20 74 72 75 65 7d 20 7b 66 6f 72 63 65 20 ct true} {force
1a3e0 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 false} } {..
1a3f0 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1a400 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 66 6f E: Attempt to fo
1a410 72 63 65 20 61 6c 6c 20 70 65 6e 64 69 6e 67 20 rce all pending
1a420 22 67 61 72 62 61 67 65 22 20 6f 62 6a 65 63 74 "garbage" object
1a430 73 20 74 6f 20 62 65 20 63 6f 6c 6c 65 63 74 65 s to be collecte
1a440 64 2c 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 d,.. #
1a450 20 20 69 6e 63 6c 75 64 69 6e 67 20 53 51 4c 69 including SQLi
1a460 74 65 20 73 74 61 74 65 6d 65 6e 74 73 20 61 6e te statements an
1a470 64 20 62 61 63 6b 75 70 20 6f 62 6a 65 63 74 73 d backup objects
1a480 3b 20 74 68 69 73 20 73 68 6f 75 6c 64 20 61 6c ; this should al
1a490 6c 6f 77 0d 0a 20 20 20 20 20 20 23 20 20 20 20 low.. #
1a4a0 20 20 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e the underlyin
1a4b0 67 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 g database file
1a4c0 74 6f 20 62 65 20 64 65 6c 65 74 65 64 2e 0d 0a to be deleted...
1a4d0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
1a4e0 66 20 7b 24 63 6f 6c 6c 65 63 74 7d 20 74 68 65 f {$collect} the
1a4f0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 63 6f 6c n {.. col
1a500 6c 65 63 74 47 61 72 62 61 67 65 20 24 3a 3a 74 lectGarbage $::t
1a510 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 20 20 20 est_channel..
1a520 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
1a530 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 . # NOTE: C
1a540 68 65 63 6b 20 69 66 20 74 68 65 20 66 69 6c 65 heck if the file
1a550 20 73 74 69 6c 6c 20 65 78 69 73 74 73 2e 0d 0a still exists...
1a560 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
1a570 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 f {[file exists
1a580 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e $fileName]} then
1a590 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
1a5a0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 # NOTE: S
1a5b0 6b 69 70 20 64 65 6c 65 74 69 6e 67 20 74 65 73 kip deleting tes
1a5c0 74 20 66 69 6c 65 73 20 69 66 20 73 6f 6d 65 62 t files if someb
1a5d0 6f 64 79 20 73 65 74 73 20 74 68 65 20 67 6c 6f ody sets the glo
1a5e0 62 61 6c 20 76 61 72 69 61 62 6c 65 0d 0a 20 20 bal variable..
1a5f0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 6f # to
1a600 20 70 72 65 76 65 6e 74 20 69 74 2e 0d 0a 20 20 prevent it...
1a610 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1a620 20 69 66 20 7b 24 66 6f 72 63 65 20 7c 7c 20 21 if {$force || !
1a630 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
1a640 6f 28 63 6c 65 61 6e 75 70 46 69 6c 65 29 5d 7d o(cleanupFile)]}
1a650 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1a660 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
1a670 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
1a680 74 6f 20 64 65 6c 65 74 65 20 74 68 65 20 74 65 to delete the te
1a690 73 74 20 66 69 6c 65 20 6e 6f 77 2e 0d 0a 20 20 st file now...
1a6a0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1a6b0 20 20 20 20 20 69 66 20 7b 5b 73 65 74 20 63 6f if {[set co
1a6c0 64 65 20 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 de [catch {file
1a6d0 64 65 6c 65 74 65 20 24 66 69 6c 65 4e 61 6d 65 delete $fileName
1a6e0 7d 20 65 72 72 6f 72 5d 5d 7d 20 74 68 65 6e 20 } error]]} then
1a6f0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 {.. #
1a700 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 .. #
1a710 4e 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 NOTE: We somehow
1a720 20 66 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 failed to delet
1a730 65 20 74 68 65 20 66 69 6c 65 2c 20 72 65 70 6f e the file, repo
1a740 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 rt why...
1a750 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1a760 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
1a770 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
1a780 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
1a790 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 "==== W
1a7a0 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 ARNING: failed t
1a7b0 6f 20 64 65 6c 65 74 65 20 74 65 73 74 20 66 69 o delete test fi
1a7c0 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 le \"" $fileName
1a7d0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1a7e0 20 20 20 20 22 5c 22 20 64 75 72 69 6e 67 20 63 "\" during c
1a7f0 6c 65 61 6e 75 70 2c 20 65 72 72 6f 72 3a 20 22 leanup, error: "
1a800 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d \n\t $error \n]
1a810 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1a820 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
1a830 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
1a840 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1a850 53 68 6f 77 20 74 68 61 74 20 77 65 20 73 6b 69 Show that we ski
1a860 70 70 65 64 20 64 65 6c 65 74 69 6e 67 20 74 68 pped deleting th
1a870 65 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 20 e file...
1a880 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
1a890 73 65 74 20 63 6f 64 65 20 30 0d 0a 0d 0a 20 20 set code 0....
1a8a0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
1a8b0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
1a8c0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
1a8d0 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d "====
1a8e0 20 57 41 52 4e 49 4e 47 3a 20 73 6b 69 70 70 65 WARNING: skippe
1a8f0 64 20 64 65 6c 65 74 69 6e 67 20 74 65 73 74 20 d deleting test
1a900 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 file \"" $fileNa
1a910 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 me \..
1a920 20 20 20 20 22 5c 22 20 64 75 72 69 6e 67 20 63 "\" during c
1a930 6c 65 61 6e 75 70 5c 6e 22 5d 0d 0a 20 20 20 20 leanup\n"]..
1a940 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 }.. } e
1a950 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 lse {.. #
1a960 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
1a970 3a 20 54 68 65 20 66 69 6c 65 20 64 6f 65 73 20 : The file does
1a980 6e 6f 74 20 65 78 69 73 74 2c 20 73 75 63 63 65 not exist, succe
1a990 73 73 21 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ss!.. #..
1a9a0 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 64 65 set code
1a9b0 20 30 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 0.. }....
1a9c0 20 20 20 20 20 72 65 74 75 72 6e 20 24 63 6f 64 return $cod
1a9d0 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 e.. }.....
1a9e0 20 70 72 6f 63 20 63 6c 65 61 6e 75 70 4d 65 6d proc cleanupMem
1a9f0 6f 72 79 20 7b 20 76 61 72 4e 61 6d 65 20 7b 71 ory { varName {q
1aa00 75 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d uiet false} } {.
1aa10 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 . if {[have
1aa20 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d SQLiteObjectComm
1aa30 61 6e 64 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 and] && \..
1aa40 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
1aa50 67 74 68 20 24 76 61 72 4e 61 6d 65 5d 20 3e 20 gth $varName] >
1aa60 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
1aa70 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
1aa80 4e 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 74 NOTE: Refer to t
1aa90 68 65 20 73 70 65 63 69 66 69 65 64 20 76 61 72 he specified var
1aaa0 69 61 62 6c 65 20 28 65 2e 67 2e 20 22 63 6f 6e iable (e.g. "con
1aab0 6e 65 63 74 69 6f 6e 22 29 20 69 6e 20 74 68 65 nection") in the
1aac0 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
1aad0 20 20 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 context of our
1aae0 20 63 61 6c 6c 65 72 2e 20 20 54 68 65 20 6f 70 caller. The op
1aaf0 61 71 75 65 20 6f 62 6a 65 63 74 20 68 61 6e 64 aque object hand
1ab00 6c 65 20 66 6f 72 20 61 6e 0d 0a 20 20 20 20 20 le for an..
1ab10 20 20 20 23 20 20 20 20 20 20 20 41 44 4f 2e 4e # ADO.N
1ab20 45 54 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 70 72 ET connection pr
1ab30 65 76 69 6f 75 73 6c 79 20 72 65 74 75 72 6e 65 eviously returne
1ab40 64 20 62 79 20 5b 67 65 74 44 62 43 6f 6e 6e 65 d by [getDbConne
1ab50 63 74 69 6f 6e 5d 0d 0a 20 20 20 20 20 20 20 20 ction]..
1ab60 23 20 20 20 20 20 20 20 73 68 6f 75 6c 64 20 62 # should b
1ab70 65 20 73 74 6f 72 65 64 20 74 68 65 72 65 2e 0d e stored there..
1ab80 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1ab90 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 upvar 1 $var
1aba0 4e 61 6d 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 0d Name connection.
1abb0 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b ... if {[
1abc0 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
1abd0 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
1abe0 20 24 63 6f 6e 6e 65 63 74 69 6f 6e 20 52 65 6c $connection Rel
1abf0 65 61 73 65 4d 65 6d 6f 72 79 0d 0a 20 20 20 20 easeMemory..
1ac00 20 20 20 20 7d 20 72 65 73 75 6c 74 5d 7d 20 74 } result]} t
1ac10 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1ac20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
1ac30 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1ac40 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1ac50 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1ac60 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
1ac70 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 "==== WAR
1ac80 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 NING: failed to
1ac90 72 65 6c 65 61 73 65 20 64 61 74 61 62 61 73 65 release database
1aca0 20 6d 65 6d 6f 72 79 2c 20 65 72 72 6f 72 3a 20 memory, error:
1acb0 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
1acc0 20 20 20 20 20 5c 6e 5c 74 20 24 72 65 73 75 6c \n\t $resul
1acd0 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 t \n]..
1ace0 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
1acf0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1ad00 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 5b 69 6e if {[llength [in
1ad10 66 6f 20 63 6f 6d 6d 61 6e 64 73 20 64 65 62 75 fo commands debu
1ad20 67 5d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d g]] > 0} then {.
1ad30 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 . if {[ca
1ad40 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
1ad50 20 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 uplevel 1 [list
1ad60 20 64 65 62 75 67 20 70 75 72 67 65 5d 0d 0a 20 debug purge]..
1ad70 20 20 20 20 20 20 20 7d 20 72 65 73 75 6c 74 5d } result]
1ad80 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1ad90 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
1ada0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1adb0 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1adc0 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
1add0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1ade0 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
1adf0 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
1ae00 74 6f 20 70 75 72 67 65 20 63 61 6c 6c 20 66 72 to purge call fr
1ae10 61 6d 65 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d ame, error: " \.
1ae20 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1ae30 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e \n\t $result \n
1ae40 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
1ae50 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
1ae60 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
1ae70 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 75 70 6c {.. upl
1ae80 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 64 65 62 evel 1 [list deb
1ae90 75 67 20 63 6c 65 61 6e 75 70 5d 0d 0a 20 20 20 ug cleanup]..
1aea0 20 20 20 20 20 7d 20 72 65 73 75 6c 74 5d 7d 20 } result]}
1aeb0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1aec0 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
1aed0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1aee0 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
1aef0 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
1af00 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1af10 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 "==== WA
1af20 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f RNING: failed to
1af30 20 63 6c 65 61 6e 75 70 20 69 6e 74 65 72 70 72 cleanup interpr
1af40 65 74 65 72 2c 20 65 72 72 6f 72 3a 20 22 20 5c eter, error: " \
1af50 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1af60 20 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c \n\t $result \
1af70 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d n].. }.
1af80 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
1af90 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
1afa0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 75 70 {.. up
1afb0 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 64 65 level 1 [list de
1afc0 62 75 67 20 63 6f 6c 6c 65 63 74 5d 0d 0a 20 20 bug collect]..
1afd0 20 20 20 20 20 20 7d 20 72 65 73 75 6c 74 5d 7d } result]}
1afe0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1aff0 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
1b000 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1b010 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
1b020 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
1b030 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
1b040 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 "==== W
1b050 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 ARNING: failed t
1b060 6f 20 63 6f 6c 6c 65 63 74 20 67 61 72 62 61 67 o collect garbag
1b070 65 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 e, error: " \..
1b080 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c \
1b090 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d n\t $result \n].
1b0a0 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
1b0b0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
1b0c0 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
1b0d0 70 72 6f 63 20 73 65 74 75 70 4d 65 6d 6f 72 79 proc setupMemory
1b0e0 43 6f 75 6e 74 65 72 73 20 7b 20 76 61 72 4e 61 Counters { varNa
1b0f0 6d 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 me } {.. if
1b100 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a {[haveSQLiteObj
1b110 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 ectCommand]} the
1b120 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 75 70 76 n {.. upv
1b130 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 63 6f ar 1 $varName co
1b140 75 6e 74 65 72 0d 0a 0d 0a 20 20 20 20 20 20 20 unter....
1b150 20 73 65 74 20 63 6f 75 6e 74 65 72 28 31 29 20 set counter(1)
1b160 5b 6f 62 6a 65 63 74 20 63 72 65 61 74 65 20 2d [object create -
1b170 61 6c 69 61 73 20 5c 0d 0a 20 20 20 20 20 20 20 alias \..
1b180 20 20 20 20 20 53 79 73 74 65 6d 2e 44 69 61 67 System.Diag
1b190 6e 6f 73 74 69 63 73 2e 50 65 72 66 6f 72 6d 61 nostics.Performa
1b1a0 6e 63 65 43 6f 75 6e 74 65 72 20 50 72 6f 63 65 nceCounter Proce
1b1b0 73 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ss \..
1b1c0 20 20 22 57 6f 72 6b 69 6e 67 20 53 65 74 22 20 "Working Set"
1b1d0 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 5b [file rootname [
1b1e0 66 69 6c 65 20 74 61 69 6c 20 24 3a 3a 62 69 6e file tail $::bin
1b1f0 5f 66 69 6c 65 5d 5d 5d 0d 0a 0d 0a 20 20 20 20 _file]]]....
1b200 20 20 20 20 73 65 74 20 63 6f 75 6e 74 65 72 28 set counter(
1b210 32 29 20 5b 6f 62 6a 65 63 74 20 63 72 65 61 74 2) [object creat
1b220 65 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 20 20 20 e -alias \..
1b230 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
1b240 69 61 67 6e 6f 73 74 69 63 73 2e 50 65 72 66 6f iagnostics.Perfo
1b250 72 6d 61 6e 63 65 43 6f 75 6e 74 65 72 20 50 72 rmanceCounter Pr
1b260 6f 63 65 73 73 20 5c 0d 0a 20 20 20 20 20 20 20 ocess \..
1b270 20 20 20 20 20 22 57 6f 72 6b 69 6e 67 20 53 65 "Working Se
1b280 74 20 50 65 61 6b 22 20 5b 66 69 6c 65 20 72 6f t Peak" [file ro
1b290 6f 74 6e 61 6d 65 20 5b 66 69 6c 65 20 74 61 69 otname [file tai
1b2a0 6c 20 24 3a 3a 62 69 6e 5f 66 69 6c 65 5d 5d 5d l $::bin_file]]]
1b2b0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 .... set
1b2c0 63 6f 75 6e 74 65 72 28 33 29 20 5b 6f 62 6a 65 counter(3) [obje
1b2d0 63 74 20 63 72 65 61 74 65 20 2d 61 6c 69 61 73 ct create -alias
1b2e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1b2f0 53 79 73 74 65 6d 2e 44 69 61 67 6e 6f 73 74 69 System.Diagnosti
1b300 63 73 2e 50 65 72 66 6f 72 6d 61 6e 63 65 43 6f cs.PerformanceCo
1b310 75 6e 74 65 72 20 50 72 6f 63 65 73 73 20 5c 0d unter Process \.
1b320 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 50 72 . "Pr
1b330 69 76 61 74 65 20 42 79 74 65 73 22 20 5b 66 69 ivate Bytes" [fi
1b340 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 5b 66 69 6c le rootname [fil
1b350 65 20 74 61 69 6c 20 24 3a 3a 62 69 6e 5f 66 69 e tail $::bin_fi
1b360 6c 65 5d 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a le]]].. }..
1b370 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 22 .. return "
1b380 22 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 ".. }.....
1b390 20 70 72 6f 63 20 72 65 70 6f 72 74 4d 65 6d 6f proc reportMemo
1b3a0 72 79 43 6f 75 6e 74 65 72 73 20 7b 20 63 68 61 ryCounters { cha
1b3b0 6e 6e 65 6c 20 76 61 72 4e 61 6d 65 20 70 72 65 nnel varName pre
1b3c0 66 69 78 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 fix } {.. i
1b3d0 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 f {[haveSQLiteOb
1b3e0 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 jectCommand]} th
1b3f0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 75 70 en {.. up
1b400 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 63 var 1 $varName c
1b410 6f 75 6e 74 65 72 0d 0a 0d 0a 20 20 20 20 20 20 ounter....
1b420 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1b430 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1b440 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
1b450 2d 20 22 20 24 70 72 65 66 69 78 20 22 20 63 6f - " $prefix " co
1b460 75 6e 74 65 72 20 5c 22 22 20 5c 0d 0a 20 20 20 unter \"" \..
1b470 20 20 20 20 20 20 20 20 20 5b 6f 62 6a 65 63 74 [object
1b480 20 69 6e 76 6f 6b 65 20 24 63 6f 75 6e 74 65 72 invoke $counter
1b490 28 31 29 20 43 6f 75 6e 74 65 72 4e 61 6d 65 5d (1) CounterName]
1b4a0 20 22 5c 22 20 76 61 6c 75 65 20 69 73 20 22 20 "\" value is "
1b4b0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
1b4c0 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 24 63 object invoke $c
1b4d0 6f 75 6e 74 65 72 28 31 29 20 52 61 77 56 61 6c ounter(1) RawVal
1b4e0 75 65 5d 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 ue] \n]....
1b4f0 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
1b500 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
1b510 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d . "--
1b520 2d 2d 20 22 20 24 70 72 65 66 69 78 20 22 20 63 -- " $prefix " c
1b530 6f 75 6e 74 65 72 20 5c 22 22 20 5c 0d 0a 20 20 ounter \"" \..
1b540 20 20 20 20 20 20 20 20 20 20 5b 6f 62 6a 65 63 [objec
1b550 74 20 69 6e 76 6f 6b 65 20 24 63 6f 75 6e 74 65 t invoke $counte
1b560 72 28 32 29 20 43 6f 75 6e 74 65 72 4e 61 6d 65 r(2) CounterName
1b570 5d 20 22 5c 22 20 76 61 6c 75 65 20 69 73 20 22 ] "\" value is "
1b580 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1b590 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 24 [object invoke $
1b5a0 63 6f 75 6e 74 65 72 28 32 29 20 52 61 77 56 61 counter(2) RawVa
1b5b0 6c 75 65 5d 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 lue] \n]....
1b5c0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1b5d0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
1b5e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d .. "-
1b5f0 2d 2d 2d 20 22 20 24 70 72 65 66 69 78 20 22 20 --- " $prefix "
1b600 63 6f 75 6e 74 65 72 20 5c 22 22 20 5c 0d 0a 20 counter \"" \..
1b610 20 20 20 20 20 20 20 20 20 20 20 5b 6f 62 6a 65 [obje
1b620 63 74 20 69 6e 76 6f 6b 65 20 24 63 6f 75 6e 74 ct invoke $count
1b630 65 72 28 33 29 20 43 6f 75 6e 74 65 72 4e 61 6d er(3) CounterNam
1b640 65 5d 20 22 5c 22 20 76 61 6c 75 65 20 69 73 20 e] "\" value is
1b650 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
1b660 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 [object invoke
1b670 24 63 6f 75 6e 74 65 72 28 33 29 20 52 61 77 56 $counter(3) RawV
1b680 61 6c 75 65 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 alue] \n]..
1b690 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
1b6a0 20 20 70 72 6f 63 20 63 6f 6c 6c 65 63 74 47 61 proc collectGa
1b6b0 72 62 61 67 65 20 7b 20 63 68 61 6e 6e 65 6c 20 rbage { channel
1b6c0 7b 6d 69 6c 6c 69 73 65 63 6f 6e 64 73 20 31 30 {milliseconds 10
1b6d0 30 30 7d 20 7b 71 75 69 65 74 20 74 72 75 65 7d 00} {quiet true}
1b6e0 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b } {.. if {
1b6f0 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 [haveSQLiteObjec
1b700 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 tCommand]} then
1b710 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b {.. if {[
1b720 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
1b730 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
1b740 20 47 43 20 47 65 74 54 6f 74 61 6c 4d 65 6d 6f GC GetTotalMemo
1b750 72 79 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 ry false..
1b760 20 20 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 30 } result] == 0
1b770 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1b780 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
1b790 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1b7a0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1b7b0 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1b7c0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1b7d0 20 20 20 22 2d 2d 2d 2d 20 6d 65 6d 6f 72 79 20 "---- memory
1b7e0 69 6e 20 75 73 65 20 62 79 20 74 68 65 20 43 4c in use by the CL
1b7f0 52 20 62 65 66 6f 72 65 20 63 6f 6c 6c 65 63 74 R before collect
1b800 69 6f 6e 2e 2e 2e 20 22 20 5c 0d 0a 20 20 20 20 ion... " \..
1b810 20 20 20 20 20 20 20 20 20 20 20 20 24 72 65 73 $res
1b820 75 6c 74 20 22 20 62 79 74 65 73 5c 6e 22 5d 0d ult " bytes\n"].
1b830 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
1b840 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
1b850 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
1b860 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
1b870 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
1b880 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
1b890 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
1b8a0 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 "==== W
1b8b0 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 ARNING: failed t
1b8c0 6f 20 67 65 74 20 43 4c 52 20 6d 65 6d 6f 72 79 o get CLR memory
1b8d0 20 75 73 61 67 65 2c 20 65 72 72 6f 72 3a 20 22 usage, error: "
1b8e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1b8f0 20 20 20 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 \n\t $result
1b900 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
1b910 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
1b920 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 }.... #
1b930 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b940 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b950 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b960 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1b970 23 23 23 23 23 23 23 23 0d 0a 0d 0a 20 20 20 20 ########....
1b980 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1b990 45 3a 20 52 65 70 65 61 74 65 64 6c 79 20 61 74 E: Repeatedly at
1b9a0 74 65 6d 70 74 20 74 6f 20 63 6f 6c 6c 65 63 74 tempt to collect
1b9b0 20 67 61 72 62 61 67 65 20 75 6e 74 69 6c 20 74 garbage until t
1b9c0 68 65 20 61 6c 6c 6f 74 74 65 64 20 6e 75 6d 62 he allotted numb
1b9d0 65 72 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 er.. #
1b9e0 20 20 6f 66 20 6d 69 6c 6c 69 73 65 63 6f 6e 64 of millisecond
1b9f0 73 20 68 61 73 20 65 6c 61 70 73 65 64 2e 20 20 s has elapsed.
1ba00 41 6c 77 61 79 73 20 61 74 74 65 6d 70 74 20 74 Always attempt t
1ba10 6f 20 63 6f 6c 6c 65 63 74 20 67 61 72 62 61 67 o collect garbag
1ba20 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
1ba30 20 61 74 20 6c 65 61 73 74 20 6f 6e 63 65 2e 0d at least once..
1ba40 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
1ba50 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f if {[haveSQLiteO
1ba60 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 bjectCommand]} t
1ba70 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 hen {.. s
1ba80 65 74 20 73 74 61 72 74 20 5b 63 6c 6f 63 6b 20 et start [clock
1ba90 73 65 63 6f 6e 64 73 5d 0d 0a 20 20 20 20 20 20 seconds]..
1baa0 20 20 73 65 74 20 73 74 6f 70 20 5b 65 78 70 72 set stop [expr
1bab0 20 7b 24 73 74 61 72 74 20 2b 20 28 24 6d 69 6c {$start + ($mil
1bac0 6c 69 73 65 63 6f 6e 64 73 20 2f 20 31 30 30 30 liseconds / 1000
1bad0 29 7d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 64 )}].... d
1bae0 6f 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 o {.. #
1baf0 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f .. # NO
1bb00 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 66 TE: Attempt to f
1bb10 6f 72 63 65 20 61 20 66 75 6c 6c 20 67 61 72 62 orce a full garb
1bb20 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 6e age collection n
1bb30 6f 77 2e 20 20 52 65 70 6f 72 74 20 61 6e 79 0d ow. Report any.
1bb40 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
1bb50 20 20 20 65 72 72 6f 72 20 74 68 61 74 20 69 73 error that is
1bb60 20 65 6e 63 6f 75 6e 74 65 72 65 64 20 69 66 20 encountered if
1bb70 77 65 20 66 61 69 6c 2e 0d 0a 20 20 20 20 20 20 we fail...
1bb80 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
1bb90 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
1bba0 20 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 objec
1bbb0 74 20 69 6e 76 6f 6b 65 20 47 43 20 47 65 74 54 t invoke GC GetT
1bbc0 6f 74 61 6c 4d 65 6d 6f 72 79 20 74 72 75 65 0d otalMemory true.
1bbd0 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 72 72 . } err
1bbe0 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 or]} then {..
1bbf0 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
1bc00 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
1bc10 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1bc20 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
1bc30 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1bc40 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d "===
1bc50 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 = WARNING: faile
1bc60 64 20 66 75 6c 6c 20 67 61 72 62 61 67 65 20 63 d full garbage c
1bc70 6f 6c 6c 65 63 74 69 6f 6e 2c 20 65 72 72 6f 72 ollection, error
1bc80 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 : " \..
1bc90 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 65 \n\t $e
1bca0 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 rror \n]..
1bcb0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1bcc0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1bcd0 20 20 73 65 74 20 6e 6f 77 20 5b 63 6c 6f 63 6b set now [clock
1bce0 20 73 65 63 6f 6e 64 73 5d 0d 0a 20 20 20 20 20 seconds]..
1bcf0 20 20 20 7d 20 77 68 69 6c 65 20 7b 24 73 74 61 } while {$sta
1bd00 72 74 20 3c 3d 20 24 6e 6f 77 20 26 26 20 24 6e rt <= $now && $n
1bd10 6f 77 20 3c 20 24 73 74 6f 70 7d 0d 0a 20 20 20 ow < $stop}..
1bd20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 23 }.... ##
1bd30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1bd40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1bd50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1bd60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1bd70 23 23 23 23 23 23 23 0d 0a 0d 0a 20 20 20 20 20 #######....
1bd80 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 if {[haveSQLite
1bd90 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 ObjectCommand]}
1bda0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1bdb0 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 if {[catch {..
1bdc0 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 object i
1bdd0 6e 76 6f 6b 65 20 47 43 20 47 65 74 54 6f 74 61 nvoke GC GetTota
1bde0 6c 4d 65 6d 6f 72 79 20 66 61 6c 73 65 0d 0a 20 lMemory false..
1bdf0 20 20 20 20 20 20 20 7d 20 72 65 73 75 6c 74 5d } result]
1be00 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
1be10 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
1be20 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
1be30 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
1be40 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
1be50 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1be60 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6d 65 "---- me
1be70 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 79 20 74 mory in use by t
1be80 68 65 20 43 4c 52 20 61 66 74 65 72 20 63 6f 6c he CLR after col
1be90 6c 65 63 74 69 6f 6e 2e 2e 2e 20 22 20 5c 0d 0a lection... " \..
1bea0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1beb0 24 72 65 73 75 6c 74 20 22 20 62 79 74 65 73 5c $result " bytes\
1bec0 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d n"].. }
1bed0 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
1bee0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 {.. if
1bef0 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
1bf00 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
1bf10 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
1bf20 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
1bf30 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d "==
1bf40 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c == WARNING: fail
1bf50 65 64 20 74 6f 20 67 65 74 20 43 4c 52 20 6d 65 ed to get CLR me
1bf60 6d 6f 72 79 20 75 73 61 67 65 2c 20 65 72 72 6f mory usage, erro
1bf70 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 r: " \..
1bf80 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 72 65 \n\t $re
1bf90 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 sult \n]..
1bfa0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1bfb0 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
1bfc0 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
1bfd0 74 53 51 4c 69 74 65 48 61 6e 64 6c 65 43 6f 75 tSQLiteHandleCou
1bfe0 6e 74 73 20 7b 20 63 68 61 6e 6e 65 6c 20 7b 71 nts { channel {q
1bff0 75 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d uiet false} } {.
1c000 0a 20 20 20 20 20 20 73 65 74 20 72 65 73 75 6c . set resul
1c010 74 20 5b 6c 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 t [list]....
1c020 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 if {[haveSQLit
1c030 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 20 eObjectCommand]
1c040 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
1c050 5b 68 61 76 65 53 51 4c 69 74 65 44 65 66 69 6e [haveSQLiteDefin
1c060 65 43 6f 6e 73 74 61 6e 74 20 43 4f 55 4e 54 5f eConstant COUNT_
1c070 48 41 4e 44 4c 45 5d 7d 20 74 68 65 6e 20 7b 0d HANDLE]} then {.
1c080 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1c090 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 # NOTE: Add
1c0a0 65 61 63 68 20 63 72 69 74 69 63 61 6c 20 68 61 each critical ha
1c0b0 6e 64 6c 65 20 63 6f 75 6e 74 20 74 6f 20 74 68 ndle count to th
1c0c0 65 20 72 65 73 75 6c 74 69 6e 67 20 6c 69 73 74 e resulting list
1c0d0 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
1c0e0 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 6e 61 foreach na
1c0f0 6d 65 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 me [list \..
1c100 20 20 20 20 20 20 20 20 63 6f 6e 6e 65 63 74 69 connecti
1c110 6f 6e 43 6f 75 6e 74 20 73 74 61 74 65 6d 65 6e onCount statemen
1c120 74 43 6f 75 6e 74 20 62 61 63 6b 75 70 43 6f 75 tCount backupCou
1c130 6e 74 20 62 6c 6f 62 43 6f 75 6e 74 5d 20 7b 0d nt blobCount] {.
1c140 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
1c150 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
1c160 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
1c170 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
1c180 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 blic \..
1c190 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
1c1a0 61 74 61 2e 53 51 4c 69 74 65 2e 44 65 62 75 67 ata.SQLite.Debug
1c1b0 44 61 74 61 20 24 6e 61 6d 65 0d 0a 20 20 20 20 Data $name..
1c1c0 20 20 20 20 20 20 7d 20 76 61 6c 75 65 5d 20 3d } value] =
1c1d0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
1c1e0 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
1c1f0 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
1c200 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1c210 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
1c220 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1c230 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
1c240 2d 20 63 72 69 74 69 63 61 6c 20 68 61 6e 64 6c - critical handl
1c250 65 20 63 6f 75 6e 74 20 5c 22 22 20 24 6e 61 6d e count \"" $nam
1c260 65 20 22 5c 22 20 69 73 20 22 20 24 76 61 6c 75 e "\" is " $valu
1c270 65 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 e \n]..
1c280 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1c290 20 20 20 20 6c 61 70 70 65 6e 64 20 72 65 73 75 lappend resu
1c2a0 6c 74 20 24 76 61 6c 75 65 0d 0a 20 20 20 20 20 lt $value..
1c2b0 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
1c2c0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
1c2d0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1c2e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
1c2f0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
1c300 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
1c310 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d "=
1c320 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 === WARNING: fai
1c330 6c 65 64 20 74 6f 20 67 65 74 20 63 72 69 74 69 led to get criti
1c340 63 61 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 cal handle count
1c350 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 \"" \..
1c360 20 20 20 20 20 20 20 20 20 20 24 6e 61 6d 65 20 $name
1c370 22 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e "\", error: " \n
1c380 5c 74 20 24 76 61 6c 75 65 20 5c 6e 5d 0d 0a 20 \t $value \n]..
1c390 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
1c3a0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1c3b0 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c }.. } el
1c3c0 73 65 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 seif {!$quiet} t
1c3d0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
1c3e0 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
1c3f0 3a 20 54 68 65 20 61 63 74 75 61 6c 20 68 61 6e : The actual han
1c400 64 6c 65 20 63 6f 75 6e 74 73 20 61 72 65 20 6e dle counts are n
1c410 6f 74 20 61 76 61 69 6c 61 62 6c 65 3b 20 74 68 ot available; th
1c420 65 72 65 66 6f 72 65 2c 20 6a 75 73 74 0d 0a 20 erefore, just..
1c430 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 # r
1c440 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 6c eturn an empty l
1c450 69 73 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ist... #.
1c460 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
1c470 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 72 channel "---- cr
1c480 69 74 69 63 61 6c 20 68 61 6e 64 6c 65 20 63 6f itical handle co
1c490 75 6e 74 73 20 75 6e 61 76 61 69 6c 61 62 6c 65 unts unavailable
1c4a0 5c 6e 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a \n".. }....
1c4b0 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 return $re
1c4c0 73 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a sult.. }.....
1c4d0 20 20 20 20 70 72 6f 63 20 73 68 75 74 64 6f 77 proc shutdow
1c4e0 6e 53 51 4c 69 74 65 20 7b 20 63 68 61 6e 6e 65 nSQLite { channe
1c4f0 6c 20 7b 66 6f 72 63 65 20 66 61 6c 73 65 7d 20 l {force false}
1c500 7b 71 75 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 {quiet false} }
1c510 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
1c520 20 20 23 20 4e 4f 54 45 3a 20 4d 61 6b 65 20 73 # NOTE: Make s
1c530 75 72 65 20 74 68 61 74 20 53 51 4c 69 74 65 20 ure that SQLite
1c540 63 6f 72 65 20 6c 69 62 72 61 72 79 20 69 73 20 core library is
1c550 63 6f 6d 70 6c 65 74 65 6c 79 20 73 68 75 74 64 completely shutd
1c560 6f 77 6e 2e 20 20 54 68 69 73 0d 0a 20 20 20 20 own. This..
1c570 20 20 23 20 20 20 20 20 20 20 69 73 20 75 73 65 # is use
1c580 64 20 62 79 20 74 65 73 74 73 20 74 68 61 74 20 d by tests that
1c590 63 68 61 6e 67 65 20 63 6f 6e 66 69 67 75 72 61 change configura
1c5a0 74 69 6f 6e 20 6f 70 74 69 6f 6e 73 20 61 6e 64 tion options and
1c5b0 2f 6f 72 20 74 68 6f 73 65 0d 0a 20 20 20 20 20 /or those..
1c5c0 20 23 20 20 20 20 20 20 20 74 68 61 74 20 6e 65 # that ne
1c5d0 65 64 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 20 ed to make sure
1c5e0 6c 6f 67 67 69 6e 67 20 69 73 20 69 6e 69 74 69 logging is initi
1c5f0 61 6c 69 7a 65 64 20 28 69 2e 65 2e 20 6a 75 73 alized (i.e. jus
1c600 74 20 69 6e 20 63 61 73 65 0d 0a 20 20 20 20 20 t in case..
1c610 20 23 20 20 20 20 20 20 20 74 68 65 20 53 51 4c # the SQL
1c620 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 ite core library
1c630 20 77 61 73 20 69 6e 69 74 69 61 6c 69 7a 65 64 was initialized
1c640 20 69 6e 20 74 68 65 20 70 72 6f 63 65 73 73 20 in the process
1c650 70 72 69 6f 72 20 74 6f 0d 0a 20 20 20 20 20 20 prior to..
1c660 23 20 20 20 20 20 20 20 74 68 65 20 53 51 4c 69 # the SQLi
1c670 74 65 4c 6f 67 20 63 6c 61 73 73 20 62 65 69 6e teLog class bein
1c680 67 20 61 62 6c 65 20 74 6f 20 73 65 74 75 70 20 g able to setup
1c690 69 74 73 20 6c 6f 67 67 69 6e 67 20 63 61 6c 6c its logging call
1c6a0 62 61 63 6b 29 2e 0d 0a 20 20 20 20 20 20 23 20 back)... #
1c6b0 20 20 20 20 20 20 4e 6f 72 6d 61 6c 6c 79 2c 20 Normally,
1c6c0 74 68 69 73 20 73 68 6f 75 6c 64 20 6f 6e 6c 79 this should only
1c6d0 20 62 65 20 70 65 72 66 6f 72 6d 65 64 20 69 66 be performed if
1c6e0 20 53 51 4c 69 74 65 20 69 73 20 6c 6f 61 64 65 SQLite is loade
1c6f0 64 20 61 6e 64 0d 0a 20 20 20 20 20 20 23 20 20 d and.. #
1c700 20 20 20 20 20 72 65 61 64 79 20 66 6f 72 20 75 ready for u
1c710 73 65 20 62 79 20 74 68 65 20 74 65 73 74 20 73 se by the test s
1c720 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a uite... #..
1c730 20 20 20 20 20 20 69 66 20 7b 24 66 6f 72 63 65 if {$force
1c740 20 7c 7c 20 5b 69 73 53 51 4c 69 74 65 52 65 61 || [isSQLiteRea
1c750 64 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 dy]} then {..
1c760 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1c770 23 20 42 55 47 46 49 58 3a 20 4d 61 6b 65 20 73 # BUGFIX: Make s
1c780 75 72 65 20 74 68 61 74 20 61 6e 79 20 22 6c 65 ure that any "le
1c790 61 6b 65 64 22 20 74 72 61 6e 73 61 63 74 69 6f aked" transactio
1c7a0 6e 73 20 61 6e 64 2f 6f 72 20 63 6f 6e 6e 65 63 ns and/or connec
1c7b0 74 69 6f 6e 73 0d 0a 20 20 20 20 20 20 20 20 23 tions.. #
1c7c0 20 20 20 20 20 20 20 20 20 61 72 65 20 63 6c 65 are cle
1c7d0 61 6e 65 64 20 75 70 20 62 65 66 6f 72 65 20 63 aned up before c
1c7e0 61 6c 6c 69 6e 67 20 74 68 65 20 6e 61 74 69 76 alling the nativ
1c7f0 65 20 73 68 75 74 64 6f 77 6e 20 66 75 6e 63 74 e shutdown funct
1c800 69 6f 6e 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ion... #.
1c810 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 . foreach
1c820 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 5b 69 6e transaction [in
1c830 66 6f 20 74 72 61 6e 73 61 63 74 69 6f 6e 73 5d fo transactions]
1c840 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 {.. if
1c850 20 7b 5b 73 74 72 69 6e 67 20 6d 61 74 63 68 20 {[string match
1c860 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1c870 20 53 79 73 74 65 6d 23 44 61 74 61 23 53 51 4c System#Data#SQL
1c880 69 74 65 23 53 51 4c 69 74 65 54 72 61 6e 73 61 ite#SQLiteTransa
1c890 63 74 69 6f 6e 23 2a 20 24 74 72 61 6e 73 61 63 ction#* $transac
1c8a0 74 69 6f 6e 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 tion]} then {..
1c8b0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b if {[
1c8c0 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
1c8d0 20 20 20 20 20 20 20 73 71 6c 20 74 72 61 6e 73 sql trans
1c8e0 61 63 74 69 6f 6e 20 72 6f 6c 6c 62 61 63 6b 20 action rollback
1c8f0 24 74 72 61 6e 73 61 63 74 69 6f 6e 0d 0a 20 20 $transaction..
1c900 20 20 20 20 20 20 20 20 20 20 7d 20 65 72 72 6f } erro
1c910 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d r] == 0} then {.
1c920 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 . i
1c930 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1c940 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1c950 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1c960 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
1c970 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c980 20 20 20 20 20 20 22 2d 2d 2d 2d 20 72 6f 6c 6c "---- roll
1c990 65 64 20 62 61 63 6b 20 6c 65 61 6b 65 64 20 74 ed back leaked t
1c9a0 72 61 6e 73 61 63 74 69 6f 6e 20 5c 22 22 20 5c ransaction \"" \
1c9b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1c9c0 20 20 20 20 20 20 24 74 72 61 6e 73 61 63 74 69 $transacti
1c9d0 6f 6e 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 on \"\n]..
1c9e0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1c9f0 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
1ca00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 . i
1ca10 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1ca20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1ca30 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1ca40 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
1ca50 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1ca60 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e "==== WARN
1ca70 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 72 ING: failed to r
1ca80 6f 6c 6c 62 61 63 6b 20 6c 65 61 6b 65 64 20 74 ollback leaked t
1ca90 72 61 6e 73 61 63 74 69 6f 6e 20 5c 22 22 20 5c ransaction \"" \
1caa0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1cab0 20 20 20 20 20 20 24 74 72 61 6e 73 61 63 74 69 $transacti
1cac0 6f 6e 20 22 5c 22 2c 20 65 72 72 6f 72 3a 20 22 on "\", error: "
1cad0 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d \n\t $error \n]
1cae0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1caf0 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d }.. }
1cb00 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1cb10 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1cb20 20 20 20 20 66 6f 72 65 61 63 68 20 64 62 20 5b foreach db [
1cb30 69 6e 66 6f 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 info connections
1cb40 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 ] {.. i
1cb50 66 20 7b 5b 73 74 72 69 6e 67 20 6d 61 74 63 68 f {[string match
1cb60 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1cb70 20 20 53 79 73 74 65 6d 23 44 61 74 61 23 53 51 System#Data#SQ
1cb80 4c 69 74 65 23 53 51 4c 69 74 65 43 6f 6e 6e 65 Lite#SQLiteConne
1cb90 63 74 69 6f 6e 23 2a 20 24 64 62 5d 7d 20 74 68 ction#* $db]} th
1cba0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1cbb0 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 73 71 if {[catch {sq
1cbc0 6c 20 63 6c 6f 73 65 20 24 64 62 7d 20 65 72 72 l close $db} err
1cbd0 6f 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b or] == 0} then {
1cbe0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1cbf0 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
1cc00 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1cc10 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1cc20 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1cc30 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1cc40 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6c 6f "---- clo
1cc50 73 65 64 20 6c 65 61 6b 65 64 20 64 61 74 61 62 sed leaked datab
1cc60 61 73 65 20 5c 22 22 20 24 64 62 20 5c 22 5c 6e ase \"" $db \"\n
1cc70 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ]..
1cc80 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
1cc90 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
1cca0 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
1ccb0 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
1ccc0 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 tpu
1ccd0 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
1cce0 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
1ccf0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1cd00 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 ==== WARNING: fa
1cd10 69 6c 65 64 20 74 6f 20 63 6c 6f 73 65 20 6c 65 iled to close le
1cd20 61 6b 65 64 20 64 61 74 61 62 61 73 65 20 5c 22 aked database \"
1cd30 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
1cd40 20 20 20 20 20 20 20 20 20 24 64 62 20 22 5c 22 $db "\"
1cd50 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 , error: " \n\t
1cd60 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 $error \n]..
1cd70 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1cd80 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1cd90 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1cda0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d }.... #.
1cdb0 0a 20 20 20 20 20 20 20 20 23 20 42 55 47 46 49 . # BUGFI
1cdc0 58 3a 20 42 65 66 6f 72 65 20 63 61 6c 6c 69 6e X: Before callin
1cdd0 67 20 74 68 65 20 6e 61 74 69 76 65 20 73 68 75 g the native shu
1cde0 74 64 6f 77 6e 20 66 75 6e 63 74 69 6f 6e 2c 20 tdown function,
1cdf0 6d 61 6b 65 20 73 75 72 65 20 62 6f 74 68 0d 0a make sure both..
1ce00 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1ce10 20 20 6f 66 20 74 68 65 20 50 52 41 47 4d 41 20 of the PRAGMA
1ce20 72 65 6c 61 74 65 64 20 64 69 72 65 63 74 6f 72 related director
1ce30 79 20 6e 61 6d 65 73 20 61 72 65 20 66 72 65 65 y names are free
1ce40 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 d... #..
1ce50 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 53 checkForS
1ce60 51 4c 69 74 65 44 69 72 65 63 74 6f 72 69 65 73 QLiteDirectories
1ce70 20 24 63 68 61 6e 6e 65 6c 20 74 72 75 65 0d 0a $channel true..
1ce80 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 .. if {[c
1ce90 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
1cea0 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
1ceb0 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
1cec0 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
1ced0 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 System.Data.S
1cee0 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e 61 74 69 QLite.UnsafeNati
1cef0 76 65 4d 65 74 68 6f 64 73 20 73 71 6c 69 74 65 veMethods sqlite
1cf00 33 5f 73 68 75 74 64 6f 77 6e 0d 0a 20 20 20 20 3_shutdown..
1cf10 20 20 20 20 7d 20 72 65 73 75 6c 74 5d 20 3d 3d } result] ==
1cf20 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
1cf30 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
1cf40 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
1cf50 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
1cf60 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
1cf70 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
1cf80 20 20 20 20 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 "---- call
1cf90 73 71 6c 69 74 65 33 5f 73 68 75 74 64 6f 77 6e sqlite3_shutdown
1cfa0 28 29 2e 2e 2e 20 6f 6b 3a 20 22 20 24 72 65 73 ()... ok: " $res
1cfb0 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ult \n]..
1cfc0 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 }.. }
1cfd0 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
1cfe0 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
1cff0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1d000 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
1d010 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
1d020 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1d030 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 "---- call sqli
1d040 74 65 33 5f 73 68 75 74 64 6f 77 6e 28 29 2e 2e te3_shutdown()..
1d050 2e 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 . error: " \n\t
1d060 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 $result \n]..
1d070 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1d080 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
1d090 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
1d0a0 20 67 65 74 53 65 74 74 69 6e 67 52 65 61 64 43 getSettingReadC
1d0b0 6f 75 6e 74 20 7b 20 6e 61 6d 65 20 7b 76 69 61 ount { name {via
1d0c0 46 69 6c 65 20 66 61 6c 73 65 7d 20 7d 20 7b 0d File false} } {.
1d0d0 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 . if {[have
1d0e0 43 6f 6e 73 74 72 61 69 6e 74 20 62 75 69 6c 64 Constraint build
1d0f0 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2e 44 65 Configuration.De
1d100 62 75 67 5d 20 26 26 20 5b 63 61 74 63 68 20 7b bug] && [catch {
1d110 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 .. object
1d120 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
1d130 4e 6f 6e 50 75 62 6c 69 63 20 2d 61 6c 69 61 73 NonPublic -alias
1d140 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1d150 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
1d160 74 65 2e 44 65 62 75 67 44 61 74 61 20 5b 65 78 te.DebugData [ex
1d170 70 72 20 7b 24 76 69 61 46 69 6c 65 20 3f 20 5c pr {$viaFile ? \
1d180 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 73 .. "s
1d190 65 74 74 69 6e 67 46 69 6c 65 52 65 61 64 43 6f ettingFileReadCo
1d1a0 75 6e 74 73 22 20 3a 20 22 73 65 74 74 69 6e 67 unts" : "setting
1d1b0 52 65 61 64 43 6f 75 6e 74 73 22 7d 5d 0d 0a 20 ReadCounts"}]..
1d1c0 20 20 20 20 20 7d 20 73 65 74 74 69 6e 67 52 65 } settingRe
1d1d0 61 64 43 6f 75 6e 74 73 5d 20 3d 3d 20 30 7d 20 adCounts] == 0}
1d1e0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1d1f0 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
1d200 74 68 20 24 6e 61 6d 65 5d 20 3e 20 30 7d 20 74 th $name] > 0} t
1d210 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1d220 20 69 66 20 7b 5b 24 73 65 74 74 69 6e 67 52 65 if {[$settingRe
1d230 61 64 43 6f 75 6e 74 73 20 54 72 79 47 65 74 56 adCounts TryGetV
1d240 61 6c 75 65 20 24 6e 61 6d 65 20 76 61 6c 75 65 alue $name value
1d250 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1d260 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
1d270 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
1d280 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
1d290 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
1d2a0 2d 20 73 65 74 74 69 6e 67 20 5c 22 22 20 24 6e - setting \"" $n
1d2b0 61 6d 65 20 22 5c 22 20 77 61 73 20 72 65 61 64 ame "\" was read
1d2c0 20 22 20 24 76 61 6c 75 65 20 22 20 74 69 6d 65 " $value " time
1d2d0 73 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 s" \..
1d2e0 20 20 20 20 20 20 5b 65 78 70 72 20 7b 24 76 69 [expr {$vi
1d2f0 61 46 69 6c 65 20 3f 20 22 20 66 72 6f 6d 20 74 aFile ? " from t
1d300 68 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e he configuration
1d310 20 66 69 6c 65 22 20 3a 20 22 22 7d 5d 20 5c 6e file" : ""}] \n
1d320 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ]....
1d330 20 72 65 74 75 72 6e 20 24 76 61 6c 75 65 0d 0a return $value..
1d340 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1d350 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
1d360 20 20 20 20 20 20 20 20 20 73 65 74 20 6e 61 6d set nam
1d370 65 43 6f 75 6e 74 20 5b 24 73 65 74 74 69 6e 67 eCount [$setting
1d380 52 65 61 64 43 6f 75 6e 74 73 20 43 6f 75 6e 74 ReadCounts Count
1d390 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 ].. set
1d3a0 20 76 61 6c 75 65 43 6f 75 6e 74 20 30 0d 0a 0d valueCount 0...
1d3b0 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 . objec
1d3c0 74 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 61 73 t foreach -alias
1d3d0 20 70 61 69 72 20 24 73 65 74 74 69 6e 67 52 65 pair $settingRe
1d3e0 61 64 43 6f 75 6e 74 73 20 7b 0d 0a 20 20 20 20 adCounts {..
1d3f0 20 20 20 20 20 20 20 20 69 6e 63 72 20 76 61 6c incr val
1d400 75 65 43 6f 75 6e 74 20 5b 24 70 61 69 72 20 56 ueCount [$pair V
1d410 61 6c 75 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 alue]....
1d420 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
1d430 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
1d440 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1d450 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1d460 73 65 74 74 69 6e 67 20 5c 22 22 20 5b 24 70 61 setting \"" [$pa
1d470 69 72 20 4b 65 79 5d 20 22 5c 22 20 77 61 73 20 ir Key] "\" was
1d480 72 65 61 64 20 22 20 5b 24 70 61 69 72 20 56 61 read " [$pair Va
1d490 6c 75 65 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 lue] \..
1d4a0 20 20 20 20 20 20 20 20 22 20 74 69 6d 65 73 22 " times"
1d4b0 20 5b 65 78 70 72 20 7b 24 76 69 61 46 69 6c 65 [expr {$viaFile
1d4c0 20 3f 20 22 20 66 72 6f 6d 20 74 68 65 20 63 6f ? " from the co
1d4d0 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 69 6c 65 nfiguration file
1d4e0 22 20 3a 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 " : \..
1d4f0 20 20 20 20 20 20 20 22 22 7d 5d 20 5c 6e 5d 0d ""}] \n].
1d500 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a . }....
1d510 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
1d520 20 5b 6c 69 73 74 20 24 6e 61 6d 65 43 6f 75 6e [list $nameCoun
1d530 74 20 24 76 61 6c 75 65 43 6f 75 6e 74 5d 0d 0a t $valueCount]..
1d540 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1d550 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b }.... if {
1d560 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
1d570 6e 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 name] > 0} then
1d580 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
1d590 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
1d5a0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1d5b0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
1d5c0 2d 20 73 65 74 74 69 6e 67 20 5c 22 22 20 24 6e - setting \"" $n
1d5d0 61 6d 65 20 22 5c 22 20 77 61 73 20 6e 6f 74 20 ame "\" was not
1d5e0 72 65 61 64 22 20 5b 65 78 70 72 20 7b 24 76 69 read" [expr {$vi
1d5f0 61 46 69 6c 65 20 3f 20 5c 0d 0a 20 20 20 20 20 aFile ? \..
1d600 20 20 20 20 20 20 20 22 20 66 72 6f 6d 20 74 68 " from th
1d610 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 e configuration
1d620 66 69 6c 65 22 20 3a 20 22 22 7d 5d 20 5c 6e 5d file" : ""}] \n]
1d630 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
1d640 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
1d650 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
1d660 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
1d670 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
1d680 20 6e 6f 20 73 65 74 74 69 6e 67 73 20 77 65 72 no settings wer
1d690 65 20 72 65 61 64 22 20 5b 65 78 70 72 20 7b 24 e read" [expr {$
1d6a0 76 69 61 46 69 6c 65 20 3f 20 5c 0d 0a 20 20 20 viaFile ? \..
1d6b0 20 20 20 20 20 20 20 20 20 22 20 66 72 6f 6d 20 " from
1d6c0 74 68 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f the configuratio
1d6d0 6e 20 66 69 6c 65 22 20 3a 20 22 22 7d 5d 20 5c n file" : ""}] \
1d6e0 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 n].. }....
1d6f0 20 20 20 20 20 72 65 74 75 72 6e 20 2d 31 0d 0a return -1..
1d700 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
1d710 6f 63 20 67 65 74 4f 74 68 65 72 43 6f 75 6e 74 oc getOtherCount
1d720 20 7b 20 6e 61 6d 65 20 7d 20 7b 0d 0a 20 20 20 { name } {..
1d730 20 20 20 69 66 20 7b 5b 68 61 76 65 43 6f 6e 73 if {[haveCons
1d740 74 72 61 69 6e 74 20 62 75 69 6c 64 43 6f 6e 66 traint buildConf
1d750 69 67 75 72 61 74 69 6f 6e 2e 44 65 62 75 67 5d iguration.Debug]
1d760 20 26 26 20 5b 63 61 74 63 68 20 7b 0d 0a 20 20 && [catch {..
1d770 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 object inv
1d780 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 oke -flags +NonP
1d790 75 62 6c 69 63 20 2d 61 6c 69 61 73 20 5c 0d 0a ublic -alias \..
1d7a0 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
1d7b0 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 44 em.Data.SQLite.D
1d7c0 65 62 75 67 44 61 74 61 20 6f 74 68 65 72 43 6f ebugData otherCo
1d7d0 75 6e 74 73 0d 0a 20 20 20 20 20 20 7d 20 6f 74 unts.. } ot
1d7e0 68 65 72 43 6f 75 6e 74 73 5d 20 3d 3d 20 30 7d herCounts] == 0}
1d7f0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1d800 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
1d810 67 74 68 20 24 6e 61 6d 65 5d 20 3e 20 30 7d 20 gth $name] > 0}
1d820 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1d830 20 20 69 66 20 7b 5b 24 6f 74 68 65 72 43 6f 75 if {[$otherCou
1d840 6e 74 73 20 54 72 79 47 65 74 56 61 6c 75 65 20 nts TryGetValue
1d850 24 6e 61 6d 65 20 76 61 6c 75 65 5d 7d 20 74 68 $name value]} th
1d860 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1d870 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1d880 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1d890 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
1d8a0 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6f 74 68 "---- oth
1d8b0 65 72 20 63 6f 75 6e 74 65 72 20 5c 22 22 20 24 er counter \"" $
1d8c0 6e 61 6d 65 20 22 5c 22 20 68 61 73 20 76 61 6c name "\" has val
1d8d0 75 65 20 22 20 24 76 61 6c 75 65 20 5c 6e 5d 0d ue " $value \n].
1d8e0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 ... r
1d8f0 65 74 75 72 6e 20 24 76 61 6c 75 65 0d 0a 20 20 eturn $value..
1d900 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1d910 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
1d920 20 20 20 20 20 20 20 73 65 74 20 6e 61 6d 65 43 set nameC
1d930 6f 75 6e 74 20 5b 24 6f 74 68 65 72 43 6f 75 6e ount [$otherCoun
1d940 74 73 20 43 6f 75 6e 74 5d 0d 0a 20 20 20 20 20 ts Count]..
1d950 20 20 20 20 20 73 65 74 20 76 61 6c 75 65 43 6f set valueCo
1d960 75 6e 74 20 30 0d 0a 0d 0a 20 20 20 20 20 20 20 unt 0....
1d970 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 61 63 object foreac
1d980 68 20 2d 61 6c 69 61 73 20 70 61 69 72 20 24 6f h -alias pair $o
1d990 74 68 65 72 43 6f 75 6e 74 73 20 7b 0d 0a 20 20 therCounts {..
1d9a0 20 20 20 20 20 20 20 20 20 20 69 6e 63 72 20 76 incr v
1d9b0 61 6c 75 65 43 6f 75 6e 74 20 5b 24 70 61 69 72 alueCount [$pair
1d9c0 20 56 61 6c 75 65 5d 0d 0a 0d 0a 20 20 20 20 20 Value]....
1d9d0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
1d9e0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
1d9f0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
1da00 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
1da10 2d 20 6f 74 68 65 72 20 63 6f 75 6e 74 65 72 20 - other counter
1da20 5c 22 22 20 5b 24 70 61 69 72 20 4b 65 79 5d 20 \"" [$pair Key]
1da30 22 5c 22 20 68 61 73 20 76 61 6c 75 65 20 22 20 "\" has value "
1da40 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1da50 20 20 20 5b 24 70 61 69 72 20 56 61 6c 75 65 5d [$pair Value]
1da60 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
1da70 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 72 }.... r
1da80 65 74 75 72 6e 20 5b 6c 69 73 74 20 24 6e 61 6d eturn [list $nam
1da90 65 43 6f 75 6e 74 20 24 76 61 6c 75 65 43 6f 75 eCount $valueCou
1daa0 6e 74 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a nt].. }..
1dab0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1dac0 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
1dad0 67 74 68 20 24 6e 61 6d 65 5d 20 3e 20 30 7d 20 gth $name] > 0}
1dae0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1daf0 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
1db00 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
1db10 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
1db20 20 22 2d 2d 2d 2d 20 6f 74 68 65 72 20 63 6f 75 "---- other cou
1db30 6e 74 65 72 20 5c 22 22 20 24 6e 61 6d 65 20 22 nter \"" $name "
1db40 5c 22 20 68 61 73 20 6e 6f 20 76 61 6c 75 65 5c \" has no value\
1db50 6e 22 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 n"].. } els
1db60 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 e {.. tpu
1db70 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
1db80 65 6c 20 22 2d 2d 2d 2d 20 74 68 65 72 65 20 61 el "---- there a
1db90 72 65 20 6e 6f 20 6f 74 68 65 72 20 63 6f 75 6e re no other coun
1dba0 74 65 72 73 5c 6e 22 0d 0a 20 20 20 20 20 20 7d ters\n".. }
1dbb0 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e .... return
1dbc0 20 2d 31 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 -1.. }.....
1dbd0 20 20 20 70 72 6f 63 20 72 65 70 6f 72 74 53 51 proc reportSQ
1dbe0 4c 69 74 65 52 65 73 6f 75 72 63 65 73 20 7b 0d LiteResources {.
1dbf0 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 68 61 . cha
1dc00 6e 6e 65 6c 20 7b 71 75 69 65 74 20 66 61 6c 73 nnel {quiet fals
1dc10 65 7d 20 7b 72 65 73 65 74 20 74 72 75 65 7d 20 e} {reset true}
1dc20 7b 63 6f 6c 6c 65 63 74 20 74 72 75 65 7d 20 7d {collect true} }
1dc30 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
1dc40 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 70 6f # NOTE: If po
1dc50 73 73 69 62 6c 65 2c 20 61 6c 77 61 79 73 20 72 ssible, always r
1dc60 65 73 65 74 20 74 68 65 20 63 61 63 68 65 64 20 eset the cached
1dc70 61 73 73 65 6d 62 6c 79 20 64 69 72 65 63 74 6f assembly directo
1dc80 72 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ry.. #
1dc90 20 20 61 6e 64 20 74 68 65 20 63 61 63 68 65 64 and the cached
1dca0 20 58 4d 4c 20 63 6f 6e 66 69 67 75 72 61 74 69 XML configurati
1dcb0 6f 6e 20 66 69 6c 65 20 6e 61 6d 65 2e 0d 0a 20 on file name...
1dcc0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
1dcd0 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a {[haveSQLiteObj
1dce0 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 ectCommand]} the
1dcf0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
1dd00 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
1dd10 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
1dd20 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
1dd30 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 blic \..
1dd40 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 System.Dat
1dd50 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e a.SQLite.UnsafeN
1dd60 61 74 69 76 65 4d 65 74 68 6f 64 73 20 5c 0d 0a ativeMethods \..
1dd70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 52 65 Re
1dd80 73 65 74 43 61 63 68 65 64 41 73 73 65 6d 62 6c setCachedAssembl
1dd90 79 44 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 yDirectory..
1dda0 20 20 20 20 7d 20 65 72 72 6f 72 5d 20 3d 3d 20 } error] ==
1ddb0 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
1ddc0 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
1ddd0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1dde0 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1ddf0 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 72 65 73 65 74 nnel "---- reset
1de00 20 63 61 63 68 65 64 20 61 73 73 65 6d 62 6c 79 cached assembly
1de10 20 64 69 72 65 63 74 6f 72 79 5c 6e 22 0d 0a 20 directory\n"..
1de20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1de30 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
1de40 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
1de50 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
1de60 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1de70 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1de80 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
1de90 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 "==== WAR
1dea0 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 NING: failed to
1deb0 72 65 73 65 74 20 63 61 63 68 65 64 20 61 73 73 reset cached ass
1dec0 65 6d 62 6c 79 20 64 69 72 65 63 74 6f 72 79 2c embly directory,
1ded0 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 " \..
1dee0 20 20 20 20 20 20 22 65 72 72 6f 72 3a 20 22 20 "error: "
1def0 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d \n\t $error \n].
1df00 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
1df10 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1df20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
1df30 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 . objec
1df40 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 t invoke -flags
1df50 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 +NonPublic \..
1df60 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
1df70 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 em.Data.SQLite.U
1df80 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f nsafeNativeMetho
1df90 64 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ds \..
1dfa0 20 20 20 20 52 65 73 65 74 43 61 63 68 65 64 58 ResetCachedX
1dfb0 6d 6c 43 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 mlConfigFileName
1dfc0 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 72 72 6f .. } erro
1dfd0 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d r] == 0} then {.
1dfe0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 . if {!
1dff0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1e000 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1e010 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d s $channel "----
1e020 20 72 65 73 65 74 20 63 61 63 68 65 64 20 58 4d reset cached XM
1e030 4c 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 L configuration
1e040 66 69 6c 65 20 6e 61 6d 65 5c 6e 22 0d 0a 20 20 file name\n"..
1e050 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1e060 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
1e070 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
1e080 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
1e090 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
1e0a0 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1e0b0 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1e0c0 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e "==== WARN
1e0d0 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 72 ING: failed to r
1e0e0 65 73 65 74 20 63 61 63 68 65 64 20 58 4d 4c 20 eset cached XML
1e0f0 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 22 20 configuration "
1e100 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1e110 20 20 20 22 66 69 6c 65 20 6e 61 6d 65 2c 20 65 "file name, e
1e120 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 rror: " \n\t $er
1e130 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ror \n]..
1e140 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
1e150 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
1e160 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1e170 45 3a 20 49 66 20 61 76 61 69 6c 61 62 6c 65 2c E: If available,
1e180 20 72 65 70 6f 72 74 20 6f 6e 20 28 61 6e 64 20 report on (and
1e190 70 6f 73 73 69 62 6c 79 20 72 65 73 65 74 29 20 possibly reset)
1e1a0 74 68 65 20 72 75 6e 74 69 6d 65 0d 0a 20 20 20 the runtime..
1e1b0 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 66 69 # confi
1e1c0 67 75 72 61 74 69 6f 6e 20 73 74 61 74 69 73 74 guration statist
1e1d0 69 63 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ics... #..
1e1e0 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 if {[haveSQ
1e1f0 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e LiteObjectComman
1e200 64 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 d] && \..
1e210 20 20 20 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 [haveConstrai
1e220 6e 74 20 62 75 69 6c 64 43 6f 6e 66 69 67 75 72 nt buildConfigur
1e230 61 74 69 6f 6e 2e 44 65 62 75 67 5d 7d 20 74 68 ation.Debug]} th
1e240 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 en {.. if
1e250 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
1e260 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 object inv
1e270 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 oke -flags +NonP
1e280 75 62 6c 69 63 20 2d 61 6c 69 61 73 20 5c 0d 0a ublic -alias \..
1e290 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 Sy
1e2a0 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
1e2b0 2e 44 65 62 75 67 44 61 74 61 20 73 65 74 74 69 .DebugData setti
1e2c0 6e 67 52 65 61 64 43 6f 75 6e 74 73 0d 0a 20 20 ngReadCounts..
1e2d0 20 20 20 20 20 20 7d 20 73 65 74 74 69 6e 67 52 } settingR
1e2e0 65 61 64 43 6f 75 6e 74 73 5d 20 3d 3d 20 30 7d eadCounts] == 0}
1e2f0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1e300 20 20 20 73 65 74 20 6e 61 6d 65 43 6f 75 6e 74 set nameCount
1e310 20 5b 24 73 65 74 74 69 6e 67 52 65 61 64 43 6f [$settingReadCo
1e320 75 6e 74 73 20 43 6f 75 6e 74 5d 0d 0a 20 20 20 unts Count]..
1e330 20 20 20 20 20 20 20 73 65 74 20 76 61 6c 75 65 set value
1e340 43 6f 75 6e 74 20 30 0d 0a 0d 0a 20 20 20 20 20 Count 0....
1e350 20 20 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 object fore
1e360 61 63 68 20 2d 61 6c 69 61 73 20 70 61 69 72 20 ach -alias pair
1e370 24 73 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e $settingReadCoun
1e380 74 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ts {..
1e390 20 20 69 6e 63 72 20 76 61 6c 75 65 43 6f 75 6e incr valueCoun
1e3a0 74 20 5b 24 70 61 69 72 20 56 61 6c 75 65 5d 0d t [$pair Value].
1e3b0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 ... i
1e3c0 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1e3d0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1e3e0 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1e3f0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1e400 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1e410 20 20 22 2d 2d 2d 2d 20 73 65 74 74 69 6e 67 20 "---- setting
1e420 5c 22 22 20 5b 24 70 61 69 72 20 4b 65 79 5d 20 \"" [$pair Key]
1e430 22 5c 22 20 77 61 73 20 72 65 61 64 20 22 20 5c "\" was read " \
1e440 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1e450 20 20 20 20 5b 24 70 61 69 72 20 56 61 6c 75 65 [$pair Value
1e460 5d 20 22 20 74 69 6d 65 73 5c 6e 22 5d 0d 0a 20 ] " times\n"]..
1e470 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
1e480 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
1e490 20 20 20 20 20 20 20 69 66 20 7b 24 72 65 73 65 if {$rese
1e4a0 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
1e4b0 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
1e4c0 68 20 7b 24 73 65 74 74 69 6e 67 52 65 61 64 43 h {$settingReadC
1e4d0 6f 75 6e 74 73 20 43 6c 65 61 72 7d 20 65 72 72 ounts Clear} err
1e4e0 6f 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b or] == 0} then {
1e4f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1e500 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
1e510 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1e520 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1e530 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1e540 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1e550 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 72 65 73 "---- res
1e560 65 74 20 73 65 74 74 69 6e 67 20 73 74 61 74 69 et setting stati
1e570 73 74 69 63 73 20 66 6f 72 20 74 68 65 20 70 72 stics for the pr
1e580 65 76 69 6f 75 73 20 22 20 5c 0d 0a 20 20 20 20 evious " \..
1e590 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1e5a0 24 6e 61 6d 65 43 6f 75 6e 74 20 22 20 6e 61 6d $nameCount " nam
1e5b0 65 73 20 61 6e 64 20 22 20 24 76 61 6c 75 65 43 es and " $valueC
1e5c0 6f 75 6e 74 20 22 20 76 61 6c 75 65 73 20 72 65 ount " values re
1e5d0 61 64 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 ad\n"]..
1e5e0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1e5f0 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
1e600 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
1e610 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
1e620 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1e630 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1e640 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1e650 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1e660 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e "==== WARNIN
1e670 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 72 65 73 G: failed to res
1e680 65 74 20 73 65 74 74 69 6e 67 20 73 74 61 74 69 et setting stati
1e690 73 74 69 63 73 20 66 6f 72 20 22 20 5c 0d 0a 20 stics for " \..
1e6a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1e6b0 20 20 20 22 74 68 65 20 70 72 65 76 69 6f 75 73 "the previous
1e6c0 20 22 20 24 6e 61 6d 65 43 6f 75 6e 74 20 22 20 " $nameCount "
1e6d0 6e 61 6d 65 73 20 61 6e 64 20 22 20 24 76 61 6c names and " $val
1e6e0 75 65 43 6f 75 6e 74 20 5c 0d 0a 20 20 20 20 20 ueCount \..
1e6f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1e700 20 76 61 6c 75 65 73 20 72 65 61 64 2c 20 65 72 values read, er
1e710 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 ror: " \n\t $err
1e720 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 or \n]..
1e730 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1e740 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1e750 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
1e760 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 .. if {[c
1e770 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
1e780 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
1e790 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
1e7a0 63 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 20 20 20 c -alias \..
1e7b0 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
1e7c0 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 44 65 62 .Data.SQLite.Deb
1e7d0 75 67 44 61 74 61 20 73 65 74 74 69 6e 67 46 69 ugData settingFi
1e7e0 6c 65 52 65 61 64 43 6f 75 6e 74 73 0d 0a 20 20 leReadCounts..
1e7f0 20 20 20 20 20 20 7d 20 73 65 74 74 69 6e 67 46 } settingF
1e800 69 6c 65 52 65 61 64 43 6f 75 6e 74 73 5d 20 3d ileReadCounts] =
1e810 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
1e820 20 20 20 20 20 20 20 73 65 74 20 6e 61 6d 65 43 set nameC
1e830 6f 75 6e 74 20 5b 24 73 65 74 74 69 6e 67 46 69 ount [$settingFi
1e840 6c 65 52 65 61 64 43 6f 75 6e 74 73 20 43 6f 75 leReadCounts Cou
1e850 6e 74 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 73 nt].. s
1e860 65 74 20 76 61 6c 75 65 43 6f 75 6e 74 20 30 0d et valueCount 0.
1e870 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a ... obj
1e880 65 63 74 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 ect foreach -ali
1e890 61 73 20 70 61 69 72 20 24 73 65 74 74 69 6e 67 as pair $setting
1e8a0 46 69 6c 65 52 65 61 64 43 6f 75 6e 74 73 20 7b FileReadCounts {
1e8b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 6e .. in
1e8c0 63 72 20 76 61 6c 75 65 43 6f 75 6e 74 20 5b 24 cr valueCount [$
1e8d0 70 61 69 72 20 56 61 6c 75 65 5d 0d 0a 0d 0a 20 pair Value]....
1e8e0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
1e8f0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1e900 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
1e910 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
1e920 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
1e930 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
1e940 2d 2d 2d 20 73 65 74 74 69 6e 67 20 5c 22 22 20 --- setting \""
1e950 5b 24 70 61 69 72 20 4b 65 79 5d 20 22 5c 22 20 [$pair Key] "\"
1e960 77 61 73 20 72 65 61 64 20 22 20 5c 0d 0a 20 20 was read " \..
1e970 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1e980 5b 24 70 61 69 72 20 56 61 6c 75 65 5d 20 22 20 [$pair Value] "
1e990 74 69 6d 65 73 20 66 72 6f 6d 20 74 68 65 20 63 times from the c
1e9a0 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 69 6c onfiguration fil
1e9b0 65 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 e\n"]..
1e9c0 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
1e9d0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 }.... i
1e9e0 66 20 7b 24 72 65 73 65 74 7d 20 74 68 65 6e 20 f {$reset} then
1e9f0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 {.. i
1ea00 66 20 7b 5b 63 61 74 63 68 20 7b 24 73 65 74 74 f {[catch {$sett
1ea10 69 6e 67 46 69 6c 65 52 65 61 64 43 6f 75 6e 74 ingFileReadCount
1ea20 73 20 43 6c 65 61 72 7d 20 65 72 72 6f 72 5d 20 s Clear} error]
1ea30 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
1ea40 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
1ea50 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
1ea60 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1ea70 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
1ea80 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
1ea90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1eaa0 20 20 20 22 2d 2d 2d 2d 20 72 65 73 65 74 20 73 "---- reset s
1eab0 65 74 74 69 6e 67 20 73 74 61 74 69 73 74 69 63 etting statistic
1eac0 73 20 66 6f 72 20 74 68 65 20 70 72 65 76 69 6f s for the previo
1ead0 75 73 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 us " \..
1eae0 20 20 20 20 20 20 20 20 20 20 20 20 24 6e 61 6d $nam
1eaf0 65 43 6f 75 6e 74 20 22 20 6e 61 6d 65 73 20 61 eCount " names a
1eb00 6e 64 20 22 20 24 76 61 6c 75 65 43 6f 75 6e 74 nd " $valueCount
1eb10 20 22 20 76 61 6c 75 65 73 20 72 65 61 64 20 22 " values read "
1eb20 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1eb30 20 20 20 20 20 20 20 20 22 66 72 6f 6d 20 74 68 "from th
1eb40 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 e configuration
1eb50 66 69 6c 65 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 file\n"]..
1eb60 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1eb70 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
1eb80 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 . i
1eb90 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1eba0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1ebb0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1ebc0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
1ebd0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1ebe0 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e "==== WARN
1ebf0 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 72 ING: failed to r
1ec00 65 73 65 74 20 73 65 74 74 69 6e 67 20 73 74 61 eset setting sta
1ec10 74 69 73 74 69 63 73 20 66 6f 72 20 22 20 5c 0d tistics for " \.
1ec20 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1ec30 20 20 20 20 20 22 74 68 65 20 70 72 65 76 69 6f "the previo
1ec40 75 73 20 22 20 24 6e 61 6d 65 43 6f 75 6e 74 20 us " $nameCount
1ec50 22 20 6e 61 6d 65 73 20 61 6e 64 20 22 20 24 76 " names and " $v
1ec60 61 6c 75 65 43 6f 75 6e 74 20 5c 0d 0a 20 20 20 alueCount \..
1ec70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ec80 20 22 20 76 61 6c 75 65 73 20 72 65 61 64 20 66 " values read f
1ec90 72 6f 6d 20 74 68 65 20 63 6f 6e 66 69 67 75 72 rom the configur
1eca0 61 74 69 6f 6e 20 66 69 6c 65 2c 20 65 72 72 6f ation file, erro
1ecb0 72 3a 20 22 20 5c 6e 5c 74 20 5c 0d 0a 20 20 20 r: " \n\t \..
1ecc0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ecd0 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 $error \n]..
1ece0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
1ecf0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1ed00 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1ed10 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
1ed20 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
1ed30 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
1ed40 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e voke -flags +Non
1ed50 50 75 62 6c 69 63 20 2d 61 6c 69 61 73 20 5c 0d Public -alias \.
1ed60 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 . S
1ed70 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1ed80 65 2e 44 65 62 75 67 44 61 74 61 20 6f 74 68 65 e.DebugData othe
1ed90 72 43 6f 75 6e 74 73 0d 0a 20 20 20 20 20 20 20 rCounts..
1eda0 20 7d 20 6f 74 68 65 72 43 6f 75 6e 74 73 5d 20 } otherCounts]
1edb0 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
1edc0 20 20 20 20 20 20 20 20 73 65 74 20 6e 61 6d 65 set name
1edd0 43 6f 75 6e 74 20 5b 24 6f 74 68 65 72 43 6f 75 Count [$otherCou
1ede0 6e 74 73 20 43 6f 75 6e 74 5d 0d 0a 20 20 20 20 nts Count]..
1edf0 20 20 20 20 20 20 73 65 74 20 76 61 6c 75 65 43 set valueC
1ee00 6f 75 6e 74 20 30 0d 0a 0d 0a 20 20 20 20 20 20 ount 0....
1ee10 20 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 61 object forea
1ee20 63 68 20 2d 61 6c 69 61 73 20 70 61 69 72 20 24 ch -alias pair $
1ee30 6f 74 68 65 72 43 6f 75 6e 74 73 20 7b 0d 0a 20 otherCounts {..
1ee40 20 20 20 20 20 20 20 20 20 20 20 69 6e 63 72 20 incr
1ee50 76 61 6c 75 65 43 6f 75 6e 74 20 5b 24 70 61 69 valueCount [$pai
1ee60 72 20 56 61 6c 75 65 5d 0d 0a 0d 0a 20 20 20 20 r Value]....
1ee70 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
1ee80 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
1ee90 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
1eea0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
1eeb0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
1eec0 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
1eed0 20 6f 74 68 65 72 20 63 6f 75 6e 74 65 72 20 5c other counter \
1eee0 22 22 20 5b 24 70 61 69 72 20 4b 65 79 5d 20 22 "" [$pair Key] "
1eef0 5c 22 20 68 61 73 20 76 61 6c 75 65 20 22 20 5c \" has value " \
1ef00 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1ef10 20 20 20 20 5b 24 70 61 69 72 20 56 61 6c 75 65 [$pair Value
1ef20 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 ] \n]..
1ef30 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
1ef40 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 }.... i
1ef50 66 20 7b 24 72 65 73 65 74 7d 20 74 68 65 6e 20 f {$reset} then
1ef60 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 {.. i
1ef70 66 20 7b 5b 63 61 74 63 68 20 7b 24 6f 74 68 65 f {[catch {$othe
1ef80 72 43 6f 75 6e 74 73 20 43 6c 65 61 72 7d 20 65 rCounts Clear} e
1ef90 72 72 6f 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e rror] == 0} then
1efa0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1efb0 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
1efc0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1efd0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
1efe0 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
1eff0 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
1f000 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 72 "---- r
1f010 65 73 65 74 20 6f 74 68 65 72 20 63 6f 75 6e 74 eset other count
1f020 65 72 73 20 66 6f 72 20 74 68 65 20 70 72 65 76 ers for the prev
1f030 69 6f 75 73 20 22 20 5c 0d 0a 20 20 20 20 20 20 ious " \..
1f040 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 6e $n
1f050 61 6d 65 43 6f 75 6e 74 20 22 20 6e 61 6d 65 73 ameCount " names
1f060 20 61 6e 64 20 22 20 24 76 61 6c 75 65 43 6f 75 and " $valueCou
1f070 6e 74 20 22 20 76 61 6c 75 65 73 5c 6e 22 5d 0d nt " values\n"].
1f080 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
1f090 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 .. }
1f0a0 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
1f0b0 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
1f0c0 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
1f0d0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
1f0e0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
1f0f0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
1f100 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d "==
1f110 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c == WARNING: fail
1f120 65 64 20 74 6f 20 72 65 73 65 74 20 6f 74 68 65 ed to reset othe
1f130 72 20 63 6f 75 6e 74 65 72 73 20 66 6f 72 20 22 r counters for "
1f140 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1f150 20 20 20 20 20 20 20 20 22 74 68 65 20 70 72 65 "the pre
1f160 76 69 6f 75 73 20 22 20 24 6e 61 6d 65 43 6f 75 vious " $nameCou
1f170 6e 74 20 22 20 6e 61 6d 65 73 20 61 6e 64 20 22 nt " names and "
1f180 20 24 76 61 6c 75 65 43 6f 75 6e 74 20 5c 0d 0a $valueCount \..
1f190 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1f1a0 20 20 20 20 22 20 76 61 6c 75 65 73 2c 20 65 72 " values, er
1f1b0 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 ror: " \n\t $err
1f1c0 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 or \n]..
1f1d0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1f1e0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1f1f0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
1f200 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1f210 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 if {[haveSQLite
1f220 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 20 26 ObjectCommand] &
1f230 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b & \.. [
1f240 68 61 76 65 53 51 4c 69 74 65 44 65 66 69 6e 65 haveSQLiteDefine
1f250 43 6f 6e 73 74 61 6e 74 20 49 4e 54 45 52 4f 50 Constant INTEROP
1f260 5f 56 49 52 54 55 41 4c 5f 54 41 42 4c 45 5d 20 _VIRTUAL_TABLE]
1f270 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
1f280 5b 68 61 76 65 53 51 4c 69 74 65 44 65 66 69 6e [haveSQLiteDefin
1f290 65 43 6f 6e 73 74 61 6e 74 20 54 52 41 43 4b 5f eConstant TRACK_
1f2a0 4d 45 4d 4f 52 59 5f 42 59 54 45 53 5d 7d 20 74 MEMORY_BYTES]} t
1f2b0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 hen {.. i
1f2c0 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1f2d0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 {.. tp
1f2e0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d uts $channel "--
1f2f0 2d 2d 20 63 75 72 72 65 6e 74 20 6d 65 6d 6f 72 -- current memor
1f300 79 20 69 6e 20 75 73 65 20 62 79 20 53 51 4c 69 y in use by SQLi
1f310 74 65 4d 65 6d 6f 72 79 2e 2e 2e 20 22 0d 0a 20 teMemory... "..
1f320 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1f330 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
1f340 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 .. obje
1f350 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
1f360 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 +NonPublic \..
1f370 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 Sys
1f380 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
1f390 53 51 4c 69 74 65 4d 65 6d 6f 72 79 20 62 79 74 SQLiteMemory byt
1f3a0 65 73 41 6c 6c 6f 63 61 74 65 64 0d 0a 20 20 20 esAllocated..
1f3b0 20 20 20 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d } memory] =
1f3c0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
1f3d0 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
1f3e0 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
1f3f0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
1f400 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1f410 67 73 20 24 6d 65 6d 6f 72 79 20 22 20 62 79 74 gs $memory " byt
1f420 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 es\n"]..
1f430 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 }.. } e
1f440 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
1f450 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e set memory unkn
1f460 6f 77 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 own....
1f470 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
1f480 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1f490 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1f4a0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 [appendArgs $me
1f4b0 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 mory \n]..
1f4c0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1f4d0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
1f4e0 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
1f4f0 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
1f500 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 $channel "----
1f510 6d 61 78 69 6d 75 6d 20 6d 65 6d 6f 72 79 20 69 maximum memory i
1f520 6e 20 75 73 65 20 62 79 20 53 51 4c 69 74 65 4d n use by SQLiteM
1f530 65 6d 6f 72 79 2e 2e 2e 20 22 0d 0a 20 20 20 20 emory... "..
1f540 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
1f550 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
1f560 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
1f570 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
1f580 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
1f590 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
1f5a0 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c .Data.SQLite.SQL
1f5b0 69 74 65 4d 65 6d 6f 72 79 20 6d 61 78 69 6d 75 iteMemory maximu
1f5c0 6d 42 79 74 65 73 41 6c 6c 6f 63 61 74 65 64 0d mBytesAllocated.
1f5d0 0a 20 20 20 20 20 20 20 20 7d 20 6d 65 6d 6f 72 . } memor
1f5e0 79 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d y] == 0} then {.
1f5f0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 . if {!
1f600 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1f610 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1f620 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
1f630 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 22 ndArgs $memory "
1f640 20 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 bytes\n"]..
1f650 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1f660 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
1f670 20 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 set memory
1f680 75 6e 6b 6e 6f 77 6e 0d 0a 0d 0a 20 20 20 20 20 unknown....
1f690 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
1f6a0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1f6b0 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1f6c0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1f6d0 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 $memory \n]..
1f6e0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1f6f0 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
1f700 0a 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 . if {!$qui
1f710 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
1f720 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1f730 65 6c 20 22 2d 2d 2d 2d 20 63 75 72 72 65 6e 74 el "---- current
1f740 20 6d 65 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 memory in use b
1f750 79 20 53 51 4c 69 74 65 2e 2e 2e 20 22 0d 0a 20 y SQLite... "..
1f760 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1f770 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f if {[haveSQLiteO
1f780 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 bjectCommand]} t
1f790 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 hen {.. i
1f7a0 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
1f7b0 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
1f7c0 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e voke -flags +Non
1f7d0 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 Public \..
1f7e0 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
1f7f0 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 ata.SQLite.Unsaf
1f800 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 20 73 eNativeMethods s
1f810 71 6c 69 74 65 33 5f 6d 65 6d 6f 72 79 5f 75 73 qlite3_memory_us
1f820 65 64 0d 0a 20 20 20 20 20 20 20 20 7d 20 6d 65 ed.. } me
1f830 6d 6f 72 79 5d 20 3d 3d 20 30 7d 20 74 68 65 6e mory] == 0} then
1f840 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 {.. if
1f850 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
1f860 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
1f870 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
1f880 70 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 ppendArgs $memor
1f890 79 20 22 20 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 y " bytes\n"]..
1f8a0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1f8b0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
1f8c0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1f8d0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4d 61 79 # NOTE: May
1f8e0 62 65 20 74 68 65 20 53 51 4c 69 74 65 20 63 6f be the SQLite co
1f8f0 72 65 20 6c 69 62 72 61 72 79 20 69 73 20 75 6e re library is un
1f900 61 76 61 69 6c 61 62 6c 65 3f 0d 0a 20 20 20 20 available?..
1f910 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1f920 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e set memory un
1f930 6b 6e 6f 77 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 known....
1f940 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
1f950 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1f960 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1f970 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 el [appendArgs $
1f980 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 memory \n]..
1f990 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1f9a0 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 }.. } else
1f9b0 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 {.. set
1f9c0 6d 65 6d 6f 72 79 20 75 6e 61 76 61 69 6c 61 62 memory unavailab
1f9d0 6c 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 le.... if
1f9e0 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
1f9f0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 {.. tpu
1fa00 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
1fa10 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 endArgs $memory
1fa20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a \n].. }..
1fa30 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1fa40 20 73 65 74 20 72 65 73 75 6c 74 20 24 6d 65 6d set result $mem
1fa50 6f 72 79 3b 20 23 20 4e 4f 54 45 3a 20 52 65 74 ory; # NOTE: Ret
1fa60 75 72 6e 20 6d 65 6d 6f 72 79 20 69 6e 2d 75 73 urn memory in-us
1fa70 65 20 74 6f 20 6f 75 72 20 63 61 6c 6c 65 72 2e e to our caller.
1fa80 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 24 .... if {!$
1fa90 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
1faa0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
1fab0 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 6d 61 78 69 annel "---- maxi
1fac0 6d 75 6d 20 6d 65 6d 6f 72 79 20 69 6e 20 75 73 mum memory in us
1fad0 65 20 62 79 20 53 51 4c 69 74 65 2e 2e 2e 20 22 e by SQLite... "
1fae0 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
1faf0 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 if {[haveSQLi
1fb00 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d teObjectCommand]
1fb10 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1fb20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
1fb30 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
1fb40 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
1fb50 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 NonPublic \..
1fb60 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 Syste
1fb70 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e m.Data.SQLite.Un
1fb80 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 safeNativeMethod
1fb90 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
1fba0 20 20 20 73 71 6c 69 74 65 33 5f 6d 65 6d 6f 72 sqlite3_memor
1fbb0 79 5f 68 69 67 68 77 61 74 65 72 20 30 0d 0a 20 y_highwater 0..
1fbc0 20 20 20 20 20 20 20 7d 20 6d 65 6d 6f 72 79 5d } memory]
1fbd0 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
1fbe0 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
1fbf0 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
1fc00 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
1fc10 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
1fc20 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 22 20 62 Args $memory " b
1fc30 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 ytes\n"]..
1fc40 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1fc50 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
1fc60 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
1fc70 23 20 4e 4f 54 45 3a 20 4d 61 79 62 65 20 74 68 # NOTE: Maybe th
1fc80 65 20 53 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 e SQLite core li
1fc90 62 72 61 72 79 20 69 73 20 75 6e 61 76 61 69 6c brary is unavail
1fca0 61 62 6c 65 3f 0d 0a 20 20 20 20 20 20 20 20 20 able?..
1fcb0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 #.. se
1fcc0 74 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e t memory unknown
1fcd0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 .... if
1fce0 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
1fcf0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
1fd00 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
1fd10 70 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 ppendArgs $memor
1fd20 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 y \n]..
1fd30 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
1fd40 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
1fd50 20 20 20 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 set memor
1fd60 79 20 75 6e 61 76 61 69 6c 61 62 6c 65 0d 0a 0d y unavailable...
1fd70 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 . if {!$q
1fd80 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
1fd90 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
1fda0 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1fdb0 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a gs $memory \n]..
1fdc0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1fdd0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b }.... if {
1fde0 24 63 6f 6c 6c 65 63 74 7d 20 74 68 65 6e 20 7b $collect} then {
1fdf0 0d 0a 20 20 20 20 20 20 20 20 63 6f 6c 6c 65 63 .. collec
1fe00 74 47 61 72 62 61 67 65 20 24 63 68 61 6e 6e 65 tGarbage $channe
1fe10 6c 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 l.. }....
1fe20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
1fe30 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1fe40 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
1fe50 22 2d 2d 2d 2d 20 63 75 72 72 65 6e 74 20 6d 65 "---- current me
1fe60 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 79 20 74 mory in use by t
1fe70 68 65 20 43 4c 52 2e 2e 2e 20 22 0d 0a 20 20 20 he CLR... "..
1fe80 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 }.... if
1fe90 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a {[haveSQLiteObj
1fea0 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 ectCommand]} the
1feb0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
1fec0 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
1fed0 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
1fee0 6b 65 20 47 43 20 47 65 74 54 6f 74 61 6c 4d 65 ke GC GetTotalMe
1fef0 6d 6f 72 79 20 66 61 6c 73 65 0d 0a 20 20 20 20 mory false..
1ff00 20 20 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d } memory] ==
1ff10 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
1ff20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
1ff30 67 20 69 73 20 69 6e 74 65 67 65 72 20 2d 73 74 g is integer -st
1ff40 72 69 63 74 20 24 6d 65 6d 6f 72 79 5d 7d 20 74 rict $memory]} t
1ff50 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1ff60 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
1ff70 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1ff80 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1ff90 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1ffa0 20 24 6d 65 6d 6f 72 79 20 22 20 62 79 74 65 73 $memory " bytes
1ffb0 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
1ffc0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
1ffd0 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
1ffe0 20 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 set memory
1fff0 69 6e 76 61 6c 69 64 0d 0a 0d 0a 20 20 20 20 20 invalid....
20000 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
20010 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
20020 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
20030 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
20040 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d Args $memory \n]
20050 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
20060 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
20070 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
20080 20 20 20 20 20 20 20 20 20 20 73 65 74 20 6d 65 set me
20090 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e 0d 0a 0d 0a mory unknown....
200a0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
200b0 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
200c0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
200d0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
200e0 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e dArgs $memory \n
200f0 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
20100 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
20110 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
20120 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e set memory un
20130 61 76 61 69 6c 61 62 6c 65 0d 0a 0d 0a 20 20 20 available....
20140 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
20150 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
20160 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
20170 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 el [appendArgs $
20180 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 memory \n]..
20190 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
201a0 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 .. return $
201b0 72 65 73 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c result.. }...
201c0 0d 0a 20 20 20 20 70 72 6f 63 20 63 68 65 63 6b .. proc check
201d0 46 6f 72 53 51 4c 69 74 65 44 69 72 65 63 74 6f ForSQLiteDirecto
201e0 72 69 65 73 20 7b 20 63 68 61 6e 6e 65 6c 20 7b ries { channel {
201f0 72 65 73 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b reset false} } {
20200 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
20210 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 # NOTE: Check i
20220 66 20 74 68 65 20 73 71 6c 69 74 65 33 5f 77 69 f the sqlite3_wi
20230 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 n32_set_director
20240 79 20 66 75 6e 63 74 69 6f 6e 20 69 73 20 61 76 y function is av
20250 61 69 6c 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 ailable...
20260 23 0d 0a 20 20 20 20 20 20 74 70 75 74 73 20 24 #.. tputs $
20270 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 channel \..
20280 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b "---- check
20290 69 6e 67 20 66 6f 72 20 66 75 6e 63 74 69 6f 6e ing for function
202a0 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 sqlite3_win32_s
202b0 65 74 5f 64 69 72 65 63 74 6f 72 79 2e 2e 2e 20 et_directory...
202c0 22 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ".... #..
202d0 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 # NOTE: This
202e0 20 63 61 6c 6c 20 74 6f 20 74 68 65 20 73 71 6c call to the sql
202f0 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 ite3_win32_set_d
20300 69 72 65 63 74 6f 72 79 20 66 75 6e 63 74 69 6f irectory functio
20310 6e 20 75 73 65 73 20 74 68 65 0d 0a 20 20 20 20 n uses the..
20320 20 20 23 20 20 20 20 20 20 20 69 6e 76 61 6c 69 # invali
20330 64 20 76 61 6c 75 65 20 30 20 66 6f 72 20 74 68 d value 0 for th
20340 65 20 66 69 72 73 74 20 61 72 67 75 6d 65 6e 74 e first argument
20350 2e 20 20 54 68 69 73 20 63 6f 64 65 20 69 73 20 . This code is
20360 64 65 73 69 67 6e 65 64 0d 0a 20 20 20 20 20 20 designed..
20370 23 20 20 20 20 20 20 20 74 6f 20 63 68 65 63 6b # to check
20380 20 69 66 20 63 61 6c 6c 69 6e 67 20 74 68 65 20 if calling the
20390 66 75 6e 63 74 69 6f 6e 20 77 69 6c 6c 20 72 61 function will ra
203a0 69 73 65 20 61 6e 20 65 78 63 65 70 74 69 6f 6e ise an exception
203b0 20 28 69 2e 65 2e 0d 0a 20 20 20 20 20 20 23 20 (i.e... #
203c0 20 20 20 20 20 20 74 68 65 20 61 63 74 75 61 6c the actual
203d0 20 72 65 73 75 6c 74 20 6f 66 20 74 68 65 20 66 result of the f
203e0 75 6e 63 74 69 6f 6e 20 64 6f 65 73 20 6e 6f 74 unction does not
203f0 20 6d 61 74 74 65 72 20 61 73 20 6c 6f 6e 67 20 matter as long
20400 61 73 20 6e 6f 0d 0a 20 20 20 20 20 20 23 20 20 as no.. #
20410 20 20 20 20 20 64 69 72 65 63 74 6f 72 79 20 69 directory i
20420 73 20 63 68 61 6e 67 65 64 29 2e 0d 0a 20 20 20 s changed)...
20430 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
20440 5b 69 73 57 69 6e 64 6f 77 73 5d 20 26 26 20 5b [isWindows] && [
20450 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
20460 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
20470 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
20480 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
20490 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
204a0 74 65 2e 55 6e 73 61 66 65 4e 61 74 69 76 65 4d te.UnsafeNativeM
204b0 65 74 68 6f 64 73 20 5c 0d 0a 20 20 20 20 20 20 ethods \..
204c0 20 20 20 20 20 20 73 71 6c 69 74 65 33 5f 77 69 sqlite3_wi
204d0 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 n32_set_director
204e0 79 20 30 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 y 0 null..
204f0 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d }] == 0} then {.
20500 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
20510 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 61 6c 6c # NOTE: Call
20520 69 6e 67 20 74 68 65 20 73 71 6c 69 74 65 33 5f ing the sqlite3_
20530 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 win32_set_direct
20540 6f 72 79 20 66 75 6e 63 74 69 6f 6e 20 64 6f 65 ory function doe
20550 73 20 6e 6f 74 0d 0a 20 20 20 20 20 20 20 20 23 s not.. #
20560 20 20 20 20 20 20 20 63 61 75 73 65 20 61 6e 20 cause an
20570 65 78 63 65 70 74 69 6f 6e 3b 20 74 68 65 72 65 exception; there
20580 66 6f 72 65 2c 20 69 74 20 6d 75 73 74 20 62 65 fore, it must be
20590 20 61 76 61 69 6c 61 62 6c 65 20 28 69 2e 65 2e available (i.e.
205a0 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
205b0 20 20 65 76 65 6e 20 74 68 6f 75 67 68 20 69 74 even though it
205c0 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 should return a
205d0 20 66 61 69 6c 75 72 65 20 72 65 74 75 72 6e 20 failure return
205e0 63 6f 64 65 20 69 6e 20 74 68 69 73 0d 0a 20 20 code in this..
205f0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 61 # ca
20600 73 65 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d se)... #.
20610 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 . addCons
20620 74 72 61 69 6e 74 20 73 71 6c 69 74 65 33 5f 77 traint sqlite3_w
20630 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f in32_set_directo
20640 72 79 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 ry.... tp
20650 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 79 65 73 uts $channel yes
20660 5c 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d \n.... #.
20670 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
20680 20 44 6f 65 73 20 6f 75 72 20 63 61 6c 6c 65 72 Does our caller
20690 20 77 61 6e 74 20 74 6f 20 72 65 73 65 74 20 74 want to reset t
206a0 68 65 20 64 69 72 65 63 74 6f 72 69 65 73 3f 0d he directories?.
206b0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
206c0 20 20 20 20 69 66 20 7b 24 72 65 73 65 74 7d 20 if {$reset}
206d0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
206e0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
206f0 20 4e 4f 54 45 3a 20 4e 6f 77 20 6d 61 6b 65 20 NOTE: Now make
20700 73 75 72 65 20 74 68 65 20 64 61 74 61 62 61 73 sure the databas
20710 65 20 61 6e 64 20 74 65 6d 70 6f 72 61 72 79 20 e and temporary
20720 64 69 72 65 63 74 6f 72 69 65 73 20 61 72 65 0d directories are.
20730 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
20740 20 20 20 72 65 73 65 74 20 74 68 65 69 72 20 64 reset their d
20750 65 66 61 75 6c 74 20 76 61 6c 75 65 73 2c 20 77 efault values, w
20760 68 69 63 68 20 73 68 6f 75 6c 64 20 62 65 20 6e hich should be n
20770 75 6c 6c 20 66 6f 72 20 62 6f 74 68 2e 0d 0a 20 ull for both...
20780 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
20790 20 53 69 6e 63 65 20 74 68 65 20 73 71 6c 69 74 Since the sqlit
207a0 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 e3_win32_set_dir
207b0 65 63 74 6f 72 79 20 66 75 6e 63 74 69 6f 6e 20 ectory function
207c0 69 73 20 61 76 61 69 6c 61 62 6c 65 2c 0d 0a 20 is available,..
207d0 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
207e0 20 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 use it...
207f0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
20800 20 66 6f 72 20 7b 73 65 74 20 69 6e 64 65 78 20 for {set index
20810 31 7d 20 7b 24 69 6e 64 65 78 20 3c 20 33 7d 20 1} {$index < 3}
20820 7b 69 6e 63 72 20 69 6e 64 65 78 7d 20 7b 0d 0a {incr index} {..
20830 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
20840 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 [catch {..
20850 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 object i
20860 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f nvoke -flags +No
20870 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 nPublic \..
20880 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 Sys
20890 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
208a0 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 UnsafeNativeMeth
208b0 6f 64 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ods \..
208c0 20 20 20 20 20 20 20 20 20 73 71 6c 69 74 65 33 sqlite3
208d0 5f 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 _win32_set_direc
208e0 74 6f 72 79 20 24 69 6e 64 65 78 20 6e 75 6c 6c tory $index null
208f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 .. }
20900 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 result] == 0} th
20910 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
20920 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
20930 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
20940 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
20950 20 20 20 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 "---- call s
20960 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 qlite3_win32_set
20970 5f 64 69 72 65 63 74 6f 72 79 28 22 20 24 69 6e _directory(" $in
20980 64 65 78 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 dex \..
20990 20 20 20 20 20 20 20 20 20 22 2c 20 6e 75 6c 6c ", null
209a0 29 2e 2e 2e 20 6f 6b 3a 20 22 20 24 72 65 73 75 )... ok: " $resu
209b0 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 lt \n]..
209c0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
209d0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
209e0 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
209f0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
20a00 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
20a10 2d 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 5f 77 - call sqlite3_w
20a20 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f in32_set_directo
20a30 72 79 28 22 20 24 69 6e 64 65 78 20 5c 0d 0a 20 ry(" $index \..
20a40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20a50 20 22 2c 20 6e 75 6c 6c 29 2e 2e 2e 20 65 72 72 ", null)... err
20a60 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 72 65 73 75 or: " \n\t $resu
20a70 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 lt \n]..
20a80 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
20a90 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
20aa0 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
20ab0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
20ac0 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 0d 0a 20 20 annel no\n....
20ad0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
20ae0 20 23 20 4e 4f 54 45 3a 20 44 6f 65 73 20 6f 75 # NOTE: Does ou
20af0 72 20 63 61 6c 6c 65 72 20 77 61 6e 74 20 74 6f r caller want to
20b00 20 72 65 73 65 74 20 74 68 65 20 64 69 72 65 63 reset the direc
20b10 74 6f 72 69 65 73 3f 20 20 54 68 69 73 20 63 61 tories? This ca
20b20 6e 20 6f 6e 6c 79 0d 0a 20 20 20 20 20 20 20 20 n only..
20b30 23 20 20 20 20 20 20 20 62 65 20 70 65 72 66 6f # be perfo
20b40 72 6d 65 64 20 69 66 20 53 51 4c 69 74 65 20 69 rmed if SQLite i
20b50 73 20 6c 6f 61 64 65 64 20 61 6e 64 20 72 65 61 s loaded and rea
20b60 64 79 20 66 6f 72 20 75 73 65 20 62 79 20 74 68 dy for use by th
20b70 65 20 74 65 73 74 0d 0a 20 20 20 20 20 20 20 20 e test..
20b80 23 20 20 20 20 20 20 20 73 75 69 74 65 2e 0d 0a # suite...
20b90 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
20ba0 20 20 20 69 66 20 7b 24 72 65 73 65 74 20 26 26 if {$reset &&
20bb0 20 5b 69 73 53 51 4c 69 74 65 52 65 61 64 79 5d [isSQLiteReady]
20bc0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
20bd0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
20be0 20 23 20 4e 4f 54 45 3a 20 4e 6f 77 20 6d 61 6b # NOTE: Now mak
20bf0 65 20 73 75 72 65 20 74 68 65 20 64 61 74 61 62 e sure the datab
20c00 61 73 65 20 61 6e 64 20 74 65 6d 70 6f 72 61 72 ase and temporar
20c10 79 20 64 69 72 65 63 74 6f 72 69 65 73 20 61 72 y directories ar
20c20 65 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 e.. #
20c30 20 20 20 20 20 72 65 73 65 74 20 74 68 65 69 72 reset their
20c40 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 73 2c default values,
20c50 20 77 68 69 63 68 20 73 68 6f 75 6c 64 20 62 65 which should be
20c60 20 6e 75 6c 6c 20 66 6f 72 20 62 6f 74 68 2e 0d null for both..
20c70 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
20c80 20 20 20 53 69 6e 63 65 20 74 68 65 20 73 71 6c Since the sql
20c90 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 ite3_win32_set_d
20ca0 69 72 65 63 74 6f 72 79 20 66 75 6e 63 74 69 6f irectory functio
20cb0 6e 20 64 6f 65 73 20 6e 6f 74 0d 0a 20 20 20 20 n does not..
20cc0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 70 # ap
20cd0 70 65 61 72 20 74 6f 20 62 65 20 61 76 61 69 6c pear to be avail
20ce0 61 62 6c 65 2c 20 75 73 65 20 74 68 65 20 61 73 able, use the as
20cf0 73 6f 63 69 61 74 65 64 20 50 52 41 47 4d 41 20 sociated PRAGMA
20d00 63 6f 6d 6d 61 6e 64 73 0d 0a 20 20 20 20 20 20 commands..
20d10 20 20 20 20 23 20 20 20 20 20 20 20 69 6e 73 74 # inst
20d20 65 61 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ead...
20d30 23 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 #.. for
20d40 65 61 63 68 20 64 69 72 65 63 74 6f 72 79 20 5b each directory [
20d50 6c 69 73 74 20 64 61 74 61 5f 73 74 6f 72 65 5f list data_store_
20d60 64 69 72 65 63 74 6f 72 79 20 74 65 6d 70 5f 73 directory temp_s
20d70 74 6f 72 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 tore_directory]
20d80 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 {.. s
20d90 65 74 20 73 71 6c 20 5b 61 70 70 65 6e 64 41 72 et sql [appendAr
20da0 67 73 20 22 50 52 41 47 4d 41 20 22 20 24 64 69 gs "PRAGMA " $di
20db0 72 65 63 74 6f 72 79 20 22 20 3d 20 5c 22 5c 22 rectory " = \"\"
20dc0 3b 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 ;"]....
20dd0 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 65 if {[catch {e
20de0 78 65 63 75 74 65 53 71 6c 20 24 73 71 6c 7d 20 xecuteSql $sql}
20df0 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 result] == 0} th
20e00 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
20e10 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
20e20 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
20e30 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
20e40 20 20 20 20 22 2d 2d 2d 2d 20 65 78 65 63 75 74 "---- execut
20e50 65 20 50 52 41 47 4d 41 20 22 20 24 64 69 72 65 e PRAGMA " $dire
20e60 63 74 6f 72 79 20 22 2e 2e 2e 20 6f 6b 3a 20 5c ctory "... ok: \
20e70 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 "" \..
20e80 20 20 20 20 20 20 20 20 24 72 65 73 75 6c 74 20 $result
20e90 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 \"\n]..
20ea0 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
20eb0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
20ec0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
20ed0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
20ee0 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
20ef0 20 65 78 65 63 75 74 65 20 50 52 41 47 4d 41 20 execute PRAGMA
20f00 22 20 24 64 69 72 65 63 74 6f 72 79 20 22 2e 2e " $directory "..
20f10 2e 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 . error: " \..
20f20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20f30 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d \n\t $result \n]
20f40 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
20f50 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
20f60 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
20f70 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
20f80 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 6e 61 6c # NOTE: Final
20f90 6c 79 2c 20 73 68 6f 77 20 74 68 65 20 63 75 72 ly, show the cur
20fa0 72 65 6e 74 20 76 61 6c 75 65 20 6f 66 20 74 68 rent value of th
20fb0 65 20 64 61 74 61 62 61 73 65 20 61 6e 64 20 74 e database and t
20fc0 65 6d 70 6f 72 61 72 79 0d 0a 20 20 20 20 20 20 emporary..
20fd0 23 20 20 20 20 20 20 20 64 69 72 65 63 74 6f 72 # director
20fe0 69 65 73 2e 20 20 54 68 69 73 20 63 61 6e 20 6f ies. This can o
20ff0 6e 6c 79 20 62 65 20 70 65 72 66 6f 72 6d 65 64 nly be performed
21000 20 69 66 20 53 51 4c 69 74 65 20 69 73 20 6c 6f if SQLite is lo
21010 61 64 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 aded.. #
21020 20 20 20 20 61 6e 64 20 72 65 61 64 79 20 66 6f and ready fo
21030 72 20 75 73 65 20 62 79 20 74 68 65 20 74 65 73 r use by the tes
21040 74 20 73 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 t suite...
21050 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 73 #.. if {[is
21060 53 51 4c 69 74 65 52 65 61 64 79 5d 7d 20 74 68 SQLiteReady]} th
21070 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 66 6f en {.. fo
21080 72 65 61 63 68 20 64 69 72 65 63 74 6f 72 79 20 reach directory
21090 5b 6c 69 73 74 20 64 61 74 61 5f 73 74 6f 72 65 [list data_store
210a0 5f 64 69 72 65 63 74 6f 72 79 20 74 65 6d 70 5f _directory temp_
210b0 73 74 6f 72 65 5f 64 69 72 65 63 74 6f 72 79 5d store_directory]
210c0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 {.. tp
210d0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
210e0 70 65 6e 64 41 72 67 73 20 22 2d 2d 2d 2d 20 63 pendArgs "---- c
210f0 68 65 63 6b 69 6e 67 20 22 20 24 64 69 72 65 63 hecking " $direc
21100 74 6f 72 79 20 22 2e 2e 2e 20 22 5d 0d 0a 0d 0a tory "... "]....
21110 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73 71 set sq
21120 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 50 l [appendArgs "P
21130 52 41 47 4d 41 20 22 20 24 64 69 72 65 63 74 6f RAGMA " $directo
21140 72 79 20 5c 3b 5d 0d 0a 0d 0a 20 20 20 20 20 20 ry \;]....
21150 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
21160 65 78 65 63 75 74 65 53 71 6c 20 24 73 71 6c 20 executeSql $sql
21170 73 63 61 6c 61 72 7d 20 72 65 73 75 6c 74 5d 20 scalar} result]
21180 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
21190 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
211a0 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
211b0 41 72 67 73 20 22 6f 6b 3a 20 5c 22 22 20 24 72 Args "ok: \"" $r
211c0 65 73 75 6c 74 20 5c 22 5c 6e 5d 0d 0a 20 20 20 esult \"\n]..
211d0 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
211e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
211f0 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
21200 65 6e 64 41 72 67 73 20 22 65 72 72 6f 72 3a 20 endArgs "error:
21210 22 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c " \n\t $result \
21220 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d n].. }.
21230 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
21240 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
21250 20 20 20 70 72 6f 63 20 6c 6f 61 64 53 51 4c 69 proc loadSQLi
21260 74 65 54 65 73 74 53 65 74 74 69 6e 67 73 20 7b teTestSettings {
21270 20 63 68 61 6e 6e 65 6c 20 7b 73 75 66 66 69 78 channel {suffix
21280 20 22 22 7d 20 7b 71 75 69 65 74 20 66 61 6c 73 ""} {quiet fals
21290 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d e} } {.. #.
212a0 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 . # NOTE: S
212b0 6b 69 70 20 6c 6f 61 64 69 6e 67 20 74 68 65 20 kip loading the
212c0 73 65 74 74 69 6e 67 73 20 69 66 20 74 68 65 69 settings if thei
212d0 72 20 75 73 61 67 65 20 68 61 73 20 62 65 65 6e r usage has been
212e0 20 64 69 73 61 62 6c 65 64 2e 0d 0a 20 20 20 20 disabled...
212f0 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
21300 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
21310 6f 28 73 71 6c 69 74 65 54 65 73 74 53 65 74 74 o(sqliteTestSett
21320 69 6e 67 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a ings)]} then {..
21330 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
21340 20 20 20 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 20 # NOTE: Load
21350 63 75 73 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 custom per-user
21360 61 6e 64 2f 6f 72 20 70 65 72 2d 68 6f 73 74 20 and/or per-host
21370 74 65 73 74 20 73 65 74 74 69 6e 67 73 20 6e 6f test settings no
21380 77 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 w... #..
21390 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f if {[info
213a0 20 65 78 69 73 74 73 20 3a 3a 74 63 6c 5f 70 6c exists ::tcl_pl
213b0 61 74 66 6f 72 6d 28 75 73 65 72 29 5d 7d 20 74 atform(user)]} t
213c0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
213d0 20 73 65 74 20 75 73 65 72 53 65 74 74 69 6e 67 set userSetting
213e0 73 46 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 sFileName [file
213f0 6a 6f 69 6e 20 5b 67 65 74 43 6f 6d 6d 6f 6e 44 join [getCommonD
21400 69 72 65 63 74 6f 72 79 5d 20 5c 0d 0a 20 20 20 irectory] \..
21410 20 20 20 20 20 20 20 20 20 20 20 5b 61 70 70 65 [appe
21420 6e 64 41 72 67 73 20 73 65 74 74 69 6e 67 73 20 ndArgs settings
21430 24 73 75 66 66 69 78 20 2e 20 24 3a 3a 74 63 6c $suffix . $::tcl
21440 5f 70 6c 61 74 66 6f 72 6d 28 75 73 65 72 29 20 _platform(user)
21450 2e 65 61 67 6c 65 5d 5d 0d 0a 0d 0a 20 20 20 20 .eagle]]....
21460 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 if {[file
21470 65 78 69 73 74 73 20 24 75 73 65 72 53 65 74 74 exists $userSett
21480 69 6e 67 73 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 ingsFileName]} t
21490 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
214a0 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
214b0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
214c0 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
214d0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
214e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
214f0 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6c 6f 61 64 "---- load
21500 69 6e 67 20 70 65 72 2d 75 73 65 72 20 74 65 73 ing per-user tes
21510 74 20 73 65 74 74 69 6e 67 73 20 66 69 6c 65 20 t settings file
21520 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 \"" \..
21530 20 20 20 20 20 20 20 20 20 24 75 73 65 72 53 65 $userSe
21540 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 5c ttingsFileName \
21550 22 2e 2e 2e 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 "...\n]..
21560 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
21570 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
21580 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
21590 20 20 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 uplevel 1 [lis
215a0 74 20 73 6f 75 72 63 65 20 24 75 73 65 72 53 65 t source $userSe
215b0 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 5d 0d ttingsFileName].
215c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 . } e
215d0 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 rror]} then {..
215e0 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
215f0 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
21600 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
21610 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
21620 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
21630 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
21640 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e "==== WARNIN
21650 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 6c 6f 61 G: failed to loa
21660 64 20 70 65 72 2d 75 73 65 72 20 73 65 74 74 69 d per-user setti
21670 6e 67 73 20 66 69 6c 65 20 5c 22 22 20 5c 0d 0a ngs file \"" \..
21680 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
21690 20 20 20 20 24 75 73 65 72 53 65 74 74 69 6e 67 $userSetting
216a0 73 46 69 6c 65 4e 61 6d 65 20 22 5c 22 2c 20 65 sFileName "\", e
216b0 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 rror: " \n\t $er
216c0 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ror \n]..
216d0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
216e0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
216f0 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
21700 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
21710 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
21720 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
21730 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
21740 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
21750 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
21760 2d 20 73 6b 69 70 70 65 64 20 6c 6f 61 64 69 6e - skipped loadin
21770 67 20 70 65 72 2d 75 73 65 72 20 74 65 73 74 20 g per-user test
21780 73 65 74 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 settings file \"
21790 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
217a0 20 20 20 20 20 20 20 24 75 73 65 72 53 65 74 74 $userSett
217b0 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 22 5c 22 ingsFileName "\"
217c0 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 , it does not ex
217d0 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 ist\n"]..
217e0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
217f0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
21800 0d 0a 20 20 20 20 20 20 20 20 23 23 23 23 23 23 .. ######
21810 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21820 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21830 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21840 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
21850 23 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 #.... if
21860 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a {[info exists ::
21870 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 68 6f 73 tcl_platform(hos
21880 74 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 t)]} then {..
21890 20 20 20 20 20 20 20 73 65 74 20 68 6f 73 74 53 set hostS
218a0 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 ettingsFileName
218b0 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 43 [file join [getC
218c0 6f 6d 6d 6f 6e 44 69 72 65 63 74 6f 72 79 5d 20 ommonDirectory]
218d0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
218e0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 73 65 74 [appendArgs set
218f0 74 69 6e 67 73 20 24 73 75 66 66 69 78 20 2e 20 tings $suffix .
21900 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 $::tcl_platform(
21910 68 6f 73 74 29 20 2e 65 61 67 6c 65 5d 5d 0d 0a host) .eagle]]..
21920 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
21930 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 68 6f [file exists $ho
21940 73 74 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 stSettingsFileNa
21950 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 me]} then {..
21960 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
21970 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
21980 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
21990 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
219a0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
219b0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
219c0 2d 20 6c 6f 61 64 69 6e 67 20 70 65 72 2d 68 6f - loading per-ho
219d0 73 74 20 74 65 73 74 20 73 65 74 74 69 6e 67 73 st test settings
219e0 20 66 69 6c 65 20 5c 22 22 20 5c 0d 0a 20 20 20 file \"" \..
219f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 $
21a00 68 6f 73 74 53 65 74 74 69 6e 67 73 46 69 6c 65 hostSettingsFile
21a10 4e 61 6d 65 20 5c 22 2e 2e 2e 5c 6e 5d 0d 0a 20 Name \"...\n]..
21a20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
21a30 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
21a40 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 [catch {..
21a50 20 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 uplevel
21a60 31 20 5b 6c 69 73 74 20 73 6f 75 72 63 65 20 24 1 [list source $
21a70 68 6f 73 74 53 65 74 74 69 6e 67 73 46 69 6c 65 hostSettingsFile
21a80 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 Name]..
21a90 20 20 20 7d 20 65 72 72 6f 72 5d 7d 20 74 68 65 } error]} the
21aa0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
21ab0 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
21ac0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
21ad0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
21ae0 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
21af0 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
21b00 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
21b10 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
21b20 74 6f 20 6c 6f 61 64 20 70 65 72 2d 68 6f 73 74 to load per-host
21b30 20 73 65 74 74 69 6e 67 73 20 66 69 6c 65 20 5c settings file \
21b40 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 "" \..
21b50 20 20 20 20 20 20 20 20 20 20 24 68 6f 73 74 53 $hostS
21b60 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 ettingsFileName
21b70 22 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e "\", error: " \n
21b80 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 \t $error \n]..
21b90 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
21ba0 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
21bb0 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 } else
21bc0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 {.. i
21bd0 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
21be0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
21bf0 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
21c00 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
21c10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
21c20 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 "---- skipped
21c30 6c 6f 61 64 69 6e 67 20 70 65 72 2d 68 6f 73 74 loading per-host
21c40 20 74 65 73 74 20 73 65 74 74 69 6e 67 73 20 66 test settings f
21c50 69 6c 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 ile \"" \..
21c60 20 20 20 20 20 20 20 20 20 20 20 20 20 24 68 6f $ho
21c70 73 74 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 stSettingsFileNa
21c80 6d 65 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 me "\", it does
21c90 6e 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 not exist\n"]..
21ca0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
21cb0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
21cc0 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
21cd0 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
21ce0 63 20 63 6f 70 79 53 61 6d 70 6c 65 44 61 74 61 c copySampleData
21cf0 62 61 73 65 46 69 6c 65 73 20 7b 7d 20 7b 0d 0a baseFiles {} {..
21d00 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 uplevel 1
21d10 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
21d20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 6f # NOTE: Co
21d30 70 79 20 28 6f 72 20 72 65 2d 63 6f 70 79 29 20 py (or re-copy)
21d40 74 68 65 20 72 65 66 65 72 65 6e 63 65 20 64 61 the reference da
21d50 74 61 62 61 73 65 20 66 69 6c 65 20 75 73 65 64 tabase file used
21d60 20 66 6f 72 20 74 68 69 73 0d 0a 20 20 20 20 20 for this..
21d70 20 20 20 23 20 20 20 20 20 20 20 75 6e 69 74 20 # unit
21d80 74 65 73 74 20 74 6f 20 74 68 65 20 62 75 69 6c test to the buil
21d90 64 20 64 69 72 65 63 74 6f 72 79 20 69 6e 20 63 d directory in c
21da0 61 73 65 20 69 74 20 68 61 73 20 62 65 65 6e 20 ase it has been
21db0 63 68 61 6e 67 65 64 0d 0a 20 20 20 20 20 20 20 changed..
21dc0 20 23 20 20 20 20 20 20 20 62 79 20 61 20 70 72 # by a pr
21dd0 65 76 69 6f 75 73 20 74 65 73 74 20 72 75 6e 2e evious test run.
21de0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
21df0 20 20 20 20 20 66 69 6c 65 20 63 6f 70 79 20 2d file copy -
21e00 66 6f 72 63 65 20 24 6e 6f 72 74 68 77 69 6e 64 force $northwind
21e10 45 66 44 62 46 69 6c 65 20 5c 0d 0a 20 20 20 20 EfDbFile \..
21e20 20 20 20 20 20 20 5b 66 69 6c 65 20 6a 6f 69 6e [file join
21e30 20 5b 67 65 74 42 75 69 6c 64 44 69 72 65 63 74 [getBuildDirect
21e40 6f 72 79 20 66 61 6c 73 65 5d 20 5b 66 69 6c 65 ory false] [file
21e50 20 74 61 69 6c 20 24 6e 6f 72 74 68 77 69 6e 64 tail $northwind
21e60 45 66 44 62 46 69 6c 65 5d 5d 0d 0a 20 20 20 20 EfDbFile]]..
21e70 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
21e80 20 20 20 70 72 6f 63 20 72 75 6e 53 51 4c 69 74 proc runSQLit
21e90 65 54 65 73 74 50 72 6f 6c 6f 67 75 65 20 7b 7d eTestPrologue {}
21ea0 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
21eb0 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 # NOTE: Skip
21ec0 72 75 6e 6e 69 6e 67 20 6f 75 72 20 63 75 73 74 running our cust
21ed0 6f 6d 20 70 72 6f 6c 6f 67 75 65 20 69 66 20 74 om prologue if t
21ee0 68 65 20 6d 61 69 6e 20 6f 6e 65 20 68 61 73 20 he main one has
21ef0 62 65 65 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 been.. #
21f00 20 20 20 20 73 6b 69 70 70 65 64 2e 0d 0a 20 20 skipped...
21f10 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
21f20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
21f30 3a 6e 6f 28 70 72 6f 6c 6f 67 75 65 2e 65 61 67 :no(prologue.eag
21f40 6c 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 le)]} then {..
21f50 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
21f60 20 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 20 74 68 # NOTE: Load th
21f70 65 20 22 62 65 66 6f 72 65 2d 63 6f 6e 73 74 72 e "before-constr
21f80 61 69 6e 74 73 22 20 63 75 73 74 6f 6d 20 70 65 aints" custom pe
21f90 72 2d 75 73 65 72 20 61 6e 64 2f 6f 72 20 70 65 r-user and/or pe
21fa0 72 2d 68 6f 73 74 0d 0a 20 20 20 20 20 20 20 20 r-host..
21fb0 23 20 20 20 20 20 20 20 74 65 73 74 20 73 65 74 # test set
21fc0 74 69 6e 67 73 20 6e 6f 77 2e 0d 0a 20 20 20 20 tings now...
21fd0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 75 #.. u
21fe0 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 6c plevel 1 [list l
21ff0 6f 61 64 53 51 4c 69 74 65 54 65 73 74 53 65 74 oadSQLiteTestSet
22000 74 69 6e 67 73 20 24 3a 3a 74 65 73 74 5f 63 68 tings $::test_ch
22010 61 6e 6e 65 6c 20 2e 62 65 66 6f 72 65 5d 0d 0a annel .before]..
22020 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
22030 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 # NOTE: Che
22040 63 6b 20 69 66 20 74 68 65 20 5b 6f 62 6a 65 63 ck if the [objec
22050 74 5d 20 63 6f 6d 6d 61 6e 64 20 69 73 20 61 76 t] command is av
22060 61 69 6c 61 62 6c 65 3b 20 69 66 20 6e 6f 74 2c ailable; if not,
22070 20 61 64 64 20 73 6f 6d 65 0d 0a 20 20 20 20 20 add some..
22080 20 20 20 23 20 20 20 20 20 20 20 73 68 69 6d 73 # shims
22090 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 74 65 73 to make the tes
220a0 74 20 73 75 69 74 65 20 72 75 6e 20 73 6d 6f 6f t suite run smoo
220b0 74 68 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 23 ther... #
220c0 0d 0a 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 .. checkF
220d0 6f 72 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f orSQLiteObjectCo
220e0 6d 6d 61 6e 64 20 24 3a 3a 74 65 73 74 5f 63 68 mmand $::test_ch
220f0 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 annel....
22100 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
22110 54 45 3a 20 44 65 74 65 72 6d 69 6e 65 20 74 68 TE: Determine th
22120 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 20 6e e names of the n
22130 61 74 69 76 65 20 70 6c 61 74 66 6f 72 6d 20 61 ative platform a
22140 6e 64 20 61 72 63 68 69 74 65 63 74 75 72 65 2e nd architecture.
22150 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
22160 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 set platfor
22170 6d 20 5b 67 65 74 42 75 69 6c 64 50 6c 61 74 66 m [getBuildPlatf
22180 6f 72 6d 20 74 72 75 65 5d 0d 0a 20 20 20 20 20 orm true]..
22190 20 20 20 73 65 74 20 61 72 63 68 69 74 65 63 74 set architect
221a0 75 72 65 20 5b 61 72 63 68 69 74 65 63 74 75 72 ure [architectur
221b0 65 46 6f 72 50 6c 61 74 66 6f 72 6d 20 24 70 6c eForPlatform $pl
221c0 61 74 66 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 20 atform]....
221d0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
221e0 4e 4f 54 45 3a 20 53 68 6f 77 20 74 68 65 20 70 NOTE: Show the p
221f0 6c 61 74 66 6f 72 6d 20 61 6e 64 20 61 72 63 68 latform and arch
22200 69 74 65 63 74 75 72 65 20 75 73 65 64 20 74 6f itecture used to
22210 20 68 65 6c 70 20 6c 6f 63 61 74 65 20 74 68 65 help locate the
22220 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
22230 20 20 6e 61 74 69 76 65 20 62 75 69 6c 64 20 66 native build f
22240 69 6c 65 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 iles... #
22250 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
22260 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
22270 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
22280 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
22290 20 70 6c 61 74 66 6f 72 6d 20 66 6f 72 20 6c 6f platform for lo
222a0 63 61 74 69 6e 67 20 6e 61 74 69 76 65 20 62 75 cating native bu
222b0 69 6c 64 20 66 69 6c 65 73 20 69 73 20 5c 22 22 ild files is \""
222c0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
222d0 24 70 6c 61 74 66 6f 72 6d 20 5c 22 5c 6e 5d 0d $platform \"\n].
222e0 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 ... tputs
222f0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
22300 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
22310 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
22320 2d 20 61 72 63 68 69 74 65 63 74 75 72 65 20 66 - architecture f
22330 6f 72 20 6c 6f 63 61 74 69 6e 67 20 6e 61 74 69 or locating nati
22340 76 65 20 62 75 69 6c 64 20 66 69 6c 65 73 20 69 ve build files i
22350 73 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 s \"" \..
22360 20 20 20 20 20 24 61 72 63 68 69 74 65 63 74 75 $architectu
22370 72 65 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 re \"\n]....
22380 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
22390 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 61 20 6c NOTE: Build a l
223a0 69 73 74 20 6f 66 20 63 6f 6e 66 69 67 75 72 61 ist of configura
223b0 74 69 6f 6e 20 66 69 6c 65 73 20 74 68 61 74 20 tion files that
223c0 77 65 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 we handle...
223d0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 #.. s
223e0 65 74 20 63 6f 6e 66 69 67 46 69 6c 65 4e 61 6d et configFileNam
223f0 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 es [list \..
22400 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
22410 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 2e 63 ata.SQLite.dll.c
22420 6f 6e 66 69 67 5d 0d 0a 0d 0a 20 20 20 20 20 20 onfig]....
22430 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
22440 4f 54 45 3a 20 42 75 69 6c 64 20 61 20 6c 69 73 OTE: Build a lis
22450 74 20 6f 66 20 61 75 78 69 6c 69 61 72 79 20 4d t of auxiliary M
22460 61 6e 61 67 65 64 20 44 65 62 75 67 67 69 6e 67 anaged Debugging
22470 20 41 73 73 69 73 74 61 6e 74 73 20 28 4d 44 41 Assistants (MDA
22480 29 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 ).. #
22490 20 20 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e configuration
224a0 20 66 69 6c 65 73 20 74 68 61 74 20 77 65 20 68 files that we h
224b0 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 andle...
224c0 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 6d #.. set m
224d0 64 61 43 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 daConfigFileName
224e0 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 s [list \..
224f0 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c EagleShel
22500 6c 33 32 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 l32.exe.mda.conf
22510 69 67 20 49 6e 73 74 61 6c 6c 65 72 2e 65 78 65 ig Installer.exe
22520 2e 6d 64 61 2e 63 6f 6e 66 69 67 20 5c 0d 0a 20 .mda.config \..
22530 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 2e test.
22540 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 69 67 20 74 exe.mda.config t
22550 65 73 74 6c 69 6e 71 2e 65 78 65 2e 6d 64 61 2e estlinq.exe.mda.
22560 63 6f 6e 66 69 67 20 5c 0d 0a 20 20 20 20 20 20 config \..
22570 20 20 20 20 20 20 74 65 73 74 65 66 36 2e 65 78 testef6.ex
22580 65 2e 6d 64 61 2e 63 6f 6e 66 69 67 5d 0d 0a 0d e.mda.config]...
22590 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
225a0 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c # NOTE: Buil
225b0 64 20 74 68 65 20 6c 69 73 74 20 6f 66 20 65 78 d the list of ex
225c0 74 65 72 6e 61 6c 20 66 69 6c 65 73 20 74 68 61 ternal files tha
225d0 74 20 77 65 20 68 61 6e 64 6c 65 2e 20 20 53 6f t we handle. So
225e0 6d 65 20 6f 66 0d 0a 20 20 20 20 20 20 20 20 23 me of.. #
225f0 20 20 20 20 20 20 20 74 68 65 73 65 20 66 69 6c these fil
22600 65 73 20 6d 61 79 20 62 65 20 6e 61 74 69 76 65 es may be native
22610 20 61 6e 64 2f 6f 72 20 6d 61 6e 61 67 65 64 20 and/or managed
22620 61 73 73 65 6d 62 6c 69 65 73 20 74 68 61 74 20 assemblies that
22630 61 72 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 are.. #
22640 20 20 20 20 20 72 65 71 75 69 72 65 64 20 74 6f required to
22650 20 70 65 72 66 6f 72 6d 20 76 61 72 69 6f 75 73 perform various
22660 20 74 65 73 74 73 2e 0d 0a 20 20 20 20 20 20 20 tests...
22670 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 #.. set
22680 65 78 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 externalFileName
22690 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 s [list \..
226a0 20 20 20 20 20 20 20 5b 66 69 6c 65 20 6a 6f 69 [file joi
226b0 6e 20 45 6e 74 69 74 79 46 72 61 6d 65 77 6f 72 n EntityFramewor
226c0 6b 20 6c 69 62 20 5b 73 74 72 69 6e 67 20 6d 61 k lib [string ma
226d0 70 20 5b 6c 69 73 74 20 46 78 20 22 22 5d 20 5c p [list Fx ""] \
226e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 73 .. [s
226f0 74 72 69 6e 67 20 6d 61 70 20 5b 6c 69 73 74 20 tring map [list
22700 6e 65 74 46 78 34 35 31 20 6e 65 74 46 78 34 35 netFx451 netFx45
22710 20 6e 65 74 46 78 34 35 32 20 6e 65 74 46 78 34 netFx452 netFx4
22720 35 20 6e 65 74 46 78 34 36 20 5c 0d 0a 20 20 20 5 netFx46 \..
22730 20 20 20 20 20 20 20 20 20 6e 65 74 46 78 34 35 netFx45
22740 20 6e 65 74 46 78 34 36 31 20 6e 65 74 46 78 34 netFx461 netFx4
22750 35 20 6e 65 74 46 78 34 36 32 20 6e 65 74 46 78 5 netFx462 netFx
22760 34 35 5d 20 5b 67 65 74 42 75 69 6c 64 4e 65 74 45] [getBuildNet
22770 46 78 5d 5d 5d 20 5c 0d 0a 20 20 20 20 20 20 20 Fx]]] \..
22780 20 20 20 20 20 45 6e 74 69 74 79 46 72 61 6d 65 EntityFrame
22790 77 6f 72 6b 2e 64 6c 6c 5d 5d 0d 0a 0d 0a 20 20 work.dll]]....
227a0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
227b0 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 # NOTE: Build t
227c0 68 65 20 6c 69 73 74 20 6f 66 20 6e 61 74 69 76 he list of nativ
227d0 65 20 61 73 73 65 6d 62 6c 79 20 66 69 6c 65 73 e assembly files
227e0 20 74 68 61 74 20 77 65 20 68 61 6e 64 6c 65 2e that we handle.
227f0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
22800 20 20 20 20 20 73 65 74 20 6e 61 74 69 76 65 46 set nativeF
22810 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 5d 0d ileNames [list].
22820 0a 0d 0a 20 20 20 20 20 20 20 20 65 76 61 6c 20 ... eval
22830 6c 61 70 70 65 6e 64 20 6e 61 74 69 76 65 46 69 lappend nativeFi
22840 6c 65 4e 61 6d 65 73 20 5b 67 65 74 4e 61 74 69 leNames [getNati
22850 76 65 4c 69 62 72 61 72 79 46 69 6c 65 4e 61 6d veLibraryFileNam
22860 65 73 4f 6e 6c 79 5d 0d 0a 20 20 20 20 20 20 20 esOnly]..
22870 20 65 76 61 6c 20 6c 61 70 70 65 6e 64 20 6e 61 eval lappend na
22880 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 5b 67 tiveFileNames [g
22890 65 74 49 6e 74 65 72 6f 70 41 73 73 65 6d 62 6c etInteropAssembl
228a0 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d 0d yFileNamesOnly].
228b0 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
228c0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 # NOTE: Bu
228d0 69 6c 64 20 74 68 65 20 6c 69 73 74 20 6f 66 20 ild the list of
228e0 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 65 6d mixed-mode assem
228f0 62 6c 79 20 66 69 6c 65 73 20 74 68 61 74 20 77 bly files that w
22900 65 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 e handle...
22910 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 #.. se
22920 74 20 6d 69 78 65 64 46 69 6c 65 4e 61 6d 65 73 t mixedFileNames
22930 20 5b 6c 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 20 [list]....
22940 20 20 20 69 66 20 7b 5b 68 61 73 52 75 6e 74 69 if {[hasRunti
22950 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 69 76 65 5d meOption native]
22960 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
22970 20 20 20 20 6c 61 70 70 65 6e 64 20 6d 69 78 65 lappend mixe
22980 64 46 69 6c 65 4e 61 6d 65 73 20 53 79 73 74 65 dFileNames Syste
22990 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c m.Data.SQLite.dl
229a0 6c 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a l.. }....
229b0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
229c0 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 # NOTE: Build
229d0 20 74 68 65 20 6c 69 73 74 20 6f 66 20 6d 61 6e the list of man
229e0 61 67 65 64 20 61 73 73 65 6d 62 6c 79 20 66 69 aged assembly fi
229f0 6c 65 73 20 74 68 61 74 20 77 65 20 68 61 6e 64 les that we hand
22a00 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a le... #..
22a10 20 20 20 20 20 20 20 20 73 65 74 20 6d 61 6e 61 set mana
22a20 67 65 64 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 gedFileNames [li
22a30 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 st \..
22a40 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
22a50 4c 69 74 65 2e 4c 69 6e 71 2e 64 6c 6c 20 53 79 Lite.Linq.dll Sy
22a60 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
22a70 2e 45 46 36 2e 64 6c 6c 5d 0d 0a 0d 0a 20 20 20 .EF6.dll]....
22a80 20 20 20 20 20 69 66 20 7b 21 5b 68 61 73 52 75 if {![hasRu
22a90 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 69 ntimeOption nati
22aa0 76 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ve]} then {..
22ab0 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 6d lappend m
22ac0 61 6e 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 20 anagedFileNames
22ad0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
22ae0 74 65 2e 64 6c 6c 0d 0a 20 20 20 20 20 20 20 20 te.dll..
22af0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a }.... #..
22b00 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
22b10 53 68 6f 77 20 74 68 65 20 76 61 72 69 6f 75 73 Show the various
22b20 20 6c 69 73 74 73 20 6f 66 20 66 69 6c 65 20 6e lists of file n
22b30 61 6d 65 73 20 74 68 61 74 20 61 72 65 20 68 61 ames that are ha
22b40 6e 64 6c 65 64 20 62 79 20 74 68 69 73 0d 0a 20 ndled by this..
22b50 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 70 # p
22b60 72 6f 63 65 64 75 72 65 2e 0d 0a 20 20 20 20 20 rocedure...
22b70 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 70 #.. tp
22b80 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
22b90 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
22ba0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
22bb0 2d 2d 2d 2d 20 6c 69 73 74 20 6f 66 20 5c 22 63 ---- list of \"c
22bc0 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5c 22 20 66 onfiguration\" f
22bd0 69 6c 65 20 6e 61 6d 65 73 20 69 73 3a 20 22 20 ile names is: "
22be0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 \.. $
22bf0 63 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 configFileNames
22c00 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 \n].... t
22c10 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
22c20 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
22c30 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
22c40 22 2d 2d 2d 2d 20 6c 69 73 74 20 6f 66 20 5c 22 "---- list of \"
22c50 4d 44 41 20 63 6f 6e 66 69 67 75 72 61 74 69 6f MDA configuratio
22c60 6e 5c 22 20 66 69 6c 65 20 6e 61 6d 65 73 20 69 n\" file names i
22c70 73 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 s: " \..
22c80 20 20 20 20 24 6d 64 61 43 6f 6e 66 69 67 46 69 $mdaConfigFi
22c90 6c 65 4e 61 6d 65 73 20 5c 6e 5d 0d 0a 0d 0a 20 leNames \n]....
22ca0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
22cb0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
22cc0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
22cd0 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6c 69 "---- li
22ce0 73 74 20 6f 66 20 5c 22 65 78 74 65 72 6e 61 6c st of \"external
22cf0 5c 22 20 66 69 6c 65 20 6e 61 6d 65 73 20 69 73 \" file names is
22d00 3a 20 22 20 24 65 78 74 65 72 6e 61 6c 46 69 6c : " $externalFil
22d10 65 4e 61 6d 65 73 20 5c 6e 5d 0d 0a 0d 0a 20 20 eNames \n]....
22d20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
22d30 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
22d40 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
22d50 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6c 69 73 "---- lis
22d60 74 20 6f 66 20 5c 22 6e 61 74 69 76 65 5c 22 20 t of \"native\"
22d70 66 69 6c 65 20 6e 61 6d 65 73 20 69 73 3a 20 22 file names is: "
22d80 20 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 $nativeFileName
22d90 73 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 s \n]....
22da0 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
22db0 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
22dc0 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
22dd0 20 20 22 2d 2d 2d 2d 20 6c 69 73 74 20 6f 66 20 "---- list of
22de0 5c 22 6d 69 78 65 64 5c 22 20 66 69 6c 65 20 6e \"mixed\" file n
22df0 61 6d 65 73 20 69 73 3a 20 22 20 24 6d 69 78 65 ames is: " $mixe
22e00 64 46 69 6c 65 4e 61 6d 65 73 20 5c 6e 5d 0d 0a dFileNames \n]..
22e10 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
22e20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
22e30 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
22e40 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
22e50 20 6c 69 73 74 20 6f 66 20 5c 22 6d 61 6e 61 67 list of \"manag
22e60 65 64 5c 22 20 66 69 6c 65 20 6e 61 6d 65 73 20 ed\" file names
22e70 69 73 3a 20 22 20 24 6d 61 6e 61 67 65 64 46 69 is: " $managedFi
22e80 6c 65 4e 61 6d 65 73 20 5c 6e 5d 0d 0a 0d 0a 20 leNames \n]....
22e90 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
22ea0 20 20 23 20 4e 4f 54 45 3a 20 52 65 6d 6f 76 65 # NOTE: Remove
22eb0 20 61 6e 79 20 74 65 73 74 20 63 6f 6e 73 74 72 any test constr
22ec0 61 69 6e 74 73 20 74 68 61 74 20 72 65 66 65 72 aints that refer
22ed0 20 74 6f 20 74 68 65 20 6e 61 74 69 76 65 20 61 to the native a
22ee0 6e 64 2f 6f 72 0d 0a 20 20 20 20 20 20 20 20 23 nd/or.. #
22ef0 20 20 20 20 20 20 20 6d 61 6e 61 67 65 64 20 61 managed a
22f00 73 73 65 6d 62 6c 79 20 66 69 6c 65 73 20 74 68 ssembly files th
22f10 61 74 20 77 65 20 68 61 6e 64 6c 65 20 75 6e 6c at we handle unl
22f20 65 73 73 20 66 6f 72 62 69 64 64 65 6e 20 66 72 ess forbidden fr
22f30 6f 6d 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 om.. #
22f40 20 20 20 20 64 6f 69 6e 67 20 73 6f 2e 0d 0a 20 doing so...
22f50 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
22f60 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
22f70 73 74 73 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 52 sts ::no(sqliteR
22f80 65 6d 6f 76 65 43 6f 6e 73 74 72 61 69 6e 74 73 emoveConstraints
22f90 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 )]} then {..
22fa0 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 foreach fi
22fb0 6c 65 4e 61 6d 65 20 24 63 6f 6e 66 69 67 46 69 leName $configFi
22fc0 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
22fd0 20 20 20 20 20 20 20 72 65 6d 6f 76 65 43 6f 6e removeCon
22fe0 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
22ff0 72 67 73 20 66 69 6c 65 5f 20 24 66 69 6c 65 4e rgs file_ $fileN
23000 61 6d 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 ame]..
23010 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 66 }.... f
23020 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 oreach fileName
23030 24 6d 64 61 43 6f 6e 66 69 67 46 69 6c 65 4e 61 $mdaConfigFileNa
23040 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 mes {..
23050 20 20 20 72 65 6d 6f 76 65 43 6f 6e 73 74 72 61 removeConstra
23060 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
23070 66 69 6c 65 5f 20 24 66 69 6c 65 4e 61 6d 65 5d file_ $fileName]
23080 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d .. }...
23090 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 . forea
230a0 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 65 78 74 ch fileName $ext
230b0 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 73 20 7b ernalFileNames {
230c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
230d0 6d 6f 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b moveConstraint [
230e0 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
230f0 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6c [file tail $fil
23100 65 4e 61 6d 65 5d 5d 0d 0a 20 20 20 20 20 20 20 eName]]..
23110 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
23120 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
23130 6d 65 20 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 me $nativeFileNa
23140 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 mes {..
23150 20 20 20 72 65 6d 6f 76 65 43 6f 6e 73 74 72 61 removeConstra
23160 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
23170 66 69 6c 65 5f 20 24 66 69 6c 65 4e 61 6d 65 5d file_ $fileName]
23180 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d .. }...
23190 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 . forea
231a0 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d 69 78 ch fileName $mix
231b0 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 edFileNames {..
231c0 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 6f 76 remov
231d0 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
231e0 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 24 66 endArgs file_ $f
231f0 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 ileName]..
23200 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
23210 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e foreach fileN
23220 61 6d 65 20 24 6d 61 6e 61 67 65 64 46 69 6c 65 ame $managedFile
23230 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 Names {..
23240 20 20 20 20 20 72 65 6d 6f 76 65 43 6f 6e 73 74 removeConst
23250 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
23260 73 20 66 69 6c 65 5f 20 24 66 69 6c 65 4e 61 6d s file_ $fileNam
23270 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d e].. }.
23280 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
23290 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
232a0 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 61 6c # NOTE: Skip al
232b0 6c 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 l System.Data.SQ
232c0 4c 69 74 65 20 72 65 6c 61 74 65 64 20 66 69 6c Lite related fil
232d0 65 20 68 61 6e 64 6c 69 6e 67 20 28 64 65 6c 65 e handling (dele
232e0 74 69 6e 67 2c 0d 0a 20 20 20 20 20 20 20 20 23 ting,.. #
232f0 20 20 20 20 20 20 20 63 6f 70 79 69 6e 67 2c 20 copying,
23300 61 6e 64 20 6c 6f 61 64 69 6e 67 29 20 69 66 20 and loading) if
23310 69 6e 73 74 72 75 63 74 65 64 2e 0d 0a 20 20 20 instructed...
23320 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
23330 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
23340 73 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 46 69 6c s ::no(sqliteFil
23350 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 es)]} then {..
23360 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
23370 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 # NOTE: Ski
23380 70 20 74 72 79 69 6e 67 20 74 6f 20 64 65 6c 65 p trying to dele
23390 74 65 20 61 6e 79 20 66 69 6c 65 73 20 69 66 20 te any files if
233a0 69 6e 73 74 72 75 63 74 65 64 2e 0d 0a 20 20 20 instructed...
233b0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
233c0 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
233d0 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 xists ::no(delet
233e0 65 53 71 6c 69 74 65 46 69 6c 65 73 29 5d 7d 20 eSqliteFiles)]}
233f0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
23400 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
23410 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 xists ::no(delet
23420 65 53 71 6c 69 74 65 43 6f 6e 66 69 67 46 69 6c eSqliteConfigFil
23430 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 es)]} then {..
23440 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 fore
23450 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 63 6f ach fileName $co
23460 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d nfigFileNames {.
23470 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
23480 20 74 72 79 44 65 6c 65 74 65 42 69 6e 61 72 79 tryDeleteBinary
23490 46 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 0d 0a File $fileName..
234a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
234b0 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
234c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
234d0 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
234e0 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 ::no(deleteSqlit
234f0 65 45 78 74 65 72 6e 61 6c 46 69 6c 65 73 29 5d eExternalFiles)]
23500 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
23510 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
23520 66 69 6c 65 4e 61 6d 65 20 24 6d 64 61 43 6f 6e fileName $mdaCon
23530 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a figFileNames {..
23540 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23550 74 72 79 44 65 6c 65 74 65 42 75 69 6c 64 46 69 tryDeleteBuildFi
23560 6c 65 20 24 66 69 6c 65 4e 61 6d 65 20 66 61 6c le $fileName fal
23570 73 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 se..
23580 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
23590 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
235a0 65 4e 61 6d 65 20 24 65 78 74 65 72 6e 61 6c 46 eName $externalF
235b0 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 ileNames {..
235c0 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 44 tryD
235d0 65 6c 65 74 65 42 69 6e 61 72 79 46 69 6c 65 20 eleteBinaryFile
235e0 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 $fileName..
235f0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
23600 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
23610 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
23620 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
23630 64 65 6c 65 74 65 53 71 6c 69 74 65 4e 61 74 69 deleteSqliteNati
23640 76 65 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 veFiles)]} then
23650 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
23660 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
23670 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 ts ::no(deleteSq
23680 6c 69 74 65 49 6d 70 6c 69 63 69 74 4e 61 74 69 liteImplicitNati
23690 76 65 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 veFiles)]} then
236a0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
236b0 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e foreach fileN
236c0 61 6d 65 20 24 6e 61 74 69 76 65 46 69 6c 65 4e ame $nativeFileN
236d0 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 ames {..
236e0 20 20 20 20 20 20 20 20 20 20 74 72 79 44 65 6c tryDel
236f0 65 74 65 41 73 73 65 6d 62 6c 79 20 24 66 69 6c eteAssembly $fil
23700 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 eName..
23710 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
23720 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
23730 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
23740 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
23750 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 65 4e 6f o(deleteSqliteNo
23760 6e 49 6d 70 6c 69 63 69 74 46 69 6c 65 73 29 5d nImplicitFiles)]
23770 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
23780 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
23790 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
237a0 28 64 65 6c 65 74 65 53 71 6c 69 74 65 50 6c 61 (deleteSqlitePla
237b0 74 66 6f 72 6d 46 69 6c 65 73 29 5d 20 26 26 20 tformFiles)] &&
237c0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
237d0 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c [string l
237e0 65 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d ength $platform]
237f0 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
23800 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23810 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 foreach fileName
23820 20 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 $nativeFileName
23830 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
23840 20 20 20 20 20 20 20 20 20 74 72 79 44 65 6c 65 tryDele
23850 74 65 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 teAssembly $file
23860 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 0d 0a Name $platform..
23870 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23880 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
23890 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
238a0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
238b0 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
238c0 28 64 65 6c 65 74 65 53 71 6c 69 74 65 41 72 63 (deleteSqliteArc
238d0 68 69 74 65 63 74 75 72 65 46 69 6c 65 73 29 5d hitectureFiles)]
238e0 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
238f0 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 [stri
23900 6e 67 20 6c 65 6e 67 74 68 20 24 61 72 63 68 69 ng length $archi
23910 74 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 74 68 tecture] > 0} th
23920 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
23930 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
23940 66 69 6c 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 fileName $native
23950 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 FileNames {..
23960 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
23970 20 74 72 79 44 65 6c 65 74 65 41 73 73 65 6d 62 tryDeleteAssemb
23980 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 24 61 72 ly $fileName $ar
23990 63 68 69 74 65 63 74 75 72 65 0d 0a 20 20 20 20 chitecture..
239a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
239b0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
239c0 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
239d0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
239e0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
239f0 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
23a00 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 sts ::no(deleteS
23a10 71 6c 69 74 65 4d 69 78 65 64 46 69 6c 65 73 29 qliteMixedFiles)
23a20 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
23a30 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
23a40 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
23a50 3a 20 49 66 20 74 68 65 20 22 6e 61 74 69 76 65 : If the "native
23a60 22 20 72 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e " runtime option
23a70 20 69 73 20 73 65 74 2c 20 64 65 6c 65 74 65 20 is set, delete
23a80 69 6d 70 6c 69 63 69 74 0d 0a 20 20 20 20 20 20 implicit..
23a90 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
23aa0 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 65 6d mixed-mode assem
23ab0 62 6c 79 20 66 69 6c 65 73 20 61 73 20 77 65 6c bly files as wel
23ac0 6c 2e 20 20 54 68 69 73 20 72 75 6e 74 69 6d 65 l. This runtime
23ad0 20 6f 70 74 69 6f 6e 0d 0a 20 20 20 20 20 20 20 option..
23ae0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 # c
23af0 68 65 63 6b 20 69 73 20 68 61 6e 64 6c 65 64 20 heck is handled
23b00 77 68 65 6e 20 62 75 69 6c 64 69 6e 67 20 74 68 when building th
23b10 65 20 6c 69 73 74 20 6f 66 20 6d 69 78 65 64 2d e list of mixed-
23b20 6d 6f 64 65 0d 0a 20 20 20 20 20 20 20 20 20 20 mode..
23b30 20 20 20 20 23 20 20 20 20 20 20 20 61 73 73 65 # asse
23b40 6d 62 6c 79 20 66 69 6c 65 20 6e 61 6d 65 73 2e mbly file names.
23b50 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
23b60 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 #..
23b70 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
23b80 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 ts ::no(deleteSq
23b90 6c 69 74 65 49 6d 70 6c 69 63 69 74 4d 69 78 65 liteImplicitMixe
23ba0 64 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b dFiles)]} then {
23bb0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
23bc0 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
23bd0 6d 65 20 24 6d 69 78 65 64 46 69 6c 65 4e 61 6d me $mixedFileNam
23be0 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
23bf0 20 20 20 20 20 20 20 20 74 72 79 44 65 6c 65 74 tryDelet
23c00 65 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e eAssembly $fileN
23c10 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ame..
23c20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
23c30 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
23c40 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
23c50 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
23c60 64 65 6c 65 74 65 53 71 6c 69 74 65 4e 6f 6e 49 deleteSqliteNonI
23c70 6d 70 6c 69 63 69 74 46 69 6c 65 73 29 5d 7d 20 mplicitFiles)]}
23c80 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
23c90 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
23ca0 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 fo exists ::no(d
23cb0 65 6c 65 74 65 53 71 6c 69 74 65 50 6c 61 74 66 eleteSqlitePlatf
23cc0 6f 72 6d 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d ormFiles)] && \.
23cd0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
23ce0 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
23cf0 67 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3e gth $platform] >
23d00 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
23d10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
23d20 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
23d30 6d 69 78 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b mixedFileNames {
23d40 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
23d50 20 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 41 tryDeleteA
23d60 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d ssembly $fileNam
23d70 65 20 24 70 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 e $platform..
23d80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
23d90 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
23da0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
23db0 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
23dc0 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 o exists ::no(de
23dd0 6c 65 74 65 53 71 6c 69 74 65 41 72 63 68 69 74 leteSqliteArchit
23de0 65 63 74 75 72 65 46 69 6c 65 73 29 5d 20 26 26 ectureFiles)] &&
23df0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
23e00 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
23e10 6c 65 6e 67 74 68 20 24 61 72 63 68 69 74 65 63 length $architec
23e20 74 75 72 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 ture] > 0} then
23e30 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
23e40 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
23e50 65 4e 61 6d 65 20 24 6d 69 78 65 64 46 69 6c 65 eName $mixedFile
23e60 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 Names {..
23e70 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 try
23e80 44 65 6c 65 74 65 41 73 73 65 6d 62 6c 79 20 24 DeleteAssembly $
23e90 66 69 6c 65 4e 61 6d 65 20 24 61 72 63 68 69 74 fileName $archit
23ea0 65 63 74 75 72 65 0d 0a 20 20 20 20 20 20 20 20 ecture..
23eb0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
23ec0 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
23ed0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
23ee0 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
23ef0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
23f00 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
23f10 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 ::no(deleteSqlit
23f20 65 4d 61 6e 61 67 65 64 46 69 6c 65 73 29 5d 7d eManagedFiles)]}
23f30 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
23f40 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
23f50 69 6c 65 4e 61 6d 65 20 24 6d 61 6e 61 67 65 64 ileName $managed
23f60 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 FileNames {..
23f70 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 try
23f80 44 65 6c 65 74 65 41 73 73 65 6d 62 6c 79 20 24 DeleteAssembly $
23f90 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 fileName..
23fa0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
23fb0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
23fc0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
23fd0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
23fe0 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 66 6f # NOTE: Check fo
23ff0 72 20 74 68 65 20 22 61 75 74 6f 53 65 6c 65 63 r the "autoSelec
24000 74 22 20 72 75 6e 74 69 6d 65 20 6f 70 74 69 6f t" runtime optio
24010 6e 2e 20 20 49 66 20 70 72 65 73 65 6e 74 2c 0d n. If present,.
24020 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
24030 20 20 20 61 74 74 65 6d 70 74 20 74 6f 20 61 75 attempt to au
24040 74 6f 6d 61 74 69 63 61 6c 6c 79 20 73 65 6c 65 tomatically sele
24050 63 74 20 74 68 65 20 66 69 72 73 74 20 61 76 61 ct the first ava
24060 69 6c 61 62 6c 65 0d 0a 20 20 20 20 20 20 20 20 ilable..
24070 20 20 23 20 20 20 20 20 20 20 62 75 69 6c 64 20 # build
24080 28 6f 72 20 22 72 65 6c 65 61 73 65 22 29 20 6f (or "release") o
24090 66 20 53 51 4c 69 74 65 20 61 6e 64 20 53 79 73 f SQLite and Sys
240a0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 0d tem.Data.SQLite.
240b0 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
240c0 20 20 20 66 6f 72 20 75 73 65 20 77 69 74 68 20 for use with
240d0 74 68 65 20 74 65 73 74 20 73 75 69 74 65 2e 0d the test suite..
240e0 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
240f0 20 20 20 20 20 20 20 20 69 66 20 7b 5b 68 61 73 if {[has
24100 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 61 75 RuntimeOption au
24110 74 6f 53 65 6c 65 63 74 5d 7d 20 74 68 65 6e 20 toSelect]} then
24120 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 {.. i
24130 66 20 7b 21 5b 63 68 65 63 6b 46 6f 72 53 51 4c f {![checkForSQL
24140 69 74 65 42 75 69 6c 64 73 20 24 3a 3a 74 65 73 iteBuilds $::tes
24150 74 5f 63 68 61 6e 6e 65 6c 20 74 72 75 65 5d 7d t_channel true]}
24160 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
24170 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 53 checkForS
24180 51 4c 69 74 65 52 65 6c 65 61 73 65 73 20 24 3a QLiteReleases $:
24190 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 74 72 :test_channel tr
241a0 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ue..
241b0 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
241c0 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
241d0 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
241e0 20 53 6b 69 70 20 74 72 79 69 6e 67 20 74 6f 20 Skip trying to
241f0 76 65 72 69 66 79 20 74 68 65 20 62 75 69 6c 64 verify the build
24200 20 64 69 72 65 63 74 6f 72 79 20 69 66 20 69 6e directory if in
24210 73 74 72 75 63 74 65 64 3b 0d 0a 20 20 20 20 20 structed;..
24220 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 74 68 # oth
24230 65 72 77 69 73 65 2c 20 6d 61 6b 65 20 73 75 72 erwise, make sur
24240 65 20 69 74 20 61 63 74 75 61 6c 6c 79 20 65 78 e it actually ex
24250 69 73 74 73 20 6f 72 20 68 61 6c 74 20 74 68 65 ists or halt the
24260 20 65 6e 74 69 72 65 0d 0a 20 20 20 20 20 20 20 entire..
24270 20 20 20 23 20 20 20 20 20 20 20 74 65 73 74 69 # testi
24280 6e 67 20 70 72 6f 63 65 73 73 20 69 66 20 69 74 ng process if it
24290 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 2e does not exist.
242a0 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
242b0 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
242c0 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
242d0 76 65 72 69 66 79 42 75 69 6c 64 44 69 72 65 63 verifyBuildDirec
242e0 74 6f 72 79 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a tory)]} then {..
242f0 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
24300 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 # NOT
24310 45 3a 20 41 74 20 74 68 69 73 20 70 6f 69 6e 74 E: At this point
24320 2c 20 74 68 65 20 62 75 69 6c 64 20 64 69 72 65 , the build dire
24330 63 74 6f 72 79 20 4d 55 53 54 20 65 78 69 73 74 ctory MUST exist
24340 20 61 73 20 61 0d 0a 20 20 20 20 20 20 20 20 20 as a..
24350 20 20 20 23 20 20 20 20 20 20 20 76 61 6c 69 64 # valid
24360 20 64 69 72 65 63 74 6f 72 79 20 66 6f 72 20 74 directory for t
24370 68 65 20 74 65 73 74 69 6e 67 20 70 72 6f 63 65 he testing proce
24380 73 73 20 74 6f 20 63 6f 6e 74 69 6e 75 65 2e 0d ss to continue..
24390 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
243a0 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 set
243b0 64 69 72 65 63 74 6f 72 79 20 5b 67 65 74 42 75 directory [getBu
243c0 69 6c 64 44 69 72 65 63 74 6f 72 79 20 66 61 6c ildDirectory fal
243d0 73 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 se]....
243e0 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 if {![file ex
243f0 69 73 74 73 20 24 64 69 72 65 63 74 6f 72 79 5d ists $directory]
24400 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 || \..
24410 20 20 20 20 20 20 20 21 5b 66 69 6c 65 20 69 73 ![file is
24420 64 69 72 65 63 74 6f 72 79 20 24 64 69 72 65 63 directory $direc
24430 74 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 tory]} then {..
24440 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
24450 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
24460 4e 4f 54 45 3a 20 4a 75 73 74 20 70 72 69 6f 72 NOTE: Just prior
24470 20 74 6f 20 61 63 74 75 61 6c 6c 79 20 68 61 6c to actually hal
24480 74 69 6e 67 20 74 68 65 20 74 65 73 74 69 6e 67 ting the testing
24490 20 70 72 6f 63 65 73 73 2c 0d 0a 20 20 20 20 20 process,..
244a0 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
244b0 20 61 64 64 20 61 6e 20 65 72 72 6f 72 20 74 6f add an error to
244c0 20 74 68 65 20 74 65 73 74 20 6c 6f 67 20 66 69 the test log fi
244d0 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 le...
244e0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
244f0 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
24500 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
24510 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
24520 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
24530 20 63 6f 75 6c 64 20 6e 6f 74 20 76 65 72 69 66 could not verif
24540 79 20 62 75 69 6c 64 20 64 69 72 65 63 74 6f 72 y build director
24550 79 20 5c 22 22 20 24 64 69 72 65 63 74 6f 72 79 y \"" $directory
24560 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
24570 20 20 20 20 20 20 22 5c 22 2c 20 61 6c 6c 20 74 "\", all t
24580 65 73 74 69 6e 67 20 68 61 6c 74 65 64 5c 6e 22 esting halted\n"
24590 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ]....
245a0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
245b0 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 61 69 73 # NOTE: Rais
245c0 69 6e 67 20 61 20 73 63 72 69 70 74 20 65 72 72 ing a script err
245d0 6f 72 20 66 72 6f 6d 20 74 68 69 73 20 70 6f 69 or from this poi
245e0 6e 74 20 73 68 6f 75 6c 64 20 68 61 6c 74 0d 0a nt should halt..
245f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
24600 20 20 20 20 20 20 74 68 65 20 74 65 73 74 69 6e the testin
24610 67 20 70 72 6f 63 65 73 73 2e 0d 0a 20 20 20 20 g process...
24620 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
24630 20 20 20 20 20 20 20 20 20 20 20 65 72 72 6f 72 error
24640 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
24650 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
24660 20 20 22 63 6f 75 6c 64 20 6e 6f 74 20 76 65 72 "could not ver
24670 69 66 79 20 62 75 69 6c 64 20 64 69 72 65 63 74 ify build direct
24680 6f 72 79 20 5c 22 22 20 24 64 69 72 65 63 74 6f ory \"" $directo
24690 72 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ry \..
246a0 20 20 20 20 20 20 20 20 22 5c 22 2c 20 61 6c 6c "\", all
246b0 20 74 65 73 74 69 6e 67 20 68 61 6c 74 65 64 22 testing halted"
246c0 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
246d0 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d .. }...
246e0 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
246f0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
24700 53 6b 69 70 20 74 72 79 69 6e 67 20 74 6f 20 63 Skip trying to c
24710 6f 70 79 20 61 6e 79 20 66 69 6c 65 73 20 69 66 opy any files if
24720 20 69 6e 73 74 72 75 63 74 65 64 2e 0d 0a 20 20 instructed...
24730 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
24740 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
24750 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 exists ::no(copy
24760 53 71 6c 69 74 65 46 69 6c 65 73 29 5d 7d 20 74 SqliteFiles)]} t
24770 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
24780 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
24790 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 ists ::no(copySq
247a0 6c 69 74 65 43 6f 6e 66 69 67 46 69 6c 65 73 29 liteConfigFiles)
247b0 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
247c0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
247d0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c ::test_channel \
247e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
247f0 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 79 69 6e "---- copyin
24800 67 20 5c 22 63 6f 6e 66 69 67 75 72 61 74 69 6f g \"configuratio
24810 6e 5c 22 20 66 69 6c 65 73 2e 2e 2e 5c 6e 22 0d n\" files...\n".
24820 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
24830 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d foreach fileNam
24840 65 20 24 63 6f 6e 66 69 67 46 69 6c 65 4e 61 6d e $configFileNam
24850 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
24860 20 20 20 20 20 20 74 72 79 43 6f 70 79 42 75 69 tryCopyBui
24870 6c 64 46 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 ldFile $fileName
24880 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 false..
24890 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
248a0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
248b0 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
248c0 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 exists ::no(cop
248d0 79 53 71 6c 69 74 65 45 78 74 65 72 6e 61 6c 46 ySqliteExternalF
248e0 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
248f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
24900 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
24910 20 4e 4f 54 45 3a 20 43 6f 70 79 20 74 68 65 20 NOTE: Copy the
24920 4d 61 6e 61 67 65 64 20 44 65 62 75 67 67 69 6e Managed Debuggin
24930 67 20 41 73 73 69 73 74 61 6e 74 73 20 28 4d 44 g Assistants (MD
24940 41 29 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e A) configuration
24950 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
24960 23 20 20 20 20 20 20 20 66 69 6c 65 20 66 6f 72 # file for
24970 20 74 68 65 20 45 61 67 6c 65 20 73 68 65 6c 6c the Eagle shell
24980 20 74 6f 20 74 68 65 20 62 75 69 6c 64 20 6f 75 to the build ou
24990 74 70 75 74 20 64 69 72 65 63 74 6f 72 79 2c 0d tput directory,.
249a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
249b0 20 20 20 20 20 20 20 77 68 69 6c 65 20 75 73 69 while usi
249c0 6e 67 20 65 61 63 68 20 6f 66 20 74 68 65 20 6e ng each of the n
249d0 61 6d 65 73 20 6f 66 20 74 68 65 20 76 61 72 69 ames of the vari
249e0 6f 75 73 20 6c 65 67 61 63 79 20 74 65 73 74 0d ous legacy test.
249f0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
24a00 20 20 20 20 20 20 20 65 78 65 63 75 74 61 62 6c executabl
24a10 65 73 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 68 es. This will h
24a20 65 6c 70 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 elp to make sure
24a30 20 74 68 61 74 20 61 6c 6c 20 74 68 65 0d 0a 20 that all the..
24a40 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 #
24a50 20 20 20 20 20 6c 65 67 61 63 79 20 74 65 73 74 legacy test
24a60 73 20 72 75 6e 20 77 69 74 68 20 65 78 61 63 74 s run with exact
24a70 6c 79 20 74 68 65 20 73 61 6d 65 20 73 65 74 20 ly the same set
24a80 6f 66 20 4d 61 6e 61 67 65 64 0d 0a 20 20 20 20 of Managed..
24a90 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
24aa0 20 20 44 65 62 75 67 67 69 6e 67 20 41 73 73 69 Debugging Assi
24ab0 73 74 61 6e 74 73 20 63 6f 6e 66 69 67 75 72 65 stants configure
24ac0 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 d...
24ad0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
24ae0 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
24af0 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 _channel \..
24b00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
24b10 2d 2d 2d 20 63 6f 70 79 69 6e 67 20 5c 22 4d 44 --- copying \"MD
24b20 41 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5c A configuration\
24b30 22 20 66 69 6c 65 73 2e 2e 2e 5c 6e 22 0d 0a 0d " files...\n"...
24b40 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 . f
24b50 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 oreach fileName
24b60 24 6d 64 61 43 6f 6e 66 69 67 46 69 6c 65 4e 61 $mdaConfigFileNa
24b70 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 mes {..
24b80 20 20 20 20 20 20 20 74 72 79 43 6f 70 79 42 69 tryCopyBi
24b90 6e 61 72 79 46 69 6c 65 20 45 61 67 6c 65 53 68 naryFile EagleSh
24ba0 65 6c 6c 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 ell.exe.mda.conf
24bb0 69 67 20 74 72 75 65 20 22 22 20 24 66 69 6c 65 ig true "" $file
24bc0 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 Name..
24bd0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
24be0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
24bf0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
24c00 43 6f 70 79 20 74 68 65 20 65 78 74 65 72 6e 61 Copy the externa
24c10 6c 20 62 69 6e 61 72 69 65 73 2c 20 69 66 20 61 l binaries, if a
24c20 6e 79 2c 20 74 6f 20 74 68 65 20 64 69 72 65 63 ny, to the direc
24c30 74 6f 72 79 20 74 68 61 74 0d 0a 20 20 20 20 20 tory that..
24c40 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
24c50 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 45 61 contains the Ea
24c60 67 6c 65 20 73 68 65 6c 6c 2e 20 20 54 68 69 73 gle shell. This
24c70 20 69 73 20 74 79 70 69 63 61 6c 6c 79 20 75 73 is typically us
24c80 65 64 20 74 6f 20 6d 61 6b 65 0d 0a 20 20 20 20 ed to make..
24c90 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
24ca0 20 20 73 75 72 65 20 61 73 73 65 6d 62 6c 69 65 sure assemblie
24cb0 73 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 s referenced by
24cc0 74 68 65 20 6f 6e 65 73 20 62 65 69 6e 67 20 74 the ones being t
24cd0 65 73 74 65 64 20 61 72 65 0d 0a 20 20 20 20 20 ested are..
24ce0 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
24cf0 20 61 76 61 69 6c 61 62 6c 65 20 64 75 72 69 6e available durin
24d00 67 20 74 68 65 20 74 65 73 74 69 6e 67 20 70 72 g the testing pr
24d10 6f 63 65 73 73 2e 0d 0a 20 20 20 20 20 20 20 20 ocess...
24d20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
24d30 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
24d40 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 22 2d 2d test_channel "--
24d50 2d 2d 20 63 6f 70 79 69 6e 67 20 5c 22 65 78 74 -- copying \"ext
24d60 65 72 6e 61 6c 5c 22 20 66 69 6c 65 73 2e 2e 2e ernal\" files...
24d70 5c 6e 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 \n"....
24d80 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
24d90 65 4e 61 6d 65 20 24 65 78 74 65 72 6e 61 6c 46 eName $externalF
24da0 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 ileNames {..
24db0 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 43 tryC
24dc0 6f 70 79 45 78 74 65 72 6e 61 6c 46 69 6c 65 20 opyExternalFile
24dd0 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 $fileName..
24de0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
24df0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
24e00 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
24e10 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
24e20 63 6f 70 79 53 71 6c 69 74 65 4e 61 74 69 76 65 copySqliteNative
24e30 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d Files)]} then {.
24e40 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
24e50 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
24e60 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 74 # NOTE: If the t
24e70 65 73 74 20 70 6c 61 74 66 6f 72 6d 20 69 73 20 est platform is
24e80 6c 69 6b 65 6c 79 20 74 68 65 20 64 65 66 61 75 likely the defau
24e90 6c 74 20 66 6f 72 20 74 68 69 73 0d 0a 20 20 20 lt for this..
24ea0 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 #
24eb0 20 20 20 6d 61 63 68 69 6e 65 2c 20 61 6c 73 6f machine, also
24ec0 20 74 72 79 20 74 6f 20 63 6f 70 79 20 74 68 65 try to copy the
24ed0 20 6e 61 74 69 76 65 20 66 69 6c 65 73 20 74 6f native files to
24ee0 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 20 20 the..
24ef0 20 20 20 20 23 20 20 20 20 20 20 20 62 69 6e 61 # bina
24f00 72 79 20 6c 6f 63 61 74 69 6f 6e 2e 0d 0a 20 20 ry location...
24f10 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
24f20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
24f30 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
24f40 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 49 6d :no(copySqliteIm
24f50 70 6c 69 63 69 74 4e 61 74 69 76 65 46 69 6c 65 plicitNativeFile
24f60 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 s)] && \..
24f70 20 20 20 20 20 20 20 20 20 20 20 20 5b 69 73 44 [isD
24f80 65 66 61 75 6c 74 42 75 69 6c 64 50 6c 61 74 66 efaultBuildPlatf
24f90 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 orm]} then {..
24fa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
24fb0 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
24fc0 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 nel \..
24fd0 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
24fe0 20 63 6f 70 79 69 6e 67 20 69 6d 70 6c 69 63 69 copying implici
24ff0 74 20 5c 22 6e 61 74 69 76 65 5c 22 20 66 69 6c t \"native\" fil
25000 65 73 2e 2e 2e 5c 6e 22 0d 0a 0d 0a 20 20 20 20 es...\n"....
25010 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 fore
25020 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6e 61 ach fileName $na
25030 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d tiveFileNames {.
25040 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
25050 20 20 20 74 72 79 43 6f 70 79 41 73 73 65 6d 62 tryCopyAssemb
25060 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 66 61 6c ly $fileName fal
25070 73 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 se..
25080 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
25090 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
250a0 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
250b0 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 fo exists ::no(c
250c0 6f 70 79 53 71 6c 69 74 65 4e 6f 6e 49 6d 70 6c opySqliteNonImpl
250d0 69 63 69 74 46 69 6c 65 73 29 5d 7d 20 74 68 65 icitFiles)]} the
250e0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
250f0 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
25100 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 exists ::no(copy
25110 53 71 6c 69 74 65 50 6c 61 74 66 6f 72 6d 46 69 SqlitePlatformFi
25120 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 les)] && \..
25130 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
25140 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
25150 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 7d 20 74 platform] > 0} t
25160 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
25170 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
25180 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
25190 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
251a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
251b0 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 79 69 6e "---- copyin
251c0 67 20 5c 22 6e 61 74 69 76 65 5c 22 20 66 69 6c g \"native\" fil
251d0 65 73 20 66 6f 72 20 70 6c 61 74 66 6f 72 6d 20 es for platform
251e0 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 \"" \..
251f0 20 20 20 20 20 20 20 20 20 20 20 20 20 24 70 6c $pl
25200 61 74 66 6f 72 6d 20 5c 22 2e 2e 2e 5c 6e 5d 0d atform \"...\n].
25210 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
25220 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
25230 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 46 69 6c eName $nativeFil
25240 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
25250 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 tr
25260 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 20 24 66 yCopyAssembly $f
25270 69 6c 65 4e 61 6d 65 20 66 61 6c 73 65 20 24 70 ileName false $p
25280 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 20 20 20 20 latform..
25290 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
252a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
252b0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
252c0 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
252d0 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 ists ::no(copySq
252e0 6c 69 74 65 41 72 63 68 69 74 65 63 74 75 72 65 liteArchitecture
252f0 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 Files)] && \..
25300 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
25310 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
25320 20 24 61 72 63 68 69 74 65 63 74 75 72 65 5d 20 $architecture]
25330 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
25340 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
25350 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
25360 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
25370 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
25380 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
25390 63 6f 70 79 69 6e 67 20 5c 22 6e 61 74 69 76 65 copying \"native
253a0 5c 22 20 66 69 6c 65 73 20 66 6f 72 20 61 72 63 \" files for arc
253b0 68 69 74 65 63 74 75 72 65 20 5c 22 22 20 5c 0d hitecture \"" \.
253c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
253d0 20 20 20 20 20 20 20 24 61 72 63 68 69 74 65 63 $architec
253e0 74 75 72 65 20 5c 22 2e 2e 2e 5c 6e 5d 0d 0a 0d ture \"...\n]...
253f0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
25400 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e foreach fileN
25410 61 6d 65 20 24 6e 61 74 69 76 65 46 69 6c 65 4e ame $nativeFileN
25420 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 ames {..
25430 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 43 tryC
25440 6f 70 79 41 73 73 65 6d 62 6c 79 20 24 66 69 6c opyAssembly $fil
25450 65 4e 61 6d 65 20 66 61 6c 73 65 20 24 61 72 63 eName false $arc
25460 68 69 74 65 63 74 75 72 65 0d 0a 20 20 20 20 20 hitecture..
25470 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
25480 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
25490 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 }..
254a0 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
254b0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }....
254c0 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
254d0 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 ts ::no(copySqli
254e0 74 65 4d 69 78 65 64 46 69 6c 65 73 29 5d 7d 20 teMixedFiles)]}
254f0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
25500 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
25510 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 # NOTE: I
25520 66 20 74 68 65 20 22 6e 61 74 69 76 65 22 20 72 f the "native" r
25530 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e 20 69 73 untime option is
25540 20 73 65 74 2c 20 63 6f 70 79 20 69 6d 70 6c 69 set, copy impli
25550 63 69 74 0d 0a 20 20 20 20 20 20 20 20 20 20 20 cit..
25560 20 20 20 23 20 20 20 20 20 20 20 6d 69 78 65 64 # mixed
25570 2d 6d 6f 64 65 20 61 73 73 65 6d 62 6c 79 20 66 -mode assembly f
25580 69 6c 65 73 20 61 73 20 77 65 6c 6c 2e 20 20 54 iles as well. T
25590 68 65 20 72 75 6e 74 69 6d 65 20 6f 70 74 69 6f he runtime optio
255a0 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 n..
255b0 20 23 20 20 20 20 20 20 20 63 68 65 63 6b 20 69 # check i
255c0 73 20 68 61 6e 64 6c 65 64 20 77 68 65 6e 20 62 s handled when b
255d0 75 69 6c 64 69 6e 67 20 74 68 65 20 6c 69 73 74 uilding the list
255e0 20 6f 66 20 6d 69 78 65 64 2d 6d 6f 64 65 0d 0a of mixed-mode..
255f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
25600 20 20 20 20 20 20 61 73 73 65 6d 62 6c 79 20 66 assembly f
25610 69 6c 65 20 6e 61 6d 65 73 2e 0d 0a 20 20 20 20 ile names...
25620 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
25630 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
25640 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
25650 6f 28 63 6f 70 79 53 71 6c 69 74 65 49 6d 70 6c o(copySqliteImpl
25660 69 63 69 74 4d 69 78 65 64 46 69 6c 65 73 29 5d icitMixedFiles)]
25670 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
25680 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
25690 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
256a0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
256b0 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 "---- cop
256c0 79 69 6e 67 20 69 6d 70 6c 69 63 69 74 20 5c 22 ying implicit \"
256d0 6d 69 78 65 64 5c 22 20 66 69 6c 65 73 2e 2e 2e mixed\" files...
256e0 5c 6e 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 \n"....
256f0 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
25700 69 6c 65 4e 61 6d 65 20 24 6d 69 78 65 64 46 69 ileName $mixedFi
25710 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
25720 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 try
25730 43 6f 70 79 41 73 73 65 6d 62 6c 79 20 24 66 69 CopyAssembly $fi
25740 6c 65 4e 61 6d 65 20 66 61 6c 73 65 0d 0a 20 20 leName false..
25750 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
25760 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
25770 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
25780 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
25790 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c sts ::no(copySql
257a0 69 74 65 4e 6f 6e 49 6d 70 6c 69 63 69 74 46 69 iteNonImplicitFi
257b0 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 les)]} then {..
257c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 i
257d0 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
257e0 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 ::no(copySqlite
257f0 50 6c 61 74 66 6f 72 6d 46 69 6c 65 73 29 5d 20 PlatformFiles)]
25800 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
25810 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
25820 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 6f g length $platfo
25830 72 6d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d rm] > 0} then {.
25840 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
25850 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
25860 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
25870 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
25880 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
25890 2d 2d 2d 20 63 6f 70 79 69 6e 67 20 5c 22 6d 69 --- copying \"mi
258a0 78 65 64 5c 22 20 66 69 6c 65 73 20 66 6f 72 20 xed\" files for
258b0 70 6c 61 74 66 6f 72 6d 20 5c 22 22 20 5c 0d 0a platform \"" \..
258c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
258d0 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 6d 20 $platform
258e0 5c 22 2e 2e 2e 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 \"...\n]....
258f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
25900 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
25910 6d 69 78 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b mixedFileNames {
25920 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
25930 20 20 20 20 20 20 74 72 79 43 6f 70 79 41 73 73 tryCopyAss
25940 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 embly $fileName
25950 66 61 6c 73 65 20 24 70 6c 61 74 66 6f 72 6d 0d false $platform.
25960 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
25970 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
25980 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
25990 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
259a0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
259b0 6f 28 63 6f 70 79 53 71 6c 69 74 65 41 72 63 68 o(copySqliteArch
259c0 69 74 65 63 74 75 72 65 46 69 6c 65 73 29 5d 20 itectureFiles)]
259d0 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
259e0 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
259f0 67 20 6c 65 6e 67 74 68 20 24 61 72 63 68 69 74 g length $archit
25a00 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 74 68 65 ecture] > 0} the
25a10 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
25a20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
25a30 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
25a40 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
25a50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
25a60 20 20 22 2d 2d 2d 2d 20 63 6f 70 79 69 6e 67 20 "---- copying
25a70 5c 22 6d 69 78 65 64 5c 22 20 66 69 6c 65 73 20 \"mixed\" files
25a80 66 6f 72 20 61 72 63 68 69 74 65 63 74 75 72 65 for architecture
25a90 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 \"" \..
25aa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 61 $a
25ab0 72 63 68 69 74 65 63 74 75 72 65 20 5c 22 2e 2e rchitecture \"..
25ac0 2e 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 .\n]....
25ad0 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 foreac
25ae0 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d 69 78 65 h fileName $mixe
25af0 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 dFileNames {..
25b00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
25b10 20 20 74 72 79 43 6f 70 79 41 73 73 65 6d 62 6c tryCopyAssembl
25b20 79 20 24 66 69 6c 65 4e 61 6d 65 20 66 61 6c 73 y $fileName fals
25b30 65 20 24 61 72 63 68 69 74 65 63 74 75 72 65 0d e $architecture.
25b40 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
25b50 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
25b60 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
25b70 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
25b80 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
25b90 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
25ba0 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f o exists ::no(co
25bb0 70 79 53 71 6c 69 74 65 4d 61 6e 61 67 65 64 46 pySqliteManagedF
25bc0 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
25bd0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
25be0 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
25bf0 6e 65 6c 20 22 2d 2d 2d 2d 20 63 6f 70 79 69 6e nel "---- copyin
25c00 67 20 5c 22 6d 61 6e 61 67 65 64 5c 22 20 66 69 g \"managed\" fi
25c10 6c 65 73 2e 2e 2e 5c 6e 22 0d 0a 0d 0a 20 20 20 les...\n"....
25c20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 forea
25c30 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d 61 6e ch fileName $man
25c40 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d agedFileNames {.
25c50 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
25c60 20 74 72 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 tryCopyAssembly
25c70 20 24 66 69 6c 65 4e 61 6d 65 20 74 72 75 65 0d $fileName true.
25c80 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
25c90 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
25ca0 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a . }....
25cb0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
25cc0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 # NOTE: S
25cd0 6b 69 70 20 74 72 79 69 6e 67 20 74 6f 20 6c 6f kip trying to lo
25ce0 61 64 20 61 6e 79 20 66 69 6c 65 73 20 69 66 20 ad any files if
25cf0 69 6e 73 74 72 75 63 74 65 64 2e 0d 0a 20 20 20 instructed...
25d00 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
25d10 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
25d20 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 xists ::no(loadS
25d30 71 6c 69 74 65 46 69 6c 65 73 29 5d 7d 20 74 68 qliteFiles)]} th
25d40 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
25d50 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
25d60 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c sts ::no(loadSql
25d70 69 74 65 49 6d 70 6c 69 63 69 74 46 69 6c 65 73 iteImplicitFiles
25d80 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 )]} then {..
25d90 20 20 20 20 20 20 20 20 20 20 74 72 79 4c 6f 61 tryLoa
25da0 64 41 73 73 65 6d 62 6c 79 20 53 79 73 74 65 6d dAssembly System
25db0 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c .Data.SQLite.dll
25dc0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
25dd0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 ... i
25de0 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
25df0 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 65 ::no(loadSqlite
25e00 4c 69 6e 71 46 69 6c 65 73 29 5d 7d 20 74 68 65 LinqFiles)]} the
25e10 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
25e20 20 20 20 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 tryLoadAssemb
25e30 6c 79 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 ly System.Data.S
25e40 51 4c 69 74 65 2e 4c 69 6e 71 2e 64 6c 6c 0d 0a QLite.Linq.dll..
25e50 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d }...
25e60 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
25e70 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
25e80 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 65 45 66 :no(loadSqliteEf
25e90 36 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 6Files)]} then {
25ea0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
25eb0 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 6c 79 20 tryLoadAssembly
25ec0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
25ed0 74 65 2e 45 46 36 2e 64 6c 6c 0d 0a 20 20 20 20 te.EF6.dll..
25ee0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
25ef0 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
25f00 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
25f10 6c 6f 61 64 53 71 6c 69 74 65 4e 6f 6e 49 6d 70 loadSqliteNonImp
25f20 6c 69 63 69 74 46 69 6c 65 73 29 5d 7d 20 74 68 licitFiles)]} th
25f30 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
25f40 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
25f50 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 xists ::no(loadS
25f60 71 6c 69 74 65 50 6c 61 74 66 6f 72 6d 46 69 6c qlitePlatformFil
25f70 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 es)] && \..
25f80 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 [st
25f90 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 ring length $pla
25fa0 74 66 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 65 6e tform] > 0} then
25fb0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
25fc0 20 20 20 20 74 72 79 4c 6f 61 64 41 73 73 65 6d tryLoadAssem
25fd0 62 6c 79 20 53 79 73 74 65 6d 2e 44 61 74 61 2e bly System.Data.
25fe0 53 51 4c 69 74 65 2e 64 6c 6c 20 24 70 6c 61 74 SQLite.dll $plat
25ff0 66 6f 72 6d 0d 0a 20 20 20 20 20 20 20 20 20 20 form..
26000 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
26010 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
26020 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f o exists ::no(lo
26030 61 64 53 71 6c 69 74 65 41 72 63 68 69 74 65 63 adSqliteArchitec
26040 74 75 72 65 46 69 6c 65 73 29 5d 20 26 26 20 5c tureFiles)] && \
26050 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
26060 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 [string leng
26070 74 68 20 24 61 72 63 68 69 74 65 63 74 75 72 65 th $architecture
26080 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
26090 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
260a0 72 79 4c 6f 61 64 41 73 73 65 6d 62 6c 79 20 53 ryLoadAssembly S
260b0 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
260c0 65 2e 64 6c 6c 20 24 61 72 63 68 69 74 65 63 74 e.dll $architect
260d0 75 72 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ure..
260e0 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
260f0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
26100 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
26110 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
26120 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 6e 61 74 ileNameOnly $nat
26130 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a iveFileNames {..
26140 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 20 catch
26150 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
26160 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
26170 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
26180 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
26190 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 "---- file v
261a0 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 20 24 66 ersion of \"" $f
261b0 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 22 5c 22 2e ileNameOnly "\".
261c0 2e 2e 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 .. \"" \..
261d0 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
261e0 76 65 72 73 69 6f 6e 20 5b 67 65 74 42 69 6e 61 version [getBina
261f0 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 ryFileName $file
26200 4e 61 6d 65 4f 6e 6c 79 5d 5d 20 5c 22 5c 6e 5d NameOnly]] \"\n]
26210 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
26220 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
26230 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
26240 4e 61 6d 65 4f 6e 6c 79 20 24 6d 69 78 65 64 46 NameOnly $mixedF
26250 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 ileNames {..
26260 20 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 catch {..
26270 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
26280 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
26290 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
262a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
262b0 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 "---- file versi
262c0 6f 6e 20 6f 66 20 5c 22 22 20 24 66 69 6c 65 4e on of \"" $fileN
262d0 61 6d 65 4f 6e 6c 79 20 22 5c 22 2e 2e 2e 20 5c ameOnly "\"... \
262e0 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 "" \..
262f0 20 20 20 20 20 20 5b 66 69 6c 65 20 76 65 72 73 [file vers
26300 69 6f 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 69 ion [getBinaryFi
26310 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 leName $fileName
26320 4f 6e 6c 79 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 20 Only]] \"\n]..
26330 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
26340 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
26350 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 foreach fileName
26360 4f 6e 6c 79 20 24 6d 61 6e 61 67 65 64 46 69 6c Only $managedFil
26370 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
26380 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 catch {..
26390 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
263a0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
263b0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
263c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
263d0 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 6f 6e --- file version
263e0 20 6f 66 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d of \"" $fileNam
263f0 65 4f 6e 6c 79 20 22 5c 22 2e 2e 2e 20 5c 22 22 eOnly "\"... \""
26400 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
26410 20 20 20 20 5b 66 69 6c 65 20 76 65 72 73 69 6f [file versio
26420 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 n [getBinaryFile
26430 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 4f 6e Name $fileNameOn
26440 6c 79 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 ly]] \"\n]..
26450 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
26460 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 }.... if
26470 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
26480 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 7d $platform] > 0}
26490 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
264a0 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e foreach fileN
264b0 61 6d 65 4f 6e 6c 79 20 24 6e 61 74 69 76 65 46 ameOnly $nativeF
264c0 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 ileNames {..
264d0 20 20 20 20 20 20 20 20 63 61 74 63 68 20 7b 0d catch {.
264e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 . t
264f0 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
26500 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
26510 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
26520 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 "---- file
26530 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 20 version of \""
26540 24 70 6c 61 74 66 6f 72 6d 20 5c 0d 0a 20 20 20 $platform \..
26550 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f /
26560 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 22 $fileNameOnly "
26570 5c 22 2e 2e 2e 20 5c 22 22 20 5b 66 69 6c 65 20 \"... \"" [file
26580 76 65 72 73 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 version \..
26590 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 [ge
265a0 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 tBinaryFileName
265b0 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 70 $fileNameOnly $p
265c0 6c 61 74 66 6f 72 6d 5d 5d 20 5c 22 5c 6e 5d 0d latform]] \"\n].
265d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
265e0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
265f0 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 foreach
26600 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 6d fileNameOnly $m
26610 69 78 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d ixedFileNames {.
26620 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 61 74 . cat
26630 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
26640 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
26650 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
26660 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
26670 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
26680 20 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 file version of
26690 20 5c 22 22 20 24 70 6c 61 74 66 6f 72 6d 20 5c \"" $platform \
266a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
266b0 20 20 20 20 2f 20 24 66 69 6c 65 4e 61 6d 65 4f / $fileNameO
266c0 6e 6c 79 20 22 5c 22 2e 2e 2e 20 5c 22 22 20 5b nly "\"... \"" [
266d0 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 5c 0d 0a file version \..
266e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
266f0 20 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 [getBinaryFile
26700 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 4f 6e Name $fileNameOn
26710 6c 79 20 24 70 6c 61 74 66 6f 72 6d 5d 5d 20 5c ly $platform]] \
26720 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 "\n]..
26730 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
26740 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
26750 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 if {[stri
26760 6e 67 20 6c 65 6e 67 74 68 20 24 61 72 63 68 69 ng length $archi
26770 74 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 74 68 tecture] > 0} th
26780 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
26790 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 foreach fileName
267a0 4f 6e 6c 79 20 24 6e 61 74 69 76 65 46 69 6c 65 Only $nativeFile
267b0 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 Names {..
267c0 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 catch {..
267d0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
267e0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
267f0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
26800 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
26810 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 "---- file ve
26820 72 73 69 6f 6e 20 6f 66 20 5c 22 22 20 24 61 72 rsion of \"" $ar
26830 63 68 69 74 65 63 74 75 72 65 20 5c 0d 0a 20 20 chitecture \..
26840 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
26850 2f 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 / $fileNameOnly
26860 22 5c 22 2e 2e 2e 20 5c 22 22 20 5b 66 69 6c 65 "\"... \"" [file
26870 20 76 65 72 73 69 6f 6e 20 5c 0d 0a 20 20 20 20 version \..
26880 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 [g
26890 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 etBinaryFileName
268a0 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 $fileNameOnly $
268b0 61 72 63 68 69 74 65 63 74 75 72 65 5d 5d 20 5c architecture]] \
268c0 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 "\n]..
268d0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
268e0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f .... fo
268f0 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 4f 6e reach fileNameOn
26900 6c 79 20 24 6d 69 78 65 64 46 69 6c 65 4e 61 6d ly $mixedFileNam
26910 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
26920 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 catch {..
26930 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
26940 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
26950 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
26960 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
26970 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 "---- file versi
26980 6f 6e 20 6f 66 20 5c 22 22 20 24 61 72 63 68 69 on of \"" $archi
26990 74 65 63 74 75 72 65 20 5c 0d 0a 20 20 20 20 20 tecture \..
269a0 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 24 / $
269b0 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 22 5c 22 fileNameOnly "\"
269c0 2e 2e 2e 20 5c 22 22 20 5b 66 69 6c 65 20 76 65 ... \"" [file ve
269d0 72 73 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 20 rsion \..
269e0 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 [getB
269f0 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 inaryFileName $f
26a00 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 61 72 63 ileNameOnly $arc
26a10 68 69 74 65 63 74 75 72 65 5d 5d 20 5c 22 5c 6e hitecture]] \"\n
26a20 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
26a30 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
26a40 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
26a50 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
26a60 20 4e 4f 54 45 3a 20 47 72 61 62 20 74 68 65 20 NOTE: Grab the
26a70 6c 69 73 74 20 6f 66 20 6d 61 6e 61 67 65 64 20 list of managed
26a80 61 73 73 65 6d 62 6c 69 65 73 20 66 6f 72 20 74 assemblies for t
26a90 68 65 20 63 75 72 72 65 6e 74 20 70 72 6f 63 65 he current proce
26aa0 73 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ss.. #
26ab0 20 20 20 20 61 6e 64 20 72 65 70 6f 72 74 20 6f and report o
26ac0 6e 20 74 68 65 20 53 79 73 74 65 6d 2e 44 61 74 n the System.Dat
26ad0 61 2e 53 51 4c 69 74 65 20 72 65 6c 61 74 65 64 a.SQLite related
26ae0 20 6f 6e 65 73 2e 0d 0a 20 20 20 20 20 20 20 20 ones...
26af0 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
26b00 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 haveSQLiteObject
26b10 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b Command]} then {
26b20 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
26b30 61 73 73 65 6d 62 6c 69 65 73 20 5b 6f 62 6a 65 assemblies [obje
26b40 63 74 20 69 6e 76 6f 6b 65 20 41 70 70 44 6f 6d ct invoke AppDom
26b50 61 69 6e 2e 43 75 72 72 65 6e 74 44 6f 6d 61 69 ain.CurrentDomai
26b60 6e 20 47 65 74 41 73 73 65 6d 62 6c 69 65 73 5d n GetAssemblies]
26b70 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 .... ob
26b80 6a 65 63 74 20 66 6f 72 65 61 63 68 20 61 73 73 ject foreach ass
26b90 65 6d 62 6c 79 20 24 61 73 73 65 6d 62 6c 69 65 embly $assemblie
26ba0 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
26bb0 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6d 61 74 if {[string mat
26bc0 63 68 20 5c 7b 53 79 73 74 65 6d 2e 44 61 74 61 ch \{System.Data
26bd0 2e 53 51 4c 69 74 65 2a 20 24 61 73 73 65 6d 62 .SQLite* $assemb
26be0 6c 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ly]} then {..
26bf0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
26c00 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
26c10 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
26c20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
26c30 20 20 22 2d 2d 2d 2d 20 66 6f 75 6e 64 20 6c 6f "---- found lo
26c40 61 64 65 64 20 61 73 73 65 6d 62 6c 79 3a 20 22 aded assembly: "
26c50 20 24 61 73 73 65 6d 62 6c 79 20 5c 6e 5d 0d 0a $assembly \n]..
26c60 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
26c70 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
26c80 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
26c90 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 catch {..
26ca0 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
26cb0 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 t_channel \..
26cc0 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
26cd0 20 64 65 66 69 6e 65 20 63 6f 6e 73 74 61 6e 74 define constant
26ce0 73 20 66 6f 72 20 5c 22 53 79 73 74 65 6d 2e 44 s for \"System.D
26cf0 61 74 61 2e 53 51 4c 69 74 65 5c 22 2e 2e 2e 20 ata.SQLite\"...
26d00 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 ".... i
26d10 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
26d20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
26d30 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
26d40 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
26d50 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
26d60 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 em.Data.SQLite.S
26d70 51 4c 69 74 65 33 20 44 65 66 69 6e 65 43 6f 6e QLite3 DefineCon
26d80 73 74 61 6e 74 73 0d 0a 20 20 20 20 20 20 20 20 stants..
26d90 20 20 7d 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 } defineConsta
26da0 6e 74 73 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 nts] == 0} then
26db0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
26dc0 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
26dd0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
26de0 20 5b 66 6f 72 6d 61 74 4c 69 73 74 20 5b 6c 73 [formatList [ls
26df0 6f 72 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ort \..
26e00 20 20 20 20 20 20 20 24 64 65 66 69 6e 65 43 6f $defineCo
26e10 6e 73 74 61 6e 74 73 5d 20 3c 6e 6f 6e 65 3e 5d nstants] <none>]
26e20 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
26e30 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
26e40 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
26e50 65 73 74 5f 63 68 61 6e 6e 65 6c 20 75 6e 6b 6e est_channel unkn
26e60 6f 77 6e 5c 6e 0d 0a 20 20 20 20 20 20 20 20 20 own\n..
26e70 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
26e80 0a 20 20 20 20 20 20 20 20 63 61 74 63 68 20 7b . catch {
26e90 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
26ea0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
26eb0 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 l \..
26ec0 20 20 20 22 2d 2d 2d 2d 20 73 6f 75 72 63 65 20 "---- source
26ed0 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 53 79 73 version of \"Sys
26ee0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
26ef0 64 6c 6c 5c 22 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 dll\"... "....
26f00 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
26f10 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
26f20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
26f30 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
26f40 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
26f50 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
26f60 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 43 6f .SQLite.SQLiteCo
26f70 6e 6e 65 63 74 69 6f 6e 20 50 72 6f 76 69 64 65 nnection Provide
26f80 72 56 65 72 73 69 6f 6e 0d 0a 20 20 20 20 20 20 rVersion..
26f90 20 20 20 20 7d 20 76 65 72 73 69 6f 6e 5d 20 3d } version] =
26fa0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
26fb0 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 if {[st
26fc0 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 65 72 ring length $ver
26fd0 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 6e sion] == 0} then
26fe0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
26ff0 20 20 73 65 74 20 76 65 72 73 69 6f 6e 20 6e 75 set version nu
27000 6c 6c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ll..
27010 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 }.. t
27020 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
27030 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
27040 20 24 76 65 72 73 69 6f 6e 20 5c 6e 5d 0d 0a 20 $version \n]..
27050 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 } else
27060 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
27070 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
27080 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d 0a nnel unknown\n..
27090 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
270a0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
270b0 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 catch {..
270c0 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
270d0 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 st_channel \..
270e0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
270f0 2d 20 73 6f 75 72 63 65 20 63 68 65 63 6b 6f 75 - source checkou
27100 74 20 6f 66 20 5c 22 53 79 73 74 65 6d 2e 44 61 t of \"System.Da
27110 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5c 22 2e ta.SQLite.dll\".
27120 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 .. "....
27130 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
27140 20 20 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 obje
27150 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
27160 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 +NonPublic \..
27170 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 S
27180 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
27190 65 2e 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 e.SQLiteConnecti
271a0 6f 6e 20 50 72 6f 76 69 64 65 72 53 6f 75 72 63 on ProviderSourc
271b0 65 49 64 0d 0a 20 20 20 20 20 20 20 20 20 20 7d eId.. }
271c0 20 73 6f 75 72 63 65 49 64 5d 20 3d 3d 20 30 7d sourceId] == 0}
271d0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
271e0 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
271f0 20 6c 65 6e 67 74 68 20 24 73 6f 75 72 63 65 49 length $sourceI
27200 64 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d d] == 0} then {.
27210 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 . s
27220 65 74 20 73 6f 75 72 63 65 49 64 20 6e 75 6c 6c et sourceId null
27230 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
27240 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
27250 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
27260 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 el [appendArgs $
27270 73 6f 75 72 63 65 49 64 20 5c 6e 5d 0d 0a 20 20 sourceId \n]..
27280 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
27290 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
272a0 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
272b0 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d 0a 20 nel unknown\n..
272c0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
272d0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
272e0 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
272f0 54 45 3a 20 43 68 65 63 6b 20 74 68 65 20 61 76 TE: Check the av
27300 61 69 6c 61 62 6c 65 20 62 75 69 6c 64 73 20 28 ailable builds (
27310 61 6e 64 20 22 72 65 6c 65 61 73 65 73 22 29 20 and "releases")
27320 6f 66 20 53 51 4c 69 74 65 20 61 6e 64 0d 0a 20 of SQLite and..
27330 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 53 # S
27340 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
27350 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 e... #..
27360 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 53 checkForS
27370 51 4c 69 74 65 42 75 69 6c 64 73 20 24 3a 3a 74 QLiteBuilds $::t
27380 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 20 20 20 est_channel..
27390 20 20 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c checkForSQL
273a0 69 74 65 52 65 6c 65 61 73 65 73 20 24 3a 3a 74 iteReleases $::t
273b0 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 est_channel....
273c0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
273d0 20 20 23 20 4e 4f 54 45 3a 20 4e 6f 77 2c 20 77 # NOTE: Now, w
273e0 65 20 6e 65 65 64 20 74 6f 20 6b 6e 6f 77 20 69 e need to know i
273f0 66 20 74 68 65 20 53 51 4c 69 74 65 20 63 6f 72 f the SQLite cor
27400 65 20 6c 69 62 72 61 72 79 20 69 73 20 61 76 61 e library is ava
27410 69 6c 61 62 6c 65 0d 0a 20 20 20 20 20 20 20 20 ilable..
27420 23 20 20 20 20 20 20 20 28 69 2e 65 2e 20 62 65 # (i.e. be
27430 63 61 75 73 65 20 74 68 65 20 6d 61 6e 61 67 65 cause the manage
27440 64 2d 6f 6e 6c 79 20 53 79 73 74 65 6d 2e 44 61 d-only System.Da
27450 74 61 2e 53 51 4c 69 74 65 20 61 73 73 65 6d 62 ta.SQLite assemb
27460 6c 79 20 63 61 6e 0d 0a 20 20 20 20 20 20 20 20 ly can..
27470 23 20 20 20 20 20 20 20 6c 6f 61 64 20 77 69 74 # load wit
27480 68 6f 75 74 20 69 74 3b 20 68 6f 77 65 76 65 72 hout it; however
27490 2c 20 69 74 20 63 61 6e 6e 6f 74 20 64 6f 20 61 , it cannot do a
274a0 6e 79 74 68 69 6e 67 20 75 73 65 66 75 6c 20 77 nything useful w
274b0 69 74 68 6f 75 74 0d 0a 20 20 20 20 20 20 20 20 ithout..
274c0 23 20 20 20 20 20 20 20 69 74 29 2e 20 20 49 66 # it). If
274d0 20 77 65 20 61 72 65 20 75 73 69 6e 67 20 74 68 we are using th
274e0 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 e mixed-mode ass
274f0 65 6d 62 6c 79 20 61 6e 64 20 77 65 20 61 6c 72 embly and we alr
27500 65 61 64 79 0d 0a 20 20 20 20 20 20 20 20 23 20 eady.. #
27510 20 20 20 20 20 20 66 6f 75 6e 64 20 69 74 20 28 found it (
27520 61 62 6f 76 65 29 2c 20 74 68 69 73 20 73 68 6f above), this sho
27530 75 6c 64 20 61 6c 77 61 79 73 20 73 75 63 63 65 uld always succe
27540 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ed... #..
27550 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
27560 53 51 4c 69 74 65 4c 69 62 72 61 72 79 20 24 3a SQLiteLibrary $:
27570 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d :test_channel...
27580 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
27590 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 # NOTE: Chec
275a0 6b 20 69 66 20 74 68 65 20 53 51 4c 69 74 65 20 k if the SQLite
275b0 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 interop assembly
275c0 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2e 0d 0a is available...
275d0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
275e0 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 checkForSQLit
275f0 65 49 6e 74 65 72 6f 70 20 24 3a 3a 74 65 73 74 eInterop $::test
27600 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 _channel....
27610 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
27620 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 65 NOTE: Check the
27630 20 53 51 4c 69 74 65 20 64 61 74 61 62 61 73 65 SQLite database
27640 20 61 6e 64 20 74 65 6d 70 6f 72 61 72 79 20 64 and temporary d
27650 69 72 65 63 74 6f 72 69 65 73 2e 0d 0a 20 20 20 irectories...
27660 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
27670 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 44 69 checkForSQLiteDi
27680 72 65 63 74 6f 72 69 65 73 20 24 3a 3a 74 65 73 rectories $::tes
27690 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 t_channel....
276a0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
276b0 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
276c0 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 69 66 20 to determine if
276d0 76 61 72 69 6f 75 73 20 63 6f 6d 70 69 6c 65 2d various compile-
276e0 74 69 6d 65 20 6f 70 74 69 6f 6e 73 20 6e 65 65 time options nee
276f0 64 65 64 20 66 6f 72 0d 0a 20 20 20 20 20 20 20 ded for..
27700 20 23 20 20 20 20 20 20 20 74 65 73 74 20 63 6f # test co
27710 6e 73 74 72 61 69 6e 74 73 20 77 65 72 65 20 65 nstraints were e
27720 6e 61 62 6c 65 64 20 66 6f 72 20 74 68 65 20 6d nabled for the m
27730 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 79 2e anaged assembly.
27740 20 20 54 68 65 72 65 0d 0a 20 20 20 20 20 20 20 There..
27750 20 23 20 20 20 20 20 20 20 61 72 65 20 73 6f 6d # are som
27760 65 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 6f e compile-time o
27770 70 74 69 6f 6e 73 20 74 68 61 74 20 6d 75 73 74 ptions that must
27780 20 61 6c 73 6f 20 68 61 76 65 20 62 65 65 6e 20 also have been
27790 65 6e 61 62 6c 65 64 0d 0a 20 20 20 20 20 20 20 enabled..
277a0 20 23 20 20 20 20 20 20 20 66 6f 72 20 74 68 65 # for the
277b0 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c interop assembl
277c0 79 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 62 65 y in order to be
277d0 20 65 66 66 65 63 74 69 76 65 2e 20 20 46 6f 72 effective. For
277e0 20 74 68 6f 73 65 0d 0a 20 20 20 20 20 20 20 20 those..
277f0 23 20 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2c # options,
27800 20 69 74 20 77 69 6c 6c 20 62 65 20 61 73 73 75 it will be assu
27810 6d 65 64 20 74 68 61 74 20 69 74 20 77 61 73 20 med that it was
27820 65 6e 61 62 6c 65 64 20 66 6f 72 20 74 68 65 20 enabled for the
27830 69 6e 74 65 72 6f 70 0d 0a 20 20 20 20 20 20 20 interop..
27840 20 23 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c # assembl
27850 79 20 69 66 20 69 74 20 77 61 73 20 65 6e 61 62 y if it was enab
27860 6c 65 64 20 66 6f 72 20 74 68 65 20 6d 61 6e 61 led for the mana
27870 67 65 64 20 61 73 73 65 6d 62 6c 79 2e 0d 0a 20 ged assembly...
27880 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
27890 20 20 66 6f 72 65 61 63 68 20 64 65 66 69 6e 65 foreach define
278a0 43 6f 6e 73 74 61 6e 74 20 5b 6c 69 73 74 20 5c Constant [list \
278b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 43 48 .. CH
278c0 45 43 4b 5f 53 54 41 54 45 20 43 4f 55 4e 54 5f ECK_STATE COUNT_
278d0 48 41 4e 44 4c 45 20 44 45 42 55 47 20 49 4e 54 HANDLE DEBUG INT
278e0 45 52 4f 50 5f 43 4f 44 45 43 20 49 4e 54 45 52 EROP_CODEC INTER
278f0 4f 50 5f 44 45 42 55 47 20 5c 0d 0a 20 20 20 20 OP_DEBUG \..
27900 20 20 20 20 20 20 20 20 49 4e 54 45 52 4f 50 5f INTEROP_
27910 45 58 54 45 4e 53 49 4f 4e 5f 46 55 4e 43 54 49 EXTENSION_FUNCTI
27920 4f 4e 53 20 49 4e 54 45 52 4f 50 5f 46 54 53 35 ONS INTEROP_FTS5
27930 5f 45 58 54 45 4e 53 49 4f 4e 20 5c 0d 0a 20 20 _EXTENSION \..
27940 20 20 20 20 20 20 20 20 20 20 49 4e 54 45 52 4f INTERO
27950 50 5f 49 4e 43 4c 55 44 45 5f 43 45 52 4f 44 20 P_INCLUDE_CEROD
27960 49 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 44 45 5f INTEROP_INCLUDE_
27970 45 58 54 52 41 20 49 4e 54 45 52 4f 50 5f 49 4e EXTRA INTEROP_IN
27980 43 4c 55 44 45 5f 53 45 45 20 5c 0d 0a 20 20 20 CLUDE_SEE \..
27990 20 20 20 20 20 20 20 20 20 49 4e 54 45 52 4f 50 INTEROP
279a0 5f 49 4e 43 4c 55 44 45 5f 5a 49 50 56 46 53 20 _INCLUDE_ZIPVFS
279b0 49 4e 54 45 52 4f 50 5f 4a 53 4f 4e 31 5f 45 58 INTEROP_JSON1_EX
279c0 54 45 4e 53 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 TENSION \..
279d0 20 20 20 20 20 20 20 49 4e 54 45 52 4f 50 5f 4c INTEROP_L
279e0 45 47 41 43 59 5f 43 4c 4f 53 45 20 49 4e 54 45 EGACY_CLOSE INTE
279f0 52 4f 50 5f 4c 4f 47 20 49 4e 54 45 52 4f 50 5f ROP_LOG INTEROP_
27a00 50 45 52 43 45 4e 54 49 4c 45 5f 45 58 54 45 4e PERCENTILE_EXTEN
27a10 53 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 20 20 SION \..
27a20 20 20 20 20 49 4e 54 45 52 4f 50 5f 52 45 47 45 INTEROP_REGE
27a30 58 50 5f 45 58 54 45 4e 53 49 4f 4e 20 49 4e 54 XP_EXTENSION INT
27a40 45 52 4f 50 5f 53 45 53 53 49 4f 4e 5f 45 58 54 EROP_SESSION_EXT
27a50 45 4e 53 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 ENSION \..
27a60 20 20 20 20 20 20 49 4e 54 45 52 4f 50 5f 53 48 INTEROP_SH
27a70 41 31 5f 45 58 54 45 4e 53 49 4f 4e 20 49 4e 54 A1_EXTENSION INT
27a80 45 52 4f 50 5f 54 45 53 54 5f 45 58 54 45 4e 53 EROP_TEST_EXTENS
27a90 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ION \..
27aa0 20 20 20 49 4e 54 45 52 4f 50 5f 54 4f 54 59 50 INTEROP_TOTYP
27ab0 45 5f 45 58 54 45 4e 53 49 4f 4e 20 49 4e 54 45 E_EXTENSION INTE
27ac0 52 4f 50 5f 56 49 52 54 55 41 4c 5f 54 41 42 4c ROP_VIRTUAL_TABL
27ad0 45 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 E \..
27ae0 20 4e 45 54 5f 32 30 20 4e 45 54 5f 33 35 20 4e NET_20 NET_35 N
27af0 45 54 5f 34 30 20 4e 45 54 5f 34 35 20 4e 45 54 ET_40 NET_45 NET
27b00 5f 34 35 31 20 4e 45 54 5f 34 35 32 20 4e 45 54 _451 NET_452 NET
27b10 5f 34 36 20 4e 45 54 5f 34 36 31 20 5c 0d 0a 20 _46 NET_461 \..
27b20 20 20 20 20 20 20 20 20 20 20 20 4e 45 54 5f 34 NET_4
27b30 36 32 20 4e 45 54 5f 43 4f 4d 50 41 43 54 5f 32 62 NET_COMPACT_2
27b40 30 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 0 PLATFORM_COMPA
27b50 43 54 46 52 41 4d 45 57 4f 52 4b 20 5c 0d 0a 20 CTFRAMEWORK \..
27b60 20 20 20 20 20 20 20 20 20 20 20 50 52 45 4c 4f PRELO
27b70 41 44 5f 4e 41 54 49 56 45 5f 4c 49 42 52 41 52 AD_NATIVE_LIBRAR
27b80 59 20 52 45 54 41 52 47 45 54 41 42 4c 45 20 53 Y RETARGETABLE S
27b90 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 20 5c QLITE_STANDARD \
27ba0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 54 48 .. TH
27bb0 52 4f 57 5f 4f 4e 5f 44 49 53 50 4f 53 45 44 20 ROW_ON_DISPOSED
27bc0 54 52 41 43 45 20 54 52 41 43 45 5f 43 4f 4e 4e TRACE TRACE_CONN
27bd0 45 43 54 49 4f 4e 20 54 52 41 43 45 5f 44 45 54 ECTION TRACE_DET
27be0 45 43 54 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 ECTION \..
27bf0 20 20 20 20 20 20 54 52 41 43 45 5f 48 41 4e 44 TRACE_HAND
27c00 4c 45 20 54 52 41 43 45 5f 50 52 45 4c 4f 41 44 LE TRACE_PRELOAD
27c10 20 54 52 41 43 45 5f 53 48 41 52 45 44 20 54 52 TRACE_SHARED TR
27c20 41 43 45 5f 53 54 41 54 45 4d 45 4e 54 20 5c 0d ACE_STATEMENT \.
27c30 0a 20 20 20 20 20 20 20 20 20 20 20 20 54 52 41 . TRA
27c40 43 45 5f 57 41 52 4e 49 4e 47 20 54 52 41 43 4b CE_WARNING TRACK
27c50 5f 4d 45 4d 4f 52 59 5f 42 59 54 45 53 20 55 53 _MEMORY_BYTES US
27c60 45 5f 45 4e 54 49 54 59 5f 46 52 41 4d 45 57 4f E_ENTITY_FRAMEWO
27c70 52 4b 5f 36 20 5c 0d 0a 20 20 20 20 20 20 20 20 RK_6 \..
27c80 20 20 20 20 55 53 45 5f 49 4e 54 45 52 4f 50 5f USE_INTEROP_
27c90 44 4c 4c 20 55 53 45 5f 50 52 45 50 41 52 45 5f DLL USE_PREPARE_
27ca0 56 32 20 57 49 4e 44 4f 57 53 5d 20 7b 0d 0a 20 V2 WINDOWS] {..
27cb0 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
27cc0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 # NOTE: Ch
27cd0 65 63 6b 20 69 66 20 74 68 65 20 63 6f 6d 70 69 eck if the compi
27ce0 6c 65 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 20 69 le-time option i
27cf0 73 20 6c 69 73 74 65 64 20 69 6e 20 74 68 65 20 s listed in the
27d00 6c 69 73 74 20 6f 66 0d 0a 20 20 20 20 20 20 20 list of..
27d10 20 20 20 23 20 20 20 20 20 20 20 22 64 65 66 69 # "defi
27d20 6e 65 20 63 6f 6e 73 74 61 6e 74 73 22 20 6b 65 ne constants" ke
27d30 70 74 20 74 72 61 63 6b 20 6f 66 20 62 79 20 74 pt track of by t
27d40 68 65 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d he managed assem
27d50 62 6c 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 bly...
27d60 23 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 #.. che
27d70 63 6b 46 6f 72 53 51 4c 69 74 65 44 65 66 69 6e ckForSQLiteDefin
27d80 65 43 6f 6e 73 74 61 6e 74 20 24 3a 3a 74 65 73 eConstant $::tes
27d90 74 5f 63 68 61 6e 6e 65 6c 20 24 64 65 66 69 6e t_channel $defin
27da0 65 43 6f 6e 73 74 61 6e 74 0d 0a 20 20 20 20 20 eConstant..
27db0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
27dc0 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
27dd0 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 65 20 E: Check if the
27de0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
27df0 74 65 20 70 72 6f 76 69 64 65 72 20 77 61 73 20 te provider was
27e00 63 6f 6d 70 69 6c 65 64 20 77 69 74 68 0d 0a 20 compiled with..
27e10 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 # s
27e20 75 70 70 6f 72 74 20 66 6f 72 20 61 6e 79 20 65 upport for any e
27e30 6e 63 72 79 70 74 65 64 20 64 61 74 61 62 61 73 ncrypted databas
27e40 65 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a es... #..
27e50 20 20 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 if {[hav
27e60 65 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e eSQLiteDefineCon
27e70 73 74 61 6e 74 20 49 4e 54 45 52 4f 50 5f 43 4f stant INTEROP_CO
27e80 44 45 43 5d 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 DEC] || \..
27e90 20 20 20 20 20 20 20 5b 68 61 76 65 53 51 4c 69 [haveSQLi
27ea0 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 teDefineConstant
27eb0 20 49 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 44 45 INTEROP_INCLUDE
27ec0 5f 53 45 45 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 _SEE]} then {..
27ed0 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
27ee0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 65 # NOTE: Ye
27ef0 73 2c 20 61 64 64 20 67 65 6e 65 72 69 63 20 63 s, add generic c
27f00 6f 6e 73 74 72 61 69 6e 74 20 66 6f 72 20 75 73 onstraint for us
27f10 65 20 62 79 20 74 68 65 20 74 65 73 74 20 73 75 e by the test su
27f20 69 74 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ite...
27f30 23 0d 0a 20 20 20 20 20 20 20 20 20 20 61 64 64 #.. add
27f40 43 6f 6e 73 74 72 61 69 6e 74 20 53 79 73 74 65 Constraint Syste
27f50 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 45 6e m.Data.SQLite.En
27f60 63 72 79 70 74 69 6f 6e 0d 0a 20 20 20 20 20 20 cryption..
27f70 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 }.... #
27f80 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
27f90 3a 20 43 68 65 63 6b 20 74 68 65 20 63 75 72 72 : Check the curr
27fa0 65 6e 74 20 62 75 69 6c 64 20 79 65 61 72 2e 20 ent build year.
27fb0 20 42 61 73 69 63 61 6c 6c 79 2c 20 74 68 69 73 Basically, this
27fc0 20 69 6e 64 69 63 61 74 65 73 0d 0a 20 20 20 20 indicates..
27fd0 20 20 20 20 23 20 20 20 20 20 20 20 77 68 69 63 # whic
27fe0 68 20 76 65 72 73 69 6f 6e 20 6f 66 20 4d 53 42 h version of MSB
27ff0 75 69 6c 64 20 61 6e 64 2f 6f 72 20 56 69 73 75 uild and/or Visu
28000 61 6c 20 53 74 75 64 69 6f 20 77 61 73 20 75 73 al Studio was us
28010 65 64 20 74 6f 0d 0a 20 20 20 20 20 20 20 20 23 ed to.. #
28020 20 20 20 20 20 20 20 63 6f 6d 70 69 6c 65 20 74 compile t
28030 68 65 20 61 73 73 65 6d 62 6c 79 20 62 69 6e 61 he assembly bina
28040 72 69 65 73 20 75 6e 64 65 72 20 74 65 73 74 2e ries under test.
28050 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
28060 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
28070 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 st_channel \..
28080 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
28090 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 checking for Sys
280a0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
280b0 62 75 69 6c 64 20 79 65 61 72 2e 2e 2e 20 22 0d build year... ".
280c0 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 79 ... set y
280d0 65 61 72 20 5b 67 65 74 42 75 69 6c 64 59 65 61 ear [getBuildYea
280e0 72 5d 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 r].. addC
280f0 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e onstraint [appen
28100 64 41 72 67 73 20 62 75 69 6c 64 59 65 61 72 2e dArgs buildYear.
28110 20 24 79 65 61 72 5d 0d 0a 20 20 20 20 20 20 20 $year]..
28120 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
28130 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
28140 67 73 20 5c 22 20 24 79 65 61 72 20 5c 22 5c 6e gs \" $year \"\n
28150 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ].... #..
28160 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
28170 43 68 65 63 6b 20 74 68 65 20 63 75 72 72 65 6e Check the curren
28180 74 20 62 75 69 6c 64 20 2e 4e 45 54 20 46 72 61 t build .NET Fra
28190 6d 65 77 6f 72 6b 2e 20 20 42 61 73 69 63 61 6c mework. Basical
281a0 6c 79 2c 20 74 68 69 73 0d 0a 20 20 20 20 20 20 ly, this..
281b0 20 20 23 20 20 20 20 20 20 20 69 6e 64 69 63 61 # indica
281c0 74 65 73 20 77 68 69 63 68 20 76 65 72 73 69 6f tes which versio
281d0 6e 20 6f 66 20 74 68 65 20 2e 4e 45 54 20 46 72 n of the .NET Fr
281e0 61 6d 65 77 6f 72 6b 20 69 73 20 62 65 69 6e 67 amework is being
281f0 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
28200 20 20 75 73 65 64 20 62 79 20 74 68 65 20 61 73 used by the as
28210 73 65 6d 62 6c 79 20 62 69 6e 61 72 69 65 73 20 sembly binaries
28220 75 6e 64 65 72 20 74 65 73 74 2e 0d 0a 20 20 20 under test...
28230 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
28240 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
28250 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 annel \..
28260 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b "---- check
28270 69 6e 67 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 ing for System.D
28280 61 74 61 2e 53 51 4c 69 74 65 20 62 75 69 6c 64 ata.SQLite build
28290 20 2e 4e 45 54 20 46 72 61 6d 65 77 6f 72 6b 2e .NET Framework.
282a0 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 .. "....
282b0 73 65 74 20 6e 65 74 46 78 20 5b 67 65 74 42 75 set netFx [getBu
282c0 69 6c 64 4e 65 74 46 78 5d 0d 0a 20 20 20 20 20 ildNetFx]..
282d0 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 addConstraint
282e0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 62 75 69 [appendArgs bui
282f0 6c 64 46 72 61 6d 65 77 6f 72 6b 2e 20 24 6e 65 ldFramework. $ne
28300 74 46 78 5d 0d 0a 20 20 20 20 20 20 20 20 74 70 tFx].. tp
28310 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
28320 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
28330 5c 22 20 24 6e 65 74 46 78 20 5c 22 5c 6e 5d 0d \" $netFx \"\n].
28340 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
28350 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 # NOTE: Ch
28360 65 63 6b 20 74 68 65 20 63 75 72 72 65 6e 74 20 eck the current
28370 62 75 69 6c 64 20 63 6f 6e 66 69 67 75 72 61 74 build configurat
28380 69 6f 6e 2e 20 20 54 68 69 73 20 73 68 6f 75 6c ion. This shoul
28390 64 20 6e 6f 72 6d 61 6c 6c 79 0d 0a 20 20 20 20 d normally..
283a0 20 20 20 20 23 20 20 20 20 20 20 20 62 65 20 65 # be e
283b0 69 74 68 65 72 20 22 44 65 62 75 67 22 20 6f 72 ither "Debug" or
283c0 20 22 52 65 6c 65 61 73 65 22 2e 0d 0a 20 20 20 "Release"...
283d0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
283e0 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
283f0 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 annel \..
28400 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b "---- check
28410 69 6e 67 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 ing for System.D
28420 61 74 61 2e 53 51 4c 69 74 65 20 62 75 69 6c 64 ata.SQLite build
28430 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2e 2e configuration..
28440 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 . ".... s
28450 65 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e et configuration
28460 20 5b 67 65 74 42 75 69 6c 64 43 6f 6e 66 69 67 [getBuildConfig
28470 75 72 61 74 69 6f 6e 5d 0d 0a 20 20 20 20 20 20 uration]..
28480 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 addConstraint
28490 5b 61 70 70 65 6e 64 41 72 67 73 20 62 75 69 6c [appendArgs buil
284a0 64 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2e 20 dConfiguration.
284b0 24 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5d 0d $configuration].
284c0 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
284d0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
284e0 61 70 70 65 6e 64 41 72 67 73 20 5c 22 20 24 63 appendArgs \" $c
284f0 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 5c 22 5c onfiguration \"\
28500 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d n].... #.
28510 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
28520 20 54 72 79 20 74 6f 20 73 65 74 75 70 20 61 6e Try to setup an
28530 20 69 6e 74 65 72 72 75 70 74 20 63 61 6c 6c 62 interrupt callb
28540 61 63 6b 20 75 73 69 6e 67 20 74 68 65 20 73 63 ack using the sc
28550 72 69 70 74 20 64 65 62 75 67 67 65 72 0d 0a 20 ript debugger..
28560 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
28570 68 61 74 20 77 69 6c 6c 20 63 61 6e 63 65 6c 20 hat will cancel
28580 61 6c 6c 20 53 51 4c 20 71 75 65 72 69 65 73 20 all SQL queries
28590 69 6e 20 70 72 6f 67 72 65 73 73 20 66 6f 72 20 in progress for
285a0 61 6c 6c 20 64 61 74 61 62 61 73 65 0d 0a 20 20 all database..
285b0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
285c0 6e 6e 65 63 74 69 6f 6e 73 20 6b 6e 6f 77 6e 20 nnections known
285d0 74 6f 20 74 68 69 73 20 69 6e 74 65 72 70 72 65 to this interpre
285e0 74 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ter... #.
285f0 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 . if {![i
28600 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
28610 73 71 6c 69 74 65 49 6e 74 65 72 72 75 70 74 43 sqliteInterruptC
28620 61 6c 6c 62 61 63 6b 29 5d 7d 20 74 68 65 6e 20 allback)]} then
28630 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 {.. set
28640 75 70 44 62 49 6e 74 65 72 72 75 70 74 43 61 6c upDbInterruptCal
28650 6c 62 61 63 6b 20 24 3a 3a 74 65 73 74 5f 63 68 lback $::test_ch
28660 61 6e 6e 65 6c 20 24 3a 3a 74 65 73 74 5f 6c 6f annel $::test_lo
28670 67 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a g.. }....
28680 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
28690 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b # NOTE: Check
286a0 20 66 6f 72 20 74 68 65 20 6e 61 74 69 76 65 20 for the native
286b0 72 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e 2c 20 runtime option,
286c0 77 68 69 63 68 20 77 6f 75 6c 64 20 6d 65 61 6e which would mean
286d0 20 77 65 20 61 72 65 0d 0a 20 20 20 20 20 20 20 we are..
286e0 20 23 20 20 20 20 20 20 20 75 73 69 6e 67 20 74 # using t
286f0 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 he mixed-mode as
28700 73 65 6d 62 6c 79 2e 0d 0a 20 20 20 20 20 20 20 sembly...
28710 20 23 0d 0a 20 20 20 20 20 20 20 20 63 68 65 63 #.. chec
28720 6b 46 6f 72 52 75 6e 74 69 6d 65 4f 70 74 69 6f kForRuntimeOptio
28730 6e 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 n $::test_channe
28740 6c 20 6e 61 74 69 76 65 0d 0a 0d 0a 20 20 20 20 l native....
28750 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
28760 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 NOTE: Check if
28770 74 68 65 20 74 65 73 74 20 73 75 69 74 65 20 73 the test suite s
28780 68 6f 75 6c 64 20 63 6f 75 6e 74 20 74 68 65 20 hould count the
28790 6e 75 6d 62 65 72 20 6f 66 20 63 6f 6e 6e 65 63 number of connec
287a0 74 69 6f 6e 73 0d 0a 20 20 20 20 20 20 20 20 23 tions.. #
287b0 20 20 20 20 20 20 20 22 6f 70 65 6e 65 64 22 20 "opened"
287c0 61 6e 64 20 22 63 6c 6f 73 65 64 22 20 66 72 6f and "closed" fro
287d0 6d 20 74 68 65 20 70 6f 6f 6c 20 77 68 65 6e 20 m the pool when
287e0 64 65 74 65 72 6d 69 6e 69 6e 67 20 69 66 20 61 determining if a
287f0 20 74 65 73 74 0d 0a 20 20 20 20 20 20 20 20 23 test.. #
28800 20 20 20 20 20 20 20 70 61 73 73 65 64 2e 20 20 passed.
28810 44 69 73 61 62 6c 69 6e 67 20 74 68 69 73 20 62 Disabling this b
28820 65 68 61 76 69 6f 72 20 69 73 20 73 6f 6d 65 74 ehavior is somet
28830 69 6d 65 73 20 6e 65 63 65 73 73 61 72 79 20 28 imes necessary (
28840 65 2e 67 2e 0d 0a 20 20 20 20 20 20 20 20 23 20 e.g... #
28850 20 20 20 20 20 20 64 75 72 69 6e 67 20 74 68 65 during the
28860 20 72 65 6c 65 61 73 65 20 74 65 73 74 69 6e 67 release testing
28870 20 70 72 6f 63 65 73 73 29 20 62 65 63 61 75 73 process) becaus
28880 65 20 74 68 65 72 65 20 61 72 65 20 73 65 76 65 e there are seve
28890 72 61 6c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ral.. #
288a0 20 20 20 20 20 74 65 73 74 73 20 74 68 61 74 20 tests that
288b0 72 65 6c 79 20 6f 6e 20 74 68 65 20 22 6f 70 65 rely on the "ope
288c0 6e 65 64 20 66 72 6f 6d 20 70 6f 6f 6c 22 20 63 ned from pool" c
288d0 6f 75 6e 74 20 62 65 69 6e 67 20 67 72 65 61 74 ount being great
288e0 65 72 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 er.. #
288f0 20 20 20 20 74 68 61 6e 20 7a 65 72 6f 2e 20 20 than zero.
28900 54 68 65 73 65 20 74 65 73 74 73 20 6d 61 79 20 These tests may
28910 66 61 69 6c 20 64 75 65 20 74 6f 20 74 68 65 20 fail due to the
28920 6e 6f 6e 2d 64 65 74 65 72 6d 69 6e 69 73 74 69 non-deterministi
28930 63 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 c.. #
28940 20 20 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 behavior of t
28950 68 65 20 43 4c 52 20 47 43 2c 20 65 76 65 6e 20 he CLR GC, even
28960 77 68 65 6e 20 74 68 65 72 65 20 69 73 20 6e 6f when there is no
28970 20 62 75 67 20 69 6e 20 74 68 65 20 63 6f 64 65 bug in the code
28980 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
28990 20 20 62 65 69 6e 67 20 74 65 73 74 65 64 2e 0d being tested..
289a0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
289b0 20 20 20 20 63 68 65 63 6b 46 6f 72 52 75 6e 74 checkForRunt
289c0 69 6d 65 4f 70 74 69 6f 6e 20 24 3a 3a 74 65 73 imeOption $::tes
289d0 74 5f 63 68 61 6e 6e 65 6c 20 6e 6f 50 6f 6f 6c t_channel noPool
289e0 43 6f 75 6e 74 73 0d 0a 0d 0a 20 20 20 20 20 20 Counts....
289f0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
28a00 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 OTE: Check if th
28a10 65 20 74 65 73 74 20 73 75 69 74 65 20 73 68 6f e test suite sho
28a20 75 6c 64 20 75 73 65 20 73 68 61 72 65 64 2d 63 uld use shared-c
28a30 61 63 68 65 20 6d 6f 64 65 2e 0d 0a 20 20 20 20 ache mode...
28a40 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 63 #.. c
28a50 68 65 63 6b 46 6f 72 52 75 6e 74 69 6d 65 4f 70 heckForRuntimeOp
28a60 74 69 6f 6e 20 24 3a 3a 74 65 73 74 5f 63 68 61 tion $::test_cha
28a70 6e 6e 65 6c 20 73 68 61 72 65 64 43 61 63 68 65 nnel sharedCache
28a80 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
28a90 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 # NOTE: R
28aa0 65 70 6f 72 74 20 74 68 65 20 72 65 73 6f 75 72 eport the resour
28ab0 63 65 20 75 73 61 67 65 20 70 72 69 6f 72 20 74 ce usage prior t
28ac0 6f 20 72 75 6e 6e 69 6e 67 20 61 6e 79 20 74 65 o running any te
28ad0 73 74 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d sts... #.
28ae0 0a 20 20 20 20 20 20 20 20 72 65 70 6f 72 74 53 . reportS
28af0 51 4c 69 74 65 52 65 73 6f 75 72 63 65 73 20 24 QLiteResources $
28b00 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a ::test_channel..
28b10 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
28b20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 47 72 61 # NOTE: Gra
28b30 62 20 74 68 65 20 6c 69 73 74 20 6f 66 20 6e 61 b the list of na
28b40 74 69 76 65 20 6d 6f 64 75 6c 65 73 20 66 6f 72 tive modules for
28b50 20 74 68 65 20 63 75 72 72 65 6e 74 20 70 72 6f the current pro
28b60 63 65 73 73 20 61 6e 64 0d 0a 20 20 20 20 20 20 cess and..
28b70 20 20 23 20 20 20 20 20 20 20 72 65 70 6f 72 74 # report
28b80 20 6f 6e 20 74 68 65 20 53 79 73 74 65 6d 2e 44 on the System.D
28b90 61 74 61 2e 53 51 4c 69 74 65 20 72 65 6c 61 74 ata.SQLite relat
28ba0 65 64 20 6f 6e 65 73 2e 0d 0a 20 20 20 20 20 20 ed ones...
28bb0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 #.. if
28bc0 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 {[haveSQLiteObje
28bd0 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e ctCommand]} then
28be0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 {.. se
28bf0 74 20 6d 6f 64 75 6c 65 73 20 5b 6f 62 6a 65 63 t modules [objec
28c00 74 20 69 6e 76 6f 6b 65 20 5c 0d 0a 20 20 20 20 t invoke \..
28c10 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
28c20 2e 44 69 61 67 6e 6f 73 74 69 63 73 2e 50 72 6f .Diagnostics.Pro
28c30 63 65 73 73 2e 47 65 74 43 75 72 72 65 6e 74 50 cess.GetCurrentP
28c40 72 6f 63 65 73 73 20 4d 6f 64 75 6c 65 73 5d 0d rocess Modules].
28c50 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a ... obj
28c60 65 63 74 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 ect foreach -ali
28c70 61 73 20 6d 6f 64 75 6c 65 20 24 6d 6f 64 75 6c as module $modul
28c80 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
28c90 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
28ca0 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6d 6f 64 # NOTE: The mod
28cb0 75 6c 65 20 66 69 6c 65 20 6e 61 6d 65 20 68 65 ule file name he
28cc0 72 65 20 6d 75 73 74 20 62 65 20 6e 6f 72 6d 61 re must be norma
28cd0 6c 69 7a 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 lized...
28ce0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
28cf0 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 set fileName
28d00 5b 66 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a 65 20 [file normalize
28d10 5b 24 6d 6f 64 75 6c 65 20 46 69 6c 65 4e 61 6d [$module FileNam
28d20 65 5d 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e]]..
28d30 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c set fileNameOnl
28d40 79 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 y [file tail $fi
28d50 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 leName]....
28d60 20 20 20 20 20 20 20 69 66 20 7b 5b 6c 73 65 61 if {[lsea
28d70 72 63 68 20 2d 65 78 61 63 74 20 2d 6e 6f 63 61 rch -exact -noca
28d80 73 65 20 2d 2d 20 5c 0d 0a 20 20 20 20 20 20 20 se -- \..
28d90 20 20 20 20 20 20 20 20 20 5b 67 65 74 4e 61 74 [getNat
28da0 69 76 65 4c 69 62 72 61 72 79 46 69 6c 65 4e 61 iveLibraryFileNa
28db0 6d 65 73 4f 6e 6c 79 5d 20 24 66 69 6c 65 4e 61 mesOnly] $fileNa
28dc0 6d 65 4f 6e 6c 79 5d 20 21 3d 20 2d 31 7d 20 74 meOnly] != -1} t
28dd0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
28de0 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
28df0 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
28e00 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
28e10 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
28e20 2d 20 66 6f 75 6e 64 20 6c 6f 61 64 65 64 20 53 - found loaded S
28e30 51 4c 69 74 65 20 6e 61 74 69 76 65 20 6c 69 62 QLite native lib
28e40 72 61 72 79 20 6d 6f 64 75 6c 65 3a 20 22 20 5c rary module: " \
28e50 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
28e60 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 20 5c 6e $fileName \n
28e70 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
28e80 20 65 6c 73 65 69 66 20 7b 5b 6c 73 65 61 72 63 elseif {[lsearc
28e90 68 20 2d 65 78 61 63 74 20 2d 6e 6f 63 61 73 65 h -exact -nocase
28ea0 20 2d 2d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 -- \..
28eb0 20 20 20 20 20 20 20 5b 67 65 74 49 6e 74 65 72 [getInter
28ec0 6f 70 41 73 73 65 6d 62 6c 79 46 69 6c 65 4e 61 opAssemblyFileNa
28ed0 6d 65 73 4f 6e 6c 79 5d 20 24 66 69 6c 65 4e 61 mesOnly] $fileNa
28ee0 6d 65 4f 6e 6c 79 5d 20 21 3d 20 2d 31 7d 20 74 meOnly] != -1} t
28ef0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
28f00 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
28f10 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
28f20 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
28f30 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
28f40 2d 20 66 6f 75 6e 64 20 6c 6f 61 64 65 64 20 53 - found loaded S
28f50 51 4c 69 74 65 20 69 6e 74 65 72 6f 70 20 61 73 QLite interop as
28f60 73 65 6d 62 6c 79 20 6d 6f 64 75 6c 65 3a 20 22 sembly module: "
28f70 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
28f80 20 20 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 20 $fileName
28f90 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 \n]..
28fa0 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d }.. }.
28fb0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
28fc0 20 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 catch {..
28fd0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
28fe0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c ::test_channel \
28ff0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
29000 22 2d 2d 2d 2d 20 63 6f 6d 70 69 6c 65 2d 74 69 "---- compile-ti
29010 6d 65 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 53 me options for S
29020 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 QLite core libra
29030 72 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 ry... "....
29040 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
29050 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6f {.. o
29060 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c bject invoke -fl
29070 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c ags +NonPublic \
29080 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
29090 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
290a0 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 53 51 4c Lite.SQLite3 SQL
290b0 69 74 65 43 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e iteCompileOption
290c0 73 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 63 s.. } c
290d0 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 5d 20 3d ompileOptions] =
290e0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
290f0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
29100 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
29110 61 70 70 65 6e 64 41 72 67 73 20 5b 66 6f 72 6d appendArgs [form
29120 61 74 4c 69 73 74 20 5b 6c 73 6f 72 74 20 5c 0d atList [lsort \.
29130 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
29140 20 24 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 $compileOptions
29150 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d 0d 0a 20 ] <none>] \n]..
29160 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 } else
29170 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
29180 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
29190 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d 0a nnel unknown\n..
291a0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
291b0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
291c0 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 catch {..
291d0 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
291e0 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 st_channel \..
291f0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
29200 2d 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 6f - compile-time o
29210 70 74 69 6f 6e 73 20 66 6f 72 20 53 51 4c 69 74 ptions for SQLit
29220 65 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 e interop assemb
29230 6c 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 ly... "....
29240 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
29250 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6f {.. o
29260 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c bject invoke -fl
29270 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c ags +NonPublic \
29280 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
29290 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
292a0 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 49 6e 74 Lite.SQLite3 Int
292b0 65 72 6f 70 43 6f 6d 70 69 6c 65 4f 70 74 69 6f eropCompileOptio
292c0 6e 73 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 ns.. }
292d0 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 5d 20 compileOptions]
292e0 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
292f0 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
29300 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
29310 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 66 6f 72 [appendArgs [for
29320 6d 61 74 4c 69 73 74 20 5b 6c 73 6f 72 74 20 5c matList [lsort \
29330 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
29340 20 20 24 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e $compileOption
29350 73 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d 0d 0a s] <none>] \n]..
29360 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 } else
29370 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
29380 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
29390 61 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d annel unknown\n.
293a0 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
293b0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
293c0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
293d0 4e 4f 54 45 3a 20 53 68 6f 77 20 74 68 65 20 61 NOTE: Show the a
293e0 63 74 69 76 65 20 74 65 73 74 20 63 6f 6e 73 74 ctive test const
293f0 72 61 69 6e 74 73 2e 0d 0a 20 20 20 20 20 20 20 raints...
29400 20 23 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 #.. tput
29410 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
29420 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 2d l [appendArgs "-
29430 2d 2d 2d 20 63 6f 6e 73 74 72 61 69 6e 74 73 3a --- constraints:
29440 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 " \..
29450 20 20 5b 66 6f 72 6d 61 74 4c 69 73 74 20 5b 6c [formatList [l
29460 73 6f 72 74 20 5b 67 65 74 43 6f 6e 73 74 72 61 sort [getConstra
29470 69 6e 74 73 5d 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c ints]] <none>] \
29480 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d n].... #.
29490 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
294a0 20 53 61 76 65 20 74 68 65 20 74 65 73 74 20 63 Save the test c
294b0 6f 6e 73 74 72 61 69 6e 74 73 20 66 6f 72 20 75 onstraints for u
294c0 73 65 20 62 79 20 74 68 72 65 61 64 73 20 63 72 se by threads cr
294d0 65 61 74 65 64 20 69 6e 20 74 68 69 73 0d 0a 20 eated in this..
294e0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 # a
294f0 70 70 6c 69 63 61 74 69 6f 6e 20 64 6f 6d 61 69 pplication domai
29500 6e 2e 20 20 54 68 69 73 20 69 73 20 6e 65 63 65 n. This is nece
29510 73 73 61 72 79 20 62 65 63 61 75 73 65 20 61 6c ssary because al
29520 6c 20 74 68 65 20 45 61 67 6c 65 0d 0a 20 20 20 l the Eagle..
29530 20 20 20 20 20 23 20 20 20 20 20 20 20 22 74 65 # "te
29540 73 74 20 63 6f 6e 74 65 78 74 22 20 69 6e 66 6f st context" info
29550 72 6d 61 74 69 6f 6e 20 69 73 20 70 65 72 2d 74 rmation is per-t
29560 68 72 65 61 64 2e 0d 0a 20 20 20 20 20 20 20 20 hread...
29570 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
29580 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
29590 65 73 74 5f 63 6f 6e 73 74 72 61 69 6e 74 73 5d est_constraints]
295a0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
295b0 20 20 20 20 73 65 74 20 3a 3a 74 65 73 74 5f 63 set ::test_c
295c0 6f 6e 73 74 72 61 69 6e 74 73 20 24 3a 3a 65 61 onstraints $::ea
295d0 67 6c 65 5f 74 65 73 74 73 28 63 6f 6e 73 74 72 gle_tests(constr
295e0 61 69 6e 74 73 29 0d 0a 20 20 20 20 20 20 20 20 aints)..
295f0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a }.... #..
29600 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
29610 4c 6f 61 64 20 74 68 65 20 22 61 66 74 65 72 2d Load the "after-
29620 63 6f 6e 73 74 72 61 69 6e 74 73 22 20 63 75 73 constraints" cus
29630 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 61 6e 64 tom per-user and
29640 2f 6f 72 20 70 65 72 2d 68 6f 73 74 0d 0a 20 20 /or per-host..
29650 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 65 # te
29660 73 74 20 73 65 74 74 69 6e 67 73 20 6e 6f 77 2e st settings now.
29670 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
29680 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 5b uplevel 1 [
29690 6c 69 73 74 20 6c 6f 61 64 53 51 4c 69 74 65 54 list loadSQLiteT
296a0 65 73 74 53 65 74 74 69 6e 67 73 20 24 3a 3a 74 estSettings $::t
296b0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 2e 61 66 74 est_channel .aft
296c0 65 72 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 er].... #
296d0 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
296e0 3a 20 49 66 20 6e 65 63 65 73 73 61 72 79 2c 20 : If necessary,
296f0 65 6e 61 62 6c 65 20 73 68 61 72 65 64 2d 63 61 enable shared-ca
29700 63 68 65 20 6d 6f 64 65 20 6e 6f 77 2e 0d 0a 20 che mode now...
29710 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
29720 20 20 69 66 20 7b 5b 68 61 73 52 75 6e 74 69 6d if {[hasRuntim
29730 65 4f 70 74 69 6f 6e 20 73 68 61 72 65 64 43 61 eOption sharedCa
29740 63 68 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 che]} then {..
29750 20 20 20 20 20 20 20 20 65 6e 61 62 6c 65 53 68 enableSh
29760 61 72 65 64 43 61 63 68 65 20 24 3a 3a 74 65 73 aredCache $::tes
29770 74 5f 63 68 61 6e 6e 65 6c 20 74 72 75 65 0d 0a t_channel true..
29780 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
29790 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
297a0 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 77 68 65 # NOTE: Show whe
297b0 6e 20 6f 75 72 20 74 65 73 74 73 20 61 63 74 75 n our tests actu
297c0 61 6c 6c 79 20 62 65 67 61 6e 20 28 6e 6f 77 29 ally began (now)
297d0 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
297e0 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
297f0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
29800 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
29810 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 53 79 73 "---- Sys
29820 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
29830 74 65 73 74 73 20 62 65 67 61 6e 20 61 74 20 22 tests began at "
29840 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
29850 5b 63 6c 6f 63 6b 20 66 6f 72 6d 61 74 20 5b 63 [clock format [c
29860 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d 5d 20 5c lock seconds]] \
29870 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 n].. }..
29880 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
29890 72 75 6e 53 51 4c 69 74 65 54 65 73 74 46 69 6c runSQLiteTestFil
298a0 65 73 50 72 6f 6c 6f 67 75 65 20 7b 7d 20 7b 0d esPrologue {} {.
298b0 0a 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 . uplevel 1
298c0 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
298d0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 # NOTE: S
298e0 65 74 75 70 20 74 68 65 20 76 61 72 69 61 62 6c etup the variabl
298f0 65 73 20 74 68 61 74 20 72 65 66 65 72 20 74 6f es that refer to
29900 20 74 68 65 20 76 61 72 69 6f 75 73 20 6e 6f 6e the various non
29910 2d 64 61 74 61 20 66 69 6c 65 73 0d 0a 20 20 20 -data files..
29920 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 71 # req
29930 75 69 72 65 64 20 62 79 20 74 68 65 20 74 65 73 uired by the tes
29940 74 73 20 69 6e 20 74 68 69 73 20 66 69 6c 65 2e ts in this file.
29950 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
29960 20 20 20 20 20 73 65 74 20 65 6e 74 69 74 79 46 set entityF
29970 72 61 6d 65 77 6f 72 6b 44 6c 6c 46 69 6c 65 20 rameworkDllFile
29980 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
29990 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 getBuildFileName
299a0 20 45 6e 74 69 74 79 46 72 61 6d 65 77 6f 72 6b EntityFramework
299b0 2e 64 6c 6c 20 66 61 6c 73 65 5d 0d 0a 0d 0a 20 .dll false]....
299c0 20 20 20 20 20 20 20 73 65 74 20 69 6e 73 74 61 set insta
299d0 6c 6c 65 72 45 78 65 46 69 6c 65 20 5c 0d 0a 20 llerExeFile \..
299e0 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 [getB
299f0 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 49 6e 73 uildFileName Ins
29a00 74 61 6c 6c 65 72 2e 65 78 65 20 66 61 6c 73 65 taller.exe false
29a10 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 ].... set
29a20 20 73 71 6c 69 74 65 44 65 73 69 67 6e 65 72 44 sqliteDesignerD
29a30 6c 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 llFile \..
29a40 20 20 20 20 20 20 5b 67 65 74 42 75 69 6c 64 46 [getBuildF
29a50 69 6c 65 4e 61 6d 65 20 53 51 4c 69 74 65 2e 44 ileName SQLite.D
29a60 65 73 69 67 6e 65 72 2e 64 6c 6c 20 66 61 6c 73 esigner.dll fals
29a70 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 e].... se
29a80 74 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 t systemDataSQLi
29a90 74 65 44 6c 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 teDllFile \..
29aa0 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 75 69 [getBui
29ab0 6c 64 46 69 6c 65 4e 61 6d 65 20 53 79 73 74 65 ldFileName Syste
29ac0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c m.Data.SQLite.dl
29ad0 6c 20 66 61 6c 73 65 5d 0d 0a 0d 0a 20 20 20 20 l false]....
29ae0 20 20 20 20 73 65 74 20 73 79 73 74 65 6d 44 61 set systemDa
29af0 74 61 53 51 4c 69 74 65 4c 69 6e 71 44 6c 6c 46 taSQLiteLinqDllF
29b00 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ile \..
29b10 20 20 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 [getBuildFile
29b20 4e 61 6d 65 20 53 79 73 74 65 6d 2e 44 61 74 61 Name System.Data
29b30 2e 53 51 4c 69 74 65 2e 4c 69 6e 71 2e 64 6c 6c .SQLite.Linq.dll
29b40 20 66 61 6c 73 65 5d 0d 0a 0d 0a 20 20 20 20 20 false]....
29b50 20 20 20 73 65 74 20 73 79 73 74 65 6d 44 61 74 set systemDat
29b60 61 53 51 4c 69 74 65 45 66 36 44 6c 6c 46 69 6c aSQLiteEf6DllFil
29b70 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
29b80 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 [getBuildFileNa
29b90 6d 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 me System.Data.S
29ba0 51 4c 69 74 65 2e 45 46 36 2e 64 6c 6c 20 66 61 QLite.EF6.dll fa
29bb0 6c 73 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 lse]....
29bc0 73 65 74 20 74 65 73 74 45 78 65 46 69 6c 65 20 set testExeFile
29bd0 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d [getBuildFileNam
29be0 65 20 74 65 73 74 2e 65 78 65 20 66 61 6c 73 65 e test.exe false
29bf0 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 ].. set t
29c00 65 73 74 4c 69 6e 71 45 78 65 46 69 6c 65 20 5b estLinqExeFile [
29c10 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 getBuildFileName
29c20 20 74 65 73 74 6c 69 6e 71 2e 65 78 65 20 66 61 testlinq.exe fa
29c30 6c 73 65 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 lse].. se
29c40 74 20 74 65 73 74 45 66 36 45 78 65 46 69 6c 65 t testEf6ExeFile
29c50 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 [getBuildFileNa
29c60 6d 65 20 74 65 73 74 65 66 36 2e 65 78 65 20 66 me testef6.exe f
29c70 61 6c 73 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 alse]....
29c80 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
29c90 54 45 3a 20 53 65 74 75 70 20 74 68 65 20 76 61 TE: Setup the va
29ca0 72 69 61 62 6c 65 73 20 74 68 61 74 20 72 65 66 riables that ref
29cb0 65 72 20 74 6f 20 74 68 65 20 76 61 72 69 6f 75 er to the variou
29cc0 73 20 64 61 74 61 20 66 69 6c 65 73 0d 0a 20 20 s data files..
29cd0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 # re
29ce0 71 75 69 72 65 64 20 62 79 20 74 68 65 20 74 65 quired by the te
29cf0 73 74 73 20 69 6e 20 74 68 69 73 20 66 69 6c 65 sts in this file
29d00 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
29d10 20 20 20 20 20 20 73 65 74 20 74 65 73 74 4c 69 set testLi
29d20 6e 71 4f 75 74 46 69 6c 65 20 5b 66 69 6c 65 20 nqOutFile [file
29d30 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 nativename [file
29d40 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 join \..
29d50 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 [getSQLiteT
29d60 65 73 74 44 61 74 61 50 61 74 68 5d 20 74 65 73 estDataPath] tes
29d70 74 6c 69 6e 71 2e 6f 75 74 5d 5d 0d 0a 0d 0a 20 tlinq.out]]....
29d80 20 20 20 20 20 20 20 73 65 74 20 6e 6f 72 74 68 set north
29d90 77 69 6e 64 45 66 44 62 46 69 6c 65 20 5b 66 69 windEfDbFile [fi
29da0 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 le nativename [f
29db0 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 ile join \..
29dc0 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 64 69 [file di
29dd0 72 6e 61 6d 65 20 5b 66 69 6c 65 20 64 69 72 6e rname [file dirn
29de0 61 6d 65 20 5b 67 65 74 53 51 4c 69 74 65 54 65 ame [getSQLiteTe
29df0 73 74 44 61 74 61 50 61 74 68 5d 5d 5d 20 5c 0d stDataPath]]] \.
29e00 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 65 73 . tes
29e10 74 6c 69 6e 71 20 6e 6f 72 74 68 77 69 6e 64 45 tlinq northwindE
29e20 46 2e 64 62 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 F.db]]....
29e30 20 20 73 65 74 20 6e 6f 6e 57 61 6c 44 62 46 69 set nonWalDbFi
29e40 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e le [file nativen
29e50 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c ame [file join \
29e60 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 .. [g
29e70 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 etSQLiteTestData
29e80 50 61 74 68 5d 20 6e 6f 6e 57 61 6c 2e 64 62 5d Path] nonWal.db]
29e90 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 ].... set
29ea0 20 77 61 6c 44 62 46 69 6c 65 20 5b 66 69 6c 65 walDbFile [file
29eb0 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c nativename [fil
29ec0 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 e join \..
29ed0 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 [getSQLite
29ee0 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 77 61 TestDataPath] wa
29ef0 6c 2e 64 62 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 l.db]]....
29f00 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
29f10 4f 54 45 3a 20 54 68 65 20 76 61 72 69 6f 75 73 OTE: The various
29f20 20 69 6e 73 74 61 6c 6c 2f 75 6e 69 6e 73 74 61 install/uninsta
29f30 6c 6c 20 6c 6f 67 20 66 69 6c 65 73 20 75 73 65 ll log files use
29f40 64 20 74 6f 20 74 65 73 74 20 74 68 65 0d 0a 20 d to test the..
29f50 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 # d
29f60 65 73 69 67 6e 2d 74 69 6d 65 20 63 6f 6d 70 6f esign-time compo
29f70 6e 65 6e 74 20 69 6e 73 74 61 6c 6c 65 72 2e 0d nent installer..
29f80 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
29f90 20 20 20 20 73 65 74 20 74 65 73 74 49 6e 73 74 set testInst
29fa0 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 69 6c 65 allVs2005LogFile
29fb0 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d [file nativenam
29fc0 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a e [file join \..
29fd0 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
29fe0 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 SQLiteTestDataPa
29ff0 74 68 5d 20 49 6e 73 74 61 6c 6c 65 72 5f 54 65 th] Installer_Te
2a000 73 74 5f 56 73 32 30 30 35 2e 6c 6f 67 5d 5d 0d st_Vs2005.log]].
2a010 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 ... set t
2a020 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 30 38 estInstallVs2008
2a030 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 LogFile [file na
2a040 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a tivename [file j
2a050 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 oin \..
2a060 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 [getSQLiteTes
2a070 74 44 61 74 61 50 61 74 68 5d 20 49 6e 73 74 61 tDataPath] Insta
2a080 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 30 38 ller_Test_Vs2008
2a090 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 .log]]....
2a0a0 20 20 73 65 74 20 74 65 73 74 49 6e 73 74 61 6c set testInstal
2a0b0 6c 56 73 32 30 31 30 4c 6f 67 46 69 6c 65 20 5b lVs2010LogFile [
2a0c0 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 file nativename
2a0d0 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 [file join \..
2a0e0 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 [getSQ
2a0f0 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 74 68 LiteTestDataPath
2a100 5d 20 49 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 ] Installer_Test
2a110 5f 56 73 32 30 31 30 2e 6c 6f 67 5d 5d 0d 0a 0d _Vs2010.log]]...
2a120 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 65 73 . set tes
2a130 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f tInstallVs2012Lo
2a140 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 gFile [file nati
2a150 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 vename [file joi
2a160 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n \..
2a170 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 [getSQLiteTestD
2a180 61 74 61 50 61 74 68 5d 20 49 6e 73 74 61 6c 6c ataPath] Install
2a190 65 72 5f 54 65 73 74 5f 56 73 32 30 31 32 2e 6c er_Test_Vs2012.l
2a1a0 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 og]]....
2a1b0 73 65 74 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 set testInstallV
2a1c0 73 32 30 31 33 4c 6f 67 46 69 6c 65 20 5b 66 69 s2013LogFile [fi
2a1d0 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 le nativename [f
2a1e0 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 ile join \..
2a1f0 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 [getSQLi
2a200 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 teTestDataPath]
2a210 49 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 Installer_Test_V
2a220 73 32 30 31 33 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 s2013.log]]....
2a230 20 20 20 20 20 20 20 73 65 74 20 74 65 73 74 49 set testI
2a240 6e 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 nstallVs2015LogF
2a250 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 ile [file native
2a260 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 name [file join
2a270 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
2a280 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 getSQLiteTestDat
2a290 61 50 61 74 68 5d 20 49 6e 73 74 61 6c 6c 65 72 aPath] Installer
2a2a0 5f 54 65 73 74 5f 56 73 32 30 31 35 2e 6c 6f 67 _Test_Vs2015.log
2a2b0 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 ]].... se
2a2c0 74 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 t testUninstallV
2a2d0 73 32 30 30 35 4c 6f 67 46 69 6c 65 20 5b 66 69 s2005LogFile [fi
2a2e0 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 le nativename [f
2a2f0 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 ile join \..
2a300 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 [getSQLi
2a310 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 teTestDataPath]
2a320 55 6e 69 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 Uninstaller_Test
2a330 5f 56 73 32 30 30 35 2e 6c 6f 67 5d 5d 0d 0a 0d _Vs2005.log]]...
2a340 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 65 73 . set tes
2a350 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 38 tUninstallVs2008
2a360 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 LogFile [file na
2a370 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a tivename [file j
2a380 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 oin \..
2a390 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 [getSQLiteTes
2a3a0 74 44 61 74 61 50 61 74 68 5d 20 55 6e 69 6e 73 tDataPath] Unins
2a3b0 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 taller_Test_Vs20
2a3c0 30 38 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 08.log]]....
2a3d0 20 20 20 20 73 65 74 20 74 65 73 74 55 6e 69 6e set testUnin
2a3e0 73 74 61 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 stallVs2010LogFi
2a3f0 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e le [file nativen
2a400 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c ame [file join \
2a410 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 .. [g
2a420 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 etSQLiteTestData
2a430 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 Path] Uninstalle
2a440 72 5f 54 65 73 74 5f 56 73 32 30 31 30 2e 6c 6f r_Test_Vs2010.lo
2a450 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 g]].... s
2a460 65 74 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c et testUninstall
2a470 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 20 5b 66 Vs2012LogFile [f
2a480 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b ile nativename [
2a490 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 file join \..
2a4a0 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c [getSQL
2a4b0 69 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d iteTestDataPath]
2a4c0 20 55 6e 69 6e 73 74 61 6c 6c 65 72 5f 54 65 73 Uninstaller_Tes
2a4d0 74 5f 56 73 32 30 31 32 2e 6c 6f 67 5d 5d 0d 0a t_Vs2012.log]]..
2a4e0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 65 .. set te
2a4f0 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
2a500 33 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 3LogFile [file n
2a510 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 ativename [file
2a520 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 join \..
2a530 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 [getSQLiteTe
2a540 73 74 44 61 74 61 50 61 74 68 5d 20 55 6e 69 6e stDataPath] Unin
2a550 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 staller_Test_Vs2
2a560 30 31 33 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 013.log]]....
2a570 20 20 20 20 20 73 65 74 20 74 65 73 74 55 6e 69 set testUni
2a580 6e 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 nstallVs2015LogF
2a590 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 ile [file native
2a5a0 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 name [file join
2a5b0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
2a5c0 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 getSQLiteTestDat
2a5d0 61 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c aPath] Uninstall
2a5e0 65 72 5f 54 65 73 74 5f 56 73 32 30 31 35 2e 6c er_Test_Vs2015.l
2a5f0 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 og]]....
2a600 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a610 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a620 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a630 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2a640 23 23 23 23 23 23 23 0d 0a 0d 0a 20 20 20 20 20 #######....
2a650 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e if {![haveCon
2a660 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
2a670 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 rgs file_ \..
2a680 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 [file t
2a690 61 69 6c 20 24 65 6e 74 69 74 79 46 72 61 6d 65 ail $entityFrame
2a6a0 77 6f 72 6b 44 6c 6c 46 69 6c 65 5d 5d 5d 7d 20 workDllFile]]]}
2a6b0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2a6c0 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
2a6d0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 65 6e test_channel $en
2a6e0 74 69 74 79 46 72 61 6d 65 77 6f 72 6b 44 6c 6c tityFrameworkDll
2a6f0 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d File.. }.
2a700 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 ... if {!
2a710 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 [haveConstraint
2a720 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 [appendArgs file
2a730 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 _ \..
2a740 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 69 6e 73 [file tail $ins
2a750 74 61 6c 6c 65 72 45 78 65 46 69 6c 65 5d 5d 5d tallerExeFile]]]
2a760 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
2a770 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 checkForFile
2a780 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 $test_channel $
2a790 69 6e 73 74 61 6c 6c 65 72 45 78 65 46 69 6c 65 installerExeFile
2a7a0 20 49 6e 73 74 61 6c 6c 65 72 2e 65 78 65 0d 0a Installer.exe..
2a7b0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
2a7c0 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 if {![haveC
2a7d0 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e onstraint [appen
2a7e0 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 dArgs file_ \..
2a7f0 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 [file
2a800 20 74 61 69 6c 20 24 73 71 6c 69 74 65 44 65 73 tail $sqliteDes
2a810 69 67 6e 65 72 44 6c 6c 46 69 6c 65 5d 5d 5d 7d ignerDllFile]]]}
2a820 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
2a830 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 checkForFile
2a840 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 73 $test_channel $s
2a850 71 6c 69 74 65 44 65 73 69 67 6e 65 72 44 6c 6c qliteDesignerDll
2a860 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d File.. }.
2a870 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 ... if {!
2a880 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 [haveConstraint
2a890 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 [appendArgs file
2a8a0 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 _ \..
2a8b0 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 73 79 73 [file tail $sys
2a8c0 74 65 6d 44 61 74 61 53 51 4c 69 74 65 44 6c 6c temDataSQLiteDll
2a8d0 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d File]]]} then {.
2a8e0 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b . check
2a8f0 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 ForFile $test_ch
2a900 61 6e 6e 65 6c 20 24 73 79 73 74 65 6d 44 61 74 annel $systemDat
2a910 61 53 51 4c 69 74 65 44 6c 6c 46 69 6c 65 0d 0a aSQLiteDllFile..
2a920 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
2a930 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 if {![haveC
2a940 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e onstraint [appen
2a950 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 dArgs file_ \..
2a960 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 [file
2a970 20 74 61 69 6c 20 24 73 79 73 74 65 6d 44 61 74 tail $systemDat
2a980 61 53 51 4c 69 74 65 4c 69 6e 71 44 6c 6c 46 69 aSQLiteLinqDllFi
2a990 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 le]]]} then {..
2a9a0 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f checkFo
2a9b0 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e rFile $test_chan
2a9c0 6e 65 6c 20 24 73 79 73 74 65 6d 44 61 74 61 53 nel $systemDataS
2a9d0 51 4c 69 74 65 4c 69 6e 71 44 6c 6c 46 69 6c 65 QLiteLinqDllFile
2a9e0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
2a9f0 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
2aa00 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
2aa10 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
2aa20 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
2aa30 6c 65 20 74 61 69 6c 20 24 73 79 73 74 65 6d 44 le tail $systemD
2aa40 61 74 61 53 51 4c 69 74 65 45 66 36 44 6c 6c 46 ataSQLiteEf6DllF
2aa50 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
2aa60 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
2aa70 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
2aa80 6e 6e 65 6c 20 24 73 79 73 74 65 6d 44 61 74 61 nnel $systemData
2aa90 53 51 4c 69 74 65 45 66 36 44 6c 6c 46 69 6c 65 SQLiteEf6DllFile
2aaa0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
2aab0 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
2aac0 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
2aad0 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
2aae0 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
2aaf0 6c 65 20 74 61 69 6c 20 24 74 65 73 74 45 78 65 le tail $testExe
2ab00 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d File]]]} then {.
2ab10 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b . check
2ab20 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 ForFile $test_ch
2ab30 61 6e 6e 65 6c 20 24 74 65 73 74 45 78 65 46 69 annel $testExeFi
2ab40 6c 65 20 74 65 73 74 2e 65 78 65 0d 0a 20 20 20 le test.exe..
2ab50 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
2ab60 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
2ab70 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
2ab80 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
2ab90 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 [file ta
2aba0 69 6c 20 24 74 65 73 74 4c 69 6e 71 45 78 65 46 il $testLinqExeF
2abb0 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
2abc0 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
2abd0 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
2abe0 6e 6e 65 6c 20 24 74 65 73 74 4c 69 6e 71 45 78 nnel $testLinqEx
2abf0 65 46 69 6c 65 20 74 65 73 74 6c 69 6e 71 2e 65 eFile testlinq.e
2ac00 78 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d xe.. }...
2ac10 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 . if {![h
2ac20 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 aveConstraint [a
2ac30 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 ppendArgs file_
2ac40 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
2ac50 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 45 file tail $testE
2ac60 66 36 45 78 65 46 69 6c 65 5d 5d 5d 7d 20 74 68 f6ExeFile]]]} th
2ac70 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
2ac80 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 checkForFile $te
2ac90 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 st_channel $test
2aca0 45 66 36 45 78 65 46 69 6c 65 20 74 65 73 74 65 Ef6ExeFile teste
2acb0 66 36 2e 65 78 65 0d 0a 20 20 20 20 20 20 20 20 f6.exe..
2acc0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 }.... if
2acd0 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e {![haveConstrain
2ace0 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 t [appendArgs fi
2acf0 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 le_ \..
2ad00 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 [file tail $t
2ad10 65 73 74 4c 69 6e 71 4f 75 74 46 69 6c 65 5d 5d estLinqOutFile]]
2ad20 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
2ad30 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
2ad40 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
2ad50 24 74 65 73 74 4c 69 6e 71 4f 75 74 46 69 6c 65 $testLinqOutFile
2ad60 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
2ad70 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
2ad80 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
2ad90 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
2ada0 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
2adb0 6c 65 20 74 61 69 6c 20 24 6e 6f 72 74 68 77 69 le tail $northwi
2adc0 6e 64 45 66 44 62 46 69 6c 65 5d 5d 5d 7d 20 74 ndEfDbFile]]]} t
2add0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
2ade0 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
2adf0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 6e 6f 72 est_channel $nor
2ae00 74 68 77 69 6e 64 45 66 44 62 46 69 6c 65 0d 0a thwindEfDbFile..
2ae10 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
2ae20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 if {![haveC
2ae30 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e onstraint [appen
2ae40 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 dArgs file_ \..
2ae50 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 [file
2ae60 20 74 61 69 6c 20 24 6e 6f 6e 57 61 6c 44 62 46 tail $nonWalDbF
2ae70 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
2ae80 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
2ae90 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
2aea0 6e 6e 65 6c 20 24 6e 6f 6e 57 61 6c 44 62 46 69 nnel $nonWalDbFi
2aeb0 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d le.. }...
2aec0 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 . if {![h
2aed0 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 aveConstraint [a
2aee0 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 ppendArgs file_
2aef0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
2af00 66 69 6c 65 20 74 61 69 6c 20 24 77 61 6c 44 62 file tail $walDb
2af10 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d File]]]} then {.
2af20 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b . check
2af30 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 ForFile $test_ch
2af40 61 6e 6e 65 6c 20 24 77 61 6c 44 62 46 69 6c 65 annel $walDbFile
2af50 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
2af60 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
2af70 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
2af80 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
2af90 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
2afa0 6c 65 20 74 61 69 6c 20 24 74 65 73 74 49 6e 73 le tail $testIns
2afb0 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 69 6c tallVs2005LogFil
2afc0 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 e]]]} then {..
2afd0 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
2afe0 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e File $test_chann
2aff0 65 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 el $testInstallV
2b000 73 32 30 30 35 4c 6f 67 46 69 6c 65 0d 0a 20 20 s2005LogFile..
2b010 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
2b020 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e if {![haveCon
2b030 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
2b040 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 rgs file_ \..
2b050 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 [file t
2b060 61 69 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c ail $testInstall
2b070 56 73 32 30 30 38 4c 6f 67 46 69 6c 65 5d 5d 5d Vs2008LogFile]]]
2b080 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
2b090 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 checkForFile
2b0a0 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 $test_channel $
2b0b0 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 30 testInstallVs200
2b0c0 38 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 8LogFile..
2b0d0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
2b0e0 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
2b0f0 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
2b100 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
2b110 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
2b120 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 $testInstallVs20
2b130 31 30 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 10LogFile]]]} th
2b140 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
2b150 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 checkForFile $te
2b160 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 st_channel $test
2b170 49 6e 73 74 61 6c 6c 56 73 32 30 31 30 4c 6f 67 InstallVs2010Log
2b180 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d File.. }.
2b190 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 ... if {!
2b1a0 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 [haveConstraint
2b1b0 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 [appendArgs file
2b1c0 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 _ \..
2b1d0 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 [file tail $tes
2b1e0 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f tInstallVs2012Lo
2b1f0 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b gFile]]]} then {
2b200 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
2b210 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
2b220 68 61 6e 6e 65 6c 20 24 74 65 73 74 49 6e 73 74 hannel $testInst
2b230 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 allVs2012LogFile
2b240 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
2b250 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
2b260 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
2b270 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
2b280 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
2b290 6c 65 20 74 61 69 6c 20 24 74 65 73 74 49 6e 73 le tail $testIns
2b2a0 74 61 6c 6c 56 73 32 30 31 33 4c 6f 67 46 69 6c tallVs2013LogFil
2b2b0 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 e]]]} then {..
2b2c0 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
2b2d0 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e File $test_chann
2b2e0 65 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 el $testInstallV
2b2f0 73 32 30 31 33 4c 6f 67 46 69 6c 65 0d 0a 20 20 s2013LogFile..
2b300 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
2b310 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e if {![haveCon
2b320 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
2b330 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 rgs file_ \..
2b340 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 [file t
2b350 61 69 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c ail $testInstall
2b360 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 5d 5d 5d Vs2015LogFile]]]
2b370 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
2b380 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 checkForFile
2b390 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 $test_channel $
2b3a0 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 testInstallVs201
2b3b0 35 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 5LogFile..
2b3c0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
2b3d0 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
2b3e0 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
2b3f0 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
2b400 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
2b410 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
2b420 32 30 30 35 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 2005LogFile]]]}
2b430 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2b440 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
2b450 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 test_channel $te
2b460 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 stUninstallVs200
2b470 35 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 5LogFile..
2b480 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
2b490 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
2b4a0 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
2b4b0 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
2b4c0 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
2b4d0 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
2b4e0 32 30 30 38 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 2008LogFile]]]}
2b4f0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2b500 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
2b510 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 test_channel $te
2b520 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 stUninstallVs200
2b530 38 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 8LogFile..
2b540 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
2b550 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
2b560 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
2b570 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
2b580 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
2b590 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
2b5a0 32 30 31 30 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 2010LogFile]]]}
2b5b0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2b5c0 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
2b5d0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 test_channel $te
2b5e0 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
2b5f0 30 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 0LogFile..
2b600 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
2b610 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
2b620 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
2b630 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
2b640 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
2b650 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
2b660 32 30 31 32 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 2012LogFile]]]}
2b670 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2b680 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
2b690 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 test_channel $te
2b6a0 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
2b6b0 32 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 2LogFile..
2b6c0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
2b6d0 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
2b6e0 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
2b6f0 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
2b700 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
2b710 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
2b720 32 30 31 33 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 2013LogFile]]]}
2b730 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2b740 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
2b750 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 test_channel $te
2b760 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
2b770 33 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 3LogFile..
2b780 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
2b790 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
2b7a0 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
2b7b0 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
2b7c0 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
2b7d0 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
2b7e0 32 30 31 35 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 2015LogFile]]]}
2b7f0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2b800 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
2b810 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 test_channel $te
2b820 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
2b830 35 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 5LogFile..
2b840 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
2b850 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
2b860 20 72 75 6e 53 51 4c 69 74 65 54 65 73 74 46 69 runSQLiteTestFi
2b870 6c 65 73 45 70 69 6c 6f 67 75 65 20 7b 7d 20 7b lesEpilogue {} {
2b880 0d 0a 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 .. uplevel
2b890 31 20 7b 0d 0a 20 20 20 20 20 20 20 20 75 6e 73 1 {.. uns
2b8a0 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 5c et -nocomplain \
2b8b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 65 .. te
2b8c0 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
2b8d0 35 4c 6f 67 46 69 6c 65 20 74 65 73 74 55 6e 69 5LogFile testUni
2b8e0 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f 67 46 nstallVs2013LogF
2b8f0 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ile \..
2b900 20 20 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c testUninstall
2b910 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 20 74 65 Vs2012LogFile te
2b920 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
2b930 30 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 20 20 20 0LogFile \..
2b940 20 20 20 20 20 20 20 20 74 65 73 74 55 6e 69 6e testUnin
2b950 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 stallVs2008LogFi
2b960 6c 65 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c le testUninstall
2b970 56 73 32 30 30 35 4c 6f 67 46 69 6c 65 20 5c 0d Vs2005LogFile \.
2b980 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 65 73 . tes
2b990 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f tInstallVs2015Lo
2b9a0 67 46 69 6c 65 20 74 65 73 74 49 6e 73 74 61 6c gFile testInstal
2b9b0 6c 56 73 32 30 31 33 4c 6f 67 46 69 6c 65 20 5c lVs2013LogFile \
2b9c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 65 .. te
2b9d0 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 32 4c stInstallVs2012L
2b9e0 6f 67 46 69 6c 65 20 74 65 73 74 49 6e 73 74 61 ogFile testInsta
2b9f0 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 6c 65 20 llVs2010LogFile
2ba00 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 \.. t
2ba10 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 30 38 estInstallVs2008
2ba20 4c 6f 67 46 69 6c 65 20 74 65 73 74 49 6e 73 74 LogFile testInst
2ba30 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 69 6c 65 allVs2005LogFile
2ba40 0d 0a 0d 0a 20 20 20 20 20 20 20 20 75 6e 73 65 .... unse
2ba50 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 5c 0d t -nocomplain \.
2ba60 0a 20 20 20 20 20 20 20 20 20 20 20 20 6e 6f 72 . nor
2ba70 74 68 77 69 6e 64 45 66 44 62 46 69 6c 65 20 74 thwindEfDbFile t
2ba80 65 73 74 4c 69 6e 71 4f 75 74 46 69 6c 65 20 5c estLinqOutFile \
2ba90 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 77 61 .. wa
2baa0 6c 44 62 46 69 6c 65 20 6e 6f 6e 57 61 6c 44 62 lDbFile nonWalDb
2bab0 46 69 6c 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 File....
2bac0 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 unset -nocomplai
2bad0 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n \..
2bae0 20 74 65 73 74 45 66 36 45 78 65 46 69 6c 65 20 testEf6ExeFile
2baf0 74 65 73 74 4c 69 6e 71 45 78 65 46 69 6c 65 20 testLinqExeFile
2bb00 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 \.. t
2bb10 65 73 74 45 78 65 46 69 6c 65 20 73 79 73 74 65 estExeFile syste
2bb20 6d 44 61 74 61 53 51 4c 69 74 65 45 66 36 44 6c mDataSQLiteEf6Dl
2bb30 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 lFile \..
2bb40 20 20 20 20 20 73 79 73 74 65 6d 44 61 74 61 53 systemDataS
2bb50 51 4c 69 74 65 4c 69 6e 71 44 6c 6c 46 69 6c 65 QLiteLinqDllFile
2bb60 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 systemDataSQLit
2bb70 65 44 6c 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 20 eDllFile \..
2bb80 20 20 20 20 20 20 20 20 73 71 6c 69 74 65 44 65 sqliteDe
2bb90 73 69 67 6e 65 72 44 6c 6c 46 69 6c 65 20 69 6e signerDllFile in
2bba0 73 74 61 6c 6c 65 72 45 78 65 46 69 6c 65 20 5c stallerExeFile \
2bbb0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 65 6e .. en
2bbc0 74 69 74 79 46 72 61 6d 65 77 6f 72 6b 44 6c 6c tityFrameworkDll
2bbd0 46 69 6c 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 File.. }..
2bbe0 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
2bbf0 63 20 72 75 6e 53 51 4c 69 74 65 54 65 73 74 45 c runSQLiteTestE
2bc00 70 69 6c 6f 67 75 65 20 7b 7d 20 7b 0d 0a 20 20 pilogue {} {..
2bc10 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
2bc20 4f 54 45 3a 20 53 6b 69 70 20 72 75 6e 6e 69 6e OTE: Skip runnin
2bc30 67 20 6f 75 72 20 63 75 73 74 6f 6d 20 65 70 69 g our custom epi
2bc40 6c 6f 67 75 65 20 69 66 20 74 68 65 20 6d 61 69 logue if the mai
2bc50 6e 20 6f 6e 65 20 68 61 73 20 62 65 65 6e 0d 0a n one has been..
2bc60 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 6b # sk
2bc70 69 70 70 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d ipped... #.
2bc80 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 . if {![inf
2bc90 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 70 o exists ::no(ep
2bca0 69 6c 6f 67 75 65 2e 65 61 67 6c 65 29 5d 7d 20 ilogue.eagle)]}
2bcb0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2bcc0 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
2bcd0 45 3a 20 53 68 6f 77 20 77 68 65 6e 20 6f 75 72 E: Show when our
2bce0 20 74 65 73 74 73 20 61 63 74 75 61 6c 6c 79 20 tests actually
2bcf0 65 6e 64 65 64 20 28 6e 6f 77 29 2e 0d 0a 20 20 ended (now)...
2bd00 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
2bd10 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
2bd20 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
2bd30 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
2bd40 20 20 22 2d 2d 2d 2d 20 53 79 73 74 65 6d 2e 44 "---- System.D
2bd50 61 74 61 2e 53 51 4c 69 74 65 20 74 65 73 74 73 ata.SQLite tests
2bd60 20 65 6e 64 65 64 20 61 74 20 22 20 5c 0d 0a 20 ended at " \..
2bd70 20 20 20 20 20 20 20 20 20 20 20 5b 63 6c 6f 63 [cloc
2bd80 6b 20 66 6f 72 6d 61 74 20 5b 63 6c 6f 63 6b 20 k format [clock
2bd90 73 65 63 6f 6e 64 73 5d 5d 20 5c 6e 5d 0d 0a 0d seconds]] \n]...
2bda0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
2bdb0 20 20 20 20 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 # NOTE: Load
2bdc0 20 74 68 65 20 22 65 70 69 6c 6f 67 75 65 22 20 the "epilogue"
2bdd0 63 75 73 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 custom per-user
2bde0 61 6e 64 2f 6f 72 20 70 65 72 2d 68 6f 73 74 20 and/or per-host
2bdf0 74 65 73 74 0d 0a 20 20 20 20 20 20 20 20 23 20 test.. #
2be00 20 20 20 20 20 20 73 65 74 74 69 6e 67 73 20 6e settings n
2be10 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ow... #..
2be20 20 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 uplevel
2be30 31 20 5b 6c 69 73 74 20 6c 6f 61 64 53 51 4c 69 1 [list loadSQLi
2be40 74 65 54 65 73 74 53 65 74 74 69 6e 67 73 20 24 teTestSettings $
2be50 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 2e ::test_channel .
2be60 65 70 69 6c 6f 67 75 65 5d 0d 0a 0d 0a 20 20 20 epilogue]....
2be70 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
2be80 23 20 42 55 47 46 49 58 3a 20 42 65 66 6f 72 65 # BUGFIX: Before
2be90 20 63 68 65 63 6b 69 6e 67 20 74 68 65 20 66 69 checking the fi
2bea0 6e 61 6c 20 72 65 73 6f 75 72 63 65 73 20 69 6e nal resources in
2beb0 20 75 73 65 20 62 79 20 53 51 4c 69 74 65 2c 20 use by SQLite,
2bec0 6d 61 6b 65 0d 0a 20 20 20 20 20 20 20 20 23 20 make.. #
2bed0 20 20 20 20 20 20 20 20 73 75 72 65 20 62 6f 74 sure bot
2bee0 68 20 6f 66 20 74 68 65 20 50 52 41 47 4d 41 20 h of the PRAGMA
2bef0 72 65 6c 61 74 65 64 20 64 69 72 65 63 74 6f 72 related director
2bf00 79 20 6e 61 6d 65 73 20 61 72 65 20 66 72 65 65 y names are free
2bf10 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 d... #..
2bf20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 53 checkForS
2bf30 51 4c 69 74 65 44 69 72 65 63 74 6f 72 69 65 73 QLiteDirectories
2bf40 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
2bf50 20 74 72 75 65 0d 0a 0d 0a 20 20 20 20 20 20 20 true....
2bf60 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
2bf70 54 45 3a 20 41 6c 73 6f 20 72 65 70 6f 72 74 20 TE: Also report
2bf80 74 68 65 20 72 65 73 6f 75 72 63 65 20 75 73 61 the resource usa
2bf90 67 65 20 61 66 74 65 72 20 72 75 6e 6e 69 6e 67 ge after running
2bfa0 20 74 68 65 20 74 65 73 74 73 2e 0d 0a 20 20 20 the tests...
2bfb0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
2bfc0 72 65 70 6f 72 74 53 51 4c 69 74 65 52 65 73 6f reportSQLiteReso
2bfd0 75 72 63 65 73 20 24 3a 3a 74 65 73 74 5f 63 68 urces $::test_ch
2bfe0 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 annel....
2bff0 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
2c000 54 45 3a 20 52 65 70 6f 72 74 20 74 68 65 20 63 TE: Report the c
2c010 72 69 74 69 63 61 6c 20 68 61 6e 64 6c 65 20 63 ritical handle c
2c020 6f 75 6e 74 73 20 61 66 74 65 72 20 72 75 6e 6e ounts after runn
2c030 69 6e 67 20 74 68 65 20 74 65 73 74 73 2e 0d 0a ing the tests...
2c040 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
2c050 20 20 20 67 65 74 53 51 4c 69 74 65 48 61 6e 64 getSQLiteHand
2c060 6c 65 43 6f 75 6e 74 73 20 24 3a 3a 74 65 73 74 leCounts $::test
2c070 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 _channel....
2c080 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
2c090 20 4e 4f 54 45 3a 20 49 66 20 6e 65 63 65 73 73 NOTE: If necess
2c0a0 61 72 79 2c 20 64 69 73 61 62 6c 65 20 73 68 61 ary, disable sha
2c0b0 72 65 64 2d 63 61 63 68 65 20 6d 6f 64 65 20 6e red-cache mode n
2c0c0 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ow... #..
2c0d0 20 20 20 20 20 20 20 20 69 66 20 7b 5b 68 61 73 if {[has
2c0e0 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 73 68 RuntimeOption sh
2c0f0 61 72 65 64 43 61 63 68 65 5d 7d 20 74 68 65 6e aredCache]} then
2c100 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 65 6e {.. en
2c110 61 62 6c 65 53 68 61 72 65 64 43 61 63 68 65 20 ableSharedCache
2c120 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
2c130 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 7d false.. }
2c140 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
2c150 0d 0a 0c 0d 0a 20 20 20 20 23 23 23 23 23 23 23 ..... #######
2c160 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c170 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c180 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c190 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c1a0 23 23 23 23 0d 0a 20 20 20 20 23 23 23 23 23 23 ####.. ######
2c1b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c1c0 23 23 23 23 23 23 23 20 45 4e 44 20 45 61 67 6c ####### END Eagl
2c1d0 65 20 4f 4e 4c 59 20 23 23 23 23 23 23 23 23 23 e ONLY #########
2c1e0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c1f0 23 23 23 23 23 0d 0a 20 20 20 20 23 23 23 23 23 #####.. #####
2c200 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c210 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c220 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c230 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2c240 23 23 23 23 23 23 0d 0a 20 20 7d 0d 0a 0d 0a 20 ######.. }....
2c250 20 23 0d 0a 20 20 23 20 4e 4f 54 45 3a 20 53 61 #.. # NOTE: Sa
2c260 76 65 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 ve the name of t
2c270 68 65 20 64 69 72 65 63 74 6f 72 79 20 63 6f 6e he directory con
2c280 74 61 69 6e 69 6e 67 20 74 68 69 73 20 66 69 6c taining this fil
2c290 65 2e 0d 0a 20 20 23 0d 0a 20 20 69 66 20 7b 21 e... #.. if {!
2c2a0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 63 6f 6d [info exists com
2c2b0 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 5d 7d 20 mon_directory]}
2c2c0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 73 65 74 20 then {.. set
2c2d0 63 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 common_directory
2c2e0 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 5b [file dirname [
2c2f0 69 6e 66 6f 20 73 63 72 69 70 74 5d 5d 0d 0a 20 info script]]..
2c300 20 7d 0d 0a 0d 0a 20 20 23 0d 0a 20 20 23 20 4e }.... #.. # N
2c310 4f 54 45 3a 20 50 72 6f 76 69 64 65 20 74 68 65 OTE: Provide the
2c320 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
2c330 69 74 65 20 74 65 73 74 20 70 61 63 6b 61 67 65 ite test package
2c340 20 74 6f 20 74 68 65 20 69 6e 74 65 72 70 72 65 to the interpre
2c350 74 65 72 2e 0d 0a 20 20 23 0d 0a 20 20 70 61 63 ter... #.. pac
2c360 6b 61 67 65 20 70 72 6f 76 69 64 65 20 53 79 73 kage provide Sys
2c370 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
2c380 54 65 73 74 20 31 2e 30 0d 0a 7d 0d 0a Test 1.0..}..