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 3f 0d 0a 20 20 20 20 20 20 20 20 x461"?..
22e0: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
22f0: 20 20 20 64 65 66 61 75 6c 74 20 7b 0d 0a 20 20 default {..
2300: 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 retu
2310: 72 6e 20 6e 65 74 46 78 33 35 3b 20 23 20 54 4f rn netFx35; # TO
2320: 44 4f 3a 20 47 6f 6f 64 20 22 66 61 6c 6c 62 61 DO: Good "fallba
2330: 63 6b 22 20 64 65 66 61 75 6c 74 3f 0d 0a 20 20 ck" default?..
2340: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
2350: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
2360: 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
2370: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 23 0d 0a 20 }..... #..
2380: 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 # NOTE: This
2390: 70 72 6f 63 65 64 75 72 65 20 73 68 6f 75 6c 64 procedure should
23a0: 20 72 65 74 75 72 6e 20 6e 6f 6e 2d 7a 65 72 6f return non-zero
23b0: 20 69 66 20 74 68 65 20 63 6f 6e 66 69 67 75 72 if the configur
23c0: 65 64 20 74 65 73 74 0d 0a 20 20 20 20 23 20 20 ed test.. #
23d0: 20 20 20 20 20 70 6c 61 74 66 6f 72 6d 20 69 73 platform is
23e0: 20 6d 6f 73 74 20 6c 69 6b 65 6c 79 20 74 68 65 most likely the
23f0: 20 64 65 66 61 75 6c 74 20 66 6f 72 20 74 68 69 default for thi
2400: 73 20 6d 61 63 68 69 6e 65 2e 0d 0a 20 20 20 20 s machine...
2410: 23 0d 0a 20 20 20 20 70 72 6f 63 20 69 73 44 65 #.. proc isDe
2420: 66 61 75 6c 74 42 75 69 6c 64 50 6c 61 74 66 6f faultBuildPlatfo
2430: 72 6d 20 7b 20 7b 76 65 72 62 6f 73 65 20 66 61 rm { {verbose fa
2440: 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 lse} } {..
2450: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
2460: 20 52 75 6e 6e 69 6e 67 20 6f 6e 20 57 6f 57 36 Running on WoW6
2470: 34 20 69 73 20 6e 65 76 65 72 20 74 68 65 20 64 4 is never the d
2480: 65 66 61 75 6c 74 20 70 6c 61 74 66 6f 72 6d 2e efault platform.
2490: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
24a0: 20 69 66 20 7b 5b 69 73 52 75 6e 6e 69 6e 67 57 if {[isRunningW
24b0: 6f 57 36 34 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 oW64]} then {..
24c0: 20 20 20 20 20 20 20 69 66 20 7b 24 76 65 72 62 if {$verb
24d0: 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ose} then {..
24e0: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
24f0: 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a test_channel \..
2500: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
2510: 2d 2d 2d 20 64 65 74 65 63 74 65 64 20 6e 6f 6e --- detected non
2520: 2d 64 65 66 61 75 6c 74 20 70 6c 61 74 66 6f 72 -default platfor
2530: 6d 20 28 57 6f 57 36 34 29 5c 6e 22 0d 0a 20 20 m (WoW64)\n"..
2540: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
2550: 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 return false..
2560: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
2570: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
2580: 20 54 68 69 73 20 68 61 73 20 61 20 67 6f 6f 64 This has a good
2590: 20 63 68 61 6e 63 65 20 6f 66 20 62 65 69 6e 67 chance of being
25a0: 20 74 68 65 20 64 65 66 61 75 6c 74 20 70 6c 61 the default pla
25b0: 74 66 6f 72 6d 2e 0d 0a 20 20 20 20 20 20 23 0d tform... #.
25c0: 0a 20 20 20 20 20 20 69 66 20 7b 24 76 65 72 62 . if {$verb
25d0: 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ose} then {..
25e0: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
25f0: 73 74 5f 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d st_channel "----
2600: 20 64 65 74 65 63 74 65 64 20 64 65 66 61 75 6c detected defaul
2610: 74 20 70 6c 61 74 66 6f 72 6d 5c 6e 22 0d 0a 20 t platform\n"..
2620: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 72 65 }.. re
2630: 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 7d turn true.. }
2640: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
2650: 74 42 75 69 6c 64 50 6c 61 74 66 6f 72 6d 20 7b tBuildPlatform {
2660: 20 6e 61 74 69 76 65 20 7d 20 7b 0d 0a 20 20 20 native } {..
2670: 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 if {[info exi
2680: 73 74 73 20 3a 3a 74 65 73 74 5f 70 6c 61 74 66 sts ::test_platf
2690: 6f 72 6d 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 orm] && \..
26a0: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
26b0: 67 74 68 20 24 3a 3a 74 65 73 74 5f 70 6c 61 74 gth $::test_plat
26c0: 66 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 form] > 0} then
26d0: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
26e0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 # NOTE: Us
26f0: 65 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 e the specified
2700: 74 65 73 74 20 70 6c 61 74 66 6f 72 6d 2e 20 20 test platform.
2710: 49 66 20 74 68 69 73 20 76 61 72 69 61 62 6c 65 If this variable
2720: 20 69 73 20 6e 6f 74 20 73 65 74 2c 0d 0a 20 20 is not set,..
2730: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 # th
2740: 65 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 20 e default value
2750: 77 69 6c 6c 20 62 65 20 62 61 73 65 64 20 6f 6e will be based on
2760: 20 74 68 65 20 6d 61 63 68 69 6e 65 20 61 72 63 the machine arc
2770: 68 69 74 65 63 74 75 72 65 2e 0d 0a 20 20 20 20 hitecture...
2780: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
2790: 65 74 75 72 6e 20 5b 65 78 70 72 20 7b 24 6e 61 eturn [expr {$na
27a0: 74 69 76 65 20 3f 20 24 3a 3a 74 65 73 74 5f 70 tive ? $::test_p
27b0: 6c 61 74 66 6f 72 6d 20 3a 20 22 22 7d 5d 0d 0a latform : ""}]..
27c0: 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b } elseif {
27d0: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
27e0: 65 73 74 5f 6d 61 63 68 69 6e 65 5d 20 26 26 20 est_machine] &&
27f0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 \.. [st
2800: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 ring length $::t
2810: 65 73 74 5f 6d 61 63 68 69 6e 65 5d 20 3e 20 30 est_machine] > 0
2820: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
2830: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
2840: 4f 54 45 3a 20 46 6f 72 20 6e 61 74 69 76 65 20 OTE: For native
2850: 62 75 69 6c 64 73 2c 20 72 65 74 75 72 6e 20 74 builds, return t
2860: 68 65 20 70 6c 61 74 66 6f 72 6d 20 6e 61 6d 65 he platform name
2870: 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 corresponding t
2880: 6f 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 o.. #
2890: 20 20 20 74 68 65 20 74 65 73 74 20 6d 61 63 68 the test mach
28a0: 69 6e 65 20 61 72 63 68 69 74 65 63 74 75 72 65 ine architecture
28b0: 3b 20 6f 74 68 65 72 77 69 73 65 2c 20 72 65 74 ; otherwise, ret
28c0: 75 72 6e 20 61 6e 20 65 6d 70 74 79 0d 0a 20 20 urn an empty..
28d0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 74 # st
28e0: 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 20 20 23 ring... #
28f0: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
2900: 20 5b 65 78 70 72 20 7b 0d 0a 20 20 20 20 20 20 [expr {..
2910: 20 20 20 20 24 6e 61 74 69 76 65 20 3f 20 5b 6d $native ? [m
2920: 61 63 68 69 6e 65 54 6f 50 6c 61 74 66 6f 72 6d achineToPlatform
2930: 20 24 3a 3a 74 65 73 74 5f 6d 61 63 68 69 6e 65 $::test_machine
2940: 5d 20 3a 20 22 22 0d 0a 20 20 20 20 20 20 20 20 ] : ""..
2950: 7d 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 }].. } else
2960: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
2970: 20 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 ::tcl_platform(
2980: 6d 61 63 68 69 6e 65 29 5d 7d 20 74 68 65 6e 20 machine)]} then
2990: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
29a0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 6f # NOTE: Fo
29b0: 72 20 6e 61 74 69 76 65 20 62 75 69 6c 64 73 2c r native builds,
29c0: 20 72 65 74 75 72 6e 20 74 68 65 20 70 6c 61 74 return the plat
29d0: 66 6f 72 6d 20 6e 61 6d 65 20 63 6f 72 72 65 73 form name corres
29e0: 70 6f 6e 64 69 6e 67 20 74 6f 0d 0a 20 20 20 20 ponding to..
29f0: 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 # the
2a00: 6d 61 63 68 69 6e 65 20 61 72 63 68 69 74 65 63 machine architec
2a10: 74 75 72 65 3b 20 6f 74 68 65 72 77 69 73 65 2c ture; otherwise,
2a20: 20 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 return an empty
2a30: 20 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 string...
2a40: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
2a50: 75 72 6e 20 5b 65 78 70 72 20 7b 0d 0a 20 20 20 urn [expr {..
2a60: 20 20 20 20 20 20 20 24 6e 61 74 69 76 65 20 3f $native ?
2a70: 20 5b 6d 61 63 68 69 6e 65 54 6f 50 6c 61 74 66 [machineToPlatf
2a80: 6f 72 6d 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 orm $::tcl_platf
2a90: 6f 72 6d 28 6d 61 63 68 69 6e 65 29 5d 20 3a 20 orm(machine)] :
2aa0: 22 22 0d 0a 20 20 20 20 20 20 20 20 7d 5d 0d 0a "".. }]..
2ab0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
2ac0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
2ad0: 20 20 20 23 20 4e 4f 54 45 3a 20 4e 6f 20 6d 61 # NOTE: No ma
2ae0: 63 68 69 6e 65 20 61 72 63 68 69 74 65 63 74 75 chine architectu
2af0: 72 65 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2c re is available,
2b00: 20 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 return an empty
2b10: 20 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 string...
2b20: 20 20 23 20 20 20 20 20 20 20 49 74 20 69 73 20 # It is
2b30: 69 6d 70 6f 72 74 61 6e 74 20 74 6f 20 72 65 74 important to ret
2b40: 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 73 74 72 urn an empty str
2b50: 69 6e 67 20 68 65 72 65 20 62 65 63 61 75 73 65 ing here because
2b60: 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 the.. #
2b70: 20 20 20 20 20 20 72 65 73 75 6c 74 20 6f 66 20 result of
2b80: 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 6d this procedure m
2b90: 61 79 20 62 65 20 75 73 65 64 20 77 69 74 68 20 ay be used with
2ba0: 5b 66 69 6c 65 20 6a 6f 69 6e 5d 2e 0d 0a 20 20 [file join]...
2bb0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
2bc0: 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 return ""..
2bd0: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
2be0: 20 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 proc getBuild
2bf0: 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 7b 7d Configuration {}
2c00: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
2c10: 20 20 20 23 20 4e 4f 54 45 3a 20 53 65 65 20 69 # NOTE: See i
2c20: 66 20 74 68 65 20 22 63 6f 6e 66 69 67 75 72 61 f the "configura
2c30: 74 69 6f 6e 22 20 73 65 74 74 69 6e 67 20 68 61 tion" setting ha
2c40: 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 64 65 s been overridde
2c50: 6e 20 62 79 20 74 68 65 0d 0a 20 20 20 20 20 20 n by the..
2c60: 23 20 20 20 20 20 20 20 75 73 65 72 20 28 65 2e # user (e.
2c70: 67 2e 20 6f 6e 20 74 68 65 20 63 6f 6d 6d 61 6e g. on the comman
2c80: 64 20 6c 69 6e 65 29 2e 20 20 54 68 69 73 20 68 d line). This h
2c90: 65 6c 70 73 20 63 6f 6e 74 72 6f 6c 20 65 78 61 elps control exa
2ca0: 63 74 6c 79 0d 0a 20 20 20 20 20 20 23 20 20 20 ctly.. #
2cb0: 20 20 20 20 77 68 69 63 68 20 73 65 74 20 6f 66 which set of
2cc0: 20 62 69 6e 61 72 69 65 73 20 77 65 20 61 72 65 binaries we are
2cd0: 20 74 65 73 74 69 6e 67 20 28 69 2e 65 2e 20 74 testing (i.e. t
2ce0: 68 6f 73 65 20 62 75 69 6c 74 20 69 6e 20 74 68 hose built in th
2cf0: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
2d00: 20 22 44 65 62 75 67 22 20 6f 72 20 22 52 65 6c "Debug" or "Rel
2d10: 65 61 73 65 22 20 62 75 69 6c 64 20 63 6f 6e 66 ease" build conf
2d20: 69 67 75 72 61 74 69 6f 6e 73 29 2e 20 20 54 6f igurations). To
2d30: 20 6f 76 65 72 72 69 64 65 20 74 68 69 73 0d 0a override this..
2d40: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 61 # va
2d50: 6c 75 65 20 76 69 61 20 74 68 65 20 63 6f 6d 6d lue via the comm
2d60: 61 6e 64 20 6c 69 6e 65 2c 20 65 6e 74 65 72 20 and line, enter
2d70: 61 20 63 6f 6d 6d 61 6e 64 20 73 69 6d 69 6c 61 a command simila
2d80: 72 20 74 6f 20 6f 6e 65 20 6f 66 0d 0a 20 20 20 r to one of..
2d90: 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 66 # the f
2da0: 6f 6c 6c 6f 77 69 6e 67 20 28 61 6c 6c 20 6f 6e ollowing (all on
2db0: 20 6f 6e 65 20 6c 69 6e 65 29 3a 0d 0a 20 20 20 one line):..
2dc0: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 #.. #
2dd0: 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 EagleShell.e
2de0: 78 65 20 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a xe -anyInitializ
2df0: 65 20 22 73 65 74 20 74 65 73 74 5f 63 6f 6e 66 e "set test_conf
2e00: 69 67 75 72 61 74 69 6f 6e 20 44 65 62 75 67 22 iguration Debug"
2e10: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
2e20: 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 -file .\path\t
2e30: 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 o\all.eagle..
2e40: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 #.. #
2e50: 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 EagleShell.e
2e60: 78 65 20 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a xe -anyInitializ
2e70: 65 20 22 73 65 74 20 74 65 73 74 5f 63 6f 6e 66 e "set test_conf
2e80: 69 67 75 72 61 74 69 6f 6e 20 52 65 6c 65 61 73 iguration Releas
2e90: 65 22 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 e".. #
2ea0: 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 -file .\path
2eb0: 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 \to\all.eagle..
2ec0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
2ed0: 20 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c EagleShell
2ee0: 2e 65 78 65 20 2d 66 69 6c 65 20 2e 5c 70 61 74 .exe -file .\pat
2ef0: 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 20 2d h\to\all.eagle -
2f00: 70 72 65 54 65 73 74 0d 0a 20 20 20 20 20 20 23 preTest.. #
2f10: 20 20 20 20 20 20 20 20 20 22 75 6e 73 65 74 20 "unset
2f20: 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 74 65 73 74 -nocomplain test
2f30: 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 22 0d _configuration".
2f40: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
2f50: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
2f60: 20 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 ::test_configur
2f70: 61 74 69 6f 6e 5d 20 26 26 20 5c 0d 0a 20 20 20 ation] && \..
2f80: 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c [string l
2f90: 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 63 6f ength $::test_co
2fa0: 6e 66 69 67 75 72 61 74 69 6f 6e 5d 20 3e 20 30 nfiguration] > 0
2fb0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
2fc0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
2fd0: 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 OTE: Use the spe
2fe0: 63 69 66 69 65 64 20 74 65 73 74 20 63 6f 6e 66 cified test conf
2ff0: 69 67 75 72 61 74 69 6f 6e 2e 20 20 54 68 65 20 iguration. The
3000: 64 65 66 61 75 6c 74 20 76 61 6c 75 65 20 75 73 default value us
3010: 65 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ed.. #
3020: 20 20 20 20 66 6f 72 20 74 68 69 73 20 76 61 72 for this var
3030: 69 61 62 6c 65 20 69 73 20 74 79 70 69 63 61 6c iable is typical
3040: 6c 79 20 22 52 65 6c 65 61 73 65 22 2c 20 61 73 ly "Release", as
3050: 20 73 65 74 20 62 79 20 74 68 65 20 74 65 73 74 set by the test
3060: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
3070: 20 20 73 75 69 74 65 20 69 74 73 65 6c 66 2e 0d suite itself..
3080: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
3090: 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 74 65 return $::te
30a0: 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e st_configuration
30b0: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
30c0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
30d0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4e 6f 72 # NOTE: Nor
30e0: 6d 61 6c 6c 79 2c 20 77 65 20 77 69 6c 6c 20 6e mally, we will n
30f0: 65 76 65 72 20 68 69 74 20 74 68 69 73 20 63 61 ever hit this ca
3100: 73 65 20 62 65 63 61 75 73 65 20 74 68 65 20 76 se because the v
3110: 61 6c 75 65 20 6f 66 20 74 68 65 0d 0a 20 20 20 alue of the..
3120: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 65 73 # tes
3130: 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 t configuration
3140: 76 61 72 69 61 62 6c 65 20 69 73 20 61 6c 77 61 variable is alwa
3150: 79 73 20 73 65 74 20 62 79 20 74 68 65 20 74 65 ys set by the te
3160: 73 74 20 73 75 69 74 65 0d 0a 20 20 20 20 20 20 st suite..
3170: 20 20 23 20 20 20 20 20 20 20 69 74 73 65 6c 66 # itself
3180: 3b 20 68 6f 77 65 76 65 72 2c 20 69 74 20 63 61 ; however, it ca
3190: 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 n be overridden
31a0: 75 73 69 6e 67 20 74 68 65 20 75 6e 73 65 74 20 using the unset
31b0: 63 6f 6d 6d 61 6e 64 0d 0a 20 20 20 20 20 20 20 command..
31c0: 20 23 20 20 20 20 20 20 20 66 72 6f 6d 20 74 68 # from th
31d0: 65 20 2d 70 72 65 54 65 73 74 20 6f 70 74 69 6f e -preTest optio
31e0: 6e 20 74 6f 20 74 68 65 20 74 65 73 74 20 73 75 n to the test su
31f0: 69 74 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ite... #.
3200: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
3210: 24 3a 3a 65 61 67 6c 65 5f 70 6c 61 74 66 6f 72 $::eagle_platfor
3220: 6d 28 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 29 m(configuration)
3230: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
3240: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
3250: 74 42 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 74 tBuildConfigurat
3260: 69 6f 6e 73 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 ions {} {..
3270: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
3280: 3a 20 53 65 65 20 69 66 20 74 68 65 20 6c 69 73 : See if the lis
3290: 74 20 6f 66 20 74 65 73 74 20 63 6f 6e 66 69 67 t of test config
32a0: 75 72 61 74 69 6f 6e 73 20 68 61 73 20 62 65 65 urations has bee
32b0: 6e 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 0d n overridden by.
32c0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 . # t
32d0: 68 65 20 75 73 65 72 20 28 65 2e 67 2e 20 6f 6e he user (e.g. on
32e0: 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e the command lin
32f0: 65 29 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 e)... #..
3300: 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
3310: 69 73 74 73 20 3a 3a 74 65 73 74 5f 63 6f 6e 66 ists ::test_conf
3320: 69 67 75 72 61 74 69 6f 6e 73 5d 20 26 26 20 5c igurations] && \
3330: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 6c 6c 65 .. [lle
3340: 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 63 6f 6e ngth $::test_con
3350: 66 69 67 75 72 61 74 69 6f 6e 73 5d 20 3e 20 30 figurations] > 0
3360: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
3370: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
3380: 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 OTE: Use the spe
3390: 63 69 66 69 65 64 20 6c 69 73 74 20 6f 66 20 74 cified list of t
33a0: 65 73 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f est configuratio
33b0: 6e 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ns... #..
33c0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
33d0: 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 ::test_configura
33e0: 74 69 6f 6e 73 0d 0a 20 20 20 20 20 20 7d 20 65 tions.. } e
33f0: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 lse {.. #
3400: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
3410: 3a 20 55 73 65 20 74 68 65 20 64 65 66 61 75 6c : Use the defaul
3420: 74 20 6c 69 73 74 20 6f 66 20 74 65 73 74 20 63 t list of test c
3430: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 73 2e 0d 0a onfigurations...
3440: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
3450: 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 return [list
3460: 44 65 62 75 67 20 52 65 6c 65 61 73 65 5d 0d 0a Debug Release]..
3470: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
3480: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 ... proc getB
3490: 75 69 6c 64 42 61 73 65 44 69 72 65 63 74 6f 72 uildBaseDirector
34a0: 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d y {} {.. #.
34b0: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 . # NOTE: F
34c0: 69 67 75 72 65 20 6f 75 74 20 74 68 65 20 62 61 igure out the ba
34d0: 73 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 se directory whe
34e0: 72 65 20 61 6c 6c 20 74 68 65 20 62 75 69 6c 64 re all the build
34f0: 73 20 73 68 6f 75 6c 64 20 62 65 0d 0a 20 20 20 s should be..
3500: 20 20 20 23 20 20 20 20 20 20 20 6c 6f 63 61 74 # locat
3510: 65 64 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 62 ed. This will b
3520: 65 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 e the directory
3530: 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 that contains th
3540: 65 20 61 63 74 75 61 6c 0d 0a 20 20 20 20 20 20 e actual..
3550: 23 20 20 20 20 20 20 20 62 75 69 6c 64 20 6f 75 # build ou
3560: 74 70 75 74 20 64 69 72 65 63 74 6f 72 79 20 28 tput directory (
3570: 65 2e 67 2e 20 70 61 72 65 6e 74 20 6f 66 20 22 e.g. parent of "
3580: 62 69 6e 22 29 2e 0d 0a 20 20 20 20 20 20 23 0d bin")... #.
3590: 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f . if {[info
35a0: 20 65 78 69 73 74 73 20 3a 3a 62 75 69 6c 64 5f exists ::build_
35b0: 62 61 73 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 base_directory]
35c0: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
35d0: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
35e0: 3a 3a 62 75 69 6c 64 5f 62 61 73 65 5f 64 69 72 ::build_base_dir
35f0: 65 63 74 6f 72 79 5d 20 3e 20 30 7d 20 74 68 65 ectory] > 0} the
3600: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
3610: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
3620: 54 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 The location of
3630: 74 68 65 20 62 75 69 6c 64 20 62 61 73 65 20 64 the build base d
3640: 69 72 65 63 74 6f 72 79 20 68 61 73 20 62 65 65 irectory has bee
3650: 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d 0a 20 n overridden;..
3660: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
3670: 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 herefore, use it
3680: 20 76 65 72 62 61 74 69 6d 2e 0d 0a 20 20 20 20 verbatim...
3690: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
36a0: 65 74 75 72 6e 20 24 3a 3a 62 75 69 6c 64 5f 62 eturn $::build_b
36b0: 61 73 65 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 ase_directory..
36c0: 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b } elseif {[
36d0: 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 63 6f info exists ::co
36e0: 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 5d 20 mmon_directory]
36f0: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
3700: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
3710: 3a 3a 63 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f ::common_directo
3720: 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d ry] > 0} then {.
3730: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
3740: 20 20 20 20 23 20 4e 4f 54 45 3a 20 4e 65 78 74 # NOTE: Next
3750: 2c 20 66 61 6c 6c 62 61 63 6b 20 74 6f 20 74 68 , fallback to th
3760: 65 20 67 72 61 6e 64 70 61 72 65 6e 74 20 64 69 e grandparent di
3770: 72 65 63 74 6f 72 79 20 6f 66 20 74 68 65 20 6f rectory of the o
3780: 6e 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ne.. #
3790: 20 20 20 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 containing t
37a0: 68 69 73 20 66 69 6c 65 20 28 69 2e 65 2e 20 22 his file (i.e. "
37b0: 63 6f 6d 6d 6f 6e 2e 65 61 67 6c 65 22 29 2c 20 common.eagle"),
37c0: 69 66 20 61 76 61 69 6c 61 62 6c 65 2e 0d 0a 20 if available...
37d0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
37e0: 20 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 64 return [file d
37f0: 69 72 6e 61 6d 65 20 5b 66 69 6c 65 20 64 69 72 irname [file dir
3800: 6e 61 6d 65 20 24 3a 3a 63 6f 6d 6d 6f 6e 5f 64 name $::common_d
3810: 69 72 65 63 74 6f 72 79 5d 5d 0d 0a 20 20 20 20 irectory]]..
3820: 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 } elseif {[inf
3830: 6f 20 65 78 69 73 74 73 20 3a 3a 70 61 74 68 5d o exists ::path]
3840: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
3850: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
3860: 24 3a 3a 70 61 74 68 5d 20 3e 20 30 7d 20 74 68 $::path] > 0} th
3870: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
3880: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
3890: 20 46 69 6e 61 6c 6c 79 2c 20 66 61 6c 6c 62 61 Finally, fallba
38a0: 63 6b 20 74 6f 20 74 68 65 20 70 61 72 65 6e 74 ck to the parent
38b0: 20 64 69 72 65 63 74 6f 72 79 20 6f 66 20 74 68 directory of th
38c0: 65 20 45 61 67 6c 65 54 65 73 74 0d 0a 20 20 20 e EagleTest..
38d0: 20 20 20 20 20 23 20 20 20 20 20 20 20 70 61 74 # pat
38e0: 68 2e 20 20 54 68 65 20 45 61 67 6c 65 54 65 73 h. The EagleTes
38f0: 74 20 70 61 63 6b 61 67 65 20 67 75 61 72 61 6e t package guaran
3900: 74 65 65 73 20 74 68 61 74 20 74 68 69 73 20 76 tees that this v
3910: 61 72 69 61 62 6c 65 0d 0a 20 20 20 20 20 20 20 ariable..
3920: 20 23 20 20 20 20 20 20 20 77 69 6c 6c 20 62 65 # will be
3930: 20 73 65 74 20 74 6f 20 74 68 65 20 64 69 72 65 set to the dire
3940: 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e 67 ctory containing
3950: 20 74 68 65 20 66 69 72 73 74 20 66 69 6c 65 20 the first file
3960: 74 6f 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 to.. #
3970: 20 20 20 20 65 78 65 63 75 74 65 20 74 68 65 20 execute the
3980: 5b 72 75 6e 54 65 73 74 50 72 6f 6c 6f 67 75 65 [runTestPrologue
3990: 5d 20 73 63 72 69 70 74 20 6c 69 62 72 61 72 79 ] script library
39a0: 20 70 72 6f 63 65 64 75 72 65 2e 0d 0a 20 20 20 procedure...
39b0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
39c0: 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 64 69 72 return [file dir
39d0: 6e 61 6d 65 20 24 3a 3a 70 61 74 68 5d 0d 0a 20 name $::path]..
39e0: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
39f0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
3a00: 20 20 23 20 4e 4f 54 45 3a 20 4e 6f 20 70 61 74 # NOTE: No pat
3a10: 68 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2c 20 h is available,
3a20: 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 return an empty
3a30: 73 74 72 69 6e 67 2e 20 20 54 68 69 73 20 70 6f string. This po
3a40: 69 6e 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 int.. #
3a50: 20 20 20 20 20 73 68 6f 75 6c 64 20 6e 6f 74 20 should not
3a60: 62 65 20 72 65 61 63 68 65 64 2e 0d 0a 20 20 20 be reached...
3a70: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
3a80: 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 20 return ""..
3a90: 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
3aa0: 20 20 70 72 6f 63 20 67 65 74 53 51 4c 69 74 65 proc getSQLite
3ab0: 54 65 73 74 44 61 74 61 50 61 74 68 20 7b 7d 20 TestDataPath {}
3ac0: 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
3ad0: 20 20 23 20 4e 4f 54 45 3a 20 46 69 67 75 72 65 # NOTE: Figure
3ae0: 20 6f 75 74 20 74 68 65 20 64 69 72 65 63 74 6f out the directo
3af0: 72 79 20 77 68 65 72 65 20 61 6c 6c 20 74 68 65 ry where all the
3b00: 20 74 65 73 74 20 64 61 74 61 20 66 69 6c 65 73 test data files
3b10: 20 73 68 6f 75 6c 64 0d 0a 20 20 20 20 20 20 23 should.. #
3b20: 20 20 20 20 20 20 20 62 65 20 6c 6f 63 61 74 65 be locate
3b30: 64 2e 20 20 54 68 69 73 20 73 68 6f 75 6c 64 20 d. This should
3b40: 62 65 20 74 68 65 20 22 64 61 74 61 22 20 64 69 be the "data" di
3b50: 72 65 63 74 6f 72 79 20 62 65 6e 65 61 74 68 20 rectory beneath
3b60: 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 the.. #
3b70: 20 20 20 64 69 72 65 63 74 6f 72 79 20 63 6f 6e directory con
3b80: 74 61 69 6e 69 6e 67 20 74 68 65 20 61 63 74 75 taining the actu
3b90: 61 6c 20 74 65 73 74 20 73 63 72 69 70 74 73 2e al test scripts.
3ba0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
3bb0: 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 6a 6f return [file jo
3bc0: 69 6e 20 24 3a 3a 70 61 74 68 20 64 61 74 61 5d in $::path data]
3bd0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
3be0: 70 72 6f 63 20 69 73 52 75 6e 6e 69 6e 67 57 6f proc isRunningWo
3bf0: 57 36 34 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 W64 {} {..
3c00: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
3c10: 20 46 6f 72 20 6e 6f 77 2c 20 6a 75 73 74 20 75 For now, just u
3c20: 73 65 20 74 68 65 20 65 78 69 73 74 69 6e 67 20 se the existing
3c30: 74 65 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 20 test constraint
3c40: 66 6f 72 20 64 65 74 65 63 74 69 6e 67 0d 0a 20 for detecting..
3c50: 20 20 20 20 20 23 20 20 20 20 20 20 20 61 20 57 # a W
3c60: 6f 57 36 34 20 70 72 6f 63 65 73 73 2e 0d 0a 20 oW64 process...
3c70: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 #.. re
3c80: 74 75 72 6e 20 5b 68 61 76 65 43 6f 6e 73 74 72 turn [haveConstr
3c90: 61 69 6e 74 20 77 6f 77 36 34 5d 0d 0a 20 20 20 aint wow64]..
3ca0: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
3cb0: 69 73 4d 69 78 65 64 4d 6f 64 65 41 73 73 65 6d isMixedModeAssem
3cc0: 62 6c 79 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7b bly { fileName {
3cd0: 76 61 72 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d varName ""} } {.
3ce0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
3cf0: 23 20 4e 4f 54 45 3a 20 46 69 72 73 74 2c 20 6d # NOTE: First, m
3d00: 61 6b 65 20 73 75 72 65 20 74 68 65 20 74 65 73 ake sure the tes
3d10: 74 20 73 75 69 74 65 20 69 6e 66 72 61 73 74 72 t suite infrastr
3d20: 75 63 74 75 72 65 20 69 73 20 61 6c 6c 6f 77 65 ucture is allowe
3d30: 64 20 74 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 d to.. #
3d40: 20 20 20 20 75 73 65 20 74 68 65 20 5b 65 78 65 use the [exe
3d50: 63 5d 20 63 6f 6d 6d 61 6e 64 2e 0d 0a 20 20 20 c] command...
3d60: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
3d70: 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
3d80: 6e 6f 28 65 78 65 63 29 5d 20 26 26 20 21 5b 69 no(exec)] && ![i
3d90: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
3da0: 63 6f 72 46 6c 61 67 73 29 5d 7d 20 74 68 65 6e corFlags)]} then
3db0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
3dc0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 # NOTE: I
3dd0: 66 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f f the location o
3de0: 66 20 43 6f 72 46 6c 61 67 73 20 69 73 20 70 72 f CorFlags is pr
3df0: 65 73 65 6e 74 20 69 6e 20 74 68 65 20 65 6e 76 esent in the env
3e00: 69 72 6f 6e 6d 65 6e 74 2c 0d 0a 20 20 20 20 20 ironment,..
3e10: 20 20 20 23 20 20 20 20 20 20 20 75 73 65 20 69 # use i
3e20: 74 3b 20 6f 74 68 65 72 77 69 73 65 20 61 73 73 t; otherwise ass
3e30: 75 6d 65 20 69 74 20 69 73 20 69 6e 20 74 68 65 ume it is in the
3e40: 20 50 41 54 48 2e 0d 0a 20 20 20 20 20 20 20 20 PATH...
3e50: 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 63 #.. set c
3e60: 6f 72 46 6c 61 67 73 20 5b 65 78 70 72 20 7b 0d orFlags [expr {.
3e70: 0a 20 20 20 20 20 20 20 20 20 20 5b 69 6e 66 6f . [info
3e80: 20 65 78 69 73 74 73 20 3a 3a 65 6e 76 28 43 6f exists ::env(Co
3e90: 72 46 6c 61 67 73 29 5d 20 3f 20 24 3a 3a 65 6e rFlags)] ? $::en
3ea0: 76 28 43 6f 72 46 6c 61 67 73 29 20 3a 20 22 43 v(CorFlags) : "C
3eb0: 6f 72 46 6c 61 67 73 22 0d 0a 20 20 20 20 20 20 orFlags"..
3ec0: 20 20 7d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }]....
3ed0: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
3ee0: 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 65 78 E: Attempt to ex
3ef0: 65 63 75 74 65 20 43 6f 72 46 6c 61 67 73 20 6f ecute CorFlags o
3f00: 6e 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 n the specified
3f10: 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 file... #
3f20: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 .. if {[c
3f30: 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
3f40: 20 20 65 78 65 63 20 2d 2d 20 24 63 6f 72 46 6c exec -- $corFl
3f50: 61 67 73 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 ags [file native
3f60: 6e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 5d 0d name $fileName].
3f70: 0a 20 20 20 20 20 20 20 20 7d 20 65 78 65 63 5d . } exec]
3f80: 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
3f90: 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
3fa0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 # NOTE: If
3fb0: 20 72 65 71 75 65 73 74 65 64 20 62 79 20 6f 75 requested by ou
3fc0: 72 20 63 61 6c 6c 65 72 2c 20 61 74 74 65 6d 70 r caller, attemp
3fd0: 74 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 t to determine t
3fe0: 68 65 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 he.. #
3ff0: 20 20 20 20 20 20 70 6c 61 74 66 6f 72 6d 20 66 platform f
4000: 6f 72 20 74 68 65 20 73 70 65 63 69 66 69 65 64 or the specified
4010: 20 66 69 6c 65 20 61 73 20 77 65 6c 6c 2e 0d 0a file as well...
4020: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
4030: 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 if {[stri
4040: 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 ng length $varNa
4050: 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d me] > 0} then {.
4060: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
4070: 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f # NO
4080: 54 45 3a 20 53 74 6f 72 65 20 74 68 65 20 70 6c TE: Store the pl
4090: 61 74 66 6f 72 6d 20 69 6e 20 74 68 65 20 6e 61 atform in the na
40a0: 6d 65 64 20 76 61 72 69 61 62 6c 65 20 69 6e 20 med variable in
40b0: 74 68 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 the..
40c0: 20 23 20 20 20 20 20 20 20 63 6f 6e 74 65 78 74 # context
40d0: 20 6f 66 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d of our caller..
40e0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
40f0: 20 20 20 20 20 20 20 20 20 20 20 20 75 70 76 61 upva
4100: 72 20 31 20 24 76 61 72 4e 61 6d 65 20 70 6c 61 r 1 $varName pla
4110: 74 66 6f 72 6d 0d 0a 0d 0a 20 20 20 20 20 20 20 tform....
4120: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
4130: 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 # NOTE: Atte
4140: 6d 70 74 20 74 6f 20 65 78 74 72 61 63 74 20 74 mpt to extract t
4150: 68 65 20 50 45 20 6c 69 6e 65 20 66 72 6f 6d 20 he PE line from
4160: 74 68 65 20 63 61 70 74 75 72 65 64 0d 0a 20 20 the captured..
4170: 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
4180: 20 20 6f 75 74 70 75 74 2e 20 20 49 66 20 74 68 output. If th
4190: 69 73 20 76 61 6c 75 65 20 69 73 20 22 50 45 33 is value is "PE3
41a0: 32 22 20 6f 72 20 22 50 45 33 32 2b 22 2c 20 74 2" or "PE32+", t
41b0: 68 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 he..
41c0: 23 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c 79 # assembly
41d0: 20 66 69 6c 65 20 69 73 20 33 32 2d 62 69 74 20 file is 32-bit
41e0: 6f 72 20 36 34 2d 62 69 74 2c 20 72 65 73 70 65 or 64-bit, respe
41f0: 63 74 69 76 65 6c 79 3b 0d 0a 20 20 20 20 20 20 ctively;..
4200: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 74 # ot
4210: 68 65 72 77 69 73 65 2c 20 69 74 73 20 74 79 70 herwise, its typ
4220: 65 20 69 73 20 75 6e 6b 6e 6f 77 6e 2e 0d 0a 20 e is unknown...
4230: 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
4240: 20 20 20 20 20 20 20 20 20 20 73 65 74 20 70 61 set pa
4250: 74 74 65 72 6e 20 7b 5e 50 45 20 20 20 20 20 20 ttern {^PE
4260: 20 20 3a 20 28 50 45 33 32 7c 50 45 33 32 5c 2b : (PE32|PE32\+
4270: 29 5c 73 2b 24 7d 0d 0a 0d 0a 20 20 20 20 20 20 )\s+$}....
4280: 20 20 20 20 20 20 69 66 20 7b 5b 72 65 67 65 78 if {[regex
4290: 70 20 2d 6c 69 6e 65 20 2d 2d 20 24 70 61 74 74 p -line -- $patt
42a0: 65 72 6e 20 24 65 78 65 63 20 64 75 6d 6d 79 20 ern $exec dummy
42b0: 70 65 33 32 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 pe32]} then {..
42c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
42d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
42e0: 48 41 43 4b 3a 20 54 68 69 73 20 5b 73 77 69 74 HACK: This [swit
42f0: 63 68 5d 20 61 73 73 75 6d 65 73 20 74 68 61 74 ch] assumes that
4300: 20 33 32 2d 62 69 74 20 65 78 65 63 75 74 61 62 32-bit executab
4310: 6c 65 73 20 61 72 65 0d 0a 20 20 20 20 20 20 20 les are..
4320: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 # a
4330: 6c 77 61 79 73 20 78 38 36 20 61 6e 64 20 74 68 lways x86 and th
4340: 61 74 20 36 34 2d 62 69 74 20 65 78 65 63 75 74 at 64-bit execut
4350: 61 62 6c 65 73 20 61 72 65 20 61 6c 77 61 79 73 ables are always
4360: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
4370: 23 20 20 20 20 20 20 20 78 36 34 2e 0d 0a 20 20 # x64...
4380: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
4390: 20 20 20 20 20 20 20 20 20 20 20 20 20 73 77 69 swi
43a0: 74 63 68 20 2d 65 78 61 63 74 20 2d 2d 20 24 70 tch -exact -- $p
43b0: 65 33 32 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 e32 {..
43c0: 20 20 20 20 20 20 20 50 45 33 32 20 7b 0d 0a 20 PE32 {..
43d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
43e0: 20 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 57 69 set platform Wi
43f0: 6e 33 32 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n32..
4400: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
4410: 20 20 20 20 20 20 20 20 50 45 33 32 2b 20 7b 0d PE32+ {.
4420: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
4430: 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 set platform
4440: 78 36 34 0d 0a 20 20 20 20 20 20 20 20 20 20 20 x64..
4450: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
4460: 20 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 20 default
4470: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
4480: 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 set platfor
4490: 6d 20 22 22 0d 0a 20 20 20 20 20 20 20 20 20 20 m ""..
44a0: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
44b0: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
44c0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
44d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 se
44e0: 74 20 70 6c 61 74 66 6f 72 6d 20 22 22 0d 0a 20 t platform ""..
44f0: 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
4500: 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
4510: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
4520: 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 # NOTE: Atte
4530: 6d 70 74 20 74 6f 20 65 78 74 72 61 63 74 20 74 mpt to extract t
4540: 68 65 20 49 4c 4f 4e 4c 59 20 6c 69 6e 65 20 66 he ILONLY line f
4550: 72 6f 6d 20 74 68 65 20 63 61 70 74 75 72 65 64 rom the captured
4560: 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 .. #
4570: 20 20 20 20 6f 75 74 70 75 74 2e 20 20 49 66 20 output. If
4580: 74 68 69 73 20 76 61 6c 75 65 20 69 73 20 7a 65 this value is ze
4590: 72 6f 2c 20 74 68 65 20 73 70 65 63 69 66 69 65 ro, the specifie
45a0: 64 20 66 69 6c 65 20 6d 75 73 74 0d 0a 20 20 20 d file must..
45b0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 # b
45c0: 65 20 61 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 e a mixed-mode a
45d0: 73 73 65 6d 62 6c 79 3b 20 6f 74 68 65 72 77 69 ssembly; otherwi
45e0: 73 65 2c 20 69 74 20 63 6f 6e 74 61 69 6e 73 20 se, it contains
45f0: 6f 6e 6c 79 0d 0a 20 20 20 20 20 20 20 20 20 20 only..
4600: 23 20 20 20 20 20 20 20 6d 61 6e 61 67 65 64 20 # managed
4610: 63 6f 6d 70 6f 6e 65 6e 74 73 2e 0d 0a 20 20 20 components...
4620: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
4630: 20 20 20 20 73 65 74 20 70 61 74 74 65 72 6e 20 set pattern
4640: 7b 5e 49 4c 4f 4e 4c 59 20 20 20 20 3a 20 28 30 {^ILONLY : (0
4650: 7c 31 29 5c 73 2b 24 7d 0d 0a 0d 0a 20 20 20 20 |1)\s+$}....
4660: 20 20 20 20 20 20 69 66 20 7b 21 5b 72 65 67 65 if {![rege
4670: 78 70 20 2d 6c 69 6e 65 20 2d 2d 20 24 70 61 74 xp -line -- $pat
4680: 74 65 72 6e 20 24 65 78 65 63 20 64 75 6d 6d 79 tern $exec dummy
4690: 20 69 6c 4f 6e 6c 79 5d 7d 20 74 68 65 6e 20 7b ilOnly]} then {
46a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
46b0: 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 turn false..
46c0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
46d0: 20 20 20 20 20 69 66 20 7b 21 24 69 6c 4f 6e 6c if {!$ilOnl
46e0: 79 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 y} then {..
46f0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
4700: 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d ue.. }.
4710: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
4720: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
4730: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 # NOTE: If
4740: 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 20 the test suite
4750: 63 61 6e 6e 6f 74 20 75 73 65 20 5b 65 78 65 63 cannot use [exec
4760: 5d 20 6f 72 20 65 78 65 63 75 74 69 6f 6e 20 6f ] or execution o
4770: 66 20 43 6f 72 46 6c 61 67 73 0d 0a 20 20 20 20 f CorFlags..
4780: 20 20 23 20 20 20 20 20 20 20 66 61 69 6c 65 64 # failed
4790: 2c 20 72 65 74 75 72 6e 20 66 61 6c 73 65 2e 0d , return false..
47a0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
47b0: 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 return false..
47c0: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
47d0: 20 67 65 74 4e 61 74 69 76 65 4c 69 62 72 61 72 getNativeLibrar
47e0: 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 20 7b yFileNamesOnly {
47f0: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
4800: 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 72 73 # NOTE: Firs
4810: 74 2c 20 63 68 65 63 6b 20 69 66 20 74 68 65 20 t, check if the
4820: 6c 69 73 74 20 6f 66 20 6e 61 74 69 76 65 20 6c list of native l
4830: 69 62 72 61 72 79 20 66 69 6c 65 20 6e 61 6d 65 ibrary file name
4840: 73 20 68 61 73 20 62 65 65 6e 0d 0a 20 20 20 20 s has been..
4850: 20 20 23 20 20 20 20 20 20 20 6d 61 6e 75 61 6c # manual
4860: 6c 79 20 6f 76 65 72 72 69 64 64 65 6e 2e 0d 0a ly overridden...
4870: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
4880: 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
4890: 3a 3a 6e 61 74 69 76 65 5f 6c 69 62 72 61 72 79 ::native_library
48a0: 5f 66 69 6c 65 5f 6e 61 6d 65 73 5d 20 26 26 20 _file_names] &&
48b0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 6c 6c \.. [ll
48c0: 65 6e 67 74 68 20 24 3a 3a 6e 61 74 69 76 65 5f ength $::native_
48d0: 6c 69 62 72 61 72 79 5f 66 69 6c 65 5f 6e 61 6d library_file_nam
48e0: 65 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d es] > 0} then {.
48f0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
4900: 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 # NOTE: The
4910: 6c 69 73 74 20 6f 66 20 6e 61 74 69 76 65 20 6c list of native l
4920: 69 62 72 61 72 79 20 66 69 6c 65 20 6e 61 6d 65 ibrary file name
4930: 73 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 s has been overr
4940: 69 64 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 idden;..
4950: 23 20 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 # therefor
4960: 65 2c 20 75 73 65 20 69 74 20 76 65 72 62 61 74 e, use it verbat
4970: 69 6d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a im... #..
4980: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
4990: 3a 3a 6e 61 74 69 76 65 5f 6c 69 62 72 61 72 79 ::native_library
49a0: 5f 66 69 6c 65 5f 6e 61 6d 65 73 0d 0a 20 20 20 _file_names..
49b0: 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 73 } elseif {[is
49c0: 57 69 6e 64 6f 77 73 5d 7d 20 74 68 65 6e 20 7b Windows]} then {
49d0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
49e0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4f 74 68 # NOTE: Oth
49f0: 65 72 77 69 73 65 2c 20 6f 6e 20 57 69 6e 64 6f erwise, on Windo
4a00: 77 73 2c 20 61 6c 77 61 79 73 20 75 73 65 20 74 ws, always use t
4a10: 68 65 20 64 65 66 61 75 6c 74 20 66 69 6c 65 20 he default file
4a20: 6e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 23 20 name.. #
4a30: 20 20 20 20 20 20 22 73 71 6c 69 74 65 33 2e 64 "sqlite3.d
4a40: 6c 6c 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ll"... #.
4a50: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
4a60: 5b 6c 69 73 74 20 73 71 6c 69 74 65 33 2e 64 6c [list sqlite3.dl
4a70: 6c 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 l].. } else
4a80: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
4a90: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4f # NOTE: O
4aa0: 74 68 65 72 77 69 73 65 2c 20 72 65 74 75 72 6e therwise, return
4ab0: 20 62 6f 74 68 20 74 68 65 20 67 65 6e 65 72 69 both the generi
4ac0: 63 20 50 4f 53 49 58 20 66 69 6c 65 20 6e 61 6d c POSIX file nam
4ad0: 65 20 61 6e 64 20 74 68 65 0d 0a 20 20 20 20 20 e and the..
4ae0: 20 20 20 23 20 20 20 20 20 20 20 4d 61 63 20 4f # Mac O
4af0: 53 20 58 20 66 69 6c 65 20 6e 61 6d 65 2c 20 73 S X file name, s
4b00: 69 6e 63 65 20 77 65 20 64 6f 20 6e 6f 74 20 63 ince we do not c
4b10: 75 72 72 65 6e 74 6c 79 20 68 61 76 65 20 61 6e urrently have an
4b20: 20 65 61 73 79 0d 0a 20 20 20 20 20 20 20 20 23 easy.. #
4b30: 20 20 20 20 20 20 20 77 61 79 20 74 6f 20 64 65 way to de
4b40: 74 65 63 74 20 77 68 69 63 68 20 6f 66 20 74 68 tect which of th
4b50: 6f 73 65 20 70 6c 61 74 66 6f 72 6d 73 20 77 65 ose platforms we
4b60: 20 61 72 65 20 72 75 6e 6e 69 6e 67 20 6f 6e 2e are running on.
4b70: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
4b80: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 return [lis
4b90: 74 20 6c 69 62 73 71 6c 69 74 65 33 2e 64 79 6c t libsqlite3.dyl
4ba0: 69 62 20 6c 69 62 73 71 6c 69 74 65 33 2e 73 6f ib libsqlite3.so
4bb0: 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 ].. }..
4bc0: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 }..... proc g
4bd0: 65 74 49 6e 74 65 72 6f 70 41 73 73 65 6d 62 6c etInteropAssembl
4be0: 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 20 7b yFileNamesOnly {
4bf0: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
4c00: 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 72 73 # NOTE: Firs
4c10: 74 2c 20 63 68 65 63 6b 20 69 66 20 74 68 65 20 t, check if the
4c20: 6c 69 73 74 20 6f 66 20 69 6e 74 65 72 6f 70 20 list of interop
4c30: 61 73 73 65 6d 62 6c 79 20 66 69 6c 65 20 6e 61 assembly file na
4c40: 6d 65 73 20 68 61 73 20 62 65 65 6e 0d 0a 20 20 mes has been..
4c50: 20 20 20 20 23 20 20 20 20 20 20 20 6d 61 6e 75 # manu
4c60: 61 6c 6c 79 20 6f 76 65 72 72 69 64 64 65 6e 2e ally overridden.
4c70: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
4c80: 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
4c90: 73 20 3a 3a 69 6e 74 65 72 6f 70 5f 61 73 73 65 s ::interop_asse
4ca0: 6d 62 6c 79 5f 66 69 6c 65 5f 6e 61 6d 65 73 5d mbly_file_names]
4cb0: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
4cc0: 20 5b 6c 6c 65 6e 67 74 68 20 24 3a 3a 69 6e 74 [llength $::int
4cd0: 65 72 6f 70 5f 61 73 73 65 6d 62 6c 79 5f 66 69 erop_assembly_fi
4ce0: 6c 65 5f 6e 61 6d 65 73 5d 20 3e 20 30 7d 20 74 le_names] > 0} t
4cf0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
4d00: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
4d10: 3a 20 54 68 65 20 6c 69 73 74 20 6f 66 20 69 6e : The list of in
4d20: 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 66 terop assembly f
4d30: 69 6c 65 20 6e 61 6d 65 73 20 68 61 73 20 62 65 ile names has be
4d40: 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d 0a en overridden;..
4d50: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
4d60: 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 therefore, use i
4d70: 74 20 76 65 72 62 61 74 69 6d 2e 0d 0a 20 20 20 t verbatim...
4d80: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
4d90: 72 65 74 75 72 6e 20 24 3a 3a 69 6e 74 65 72 6f return $::intero
4da0: 70 5f 61 73 73 65 6d 62 6c 79 5f 66 69 6c 65 5f p_assembly_file_
4db0: 6e 61 6d 65 73 0d 0a 20 20 20 20 20 20 7d 20 65 names.. } e
4dc0: 6c 73 65 69 66 20 7b 5b 69 73 57 69 6e 64 6f 77 lseif {[isWindow
4dd0: 73 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 s]} then {..
4de0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
4df0: 20 4e 4f 54 45 3a 20 4f 74 68 65 72 77 69 73 65 NOTE: Otherwise
4e00: 2c 20 6f 6e 20 57 69 6e 64 6f 77 73 2c 20 61 6c , on Windows, al
4e10: 77 61 79 73 20 75 73 65 20 74 68 65 20 64 65 66 ways use the def
4e20: 61 75 6c 74 20 66 69 6c 65 20 6e 61 6d 65 0d 0a ault file name..
4e30: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
4e40: 22 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f 70 2e "SQLite.Interop.
4e50: 64 6c 6c 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 dll"... #
4e60: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
4e70: 20 5b 6c 69 73 74 20 53 51 4c 69 74 65 2e 49 6e [list SQLite.In
4e80: 74 65 72 6f 70 2e 64 6c 6c 5d 0d 0a 20 20 20 20 terop.dll]..
4e90: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
4ea0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
4eb0: 20 4e 4f 54 45 3a 20 4f 74 68 65 72 77 69 73 65 NOTE: Otherwise
4ec0: 2c 20 72 65 74 75 72 6e 20 62 6f 74 68 20 74 68 , return both th
4ed0: 65 20 67 65 6e 65 72 69 63 20 50 4f 53 49 58 20 e generic POSIX
4ee0: 66 69 6c 65 20 6e 61 6d 65 20 61 6e 64 20 74 68 file name and th
4ef0: 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
4f00: 20 20 20 4d 61 63 20 4f 53 20 58 20 66 69 6c 65 Mac OS X file
4f10: 20 6e 61 6d 65 2c 20 73 69 6e 63 65 20 77 65 20 name, since we
4f20: 64 6f 20 6e 6f 74 20 63 75 72 72 65 6e 74 6c 79 do not currently
4f30: 20 68 61 76 65 20 61 6e 20 65 61 73 79 0d 0a 20 have an easy..
4f40: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 77 # w
4f50: 61 79 20 74 6f 20 64 65 74 65 63 74 20 77 68 69 ay to detect whi
4f60: 63 68 20 6f 66 20 74 68 6f 73 65 20 70 6c 61 74 ch of those plat
4f70: 66 6f 72 6d 73 20 77 65 20 61 72 65 20 72 75 6e forms we are run
4f80: 6e 69 6e 67 20 6f 6e 2e 0d 0a 20 20 20 20 20 20 ning on...
4f90: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
4fa0: 75 72 6e 20 5b 6c 69 73 74 20 6c 69 62 53 51 4c urn [list libSQL
4fb0: 69 74 65 2e 49 6e 74 65 72 6f 70 2e 64 79 6c 69 ite.Interop.dyli
4fc0: 62 20 6c 69 62 53 51 4c 69 74 65 2e 49 6e 74 65 b libSQLite.Inte
4fd0: 72 6f 70 2e 73 6f 5d 0d 0a 20 20 20 20 20 20 7d rop.so].. }
4fe0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
4ff0: 70 72 6f 63 20 67 65 74 43 6f 72 65 45 78 74 65 proc getCoreExte
5000: 6e 73 69 6f 6e 42 69 6e 61 72 79 46 69 6c 65 4e nsionBinaryFileN
5010: 61 6d 65 20 7b 20 7b 64 65 66 61 75 6c 74 20 22 ame { {default "
5020: 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 "} } {.. se
5030: 74 20 66 69 6c 65 4e 61 6d 65 20 5b 67 65 74 43 t fileName [getC
5040: 6f 72 65 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d oreBinaryFileNam
5050: 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b e].... if {
5060: 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 [file exists $fi
5070: 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d leName]} then {.
5080: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
5090: 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 $fileName..
50a0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 }.... retu
50b0: 72 6e 20 24 64 65 66 61 75 6c 74 0d 0a 20 20 20 rn $default..
50c0: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
50d0: 69 73 42 75 69 6c 64 41 76 61 69 6c 61 62 6c 65 isBuildAvailable
50e0: 20 7b 20 6e 61 74 69 76 65 20 64 69 72 65 63 74 { native direct
50f0: 6f 72 79 20 7b 76 61 72 4e 61 6d 65 20 22 22 7d ory {varName ""}
5100: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
5110: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 # NOTE: Bui
5120: 6c 64 20 74 68 65 20 66 75 6c 6c 79 20 71 75 61 ld the fully qua
5130: 6c 69 66 69 65 64 20 66 69 6c 65 20 6e 61 6d 65 lified file name
5140: 20 66 6f 72 20 74 68 65 20 70 72 69 6d 61 72 79 for the primary
5150: 20 61 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 assembly..
5160: 20 23 20 20 20 20 20 20 20 63 6f 6e 74 61 69 6e # contain
5170: 69 6e 67 20 74 68 65 20 53 79 73 74 65 6d 2e 44 ing the System.D
5180: 61 74 61 2e 53 51 4c 69 74 65 20 6d 61 6e 61 67 ata.SQLite manag
5190: 65 64 20 63 6f 6d 70 6f 6e 65 6e 74 73 2e 20 20 ed components.
51a0: 49 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 It.. #
51b0: 20 20 73 68 6f 75 6c 64 20 62 65 20 6e 6f 74 65 should be note
51c0: 64 20 74 68 61 74 20 74 68 69 73 20 61 73 73 65 d that this asse
51d0: 6d 62 6c 79 20 66 69 6c 65 20 6d 61 79 20 61 6c mbly file may al
51e0: 73 6f 20 63 6f 6e 74 61 69 6e 20 74 68 65 0d 0a so contain the..
51f0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6e 61 # na
5200: 74 69 76 65 20 63 6f 6d 70 6f 6e 65 6e 74 73 2c tive components,
5210: 20 69 66 20 61 20 6e 61 74 69 76 65 20 62 75 69 if a native bui
5220: 6c 64 20 69 73 20 69 6e 20 75 73 65 2e 0d 0a 20 ld is in use...
5230: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 #.. se
5240: 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 t fileName [file
5250: 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c nativename [fil
5260: 65 20 6a 6f 69 6e 20 24 64 69 72 65 63 74 6f 72 e join $director
5270: 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 53 y \.. S
5280: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
5290: 65 2e 64 6c 6c 5d 5d 0d 0a 0d 0a 20 20 20 20 20 e.dll]]....
52a0: 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 if {![file exis
52b0: 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 ts $fileName]} t
52c0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 hen {.. r
52d0: 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 eturn false..
52e0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
52f0: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 . # NOTE: A
5300: 74 74 65 6d 70 74 20 74 6f 20 61 75 74 6f 6d 61 ttempt to automa
5310: 74 69 63 61 6c 6c 79 20 64 65 74 65 63 74 20 69 tically detect i
5320: 66 20 74 68 65 20 70 72 69 6d 61 72 79 20 61 73 f the primary as
5330: 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 20 23 20 sembly.. #
5340: 20 20 20 20 20 20 63 6f 6e 74 61 69 6e 73 20 61 contains a
5350: 6e 79 20 6e 61 74 69 76 65 20 63 6f 6d 70 6f 6e ny native compon
5360: 65 6e 74 73 2c 20 69 66 20 6e 65 63 65 73 73 61 ents, if necessa
5370: 72 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ry... #..
5380: 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
5390: 6c 65 6e 67 74 68 20 24 6e 61 74 69 76 65 5d 20 length $native]
53a0: 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
53b0: 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
53c0: 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 6d g length $varNam
53d0: 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a e] > 0} then {..
53e0: 20 20 20 20 20 20 20 20 20 20 75 70 76 61 72 20 upvar
53f0: 31 20 24 76 61 72 4e 61 6d 65 20 24 76 61 72 4e 1 $varName $varN
5400: 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a ame.. }..
5410: 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 6e 61 .. set na
5420: 74 69 76 65 20 5b 69 73 4d 69 78 65 64 4d 6f 64 tive [isMixedMod
5430: 65 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e eAssembly $fileN
5440: 61 6d 65 20 24 76 61 72 4e 61 6d 65 5d 0d 0a 20 ame $varName]..
5450: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
5460: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
5470: 20 49 66 20 74 68 65 20 70 72 69 6d 61 72 79 20 If the primary
5480: 61 73 73 65 6d 62 6c 79 20 61 6c 73 6f 20 63 6f assembly also co
5490: 6e 74 61 69 6e 73 20 74 68 65 20 6e 61 74 69 76 ntains the nativ
54a0: 65 20 63 6f 6d 70 6f 6e 65 6e 74 73 2c 0d 0a 20 e components,..
54b0: 20 20 20 20 20 23 20 20 20 20 20 20 20 77 65 20 # we
54c0: 68 61 76 65 20 65 76 65 72 79 74 68 69 6e 67 20 have everything
54d0: 77 65 20 6e 65 65 64 2e 0d 0a 20 20 20 20 20 20 we need...
54e0: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 6e 61 #.. if {$na
54f0: 74 69 76 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 tive} then {..
5500: 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
5510: 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 e.. }....
5520: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
5530: 4f 54 45 3a 20 57 68 61 74 20 69 73 20 74 68 65 OTE: What is the
5540: 20 61 72 63 68 69 74 65 63 74 75 72 65 20 66 6f architecture fo
5550: 72 20 74 68 69 73 20 6d 61 63 68 69 6e 65 3f 0d r this machine?.
5560: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
5570: 73 65 74 20 61 72 63 68 69 74 65 63 74 75 72 65 set architecture
5580: 20 5b 6d 61 63 68 69 6e 65 54 6f 50 6c 61 74 66 [machineToPlatf
5590: 6f 72 6d 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 orm $::tcl_platf
55a0: 6f 72 6d 28 6d 61 63 68 69 6e 65 29 20 74 72 75 orm(machine) tru
55b0: 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 e].... #..
55c0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 68 61 # NOTE: Wha
55d0: 74 20 69 73 20 74 68 65 20 70 6c 61 74 66 6f 72 t is the platfor
55e0: 6d 20 66 6f 72 20 74 68 69 73 20 6d 61 63 68 69 m for this machi
55f0: 6e 65 3f 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ne?.. #..
5600: 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d set platform
5610: 20 5b 6d 61 63 68 69 6e 65 54 6f 50 6c 61 74 66 [machineToPlatf
5620: 6f 72 6d 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 orm $::tcl_platf
5630: 6f 72 6d 28 6d 61 63 68 69 6e 65 29 5d 0d 0a 0d orm(machine)]...
5640: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
5650: 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 # NOTE: Build th
5660: 65 20 66 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 e fully qualifie
5670: 64 20 66 69 6c 65 20 6e 61 6d 65 20 66 6f 72 20 d file name for
5680: 74 68 65 20 69 6e 74 65 72 6f 70 20 61 73 73 65 the interop asse
5690: 6d 62 6c 79 0d 0a 20 20 20 20 20 20 23 20 20 20 mbly.. #
56a0: 20 20 20 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 containing t
56b0: 68 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 he System.Data.S
56c0: 51 4c 69 74 65 20 6e 61 74 69 76 65 20 63 6f 6d QLite native com
56d0: 70 6f 6e 65 6e 74 73 2e 20 20 49 66 20 74 68 69 ponents. If thi
56e0: 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 s.. #
56f0: 20 66 69 6c 65 20 65 78 69 73 74 73 2c 20 77 65 file exists, we
5700: 20 73 68 6f 75 6c 64 20 68 61 76 65 20 65 76 65 should have eve
5710: 72 79 74 68 69 6e 67 20 77 65 20 6e 65 65 64 2e rything we need.
5720: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
5730: 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d foreach fileNam
5740: 65 4f 6e 6c 79 20 5b 67 65 74 49 6e 74 65 72 6f eOnly [getIntero
5750: 70 41 73 73 65 6d 62 6c 79 46 69 6c 65 4e 61 6d pAssemblyFileNam
5760: 65 73 4f 6e 6c 79 5d 20 7b 0d 0a 20 20 20 20 20 esOnly] {..
5770: 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 set fileName
5780: 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
5790: 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 [file join $dir
57a0: 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 ectory \..
57b0: 20 20 20 20 20 20 24 61 72 63 68 69 74 65 63 74 $architect
57c0: 75 72 65 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c ure $fileNameOnl
57d0: 79 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 y]].... i
57e0: 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 f {[file exists
57f0: 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e $fileName]} then
5800: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 {.. re
5810: 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 turn true..
5820: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
5830: 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 set fileName [fi
5840: 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 le nativename [f
5850: 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 65 63 74 ile join $direct
5860: 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ory \..
5870: 20 20 20 24 70 6c 61 74 66 6f 72 6d 20 24 66 69 $platform $fi
5880: 6c 65 4e 61 6d 65 4f 6e 6c 79 5d 5d 0d 0a 0d 0a leNameOnly]]....
5890: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c if {[fil
58a0: 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 e exists $fileNa
58b0: 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 me]} then {..
58c0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
58d0: 75 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d ue.. }...
58e0: 0a 20 20 20 20 20 20 20 20 73 65 74 20 66 69 6c . set fil
58f0: 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6e 61 74 69 eName [file nati
5900: 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 vename [file joi
5910: 6e 20 24 64 69 72 65 63 74 6f 72 79 20 5c 0d 0a n $directory \..
5920: 20 20 20 20 20 20 20 20 20 20 20 20 24 66 69 6c $fil
5930: 65 4e 61 6d 65 4f 6e 6c 79 5d 5d 0d 0a 0d 0a 20 eNameOnly]]....
5940: 20 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 if {[file
5950: 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d exists $fileNam
5960: 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
5970: 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
5980: 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 e.. }..
5990: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 }.... #
59a0: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
59b0: 42 75 69 6c 64 20 74 68 65 20 66 75 6c 6c 79 20 Build the fully
59c0: 71 75 61 6c 69 66 69 65 64 20 66 69 6c 65 20 6e qualified file n
59d0: 61 6d 65 20 66 6f 72 20 74 68 65 20 53 51 4c 69 ame for the SQLi
59e0: 74 65 20 63 6f 72 65 0d 0a 20 20 20 20 20 20 23 te core.. #
59f0: 20 20 20 20 20 20 20 6c 69 62 72 61 72 79 2e 20 library.
5a00: 20 49 66 20 74 68 69 73 20 66 69 6c 65 20 65 78 If this file ex
5a10: 69 73 74 73 2c 20 77 65 20 73 68 6f 75 6c 64 20 ists, we should
5a20: 68 61 76 65 20 65 76 65 72 79 74 68 69 6e 67 20 have everything
5a30: 77 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 we.. #
5a40: 20 20 6e 65 65 64 2e 0d 0a 20 20 20 20 20 20 23 need... #
5a50: 0d 0a 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 .. foreach
5a60: 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 5b 67 65 fileNameOnly [ge
5a70: 74 4e 61 74 69 76 65 4c 69 62 72 61 72 79 46 69 tNativeLibraryFi
5a80: 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d 20 7b 0d 0a leNamesOnly] {..
5a90: 20 20 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 set file
5aa0: 4e 61 6d 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 Name [file nativ
5ab0: 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
5ac0: 20 24 64 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 $directory \..
5ad0: 20 20 20 20 20 20 20 20 20 20 20 24 61 72 63 68 $arch
5ae0: 69 74 65 63 74 75 72 65 20 24 66 69 6c 65 4e 61 itecture $fileNa
5af0: 6d 65 4f 6e 6c 79 5d 5d 0d 0a 0d 0a 20 20 20 20 meOnly]]....
5b00: 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 if {[file ex
5b10: 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d ists $fileName]}
5b20: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
5b30: 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a return true..
5b40: 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
5b50: 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d set fileNam
5b60: 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 e [file nativena
5b70: 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 me [file join $d
5b80: 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 irectory \..
5b90: 20 20 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 $platfor
5ba0: 6d 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d m $fileNameOnly]
5bb0: 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 ].... if
5bc0: 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 {[file exists $f
5bd0: 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b ileName]} then {
5be0: 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 .. retu
5bf0: 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 20 rn true..
5c00: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 }.... se
5c10: 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 t fileName [file
5c20: 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c nativename [fil
5c30: 65 20 6a 6f 69 6e 20 24 64 69 72 65 63 74 6f 72 e join $director
5c40: 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 y \..
5c50: 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d 5d $fileNameOnly]]
5c60: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
5c70: 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 [file exists $fi
5c80: 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d leName]} then {.
5c90: 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 . retur
5ca0: 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 20 20 n true..
5cb0: 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
5cc0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
5cd0: 4f 54 45 3a 20 4f 6e 65 20 6f 72 20 6d 6f 72 65 OTE: One or more
5ce0: 20 6e 61 74 69 76 65 20 63 6f 6d 70 6f 6e 65 6e native componen
5cf0: 74 73 20 6e 65 65 64 65 64 20 62 79 20 53 79 73 ts needed by Sys
5d00: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 0d tem.Data.SQLite.
5d10: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 . # a
5d20: 72 65 20 6d 69 73 73 69 6e 67 2e 0d 0a 20 20 20 re missing...
5d30: 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 #.. retu
5d40: 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 7d 0d rn false.. }.
5d50: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 69 73 52 .... proc isR
5d60: 65 6c 65 61 73 65 41 76 61 69 6c 61 62 6c 65 20 eleaseAvailable
5d70: 7b 20 64 69 72 65 63 74 6f 72 79 20 7b 76 61 72 { directory {var
5d80: 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 Name ""} } {..
5d90: 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
5da0: 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 6d 65 5d length $varName]
5db0: 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
5dc0: 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 76 upvar 1 $v
5dd0: 61 72 4e 61 6d 65 20 24 76 61 72 4e 61 6d 65 0d arName $varName.
5de0: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
5df0: 20 20 72 65 74 75 72 6e 20 5b 69 73 42 75 69 6c return [isBuil
5e00: 64 41 76 61 69 6c 61 62 6c 65 20 22 22 20 24 64 dAvailable "" $d
5e10: 69 72 65 63 74 6f 72 79 20 24 76 61 72 4e 61 6d irectory $varNam
5e20: 65 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 e].. }.....
5e30: 20 20 70 72 6f 63 20 6a 6f 69 6e 42 75 69 6c 64 proc joinBuild
5e40: 44 69 72 65 63 74 6f 72 79 20 7b 20 6e 61 74 69 Directory { nati
5e50: 76 65 20 70 61 74 68 20 79 65 61 72 20 70 6c 61 ve path year pla
5e60: 74 66 6f 72 6d 20 63 6f 6e 66 69 67 75 72 61 74 tform configurat
5e70: 69 6f 6e 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ion } {.. #
5e80: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
5e90: 46 69 67 75 72 65 20 6f 75 74 20 61 6e 64 20 74 Figure out and t
5ea0: 68 65 6e 20 72 65 74 75 72 6e 20 74 68 65 20 66 hen return the f
5eb0: 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 20 70 ully qualified p
5ec0: 61 74 68 20 74 6f 20 74 68 65 20 62 75 69 6c 64 ath to the build
5ed0: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
5ee0: 64 69 72 65 63 74 6f 72 79 20 62 61 73 65 64 20 directory based
5ef0: 6f 6e 20 61 6c 6c 20 74 68 65 20 61 72 67 75 6d on all the argum
5f00: 65 6e 74 73 20 70 72 6f 76 69 64 65 64 20 62 79 ents provided by
5f10: 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d 0a 20 20 our caller...
5f20: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
5f30: 7b 24 6e 61 74 69 76 65 7d 20 74 68 65 6e 20 7b {$native} then {
5f40: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
5f50: 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 70 61 74 [file join $pat
5f60: 68 20 62 69 6e 20 24 79 65 61 72 20 24 70 6c 61 h bin $year $pla
5f70: 74 66 6f 72 6d 20 24 63 6f 6e 66 69 67 75 72 61 tform $configura
5f80: 74 69 6f 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 65 tion].. } e
5f90: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 lse {.. r
5fa0: 65 74 75 72 6e 20 5b 66 69 6c 65 20 6a 6f 69 6e eturn [file join
5fb0: 20 24 70 61 74 68 20 62 69 6e 20 24 79 65 61 72 $path bin $year
5fc0: 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 $configuration
5fd0: 62 69 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 bin].. }..
5fe0: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
5ff0: 63 20 67 65 74 42 75 69 6c 64 44 69 72 65 63 74 c getBuildDirect
6000: 6f 72 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 ory {} {..
6010: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
6020: 20 53 65 65 20 69 66 20 74 68 65 20 22 6e 61 74 See if the "nat
6030: 69 76 65 22 20 72 75 6e 74 69 6d 65 20 6f 70 74 ive" runtime opt
6040: 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 73 65 74 ion has been set
6050: 2e 20 20 49 66 20 73 6f 2c 20 75 73 65 20 74 68 . If so, use th
6060: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
6070: 20 64 69 72 65 63 74 6f 72 79 20 66 6f 72 20 74 directory for t
6080: 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 he mixed-mode as
6090: 73 65 6d 62 6c 79 20 28 61 2e 6b 2e 61 2e 20 74 sembly (a.k.a. t
60a0: 68 65 20 6e 61 74 69 76 65 20 69 6e 74 65 72 6f he native intero
60b0: 70 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 p.. #
60c0: 20 61 73 73 65 6d 62 6c 79 29 2e 20 20 54 6f 20 assembly). To
60d0: 65 6e 61 62 6c 65 20 74 68 69 73 20 6f 70 74 69 enable this opti
60e0: 6f 6e 20 76 69 61 20 74 68 65 20 63 6f 6d 6d 61 on via the comma
60f0: 6e 64 20 6c 69 6e 65 2c 20 65 6e 74 65 72 20 61 nd line, enter a
6100: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
6110: 63 6f 6d 6d 61 6e 64 20 73 69 6d 69 6c 61 72 20 command similar
6120: 74 6f 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 6f to one of the fo
6130: 6c 6c 6f 77 69 6e 67 20 28 61 6c 6c 20 6f 6e 20 llowing (all on
6140: 6f 6e 65 20 6c 69 6e 65 29 3a 0d 0a 20 20 20 20 one line):..
6150: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 20 #.. #
6160: 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 EagleShell.ex
6170: 65 20 2d 69 6e 69 74 69 61 6c 69 7a 65 20 2d 72 e -initialize -r
6180: 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 untimeOption nat
6190: 69 76 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 ive.. #
61a0: 20 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 -file .\pat
61b0: 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a h\to\all.eagle..
61c0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
61d0: 20 20 20 20 20 20 20 54 6f 20 65 6e 61 62 6c 65 To enable
61e0: 20 74 68 69 73 20 6f 70 74 69 6f 6e 20 76 69 61 this option via
61f0: 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e the command lin
6200: 65 20 70 72 69 6f 72 20 74 6f 20 74 68 65 20 22 e prior to the "
6210: 62 65 74 61 20 31 36 22 0d 0a 20 20 20 20 20 20 beta 16"..
6220: 23 20 20 20 20 20 20 20 72 65 6c 65 61 73 65 20 # release
6230: 6f 66 20 45 61 67 6c 65 2c 20 74 68 65 20 66 6f of Eagle, the fo
6240: 6c 6c 6f 77 69 6e 67 20 63 6f 6d 6d 61 6e 64 20 llowing command
6250: 6d 75 73 74 20 62 65 20 75 73 65 64 20 69 6e 73 must be used ins
6260: 74 65 61 64 0d 0a 20 20 20 20 20 20 23 20 20 20 tead.. #
6270: 20 20 20 20 28 61 6c 73 6f 20 61 6c 6c 20 6f 6e (also all on
6280: 20 6f 6e 65 20 6c 69 6e 65 29 3a 0d 0a 20 20 20 one line):..
6290: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 #.. #
62a0: 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 EagleShell.e
62b0: 78 65 20 2d 69 6e 69 74 69 61 6c 69 7a 65 20 2d xe -initialize -
62c0: 70 6f 73 74 49 6e 69 74 69 61 6c 69 7a 65 0d 0a postInitialize..
62d0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 #
62e0: 22 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 49 "object invoke I
62f0: 6e 74 65 72 70 72 65 74 65 72 2e 47 65 74 41 63 nterpreter.GetAc
6300: 74 69 76 65 20 41 64 64 52 75 6e 74 69 6d 65 4f tive AddRuntimeO
6310: 70 74 69 6f 6e 20 6e 61 74 69 76 65 22 0d 0a 20 ption native"..
6320: 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 2d # -
6330: 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 file .\path\to\a
6340: 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 20 20 20 ll.eagle..
6350: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e #.. if {[in
6360: 66 6f 20 65 78 69 73 74 73 20 3a 3a 62 75 69 6c fo exists ::buil
6370: 64 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 26 20 d_directory] &&
6380: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 \.. [st
6390: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 62 ring length $::b
63a0: 75 69 6c 64 5f 64 69 72 65 63 74 6f 72 79 5d 20 uild_directory]
63b0: 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
63c0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
63d0: 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 # NOTE: The loca
63e0: 74 69 6f 6e 20 6f 66 20 74 68 65 20 62 75 69 6c tion of the buil
63f0: 64 20 64 69 72 65 63 74 6f 72 79 20 68 61 73 20 d directory has
6400: 62 65 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b been overridden;
6410: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
6420: 20 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 therefore, use
6430: 20 69 74 20 76 65 72 62 61 74 69 6d 2e 0d 0a 20 it verbatim...
6440: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
6450: 20 20 72 65 74 75 72 6e 20 24 3a 3a 62 75 69 6c return $::buil
6460: 64 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 d_directory..
6470: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
6480: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
6490: 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 22 # NOTE: If the "
64a0: 6e 61 74 69 76 65 22 20 72 75 6e 74 69 6d 65 20 native" runtime
64b0: 6f 70 74 69 6f 6e 20 69 73 20 73 65 74 2c 20 74 option is set, t
64c0: 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 he mixed-mode as
64d0: 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 20 20 20 sembly..
64e0: 23 20 20 20 20 20 20 20 69 73 20 62 65 69 6e 67 # is being
64f0: 20 74 65 73 74 65 64 2e 20 20 49 6e 20 74 68 61 tested. In tha
6500: 74 20 63 61 73 65 2c 20 74 68 65 20 70 61 74 68 t case, the path
6510: 20 74 6f 20 74 68 65 20 62 75 69 6c 64 20 64 69 to the build di
6520: 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 20 rectory..
6530: 20 23 20 20 20 20 20 20 20 77 69 6c 6c 20 63 6f # will co
6540: 6e 74 61 69 6e 20 74 68 65 20 70 6c 61 74 66 6f ntain the platfo
6550: 72 6d 20 6e 61 6d 65 20 61 6e 64 20 61 6c 6c 20 rm name and all
6560: 74 68 65 20 62 69 6e 61 72 69 65 73 20 75 6e 64 the binaries und
6570: 65 72 20 74 65 73 74 0d 0a 20 20 20 20 20 20 20 er test..
6580: 20 23 20 20 20 20 20 20 20 73 68 6f 75 6c 64 20 # should
6590: 62 65 20 70 72 65 73 65 6e 74 20 69 6e 20 74 68 be present in th
65a0: 61 74 20 64 69 72 65 63 74 6f 72 79 2e 20 20 49 at directory. I
65b0: 66 20 74 68 65 20 22 6e 61 74 69 76 65 22 20 72 f the "native" r
65c0: 75 6e 74 69 6d 65 0d 0a 20 20 20 20 20 20 20 20 untime..
65d0: 23 20 20 20 20 20 20 20 6f 70 74 69 6f 6e 20 69 # option i
65e0: 73 20 6e 6f 74 20 73 65 74 2c 20 74 68 65 20 62 s not set, the b
65f0: 75 69 6c 64 20 64 69 72 65 63 74 6f 72 79 20 77 uild directory w
6600: 69 6c 6c 20 62 65 20 63 6f 6e 73 69 64 65 72 65 ill be considere
6610: 64 20 74 6f 20 62 65 0d 0a 20 20 20 20 20 20 20 d to be..
6620: 20 23 20 20 20 20 20 20 20 22 70 6c 61 74 66 6f # "platfo
6630: 72 6d 2d 6e 65 75 74 72 61 6c 22 2c 20 77 69 74 rm-neutral", wit
6640: 68 20 74 68 65 20 6e 6f 74 61 62 6c 65 20 65 78 h the notable ex
6650: 63 65 70 74 69 6f 6e 20 6f 66 20 61 6e 79 20 6e ception of any n
6660: 61 74 69 76 65 0d 0a 20 20 20 20 20 20 20 20 23 ative.. #
6670: 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c 79 20 assembly
6680: 28 65 2e 67 2e 20 22 53 51 4c 69 74 65 2e 49 6e (e.g. "SQLite.In
6690: 74 65 72 6f 70 2e 64 6c 6c 22 29 20 63 6f 70 69 terop.dll") copi
66a0: 65 64 20 74 68 65 72 65 20 64 75 72 69 6e 67 20 ed there during
66b0: 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 the.. #
66c0: 20 20 20 20 20 62 75 69 6c 64 20 70 72 6f 63 65 build proce
66d0: 73 73 20 69 74 73 65 6c 66 2e 20 20 49 66 20 74 ss itself. If t
66e0: 68 65 20 62 75 69 6c 64 20 70 72 6f 63 65 73 73 he build process
66f0: 20 73 6f 6d 65 68 6f 77 20 64 6f 65 73 20 6e 6f somehow does no
6700: 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 t.. #
6710: 20 20 20 63 6f 70 79 20 74 68 65 20 6e 61 74 69 copy the nati
6720: 76 65 20 61 73 73 65 6d 62 6c 79 20 66 6f 72 20 ve assembly for
6730: 74 68 69 73 20 70 6c 61 74 66 6f 72 6d 2c 20 6d this platform, m
6740: 6f 73 74 20 6f 66 20 74 68 65 20 74 65 73 74 73 ost of the tests
6750: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
6760: 20 20 69 6e 20 74 68 65 20 73 75 69 74 65 20 77 in the suite w
6770: 69 6c 6c 20 73 69 6d 70 6c 79 20 62 65 20 73 6b ill simply be sk
6780: 69 70 70 65 64 2e 20 20 47 65 6e 65 72 61 6c 6c ipped. Generall
6790: 79 20 73 70 65 61 6b 69 6e 67 2c 20 74 68 65 72 y speaking, ther
67a0: 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
67b0: 20 20 20 61 72 65 20 74 77 6f 20 77 61 79 73 20 are two ways
67c0: 74 6f 20 62 75 69 6c 64 20 74 68 65 20 62 69 6e to build the bin
67d0: 61 72 69 65 73 20 77 68 65 6e 20 70 72 65 70 61 aries when prepa
67e0: 72 69 6e 67 20 74 6f 20 72 75 6e 20 74 68 65 0d ring to run the.
67f0: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
6800: 20 74 65 73 74 20 73 75 69 74 65 3a 0d 0a 20 20 test suite:..
6810: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
6820: 20 23 20 20 20 20 20 20 20 31 2e 20 42 75 69 6c # 1. Buil
6830: 64 20 74 68 65 20 73 65 70 61 72 61 74 65 20 6d d the separate m
6840: 61 6e 61 67 65 64 20 61 6e 64 20 6e 61 74 69 76 anaged and nativ
6850: 65 20 61 73 73 65 6d 62 6c 69 65 73 20 75 73 69 e assemblies usi
6860: 6e 67 20 73 6f 6d 65 0d 0a 20 20 20 20 20 20 20 ng some..
6870: 20 23 20 20 20 20 20 20 20 20 20 20 63 6f 6d 6d # comm
6880: 61 6e 64 73 20 73 69 6d 69 6c 61 72 20 74 6f 3a ands similar to:
6890: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
68a0: 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 #
68b0: 62 75 69 6c 64 2e 62 61 74 20 24 7b 43 6f 6e 66 build.bat ${Conf
68c0: 69 67 75 72 61 74 69 6f 6e 7d 4d 61 6e 61 67 65 iguration}Manage
68d0: 64 4f 6e 6c 79 20 24 7b 50 6c 61 74 66 6f 72 6d dOnly ${Platform
68e0: 7d 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 }.. #
68f0: 20 20 20 20 20 20 62 75 69 6c 64 2e 62 61 74 20 build.bat
6900: 24 7b 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 7d ${Configuration}
6910: 4e 61 74 69 76 65 4f 6e 6c 79 20 24 7b 50 6c 61 NativeOnly ${Pla
6920: 74 66 6f 72 6d 7d 0d 0a 20 20 20 20 20 20 20 20 tform}..
6930: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 #.. #
6940: 20 20 20 20 20 20 57 68 65 72 65 20 24 7b 43 6f Where ${Co
6950: 6e 66 69 67 75 72 61 74 69 6f 6e 7d 20 69 73 20 nfiguration} is
6960: 65 69 74 68 65 72 20 22 44 65 62 75 67 22 20 6f either "Debug" o
6970: 72 20 22 52 65 6c 65 61 73 65 22 20 61 6e 64 0d r "Release" and.
6980: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
6990: 20 20 20 20 24 7b 50 6c 61 74 66 6f 72 6d 7d 20 ${Platform}
69a0: 69 73 20 65 69 74 68 65 72 20 22 57 69 6e 33 32 is either "Win32
69b0: 22 20 6f 72 20 22 78 36 34 22 2e 0d 0a 20 20 20 " or "x64"...
69c0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
69d0: 23 20 20 20 20 20 20 20 32 2e 20 42 75 69 6c 64 # 2. Build
69e0: 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 the mixed-mode
69f0: 61 73 73 65 6d 62 6c 79 20 75 73 69 6e 67 20 61 assembly using a
6a00: 20 63 6f 6d 6d 61 6e 64 20 73 69 6d 69 6c 61 72 command similar
6a10: 20 74 6f 3a 0d 0a 20 20 20 20 20 20 20 20 23 0d to:.. #.
6a20: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
6a30: 20 20 20 20 62 75 69 6c 64 2e 62 61 74 20 24 7b build.bat ${
6a40: 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 7d 20 24 Configuration} $
6a50: 7b 50 6c 61 74 66 6f 72 6d 7d 0d 0a 20 20 20 20 {Platform}..
6a60: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
6a70: 20 20 20 20 20 20 20 20 20 20 57 68 65 72 65 20 Where
6a80: 24 7b 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 7d ${Configuration}
6a90: 20 69 73 20 65 69 74 68 65 72 20 22 44 65 62 75 is either "Debu
6aa0: 67 22 20 6f 72 20 22 52 65 6c 65 61 73 65 22 20 g" or "Release"
6ab0: 61 6e 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 and.. #
6ac0: 20 20 20 20 20 20 20 20 24 7b 50 6c 61 74 66 6f ${Platfo
6ad0: 72 6d 7d 20 69 73 20 65 69 74 68 65 72 20 22 57 rm} is either "W
6ae0: 69 6e 33 32 22 20 6f 72 20 22 78 36 34 22 2e 20 in32" or "x64".
6af0: 20 49 66 20 74 68 69 73 20 63 6f 6d 6d 61 6e 64 If this command
6b00: 20 69 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 is.. #
6b10: 20 20 20 20 20 20 20 20 75 73 65 64 2c 20 76 61 used, va
6b20: 72 69 6f 75 73 20 74 65 73 74 73 20 74 68 61 74 rious tests that
6b30: 20 72 65 71 75 69 72 65 20 73 75 70 70 6c 65 6d require supplem
6b40: 65 6e 74 61 72 79 20 6d 61 6e 61 67 65 64 0d 0a entary managed..
6b50: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
6b60: 20 20 20 61 73 73 65 6d 62 6c 69 65 73 20 28 65 assemblies (e
6b70: 2e 67 2e 20 4c 49 4e 51 29 20 6d 61 79 20 62 65 .g. LINQ) may be
6b80: 20 73 6b 69 70 70 65 64 20 75 6e 6c 65 73 73 20 skipped unless
6b90: 74 68 6f 73 65 20 62 69 6e 61 72 69 65 73 0d 0a those binaries..
6ba0: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
6bb0: 20 20 20 61 72 65 20 73 75 62 73 65 71 75 65 6e are subsequen
6bc0: 74 6c 79 20 63 6f 70 69 65 64 20 69 6e 74 6f 20 tly copied into
6bd0: 74 68 65 20 63 6f 72 72 65 63 74 20 64 69 72 65 the correct dire
6be0: 63 74 6f 72 79 20 28 69 2e 65 2e 20 62 79 0d 0a ctory (i.e. by..
6bf0: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
6c00: 20 20 20 22 74 65 73 74 5f 61 6c 6c 2e 62 61 74 "test_all.bat
6c10: 22 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ")... #..
6c20: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
6c30: 4e 6f 74 65 20 74 68 61 74 20 61 6c 6c 20 6f 66 Note that all of
6c40: 20 74 68 65 20 62 75 69 6c 64 20 63 6f 6d 6d 61 the build comma
6c50: 6e 64 73 20 61 62 6f 76 65 20 77 69 6c 6c 20 64 nds above will d
6c60: 65 66 61 75 6c 74 20 74 6f 20 75 73 69 6e 67 0d efault to using.
6c70: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
6c80: 20 74 68 65 20 6c 61 74 65 73 74 20 76 65 72 73 the latest vers
6c90: 69 6f 6e 20 6f 66 20 4d 53 42 75 69 6c 64 20 61 ion of MSBuild a
6ca0: 76 61 69 6c 61 62 6c 65 20 61 6e 64 20 74 68 65 vailable and the
6cb0: 20 22 74 65 73 74 5f 79 65 61 72 22 20 6d 61 79 "test_year" may
6cc0: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
6cd0: 20 20 6e 65 65 64 20 74 6f 20 62 65 20 61 64 6a need to be adj
6ce0: 75 73 74 65 64 20 61 63 63 6f 72 64 69 6e 67 6c usted accordingl
6cf0: 79 20 74 6f 20 61 63 74 75 61 6c 6c 79 20 72 75 y to actually ru
6d00: 6e 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 n the test suite
6d10: 2e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 ... #
6d20: 20 20 20 52 65 66 65 72 20 74 6f 20 74 68 65 20 Refer to the
6d30: 63 6f 6d 6d 65 6e 74 73 20 69 6e 20 5b 67 65 74 comments in [get
6d40: 42 75 69 6c 64 59 65 61 72 5d 20 66 6f 72 20 6d BuildYear] for m
6d50: 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 ore information
6d60: 6f 6e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 on.. #
6d70: 20 20 20 20 68 6f 77 20 74 6f 20 73 65 74 20 74 how to set t
6d80: 68 69 73 20 76 61 72 69 61 62 6c 65 2e 0d 0a 20 his variable...
6d90: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
6da0: 20 20 73 65 74 20 6e 61 74 69 76 65 20 5b 68 61 set native [ha
6db0: 73 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 6e sRuntimeOption n
6dc0: 61 74 69 76 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 ative]....
6dd0: 20 20 72 65 74 75 72 6e 20 5b 6a 6f 69 6e 42 75 return [joinBu
6de0: 69 6c 64 44 69 72 65 63 74 6f 72 79 20 24 6e 61 ildDirectory $na
6df0: 74 69 76 65 20 5b 67 65 74 42 75 69 6c 64 42 61 tive [getBuildBa
6e00: 73 65 44 69 72 65 63 74 6f 72 79 5d 20 5c 0d 0a seDirectory] \..
6e10: 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
6e20: 42 75 69 6c 64 59 65 61 72 5d 20 5b 67 65 74 42 BuildYear] [getB
6e30: 75 69 6c 64 50 6c 61 74 66 6f 72 6d 20 24 6e 61 uildPlatform $na
6e40: 74 69 76 65 5d 20 5b 67 65 74 42 75 69 6c 64 43 tive] [getBuildC
6e50: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5d 5d 0d 0a onfiguration]]..
6e60: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
6e70: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 52 ... proc getR
6e80: 65 6c 65 61 73 65 56 65 72 73 69 6f 6e 20 7b 7d eleaseVersion {}
6e90: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
6ea0: 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 67 75 72 # NOTE: Figur
6eb0: 65 20 6f 75 74 20 74 68 65 20 72 65 6c 65 61 73 e out the releas
6ec0: 65 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 75 73 e version for us
6ed0: 65 20 77 69 74 68 20 74 68 65 20 62 75 69 6c 64 e with the build
6ee0: 20 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 directory..
6ef0: 20 20 23 20 20 20 20 20 20 20 77 68 65 6e 20 63 # when c
6f00: 68 65 63 6b 69 6e 67 20 66 6f 72 20 61 76 61 69 hecking for avai
6f10: 6c 61 62 6c 65 20 72 65 6c 65 61 73 65 73 2e 0d lable releases..
6f20: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
6f30: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
6f40: 20 3a 3a 72 65 6c 65 61 73 65 5f 76 65 72 73 69 ::release_versi
6f50: 6f 6e 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 on] && \..
6f60: 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 [string leng
6f70: 74 68 20 24 3a 3a 72 65 6c 65 61 73 65 5f 76 65 th $::release_ve
6f80: 72 73 69 6f 6e 5d 20 3e 20 30 7d 20 74 68 65 6e rsion] > 0} then
6f90: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
6fa0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 # NOTE: T
6fb0: 68 65 20 72 65 6c 65 61 73 65 20 76 65 72 73 69 he release versi
6fc0: 6f 6e 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 on has been over
6fd0: 72 69 64 64 65 6e 3b 20 74 68 65 72 65 66 6f 72 ridden; therefor
6fe0: 65 2c 20 75 73 65 20 69 74 0d 0a 20 20 20 20 20 e, use it..
6ff0: 20 20 20 23 20 20 20 20 20 20 20 76 65 72 62 61 # verba
7000: 74 69 6d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d tim... #.
7010: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
7020: 24 3a 3a 72 65 6c 65 61 73 65 5f 76 65 72 73 69 $::release_versi
7030: 6f 6e 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 on.. } else
7040: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
7050: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4e # NOTE: N
7060: 6f 20 72 65 6c 65 61 73 65 20 76 65 72 73 69 6f o release versio
7070: 6e 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2c 20 n is available,
7080: 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 return an empty
7090: 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 20 string...
70a0: 20 23 20 20 20 20 20 20 20 49 74 20 69 73 20 69 # It is i
70b0: 6d 70 6f 72 74 61 6e 74 20 74 6f 20 72 65 74 75 mportant to retu
70c0: 72 6e 20 61 6e 20 65 6d 70 74 79 20 73 74 72 69 rn an empty stri
70d0: 6e 67 20 68 65 72 65 20 62 65 63 61 75 73 65 20 ng here because
70e0: 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 the.. #
70f0: 20 20 20 20 20 72 65 73 75 6c 74 20 6f 66 20 74 result of t
7100: 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 6d 61 his procedure ma
7110: 79 20 62 65 20 75 73 65 64 20 77 69 74 68 20 5b y be used with [
7120: 66 69 6c 65 20 6a 6f 69 6e 5d 2e 0d 0a 20 20 20 file join]...
7130: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
7140: 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 20 return ""..
7150: 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
7160: 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 46 proc getBuildF
7170: 69 6c 65 4e 61 6d 65 20 7b 20 66 69 6c 65 4e 61 ileName { fileNa
7180: 6d 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d me {platform ""}
7190: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
71a0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 # NOTE: Ret
71b0: 75 72 6e 73 20 74 68 65 20 73 70 65 63 69 66 69 urns the specifi
71c0: 65 64 20 66 69 6c 65 20 6e 61 6d 65 20 61 73 20 ed file name as
71d0: 69 66 20 69 74 20 77 65 72 65 20 6c 6f 63 61 74 if it were locat
71e0: 65 64 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 ed in the..
71f0: 20 23 20 20 20 20 20 20 20 62 75 69 6c 64 20 64 # build d
7200: 69 72 65 63 74 6f 72 79 2c 20 64 69 73 63 61 72 irectory, discar
7210: 64 69 6e 67 20 61 6e 79 20 64 69 72 65 63 74 6f ding any directo
7220: 72 79 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 70 ry information p
7230: 72 65 73 65 6e 74 0d 0a 20 20 20 20 20 20 23 20 resent.. #
7240: 20 20 20 20 20 20 69 6e 20 74 68 65 20 66 69 6c in the fil
7250: 65 20 6e 61 6d 65 20 61 73 20 70 72 6f 76 69 64 e name as provid
7260: 65 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 ed by our caller
7270: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
7280: 20 20 73 65 74 20 72 65 73 75 6c 74 20 5b 66 69 set result [fi
7290: 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5c 0d le nativename \.
72a0: 0a 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 . [file
72b0: 20 6a 6f 69 6e 20 5b 67 65 74 42 75 69 6c 64 44 join [getBuildD
72c0: 69 72 65 63 74 6f 72 79 5d 20 24 70 6c 61 74 66 irectory] $platf
72d0: 6f 72 6d 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 orm [file tail $
72e0: 66 69 6c 65 4e 61 6d 65 5d 5d 5d 0d 0a 0d 0a 20 fileName]]]....
72f0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
7300: 48 41 43 4b 3a 20 57 68 65 6e 20 72 75 6e 6e 69 HACK: When runni
7310: 6e 67 20 6f 6e 20 57 6f 57 36 34 2c 20 61 73 73 ng on WoW64, ass
7320: 75 6d 65 20 74 68 65 20 74 65 73 74 20 65 78 65 ume the test exe
7330: 63 75 74 61 62 6c 65 73 20 61 72 65 20 70 72 65 cutables are pre
7340: 73 65 6e 74 0d 0a 20 20 20 20 20 20 23 20 20 20 sent.. #
7350: 20 20 20 20 77 69 74 68 20 74 68 65 20 22 33 32 with the "32
7360: 22 20 73 75 66 66 69 78 20 6f 6e 20 74 68 65 6d " suffix on them
7370: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
7380: 20 20 69 66 20 7b 5b 69 73 52 75 6e 6e 69 6e 67 if {[isRunning
7390: 57 6f 57 36 34 5d 20 26 26 20 5b 66 69 6c 65 20 WoW64] && [file
73a0: 65 78 74 65 6e 73 69 6f 6e 20 24 72 65 73 75 6c extension $resul
73b0: 74 5d 20 65 71 20 22 2e 65 78 65 22 7d 20 74 68 t] eq ".exe"} th
73c0: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 en {.. se
73d0: 74 20 72 65 73 75 6c 74 20 5b 61 70 70 65 6e 64 t result [append
73e0: 41 72 67 73 20 5b 66 69 6c 65 20 72 6f 6f 74 6e Args [file rootn
73f0: 61 6d 65 20 24 72 65 73 75 6c 74 5d 20 33 32 2e ame $result] 32.
7400: 65 78 65 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d exe].. }...
7410: 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 72 . return $r
7420: 65 73 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d esult.. }....
7430: 0a 20 20 20 20 70 72 6f 63 20 67 65 74 45 78 74 . proc getExt
7440: 65 72 6e 61 6c 44 69 72 65 63 74 6f 72 79 20 7b ernalDirectory {
7450: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
7460: 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 # NOTE: This
7470: 20 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 72 procedure retur
7480: 6e 73 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 ns the directory
7490: 20 77 68 65 72 65 20 74 68 65 20 65 78 74 65 72 where the exter
74a0: 6e 61 6c 20 62 69 6e 61 72 79 0d 0a 20 20 20 20 nal binary..
74b0: 20 20 23 20 20 20 20 20 20 20 66 69 6c 65 73 20 # files
74c0: 61 72 65 20 6c 6f 63 61 74 65 64 2e 0d 0a 20 20 are located...
74d0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 #.. ret
74e0: 75 72 6e 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 urn [file native
74f0: 6e 61 6d 65 20 5b 66 69 6c 65 20 64 69 72 6e 61 name [file dirna
7500: 6d 65 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 me [file dirname
7510: 20 5b 69 6e 66 6f 20 62 69 6e 61 72 79 5d 5d 5d [info binary]]]
7520: 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 ].. }.....
7530: 20 70 72 6f 63 20 67 65 74 42 69 6e 61 72 79 44 proc getBinaryD
7540: 69 72 65 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a 20 irectory {} {..
7550: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
7560: 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f 63 65 NOTE: This proce
7570: 64 75 72 65 20 72 65 74 75 72 6e 73 20 74 68 65 dure returns the
7580: 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 65 directory where
7590: 20 74 68 65 20 74 65 73 74 20 61 70 70 6c 69 63 the test applic
75a0: 61 74 69 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 ation.. #
75b0: 20 20 20 20 20 69 74 73 65 6c 66 20 28 69 2e 65 itself (i.e
75c0: 2e 20 74 68 65 20 45 61 67 6c 65 20 73 68 65 6c . the Eagle shel
75d0: 6c 29 20 69 73 20 6c 6f 63 61 74 65 64 2e 20 20 l) is located.
75e0: 54 68 69 73 20 77 69 6c 6c 20 62 65 20 75 73 65 This will be use
75f0: 64 20 61 73 0d 0a 20 20 20 20 20 20 23 20 20 20 d as.. #
7600: 20 20 20 20 74 68 65 20 64 65 73 74 69 6e 61 74 the destinat
7610: 69 6f 6e 20 66 6f 72 20 74 68 65 20 63 6f 70 69 ion for the copi
7620: 65 64 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 ed System.Data.S
7630: 51 4c 69 74 65 20 6e 61 74 69 76 65 20 61 6e 64 QLite native and
7640: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
7650: 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 69 managed assembli
7660: 65 73 20 28 69 2e 65 2e 20 62 65 63 61 75 73 65 es (i.e. because
7670: 20 74 68 69 73 20 69 73 20 6f 6e 65 20 6f 66 20 this is one of
7680: 74 68 65 20 66 65 77 20 70 6c 61 63 65 73 0d 0a the few places..
7690: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 77 68 # wh
76a0: 65 72 65 20 74 68 65 20 43 4c 52 20 77 69 6c 6c ere the CLR will
76b0: 20 61 63 74 75 61 6c 6c 79 20 66 69 6e 64 20 61 actually find a
76c0: 6e 64 20 6c 6f 61 64 20 74 68 65 6d 20 70 72 6f nd load them pro
76d0: 70 65 72 6c 79 29 2e 0d 0a 20 20 20 20 20 20 23 perly)... #
76e0: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 .. if {[inf
76f0: 6f 20 65 78 69 73 74 73 20 3a 3a 62 69 6e 61 72 o exists ::binar
7700: 79 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 26 20 y_directory] &&
7710: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 \.. [st
7720: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 62 ring length $::b
7730: 69 6e 61 72 79 5f 64 69 72 65 63 74 6f 72 79 5d inary_directory]
7740: 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
7750: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
7760: 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 # NOTE: The loc
7770: 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 62 69 6e ation of the bin
7780: 61 72 79 20 64 69 72 65 63 74 6f 72 79 20 68 61 ary directory ha
7790: 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 64 65 s been overridde
77a0: 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 n;.. #
77b0: 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c 20 75 therefore, u
77c0: 73 65 20 69 74 20 76 65 72 62 61 74 69 6d 2e 0d se it verbatim..
77d0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
77e0: 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 62 69 return $::bi
77f0: 6e 61 72 79 5f 64 69 72 65 63 74 6f 72 79 0d 0a nary_directory..
7800: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
7810: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b return [
7820: 69 6e 66 6f 20 62 69 6e 61 72 79 5d 0d 0a 20 20 info binary]..
7830: 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
7840: 0a 20 20 20 20 70 72 6f 63 20 67 65 74 45 78 74 . proc getExt
7850: 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 20 7b 20 ernalFileName {
7860: 66 69 6c 65 4e 61 6d 65 20 7d 20 7b 0d 0a 20 20 fileName } {..
7870: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
7880: 4f 54 45 3a 20 52 65 74 75 72 6e 73 20 74 68 65 OTE: Returns the
7890: 20 73 70 65 63 69 66 69 65 64 20 66 69 6c 65 20 specified file
78a0: 6e 61 6d 65 20 61 73 20 69 66 20 69 74 20 77 65 name as if it we
78b0: 72 65 20 6c 6f 63 61 74 65 64 20 69 6e 20 74 68 re located in th
78c0: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
78d0: 20 64 69 72 65 63 74 6f 72 79 20 63 6f 6e 74 61 directory conta
78e0: 69 6e 69 6e 67 20 74 68 65 20 65 78 74 65 72 6e ining the extern
78f0: 61 6c 20 62 69 6e 61 72 69 65 73 2e 0d 0a 20 20 al binaries...
7900: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 #.. ret
7910: 75 72 6e 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 urn [file native
7920: 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 name [file join
7930: 5b 67 65 74 45 78 74 65 72 6e 61 6c 44 69 72 65 [getExternalDire
7940: 63 74 6f 72 79 5d 20 24 66 69 6c 65 4e 61 6d 65 ctory] $fileName
7950: 5d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 ]].. }.....
7960: 20 20 70 72 6f 63 20 67 65 74 42 69 6e 61 72 79 proc getBinary
7970: 46 69 6c 65 4e 61 6d 65 20 7b 20 66 69 6c 65 4e FileName { fileN
7980: 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 ame {platform ""
7990: 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a } } {.. #..
79a0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 # NOTE: Re
79b0: 74 75 72 6e 73 20 74 68 65 20 73 70 65 63 69 66 turns the specif
79c0: 69 65 64 20 66 69 6c 65 20 6e 61 6d 65 20 61 73 ied file name as
79d0: 20 69 66 20 69 74 20 77 65 72 65 20 6c 6f 63 61 if it were loca
79e0: 74 65 64 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 ted in the..
79f0: 20 20 23 20 20 20 20 20 20 20 62 69 6e 61 72 79 # binary
7a00: 20 64 69 72 65 63 74 6f 72 79 2c 20 64 69 73 63 directory, disc
7a10: 61 72 64 69 6e 67 20 61 6e 79 20 64 69 72 65 63 arding any direc
7a20: 74 6f 72 79 20 69 6e 66 6f 72 6d 61 74 69 6f 6e tory information
7a30: 20 70 72 65 73 65 6e 74 0d 0a 20 20 20 20 20 20 present..
7a40: 23 20 20 20 20 20 20 20 69 6e 20 74 68 65 20 66 # in the f
7a50: 69 6c 65 20 6e 61 6d 65 20 61 73 20 70 72 6f 76 ile name as prov
7a60: 69 64 65 64 20 62 79 20 6f 75 72 20 63 61 6c 6c ided by our call
7a70: 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 er... #..
7a80: 20 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 return [file
7a90: 20 6e 61 74 69 76 65 6e 61 6d 65 20 5c 0d 0a 20 nativename \..
7aa0: 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 6a [file j
7ab0: 6f 69 6e 20 5b 67 65 74 42 69 6e 61 72 79 44 69 oin [getBinaryDi
7ac0: 72 65 63 74 6f 72 79 5d 20 24 70 6c 61 74 66 6f rectory] $platfo
7ad0: 72 6d 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 rm [file tail $f
7ae0: 69 6c 65 4e 61 6d 65 5d 5d 5d 0d 0a 20 20 20 20 ileName]]]..
7af0: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 }..... proc g
7b00: 65 74 43 6f 72 65 42 69 6e 61 72 79 46 69 6c 65 etCoreBinaryFile
7b10: 4e 61 6d 65 20 7b 20 7b 70 6c 61 74 66 6f 72 6d Name { {platform
7b20: 20 22 22 7d 20 7b 73 74 61 6e 64 61 72 64 20 22 ""} {standard "
7b30: 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d "} } {.. #.
7b40: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 . # NOTE: R
7b50: 65 74 75 72 6e 73 20 74 68 65 20 66 75 6c 6c 20 eturns the full
7b60: 70 61 74 68 20 66 6f 72 20 74 68 65 20 66 69 6c path for the fil
7b70: 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 e containing the
7b80: 20 53 51 4c 69 74 65 20 63 6f 72 65 0d 0a 20 20 SQLite core..
7b90: 20 20 20 20 23 20 20 20 20 20 20 20 6e 61 74 69 # nati
7ba0: 76 65 20 6c 69 62 72 61 72 79 20 63 6f 64 65 20 ve library code
7bb0: 66 6f 72 20 74 68 69 73 20 70 6c 61 74 66 6f 72 for this platfor
7bc0: 6d 2e 20 20 46 69 72 73 74 2c 20 63 68 65 63 6b m. First, check
7bd0: 20 61 6e 64 20 73 65 65 20 69 66 0d 0a 20 20 20 and see if..
7be0: 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 53 # the S
7bf0: 51 4c 69 74 65 20 63 6f 72 65 20 6e 61 74 69 76 QLite core nativ
7c00: 65 20 6c 69 62 72 61 72 79 20 68 61 73 20 61 6c e library has al
7c10: 72 65 61 64 79 20 62 65 65 6e 20 6c 6f 61 64 65 ready been loade
7c20: 64 2e 20 20 4e 65 78 74 2c 0d 0a 20 20 20 20 20 d. Next,..
7c30: 20 23 20 20 20 20 20 20 20 66 61 6c 6c 62 61 63 # fallbac
7c40: 6b 20 74 6f 20 77 68 61 74 20 74 68 65 20 66 75 k to what the fu
7c50: 6c 6c 20 70 61 74 68 20 73 68 6f 75 6c 64 20 62 ll path should b
7c60: 65 2c 20 62 61 73 65 64 20 6f 6e 20 77 68 65 74 e, based on whet
7c70: 68 65 72 20 74 68 65 0d 0a 20 20 20 20 20 20 23 her the.. #
7c80: 20 20 20 20 20 20 20 6d 69 78 65 64 2d 6d 6f 64 mixed-mod
7c90: 65 20 61 73 73 65 6d 62 6c 79 20 69 73 20 62 65 e assembly is be
7ca0: 69 6e 67 20 75 73 65 64 20 61 6e 64 20 74 68 65 ing used and the
7cb0: 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 63 75 72 name of the cur
7cc0: 72 65 6e 74 0d 0a 20 20 20 20 20 20 23 20 20 20 rent.. #
7cd0: 20 20 20 20 70 6c 61 74 66 6f 72 6d 2e 0d 0a 20 platform...
7ce0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
7cf0: 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
7d00: 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b object invok
7d10: 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 e -flags +NonPub
7d20: 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 lic \..
7d30: 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 System.Data.S
7d40: 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e 61 74 69 QLite.UnsafeNati
7d50: 76 65 4d 65 74 68 6f 64 73 20 5f 53 51 4c 69 74 veMethods _SQLit
7d60: 65 4e 61 74 69 76 65 4d 6f 64 75 6c 65 46 69 6c eNativeModuleFil
7d70: 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 7d 20 66 eName.. } f
7d80: 69 6c 65 4e 61 6d 65 5d 20 3d 3d 20 30 20 26 26 ileName] == 0 &&
7d90: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
7da0: 24 66 69 6c 65 4e 61 6d 65 5d 20 3e 20 30 7d 20 $fileName] > 0}
7db0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
7dc0: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
7dd0: 45 3a 20 54 68 65 20 53 51 4c 69 74 65 20 63 6f E: The SQLite co
7de0: 72 65 20 6e 61 74 69 76 65 20 6c 69 62 72 61 72 re native librar
7df0: 79 20 68 61 73 20 61 6c 72 65 61 64 79 20 62 65 y has already be
7e00: 65 6e 20 6c 6f 61 64 65 64 20 76 69 61 0d 0a 20 en loaded via..
7e10: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
7e20: 68 65 20 6e 61 74 69 76 65 20 6c 69 62 72 61 72 he native librar
7e30: 79 20 70 72 65 2d 6c 6f 61 64 65 72 2e 20 20 52 y pre-loader. R
7e40: 65 74 75 72 6e 20 74 68 61 74 20 66 69 6c 65 20 eturn that file
7e50: 6e 61 6d 65 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 name now...
7e60: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 #.. re
7e70: 74 75 72 6e 20 24 66 69 6c 65 4e 61 6d 65 0d 0a turn $fileName..
7e80: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
7e90: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
7ea0: 3a 20 49 66 20 74 68 65 20 22 6e 61 74 69 76 65 : If the "native
7eb0: 22 20 72 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e " runtime option
7ec0: 20 68 61 73 20 62 65 65 6e 20 73 65 74 2c 20 61 has been set, a
7ed0: 6c 77 61 79 73 20 72 65 74 75 72 6e 20 74 68 65 lways return the
7ee0: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
7ef0: 66 69 6c 65 20 6e 61 6d 65 20 66 6f 72 20 74 68 file name for th
7f00: 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 e mixed-mode ass
7f10: 65 6d 62 6c 79 2e 0d 0a 20 20 20 20 20 20 23 0d embly... #.
7f20: 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 73 52 . if {[hasR
7f30: 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 untimeOption nat
7f40: 69 76 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ive]} then {..
7f50: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
7f60: 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 # NOTE: Return
7f70: 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 the mixed-mode a
7f80: 73 73 65 6d 62 6c 79 20 66 69 6c 65 20 6e 61 6d ssembly file nam
7f90: 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 e... #..
7fa0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 66 return [f
7fb0: 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5c ile nativename \
7fc0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 .. [f
7fd0: 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 42 69 6e ile join [getBin
7fe0: 61 72 79 44 69 72 65 63 74 6f 72 79 5d 20 24 70 aryDirectory] $p
7ff0: 6c 61 74 66 6f 72 6d 20 53 79 73 74 65 6d 2e 44 latform System.D
8000: 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5d 5d ata.SQLite.dll]]
8010: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
8020: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
8030: 54 45 3a 20 41 72 65 20 77 65 20 61 74 74 65 6d TE: Are we attem
8040: 70 74 69 6e 67 20 74 6f 20 61 75 74 6f 6d 61 74 pting to automat
8050: 69 63 61 6c 6c 79 20 64 65 74 65 63 74 20 77 68 ically detect wh
8060: 65 74 68 65 72 20 6f 72 20 6e 6f 74 20 74 68 65 ether or not the
8070: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
8080: 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 interop assembly
8090: 20 73 68 6f 75 6c 64 20 62 65 20 75 73 65 64 3f should be used?
80a0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
80b0: 20 73 65 74 20 61 75 74 6f 6d 61 74 69 63 20 5b set automatic [
80c0: 65 78 70 72 20 7b 5b 73 74 72 69 6e 67 20 6c 65 expr {[string le
80d0: 6e 67 74 68 20 24 73 74 61 6e 64 61 72 64 5d 20 ngth $standard]
80e0: 3d 3d 20 30 7d 5d 0d 0a 0d 0a 20 20 20 20 20 20 == 0}]....
80f0: 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
8100: 20 46 69 72 73 74 2c 20 69 6e 20 65 69 74 68 65 First, in eithe
8110: 72 20 22 61 75 74 6f 6d 61 74 69 63 22 20 6f 72 r "automatic" or
8120: 20 22 6e 6f 6e 2d 73 74 61 6e 64 61 72 64 22 20 "non-standard"
8130: 6d 6f 64 65 73 2c 20 61 74 74 65 6d 70 74 0d 0a modes, attempt..
8140: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 6f # to
8150: 20 66 69 6e 64 20 74 68 65 20 6e 61 74 69 76 65 find the native
8160: 2d 6f 6e 6c 79 20 69 6e 74 65 72 6f 70 20 61 73 -only interop as
8170: 73 65 6d 62 6c 79 2e 0d 0a 20 20 20 20 20 20 23 sembly... #
8180: 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 61 75 74 .. if {$aut
8190: 6f 6d 61 74 69 63 20 7c 7c 20 21 24 73 74 61 6e omatic || !$stan
81a0: 64 61 72 64 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 dard} then {..
81b0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
81c0: 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 # NOTE: Attempt
81d0: 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68 to determine th
81e0: 65 20 6e 61 74 69 76 65 2d 6f 6e 6c 79 20 69 6e e native-only in
81f0: 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 66 terop assembly f
8200: 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ile.. #
8210: 20 20 20 20 20 6e 61 6d 65 20 66 6f 72 20 74 68 name for th
8220: 69 73 20 70 6c 61 74 66 6f 72 6d 20 61 6e 64 20 is platform and
8230: 74 68 65 6e 20 72 65 74 75 72 6e 20 69 74 2e 0d then return it..
8240: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
8250: 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
8260: 4e 61 6d 65 4f 6e 6c 79 20 5b 67 65 74 49 6e 74 NameOnly [getInt
8270: 65 72 6f 70 41 73 73 65 6d 62 6c 79 46 69 6c 65 eropAssemblyFile
8280: 4e 61 6d 65 73 4f 6e 6c 79 5d 20 7b 0d 0a 20 20 NamesOnly] {..
8290: 20 20 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 set file
82a0: 4e 61 6d 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 Name [file nativ
82b0: 65 6e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 ename \..
82c0: 20 20 20 20 20 20 20 5b 66 69 6c 65 20 6a 6f 69 [file joi
82d0: 6e 20 5b 67 65 74 42 69 6e 61 72 79 44 69 72 65 n [getBinaryDire
82e0: 63 74 6f 72 79 5d 20 24 70 6c 61 74 66 6f 72 6d ctory] $platform
82f0: 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d 5d $fileNameOnly]]
8300: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 .... if
8310: 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {[file exists $
8320: 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 fileName]} then
8330: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 {.. r
8340: 65 74 75 72 6e 20 24 66 69 6c 65 4e 61 6d 65 0d eturn $fileName.
8350: 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
8360: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
8370: 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
8380: 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 6e 2c # NOTE: Then,
8390: 20 69 6e 20 65 69 74 68 65 72 20 22 61 75 74 6f in either "auto
83a0: 6d 61 74 69 63 22 20 6f 72 20 22 73 74 61 6e 64 matic" or "stand
83b0: 61 72 64 22 20 6d 6f 64 65 73 2c 20 61 74 74 65 ard" modes, atte
83c0: 6d 70 74 20 74 6f 0d 0a 20 20 20 20 20 20 23 20 mpt to.. #
83d0: 20 20 20 20 20 20 66 69 6e 64 20 74 68 65 20 73 find the s
83e0: 74 61 6e 64 61 72 64 20 53 51 4c 69 74 65 20 6c tandard SQLite l
83f0: 69 62 72 61 72 79 2e 0d 0a 20 20 20 20 20 20 23 ibrary... #
8400: 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 61 75 74 .. if {$aut
8410: 6f 6d 61 74 69 63 20 7c 7c 20 24 73 74 61 6e 64 omatic || $stand
8420: 61 72 64 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ard} then {..
8430: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
8440: 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
8450: 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68 65 to determine the
8460: 20 6e 61 74 69 76 65 2d 6f 6e 6c 79 20 73 74 61 native-only sta
8470: 6e 64 61 72 64 20 53 51 4c 69 74 65 20 6c 69 62 ndard SQLite lib
8480: 72 61 72 79 0d 0a 20 20 20 20 20 20 20 20 23 20 rary.. #
8490: 20 20 20 20 20 20 66 69 6c 65 20 6e 61 6d 65 20 file name
84a0: 66 6f 72 20 74 68 69 73 20 70 6c 61 74 66 6f 72 for this platfor
84b0: 6d 20 61 6e 64 20 74 68 65 6e 20 72 65 74 75 72 m and then retur
84c0: 6e 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 n it... #
84d0: 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 .. foreac
84e0: 68 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 5b h fileNameOnly [
84f0: 67 65 74 4e 61 74 69 76 65 4c 69 62 72 61 72 79 getNativeLibrary
8500: 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d 20 7b FileNamesOnly] {
8510: 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
8520: 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6e fileName [file n
8530: 61 74 69 76 65 6e 61 6d 65 20 5c 0d 0a 20 20 20 ativename \..
8540: 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 [file
8550: 20 6a 6f 69 6e 20 5b 67 65 74 42 69 6e 61 72 79 join [getBinary
8560: 44 69 72 65 63 74 6f 72 79 5d 20 24 70 6c 61 74 Directory] $plat
8570: 66 6f 72 6d 20 24 66 69 6c 65 4e 61 6d 65 4f 6e form $fileNameOn
8580: 6c 79 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ly]]....
8590: 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 if {[file exis
85a0: 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 ts $fileName]} t
85b0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
85c0: 20 20 20 72 65 74 75 72 6e 20 24 66 69 6c 65 4e return $fileN
85d0: 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d ame.. }
85e0: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
85f0: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
8600: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 . # NOTE: W
8610: 61 73 20 74 68 65 20 6d 61 6e 61 67 65 64 20 61 as the managed a
8620: 73 73 65 6d 62 6c 79 20 63 6f 6d 70 69 6c 65 64 ssembly compiled
8630: 20 65 78 70 65 63 74 69 6e 67 20 74 6f 20 64 65 expecting to de
8640: 61 6c 20 77 69 74 68 20 74 68 65 0d 0a 20 20 20 al with the..
8650: 20 20 20 23 20 20 20 20 20 20 20 73 74 61 6e 64 # stand
8660: 61 72 64 20 63 6f 72 65 20 6c 69 62 72 61 72 79 ard core library
8670: 3f 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ?.. #..
8680: 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 if {[haveSQLit
8690: 65 44 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 20 eDefineConstant
86a0: 53 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 5d SQLITE_STANDARD]
86b0: 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 || \..
86c0: 20 5b 68 61 76 65 53 51 4c 69 74 65 44 65 66 69 [haveSQLiteDefi
86d0: 6e 65 43 6f 6e 73 74 61 6e 74 20 53 51 4c 49 54 neConstant SQLIT
86e0: 45 5f 53 54 41 4e 44 41 52 44 5f 4c 49 42 52 41 E_STANDARD_LIBRA
86f0: 52 59 5f 4e 41 4d 45 5d 7d 20 74 68 65 6e 20 7b RY_NAME]} then {
8700: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
8710: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 61 6c # NOTE: Fal
8720: 6c 62 61 63 6b 20 74 6f 20 72 65 74 75 72 6e 69 lback to returni
8730: 6e 67 20 74 68 65 20 6e 61 74 69 76 65 2d 6f 6e ng the native-on
8740: 6c 79 20 73 74 61 6e 64 61 72 64 20 53 51 4c 69 ly standard SQLi
8750: 74 65 20 6c 69 62 72 61 72 79 0d 0a 20 20 20 20 te library..
8760: 20 20 20 20 23 20 20 20 20 20 20 20 66 69 6c 65 # file
8770: 20 6e 61 6d 65 20 66 6f 72 20 74 68 65 20 70 6c name for the pl
8780: 61 74 66 6f 72 6d 2e 0d 0a 20 20 20 20 20 20 20 atform...
8790: 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 #.. set
87a0: 66 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 20 5b 67 fileNamesOnly [g
87b0: 65 74 4e 61 74 69 76 65 4c 69 62 72 61 72 79 46 etNativeLibraryF
87c0: 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d 0d 0a 0d ileNamesOnly]...
87d0: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 6c 6c . if {[ll
87e0: 65 6e 67 74 68 20 24 66 69 6c 65 4e 61 6d 65 73 ength $fileNames
87f0: 4f 6e 6c 79 5d 20 3d 3d 20 30 7d 20 74 68 65 6e Only] == 0} then
8800: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 {.. re
8810: 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 20 20 20 turn ""..
8820: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 72 65 }.... re
8830: 74 75 72 6e 20 5b 66 69 6c 65 20 6e 61 74 69 76 turn [file nativ
8840: 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
8850: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
8860: 5b 67 65 74 42 69 6e 61 72 79 44 69 72 65 63 74 [getBinaryDirect
8870: 6f 72 79 5d 20 24 70 6c 61 74 66 6f 72 6d 20 5b ory] $platform [
8880: 6c 69 6e 64 65 78 20 24 66 69 6c 65 4e 61 6d 65 lindex $fileName
8890: 73 4f 6e 6c 79 20 30 5d 5d 5d 0d 0a 20 20 20 20 sOnly 0]]]..
88a0: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
88b0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
88c0: 20 4e 4f 54 45 3a 20 46 61 6c 6c 62 61 63 6b 20 NOTE: Fallback
88d0: 74 6f 20 72 65 74 75 72 6e 69 6e 67 20 74 68 65 to returning the
88e0: 20 6e 61 74 69 76 65 2d 6f 6e 6c 79 20 69 6e 74 native-only int
88f0: 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 66 69 erop assembly fi
8900: 6c 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 le.. #
8910: 20 20 20 20 6e 61 6d 65 20 66 6f 72 20 74 68 65 name for the
8920: 20 70 6c 61 74 66 6f 72 6d 2e 0d 0a 20 20 20 20 platform...
8930: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 #.. s
8940: 65 74 20 66 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 et fileNamesOnly
8950: 20 5b 67 65 74 49 6e 74 65 72 6f 70 41 73 73 65 [getInteropAsse
8960: 6d 62 6c 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c mblyFileNamesOnl
8970: 79 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 y].... if
8980: 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 66 69 6c 65 {[llength $file
8990: 4e 61 6d 65 73 4f 6e 6c 79 5d 20 3d 3d 20 30 7d NamesOnly] == 0}
89a0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
89b0: 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 return ""..
89c0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
89d0: 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 return [file
89e0: 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 nativename [file
89f0: 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 join \..
8a00: 20 20 20 20 20 5b 67 65 74 42 69 6e 61 72 79 44 [getBinaryD
8a10: 69 72 65 63 74 6f 72 79 5d 20 24 70 6c 61 74 66 irectory] $platf
8a20: 6f 72 6d 20 5b 6c 69 6e 64 65 78 20 24 66 69 6c orm [lindex $fil
8a30: 65 4e 61 6d 65 73 4f 6e 6c 79 20 30 5d 5d 5d 0d eNamesOnly 0]]].
8a40: 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d . }.. }.
8a50: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 .... proc get
8a60: 43 6f 6d 6d 6f 6e 44 69 72 65 63 74 6f 72 79 20 CommonDirectory
8a70: 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 {} {.. #..
8a80: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 # NOTE: Thi
8a90: 73 20 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 s procedure retu
8aa0: 72 6e 73 20 74 68 65 20 64 69 72 65 63 74 6f 72 rns the director
8ab0: 79 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74 y where the test
8ac0: 20 73 63 72 69 70 74 73 0d 0a 20 20 20 20 20 20 scripts..
8ad0: 23 20 20 20 20 20 20 20 73 68 6f 75 6c 64 20 62 # should b
8ae0: 65 20 6c 6f 63 61 74 65 64 2e 20 20 42 79 20 64 e located. By d
8af0: 65 66 61 75 6c 74 2c 20 74 68 69 73 20 6a 75 73 efault, this jus
8b00: 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 45 61 t returns the Ea
8b10: 67 6c 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 gle.. #
8b20: 20 20 20 62 69 6e 61 72 79 20 64 69 72 65 63 74 binary direct
8b30: 6f 72 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ory... #..
8b40: 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 if {[info e
8b50: 78 69 73 74 73 20 3a 3a 63 6f 6d 6d 6f 6e 5f 64 xists ::common_d
8b60: 69 72 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a irectory] && \..
8b70: 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
8b80: 67 20 6c 65 6e 67 74 68 20 24 3a 3a 63 6f 6d 6d g length $::comm
8b90: 6f 6e 5f 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 on_directory] >
8ba0: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
8bb0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
8bc0: 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 74 69 NOTE: The locati
8bd0: 6f 6e 20 6f 66 20 74 68 65 20 63 6f 6d 6d 6f 6e on of the common
8be0: 20 64 69 72 65 63 74 6f 72 79 20 68 61 73 20 62 directory has b
8bf0: 65 65 6e 20 73 65 74 3b 0d 0a 20 20 20 20 20 20 een set;..
8c00: 20 20 23 20 20 20 20 20 20 20 74 68 65 72 65 66 # theref
8c10: 6f 72 65 2c 20 75 73 65 20 69 74 2e 0d 0a 20 20 ore, use it...
8c20: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
8c30: 20 72 65 74 75 72 6e 20 24 3a 3a 63 6f 6d 6d 6f return $::commo
8c40: 6e 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 n_directory..
8c50: 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e } elseif {[in
8c60: 66 6f 20 65 78 69 73 74 73 20 3a 3a 76 65 6e 64 fo exists ::vend
8c70: 6f 72 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 26 or_directory] &&
8c80: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 \.. [s
8c90: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a tring length $::
8ca0: 76 65 6e 64 6f 72 5f 64 69 72 65 63 74 6f 72 79 vendor_directory
8cb0: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
8cc0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
8cd0: 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f # NOTE: The lo
8ce0: 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 76 65 cation of the ve
8cf0: 6e 64 6f 72 20 64 69 72 65 63 74 6f 72 79 20 68 ndor directory h
8d00: 61 73 20 62 65 65 6e 20 73 65 74 3b 0d 0a 20 20 as been set;..
8d10: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 # th
8d20: 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 2e erefore, use it.
8d30: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
8d40: 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 76 return $::v
8d50: 65 6e 64 6f 72 5f 64 69 72 65 63 74 6f 72 79 0d endor_directory.
8d60: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 . } elseif
8d70: 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a {[info exists ::
8d80: 74 63 6c 5f 6c 69 62 72 61 72 79 5d 20 26 26 20 tcl_library] &&
8d90: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 \.. [st
8da0: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 ring length $::t
8db0: 63 6c 5f 6c 69 62 72 61 72 79 5d 20 3e 20 30 20 cl_library] > 0
8dc0: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
8dd0: 5b 66 69 6c 65 20 69 73 64 69 72 65 63 74 6f 72 [file isdirector
8de0: 79 20 24 3a 3a 74 63 6c 5f 6c 69 62 72 61 72 79 y $::tcl_library
8df0: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
8e00: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
8e10: 4e 4f 54 45 3a 20 54 68 65 20 76 61 72 69 61 62 NOTE: The variab
8e20: 6c 65 20 77 69 74 68 20 74 68 65 20 6c 6f 63 61 le with the loca
8e30: 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 63 72 69 tion of the scri
8e40: 70 74 20 6c 69 62 72 61 72 79 20 69 73 0d 0a 20 pt library is..
8e50: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 # s
8e60: 65 74 20 61 6e 64 20 61 70 70 65 61 72 73 20 74 et and appears t
8e70: 6f 20 62 65 20 61 20 72 65 61 6c 20 64 69 72 65 o be a real dire
8e80: 63 74 6f 72 79 20 28 69 2e 65 2e 20 6e 6f 74 20 ctory (i.e. not
8e90: 65 6d 62 65 64 64 65 64 0d 0a 20 20 20 20 20 20 embedded..
8ea0: 20 20 23 20 20 20 20 20 20 20 77 69 74 68 69 6e # within
8eb0: 20 61 20 66 69 6c 65 29 3b 20 74 68 65 72 65 66 a file); theref
8ec0: 6f 72 65 2c 20 75 73 65 20 69 74 2e 0d 0a 20 20 ore, use it...
8ed0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
8ee0: 20 72 65 74 75 72 6e 20 24 3a 3a 74 63 6c 5f 6c return $::tcl_l
8ef0: 69 62 72 61 72 79 0d 0a 20 20 20 20 20 20 7d 20 ibrary.. }
8f00: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
8f10: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
8f20: 45 3a 20 46 61 6c 6c 62 61 63 6b 20 74 6f 20 74 E: Fallback to t
8f30: 68 65 20 64 69 72 65 63 74 6f 72 79 20 63 6f 6e he directory con
8f40: 74 61 69 6e 69 6e 67 20 74 68 65 20 65 78 65 63 taining the exec
8f50: 75 74 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 20 utable...
8f60: 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 #.. retu
8f70: 72 6e 20 5b 69 6e 66 6f 20 62 69 6e 61 72 79 5d rn [info binary]
8f80: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
8f90: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
8fa0: 74 44 61 74 61 62 61 73 65 44 69 72 65 63 74 6f tDatabaseDirecto
8fb0: 72 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ry {} {.. #
8fc0: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
8fd0: 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 72 This procedure r
8fe0: 65 74 75 72 6e 73 20 74 68 65 20 64 69 72 65 63 eturns the direc
8ff0: 74 6f 72 79 20 77 68 65 72 65 20 74 68 65 20 74 tory where the t
9000: 65 73 74 20 64 61 74 61 62 61 73 65 73 0d 0a 20 est databases..
9010: 20 20 20 20 20 23 20 20 20 20 20 20 20 73 68 6f # sho
9020: 75 6c 64 20 62 65 20 6c 6f 63 61 74 65 64 2e 20 uld be located.
9030: 20 42 79 20 64 65 66 61 75 6c 74 2c 20 74 68 69 By default, thi
9040: 73 20 6a 75 73 74 20 75 73 65 73 20 74 68 65 20 s just uses the
9050: 74 65 6d 70 6f 72 61 72 79 0d 0a 20 20 20 20 20 temporary..
9060: 20 23 20 20 20 20 20 20 20 64 69 72 65 63 74 6f # directo
9070: 72 79 20 63 6f 6e 66 69 67 75 72 65 64 20 66 6f ry configured fo
9080: 72 20 74 68 69 73 20 73 79 73 74 65 6d 2e 0d 0a r this system...
9090: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
90a0: 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
90b0: 3a 3a 64 61 74 61 62 61 73 65 5f 64 69 72 65 63 ::database_direc
90c0: 74 6f 72 79 5d 20 26 26 20 5c 0d 0a 20 20 20 20 tory] && \..
90d0: 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 [string le
90e0: 6e 67 74 68 20 24 3a 3a 64 61 74 61 62 61 73 65 ngth $::database
90f0: 5f 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 30 7d _directory] > 0}
9100: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
9110: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
9120: 54 45 3a 20 54 68 65 20 6c 6f 63 61 74 69 6f 6e TE: The location
9130: 20 6f 66 20 74 68 65 20 64 61 74 61 62 61 73 65 of the database
9140: 20 64 69 72 65 63 74 6f 72 79 20 68 61 73 20 62 directory has b
9150: 65 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d een overridden;.
9160: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
9170: 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 therefore, use
9180: 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a it... #..
9190: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
91a0: 3a 3a 64 61 74 61 62 61 73 65 5f 64 69 72 65 63 ::database_direc
91b0: 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c tory.. } el
91c0: 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 seif {[info exis
91d0: 74 73 20 3a 3a 73 63 72 61 74 63 68 5f 64 69 72 ts ::scratch_dir
91e0: 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a 20 20 ectory] && \..
91f0: 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
9200: 6c 65 6e 67 74 68 20 24 3a 3a 73 63 72 61 74 63 length $::scratc
9210: 68 5f 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 30 h_directory] > 0
9220: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
9230: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
9240: 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 74 69 6f OTE: The locatio
9250: 6e 20 6f 66 20 74 68 65 20 73 63 72 61 74 63 68 n of the scratch
9260: 20 64 69 72 65 63 74 6f 72 79 20 68 61 73 20 62 directory has b
9270: 65 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d een overridden;.
9280: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
9290: 20 74 68 65 72 65 66 6f 72 65 2c 20 75 73 65 20 therefore, use
92a0: 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a it... #..
92b0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
92c0: 3a 3a 73 63 72 61 74 63 68 5f 64 69 72 65 63 74 ::scratch_direct
92d0: 6f 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 ory.. } els
92e0: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 e {.. ret
92f0: 75 72 6e 20 5b 67 65 74 54 65 6d 70 6f 72 61 72 urn [getTemporar
9300: 79 50 61 74 68 5d 0d 0a 20 20 20 20 20 20 7d 0d yPath].. }.
9310: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
9320: 72 6f 63 20 67 65 74 54 65 6d 70 6f 72 61 72 79 roc getTemporary
9330: 44 69 72 65 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a Directory {} {..
9340: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
9350: 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f 63 NOTE: This proc
9360: 65 64 75 72 65 20 72 65 74 75 72 6e 73 20 74 68 edure returns th
9370: 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 e directory wher
9380: 65 20 74 68 65 20 74 65 6d 70 6f 72 61 72 79 20 e the temporary
9390: 66 69 6c 65 73 0d 0a 20 20 20 20 20 20 23 20 20 files.. #
93a0: 20 20 20 20 20 73 68 6f 75 6c 64 20 62 65 20 6c should be l
93b0: 6f 63 61 74 65 64 2e 20 20 42 79 20 64 65 66 61 ocated. By defa
93c0: 75 6c 74 2c 20 74 68 69 73 20 6a 75 73 74 20 75 ult, this just u
93d0: 73 65 73 20 74 68 65 20 74 65 6d 70 6f 72 61 72 ses the temporar
93e0: 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 y.. #
93f0: 20 64 69 72 65 63 74 6f 72 79 20 63 6f 6e 66 69 directory confi
9400: 67 75 72 65 64 20 66 6f 72 20 74 68 69 73 20 73 gured for this s
9410: 79 73 74 65 6d 2e 0d 0a 20 20 20 20 20 20 23 0d ystem... #.
9420: 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f . if {[info
9430: 20 65 78 69 73 74 73 20 3a 3a 74 65 6d 70 6f 72 exists ::tempor
9440: 61 72 79 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 ary_directory] &
9450: 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b & \.. [
9460: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a string length $:
9470: 3a 74 65 6d 70 6f 72 61 72 79 5f 64 69 72 65 63 :temporary_direc
9480: 74 6f 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 tory] > 0} then
9490: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
94a0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 # NOTE: Th
94b0: 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 e location of th
94c0: 65 20 74 65 6d 70 6f 72 61 72 79 20 64 69 72 65 e temporary dire
94d0: 63 74 6f 72 79 20 68 61 73 20 62 65 65 6e 20 6f ctory has been o
94e0: 76 65 72 72 69 64 64 65 6e 3b 0d 0a 20 20 20 20 verridden;..
94f0: 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 72 # ther
9500: 65 66 6f 72 65 2c 20 75 73 65 20 69 74 2e 0d 0a efore, use it...
9510: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
9520: 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 74 65 6d return $::tem
9530: 70 6f 72 61 72 79 5f 64 69 72 65 63 74 6f 72 79 porary_directory
9540: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 .. } elseif
9550: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {[info exists :
9560: 3a 73 63 72 61 74 63 68 5f 64 69 72 65 63 74 6f :scratch_directo
9570: 72 79 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 ry] && \..
9580: 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 [string leng
9590: 74 68 20 24 3a 3a 73 63 72 61 74 63 68 5f 64 69 th $::scratch_di
95a0: 72 65 63 74 6f 72 79 5d 20 3e 20 30 7d 20 74 68 rectory] > 0} th
95b0: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
95c0: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
95d0: 20 54 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 The location of
95e0: 20 74 68 65 20 73 63 72 61 74 63 68 20 64 69 72 the scratch dir
95f0: 65 63 74 6f 72 79 20 68 61 73 20 62 65 65 6e 20 ectory has been
9600: 6f 76 65 72 72 69 64 64 65 6e 3b 0d 0a 20 20 20 overridden;..
9610: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 # the
9620: 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 2e 0d refore, use it..
9630: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
9640: 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 73 63 return $::sc
9650: 72 61 74 63 68 5f 64 69 72 65 63 74 6f 72 79 0d ratch_directory.
9660: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
9670: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
9680: 5b 67 65 74 54 65 6d 70 6f 72 61 72 79 50 61 74 [getTemporaryPat
9690: 68 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 h].. }..
96a0: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
96b0: 67 65 74 45 78 65 63 75 74 65 4f 6e 53 65 74 75 getExecuteOnSetu
96c0: 70 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 p {} {.. if
96d0: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {[info exists :
96e0: 3a 65 78 65 63 75 74 65 5f 6f 6e 5f 73 65 74 75 :execute_on_setu
96f0: 70 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 p] && \..
9700: 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 [string lengt
9710: 68 20 24 3a 3a 65 78 65 63 75 74 65 5f 6f 6e 5f h $::execute_on_
9720: 73 65 74 75 70 5d 20 3e 20 30 7d 20 74 68 65 6e setup] > 0} then
9730: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
9740: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 # NOTE: R
9750: 65 74 75 72 6e 20 74 68 65 20 63 6f 6e 66 69 67 eturn the config
9760: 75 72 65 64 20 53 51 4c 20 74 6f 20 65 78 65 63 ured SQL to exec
9770: 75 74 65 20 64 75 72 69 6e 67 20 74 68 65 20 63 ute during the c
9780: 6f 6e 6e 65 63 74 69 6f 6e 0d 0a 20 20 20 20 20 onnection..
9790: 20 20 20 23 20 20 20 20 20 20 20 73 65 74 75 70 # setup
97a0: 20 70 72 6f 63 65 64 75 72 65 20 28 69 2e 65 2e procedure (i.e.
97b0: 20 66 6f 72 20 65 76 65 72 79 20 74 65 73 74 20 for every test
97c0: 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 database connect
97d0: 69 6f 6e 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 ion)... #
97e0: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
97f0: 20 24 3a 3a 65 78 65 63 75 74 65 5f 6f 6e 5f 73 $::execute_on_s
9800: 65 74 75 70 0d 0a 20 20 20 20 20 20 7d 20 65 6c etup.. } el
9810: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d se {.. #.
9820: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
9830: 20 42 79 20 64 65 66 61 75 6c 74 2c 20 74 68 65 By default, the
9840: 72 65 20 69 73 20 6e 6f 20 53 51 4c 20 74 6f 20 re is no SQL to
9850: 65 78 65 63 75 74 65 20 64 75 72 69 6e 67 20 74 execute during t
9860: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 0d 0a 20 he connection..
9870: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 # s
9880: 65 74 75 70 20 70 72 6f 63 65 64 75 72 65 20 28 etup procedure (
9890: 69 2e 65 2e 20 66 6f 72 20 65 76 65 72 79 20 74 i.e. for every t
98a0: 65 73 74 20 64 61 74 61 62 61 73 65 20 63 6f 6e est database con
98b0: 6e 65 63 74 69 6f 6e 29 2e 0d 0a 20 20 20 20 20 nection)...
98c0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 #.. re
98d0: 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 20 20 7d turn "".. }
98e0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
98f0: 70 72 6f 63 20 67 65 74 54 65 73 74 4f 76 65 72 proc getTestOver
9900: 72 69 64 65 73 50 72 65 61 6d 62 6c 65 20 7b 20 ridesPreamble {
9910: 7b 65 78 74 72 61 56 61 72 4e 61 6d 65 73 20 22 {extraVarNames "
9920: 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 "} } {.. se
9930: 74 20 76 61 72 4e 61 6d 65 73 20 5b 6c 69 73 74 t varNames [list
9940: 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ].... #..
9950: 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 61 # NOTE: If a
9960: 76 61 69 6c 61 62 6c 65 2c 20 73 74 61 72 74 20 vailable, start
9970: 77 69 74 68 20 74 68 65 20 6d 61 73 74 65 72 20 with the master
9980: 6c 69 73 74 20 6f 66 20 74 65 73 74 20 6f 76 65 list of test ove
9990: 72 72 69 64 65 0d 0a 20 20 20 20 20 20 23 20 20 rride.. #
99a0: 20 20 20 20 20 76 61 72 69 61 62 6c 65 73 2e 0d variables..
99b0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
99c0: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
99d0: 20 3a 3a 74 65 73 74 5f 6f 76 65 72 72 69 64 65 ::test_override
99e0: 73 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 s] && \..
99f0: 20 20 20 5b 6c 6c 65 6e 67 74 68 20 24 3a 3a 74 [llength $::t
9a00: 65 73 74 5f 6f 76 65 72 72 69 64 65 73 5d 20 3e est_overrides] >
9a10: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
9a20: 20 20 20 20 65 76 61 6c 20 6c 61 70 70 65 6e 64 eval lappend
9a30: 20 76 61 72 4e 61 6d 65 73 20 24 3a 3a 74 65 73 varNames $::tes
9a40: 74 5f 6f 76 65 72 72 69 64 65 73 0d 0a 20 20 20 t_overrides..
9a50: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
9a60: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 . # NOTE: I
9a70: 66 20 72 65 71 75 65 73 74 65 64 20 62 79 20 6f f requested by o
9a80: 75 72 20 63 61 6c 6c 65 72 2c 20 61 64 64 20 61 ur caller, add a
9a90: 6e 79 20 61 64 64 69 74 69 6f 6e 61 6c 20 76 61 ny additional va
9aa0: 72 69 61 62 6c 65 0d 0a 20 20 20 20 20 20 23 20 riable.. #
9ab0: 20 20 20 20 20 20 6e 61 6d 65 73 20 74 6f 20 63 names to c
9ac0: 6f 70 79 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 opy now...
9ad0: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 6c 6c #.. if {[ll
9ae0: 65 6e 67 74 68 20 24 65 78 74 72 61 56 61 72 4e ength $extraVarN
9af0: 61 6d 65 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 ames] > 0} then
9b00: 7b 0d 0a 20 20 20 20 20 20 20 20 65 76 61 6c 20 {.. eval
9b10: 6c 61 70 70 65 6e 64 20 76 61 72 4e 61 6d 65 73 lappend varNames
9b20: 20 24 65 78 74 72 61 56 61 72 4e 61 6d 65 73 0d $extraVarNames.
9b30: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
9b40: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
9b50: 45 3a 20 42 75 69 6c 64 20 74 68 65 20 73 63 72 E: Build the scr
9b60: 69 70 74 20 66 72 61 67 6d 65 6e 74 20 74 6f 20 ipt fragment to
9b70: 62 65 20 72 65 74 75 72 6e 65 64 20 62 79 20 70 be returned by p
9b80: 72 6f 63 65 73 73 69 6e 67 20 65 61 63 68 0d 0a rocessing each..
9b90: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 61 # va
9ba0: 72 69 61 62 6c 65 20 6e 61 6d 65 20 61 6e 64 20 riable name and
9bb0: 61 64 64 69 6e 67 20 74 68 65 20 6e 65 63 65 63 adding the necec
9bc0: 65 73 73 61 72 79 20 73 63 72 69 70 74 20 66 72 essary script fr
9bd0: 61 67 6d 65 6e 74 73 20 66 6f 72 0d 0a 20 20 20 agments for..
9be0: 20 20 20 23 20 20 20 20 20 20 20 65 61 63 68 20 # each
9bf0: 6f 6e 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 one... #..
9c00: 20 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 20 set result
9c10: 22 22 0d 0a 0d 0a 20 20 20 20 20 20 66 6f 72 65 "".... fore
9c20: 61 63 68 20 76 61 72 4e 61 6d 65 20 24 76 61 72 ach varName $var
9c30: 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 Names {..
9c40: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
9c50: 54 45 3a 20 42 75 69 6c 64 20 74 68 65 20 71 75 TE: Build the qu
9c60: 61 6c 69 66 69 65 64 20 67 6c 6f 62 61 6c 20 76 alified global v
9c70: 61 72 69 61 62 6c 65 20 6e 61 6d 65 2e 0d 0a 20 ariable name...
9c80: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
9c90: 20 20 73 65 74 20 66 75 6c 6c 56 61 72 4e 61 6d set fullVarNam
9ca0: 65 20 5b 61 70 70 65 6e 64 41 72 67 73 20 3a 3a e [appendArgs ::
9cb0: 20 24 76 61 72 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 $varName]....
9cc0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
9cd0: 20 23 20 4e 4f 54 45 3a 20 44 6f 65 73 20 74 68 # NOTE: Does th
9ce0: 65 20 76 61 72 69 61 62 6c 65 20 65 78 69 73 74 e variable exist
9cf0: 20 69 6e 20 74 68 69 73 20 69 6e 74 65 72 70 72 in this interpr
9d00: 65 74 65 72 20 63 6f 6e 74 65 78 74 3f 0d 0a 20 eter context?..
9d10: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
9d20: 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
9d30: 74 73 20 24 66 75 6c 6c 56 61 72 4e 61 6d 65 5d ts $fullVarName]
9d40: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
9d50: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
9d60: 20 23 20 4e 4f 54 45 3a 20 41 70 70 65 6e 64 20 # NOTE: Append
9d70: 61 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e a script fragmen
9d80: 74 20 74 6f 20 74 68 65 20 72 65 73 75 6c 74 20 t to the result
9d90: 74 68 61 74 20 77 69 6c 6c 20 63 6f 72 72 65 63 that will correc
9da0: 74 6c 79 0d 0a 20 20 20 20 20 20 20 20 20 20 23 tly.. #
9db0: 20 20 20 20 20 20 20 63 6f 70 79 20 61 6e 79 20 copy any
9dc0: 63 6f 6e 74 61 69 6e 65 64 20 76 61 6c 75 65 20 contained value
9dd0: 74 6f 20 61 6e 6f 74 68 65 72 20 69 6e 74 65 72 to another inter
9de0: 70 72 65 74 65 72 20 63 6f 6e 74 65 78 74 2e 0d preter context..
9df0: 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
9e00: 20 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 72 append r
9e10: 65 73 75 6c 74 20 5c 6e 20 22 73 65 74 20 22 20 esult \n "set "
9e20: 24 66 75 6c 6c 56 61 72 4e 61 6d 65 20 22 20 5c $fullVarName " \
9e30: 7b 22 20 5b 73 65 74 20 24 66 75 6c 6c 56 61 72 {" [set $fullVar
9e40: 4e 61 6d 65 5d 20 5c 7d 0d 0a 20 20 20 20 20 20 Name] \}..
9e50: 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
9e60: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
9e70: 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 72 65 NOTE: If the re
9e80: 73 75 6c 74 20 63 6f 6e 74 61 69 6e 73 20 6f 6e sult contains on
9e90: 65 20 6f 72 20 6d 6f 72 65 20 73 63 72 69 70 74 e or more script
9ea0: 20 66 72 61 67 6d 65 6e 74 73 2c 20 61 70 70 65 fragments, appe
9eb0: 6e 64 20 61 0d 0a 20 20 20 20 20 20 23 20 20 20 nd a.. #
9ec0: 20 20 20 20 6e 65 77 6c 69 6e 65 2e 0d 0a 20 20 newline...
9ed0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
9ee0: 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
9ef0: 24 72 65 73 75 6c 74 5d 20 3e 20 30 7d 20 74 68 $result] > 0} th
9f00: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 70 en {.. ap
9f10: 70 65 6e 64 20 72 65 73 75 6c 74 20 5c 6e 0d 0a pend result \n..
9f20: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
9f30: 20 72 65 74 75 72 6e 20 24 72 65 73 75 6c 74 0d return $result.
9f40: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
9f50: 72 6f 63 20 6d 6f 76 65 53 79 73 74 65 6d 44 61 roc moveSystemDa
9f60: 74 61 53 51 4c 69 74 65 44 6c 6c 43 6f 6e 66 69 taSQLiteDllConfi
9f70: 67 20 7b 20 7b 72 65 73 74 6f 72 65 20 66 61 6c g { {restore fal
9f80: 73 65 7d 20 7b 76 65 72 62 6f 73 65 20 66 61 6c se} {verbose fal
9f90: 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 se} } {.. s
9fa0: 65 74 20 64 69 72 65 63 74 6f 72 79 20 5b 6f 62 et directory [ob
9fb0: 6a 65 63 74 20 69 6e 76 6f 6b 65 20 41 70 70 44 ject invoke AppD
9fc0: 6f 6d 61 69 6e 20 43 75 72 72 65 6e 74 44 6f 6d omain CurrentDom
9fd0: 61 69 6e 2e 42 61 73 65 44 69 72 65 63 74 6f 72 ain.BaseDirector
9fe0: 79 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b y].... if {
9ff0: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
a000: 64 69 72 65 63 74 6f 72 79 5d 20 3d 3d 20 30 7d directory] == 0}
a010: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
a020: 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 if {$verbose} t
a030: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
a040: 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
a050: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
a060: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
a070: 20 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 "---- skippe
a080: 64 20 6d 6f 76 69 6e 67 20 5c 22 53 79 73 74 65 d moving \"Syste
a090: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c m.Data.SQLite.dl
a0a0: 6c 2e 63 6f 6e 66 69 67 5c 22 2c 20 22 20 5c 0d l.config\", " \.
a0b0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
a0c0: 6e 6f 20 62 61 73 65 20 64 69 72 65 63 74 6f 72 no base director
a0d0: 79 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d y\n"].. }
a0e0: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
a0f0: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
a100: 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 28 set fileName(
a110: 31 29 20 5b 66 69 6c 65 20 6e 6f 72 6d 61 6c 69 1) [file normali
a120: 7a 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ze \..
a130: 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 65 [file join $dire
a140: 63 74 6f 72 79 20 53 79 73 74 65 6d 2e 44 61 74 ctory System.Dat
a150: 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 2e 63 6f 6e a.SQLite.dll.con
a160: 66 69 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 73 fig]].... s
a170: 65 74 20 66 69 6c 65 4e 61 6d 65 28 32 29 20 5b et fileName(2) [
a180: 61 70 70 65 6e 64 41 72 67 73 20 24 66 69 6c 65 appendArgs $file
a190: 4e 61 6d 65 28 31 29 20 2e 6d 6f 76 65 64 5d 0d Name(1) .moved].
a1a0: 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 72 65 ... if {$re
a1b0: 73 74 6f 72 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 store} then {..
a1c0: 20 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 if {[file
a1d0: 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d exists $fileNam
a1e0: 65 28 32 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 e(2)]} then {..
a1f0: 20 20 20 20 20 20 20 20 20 66 69 6c 65 20 72 65 file re
a200: 6e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 28 32 name $fileName(2
a210: 29 20 24 66 69 6c 65 4e 61 6d 65 28 31 29 0d 0a ) $fileName(1)..
a220: 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
a230: 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b $verbose} then {
a240: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
a250: 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
a260: 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
a270: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
a280: 20 20 20 22 2d 2d 2d 2d 20 6d 6f 76 65 64 20 5c "---- moved \
a290: 22 22 20 24 66 69 6c 65 4e 61 6d 65 28 32 29 20 "" $fileName(2)
a2a0: 22 5c 22 20 74 6f 20 5c 22 22 20 5c 0d 0a 20 20 "\" to \"" \..
a2b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 66 $f
a2c0: 69 6c 65 4e 61 6d 65 28 31 29 20 5c 22 5c 6e 5d ileName(1) \"\n]
a2d0: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
a2e0: 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
a2f0: 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 . if {$
a300: 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d verbose} then {.
a310: 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
a320: 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
a330: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
a340: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
a350: 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 "---- skipped
a360: 6d 6f 76 69 6e 67 20 5c 22 22 20 24 66 69 6c 65 moving \"" $file
a370: 4e 61 6d 65 28 32 29 20 5c 0d 0a 20 20 20 20 20 Name(2) \..
a380: 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 "\",
a390: 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 it does not exis
a3a0: 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 t\n"]..
a3b0: 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
a3c0: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
a3d0: 20 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 if {[file
a3e0: 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d exists $fileNam
a3f0: 65 28 31 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 e(1)]} then {..
a400: 20 20 20 20 20 20 20 20 20 66 69 6c 65 20 72 65 file re
a410: 6e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 28 31 name $fileName(1
a420: 29 20 24 66 69 6c 65 4e 61 6d 65 28 32 29 0d 0a ) $fileName(2)..
a430: 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
a440: 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b $verbose} then {
a450: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
a460: 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
a470: 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
a480: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
a490: 20 20 20 22 2d 2d 2d 2d 20 6d 6f 76 65 64 20 5c "---- moved \
a4a0: 22 22 20 24 66 69 6c 65 4e 61 6d 65 28 31 29 20 "" $fileName(1)
a4b0: 22 5c 22 20 74 6f 20 5c 22 22 20 5c 0d 0a 20 20 "\" to \"" \..
a4c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 66 $f
a4d0: 69 6c 65 4e 61 6d 65 28 32 29 20 5c 22 5c 6e 5d ileName(2) \"\n]
a4e0: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
a4f0: 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
a500: 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 . if {$
a510: 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d verbose} then {.
a520: 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
a530: 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
a540: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
a550: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
a560: 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 "---- skipped
a570: 6d 6f 76 69 6e 67 20 5c 22 22 20 24 66 69 6c 65 moving \"" $file
a580: 4e 61 6d 65 28 31 29 20 5c 0d 0a 20 20 20 20 20 Name(1) \..
a590: 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 "\",
a5a0: 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 it does not exis
a5b0: 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 t\n"]..
a5c0: 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
a5d0: 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
a5e0: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 41 70 .. proc getAp
a5f0: 70 44 6f 6d 61 69 6e 50 72 65 61 6d 62 6c 65 20 pDomainPreamble
a600: 7b 20 7b 70 72 65 66 69 78 20 22 22 7d 20 7b 73 { {prefix ""} {s
a610: 75 66 66 69 78 20 22 22 7d 20 7d 20 7b 0d 0a 20 uffix ""} } {..
a620: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
a630: 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f 63 65 NOTE: This proce
a640: 64 75 72 65 20 72 65 74 75 72 6e 73 20 61 20 74 dure returns a t
a650: 65 73 74 20 73 65 74 75 70 20 73 63 72 69 70 74 est setup script
a660: 20 66 72 61 67 6d 65 6e 74 20 73 75 69 74 61 62 fragment suitab
a670: 6c 65 20 66 6f 72 0d 0a 20 20 20 20 20 20 23 20 le for.. #
a680: 20 20 20 20 20 20 65 76 61 6c 75 61 74 69 6f 6e evaluation
a690: 20 62 79 20 61 6e 20 69 6e 74 65 72 70 72 65 74 by an interpret
a6a0: 65 72 20 63 72 65 61 74 65 64 20 69 6e 20 61 6e er created in an
a6b0: 20 69 73 6f 6c 61 74 65 64 20 61 70 70 6c 69 63 isolated applic
a6c0: 61 74 69 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 ation.. #
a6d0: 20 20 20 20 20 64 6f 6d 61 69 6e 2e 20 20 54 68 domain. Th
a6e0: 65 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e e script fragmen
a6f0: 74 20 62 65 69 6e 67 20 72 65 74 75 72 6e 65 64 t being returned
a700: 20 77 69 6c 6c 20 62 65 20 73 75 72 72 6f 75 6e will be surroun
a710: 64 65 64 20 62 79 0d 0a 20 20 20 20 20 20 23 20 ded by.. #
a720: 20 20 20 20 20 20 74 68 65 20 70 72 65 66 69 78 the prefix
a730: 20 61 6e 64 20 73 75 66 66 69 78 20 22 73 63 72 and suffix "scr
a740: 69 70 74 20 66 72 61 67 6d 65 6e 74 73 22 20 73 ipt fragments" s
a750: 70 65 63 69 66 69 65 64 20 62 79 20 6f 75 72 20 pecified by our
a760: 63 61 6c 6c 65 72 2c 0d 0a 20 20 20 20 20 20 23 caller,.. #
a770: 20 20 20 20 20 20 20 69 66 20 61 6e 79 2e 20 20 if any.
a780: 54 68 65 20 65 6e 74 69 72 65 20 73 63 72 69 70 The entire scrip
a790: 74 20 62 65 69 6e 67 20 72 65 74 75 72 6e 65 64 t being returned
a7a0: 20 77 69 6c 6c 20 62 65 20 73 75 62 73 74 69 74 will be substit
a7b0: 75 74 65 64 20 76 69 61 0d 0a 20 20 20 20 20 20 uted via..
a7c0: 23 20 20 20 20 20 20 20 5b 73 75 62 73 74 5d 2c # [subst],
a7d0: 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 20 in the context
a7e0: 6f 66 20 6f 75 72 20 63 61 6c 6c 65 72 2c 20 62 of our caller, b
a7f0: 65 66 6f 72 65 20 62 65 69 6e 67 20 72 65 74 75 efore being retu
a800: 72 6e 65 64 2e 0d 0a 20 20 20 20 20 20 23 20 20 rned... #
a810: 20 20 20 20 20 54 68 69 73 20 73 74 65 70 20 69 This step i
a820: 73 20 6e 65 63 65 73 73 61 72 79 20 73 6f 20 74 s necessary so t
a830: 68 61 74 20 73 6f 6d 65 20 6c 69 6d 69 74 65 64 hat some limited
a840: 20 63 6f 6e 74 65 78 74 20 69 6e 66 6f 72 6d 61 context informa
a850: 74 69 6f 6e 2c 0d 0a 20 20 20 20 20 20 23 20 20 tion,.. #
a860: 20 20 20 20 20 70 72 69 6d 61 72 69 6c 79 20 72 primarily r
a870: 65 6c 61 74 65 64 20 74 6f 20 74 68 65 20 74 65 elated to the te
a880: 73 74 69 6e 67 20 64 69 72 65 63 74 6f 72 69 65 sting directorie
a890: 73 2c 20 63 61 6e 20 62 65 20 74 72 61 6e 73 66 s, can be transf
a8a0: 65 72 72 65 64 0d 0a 20 20 20 20 20 20 23 20 20 erred.. #
a8b0: 20 20 20 20 20 74 6f 20 74 68 65 20 69 6e 74 65 to the inte
a8c0: 72 70 72 65 74 65 72 20 69 6e 20 74 68 65 20 69 rpreter in the i
a8d0: 73 6f 6c 61 74 65 64 20 61 70 70 6c 69 63 61 74 solated applicat
a8e0: 69 6f 6e 20 64 6f 6d 61 69 6e 2c 20 6d 61 6b 69 ion domain, maki
a8f0: 6e 67 20 69 74 0d 0a 20 20 20 20 20 20 23 20 20 ng it.. #
a900: 20 20 20 20 20 61 62 6c 65 20 74 6f 20 73 75 63 able to suc
a910: 63 65 73 73 66 75 6c 6c 79 20 72 75 6e 20 74 65 cessfully run te
a920: 73 74 73 20 74 68 61 74 20 72 65 71 75 69 72 65 sts that require
a930: 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 one or more of
a940: 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 the.. #
a950: 20 20 20 66 69 6c 65 73 20 69 6e 20 6f 6e 65 20 files in one
a960: 6f 66 20 74 68 65 20 74 65 73 74 69 6e 67 20 64 of the testing d
a970: 69 72 65 63 74 6f 72 69 65 73 2e 20 20 43 61 6c irectories. Cal
a980: 6c 65 72 73 20 73 68 6f 75 6c 64 20 6b 65 65 70 lers should keep
a990: 20 69 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 in.. #
a9a0: 20 20 20 6d 69 6e 64 20 74 68 61 74 20 74 68 65 mind that the
a9b0: 20 74 65 73 74 20 73 63 72 69 70 74 20 66 72 61 test script fra
a9c0: 67 6d 65 6e 74 20 62 65 69 6e 67 20 72 65 74 75 gment being retu
a9d0: 72 6e 65 64 20 63 61 6e 6e 6f 74 20 72 65 6c 79 rned cannot rely
a9e0: 20 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 on.. #
a9f0: 20 20 20 61 6e 79 20 73 63 72 69 70 74 20 6c 69 any script li
aa00: 62 72 61 72 79 20 70 72 6f 63 65 64 75 72 65 73 brary procedures
aa10: 20 74 68 61 74 20 61 72 65 20 6e 6f 74 20 70 72 that are not pr
aa20: 6f 76 69 64 65 64 20 62 79 20 74 68 65 20 45 61 ovided by the Ea
aa30: 67 6c 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 gle.. #
aa40: 20 20 20 6c 69 62 72 61 72 79 20 70 61 63 6b 61 library packa
aa50: 67 65 20 28 69 2e 65 2e 20 22 69 6e 69 74 2e 65 ge (i.e. "init.e
aa60: 61 67 6c 65 22 29 2c 20 69 6e 63 6c 75 64 69 6e agle"), includin
aa70: 67 20 74 68 6f 73 65 20 70 72 6f 76 69 64 65 64 g those provided
aa80: 20 62 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 by.. #
aa90: 20 20 20 74 68 65 20 45 61 67 6c 65 20 74 65 73 the Eagle tes
aaa0: 74 20 70 61 63 6b 61 67 65 2c 20 75 6e 6c 65 73 t package, unles
aab0: 73 20 74 68 65 20 66 69 6c 65 20 63 6f 6e 74 61 s the file conta
aac0: 69 6e 69 6e 67 20 74 68 65 6d 20 69 73 20 6c 6f ining them is lo
aad0: 61 64 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 aded.. #
aae0: 20 20 20 20 6d 61 6e 75 61 6c 6c 79 20 76 69 61 manually via
aaf0: 20 73 6f 6d 65 20 6f 74 68 65 72 20 6d 65 63 68 some other mech
ab00: 61 6e 69 73 6d 20 28 65 2e 67 2e 20 62 79 20 69 anism (e.g. by i
ab10: 6e 63 6c 75 64 69 6e 67 20 61 70 70 72 6f 70 72 ncluding appropr
ab20: 69 61 74 65 0d 0a 20 20 20 20 20 20 23 20 20 20 iate.. #
ab30: 20 20 20 20 5b 70 61 63 6b 61 67 65 20 72 65 71 [package req
ab40: 75 69 72 65 5d 20 6f 72 20 5b 73 6f 75 72 63 65 uire] or [source
ab50: 5d 20 63 6f 6d 6d 61 6e 64 73 20 69 6e 20 74 68 ] commands in th
ab60: 65 20 70 72 65 66 69 78 20 6f 72 20 73 75 66 66 e prefix or suff
ab70: 69 78 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ix.. #
ab80: 20 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e script fragmen
ab90: 74 73 29 2e 20 20 41 6c 73 6f 2c 20 61 6c 6c 20 ts). Also, all
aba0: 76 61 72 69 61 62 6c 65 20 72 65 66 65 72 65 6e variable referen
abb0: 63 65 73 20 61 6e 64 20 61 6c 6c 20 6e 65 73 74 ces and all nest
abc0: 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ed.. #
abd0: 20 20 63 6f 6d 6d 61 6e 64 73 20 28 69 2e 65 2e commands (i.e.
abe0: 20 74 68 6f 73 65 20 69 6e 20 73 71 75 61 72 65 those in square
abf0: 20 62 72 61 63 6b 65 74 73 29 20 63 6f 6e 74 61 brackets) conta
ac00: 69 6e 65 64 20 69 6e 20 74 68 65 20 66 69 6e 61 ined in the fina
ac10: 6c 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 l.. #
ac20: 20 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 script fragment
ac30: 20 77 69 6c 6c 20 65 6e 64 20 75 70 20 62 65 69 will end up bei
ac40: 6e 67 20 65 76 61 6c 75 61 74 65 64 20 69 6e 20 ng evaluated in
ac50: 74 68 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 74 the context of t
ac60: 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 he.. #
ac70: 20 20 63 61 6c 6c 69 6e 67 20 69 6e 74 65 72 70 calling interp
ac80: 72 65 74 65 72 20 61 6e 64 20 6e 6f 74 20 74 68 reter and not th
ac90: 65 20 74 61 72 67 65 74 20 69 6e 74 65 72 70 72 e target interpr
aca0: 65 74 65 72 20 63 72 65 61 74 65 64 20 69 6e 20 eter created in
acb0: 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 the.. #
acc0: 20 20 20 69 73 6f 6c 61 74 65 64 20 61 70 70 6c isolated appl
acd0: 69 63 61 74 69 6f 6e 20 64 6f 6d 61 69 6e 20 75 ication domain u
ace0: 6e 6c 65 73 73 20 74 68 65 20 64 6f 6c 6c 61 72 nless the dollar
acf0: 20 73 69 67 6e 73 20 61 6e 64 2f 6f 72 20 73 71 signs and/or sq
ad00: 75 61 72 65 0d 0a 20 20 20 20 20 20 23 20 20 20 uare.. #
ad10: 20 20 20 20 62 72 61 63 6b 65 74 73 20 61 72 65 brackets are
ad20: 20 73 70 65 63 69 61 6c 6c 79 20 71 75 6f 74 65 specially quote
ad30: 64 20 77 69 74 68 20 62 61 63 6b 73 6c 61 73 68 d with backslash
ad40: 65 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 es... #..
ad50: 20 20 20 20 72 65 74 75 72 6e 20 5b 75 70 6c 65 return [uple
ad60: 76 65 6c 20 31 20 5b 6c 69 73 74 20 73 75 62 73 vel 1 [list subs
ad70: 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 70 t [appendArgs $p
ad80: 72 65 66 69 78 20 7b 0d 0a 20 20 20 20 20 20 20 refix {..
ad90: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
ada0: 54 45 3a 20 54 68 65 20 5c 5b 6f 62 6a 65 63 74 TE: The \[object
adb0: 5c 5d 20 63 6f 6d 6d 61 6e 64 20 6d 61 79 20 62 \] command may b
adc0: 65 20 6d 69 73 73 69 6e 67 20 69 6e 20 73 6f 6d e missing in som
add0: 65 20 45 61 67 6c 65 20 63 6f 72 65 0d 0a 20 20 e Eagle core..
ade0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6c 69 # li
adf0: 62 72 61 72 79 20 63 6f 6e 66 69 67 75 72 61 74 brary configurat
ae00: 69 6f 6e 73 2e 20 20 43 6c 6f 6e 69 6e 67 20 61 ions. Cloning a
ae10: 6e 64 20 75 73 69 6e 67 20 74 68 65 20 70 72 6f nd using the pro
ae20: 63 65 64 75 72 65 0d 0a 20 20 20 20 20 20 20 20 cedure..
ae30: 23 20 20 20 20 20 20 20 5c 5b 63 68 61 6e 67 65 # \[change
ae40: 4e 61 74 69 76 65 52 75 6e 74 69 6d 65 4f 70 74 NativeRuntimeOpt
ae50: 69 6f 6e 5c 5d 20 6d 61 79 20 68 65 6c 70 20 74 ion\] may help t
ae60: 6f 20 6d 69 74 69 67 61 74 65 20 74 68 69 73 2e o mitigate this.
ae70: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
ae80: 20 20 20 20 20 70 72 6f 63 20 63 68 61 6e 67 65 proc change
ae90: 4e 61 74 69 76 65 52 75 6e 74 69 6d 65 4f 70 74 NativeRuntimeOpt
aea0: 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ion \..
aeb0: 20 20 20 7b 5b 69 6e 66 6f 20 61 72 67 73 20 63 {[info args c
aec0: 68 61 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 69 hangeNativeRunti
aed0: 6d 65 4f 70 74 69 6f 6e 5d 7d 20 5c 0d 0a 20 20 meOption]} \..
aee0: 20 20 20 20 20 20 20 20 20 20 7b 5b 69 6e 66 6f {[info
aef0: 20 62 6f 64 79 20 63 68 61 6e 67 65 4e 61 74 69 body changeNati
af00: 76 65 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 5d veRuntimeOption]
af10: 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 63 61 74 }.... cat
af20: 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
af30: 63 68 61 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 changeNativeRunt
af40: 69 6d 65 4f 70 74 69 6f 6e 20 5b 68 61 73 52 75 imeOption [hasRu
af50: 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 69 ntimeOption nati
af60: 76 65 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a ve].. }..
af70: 20 20 20 20 20 20 7d 20 5b 67 65 74 54 65 73 74 } [getTest
af80: 4f 76 65 72 72 69 64 65 73 50 72 65 61 6d 62 6c OverridesPreambl
af90: 65 20 5b 6c 69 73 74 20 70 61 74 68 20 74 65 73 e [list path tes
afa0: 74 5f 63 68 61 6e 6e 65 6c 5d 5d 20 24 73 75 66 t_channel]] $suf
afb0: 66 69 78 5d 5d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c fix]]].. }...
afc0: 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 79 43 6f .. proc tryCo
afd0: 70 79 45 78 74 65 72 6e 61 6c 46 69 6c 65 20 7b pyExternalFile {
afe0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 66 69 .. fi
aff0: 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d leName {platform
b000: 20 22 22 7d 20 7b 6e 65 77 46 69 6c 65 4e 61 6d ""} {newFileNam
b010: 65 20 22 22 7d 20 7b 76 65 72 62 6f 73 65 20 66 e ""} {verbose f
b020: 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 alse} } {..
b030: 20 73 65 74 20 73 6f 75 72 63 65 46 69 6c 65 4e set sourceFileN
b040: 61 6d 65 20 5b 67 65 74 45 78 74 65 72 6e 61 6c ame [getExternal
b050: 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 FileName $fileNa
b060: 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 me].... if
b070: 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {![file exists $
b080: 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 5d 7d sourceFileName]}
b090: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
b0a0: 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 if {$verbose} t
b0b0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
b0c0: 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
b0d0: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
b0e0: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
b0f0: 20 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 "---- skippe
b100: 64 20 63 6f 70 79 69 6e 67 20 65 78 74 65 72 6e d copying extern
b110: 61 6c 20 66 69 6c 65 20 5c 22 22 20 24 73 6f 75 al file \"" $sou
b120: 72 63 65 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 rceFileName \..
b130: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 "\"
b140: 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 , it does not ex
b150: 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 ist\n"]..
b160: 20 7d 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 }.. retu
b170: 72 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 rn.. }....
b180: 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
b190: 20 6c 65 6e 67 74 68 20 24 6e 65 77 46 69 6c 65 length $newFile
b1a0: 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 Name] > 0} then
b1b0: 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 {.. set t
b1c0: 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 argetFileName [g
b1d0: 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 etBinaryFileName
b1e0: 20 24 6e 65 77 46 69 6c 65 4e 61 6d 65 20 24 70 $newFileName $p
b1f0: 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 20 20 20 20 latform]..
b200: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
b210: 20 20 73 65 74 20 74 61 72 67 65 74 46 69 6c 65 set targetFile
b220: 4e 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 46 Name [getBinaryF
b230: 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d ileName $fileNam
b240: 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 e $platform]..
b250: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 }.... s
b260: 65 74 20 74 61 72 67 65 74 44 69 72 65 63 74 6f et targetDirecto
b270: 72 79 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 ry [file dirname
b280: 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 $targetFileName
b290: 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b ].... if {[
b2a0: 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
b2b0: 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 if {![file exis
b2c0: 74 73 20 24 74 61 72 67 65 74 44 69 72 65 63 74 ts $targetDirect
b2d0: 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ory]} then {..
b2e0: 20 20 20 20 20 20 20 20 66 69 6c 65 20 6d 6b 64 file mkd
b2f0: 69 72 20 24 74 61 72 67 65 74 44 69 72 65 63 74 ir $targetDirect
b300: 6f 72 79 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a ory.. }..
b310: 20 20 20 20 20 20 20 20 66 69 6c 65 20 63 6f 70 file cop
b320: 79 20 2d 66 6f 72 63 65 20 24 73 6f 75 72 63 65 y -force $source
b330: 46 69 6c 65 4e 61 6d 65 20 24 74 61 72 67 65 74 FileName $target
b340: 46 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 FileName..
b350: 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d }] == 0} then {.
b360: 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
b370: 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
b380: 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
b390: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
b3a0: 63 6f 70 69 65 64 20 65 78 74 65 72 6e 61 6c 20 copied external
b3b0: 66 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 73 file from \"" $s
b3c0: 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 22 5c ourceFileName "\
b3d0: 22 20 74 6f 20 5c 22 22 20 5c 0d 0a 20 20 20 20 " to \"" \..
b3e0: 20 20 20 20 20 20 20 20 24 74 61 72 67 65 74 46 $targetF
b3f0: 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 ileName \"\n]..
b400: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
b410: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
b420: 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
b430: 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
b440: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 61 "---- fa
b450: 69 6c 65 64 20 74 6f 20 63 6f 70 79 20 65 78 74 iled to copy ext
b460: 65 72 6e 61 6c 20 66 69 6c 65 20 66 72 6f 6d 20 ernal file from
b470: 5c 22 22 20 24 73 6f 75 72 63 65 46 69 6c 65 4e \"" $sourceFileN
b480: 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ame \..
b490: 20 20 20 22 5c 22 20 74 6f 20 5c 22 22 20 24 74 "\" to \"" $t
b4a0: 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5c 22 argetFileName \"
b4b0: 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 \n].. }..
b4c0: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
b4d0: 20 74 72 79 43 6f 70 79 42 69 6e 61 72 79 46 69 tryCopyBinaryFi
b4e0: 6c 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 le {..
b4f0: 20 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 fileName {plat
b500: 66 6f 72 6d 20 22 22 7d 20 7b 6e 65 77 46 69 6c form ""} {newFil
b510: 65 4e 61 6d 65 20 22 22 7d 20 7b 76 65 72 62 6f eName ""} {verbo
b520: 73 65 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 se false} } {..
b530: 20 20 20 20 20 73 65 74 20 73 6f 75 72 63 65 46 set sourceF
b540: 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 69 6e 61 ileName [getBina
b550: 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 ryFileName $file
b560: 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d Name $platform].
b570: 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 66 ... if {![f
b580: 69 6c 65 20 65 78 69 73 74 73 20 24 73 6f 75 72 ile exists $sour
b590: 63 65 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 ceFileName]} the
b5a0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
b5b0: 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 {$verbose} then
b5c0: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 {.. tpu
b5d0: 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
b5e0: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
b5f0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
b600: 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 63 6f "---- skipped co
b610: 70 79 69 6e 67 20 62 69 6e 61 72 79 20 66 69 6c pying binary fil
b620: 65 20 5c 22 22 20 24 73 6f 75 72 63 65 46 69 6c e \"" $sourceFil
b630: 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 eName \..
b640: 20 20 20 20 20 20 20 22 5c 22 2c 20 69 74 20 64 "\", it d
b650: 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 5c 6e 22 oes not exist\n"
b660: 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 ].. }..
b670: 20 20 20 20 20 20 72 65 74 75 72 6e 0d 0a 20 20 return..
b680: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 }.... i
b690: 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 f {[string lengt
b6a0: 68 20 24 6e 65 77 46 69 6c 65 4e 61 6d 65 5d 20 h $newFileName]
b6b0: 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
b6c0: 20 20 20 20 20 73 65 74 20 74 61 72 67 65 74 46 set targetF
b6d0: 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 75 69 6c ileName [getBuil
b6e0: 64 46 69 6c 65 4e 61 6d 65 20 24 6e 65 77 46 69 dFileName $newFi
b6f0: 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d leName $platform
b700: 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 ].. } else
b710: 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 {.. set t
b720: 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5b 67 argetFileName [g
b730: 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 etBuildFileName
b740: 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 $fileName $platf
b750: 6f 72 6d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d orm].. }...
b760: 0a 20 20 20 20 20 20 73 65 74 20 74 61 72 67 65 . set targe
b770: 74 44 69 72 65 63 74 6f 72 79 20 5b 66 69 6c 65 tDirectory [file
b780: 20 64 69 72 6e 61 6d 65 20 24 74 61 72 67 65 74 dirname $target
b790: 46 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 FileName]....
b7a0: 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
b7b0: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 66 . if {![f
b7c0: 69 6c 65 20 65 78 69 73 74 73 20 24 74 61 72 67 ile exists $targ
b7d0: 65 74 44 69 72 65 63 74 6f 72 79 5d 7d 20 74 68 etDirectory]} th
b7e0: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
b7f0: 66 69 6c 65 20 6d 6b 64 69 72 20 24 74 61 72 67 file mkdir $targ
b800: 65 74 44 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 etDirectory..
b810: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
b820: 66 69 6c 65 20 63 6f 70 79 20 2d 66 6f 72 63 65 file copy -force
b830: 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 $sourceFileName
b840: 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 $targetFileName
b850: 0d 0a 20 20 20 20 20 20 7d 5d 20 3d 3d 20 30 7d .. }] == 0}
b860: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
b870: 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
b880: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
b890: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
b8a0: 20 20 22 2d 2d 2d 2d 20 63 6f 70 69 65 64 20 62 "---- copied b
b8b0: 69 6e 61 72 79 20 66 69 6c 65 20 66 72 6f 6d 20 inary file from
b8c0: 5c 22 22 20 24 73 6f 75 72 63 65 46 69 6c 65 4e \"" $sourceFileN
b8d0: 61 6d 65 20 22 5c 22 20 74 6f 20 5c 22 22 20 5c ame "\" to \"" \
b8e0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 74 .. $t
b8f0: 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5c 22 argetFileName \"
b900: 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 \n].. } els
b910: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 e {.. tpu
b920: 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
b930: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
b940: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d .. "-
b950: 2d 2d 2d 20 66 61 69 6c 65 64 20 74 6f 20 63 6f --- failed to co
b960: 70 79 20 62 69 6e 61 72 79 20 66 69 6c 65 20 66 py binary file f
b970: 72 6f 6d 20 5c 22 22 20 24 73 6f 75 72 63 65 46 rom \"" $sourceF
b980: 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 ileName \..
b990: 20 20 20 20 20 20 20 22 5c 22 20 74 6f 20 5c 22 "\" to \"
b9a0: 22 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d " $targetFileNam
b9b0: 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d e \"\n].. }
b9c0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
b9d0: 70 72 6f 63 20 74 72 79 43 6f 70 79 42 75 69 6c proc tryCopyBuil
b9e0: 64 46 69 6c 65 20 7b 0d 0a 20 20 20 20 20 20 20 dFile {..
b9f0: 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 7b 70 fileName {p
ba00: 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7b 6e 65 77 latform ""} {new
ba10: 46 69 6c 65 4e 61 6d 65 20 22 22 7d 20 7b 76 65 FileName ""} {ve
ba20: 72 62 6f 73 65 20 66 61 6c 73 65 7d 20 7d 20 7b rbose false} } {
ba30: 0d 0a 20 20 20 20 20 20 73 65 74 20 73 6f 75 72 .. set sour
ba40: 63 65 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 ceFileName [getB
ba50: 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 24 66 69 uildFileName $fi
ba60: 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d leName $platform
ba70: 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 ].... if {!
ba80: 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 73 6f [file exists $so
ba90: 75 72 63 65 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 urceFileName]} t
baa0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 hen {.. i
bab0: 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 f {$verbose} the
bac0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 n {.. t
bad0: 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
bae0: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
baf0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
bb00: 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 "---- skipped
bb10: 63 6f 70 79 69 6e 67 20 62 75 69 6c 64 20 66 69 copying build fi
bb20: 6c 65 20 5c 22 22 20 24 73 6f 75 72 63 65 46 69 le \"" $sourceFi
bb30: 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 leName \..
bb40: 20 20 20 20 20 20 20 20 22 5c 22 2c 20 69 74 20 "\", it
bb50: 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 5c 6e does not exist\n
bb60: 22 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 "].. }..
bb70: 20 20 20 20 20 20 20 72 65 74 75 72 6e 0d 0a 20 return..
bb80: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
bb90: 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
bba0: 74 68 20 24 6e 65 77 46 69 6c 65 4e 61 6d 65 5d th $newFileName]
bbb0: 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
bbc0: 20 20 20 20 20 20 73 65 74 20 74 61 72 67 65 74 set target
bbd0: 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 69 6e FileName [getBin
bbe0: 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 6e 65 77 aryFileName $new
bbf0: 46 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f FileName $platfo
bc00: 72 6d 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 rm].. } els
bc10: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 e {.. set
bc20: 20 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 targetFileName
bc30: 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 [getBinaryFileNa
bc40: 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c me $fileName $pl
bc50: 61 74 66 6f 72 6d 5d 0d 0a 20 20 20 20 20 20 7d atform].. }
bc60: 0d 0a 0d 0a 20 20 20 20 20 20 73 65 74 20 74 61 .... set ta
bc70: 72 67 65 74 44 69 72 65 63 74 6f 72 79 20 5b 66 rgetDirectory [f
bc80: 69 6c 65 20 64 69 72 6e 61 6d 65 20 24 74 61 72 ile dirname $tar
bc90: 67 65 74 46 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a getFileName]....
bca0: 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
bcb0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
bcc0: 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 74 ![file exists $t
bcd0: 61 72 67 65 74 44 69 72 65 63 74 6f 72 79 5d 7d argetDirectory]}
bce0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
bcf0: 20 20 20 66 69 6c 65 20 6d 6b 64 69 72 20 24 74 file mkdir $t
bd00: 61 72 67 65 74 44 69 72 65 63 74 6f 72 79 0d 0a argetDirectory..
bd10: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
bd20: 20 20 20 66 69 6c 65 20 63 6f 70 79 20 2d 66 6f file copy -fo
bd30: 72 63 65 20 24 73 6f 75 72 63 65 46 69 6c 65 4e rce $sourceFileN
bd40: 61 6d 65 20 24 74 61 72 67 65 74 46 69 6c 65 4e ame $targetFileN
bd50: 61 6d 65 0d 0a 20 20 20 20 20 20 7d 5d 20 3d 3d ame.. }] ==
bd60: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
bd70: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
bd80: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
bd90: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
bda0: 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 69 65 "---- copie
bdb0: 64 20 62 75 69 6c 64 20 66 69 6c 65 20 66 72 6f d build file fro
bdc0: 6d 20 5c 22 22 20 24 73 6f 75 72 63 65 46 69 6c m \"" $sourceFil
bdd0: 65 4e 61 6d 65 20 22 5c 22 20 74 6f 20 5c 22 22 eName "\" to \""
bde0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
bdf0: 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 $targetFileName
be00: 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 65 \"\n].. } e
be10: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 lse {.. t
be20: 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
be30: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
be40: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
be50: 22 2d 2d 2d 2d 20 66 61 69 6c 65 64 20 74 6f 20 "---- failed to
be60: 63 6f 70 79 20 62 75 69 6c 64 20 66 69 6c 65 20 copy build file
be70: 66 72 6f 6d 20 5c 22 22 20 24 73 6f 75 72 63 65 from \"" $source
be80: 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 FileName \..
be90: 20 20 20 20 20 20 20 20 22 5c 22 20 74 6f 20 5c "\" to \
bea0: 22 22 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 "" $targetFileNa
beb0: 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 me \"\n]..
bec0: 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
bed0: 20 70 72 6f 63 20 74 72 79 44 65 6c 65 74 65 42 proc tryDeleteB
bee0: 69 6e 61 72 79 46 69 6c 65 20 7b 20 66 69 6c 65 inaryFile { file
bef0: 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 6d 20 22 Name {platform "
bf00: 22 7d 20 7b 76 65 72 62 6f 73 65 20 66 61 6c 73 "} {verbose fals
bf10: 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 e} } {.. se
bf20: 74 20 66 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 t fileName [getB
bf30: 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 inaryFileName $f
bf40: 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 ileName $platfor
bf50: 6d 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b m].... if {
bf60: 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 ![file exists $f
bf70: 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b ileName]} then {
bf80: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 24 76 .. if {$v
bf90: 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a erbose} then {..
bfa0: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
bfb0: 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
bfc0: 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
bfd0: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
bfe0: 2d 2d 20 73 6b 69 70 70 65 64 20 64 65 6c 65 74 -- skipped delet
bff0: 69 6e 67 20 62 69 6e 61 72 79 20 66 69 6c 65 20 ing binary file
c000: 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 0d \"" $fileName \.
c010: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
c020: 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 \", it does not
c030: 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 exist\n"]..
c040: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 72 65 }.. re
c050: 74 75 72 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d turn.. }...
c060: 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 . if {[catc
c070: 68 20 7b 66 69 6c 65 20 64 65 6c 65 74 65 20 24 h {file delete $
c080: 66 69 6c 65 4e 61 6d 65 7d 5d 20 3d 3d 20 30 7d fileName}] == 0}
c090: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
c0a0: 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
c0b0: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
c0c0: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
c0d0: 20 20 22 2d 2d 2d 2d 20 64 65 6c 65 74 65 64 20 "---- deleted
c0e0: 62 69 6e 61 72 79 20 66 69 6c 65 20 5c 22 22 20 binary file \""
c0f0: 24 66 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d $fileName \"\n].
c100: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
c110: 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
c120: 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
c130: 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
c140: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
c150: 66 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 failed to delete
c160: 20 62 69 6e 61 72 79 20 66 69 6c 65 20 5c 22 22 binary file \""
c170: 20 24 66 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d $fileName \"\n]
c180: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
c190: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 ..... proc tr
c1a0: 79 44 65 6c 65 74 65 42 75 69 6c 64 46 69 6c 65 yDeleteBuildFile
c1b0: 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 { fileName {pla
c1c0: 74 66 6f 72 6d 20 22 22 7d 20 7b 76 65 72 62 6f tform ""} {verbo
c1d0: 73 65 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 se false} } {..
c1e0: 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d set fileNam
c1f0: 65 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e e [getBuildFileN
c200: 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 ame $fileName $p
c210: 6c 61 74 66 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 latform]....
c220: 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 if {![file exi
c230: 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 sts $fileName]}
c240: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
c250: 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 if {$verbose} th
c260: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
c270: 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
c280: 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
c290: 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
c2a0: 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 "---- skipped
c2b0: 20 64 65 6c 65 74 69 6e 67 20 62 75 69 6c 64 20 deleting build
c2c0: 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 file \"" $fileNa
c2d0: 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 me \..
c2e0: 20 20 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 "\", it does
c2f0: 20 6e 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a not exist\n"]..
c300: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
c310: 20 20 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 return..
c320: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b }.... if {
c330: 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 64 65 6c [catch {file del
c340: 65 74 65 20 24 66 69 6c 65 4e 61 6d 65 7d 5d 20 ete $fileName}]
c350: 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
c360: 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
c370: 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
c380: 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
c390: 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 64 65 6c "---- del
c3a0: 65 74 65 64 20 62 75 69 6c 64 20 66 69 6c 65 20 eted build file
c3b0: 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 22 \"" $fileName \"
c3c0: 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 \n].. } els
c3d0: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 e {.. tpu
c3e0: 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
c3f0: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
c400: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d .. "-
c410: 2d 2d 2d 20 66 61 69 6c 65 64 20 74 6f 20 64 65 --- failed to de
c420: 6c 65 74 65 20 62 75 69 6c 64 20 66 69 6c 65 20 lete build file
c430: 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 22 \"" $fileName \"
c440: 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 \n].. }..
c450: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
c460: 20 74 72 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 tryCopyAssembly
c470: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
c480: 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 6f fileName {platfo
c490: 72 6d 20 22 22 7d 20 7b 70 64 62 20 74 72 75 65 rm ""} {pdb true
c4a0: 7d 20 7b 76 65 72 62 6f 73 65 20 66 61 6c 73 65 } {verbose false
c4b0: 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 72 79 } } {.. try
c4c0: 43 6f 70 79 42 75 69 6c 64 46 69 6c 65 20 24 66 CopyBuildFile $f
c4d0: 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 ileName $platfor
c4e0: 6d 20 22 22 20 24 76 65 72 62 6f 73 65 0d 0a 0d m "" $verbose...
c4f0: 0a 20 20 20 20 20 20 69 66 20 7b 24 70 64 62 7d . if {$pdb}
c500: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
c510: 20 74 72 79 43 6f 70 79 42 75 69 6c 64 46 69 6c tryCopyBuildFil
c520: 65 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d e [appendArgs \.
c530: 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
c540: 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 24 66 69 6c le rootname $fil
c550: 65 4e 61 6d 65 5d 20 2e 70 64 62 5d 20 24 70 6c eName] .pdb] $pl
c560: 61 74 66 6f 72 6d 20 22 22 20 24 76 65 72 62 6f atform "" $verbo
c570: 73 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 se.. }..
c580: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
c590: 74 72 79 44 65 6c 65 74 65 41 73 73 65 6d 62 6c tryDeleteAssembl
c5a0: 79 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 y {..
c5b0: 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 fileName {platf
c5c0: 6f 72 6d 20 22 22 7d 20 7b 70 64 62 20 74 72 75 orm ""} {pdb tru
c5d0: 65 7d 20 7b 76 65 72 62 6f 73 65 20 66 61 6c 73 e} {verbose fals
c5e0: 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 72 e} } {.. tr
c5f0: 79 44 65 6c 65 74 65 42 69 6e 61 72 79 46 69 6c yDeleteBinaryFil
c600: 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 e $fileName $pla
c610: 74 66 6f 72 6d 20 24 76 65 72 62 6f 73 65 0d 0a tform $verbose..
c620: 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 70 64 62 .. if {$pdb
c630: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
c640: 20 20 74 72 79 44 65 6c 65 74 65 42 69 6e 61 72 tryDeleteBinar
c650: 79 46 69 6c 65 20 5b 61 70 70 65 6e 64 41 72 67 yFile [appendArg
c660: 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
c670: 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 [file rootname
c680: 24 66 69 6c 65 4e 61 6d 65 5d 20 2e 70 64 62 5d $fileName] .pdb]
c690: 20 24 70 6c 61 74 66 6f 72 6d 20 24 76 65 72 62 $platform $verb
c6a0: 6f 73 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 ose.. }..
c6b0: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
c6c0: 20 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 6c 79 tryLoadAssembly
c6d0: 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 { fileName {pla
c6e0: 74 66 6f 72 6d 20 22 22 7d 20 7d 20 7b 0d 0a 20 tform ""} } {..
c6f0: 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d set fileNam
c700: 65 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 e [getBinaryFile
c710: 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 Name $fileName $
c720: 70 6c 61 74 66 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 platform]....
c730: 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
c740: 0a 20 20 20 20 20 20 20 20 73 65 74 20 61 73 73 . set ass
c750: 65 6d 62 6c 79 20 5b 6f 62 6a 65 63 74 20 6c 6f embly [object lo
c760: 61 64 20 2d 6c 6f 61 64 74 79 70 65 20 46 69 6c ad -loadtype Fil
c770: 65 20 2d 61 6c 69 61 73 20 24 66 69 6c 65 4e 61 e -alias $fileNa
c780: 6d 65 5d 0d 0a 20 20 20 20 20 20 7d 5d 20 3d 3d me].. }] ==
c790: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
c7a0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
c7b0: 20 4e 4f 54 45 3a 20 4e 6f 77 2c 20 61 64 64 20 NOTE: Now, add
c7c0: 74 68 65 20 6e 65 63 65 73 73 61 72 79 20 74 65 the necessary te
c7d0: 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 2e 0d 0a st constraint...
c7e0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
c7f0: 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 addConstraint
c800: 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 [file rootname
c810: 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 [file tail $file
c820: 4e 61 6d 65 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 Name]]....
c830: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
c840: 4f 54 45 3a 20 47 72 61 62 20 74 68 65 20 69 6d OTE: Grab the im
c850: 61 67 65 20 72 75 6e 74 69 6d 65 20 76 65 72 73 age runtime vers
c860: 69 6f 6e 20 66 72 6f 6d 20 74 68 65 20 61 73 73 ion from the ass
c870: 65 6d 62 6c 79 20 62 65 63 61 75 73 65 0d 0a 20 embly because..
c880: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 # s
c890: 65 76 65 72 61 6c 20 74 65 73 74 73 20 72 65 6c everal tests rel
c8a0: 79 20 6f 6e 20 69 74 20 68 61 76 69 6e 67 20 61 y on it having a
c8b0: 20 63 65 72 74 61 69 6e 20 76 61 6c 75 65 2e 0d certain value..
c8c0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
c8d0: 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e addConstrain
c8e0: 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 66 t [appendArgs [f
c8f0: 69 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 4e 61 ile tail $fileNa
c900: 6d 65 5d 20 5f 20 5c 0d 0a 20 20 20 20 20 20 20 me] _ \..
c910: 20 20 20 20 20 5b 24 61 73 73 65 6d 62 6c 79 20 [$assembly
c920: 49 6d 61 67 65 52 75 6e 74 69 6d 65 56 65 72 73 ImageRuntimeVers
c930: 69 6f 6e 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 ion]]....
c940: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
c950: 54 45 3a 20 52 65 74 75 72 6e 20 74 68 65 20 66 TE: Return the f
c960: 75 6c 6c 20 70 61 74 68 20 6f 66 20 74 68 65 20 ull path of the
c970: 6c 6f 61 64 65 64 20 66 69 6c 65 2e 0d 0a 20 20 loaded file...
c980: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
c990: 20 72 65 74 75 72 6e 20 24 66 69 6c 65 4e 61 6d return $fileNam
c9a0: 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 e.. }....
c9b0: 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 return ""..
c9c0: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
c9d0: 63 20 69 73 53 51 4c 69 74 65 52 65 61 64 79 20 c isSQLiteReady
c9e0: 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 {} {.. #..
c9f0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 # NOTE: Thi
ca00: 73 20 70 72 6f 63 65 64 75 72 65 20 6d 75 73 74 s procedure must
ca10: 20 72 65 74 75 72 6e 20 6e 6f 6e 2d 7a 65 72 6f return non-zero
ca20: 20 6f 6e 6c 79 20 69 66 20 74 68 65 20 53 51 4c only if the SQL
ca30: 69 74 65 20 6e 61 74 69 76 65 0d 0a 20 20 20 20 ite native..
ca40: 20 20 23 20 20 20 20 20 20 20 6c 69 62 72 61 72 # librar
ca50: 79 20 61 6e 64 20 74 68 65 20 53 79 73 74 65 6d y and the System
ca60: 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 6d 61 6e .Data.SQLite man
ca70: 61 67 65 64 20 61 73 73 65 6d 62 6c 79 20 61 72 aged assembly ar
ca80: 65 20 6c 6f 61 64 65 64 0d 0a 20 20 20 20 20 20 e loaded..
ca90: 23 20 20 20 20 20 20 20 61 6e 64 20 72 65 61 64 # and read
caa0: 79 20 66 6f 72 20 75 73 65 20 62 79 20 74 68 65 y for use by the
cab0: 20 74 65 73 74 20 73 75 69 74 65 2e 20 20 43 75 test suite. Cu
cac0: 72 72 65 6e 74 6c 79 2c 20 74 68 69 73 20 70 72 rrently, this pr
cad0: 6f 63 65 64 75 72 65 0d 0a 20 20 20 20 20 20 23 ocedure.. #
cae0: 20 20 20 20 20 20 20 73 68 6f 75 6c 64 20 62 65 should be
caf0: 20 63 61 6c 6c 65 64 20 6f 6e 6c 79 20 61 66 74 called only aft
cb00: 65 72 20 74 68 65 20 5b 74 72 79 4c 6f 61 64 41 er the [tryLoadA
cb10: 73 73 65 6d 62 6c 79 5d 20 70 72 6f 63 65 64 75 ssembly] procedu
cb20: 72 65 20 68 61 73 0d 0a 20 20 20 20 20 20 23 20 re has.. #
cb30: 20 20 20 20 20 20 62 65 65 6e 20 63 61 6c 6c 65 been calle
cb40: 64 20 74 6f 20 70 72 6f 62 65 20 66 6f 72 20 74 d to probe for t
cb50: 68 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 he System.Data.S
cb60: 51 4c 69 74 65 20 6d 61 6e 61 67 65 64 20 61 73 QLite managed as
cb70: 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 20 23 20 sembly.. #
cb80: 20 20 20 20 20 20 61 6e 64 20 74 68 65 20 5b 63 and the [c
cb90: 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 5d 20 70 heckForSQLite] p
cba0: 72 6f 63 65 64 75 72 65 20 68 61 73 20 62 65 65 rocedure has bee
cbb0: 6e 20 63 61 6c 6c 65 64 20 74 6f 20 70 72 6f 62 n called to prob
cbc0: 65 20 66 6f 72 0d 0a 20 20 20 20 20 20 23 20 20 e for.. #
cbd0: 20 20 20 20 20 74 68 65 20 53 51 4c 69 74 65 20 the SQLite
cbe0: 6e 61 74 69 76 65 20 6c 69 62 72 61 72 79 3b 20 native library;
cbf0: 6f 74 68 65 72 77 69 73 65 2c 20 74 68 69 73 20 otherwise, this
cc00: 70 72 6f 63 65 64 75 72 65 20 77 69 6c 6c 20 73 procedure will s
cc10: 69 6d 70 6c 79 0d 0a 20 20 20 20 20 20 23 20 20 imply.. #
cc20: 20 20 20 20 20 61 6c 77 61 79 73 20 72 65 74 75 always retu
cc30: 72 6e 20 7a 65 72 6f 2e 0d 0a 20 20 20 20 20 20 rn zero...
cc40: 23 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 #.. return
cc50: 5b 65 78 70 72 20 7b 0d 0a 20 20 20 20 20 20 20 [expr {..
cc60: 20 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 [haveConstraint
cc70: 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
cc80: 69 74 65 5d 20 26 26 20 5b 68 61 76 65 43 6f 6e ite] && [haveCon
cc90: 73 74 72 61 69 6e 74 20 53 51 4c 69 74 65 5d 0d straint SQLite].
cca0: 0a 20 20 20 20 20 20 7d 5d 0d 0a 20 20 20 20 7d . }].. }
ccb0: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 6d 61 ..... proc ma
ccc0: 74 63 68 50 6c 61 74 66 6f 72 6d 20 7b 20 70 6c tchPlatform { pl
ccd0: 61 74 66 6f 72 6d 20 7d 20 7b 0d 0a 20 20 20 20 atform } {..
cce0: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
ccf0: 45 3a 20 41 6e 20 65 6d 70 74 79 20 73 74 72 69 E: An empty stri
cd00: 6e 67 20 66 6f 72 20 74 68 65 20 70 6c 61 74 66 ng for the platf
cd10: 6f 72 6d 20 6d 65 61 6e 73 20 74 68 61 74 20 74 orm means that t
cd20: 68 65 20 62 75 69 6c 64 20 69 73 20 6e 6f 74 0d he build is not.
cd30: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 5b . # [
cd40: 70 72 69 6d 61 72 69 6c 79 5d 20 61 20 6e 61 74 primarily] a nat
cd50: 69 76 65 20 62 75 69 6c 64 3b 20 74 68 65 72 65 ive build; there
cd60: 66 6f 72 65 2c 20 69 74 20 61 6c 77 61 79 73 20 fore, it always
cd70: 6d 61 74 63 68 65 73 2e 0d 0a 20 20 20 20 20 20 matches...
cd80: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 #.. if {[st
cd90: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 ring length $pla
cda0: 74 66 6f 72 6d 5d 20 3d 3d 20 30 7d 20 74 68 65 tform] == 0} the
cdb0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 n {.. ret
cdc0: 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 urn true..
cdd0: 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
cde0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 6f 65 73 # NOTE: Does
cdf0: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 70 the specified p
ce00: 6c 61 74 66 6f 72 6d 20 6d 61 74 63 68 20 75 70 latform match up
ce10: 20 74 6f 20 74 68 65 20 63 75 72 72 65 6e 74 20 to the current
ce20: 70 72 6f 63 65 73 73 3f 0d 0a 20 20 20 20 20 20 process?..
ce30: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 70 6c #.. if {$pl
ce40: 61 74 66 6f 72 6d 20 65 71 20 5b 6d 61 63 68 69 atform eq [machi
ce50: 6e 65 54 6f 50 6c 61 74 66 6f 72 6d 20 24 3a 3a neToPlatform $::
ce60: 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 6d 61 63 tcl_platform(mac
ce70: 68 69 6e 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a hine)]} then {..
ce80: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 return t
ce90: 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a rue.. }....
cea0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
ceb0: 20 4e 4f 54 45 3a 20 54 68 65 20 73 70 65 63 69 NOTE: The speci
cec0: 66 69 65 64 20 70 6c 61 74 66 6f 72 6d 20 64 6f fied platform do
ced0: 65 73 20 6e 6f 74 20 6d 61 74 63 68 20 75 70 20 es not match up
cee0: 77 69 74 68 20 74 68 65 20 70 6c 61 74 66 6f 72 with the platfor
cef0: 6d 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 m.. #
cf00: 20 66 6f 72 20 74 68 65 20 63 75 72 72 65 6e 74 for the current
cf10: 20 70 72 6f 63 65 73 73 2e 0d 0a 20 20 20 20 20 process...
cf20: 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e #.. return
cf30: 20 66 61 6c 73 65 0d 0a 20 20 20 20 7d 0d 0a 0c false.. }...
cf40: 0d 0a 20 20 20 20 70 72 6f 63 20 68 61 76 65 53 .. proc haveS
cf50: 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 QLiteObjectComma
cf60: 6e 64 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 nd {} {.. #
cf70: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
cf80: 49 73 20 74 68 65 20 5b 6f 62 6a 65 63 74 5d 20 Is the [object]
cf90: 63 6f 6d 6d 61 6e 64 20 63 75 72 72 65 6e 74 6c command currentl
cfa0: 79 20 61 76 61 69 6c 61 62 6c 65 3f 0d 0a 20 20 y available?..
cfb0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 #.. ret
cfc0: 75 72 6e 20 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e urn [expr {[llen
cfd0: 67 74 68 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e gth [info comman
cfe0: 64 73 20 6f 62 6a 65 63 74 5d 5d 20 3e 20 30 7d ds object]] > 0}
cff0: 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 ].. }.....
d000: 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 51 proc checkForSQ
d010: 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e LiteObjectComman
d020: 64 20 7b 20 63 68 61 6e 6e 65 6c 20 7d 20 7b 0d d { channel } {.
d030: 0a 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 . tputs $ch
d040: 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 68 65 63 annel "---- chec
d050: 6b 69 6e 67 20 66 6f 72 20 5c 22 6f 62 6a 65 63 king for \"objec
d060: 74 5c 22 20 63 6f 6d 6d 61 6e 64 20 75 73 61 67 t\" command usag
d070: 65 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 e... "....
d080: 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
d090: 73 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 4f 62 6a s ::no(sqliteObj
d0a0: 65 63 74 43 6f 6d 6d 61 6e 64 29 5d 20 26 26 20 ectCommand)] &&
d0b0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 68 61 \.. [ha
d0c0: 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f veSQLiteObjectCo
d0d0: 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a mmand]} then {..
d0e0: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
d0f0: 68 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a 20 20 hannel yes\n..
d100: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
d110: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
d120: 20 23 20 4e 4f 54 45 3a 20 55 6e 6c 65 73 73 20 # NOTE: Unless
d130: 77 65 20 61 72 65 20 66 6f 72 62 69 64 64 65 6e we are forbidden
d140: 20 66 72 6f 6d 20 64 6f 69 6e 67 20 73 6f 2c 20 from doing so,
d150: 61 64 64 20 73 6f 6d 65 20 63 6f 6e 73 74 72 61 add some constra
d160: 69 6e 74 73 0d 0a 20 20 20 20 20 20 20 20 23 20 ints.. #
d170: 20 20 20 20 20 20 74 68 61 74 20 77 69 6c 6c 20 that will
d180: 61 6c 6c 6f 77 20 6d 6f 73 74 20 6f 66 20 74 68 allow most of th
d190: 65 20 74 65 73 74 20 73 75 69 74 65 20 74 6f 20 e test suite to
d1a0: 72 75 6e 20 28 69 2e 65 2e 20 74 68 6f 73 65 0d run (i.e. those.
d1b0: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
d1c0: 20 74 65 73 74 73 20 74 68 61 74 20 64 6f 20 6e tests that do n
d1d0: 6f 74 20 64 69 72 65 63 74 6c 79 20 72 65 6c 79 ot directly rely
d1e0: 20 75 70 6f 6e 20 74 68 65 20 5b 6f 62 6a 65 63 upon the [objec
d1f0: 74 5d 20 63 6f 6d 6d 61 6e 64 29 2e 0d 0a 20 20 t] command)...
d200: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
d210: 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
d220: 74 73 20 3a 3a 6e 6f 28 73 68 69 6d 53 51 4c 69 ts ::no(shimSQLi
d230: 74 65 41 73 73 65 6d 62 6c 79 43 6f 6e 73 74 72 teAssemblyConstr
d240: 61 69 6e 74 73 29 5d 7d 20 74 68 65 6e 20 7b 0d aints)]} then {.
d250: 0a 20 20 20 20 20 20 20 20 20 20 61 64 64 43 6f . addCo
d260: 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 74 65 0d nstraint SQLite.
d270: 0a 20 20 20 20 20 20 20 20 20 20 61 64 64 43 6f . addCo
d280: 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 74 65 49 nstraint SQLiteI
d290: 6e 74 65 72 6f 70 0d 0a 20 20 20 20 20 20 20 20 nterop..
d2a0: 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 addConstraint
d2b0: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
d2c0: 74 65 0d 0a 20 20 20 20 20 20 20 20 20 20 61 64 te.. ad
d2d0: 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 79 73 74 dConstraint Syst
d2e0: 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 45 em.Data.SQLite.E
d2f0: 6e 63 72 79 70 74 69 6f 6e 0d 0a 20 20 20 20 20 ncryption..
d300: 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 addConstrai
d310: 6e 74 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 nt System.Data.S
d320: 51 4c 69 74 65 2e 4c 69 6e 71 0d 0a 0d 0a 20 20 QLite.Linq....
d330: 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 addConst
d340: 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
d350: 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
d360: 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 System.Data.S
d370: 51 4c 69 74 65 2e 64 6c 6c 5f 76 20 5b 67 65 74 QLite.dll_v [get
d380: 42 75 69 6c 64 43 6c 72 56 65 72 73 69 6f 6e 5d BuildClrVersion]
d390: 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a ].. }....
d3a0: 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
d3b0: 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 73 fo exists ::no(s
d3c0: 68 69 6d 53 51 4c 69 74 65 44 65 66 69 6e 65 43 himSQLiteDefineC
d3d0: 6f 6e 73 74 61 6e 74 43 6f 6e 73 74 72 61 69 6e onstantConstrain
d3e0: 74 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ts)]} then {..
d3f0: 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
d400: 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 20 5b defineConstant [
d410: 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 list \..
d420: 20 20 20 20 20 20 49 4e 54 45 52 4f 50 5f 45 58 INTEROP_EX
d430: 54 45 4e 53 49 4f 4e 5f 46 55 4e 43 54 49 4f 4e TENSION_FUNCTION
d440: 53 20 49 4e 54 45 52 4f 50 5f 46 54 53 35 5f 45 S INTEROP_FTS5_E
d450: 58 54 45 4e 53 49 4f 4e 20 5c 0d 0a 20 20 20 20 XTENSION \..
d460: 20 20 20 20 20 20 20 20 20 20 49 4e 54 45 52 4f INTERO
d470: 50 5f 4a 53 4f 4e 31 5f 45 58 54 45 4e 53 49 4f P_JSON1_EXTENSIO
d480: 4e 20 49 4e 54 45 52 4f 50 5f 50 45 52 43 45 4e N INTEROP_PERCEN
d490: 54 49 4c 45 5f 45 58 54 45 4e 53 49 4f 4e 20 5c TILE_EXTENSION \
d4a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
d4b0: 49 4e 54 45 52 4f 50 5f 52 45 47 45 58 50 5f 45 INTEROP_REGEXP_E
d4c0: 58 54 45 4e 53 49 4f 4e 20 49 4e 54 45 52 4f 50 XTENSION INTEROP
d4d0: 5f 54 45 53 54 5f 45 58 54 45 4e 53 49 4f 4e 20 _TEST_EXTENSION
d4e0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
d4f0: 20 49 4e 54 45 52 4f 50 5f 54 4f 54 59 50 45 5f INTEROP_TOTYPE_
d500: 45 58 54 45 4e 53 49 4f 4e 20 49 4e 54 45 52 4f EXTENSION INTERO
d510: 50 5f 56 49 52 54 55 41 4c 5f 54 41 42 4c 45 20 P_VIRTUAL_TABLE
d520: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
d530: 20 55 53 45 5f 49 4e 54 45 52 4f 50 5f 44 4c 4c USE_INTEROP_DLL
d540: 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ] {..
d550: 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 5b addConstraint [
d560: 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
d570: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 [g
d580: 65 74 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f etSQLiteDefineCo
d590: 6e 73 74 61 6e 74 50 72 65 66 69 78 5d 20 24 64 nstantPrefix] $d
d5a0: 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 5d 0d 0a efineConstant]..
d5b0: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
d5c0: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
d5d0: 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
d5e0: 73 74 73 20 3a 3a 6e 6f 28 73 68 69 6d 53 51 4c sts ::no(shimSQL
d5f0: 69 74 65 56 69 73 75 61 6c 53 74 75 64 69 6f 43 iteVisualStudioC
d600: 6f 6e 73 74 72 61 69 6e 74 73 29 5d 7d 20 74 68 onstraints)]} th
d610: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
d620: 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 addConstraint [a
d630: 70 70 65 6e 64 41 72 67 73 20 76 69 73 75 61 6c ppendArgs visual
d640: 53 74 75 64 69 6f 20 5b 67 65 74 42 75 69 6c 64 Studio [getBuild
d650: 59 65 61 72 5d 5d 0d 0a 20 20 20 20 20 20 20 20 Year]]..
d660: 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 75 }.... tpu
d670: 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e ts $channel no\n
d680: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
d690: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 68 ..... proc ch
d6a0: 61 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 69 6d angeNativeRuntim
d6b0: 65 4f 70 74 69 6f 6e 20 7b 20 6e 61 74 69 76 65 eOption { native
d6c0: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b } {.. if {
d6d0: 5b 6c 6c 65 6e 67 74 68 20 5b 69 6e 66 6f 20 63 [llength [info c
d6e0: 6f 6d 6d 61 6e 64 73 20 64 65 62 75 67 5d 5d 20 ommands debug]]
d6f0: 3e 20 30 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 > 0 && \..
d700: 20 20 20 20 5b 6c 6c 65 6e 67 74 68 20 5b 69 6e [llength [in
d710: 66 6f 20 73 75 62 63 6f 6d 6d 61 6e 64 73 20 64 fo subcommands d
d720: 65 62 75 67 20 72 75 6e 74 69 6d 65 6f 70 74 69 ebug runtimeopti
d730: 6f 6e 5d 5d 20 3e 20 30 20 26 26 20 5b 63 61 74 on]] > 0 && [cat
d740: 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 64 65 ch {.. de
d750: 62 75 67 20 72 75 6e 74 69 6d 65 6f 70 74 69 6f bug runtimeoptio
d760: 6e 20 5b 65 78 70 72 20 7b 24 6e 61 74 69 76 65 n [expr {$native
d770: 20 3f 20 22 61 64 64 22 20 3a 20 22 72 65 6d 6f ? "add" : "remo
d780: 76 65 22 7d 5d 20 6e 61 74 69 76 65 0d 0a 20 20 ve"}] native..
d790: 20 20 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 }] == 0} the
d7a0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 n {.. ret
d7b0: 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 urn true..
d7c0: 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b }.... if {[
d7d0: 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 haveSQLiteObject
d7e0: 43 6f 6d 6d 61 6e 64 5d 20 26 26 20 5b 63 61 74 Command] && [cat
d7f0: 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 ch {.. ob
d800: 6a 65 63 74 20 69 6e 76 6f 6b 65 20 49 6e 74 65 ject invoke Inte
d810: 72 70 72 65 74 65 72 2e 47 65 74 41 63 74 69 76 rpreter.GetActiv
d820: 65 20 5b 65 78 70 72 20 7b 24 6e 61 74 69 76 65 e [expr {$native
d830: 20 3f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ? \..
d840: 20 20 22 41 64 64 52 75 6e 74 69 6d 65 4f 70 74 "AddRuntimeOpt
d850: 69 6f 6e 22 20 3a 20 22 52 65 6d 6f 76 65 52 75 ion" : "RemoveRu
d860: 6e 74 69 6d 65 4f 70 74 69 6f 6e 22 7d 5d 20 6e ntimeOption"}] n
d870: 61 74 69 76 65 0d 0a 20 20 20 20 20 20 7d 5d 20 ative.. }]
d880: 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
d890: 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
d8a0: 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 e.. }....
d8b0: 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 return false
d8c0: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
d8d0: 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 51 4c proc checkForSQL
d8e0: 69 74 65 42 75 69 6c 64 73 20 7b 20 63 68 61 6e iteBuilds { chan
d8f0: 6e 65 6c 20 7b 73 65 6c 65 63 74 20 66 61 6c 73 nel {select fals
d900: 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d e} } {.. #.
d910: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 . # NOTE: C
d920: 68 65 63 6b 20 66 6f 72 20 65 76 65 72 79 20 70 heck for every p
d930: 6f 73 73 69 62 6c 65 20 76 61 6c 69 64 20 63 6f ossible valid co
d940: 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 76 61 6c mbination of val
d950: 75 65 73 20 75 73 65 64 20 77 68 65 6e 0d 0a 20 ues used when..
d960: 20 20 20 20 20 23 20 20 20 20 20 20 20 6c 6f 63 # loc
d970: 61 74 69 6e 67 20 6f 75 74 20 74 68 65 20 62 75 ating out the bu
d980: 69 6c 64 20 6f 75 74 70 75 74 20 64 69 72 65 63 ild output direc
d990: 74 6f 72 79 2c 20 73 68 6f 77 69 6e 67 20 65 61 tory, showing ea
d9a0: 63 68 20 61 76 61 69 6c 61 62 6c 65 0d 0a 20 20 ch available..
d9b0: 20 20 20 20 23 20 20 20 20 20 20 20 62 75 69 6c # buil
d9c0: 64 20 76 61 72 69 61 74 69 6f 6e 20 61 6c 6f 6e d variation alon
d9d0: 67 20 74 68 65 20 77 61 79 2e 0d 0a 20 20 20 20 g the way...
d9e0: 20 20 23 0d 0a 20 20 20 20 20 20 66 6f 72 65 61 #.. forea
d9f0: 63 68 20 6e 61 74 69 76 65 20 5b 6c 69 73 74 20 ch native [list
da00: 66 61 6c 73 65 20 74 72 75 65 5d 20 7b 0d 0a 20 false true] {..
da10: 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 79 foreach y
da20: 65 61 72 20 5b 67 65 74 42 75 69 6c 64 59 65 61 ear [getBuildYea
da30: 72 73 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 rs] {..
da40: 20 66 6f 72 65 61 63 68 20 63 6f 6e 66 69 67 75 foreach configu
da50: 72 61 74 69 6f 6e 20 5b 67 65 74 42 75 69 6c 64 ration [getBuild
da60: 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 73 5d 20 Configurations]
da70: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 {.. #
da80: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 .. #
da90: 4e 4f 54 45 3a 20 46 69 67 75 72 65 20 6f 75 74 NOTE: Figure out
daa0: 20 74 68 65 20 65 66 66 65 63 74 69 76 65 20 62 the effective b
dab0: 75 69 6c 64 20 70 6c 61 74 66 6f 72 6d 2e 20 20 uild platform.
dac0: 54 68 69 73 20 69 73 0d 0a 20 20 20 20 20 20 20 This is..
dad0: 20 20 20 20 20 23 20 20 20 20 20 20 20 62 61 73 # bas
dae0: 65 64 20 6f 6e 20 77 68 65 74 68 65 72 20 6f 72 ed on whether or
daf0: 20 6e 6f 74 20 61 20 5b 70 72 69 6d 61 72 69 6c not a [primaril
db00: 79 5d 20 6e 61 74 69 76 65 20 62 75 69 6c 64 0d y] native build.
db10: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 . #
db20: 20 20 20 20 20 69 73 20 62 65 69 6e 67 20 75 73 is being us
db30: 65 64 2e 20 20 46 6f 72 20 5b 70 72 69 6d 61 72 ed. For [primar
db40: 69 6c 79 5d 20 6e 6f 6e 2d 6e 61 74 69 76 65 20 ily] non-native
db50: 62 75 69 6c 64 73 2c 0d 0a 20 20 20 20 20 20 20 builds,..
db60: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 69 # thi
db70: 73 20 77 69 6c 6c 20 62 65 20 61 6e 20 65 6d 70 s will be an emp
db80: 74 79 20 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 ty string...
db90: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
dba0: 20 20 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 set platf
dbb0: 6f 72 6d 20 5b 67 65 74 42 75 69 6c 64 50 6c 61 orm [getBuildPla
dbc0: 74 66 6f 72 6d 20 24 6e 61 74 69 76 65 5d 0d 0a tform $native]..
dbd0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
dbe0: 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
dbf0: 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
dc00: 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
dc10: 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 - checking for S
dc20: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
dc30: 65 20 62 75 69 6c 64 20 5c 22 22 20 5b 65 78 70 e build \"" [exp
dc40: 72 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 r \..
dc50: 20 20 20 20 20 7b 24 6e 61 74 69 76 65 20 3f 20 {$native ?
dc60: 22 6e 61 74 69 76 65 2f 22 20 3a 20 22 22 7d 5d "native/" : ""}]
dc70: 20 5b 65 78 70 72 20 7b 5b 73 74 72 69 6e 67 20 [expr {[string
dc80: 6c 65 6e 67 74 68 20 5c 0d 0a 20 20 20 20 20 20 length \..
dc90: 20 20 20 20 20 20 20 20 20 20 24 70 6c 61 74 66 $platf
dca0: 6f 72 6d 5d 20 3e 20 30 20 3f 20 5b 61 70 70 65 orm] > 0 ? [appe
dcb0: 6e 64 41 72 67 73 20 24 70 6c 61 74 66 6f 72 6d ndArgs $platform
dcc0: 20 2f 5d 20 3a 20 22 22 7d 5d 20 24 79 65 61 72 /] : ""}] $year
dcd0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
dce0: 20 20 20 20 2f 20 24 63 6f 6e 66 69 67 75 72 61 / $configura
dcf0: 74 69 6f 6e 20 22 5c 22 2e 2e 2e 20 22 5d 0d 0a tion "\"... "]..
dd00: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d .. #.
dd10: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e . # N
dd20: 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 20 66 OTE: Build the f
dd30: 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 20 64 ully qualified d
dd40: 69 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 irectory where t
dd50: 68 65 20 6e 65 63 65 73 73 61 72 79 0d 0a 20 20 he necessary..
dd60: 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
dd70: 20 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 66 6f 72 components for
dd80: 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
dd90: 69 74 65 20 73 68 6f 75 6c 64 20 62 65 20 66 6f ite should be fo
dda0: 75 6e 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 und...
ddb0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
ddc0: 20 73 65 74 20 64 69 72 65 63 74 6f 72 79 20 5b set directory [
ddd0: 6a 6f 69 6e 42 75 69 6c 64 44 69 72 65 63 74 6f joinBuildDirecto
dde0: 72 79 20 24 6e 61 74 69 76 65 20 5c 0d 0a 20 20 ry $native \..
ddf0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 [g
de00: 65 74 42 75 69 6c 64 42 61 73 65 44 69 72 65 63 etBuildBaseDirec
de10: 74 6f 72 79 5d 20 24 79 65 61 72 20 24 70 6c 61 tory] $year $pla
de20: 74 66 6f 72 6d 20 24 63 6f 6e 66 69 67 75 72 61 tform $configura
de30: 74 69 6f 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 tion]....
de40: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
de50: 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 6f 20 74 # NOTE: Do t
de60: 68 65 20 6e 65 63 65 73 73 61 72 79 20 66 69 6c he necessary fil
de70: 65 73 20 65 78 69 73 74 3f 20 20 43 75 72 72 65 es exist? Curre
de80: 6e 74 6c 79 2c 20 6e 6f 20 6f 74 68 65 72 20 73 ntly, no other s
de90: 74 65 70 73 0d 0a 20 20 20 20 20 20 20 20 20 20 teps..
dea0: 20 20 23 20 20 20 20 20 20 20 61 72 65 20 74 61 # are ta
deb0: 6b 65 6e 20 74 6f 20 76 65 72 69 66 79 20 74 68 ken to verify th
dec0: 69 73 20 62 75 69 6c 64 20 69 73 20 61 63 74 75 is build is actu
ded0: 61 6c 6c 79 20 76 69 61 62 6c 65 2e 0d 0a 20 20 ally viable...
dee0: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
def0: 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 73 if {[is
df00: 42 75 69 6c 64 41 76 61 69 6c 61 62 6c 65 20 24 BuildAvailable $
df10: 6e 61 74 69 76 65 20 24 64 69 72 65 63 74 6f 72 native $director
df20: 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 y]} then {..
df30: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
df40: 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 # NOT
df50: 45 3a 20 57 68 65 6e 20 69 6e 20 22 73 65 6c 65 E: When in "sele
df60: 63 74 22 20 6d 6f 64 65 2c 20 61 75 74 6f 6d 61 ct" mode, automa
df70: 74 69 63 61 6c 6c 79 20 73 65 6c 65 63 74 20 74 tically select t
df80: 68 65 20 66 69 72 73 74 0d 0a 20 20 20 20 20 20 he first..
df90: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
dfa0: 61 76 61 69 6c 61 62 6c 65 20 62 75 69 6c 64 20 available build
dfb0: 6f 66 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 of System.Data.S
dfc0: 51 4c 69 74 65 20 61 6e 64 20 74 68 65 6e 20 72 QLite and then r
dfd0: 65 74 75 72 6e 0d 0a 20 20 20 20 20 20 20 20 20 eturn..
dfe0: 20 20 20 20 20 23 20 20 20 20 20 20 20 69 6d 6d # imm
dff0: 65 64 69 61 74 65 6c 79 2e 0d 0a 20 20 20 20 20 ediately...
e000: 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
e010: 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 73 if {$s
e020: 65 6c 65 63 74 20 26 26 20 5b 6d 61 74 63 68 50 elect && [matchP
e030: 6c 61 74 66 6f 72 6d 20 24 70 6c 61 74 66 6f 72 latform $platfor
e040: 6d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 m]} then {..
e050: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
e060: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 #
e070: 20 4e 4f 54 45 3a 20 4d 61 6e 75 61 6c 6c 79 20 NOTE: Manually
e080: 6f 76 65 72 72 69 64 65 20 61 6c 6c 20 74 68 65 override all the
e090: 20 62 75 69 6c 64 20 64 69 72 65 63 74 6f 72 79 build directory
e0a0: 20 73 65 6c 65 63 74 69 6f 6e 0d 0a 20 20 20 20 selection..
e0b0: 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 #
e0c0: 20 20 20 20 72 65 6c 61 74 65 64 20 74 65 73 74 related test
e0d0: 20 73 65 74 74 69 6e 67 73 20 69 6e 20 6f 72 64 settings in ord
e0e0: 65 72 20 74 6f 20 66 6f 72 63 65 20 74 68 69 73 er to force this
e0f0: 20 62 75 69 6c 64 0d 0a 20 20 20 20 20 20 20 20 build..
e100: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
e110: 6f 66 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 of System.Data.S
e120: 51 4c 69 74 65 20 74 6f 20 62 65 20 75 73 65 64 QLite to be used
e130: 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
e140: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
e150: 20 20 20 20 20 20 69 66 20 7b 21 5b 63 68 61 6e if {![chan
e160: 67 65 4e 61 74 69 76 65 52 75 6e 74 69 6d 65 4f geNativeRuntimeO
e170: 70 74 69 6f 6e 20 24 6e 61 74 69 76 65 5d 7d 20 ption $native]}
e180: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
e190: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
e1a0: 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
e1b0: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
e1c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 6e "n
e1d0: 6f 2c 20 66 61 69 6c 65 64 20 74 6f 20 22 20 5b o, failed to " [
e1e0: 65 78 70 72 20 7b 24 6e 61 74 69 76 65 20 3f 20 expr {$native ?
e1f0: 22 61 64 64 22 20 3a 20 22 72 65 6d 6f 76 65 22 "add" : "remove"
e200: 7d 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 }] \..
e210: 20 20 20 20 20 20 20 20 20 20 20 20 22 20 74 68 " th
e220: 65 20 5c 22 6e 61 74 69 76 65 5c 22 20 72 75 6e e \"native\" run
e230: 74 69 6d 65 20 6f 70 74 69 6f 6e 5c 6e 22 5d 0d time option\n"].
e240: 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
e250: 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 return fals
e260: 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e..
e270: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
e280: 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a 74 65 set ::te
e290: 73 74 5f 79 65 61 72 20 24 79 65 61 72 0d 0a 20 st_year $year..
e2a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 s
e2b0: 65 74 20 3a 3a 74 65 73 74 5f 70 6c 61 74 66 6f et ::test_platfo
e2c0: 72 6d 20 24 70 6c 61 74 66 6f 72 6d 0d 0a 20 20 rm $platform..
e2d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 se
e2e0: 74 20 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 67 75 t ::test_configu
e2f0: 72 61 74 69 6f 6e 20 24 63 6f 6e 66 69 67 75 72 ration $configur
e300: 61 74 69 6f 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 ation....
e310: 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
e320: 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
e330: 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
e340: 20 20 20 20 20 20 20 20 20 20 20 22 79 65 73 2c "yes,
e350: 20 73 65 6c 65 63 74 65 64 20 28 22 20 5b 65 78 selected (" [ex
e360: 70 72 20 7b 24 6e 61 74 69 76 65 20 3f 20 22 6e pr {$native ? "n
e370: 61 74 69 76 65 2f 22 20 3a 20 22 22 7d 5d 20 5c ative/" : ""}] \
e380: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
e390: 20 20 20 20 20 20 5b 65 78 70 72 20 7b 5b 73 74 [expr {[st
e3a0: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 ring length $pla
e3b0: 74 66 6f 72 6d 5d 20 3e 20 30 20 3f 20 5b 61 70 tform] > 0 ? [ap
e3c0: 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
e3d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
e3e0: 24 70 6c 61 74 66 6f 72 6d 20 2f 5d 20 3a 20 22 $platform /] : "
e3f0: 22 7d 5d 20 24 79 65 61 72 20 2f 20 24 63 6f 6e "}] $year / $con
e400: 66 69 67 75 72 61 74 69 6f 6e 20 22 29 5c 6e 22 figuration ")\n"
e410: 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ]....
e420: 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 return true
e430: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
e440: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
e450: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
e460: 24 63 68 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a $channel yes\n..
e470: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
e480: 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 . } e
e490: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
e4a0: 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
e4b0: 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 20 20 20 20 20 nel no\n..
e4c0: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
e4d0: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
e4e0: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
e4f0: 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a return false..
e500: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
e510: 6f 63 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 oc checkForSQLit
e520: 65 52 65 6c 65 61 73 65 73 20 7b 20 63 68 61 6e eReleases { chan
e530: 6e 65 6c 20 7b 73 65 6c 65 63 74 20 66 61 6c 73 nel {select fals
e540: 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d e} } {.. #.
e550: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 . # NOTE: C
e560: 68 65 63 6b 20 66 6f 72 20 70 61 73 74 20 72 65 heck for past re
e570: 6c 65 61 73 65 73 20 6f 66 20 53 79 73 74 65 6d leases of System
e580: 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 69 6e 20 .Data.SQLite in
e590: 74 68 65 20 64 69 72 65 63 74 6f 72 79 0d 0a 20 the directory..
e5a0: 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e # con
e5b0: 74 61 69 6e 65 64 20 69 6e 20 74 68 65 20 22 53 tained in the "S
e5c0: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
e5d0: 65 22 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 e" environment v
e5e0: 61 72 69 61 62 6c 65 2c 20 69 66 0d 0a 20 20 20 ariable, if..
e5f0: 20 20 20 23 20 20 20 20 20 20 20 70 72 65 73 65 # prese
e600: 6e 74 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 nt... #..
e610: 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
e620: 69 73 74 73 20 3a 3a 65 6e 76 28 53 79 73 74 65 ists ::env(Syste
e630: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 29 5d 20 m.Data.SQLite)]
e640: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
e650: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
e660: 3a 3a 65 6e 76 28 53 79 73 74 65 6d 2e 44 61 74 ::env(System.Dat
e670: 61 2e 53 51 4c 69 74 65 29 5d 20 3e 20 30 7d 20 a.SQLite)] > 0}
e680: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
e690: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
e6a0: 45 3a 20 42 75 69 6c 64 20 74 68 65 20 66 75 6c E: Build the ful
e6b0: 6c 79 20 71 75 61 6c 69 66 69 65 64 20 64 69 72 ly qualified dir
e6c0: 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 68 65 ectory where the
e6d0: 20 6e 65 63 65 73 73 61 72 79 0d 0a 20 20 20 20 necessary..
e6e0: 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6d 70 # comp
e6f0: 6f 6e 65 6e 74 73 20 66 6f 72 20 53 79 73 74 65 onents for Syste
e700: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 73 68 m.Data.SQLite sh
e710: 6f 75 6c 64 20 62 65 20 66 6f 75 6e 64 2e 0d 0a ould be found...
e720: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
e730: 20 20 20 73 65 74 20 64 69 72 65 63 74 6f 72 79 set directory
e740: 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d [file nativenam
e750: 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a e [file join \..
e760: 20 20 20 20 20 20 20 20 20 20 20 20 24 3a 3a 65 $::e
e770: 6e 76 28 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 nv(System.Data.S
e780: 51 4c 69 74 65 29 20 5b 67 65 74 52 65 6c 65 61 QLite) [getRelea
e790: 73 65 56 65 72 73 69 6f 6e 5d 5d 5d 0d 0a 0d 0a seVersion]]]....
e7a0: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
e7b0: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
e7c0: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
e7d0: 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 "---- checking
e7e0: 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 61 74 61 for System.Data
e7f0: 2e 53 51 4c 69 74 65 20 72 65 6c 65 61 73 65 20 .SQLite release
e800: 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 \"" \..
e810: 20 20 20 24 64 69 72 65 63 74 6f 72 79 20 22 5c $directory "\
e820: 22 2e 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 20 20 20 "... "]....
e830: 20 20 20 69 66 20 7b 5b 69 73 52 65 6c 65 61 73 if {[isReleas
e840: 65 41 76 61 69 6c 61 62 6c 65 20 24 64 69 72 65 eAvailable $dire
e850: 63 74 6f 72 79 20 70 6c 61 74 66 6f 72 6d 5d 7d ctory platform]}
e860: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
e870: 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c if {[string l
e880: 65 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d ength $platform]
e890: 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
e8a0: 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 70 set p
e8b0: 6c 61 74 66 6f 72 6d 20 75 6e 6b 6e 6f 77 6e 0d latform unknown.
e8c0: 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a . }....
e8d0: 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 73 if {$s
e8e0: 65 6c 65 63 74 20 26 26 20 5b 6d 61 74 63 68 50 elect && [matchP
e8f0: 6c 61 74 66 6f 72 6d 20 24 70 6c 61 74 66 6f 72 latform $platfor
e900: 6d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 m]} then {..
e910: 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a 62 75 set ::bu
e920: 69 6c 64 5f 64 69 72 65 63 74 6f 72 79 20 24 64 ild_directory $d
e930: 69 72 65 63 74 6f 72 79 0d 0a 0d 0a 20 20 20 20 irectory....
e940: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
e950: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
e960: 67 73 20 22 79 65 73 2c 20 73 65 6c 65 63 74 65 gs "yes, selecte
e970: 64 20 28 22 20 24 70 6c 61 74 66 6f 72 6d 20 22 d (" $platform "
e980: 29 5c 6e 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 )\n"]....
e990: 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 return true
e9a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c .. } el
e9b0: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
e9c0: 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
e9d0: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 79 65 [appendArgs "ye
e9e0: 73 20 28 22 20 24 70 6c 61 74 66 6f 72 6d 20 22 s (" $platform "
e9f0: 29 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 )\n"]..
ea00: 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c }.. } el
ea10: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
ea20: 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e tputs $channel n
ea30: 6f 5c 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 o\n....
ea40: 20 66 6f 72 65 61 63 68 20 70 61 74 68 20 5b 6c foreach path [l
ea50: 73 6f 72 74 20 2d 64 65 63 72 65 61 73 69 6e 67 sort -decreasing
ea60: 20 5b 66 69 6c 65 20 6c 69 73 74 20 24 64 69 72 [file list $dir
ea70: 65 63 74 6f 72 79 20 2a 5d 5d 20 7b 0d 0a 20 20 ectory *]] {..
ea80: 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 66 if {[f
ea90: 69 6c 65 20 65 78 69 73 74 73 20 24 70 61 74 68 ile exists $path
eaa0: 5d 20 26 26 20 5b 66 69 6c 65 20 69 73 64 69 72 ] && [file isdir
eab0: 65 63 74 6f 72 79 20 24 70 61 74 68 5d 7d 20 74 ectory $path]} t
eac0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
ead0: 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
eae0: 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
eaf0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
eb00: 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b "---- check
eb10: 69 6e 67 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 ing for System.D
eb20: 61 74 61 2e 53 51 4c 69 74 65 20 72 65 6c 65 61 ata.SQLite relea
eb30: 73 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 se \"" \..
eb40: 20 20 20 20 20 20 20 20 20 20 20 20 24 70 61 74 $pat
eb50: 68 20 22 5c 22 2e 2e 2e 20 22 5d 0d 0a 0d 0a 20 h "\"... "]....
eb60: 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
eb70: 7b 5b 69 73 52 65 6c 65 61 73 65 41 76 61 69 6c {[isReleaseAvail
eb80: 61 62 6c 65 20 24 70 61 74 68 20 70 6c 61 74 66 able $path platf
eb90: 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 orm]} then {..
eba0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
ebb0: 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
ebc0: 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3d 3d 20 30 $platform] == 0
ebd0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
ebe0: 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 set
ebf0: 70 6c 61 74 66 6f 72 6d 20 75 6e 6b 6e 6f 77 6e platform unknown
ec00: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
ec10: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
ec20: 20 20 20 20 20 20 20 69 66 20 7b 24 73 65 6c 65 if {$sele
ec30: 63 74 20 26 26 20 5b 6d 61 74 63 68 50 6c 61 74 ct && [matchPlat
ec40: 66 6f 72 6d 20 24 70 6c 61 74 66 6f 72 6d 5d 7d form $platform]}
ec50: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
ec60: 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 3a set :
ec70: 3a 62 75 69 6c 64 5f 64 69 72 65 63 74 6f 72 79 :build_directory
ec80: 20 24 70 61 74 68 0d 0a 0d 0a 20 20 20 20 20 20 $path....
ec90: 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
eca0: 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
ecb0: 6e 64 41 72 67 73 20 22 79 65 73 2c 20 73 65 6c ndArgs "yes, sel
ecc0: 65 63 74 65 64 20 28 22 20 24 70 6c 61 74 66 6f ected (" $platfo
ecd0: 72 6d 20 22 29 5c 6e 22 5d 0d 0a 0d 0a 20 20 20 rm ")\n"]....
ece0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 r
ecf0: 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 eturn true..
ed00: 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c } el
ed10: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
ed20: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
ed30: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
ed40: 67 73 20 22 79 65 73 20 28 22 20 24 70 6c 61 74 gs "yes (" $plat
ed50: 66 6f 72 6d 20 22 29 5c 6e 22 5d 0d 0a 20 20 20 form ")\n"]..
ed60: 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
ed70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 }
ed80: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
ed90: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
eda0: 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 20 20 hannel no\n..
edb0: 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
edc0: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
edd0: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
ede0: 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 }.. } els
edf0: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 e {.. tpu
ee00: 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
ee10: 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
ee20: 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 65 6e 76 "---- env
ee30: 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c ironment variabl
ee40: 65 20 5c 22 53 79 73 74 65 6d 2e 44 61 74 61 2e e \"System.Data.
ee50: 53 51 4c 69 74 65 5c 22 20 69 73 20 6e 6f 74 20 SQLite\" is not
ee60: 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
ee70: 20 22 73 65 74 2c 20 73 6b 69 70 70 69 6e 67 20 "set, skipping
ee80: 63 68 65 63 6b 20 66 6f 72 20 72 65 6c 65 61 73 check for releas
ee90: 65 73 2e 2e 2e 5c 6e 22 5d 0d 0a 20 20 20 20 20 es...\n"]..
eea0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 }.... retu
eeb0: 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 7d 0d rn false.. }.
eec0: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 68 65 .... proc che
eed0: 63 6b 46 6f 72 53 51 4c 69 74 65 4c 69 62 72 61 ckForSQLiteLibra
eee0: 72 79 20 7b 20 63 68 61 6e 6e 65 6c 20 7d 20 7b ry { channel } {
eef0: 0d 0a 20 20 20 20 20 20 74 70 75 74 73 20 24 63 .. tputs $c
ef00: 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 68 65 hannel "---- che
ef10: 63 6b 69 6e 67 20 66 6f 72 20 53 51 4c 69 74 65 cking for SQLite
ef20: 20 63 6f 72 65 20 6c 69 62 72 61 72 79 2e 2e 2e core library...
ef30: 20 22 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b ".... if {
ef40: 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 [catch {..
ef50: 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
ef60: 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
ef70: 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
ef80: 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
ef90: 69 74 65 2e 53 51 4c 69 74 65 33 20 53 51 4c 69 ite.SQLite3 SQLi
efa0: 74 65 56 65 72 73 69 6f 6e 0d 0a 20 20 20 20 20 teVersion..
efb0: 20 7d 20 76 65 72 73 69 6f 6e 5d 20 3d 3d 20 30 } version] == 0
efc0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
efd0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
efe0: 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 OTE: Check if th
eff0: 65 20 72 65 74 75 72 6e 65 64 20 76 65 72 73 69 e returned versi
f000: 6f 6e 20 77 61 73 20 6e 75 6c 6c 2e 20 20 49 66 on was null. If
f010: 20 73 6f 2c 20 6d 61 6b 65 20 69 74 20 65 61 73 so, make it eas
f020: 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 y.. #
f030: 20 20 20 74 6f 20 73 70 6f 74 2e 0d 0a 20 20 20 to spot...
f040: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
f050: 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
f060: 74 68 20 24 76 65 72 73 69 6f 6e 5d 20 3d 3d 20 th $version] ==
f070: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
f080: 20 20 20 20 20 73 65 74 20 76 65 72 73 69 6f 6e set version
f090: 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 20 20 7d null.. }
f0a0: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
f0b0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 # NOTE: A
f0c0: 74 74 65 6d 70 74 20 74 6f 20 71 75 65 72 79 20 ttempt to query
f0d0: 74 68 65 20 46 6f 73 73 69 6c 20 73 6f 75 72 63 the Fossil sourc
f0e0: 65 20 69 64 65 6e 74 69 66 69 65 72 20 66 6f 72 e identifier for
f0f0: 20 74 68 65 20 53 51 4c 69 74 65 0d 0a 20 20 20 the SQLite..
f100: 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 72 # cor
f110: 65 20 6c 69 62 72 61 72 79 2e 0d 0a 20 20 20 20 e library...
f120: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 #.. i
f130: 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
f140: 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
f150: 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e voke -flags +Non
f160: 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 Public \..
f170: 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
f180: 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 ata.SQLite.SQLit
f190: 65 33 20 53 51 4c 69 74 65 53 6f 75 72 63 65 49 e3 SQLiteSourceI
f1a0: 64 0d 0a 20 20 20 20 20 20 20 20 7d 20 73 6f 75 d.. } sou
f1b0: 72 63 65 49 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a rceId]} then {..
f1c0: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
f1d0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 # NOTE: W
f1e0: 65 20 66 61 69 6c 65 64 20 74 6f 20 71 75 65 72 e failed to quer
f1f0: 79 20 74 68 65 20 46 6f 73 73 69 6c 20 73 6f 75 y the Fossil sou
f200: 72 63 65 20 69 64 65 6e 74 69 66 69 65 72 2e 0d rce identifier..
f210: 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
f220: 20 20 20 20 20 20 20 20 73 65 74 20 73 6f 75 72 set sour
f230: 63 65 49 64 20 75 6e 6b 6e 6f 77 6e 0d 0a 20 20 ceId unknown..
f240: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
f250: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
f260: 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 NOTE: Check if t
f270: 68 65 20 72 65 74 75 72 6e 65 64 20 46 6f 73 73 he returned Foss
f280: 69 6c 20 73 6f 75 72 63 65 20 69 64 65 6e 74 69 il source identi
f290: 66 69 65 72 20 77 61 73 20 6e 75 6c 6c 2e 20 20 fier was null.
f2a0: 49 66 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 If.. #
f2b0: 20 20 20 20 73 6f 2c 20 6d 61 6b 65 20 69 74 20 so, make it
f2c0: 65 61 73 79 20 74 6f 20 73 70 6f 74 2e 0d 0a 20 easy to spot...
f2d0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
f2e0: 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
f2f0: 6e 67 74 68 20 24 73 6f 75 72 63 65 49 64 5d 20 ngth $sourceId]
f300: 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
f310: 20 20 20 20 20 20 20 20 73 65 74 20 73 6f 75 72 set sour
f320: 63 65 49 64 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 ceId null..
f330: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
f340: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
f350: 45 3a 20 59 65 73 2c 20 74 68 65 20 53 51 4c 69 E: Yes, the SQLi
f360: 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 20 te core library
f370: 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 61 76 appears to be av
f380: 61 69 6c 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 ailable...
f390: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 61 64 64 #.. add
f3a0: 43 6f 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 74 Constraint SQLit
f3b0: 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 75 e.... tpu
f3c0: 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
f3d0: 65 6e 64 41 72 67 73 20 22 79 65 73 20 28 22 20 endArgs "yes ("
f3e0: 24 76 65 72 73 69 6f 6e 20 22 20 22 20 24 73 6f $version " " $so
f3f0: 75 72 63 65 49 64 20 22 29 5c 6e 22 5d 0d 0a 20 urceId ")\n"]..
f400: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
f410: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
f420: 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 20 20 20 annel no\n..
f430: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
f440: 20 20 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 proc checkFor
f450: 53 51 4c 69 74 65 49 6e 74 65 72 6f 70 20 7b 20 SQLiteInterop {
f460: 63 68 61 6e 6e 65 6c 20 7d 20 7b 0d 0a 20 20 20 channel } {..
f470: 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
f480: 6c 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 l "---- checking
f490: 20 66 6f 72 20 53 51 4c 69 74 65 20 69 6e 74 65 for SQLite inte
f4a0: 72 6f 70 20 61 73 73 65 6d 62 6c 79 2e 2e 2e 20 rop assembly...
f4b0: 22 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b ".... if {[
f4c0: 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
f4d0: 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
f4e0: 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
f4f0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
f500: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
f510: 74 65 2e 53 51 4c 69 74 65 33 20 49 6e 74 65 72 te.SQLite3 Inter
f520: 6f 70 56 65 72 73 69 6f 6e 0d 0a 20 20 20 20 20 opVersion..
f530: 20 7d 20 76 65 72 73 69 6f 6e 5d 20 3d 3d 20 30 } version] == 0
f540: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
f550: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
f560: 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 OTE: Check if th
f570: 65 20 72 65 74 75 72 6e 65 64 20 76 65 72 73 69 e returned versi
f580: 6f 6e 20 77 61 73 20 6e 75 6c 6c 2e 20 20 49 66 on was null. If
f590: 20 73 6f 2c 20 6d 61 6b 65 20 69 74 20 65 61 73 so, make it eas
f5a0: 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 y.. #
f5b0: 20 20 20 74 6f 20 73 70 6f 74 2e 0d 0a 20 20 20 to spot...
f5c0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
f5d0: 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
f5e0: 74 68 20 24 76 65 72 73 69 6f 6e 5d 20 3d 3d 20 th $version] ==
f5f0: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
f600: 20 20 20 20 20 73 65 74 20 76 65 72 73 69 6f 6e set version
f610: 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 20 20 7d null.. }
f620: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
f630: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 # NOTE: A
f640: 74 74 65 6d 70 74 20 74 6f 20 71 75 65 72 79 20 ttempt to query
f650: 74 68 65 20 46 6f 73 73 69 6c 20 73 6f 75 72 63 the Fossil sourc
f660: 65 20 69 64 65 6e 74 69 66 69 65 72 20 66 6f 72 e identifier for
f670: 20 74 68 65 20 53 51 4c 69 74 65 0d 0a 20 20 20 the SQLite..
f680: 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 72 # cor
f690: 65 20 6c 69 62 72 61 72 79 2e 0d 0a 20 20 20 20 e library...
f6a0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 #.. i
f6b0: 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
f6c0: 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
f6d0: 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e voke -flags +Non
f6e0: 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 Public \..
f6f0: 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
f700: 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 ata.SQLite.SQLit
f710: 65 33 20 49 6e 74 65 72 6f 70 53 6f 75 72 63 65 e3 InteropSource
f720: 49 64 0d 0a 20 20 20 20 20 20 20 20 7d 20 73 6f Id.. } so
f730: 75 72 63 65 49 64 5d 7d 20 74 68 65 6e 20 7b 0d urceId]} then {.
f740: 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
f750: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
f760: 57 65 20 66 61 69 6c 65 64 20 74 6f 20 71 75 65 We failed to que
f770: 72 79 20 74 68 65 20 46 6f 73 73 69 6c 20 73 6f ry the Fossil so
f780: 75 72 63 65 20 69 64 65 6e 74 69 66 69 65 72 2e urce identifier.
f790: 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
f7a0: 20 20 20 20 20 20 20 20 20 73 65 74 20 73 6f 75 set sou
f7b0: 72 63 65 49 64 20 75 6e 6b 6e 6f 77 6e 0d 0a 20 rceId unknown..
f7c0: 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
f7d0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
f7e0: 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 NOTE: Check if
f7f0: 74 68 65 20 72 65 74 75 72 6e 65 64 20 46 6f 73 the returned Fos
f800: 73 69 6c 20 73 6f 75 72 63 65 20 69 64 65 6e 74 sil source ident
f810: 69 66 69 65 72 20 77 61 73 20 6e 75 6c 6c 2e 20 ifier was null.
f820: 20 49 66 0d 0a 20 20 20 20 20 20 20 20 23 20 20 If.. #
f830: 20 20 20 20 20 73 6f 2c 20 6d 61 6b 65 20 69 74 so, make it
f840: 20 65 61 73 79 20 74 6f 20 73 70 6f 74 2e 0d 0a easy to spot...
f850: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
f860: 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c if {[string l
f870: 65 6e 67 74 68 20 24 73 6f 75 72 63 65 49 64 5d ength $sourceId]
f880: 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
f890: 20 20 20 20 20 20 20 20 20 73 65 74 20 73 6f 75 set sou
f8a0: 72 63 65 49 64 20 6e 75 6c 6c 0d 0a 20 20 20 20 rceId null..
f8b0: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
f8c0: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
f8d0: 54 45 3a 20 42 65 66 6f 72 65 20 61 63 74 75 61 TE: Before actua
f8e0: 6c 6c 79 20 61 64 64 69 6e 67 20 74 68 65 20 74 lly adding the t
f8f0: 65 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 2c 20 est constraint,
f900: 6d 61 6b 65 20 73 75 72 65 20 74 68 65 0d 0a 20 make sure the..
f910: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 # v
f920: 65 72 73 69 6f 6e 20 69 73 20 76 61 6c 69 64 20 ersion is valid
f930: 28 69 2e 65 2e 20 6e 6f 74 20 6a 75 73 74 20 74 (i.e. not just t
f940: 68 61 74 20 77 65 20 63 6f 75 6c 64 20 71 75 65 hat we could que
f950: 72 79 20 69 74 29 2e 0d 0a 20 20 20 20 20 20 20 ry it)...
f960: 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b #.. if {
f970: 24 76 65 72 73 69 6f 6e 20 6e 65 20 22 6e 75 6c $version ne "nul
f980: 6c 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 l"} then {..
f990: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
f9a0: 20 20 20 23 20 4e 4f 54 45 3a 20 59 65 73 2c 20 # NOTE: Yes,
f9b0: 74 68 65 20 53 51 4c 69 74 65 20 69 6e 74 65 72 the SQLite inter
f9c0: 6f 70 20 61 73 73 65 6d 62 6c 79 20 61 70 70 65 op assembly appe
f9d0: 61 72 73 20 74 6f 20 62 65 20 61 76 61 69 6c 61 ars to be availa
f9e0: 62 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ble...
f9f0: 23 0d 0a 20 20 20 20 20 20 20 20 20 20 61 64 64 #.. add
fa00: 43 6f 6e 73 74 72 61 69 6e 74 20 53 51 4c 69 74 Constraint SQLit
fa10: 65 49 6e 74 65 72 6f 70 0d 0a 0d 0a 20 20 20 20 eInterop....
fa20: 20 20 20 20 20 20 73 65 74 20 61 6e 73 77 65 72 set answer
fa30: 20 79 65 73 0d 0a 20 20 20 20 20 20 20 20 7d 20 yes.. }
fa40: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
fa50: 20 20 73 65 74 20 61 6e 73 77 65 72 20 6e 6f 0d set answer no.
fa60: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
fa70: 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
fa80: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
fa90: 20 24 61 6e 73 77 65 72 20 22 20 28 22 20 24 76 $answer " (" $v
faa0: 65 72 73 69 6f 6e 20 22 20 22 20 24 73 6f 75 72 ersion " " $sour
fab0: 63 65 49 64 20 22 29 5c 6e 22 5d 0d 0a 20 20 20 ceId ")\n"]..
fac0: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
fad0: 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
fae0: 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 20 20 20 20 20 nel no\n..
faf0: 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
fb00: 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 51 proc checkForSQ
fb10: 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 61 LiteDefineConsta
fb20: 6e 74 20 7b 20 63 68 61 6e 6e 65 6c 20 6e 61 6d nt { channel nam
fb30: 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 70 75 e } {.. tpu
fb40: 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
fb50: 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
fb60: 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b "---- check
fb70: 69 6e 67 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 ing for System.D
fb80: 61 74 61 2e 53 51 4c 69 74 65 20 64 65 66 69 6e ata.SQLite defin
fb90: 65 20 63 6f 6e 73 74 61 6e 74 20 5c 22 22 20 24 e constant \"" $
fba0: 6e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 name \..
fbb0: 20 20 22 5c 22 2e 2e 2e 20 22 5d 0d 0a 0d 0a 20 "\"... "]....
fbc0: 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
fbd0: 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 {.. objec
fbe0: 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 t invoke -flags
fbf0: 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 +NonPublic \..
fc00: 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
fc10: 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c .Data.SQLite.SQL
fc20: 69 74 65 33 20 44 65 66 69 6e 65 43 6f 6e 73 74 ite3 DefineConst
fc30: 61 6e 74 73 0d 0a 20 20 20 20 20 20 7d 20 64 65 ants.. } de
fc40: 66 69 6e 65 43 6f 6e 73 74 61 6e 74 73 5d 20 3d fineConstants] =
fc50: 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
fc60: 20 20 20 20 20 69 66 20 7b 5b 6c 73 65 61 72 63 if {[lsearc
fc70: 68 20 2d 65 78 61 63 74 20 2d 6e 6f 63 61 73 65 h -exact -nocase
fc80: 20 24 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 $defineConstant
fc90: 73 20 24 6e 61 6d 65 5d 20 21 3d 20 2d 31 7d 20 s $name] != -1}
fca0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
fcb0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
fcc0: 20 4e 4f 54 45 3a 20 59 65 73 2c 20 74 68 69 73 NOTE: Yes, this
fcd0: 20 64 65 66 69 6e 65 20 63 6f 6e 73 74 61 6e 74 define constant
fce0: 20 77 61 73 20 65 6e 61 62 6c 65 64 20 77 68 65 was enabled whe
fcf0: 6e 20 74 68 65 20 6d 61 6e 61 67 65 64 0d 0a 20 n the managed..
fd00: 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
fd10: 20 61 73 73 65 6d 62 6c 79 20 77 61 73 20 63 6f assembly was co
fd20: 6d 70 69 6c 65 64 2e 0d 0a 20 20 20 20 20 20 20 mpiled...
fd30: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
fd40: 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 addConstraint [a
fd50: 70 70 65 6e 64 41 72 67 73 20 5b 67 65 74 53 51 ppendArgs [getSQ
fd60: 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 61 LiteDefineConsta
fd70: 6e 74 50 72 65 66 69 78 5d 20 24 6e 61 6d 65 5d ntPrefix] $name]
fd80: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 .... tp
fd90: 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 79 65 73 uts $channel yes
fda0: 5c 6e 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c \n.. } el
fdb0: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
fdc0: 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e tputs $channel n
fdd0: 6f 5c 6e 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a o\n.. }..
fde0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
fdf0: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
fe00: 68 61 6e 6e 65 6c 20 65 72 72 6f 72 5c 6e 0d 0a hannel error\n..
fe10: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
fe20: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 44 ... proc getD
fe30: 61 74 65 54 69 6d 65 46 6f 72 6d 61 74 20 7b 7d ateTimeFormat {}
fe40: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
fe50: 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 # NOTE: This
fe60: 70 72 6f 63 65 64 75 72 65 20 73 69 6d 70 6c 79 procedure simply
fe70: 20 72 65 74 75 72 6e 73 20 74 68 65 20 22 64 65 returns the "de
fe80: 66 61 75 6c 74 22 20 44 61 74 65 54 69 6d 65 20 fault" DateTime
fe90: 66 6f 72 6d 61 74 20 75 73 65 64 0d 0a 20 20 20 format used..
fea0: 20 20 20 23 20 20 20 20 20 20 20 62 79 20 74 68 # by th
feb0: 65 20 74 65 73 74 20 73 75 69 74 65 2e 0d 0a 20 e test suite...
fec0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
fed0: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {[info exists :
fee0: 3a 64 61 74 65 74 69 6d 65 5f 66 6f 72 6d 61 74 :datetime_format
fef0: 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] && \..
ff00: 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
ff10: 20 24 3a 3a 64 61 74 65 74 69 6d 65 5f 66 6f 72 $::datetime_for
ff20: 6d 61 74 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b mat] > 0} then {
ff30: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
ff40: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 # NOTE: Ret
ff50: 75 72 6e 20 74 68 65 20 6d 61 6e 75 61 6c 6c 79 urn the manually
ff60: 20 6f 76 65 72 72 69 64 64 65 6e 20 76 61 6c 75 overridden valu
ff70: 65 20 66 6f 72 20 74 68 65 20 44 61 74 65 54 69 e for the DateTi
ff80: 6d 65 20 66 6f 72 6d 61 74 2e 0d 0a 20 20 20 20 me format...
ff90: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
ffa0: 65 74 75 72 6e 20 24 3a 3a 64 61 74 65 74 69 6d eturn $::datetim
ffb0: 65 5f 66 6f 72 6d 61 74 0d 0a 20 20 20 20 20 20 e_format..
ffc0: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
ffd0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
ffe0: 4f 54 45 3a 20 52 65 74 75 72 6e 20 61 6e 20 49 OTE: Return an I
fff0: 53 4f 38 36 30 31 20 44 61 74 65 54 69 6d 65 20 SO8601 DateTime
10000 66 6f 72 6d 61 74 20 63 6f 6d 70 61 74 69 62 6c format compatibl
10010 65 20 77 69 74 68 20 53 51 4c 69 74 65 2c 0d 0a e with SQLite,..
10020 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
10030 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
10040 74 65 2c 20 61 6e 64 20 73 75 69 74 61 62 6c 65 te, and suitable
10050 20 66 6f 72 20 72 6f 75 6e 64 2d 74 72 69 70 70 for round-tripp
10060 69 6e 67 20 77 69 74 68 20 74 68 65 0d 0a 20 20 ing with the..
10070 20 20 20 20 20 20 23 20 20 20 20 20 20 20 44 61 # Da
10080 74 65 54 69 6d 65 20 63 6c 61 73 73 20 6f 66 20 teTime class of
10090 74 68 65 20 66 72 61 6d 65 77 6f 72 6b 2e 20 20 the framework.
100a0 49 66 20 74 68 69 73 20 76 61 6c 75 65 20 69 73 If this value is
100b0 20 63 68 61 6e 67 65 64 2c 0d 0a 20 20 20 20 20 changed,..
100c0 20 20 20 23 20 20 20 20 20 20 20 76 61 72 69 6f # vario
100d0 75 73 20 74 65 73 74 73 20 6d 61 79 20 66 61 69 us tests may fai
100e0 6c 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 l... #..
100f0 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 22 79 return "y
10100 79 79 79 2d 4d 4d 2d 64 64 20 48 48 3a 6d 6d 3a yyy-MM-dd HH:mm:
10110 73 73 2e 46 46 46 46 46 46 46 4b 22 0d 0a 20 20 ss.FFFFFFFK"..
10120 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
10130 0a 20 20 20 20 70 72 6f 63 20 65 6e 75 6d 65 72 . proc enumer
10140 61 62 6c 65 54 6f 4c 69 73 74 20 7b 20 65 6e 75 ableToList { enu
10150 6d 65 72 61 62 6c 65 20 7d 20 7b 0d 0a 20 20 20 merable } {..
10160 20 20 20 73 65 74 20 72 65 73 75 6c 74 20 5b 6c set result [l
10170 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 ist].... if
10180 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 {[string length
10190 20 24 65 6e 75 6d 65 72 61 62 6c 65 5d 20 3d 3d $enumerable] ==
101a0 20 30 20 7c 7c 20 24 65 6e 75 6d 65 72 61 62 6c 0 || $enumerabl
101b0 65 20 65 71 20 22 6e 75 6c 6c 22 7d 20 74 68 65 e eq "null"} the
101c0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 n {.. ret
101d0 75 72 6e 20 24 72 65 73 75 6c 74 0d 0a 20 20 20 urn $result..
101e0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 6f 62 }.... ob
101f0 6a 65 63 74 20 66 6f 72 65 61 63 68 20 2d 61 6c ject foreach -al
10200 69 61 73 20 69 74 65 6d 20 24 65 6e 75 6d 65 72 ias item $enumer
10210 61 62 6c 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 able {..
10220 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
10230 74 68 20 24 69 74 65 6d 5d 20 3e 20 30 7d 20 74 th $item] > 0} t
10240 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
10250 20 6c 61 70 70 65 6e 64 20 72 65 73 75 6c 74 20 lappend result
10260 5b 24 69 74 65 6d 20 54 6f 53 74 72 69 6e 67 5d [$item ToString]
10270 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
10280 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 }.... re
10290 74 75 72 6e 20 24 72 65 73 75 6c 74 0d 0a 20 20 turn $result..
102a0 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
102b0 20 63 61 74 63 68 41 6e 64 52 65 74 75 72 6e 20 catchAndReturn
102c0 7b 20 73 63 72 69 70 74 20 7b 73 74 61 63 6b 54 { script {stackT
102d0 72 61 63 65 20 66 61 6c 73 65 7d 20 7b 73 74 72 race false} {str
102e0 69 63 74 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 ict true} } {..
102f0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
10300 4e 4f 54 45 3a 20 45 76 61 6c 75 61 74 65 20 74 NOTE: Evaluate t
10310 68 65 20 73 63 72 69 70 74 20 70 72 6f 76 69 64 he script provid
10320 65 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 ed by our caller
10330 20 69 6e 20 74 68 65 69 72 20 63 6f 6e 74 65 78 in their contex
10340 74 2c 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 t,.. #
10350 20 20 63 61 70 74 75 72 69 6e 67 20 62 6f 74 68 capturing both
10360 20 74 68 65 20 72 65 73 75 6c 74 20 61 6e 64 20 the result and
10370 74 68 65 20 72 65 74 75 72 6e 20 63 6f 64 65 2e the return code.
10380 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
10390 20 73 65 74 20 63 6f 64 65 20 5b 63 61 74 63 68 set code [catch
103a0 20 7b 75 70 6c 65 76 65 6c 20 31 20 24 73 63 72 {uplevel 1 $scr
103b0 69 70 74 7d 20 72 65 73 75 6c 74 5d 0d 0a 0d 0a ipt} result]....
103c0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
103d0 20 4e 4f 54 45 3a 20 44 69 64 20 74 68 65 20 73 NOTE: Did the s
103e0 63 72 69 70 74 20 70 72 6f 76 69 64 65 64 20 62 cript provided b
103f0 79 20 6f 75 72 20 63 61 6c 6c 65 72 20 4e 4f 54 y our caller NOT
10400 20 72 61 69 73 65 20 61 6e 20 65 72 72 6f 72 3f raise an error?
10410 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
10420 20 69 66 20 7b 24 73 74 72 69 63 74 20 26 26 20 if {$strict &&
10430 24 63 6f 64 65 20 3d 3d 20 30 20 7c 7c 20 21 24 $code == 0 || !$
10440 73 74 72 69 63 74 20 26 26 20 24 63 6f 64 65 20 strict && $code
10450 21 3d 20 31 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 != 1} then {..
10460 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
10470 20 23 20 4e 4f 54 45 3a 20 53 75 63 63 65 73 73 # NOTE: Success
10480 2e 20 20 52 65 74 75 72 6e 20 61 20 6c 69 73 74 . Return a list
10490 20 77 69 74 68 20 74 68 65 20 72 65 74 75 72 6e with the return
104a0 20 63 6f 64 65 20 61 6e 64 20 74 68 65 20 72 65 code and the re
104b0 73 75 6c 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 sult... #
104c0 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
104d0 20 5b 6c 69 73 74 20 24 63 6f 64 65 20 24 72 65 [list $code $re
104e0 73 75 6c 74 5d 0d 0a 20 20 20 20 20 20 7d 20 65 sult].. } e
104f0 6c 73 65 69 66 20 7b 24 73 74 61 63 6b 54 72 61 lseif {$stackTra
10500 63 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 ce} then {..
10510 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
10520 20 4e 4f 54 45 3a 20 46 61 69 6c 75 72 65 2e 20 NOTE: Failure.
10530 20 4f 75 72 20 63 61 6c 6c 65 72 20 77 61 6e 74 Our caller want
10540 73 20 61 20 66 75 6c 6c 20 73 74 61 63 6b 20 74 s a full stack t
10550 72 61 63 65 20 28 69 66 20 61 70 70 6c 69 63 61 race (if applica
10560 62 6c 65 29 2c 0d 0a 20 20 20 20 20 20 20 20 23 ble),.. #
10570 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 61 20 return a
10580 6c 69 73 74 20 77 69 74 68 20 74 68 65 20 72 65 list with the re
10590 74 75 72 6e 20 63 6f 64 65 20 61 6e 64 20 74 68 turn code and th
105a0 65 20 72 65 73 75 6c 74 20 76 65 72 62 61 74 69 e result verbati
105b0 6d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 m... #..
105c0 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c return [l
105d0 69 73 74 20 24 63 6f 64 65 20 24 72 65 73 75 6c ist $code $resul
105e0 74 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 t].. } else
105f0 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
10600 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 # NOTE: F
10610 61 69 6c 75 72 65 2e 20 20 4f 75 72 20 63 61 6c ailure. Our cal
10620 6c 65 72 20 64 6f 65 73 20 6e 6f 74 20 77 61 6e ler does not wan
10630 74 20 61 20 66 75 6c 6c 20 73 74 61 63 6b 20 74 t a full stack t
10640 72 61 63 65 20 28 69 66 0d 0a 20 20 20 20 20 20 race (if..
10650 20 20 23 20 20 20 20 20 20 20 61 70 70 6c 69 63 # applic
10660 61 62 6c 65 29 2c 20 72 65 74 75 72 6e 20 61 20 able), return a
10670 6c 69 73 74 20 77 69 74 68 20 74 68 65 20 72 65 list with the re
10680 74 75 72 6e 20 63 6f 64 65 2c 20 74 68 65 20 65 turn code, the e
10690 72 72 6f 72 0d 0a 20 20 20 20 20 20 20 20 23 20 rror.. #
106a0 20 20 20 20 20 20 63 6f 64 65 20 66 6f 72 20 74 code for t
106b0 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 2c 20 he interpreter,
106c0 61 6e 64 20 74 68 65 20 65 72 72 6f 72 20 6d 65 and the error me
106d0 73 73 61 67 65 20 75 70 20 74 6f 20 74 68 65 0d ssage up to the.
106e0 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
106f0 20 70 6f 69 6e 74 20 77 68 65 72 65 20 74 68 65 point where the
10700 20 73 74 61 63 6b 20 74 72 61 63 65 20 73 68 6f stack trace sho
10710 75 6c 64 20 73 74 61 72 74 2e 0d 0a 20 20 20 20 uld start...
10720 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
10730 65 74 75 72 6e 20 5b 6c 69 73 74 20 24 63 6f 64 eturn [list $cod
10740 65 20 24 3a 3a 65 72 72 6f 72 43 6f 64 65 20 5c e $::errorCode \
10750 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 65 .. [e
10760 78 74 72 61 63 74 53 79 73 74 65 6d 44 61 74 61 xtractSystemData
10770 53 51 4c 69 74 65 45 78 63 65 70 74 69 6f 6e 4d SQLiteExceptionM
10780 65 73 73 61 67 65 20 24 72 65 73 75 6c 74 5d 5d essage $result]]
10790 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
107a0 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 6f ..... proc co
107b0 6d 70 69 6c 65 43 53 68 61 72 70 57 69 74 68 20 mpileCSharpWith
107c0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
107d0 65 78 74 20 6d 65 6d 6f 72 79 20 73 79 6d 62 6f ext memory symbo
107e0 6c 73 20 73 74 72 69 63 74 20 72 65 73 75 6c 74 ls strict result
107f0 73 56 61 72 4e 61 6d 65 20 65 72 72 6f 72 73 56 sVarName errorsV
10800 61 72 4e 61 6d 65 20 66 69 6c 65 4e 61 6d 65 73 arName fileNames
10810 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 61 72 .. ar
10820 67 73 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d gs } {.. #.
10830 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 . # NOTE: S
10840 69 6e 63 65 20 77 65 20 61 72 65 20 67 6f 69 6e ince we are goin
10850 67 20 74 6f 20 75 73 65 20 74 68 69 73 20 6d 65 g to use this me
10860 74 68 6f 64 20 6e 61 6d 65 20 61 20 6c 6f 74 2c thod name a lot,
10870 20 61 73 73 69 67 6e 20 69 74 20 74 6f 20 61 0d assign it to a.
10880 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 . # v
10890 61 72 69 61 62 6c 65 20 66 69 72 73 74 2e 0d 0a ariable first...
108a0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 #.. s
108b0 65 74 20 61 64 64 20 52 65 66 65 72 65 6e 63 65 et add Reference
108c0 64 41 73 73 65 6d 62 6c 69 65 73 2e 41 64 64 0d dAssemblies.Add.
108d0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
108e0 20 20 23 20 4e 4f 54 45 3a 20 43 72 65 61 74 65 # NOTE: Create
108f0 20 74 68 65 20 62 61 73 65 20 63 6f 6d 6d 61 6e the base comman
10900 64 20 74 6f 20 65 76 61 6c 75 61 74 65 20 61 6e d to evaluate an
10910 64 20 61 64 64 20 74 68 65 20 70 72 6f 70 65 72 d add the proper
10920 74 79 20 73 65 74 74 69 6e 67 73 0d 0a 20 20 20 ty settings..
10930 20 20 20 23 20 20 20 20 20 20 20 74 68 61 74 20 # that
10940 61 72 65 20 61 6c 6d 6f 73 74 20 61 6c 77 61 79 are almost alway
10950 73 20 6e 65 65 64 65 64 20 62 79 20 6f 75 72 20 s needed by our
10960 75 6e 69 74 20 74 65 73 74 73 20 28 69 2e 65 2e unit tests (i.e.
10970 20 74 68 65 20 53 79 73 74 65 6d 0d 0a 20 20 20 the System..
10980 20 20 20 23 20 20 20 20 20 20 20 61 6e 64 20 53 # and S
10990 79 73 74 65 6d 2e 44 61 74 61 20 61 73 73 65 6d ystem.Data assem
109a0 62 6c 79 20 72 65 66 65 72 65 6e 63 65 73 29 2e bly references).
109b0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
109c0 20 73 65 74 20 63 6f 6d 6d 61 6e 64 20 5b 6c 69 set command [li
109d0 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 st \..
109e0 63 6f 6d 70 69 6c 65 43 53 68 61 72 70 20 24 74 compileCSharp $t
109f0 65 78 74 20 24 6d 65 6d 6f 72 79 20 24 73 79 6d ext $memory $sym
10a00 62 6f 6c 73 20 24 73 74 72 69 63 74 20 72 65 73 bols $strict res
10a10 75 6c 74 73 20 65 72 72 6f 72 73 20 5c 0d 0a 20 ults errors \..
10a20 20 20 20 20 20 20 20 20 20 24 61 64 64 20 53 79 $add Sy
10a30 73 74 65 6d 2e 64 6c 6c 20 24 61 64 64 20 53 79 stem.dll $add Sy
10a40 73 74 65 6d 2e 44 61 74 61 2e 64 6c 6c 20 24 61 stem.Data.dll $a
10a50 64 64 20 53 79 73 74 65 6d 2e 54 72 61 6e 73 61 dd System.Transa
10a60 63 74 69 6f 6e 73 2e 64 6c 6c 20 5c 0d 0a 20 20 ctions.dll \..
10a70 20 20 20 20 20 20 20 20 24 61 64 64 20 53 79 73 $add Sys
10a80 74 65 6d 2e 58 6d 6c 2e 64 6c 6c 5d 0d 0a 0d 0a tem.Xml.dll]....
10a90 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
10aa0 20 4e 4f 54 45 3a 20 41 64 64 20 61 6c 6c 20 74 NOTE: Add all t
10ab0 68 65 20 70 72 6f 76 69 64 65 64 20 66 69 6c 65 he provided file
10ac0 20 6e 61 6d 65 73 20 61 73 20 61 73 73 65 6d 62 names as assemb
10ad0 6c 79 20 72 65 66 65 72 65 6e 63 65 73 2e 0d 0a ly references...
10ae0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 66 #.. f
10af0 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 oreach fileName
10b00 24 66 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 $fileNames {..
10b10 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 63 6f lappend co
10b20 6d 6d 61 6e 64 20 24 61 64 64 20 5b 67 65 74 42 mmand $add [getB
10b30 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 inaryFileName $f
10b40 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 ileName]..
10b50 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
10b60 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 # NOTE: Add
10b70 74 68 65 20 65 78 74 72 61 20 61 72 67 75 6d 65 the extra argume
10b80 6e 74 73 2c 20 69 66 20 61 6e 79 2c 20 74 6f 20 nts, if any, to
10b90 74 68 65 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 65 the command to e
10ba0 76 61 6c 75 61 74 65 2e 0d 0a 20 20 20 20 20 20 valuate...
10bb0 23 0d 0a 20 20 20 20 20 20 65 76 61 6c 20 6c 61 #.. eval la
10bc0 70 70 65 6e 64 20 63 6f 6d 6d 61 6e 64 20 24 61 ppend command $a
10bd0 72 67 73 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a rgs.... #..
10be0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 6c # NOTE: Al
10bf0 69 61 73 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 ias the compiler
10c00 20 6c 6f 63 61 6c 20 72 65 73 75 6c 74 73 20 61 local results a
10c10 6e 64 20 65 72 72 6f 72 73 20 76 61 72 69 61 62 nd errors variab
10c20 6c 65 73 20 74 6f 20 74 68 65 0d 0a 20 20 20 20 les to the..
10c30 20 20 23 20 20 20 20 20 20 20 76 61 72 69 61 62 # variab
10c40 6c 65 20 6e 61 6d 65 73 20 70 72 6f 76 69 64 65 le names provide
10c50 64 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 2e d by our caller.
10c60 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
10c70 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
10c80 67 74 68 20 24 72 65 73 75 6c 74 73 56 61 72 4e gth $resultsVarN
10c90 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ame] > 0} then {
10ca0 0d 0a 20 20 20 20 20 20 20 20 75 70 76 61 72 20 .. upvar
10cb0 31 20 24 72 65 73 75 6c 74 73 56 61 72 4e 61 6d 1 $resultsVarNam
10cc0 65 20 72 65 73 75 6c 74 73 0d 0a 20 20 20 20 20 e results..
10cd0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b }.... if {
10ce0 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
10cf0 65 72 72 6f 72 73 56 61 72 4e 61 6d 65 5d 20 3e errorsVarName] >
10d00 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
10d10 20 20 20 20 75 70 76 61 72 20 31 20 24 65 72 72 upvar 1 $err
10d20 6f 72 73 56 61 72 4e 61 6d 65 20 65 72 72 6f 72 orsVarName error
10d30 73 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 s.. }....
10d40 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
10d50 4f 54 45 3a 20 45 76 61 6c 75 61 74 65 20 74 68 OTE: Evaluate th
10d60 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 5b 63 e constructed [c
10d70 6f 6d 70 69 6c 65 43 53 68 61 72 70 5d 20 63 6f ompileCSharp] co
10d80 6d 6d 61 6e 64 20 61 6e 64 20 72 65 74 75 72 6e mmand and return
10d90 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 the.. #
10da0 20 20 20 20 72 65 73 75 6c 74 2e 0d 0a 20 20 20 result...
10db0 20 20 20 23 0d 0a 20 20 20 20 20 20 65 76 61 6c #.. eval
10dc0 20 24 63 6f 6d 6d 61 6e 64 0d 0a 20 20 20 20 7d $command.. }
10dd0 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 69 73 ..... proc is
10de0 4d 65 6d 6f 72 79 44 62 20 7b 20 66 69 6c 65 4e MemoryDb { fileN
10df0 61 6d 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ame } {.. #
10e00 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
10e10 49 73 20 74 68 65 20 73 70 65 63 69 66 69 65 64 Is the specified
10e20 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 6e database file n
10e30 61 6d 65 20 72 65 61 6c 6c 79 20 61 6e 20 69 6e ame really an in
10e40 2d 6d 65 6d 6f 72 79 20 64 61 74 61 62 61 73 65 -memory database
10e50 3f 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ?.. #..
10e60 20 20 72 65 74 75 72 6e 20 5b 65 78 70 72 20 7b return [expr {
10e70 24 66 69 6c 65 4e 61 6d 65 20 65 71 20 22 3a 6d $fileName eq ":m
10e80 65 6d 6f 72 79 3a 22 20 7c 7c 20 5c 0d 0a 20 20 emory:" || \..
10e90 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
10ea0 72 61 6e 67 65 20 24 66 69 6c 65 4e 61 6d 65 20 range $fileName
10eb0 30 20 31 32 5d 20 65 71 20 22 66 69 6c 65 3a 3a 0 12] eq "file::
10ec0 6d 65 6d 6f 72 79 3a 22 7d 5d 0d 0a 20 20 20 20 memory:"}]..
10ed0 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 69 }..... proc i
10ee0 73 54 61 62 6c 65 49 6e 44 62 20 7b 20 6e 61 6d sTableInDb { nam
10ef0 65 20 7b 76 61 72 4e 61 6d 65 20 64 62 7d 20 7d e {varName db} }
10f00 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
10f10 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 # NOTE: Refer
10f20 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 to the specifie
10f30 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e d variable (e.g.
10f40 20 22 64 62 22 29 20 69 6e 20 74 68 65 20 63 6f "db") in the co
10f50 6e 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a 20 20 ntext of our..
10f60 20 20 20 20 23 20 20 20 20 20 20 20 63 61 6c 6c # call
10f70 65 72 2e 20 20 49 74 20 63 6f 6e 74 61 69 6e 73 er. It contains
10f80 20 74 68 65 20 64 61 74 61 62 61 73 65 20 63 6f the database co
10f90 6e 6e 65 63 74 69 6f 6e 20 68 61 6e 64 6c 65 20 nnection handle
10fa0 74 68 61 74 20 77 69 6c 6c 20 62 65 0d 0a 20 20 that will be..
10fb0 20 20 20 20 23 20 20 20 20 20 20 20 75 73 65 64 # used
10fc0 20 74 6f 20 65 78 65 63 75 74 65 20 74 68 65 20 to execute the
10fd0 71 75 65 72 79 20 75 73 65 64 20 74 6f 20 64 65 query used to de
10fe0 74 65 72 6d 69 6e 65 20 69 66 20 74 68 65 20 6e termine if the n
10ff0 61 6d 65 64 20 74 61 62 6c 65 20 69 73 0d 0a 20 amed table is..
11000 20 20 20 20 20 23 20 20 20 20 20 20 20 70 72 65 # pre
11010 73 65 6e 74 20 69 6e 20 74 68 61 74 20 64 61 74 sent in that dat
11020 61 62 61 73 65 2e 0d 0a 20 20 20 20 20 20 23 0d abase... #.
11030 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 . upvar 1 $
11040 76 61 72 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 varName db....
11050 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
11060 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 71 6c OTE: Use the sql
11070 69 74 65 5f 6d 61 73 74 65 72 20 74 61 62 6c 65 ite_master table
11080 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 69 66 to determine if
11090 20 74 68 65 20 6e 61 6d 65 64 20 74 61 62 6c 65 the named table
110a0 20 69 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 is.. #
110b0 20 20 20 70 72 65 73 65 6e 74 20 69 6e 20 74 68 present in th
110c0 65 20 64 61 74 61 62 61 73 65 2e 0d 0a 20 20 20 e database...
110d0 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 74 20 #.. set
110e0 73 71 6c 20 7b 0d 0a 20 20 20 20 20 20 20 20 53 sql {.. S
110f0 45 4c 45 43 54 20 43 4f 55 4e 54 28 2a 29 20 46 ELECT COUNT(*) F
11100 52 4f 4d 20 73 71 6c 69 74 65 5f 6d 61 73 74 65 ROM sqlite_maste
11110 72 20 57 48 45 52 45 20 74 79 70 65 20 3d 20 27 r WHERE type = '
11120 74 61 62 6c 65 27 20 41 4e 44 20 6e 61 6d 65 20 table' AND name
11130 3d 20 3f 3b 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d = ?;.. }...
11140 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
11150 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 20 6e # NOTE: Return n
11160 6f 6e 2d 7a 65 72 6f 20 69 66 20 74 68 65 20 6e on-zero if the n
11170 61 6d 65 64 20 74 61 62 6c 65 20 69 73 20 70 72 amed table is pr
11180 65 73 65 6e 74 2e 0d 0a 20 20 20 20 20 20 23 0d esent... #.
11190 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 65 . return [e
111a0 78 70 72 20 7b 0d 0a 20 20 20 20 20 20 20 20 5b xpr {.. [
111b0 73 71 6c 20 65 78 65 63 75 74 65 20 2d 65 78 65 sql execute -exe
111c0 63 75 74 65 20 73 63 61 6c 61 72 20 24 64 62 20 cute scalar $db
111d0 24 73 71 6c 20 5b 6c 69 73 74 20 70 61 72 61 6d $sql [list param
111e0 31 20 53 74 72 69 6e 67 20 24 6e 61 6d 65 5d 5d 1 String $name]]
111f0 20 3e 20 30 0d 0a 20 20 20 20 20 20 7d 5d 0d 0a > 0.. }]..
11200 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
11210 6f 63 20 67 65 74 44 62 44 65 66 61 75 6c 74 50 oc getDbDefaultP
11220 61 67 65 53 69 7a 65 20 7b 7d 20 7b 0d 0a 20 20 ageSize {} {..
11230 20 20 20 20 74 72 79 20 7b 0d 0a 20 20 20 20 20 try {..
11240 20 20 20 73 65 74 20 64 62 20 5b 73 71 6c 20 6f set db [sql o
11250 70 65 6e 20 2d 74 79 70 65 20 53 51 4c 69 74 65 pen -type SQLite
11260 20 7b 44 61 74 61 20 53 6f 75 72 63 65 3d 3a 6d {Data Source=:m
11270 65 6d 6f 72 79 3a 3b 7d 5d 0d 0a 20 20 20 20 20 emory:;}]..
11280 20 20 20 72 65 74 75 72 6e 20 5b 73 71 6c 20 65 return [sql e
11290 78 65 63 75 74 65 20 2d 65 78 65 63 75 74 65 20 xecute -execute
112a0 73 63 61 6c 61 72 20 24 64 62 20 22 50 52 41 47 scalar $db "PRAG
112b0 4d 41 20 70 61 67 65 5f 73 69 7a 65 3b 22 5d 0d MA page_size;"].
112c0 0a 20 20 20 20 20 20 7d 20 66 69 6e 61 6c 6c 79 . } finally
112d0 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
112e0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 64 62 5d [info exists db]
112f0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
11300 20 20 20 20 63 61 74 63 68 20 7b 73 71 6c 20 63 catch {sql c
11310 6c 6f 73 65 20 24 64 62 7d 0d 0a 20 20 20 20 20 lose $db}..
11320 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f unset -noco
11330 6d 70 6c 61 69 6e 20 64 62 0d 0a 20 20 20 20 20 mplain db..
11340 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
11350 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
11360 63 20 67 65 74 44 62 44 65 66 61 75 6c 74 43 61 c getDbDefaultCa
11370 63 68 65 53 69 7a 65 20 7b 7d 20 7b 0d 0a 20 20 cheSize {} {..
11380 20 20 20 20 74 72 79 20 7b 0d 0a 20 20 20 20 20 try {..
11390 20 20 20 73 65 74 20 64 62 20 5b 73 71 6c 20 6f set db [sql o
113a0 70 65 6e 20 2d 74 79 70 65 20 53 51 4c 69 74 65 pen -type SQLite
113b0 20 7b 44 61 74 61 20 53 6f 75 72 63 65 3d 3a 6d {Data Source=:m
113c0 65 6d 6f 72 79 3a 3b 7d 5d 0d 0a 20 20 20 20 20 emory:;}]..
113d0 20 20 20 72 65 74 75 72 6e 20 5b 73 71 6c 20 65 return [sql e
113e0 78 65 63 75 74 65 20 2d 65 78 65 63 75 74 65 20 xecute -execute
113f0 73 63 61 6c 61 72 20 24 64 62 20 22 50 52 41 47 scalar $db "PRAG
11400 4d 41 20 63 61 63 68 65 5f 73 69 7a 65 3b 22 5d MA cache_size;"]
11410 0d 0a 20 20 20 20 20 20 7d 20 66 69 6e 61 6c 6c .. } finall
11420 79 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 y {.. if
11430 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 64 62 {[info exists db
11440 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
11450 20 20 20 20 20 63 61 74 63 68 20 7b 73 71 6c 20 catch {sql
11460 63 6c 6f 73 65 20 24 64 62 7d 0d 0a 20 20 20 20 close $db}..
11470 20 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 unset -noc
11480 6f 6d 70 6c 61 69 6e 20 64 62 0d 0a 20 20 20 20 omplain db..
11490 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
114a0 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
114b0 6f 63 20 75 73 65 4c 65 67 61 63 79 44 62 50 61 oc useLegacyDbPa
114c0 67 65 41 6e 64 43 61 63 68 65 53 69 7a 65 73 20 geAndCacheSizes
114d0 7b 20 76 61 72 4e 61 6d 65 20 7d 20 7b 0d 0a 20 { varName } {..
114e0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
114f0 4e 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 74 NOTE: Refer to t
11500 68 65 20 73 70 65 63 69 66 69 65 64 20 76 61 72 he specified var
11510 69 61 62 6c 65 20 28 65 2e 67 2e 20 22 64 62 22 iable (e.g. "db"
11520 29 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 ) in the context
11530 20 6f 66 20 6f 75 72 0d 0a 20 20 20 20 20 20 23 of our.. #
11540 20 20 20 20 20 20 20 63 61 6c 6c 65 72 2e 20 20 caller.
11550 49 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 It contains the
11560 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 database connect
11570 69 6f 6e 20 68 61 6e 64 6c 65 20 74 68 61 74 20 ion handle that
11580 77 69 6c 6c 20 62 65 0d 0a 20 20 20 20 20 20 23 will be.. #
11590 20 20 20 20 20 20 20 75 73 65 64 20 74 6f 20 65 used to e
115a0 78 65 63 75 74 65 20 71 75 65 72 69 65 73 20 75 xecute queries u
115b0 73 65 64 20 74 6f 20 73 65 74 20 74 68 65 20 70 sed to set the p
115c0 61 67 65 20 61 6e 64 20 63 61 63 68 65 20 73 69 age and cache si
115d0 7a 65 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 zes... #..
115e0 20 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 upvar 1 $va
115f0 72 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 20 20 rName db....
11600 20 20 73 71 6c 20 65 78 65 63 75 74 65 20 24 64 sql execute $d
11610 62 20 7b 0d 0a 20 20 20 20 20 20 20 20 50 52 41 b {.. PRA
11620 47 4d 41 20 70 61 67 65 5f 73 69 7a 65 20 3d 20 GMA page_size =
11630 31 30 32 34 3b 0d 0a 20 20 20 20 20 20 20 20 50 1024;.. P
11640 52 41 47 4d 41 20 63 61 63 68 65 5f 73 69 7a 65 RAGMA cache_size
11650 20 3d 20 32 30 30 30 3b 0d 0a 20 20 20 20 20 20 = 2000;..
11660 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 }.... retur
11670 6e 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 n [list \..
11680 20 20 20 20 20 5b 73 71 6c 20 65 78 65 63 75 74 [sql execut
11690 65 20 2d 65 78 65 63 75 74 65 20 73 63 61 6c 61 e -execute scala
116a0 72 20 24 64 62 20 22 50 52 41 47 4d 41 20 70 61 r $db "PRAGMA pa
116b0 67 65 5f 73 69 7a 65 3b 22 5d 20 5c 0d 0a 20 20 ge_size;"] \..
116c0 20 20 20 20 20 20 20 20 5b 73 71 6c 20 65 78 65 [sql exe
116d0 63 75 74 65 20 2d 65 78 65 63 75 74 65 20 73 63 cute -execute sc
116e0 61 6c 61 72 20 24 64 62 20 22 50 52 41 47 4d 41 alar $db "PRAGMA
116f0 20 63 61 63 68 65 5f 73 69 7a 65 3b 22 5d 5d 0d cache_size;"]].
11700 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
11710 72 6f 63 20 65 78 74 72 61 63 74 53 79 73 74 65 roc extractSyste
11720 6d 44 61 74 61 53 51 4c 69 74 65 45 78 63 65 70 mDataSQLiteExcep
11730 74 69 6f 6e 4d 65 73 73 61 67 65 20 7b 20 76 61 tionMessage { va
11740 6c 75 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 lue } {.. #
11750 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
11760 49 66 20 74 68 65 20 73 74 72 69 6e 67 20 63 6f If the string co
11770 6e 66 6f 72 6d 73 20 74 6f 20 66 6f 72 6d 61 74 nforms to format
11780 20 6f 66 20 74 68 65 20 6e 6f 72 6d 61 6c 20 65 of the normal e
11790 78 63 65 70 74 69 6f 6e 0d 0a 20 20 20 20 20 20 xception..
117a0 23 20 20 20 20 20 20 20 65 72 72 6f 72 20 73 74 # error st
117b0 72 69 6e 67 73 2c 20 65 78 74 72 61 63 74 20 61 rings, extract a
117c0 6e 64 20 72 65 74 75 72 6e 20 6f 6e 6c 79 20 74 nd return only t
117d0 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65 he error message
117e0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
117f0 70 6f 72 74 69 6f 6e 20 69 74 73 65 6c 66 2e 0d portion itself..
11800 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
11810 73 65 74 20 70 61 74 74 65 72 6e 73 20 5b 6c 69 set patterns [li
11820 73 74 20 5c 0d 0a 20 20 20 20 20 20 7b 53 79 73 st \.. {Sys
11830 74 65 6d 5c 2e 44 61 74 61 5c 2e 53 51 4c 69 74 tem\.Data\.SQLit
11840 65 5c 2e 53 51 4c 69 74 65 45 78 63 65 70 74 69 e\.SQLiteExcepti
11850 6f 6e 20 5c 28 30 78 38 30 30 30 34 30 30 35 5c on \(0x80004005\
11860 29 3a 20 28 2e 2b 3f 29 20 20 28 3f 3a 20 29 3f ): (.+?) (?: )?
11870 61 74 7d 20 5c 0d 0a 20 20 20 20 20 20 7b 53 79 at} \.. {Sy
11880 73 74 65 6d 5c 2e 44 61 74 61 5c 2e 53 51 4c 69 stem\.Data\.SQLi
11890 74 65 5c 2e 53 51 4c 69 74 65 45 78 63 65 70 74 te\.SQLiteExcept
118a0 69 6f 6e 3a 20 28 2e 2b 3f 29 20 20 28 3f 3a 20 ion: (.+?) (?:
118b0 29 3f 61 74 7d 5d 0d 0a 0d 0a 20 20 20 20 20 20 )?at}]....
118c0 66 6f 72 65 61 63 68 20 70 61 74 74 65 72 6e 20 foreach pattern
118d0 24 70 61 74 74 65 72 6e 73 20 7b 0d 0a 20 20 20 $patterns {..
118e0 20 20 20 20 20 69 66 20 7b 5b 72 65 67 65 78 70 if {[regexp
118f0 20 2d 2d 20 24 70 61 74 74 65 72 6e 20 24 76 61 -- $pattern $va
11900 6c 75 65 20 64 75 6d 6d 79 20 6d 65 73 73 61 67 lue dummy messag
11910 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
11920 20 20 20 20 20 20 73 65 74 20 6d 65 73 73 61 67 set messag
11930 65 20 5b 73 74 72 69 6e 67 20 6d 61 70 20 5b 6c e [string map [l
11940 69 73 74 20 5c 72 5c 6e 20 5c 6e 5d 20 5b 73 74 ist \r\n \n] [st
11950 72 69 6e 67 20 74 72 69 6d 20 24 6d 65 73 73 61 ring trim $messa
11960 67 65 5d 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 ge]]..
11970 73 65 74 20 6c 69 6e 65 73 20 5b 73 70 6c 69 74 set lines [split
11980 20 24 6d 65 73 73 61 67 65 20 5c 6e 5d 0d 0a 0d $message \n]...
11990 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
119a0 6c 6c 65 6e 67 74 68 20 24 6c 69 6e 65 73 5d 20 llength $lines]
119b0 3d 3d 20 32 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 2} then {..
119c0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 6c if {[l
119d0 69 6e 64 65 78 20 24 6c 69 6e 65 73 20 30 5d 20 index $lines 0]
119e0 65 71 20 5b 6c 69 6e 64 65 78 20 24 6c 69 6e 65 eq [lindex $line
119f0 73 20 31 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 s 1]} then {..
11a00 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 retu
11a10 72 6e 20 5b 6c 69 6e 64 65 78 20 24 6c 69 6e 65 rn [lindex $line
11a20 73 20 30 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 s 0]..
11a30 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
11a40 20 20 20 72 65 74 75 72 6e 20 5b 61 70 70 65 6e return [appen
11a50 64 41 72 67 73 20 5b 6c 69 6e 64 65 78 20 24 6c dArgs [lindex $l
11a60 69 6e 65 73 20 30 5d 20 22 20 2d 2d 20 22 20 5b ines 0] " -- " [
11a70 6c 69 6e 64 65 78 20 24 6c 69 6e 65 73 20 31 5d lindex $lines 1]
11a80 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
11a90 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 .. retu
11aa0 72 6e 20 24 6d 65 73 73 61 67 65 0d 0a 20 20 20 rn $message..
11ab0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d }.. }.
11ac0 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 ... return
11ad0 24 76 61 6c 75 65 0d 0a 20 20 20 20 7d 0d 0a 0c $value.. }...
11ae0 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 69 6d 53 .. proc trimS
11af0 71 6c 20 7b 20 73 71 6c 20 7d 20 7b 0d 0a 20 20 ql { sql } {..
11b00 20 20 20 20 72 65 74 75 72 6e 20 5b 72 65 67 73 return [regs
11b10 75 62 20 2d 61 6c 6c 20 2d 2d 20 7b 5c 73 2b 7d ub -all -- {\s+}
11b20 20 5b 73 74 72 69 6e 67 20 74 72 69 6d 20 24 73 [string trim $s
11b30 71 6c 5d 20 22 20 22 5d 0d 0a 20 20 20 20 7d 0d ql] " "].. }.
11b40 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 65 78 65 .... proc exe
11b50 63 75 74 65 53 71 6c 20 7b 20 73 71 6c 20 7b 65 cuteSql { sql {e
11b60 78 65 63 75 74 65 20 6e 6f 6e 65 7d 20 7b 66 6f xecute none} {fo
11b70 72 6d 61 74 20 6e 6f 6e 65 7d 20 7b 66 69 6c 65 rmat none} {file
11b80 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 Name ""} } {..
11b90 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
11ba0 6c 65 6e 67 74 68 20 24 66 69 6c 65 4e 61 6d 65 length $fileName
11bb0 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 73 65 ] == 0} then {se
11bc0 74 20 66 69 6c 65 4e 61 6d 65 20 3a 6d 65 6d 6f t fileName :memo
11bd0 72 79 3a 7d 0d 0a 20 20 20 20 20 20 73 65 74 75 ry:}.. setu
11be0 70 44 62 20 24 66 69 6c 65 4e 61 6d 65 20 22 22 pDb $fileName ""
11bf0 20 22 22 20 22 22 20 22 22 20 22 22 20 66 61 6c "" "" "" "" fal
11c00 73 65 20 66 61 6c 73 65 20 66 61 6c 73 65 20 66 se false false f
11c10 61 6c 73 65 20 64 62 20 74 72 75 65 0d 0a 0d 0a alse db true....
11c20 20 20 20 20 20 20 74 72 79 20 7b 0d 0a 20 20 20 try {..
11c30 20 20 20 20 20 72 65 74 75 72 6e 20 5b 75 70 6c return [upl
11c40 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 5c 0d 0a evel 1 [list \..
11c50 20 20 20 20 20 20 20 20 20 20 20 20 73 71 6c 20 sql
11c60 65 78 65 63 75 74 65 20 2d 65 78 65 63 75 74 65 execute -execute
11c70 20 24 65 78 65 63 75 74 65 20 2d 66 6f 72 6d 61 $execute -forma
11c80 74 20 24 66 6f 72 6d 61 74 20 24 64 62 20 24 73 t $format $db $s
11c90 71 6c 5d 5d 0d 0a 20 20 20 20 20 20 7d 20 66 69 ql]].. } fi
11ca0 6e 61 6c 6c 79 20 7b 0d 0a 20 20 20 20 20 20 20 nally {..
11cb0 20 63 6c 65 61 6e 75 70 44 62 20 24 66 69 6c 65 cleanupDb $file
11cc0 4e 61 6d 65 20 64 62 20 66 61 6c 73 65 20 66 61 Name db false fa
11cd0 6c 73 65 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 lse false..
11ce0 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
11cf0 20 20 70 72 6f 63 20 68 61 73 4e 6f 46 6c 61 67 proc hasNoFlag
11d00 73 20 7b 20 76 61 72 4e 61 6d 65 20 6e 6f 6e 65 s { varName none
11d10 20 7d 20 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 } {.. upva
11d20 72 20 31 20 24 76 61 72 4e 61 6d 65 20 66 6c 61 r 1 $varName fla
11d30 67 73 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b gs.... if {
11d40 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 66 6c ![info exists fl
11d50 61 67 73 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ags]} then {..
11d60 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
11d70 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 e.. }....
11d80 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
11d90 6c 65 6e 67 74 68 20 24 66 6c 61 67 73 5d 20 3d length $flags] =
11da0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
11db0 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 return true
11dc0 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
11dd0 20 20 20 69 66 20 7b 24 6e 6f 6e 65 20 26 26 20 if {$none &&
11de0 24 66 6c 61 67 73 20 65 71 20 22 4e 6f 6e 65 22 $flags eq "None"
11df0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
11e00 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 return true..
11e10 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
11e20 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 return false..
11e30 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
11e40 20 67 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 46 6c getConnectionFl
11e50 61 67 73 20 7b 20 66 69 6c 65 4e 61 6d 65 20 66 ags { fileName f
11e60 6c 61 67 73 20 7b 71 75 69 65 74 20 66 61 6c 73 lags {quiet fals
11e70 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d e} } {.. #.
11e80 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 . # NOTE: F
11e90 69 67 75 72 65 20 6f 75 74 20 77 68 69 63 68 20 igure out which
11ea0 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 6e 61 database file na
11eb0 6d 65 20 6f 72 20 63 6f 6e 6e 65 63 74 69 6f 6e me or connection
11ec0 20 73 74 72 69 6e 67 20 74 68 65 73 65 0d 0a 20 string these..
11ed0 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e # con
11ee0 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 77 69 nection flags wi
11ef0 6c 6c 20 61 63 74 75 61 6c 6c 79 20 61 70 70 6c ll actually appl
11f00 79 20 74 6f 2e 20 20 54 68 69 73 20 69 73 20 6e y to. This is n
11f10 6f 74 20 6e 65 63 65 73 73 61 72 79 0d 0a 20 20 ot necessary..
11f20 20 20 20 20 23 20 20 20 20 20 20 20 69 6e 20 71 # in q
11f30 75 69 65 74 20 6d 6f 64 65 20 62 65 63 61 75 73 uiet mode becaus
11f40 65 20 74 68 69 73 20 69 6e 66 6f 72 6d 61 74 69 e this informati
11f50 6f 6e 20 69 73 20 6f 6e 6c 79 20 75 73 65 64 20 on is only used
11f60 66 6f 72 20 6c 6f 67 67 69 6e 67 0d 0a 20 20 20 for logging..
11f70 20 20 20 23 20 20 20 20 20 20 20 61 6e 64 20 72 # and r
11f80 65 70 6f 72 74 69 6e 67 20 70 75 72 70 6f 73 65 eporting purpose
11f90 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 s... #..
11fa0 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
11fb0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
11fc0 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
11fd0 74 68 20 24 66 69 6c 65 4e 61 6d 65 5d 20 3e 20 th $fileName] >
11fe0 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
11ff0 20 20 20 20 20 73 65 74 20 64 61 74 61 62 61 73 set databas
12000 65 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 66 e [appendArgs "f
12010 69 6c 65 20 6e 61 6d 65 20 5c 22 22 20 24 66 69 ile name \"" $fi
12020 6c 65 4e 61 6d 65 20 5c 22 5d 0d 0a 20 20 20 20 leName \"]..
12030 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 } elseif {[i
12040 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 64 61 74 nfo exists ::dat
12050 61 53 6f 75 72 63 65 5d 20 26 26 20 5c 0d 0a 20 aSource] && \..
12060 20 20 20 20 20 20 20 20 20 20 20 21 5b 61 72 72 ![arr
12070 61 79 20 65 78 69 73 74 73 20 3a 3a 64 61 74 61 ay exists ::data
12080 53 6f 75 72 63 65 5d 7d 20 74 68 65 6e 20 7b 0d Source]} then {.
12090 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 64 . set d
120a0 61 74 61 62 61 73 65 20 5b 61 70 70 65 6e 64 41 atabase [appendA
120b0 72 67 73 20 22 64 61 74 61 20 73 6f 75 72 63 65 rgs "data source
120c0 20 5c 22 22 20 24 3a 3a 64 61 74 61 53 6f 75 72 \"" $::dataSour
120d0 63 65 20 5c 22 5d 0d 0a 20 20 20 20 20 20 20 20 ce \"]..
120e0 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
120f0 20 20 20 20 73 65 74 20 64 61 74 61 62 61 73 65 set database
12100 20 3c 75 6e 6b 6e 6f 77 6e 3e 0d 0a 20 20 20 20 <unknown>..
12110 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
12120 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
12130 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 28 61 # NOTE: Show (a
12140 6e 64 20 6c 6f 67 29 20 74 68 65 20 6c 6f 63 61 nd log) the loca
12150 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 l connection fla
12160 67 73 20 61 6e 64 20 74 68 65 20 61 73 73 6f 63 gs and the assoc
12170 69 61 74 65 64 0d 0a 20 20 20 20 20 20 23 20 20 iated.. #
12180 20 20 20 20 20 64 61 74 61 20 73 6f 75 72 63 65 data source
12190 20 6f 72 20 66 69 6c 65 20 6e 61 6d 65 2e 0d 0a or file name...
121a0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
121b0 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
121c0 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
121d0 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
121e0 6e 6f 28 65 6d 69 74 4c 6f 63 61 6c 46 6c 61 67 no(emitLocalFlag
121f0 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 s)] && \..
12200 20 20 20 20 20 20 28 21 5b 69 6e 66 6f 20 65 78 (![info ex
12210 69 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 4c 6f ists ::no(emitLo
12220 63 61 6c 46 6c 61 67 73 49 66 4e 6f 6e 65 29 5d calFlagsIfNone)]
12230 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 || \..
12240 20 20 20 20 21 5b 68 61 73 4e 6f 46 6c 61 67 73 ![hasNoFlags
12250 20 66 6c 61 67 73 20 66 61 6c 73 65 5d 29 7d 20 flags false])}
12260 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
12270 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
12280 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
12290 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
122a0 20 20 20 20 20 22 2d 2d 2d 2d 20 6c 6f 63 61 6c "---- local
122b0 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 connection flag
122c0 73 20 66 6f 72 20 22 20 24 64 61 74 61 62 61 73 s for " $databas
122d0 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
122e0 20 20 20 22 20 61 72 65 3a 20 22 20 5b 65 78 70 " are: " [exp
122f0 72 20 7b 21 5b 68 61 73 4e 6f 46 6c 61 67 73 20 r {![hasNoFlags
12300 66 6c 61 67 73 20 66 61 6c 73 65 5d 20 3f 20 5c flags false] ? \
12310 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
12320 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 22 20 24 [appendArgs \" $
12330 66 6c 61 67 73 20 5c 22 5d 20 3a 20 22 3c 6e 6f flags \"] : "<no
12340 6e 65 3e 22 7d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 ne>"}] \n]..
12350 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
12360 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
12370 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 28 61 # NOTE: Show (a
12380 6e 64 20 6c 6f 67 29 20 74 68 65 20 73 68 61 72 nd log) the shar
12390 65 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c ed connection fl
123a0 61 67 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ags... #..
123b0 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
123c0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
123d0 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
123e0 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
123f0 20 69 6e 76 6f 6b 65 20 53 79 73 74 65 6d 2e 44 invoke System.D
12400 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 ata.SQLite.SQLit
12410 65 43 6f 6e 6e 65 63 74 69 6f 6e 20 53 68 61 72 eConnection Shar
12420 65 64 46 6c 61 67 73 0d 0a 20 20 20 20 20 20 20 edFlags..
12430 20 7d 20 73 68 61 72 65 64 46 6c 61 67 73 5d 20 } sharedFlags]
12440 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
12450 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
12460 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 fo exists ::no(e
12470 6d 69 74 53 68 61 72 65 64 46 6c 61 67 73 29 5d mitSharedFlags)]
12480 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
12490 20 20 20 20 20 28 21 5b 69 6e 66 6f 20 65 78 69 (![info exi
124a0 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 53 68 61 sts ::no(emitSha
124b0 72 65 64 46 6c 61 67 73 49 66 4e 6f 6e 65 29 5d redFlagsIfNone)]
124c0 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 || \..
124d0 20 20 20 20 20 20 21 5b 68 61 73 4e 6f 46 6c 61 ![hasNoFla
124e0 67 73 20 73 68 61 72 65 64 46 6c 61 67 73 20 74 gs sharedFlags t
124f0 72 75 65 5d 29 7d 20 74 68 65 6e 20 7b 0d 0a 20 rue])} then {..
12500 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
12510 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
12520 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
12530 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
12540 22 2d 2d 2d 2d 20 73 68 61 72 65 64 20 63 6f 6e "---- shared con
12550 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 66 6f nection flags fo
12560 72 20 22 20 24 64 61 74 61 62 61 73 65 20 5c 0d r " $database \.
12570 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
12580 20 22 20 61 72 65 3a 20 22 20 5b 65 78 70 72 20 " are: " [expr
12590 7b 21 5b 68 61 73 4e 6f 46 6c 61 67 73 20 73 68 {![hasNoFlags sh
125a0 61 72 65 64 46 6c 61 67 73 20 74 72 75 65 5d 20 aredFlags true]
125b0 3f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ? \..
125c0 20 20 20 20 20 5b 61 70 70 65 6e 64 41 72 67 73 [appendArgs
125d0 20 5c 22 20 24 73 68 61 72 65 64 46 6c 61 67 73 \" $sharedFlags
125e0 20 5c 22 5d 20 3a 20 22 3c 6e 6f 6e 65 3e 22 7d \"] : "<none>"}
125f0 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 ] \n]..
12600 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c }.. } el
12610 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
12620 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
12630 73 20 3a 3a 6e 6f 28 65 6d 69 74 53 68 61 72 65 s ::no(emitShare
12640 64 46 6c 61 67 73 29 5d 20 26 26 20 5c 0d 0a 20 dFlags)] && \..
12650 20 20 20 20 20 20 20 20 20 20 20 20 20 21 5b 69 ![i
12660 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
12670 65 6d 69 74 53 68 61 72 65 64 46 6c 61 67 73 49 emitSharedFlagsI
12680 66 55 6e 61 76 61 69 6c 61 62 6c 65 29 5d 7d 20 fUnavailable)]}
12690 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
126a0 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
126b0 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
126c0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
126d0 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
126e0 68 61 72 65 64 20 63 6f 6e 6e 65 63 74 69 6f 6e hared connection
126f0 20 66 6c 61 67 73 20 66 6f 72 20 22 20 24 64 61 flags for " $da
12700 74 61 62 61 73 65 20 5c 0d 0a 20 20 20 20 20 20 tabase \..
12710 20 20 20 20 20 20 20 20 20 20 22 20 61 72 65 3a " are:
12720 20 3c 75 6e 61 76 61 69 6c 61 62 6c 65 3e 5c 6e <unavailable>\n
12730 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d "].. }.
12740 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
12750 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
12760 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 # NOTE: Sh
12770 6f 77 20 28 61 6e 64 20 6c 6f 67 29 20 74 68 65 ow (and log) the
12780 20 64 65 74 65 63 74 65 64 20 67 6c 6f 62 61 6c detected global
12790 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 connection flag
127a0 73 2c 20 69 66 20 61 6e 79 2e 0d 0a 20 20 20 20 s, if any...
127b0 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
127c0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
127d0 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
127e0 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 fo exists ::no(e
127f0 6d 69 74 47 6c 6f 62 61 6c 46 6c 61 67 73 29 5d mitGlobalFlags)]
12800 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
12810 20 20 20 28 21 5b 69 6e 66 6f 20 65 78 69 73 74 (![info exist
12820 73 20 3a 3a 6e 6f 28 65 6d 69 74 47 6c 6f 62 61 s ::no(emitGloba
12830 6c 46 6c 61 67 73 49 66 4e 6f 6e 65 29 5d 20 7c lFlagsIfNone)] |
12840 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 | \..
12850 20 20 21 5b 68 61 73 4e 6f 46 6c 61 67 73 20 3a ![hasNoFlags :
12860 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 6c 61 67 :connection_flag
12870 73 20 66 61 6c 73 65 5d 29 7d 20 74 68 65 6e 20 s false])} then
12880 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 {.. tpu
12890 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
128a0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
128b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
128c0 22 2d 2d 2d 2d 20 67 6c 6f 62 61 6c 20 63 6f 6e "---- global con
128d0 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 61 72 nection flags ar
128e0 65 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 e: " \..
128f0 20 20 20 20 20 20 5b 65 78 70 72 20 7b 21 5b 68 [expr {![h
12900 61 73 4e 6f 46 6c 61 67 73 20 3a 3a 63 6f 6e 6e asNoFlags ::conn
12910 65 63 74 69 6f 6e 5f 66 6c 61 67 73 20 66 61 6c ection_flags fal
12920 73 65 5d 20 3f 20 5c 0d 0a 20 20 20 20 20 20 20 se] ? \..
12930 20 20 20 20 20 20 20 5b 61 70 70 65 6e 64 41 72 [appendAr
12940 67 73 20 5c 22 20 24 3a 3a 63 6f 6e 6e 65 63 74 gs \" $::connect
12950 69 6f 6e 5f 66 6c 61 67 73 20 5c 22 5d 20 3a 20 ion_flags \"] :
12960 22 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c 6e 5d 0d 0a "<none>"}] \n]..
12970 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
12980 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
12990 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 # NOTE: If
129a0 74 68 65 72 65 20 61 72 65 20 61 6e 79 20 67 6c there are any gl
129b0 6f 62 61 6c 20 28 70 65 72 20 74 65 73 74 20 72 obal (per test r
129c0 75 6e 29 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 un) connection f
129d0 6c 61 67 73 20 63 75 72 72 65 6e 74 6c 79 0d 0a lags currently..
129e0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 65 # se
129f0 74 2c 20 75 73 65 20 74 68 65 6d 20 6e 6f 77 20 t, use them now
12a00 28 69 2e 65 2e 20 62 79 20 63 6f 6d 62 69 6e 69 (i.e. by combini
12a10 6e 67 20 74 68 65 6d 20 77 69 74 68 20 74 68 65 ng them with the
12a20 20 6f 6e 65 73 20 66 6f 72 20 74 68 69 73 0d 0a ones for this..
12a30 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
12a40 6e 6e 65 63 74 69 6f 6e 29 2e 0d 0a 20 20 20 20 nnection)...
12a50 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
12a60 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 63 6f info exists ::co
12a70 6e 6e 65 63 74 69 6f 6e 5f 66 6c 61 67 73 5d 7d nnection_flags]}
12a80 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
12a90 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
12aa0 54 45 3a 20 43 6f 6d 62 69 6e 65 20 61 6e 64 2f TE: Combine and/
12ab0 6f 72 20 72 65 70 6c 61 63 65 20 74 68 65 20 63 or replace the c
12ac0 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 onnection flags
12ad0 61 6e 64 20 74 68 65 6e 20 73 68 6f 77 20 74 68 and then show th
12ae0 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
12af0 20 20 20 6e 65 77 20 76 61 6c 75 65 2e 0d 0a 20 new value...
12b00 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
12b10 20 20 73 65 74 20 66 6c 61 67 73 20 5b 63 6f 6d set flags [com
12b20 62 69 6e 65 46 6c 61 67 73 20 24 66 6c 61 67 73 bineFlags $flags
12b30 20 24 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 $::connection_f
12b40 6c 61 67 73 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 lags]....
12b50 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
12b60 54 45 3a 20 53 68 6f 77 20 28 61 6e 64 20 6c 6f TE: Show (and lo
12b70 67 29 20 74 68 65 20 6e 65 77 20 65 66 66 65 63 g) the new effec
12b80 74 69 76 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 tive connection
12b90 66 6c 61 67 73 2e 0d 0a 20 20 20 20 20 20 20 20 flags...
12ba0 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
12bb0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
12bc0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
12bd0 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
12be0 28 65 6d 69 74 43 6f 6d 62 69 6e 65 64 46 6c 61 (emitCombinedFla
12bf0 67 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 gs)] && \..
12c00 20 20 20 20 20 20 20 20 20 28 21 5b 69 6e 66 6f (![info
12c10 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 exists ::no(emi
12c20 74 43 6f 6d 62 69 6e 65 64 46 6c 61 67 73 49 66 tCombinedFlagsIf
12c30 4e 6f 6e 65 29 5d 20 7c 7c 20 5c 0d 0a 20 20 20 None)] || \..
12c40 20 20 20 20 20 20 20 20 20 20 20 20 21 5b 68 61 ![ha
12c50 73 4e 6f 46 6c 61 67 73 20 66 6c 61 67 73 20 66 sNoFlags flags f
12c60 61 6c 73 65 5d 29 7d 20 74 68 65 6e 20 7b 0d 0a alse])} then {..
12c70 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
12c80 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
12c90 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
12ca0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
12cb0 20 22 2d 2d 2d 2d 20 63 6f 6d 62 69 6e 65 64 20 "---- combined
12cc0 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 connection flags
12cd0 20 66 6f 72 20 22 20 24 64 61 74 61 62 61 73 65 for " $database
12ce0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
12cf0 20 20 20 20 22 20 61 72 65 3a 20 22 20 5b 65 78 " are: " [ex
12d00 70 72 20 7b 21 5b 68 61 73 4e 6f 46 6c 61 67 73 pr {![hasNoFlags
12d10 20 66 6c 61 67 73 20 66 61 6c 73 65 5d 20 3f 20 flags false] ?
12d20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
12d30 20 20 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c [appendArgs \
12d40 22 20 24 66 6c 61 67 73 20 5c 22 5d 20 3a 20 22 " $flags \"] : "
12d50 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c 6e 5d 0d 0a 20 <none>"}] \n]..
12d60 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
12d70 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
12d80 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 .. return $
12d90 66 6c 61 67 73 0d 0a 20 20 20 20 7d 0d 0a 0c 0d flags.. }....
12da0 0a 20 20 20 20 70 72 6f 63 20 67 65 74 46 6c 61 . proc getFla
12db0 67 73 50 72 6f 70 65 72 74 79 20 7b 20 7b 66 6c gsProperty { {fl
12dc0 61 67 73 20 22 22 7d 20 7b 71 75 69 65 74 20 66 ags ""} {quiet f
12dd0 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 alse} } {..
12de0 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
12df0 3a 20 44 65 74 65 72 6d 69 6e 65 20 77 68 61 74 : Determine what
12e00 20 74 68 65 20 63 6f 6d 62 69 6e 65 64 20 28 67 the combined (g
12e10 6c 6f 62 61 6c 20 61 6e 64 20 6c 6f 63 61 6c 29 lobal and local)
12e20 20 63 6f 6e 6e 65 63 74 69 6f 6e 0d 0a 20 20 20 connection..
12e30 20 20 20 23 20 20 20 20 20 20 20 66 6c 61 67 73 # flags
12e40 20 73 68 6f 75 6c 64 20 62 65 2c 20 70 6f 73 73 should be, poss
12e50 69 62 6c 79 20 71 75 69 65 74 6c 79 2e 0d 0a 20 ibly quietly...
12e60 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 65 #.. se
12e70 74 20 66 6c 61 67 73 20 5b 67 65 74 43 6f 6e 6e t flags [getConn
12e80 65 63 74 69 6f 6e 46 6c 61 67 73 20 22 22 20 24 ectionFlags "" $
12e90 66 6c 61 67 73 20 24 71 75 69 65 74 5d 0d 0a 0d flags $quiet]...
12ea0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
12eb0 23 20 4e 4f 54 45 3a 20 49 66 20 6e 6f 20 67 6c # NOTE: If no gl
12ec0 6f 62 61 6c 20 6f 72 20 6c 6f 63 61 6c 20 63 6f obal or local co
12ed0 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 77 nnection flags w
12ee0 65 72 65 20 73 70 65 63 69 66 69 65 64 2c 20 74 ere specified, t
12ef0 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 he.. #
12f00 20 20 64 65 66 61 75 6c 74 20 63 6f 6e 6e 65 63 default connec
12f10 74 69 6f 6e 20 66 6c 61 67 73 20 73 68 6f 75 6c tion flags shoul
12f20 64 20 62 65 20 75 73 65 64 3b 20 74 68 65 72 65 d be used; there
12f30 66 6f 72 65 2c 20 72 65 74 75 72 6e 0d 0a 20 20 fore, return..
12f40 20 20 20 20 23 20 20 20 20 20 20 20 61 6e 20 65 # an e
12f50 6d 70 74 79 20 73 74 72 69 6e 67 20 69 6e 20 74 mpty string in t
12f60 68 61 74 20 63 61 73 65 2e 0d 0a 20 20 20 20 20 hat case...
12f70 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 #.. if {[s
12f80 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 66 6c tring length $fl
12f90 61 67 73 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ags] == 0} then
12fa0 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 {.. retur
12fb0 6e 20 22 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d n "".. }...
12fc0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
12fd0 23 20 4e 4f 54 45 3a 20 49 6e 20 6f 72 64 65 72 # NOTE: In order
12fe0 20 74 6f 20 63 68 65 63 6b 20 69 66 20 74 68 65 to check if the
12ff0 20 64 65 66 61 75 6c 74 20 63 6f 6e 6e 65 63 74 default connect
13000 69 6f 6e 20 66 6c 61 67 73 20 61 72 65 20 62 65 ion flags are be
13010 69 6e 67 20 75 73 65 64 0d 0a 20 20 20 20 20 20 ing used..
13020 23 20 20 20 20 20 20 20 69 74 20 69 73 20 6e 65 # it is ne
13030 63 65 73 73 61 72 79 20 74 6f 20 61 74 74 65 6d cessary to attem
13040 70 74 20 61 20 63 6f 6e 76 65 72 73 69 6f 6e 20 pt a conversion
13050 74 6f 20 74 68 65 20 61 63 74 75 61 6c 20 65 6e to the actual en
13060 75 6d 65 72 61 74 65 64 0d 0a 20 20 20 20 20 20 umerated..
13070 23 20 20 20 20 20 20 20 74 79 70 65 2e 20 20 46 # type. F
13080 61 69 6c 69 6e 67 20 74 68 61 74 2c 20 74 68 65 ailing that, the
13090 20 63 68 65 63 6b 20 61 67 61 69 6e 73 74 20 74 check against t
130a0 68 65 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 he default value
130b0 20 77 69 6c 6c 20 62 65 0d 0a 20 20 20 20 20 20 will be..
130c0 23 20 20 20 20 20 20 20 73 6b 69 70 70 65 64 2e # skipped.
130d0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
130e0 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
130f0 20 20 20 20 20 20 20 73 65 74 20 65 72 72 6f 72 set error
13100 20 6e 75 6c 6c 3b 20 23 20 49 47 4e 4f 52 45 44 null; # IGNORED
13110 0d 0a 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 .... obje
13120 63 74 20 69 6e 76 6f 6b 65 20 55 74 69 6c 69 74 ct invoke Utilit
13130 79 20 54 72 79 50 61 72 73 65 46 6c 61 67 73 45 y TryParseFlagsE
13140 6e 75 6d 20 22 22 20 5c 0d 0a 20 20 20 20 20 20 num "" \..
13150 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 System.Dat
13160 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 43 a.SQLite.SQLiteC
13170 6f 6e 6e 65 63 74 69 6f 6e 46 6c 61 67 73 20 22 onnectionFlags "
13180 22 20 24 66 6c 61 67 73 20 6e 75 6c 6c 20 74 72 " $flags null tr
13190 75 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ue \..
131a0 20 20 74 72 75 65 20 65 72 72 6f 72 0d 0a 20 20 true error..
131b0 20 20 20 20 7d 20 76 61 6c 75 65 5d 7d 20 74 68 } value]} th
131c0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
131d0 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
131e0 20 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 70 Attempting to p
131f0 61 72 73 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 arse the connect
13200 69 6f 6e 20 66 6c 61 67 73 20 63 61 75 73 65 64 ion flags caused
13210 20 61 20 73 63 72 69 70 74 0d 0a 20 20 20 20 20 a script..
13220 20 20 20 23 20 20 20 20 20 20 20 65 72 72 6f 72 # error
13230 2e 20 20 45 6d 69 74 20 61 20 77 61 72 6e 69 6e . Emit a warnin
13240 67 20 74 6f 20 74 68 65 20 74 65 73 74 20 6c 6f g to the test lo
13250 67 20 66 69 6c 65 20 61 6e 64 20 63 6f 6e 74 69 g file and conti
13260 6e 75 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 nue.. #
13270 20 20 20 20 20 75 73 69 6e 67 20 61 6e 20 65 6d using an em
13280 74 70 79 20 73 74 72 69 6e 67 20 69 6e 73 74 65 tpy string inste
13290 61 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ad... #..
132a0 20 20 20 20 20 20 20 20 74 6c 6f 67 20 5b 61 70 tlog [ap
132b0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
132c0 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 "==== WA
132d0 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f RNING: failed to
132e0 20 70 61 72 73 65 20 63 6f 6e 6e 65 63 74 69 6f parse connectio
132f0 6e 20 66 6c 61 67 73 2c 20 65 72 72 6f 72 3a 20 n flags, error:
13300 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
13310 20 5c 6e 5c 74 20 24 76 61 6c 75 65 20 5c 6e 5d \n\t $value \n]
13320 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 .... set
13330 76 61 6c 75 65 20 22 22 0d 0a 20 20 20 20 20 20 value ""..
13340 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
13350 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 # NOTE: If t
13360 68 65 20 63 6f 6d 62 69 6e 65 64 20 66 6c 61 67 he combined flag
13370 73 20 73 74 72 69 6e 67 20 63 6f 75 6c 64 20 6e s string could n
13380 6f 74 20 61 63 74 75 61 6c 6c 79 20 62 65 20 63 ot actually be c
13390 6f 6e 76 65 72 74 65 64 0d 0a 20 20 20 20 20 20 onverted..
133a0 23 20 20 20 20 20 20 20 74 6f 20 74 68 65 20 65 # to the e
133b0 6e 75 6d 65 72 61 74 65 64 20 74 79 70 65 20 69 numerated type i
133c0 74 20 69 73 20 74 68 65 20 64 65 66 61 75 6c 74 t is the default
133d0 20 76 61 6c 75 65 2c 20 74 68 65 6e 20 6a 75 73 value, then jus
133e0 74 20 75 73 65 0d 0a 20 20 20 20 20 20 23 20 20 t use.. #
133f0 20 20 20 20 20 69 74 20 76 65 72 62 61 74 69 6d it verbatim
13400 3b 20 6f 74 68 65 72 77 69 73 65 2c 20 6a 75 73 ; otherwise, jus
13410 74 20 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 t return an empt
13420 79 20 73 74 72 69 6e 67 2e 20 20 49 6e 20 74 68 y string. In th
13430 61 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 at.. #
13440 20 20 63 61 73 65 2c 20 74 68 65 20 64 65 66 61 case, the defa
13450 75 6c 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 ult connection f
13460 6c 61 67 73 20 77 69 6c 6c 20 62 65 20 75 73 65 lags will be use
13470 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 d... #..
13480 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c if {[string l
13490 65 6e 67 74 68 20 24 76 61 6c 75 65 5d 20 3d 3d ength $value] ==
134a0 20 30 20 7c 7c 20 24 76 61 6c 75 65 20 6e 65 20 0 || $value ne
134b0 22 44 65 66 61 75 6c 74 22 7d 20 74 68 65 6e 20 "Default"} then
134c0 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
134d0 20 20 20 20 20 20 23 20 57 41 52 4e 49 4e 47 3a # WARNING:
134e0 20 54 68 69 73 20 72 65 74 75 72 6e 73 20 74 68 This returns th
134f0 65 20 73 74 72 69 6e 67 20 76 61 6c 75 65 20 6f e string value o
13500 66 20 74 68 65 20 63 6f 6d 62 69 6e 65 64 20 66 f the combined f
13510 6c 61 67 73 2c 20 6e 6f 74 0d 0a 20 20 20 20 20 lags, not..
13520 20 20 20 23 20 20 20 20 20 20 20 20 20 20 74 68 # th
13530 65 20 65 6e 75 6d 65 72 61 74 65 64 20 76 61 6c e enumerated val
13540 75 65 2e 20 20 54 68 69 73 20 69 73 20 62 79 20 ue. This is by
13550 64 65 73 69 67 6e 20 61 6e 64 20 73 68 6f 75 6c design and shoul
13560 64 20 6e 6f 74 0d 0a 20 20 20 20 20 20 20 20 23 d not.. #
13570 20 20 20 20 20 20 20 20 20 20 62 65 20 63 68 61 be cha
13580 6e 67 65 64 20 77 69 74 68 6f 75 74 20 63 61 72 nged without car
13590 65 66 75 6c 20 63 6f 6e 73 69 64 65 72 61 74 69 eful considerati
135a0 6f 6e 20 28 65 2e 67 2e 20 69 74 20 77 6f 75 6c on (e.g. it woul
135b0 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 d.. #
135c0 20 20 20 20 20 20 70 72 65 76 65 6e 74 20 74 68 prevent th
135d0 65 20 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 e SQLiteConnecti
135e0 6f 6e 20 63 6c 61 73 73 20 66 72 6f 6d 20 61 6c on class from al
135f0 6c 6f 77 69 6e 67 20 69 6e 76 61 6c 69 64 0d 0a lowing invalid..
13600 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
13610 20 20 20 5b 22 6d 61 67 69 63 61 6c 22 5d 20 6d ["magical"] m
13620 65 74 61 2d 66 6c 61 67 73 29 2e 0d 0a 20 20 20 eta-flags)...
13630 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
13640 72 65 74 75 72 6e 20 5b 61 70 70 65 6e 64 41 72 return [appendAr
13650 67 73 20 22 46 6c 61 67 73 3d 22 20 24 66 6c 61 gs "Flags=" $fla
13660 67 73 20 5c 3b 5d 0d 0a 20 20 20 20 20 20 7d 0d gs \;].. }.
13670 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 ... return
13680 22 22 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 "".. }.....
13690 20 20 70 72 6f 63 20 65 6e 61 62 6c 65 53 68 61 proc enableSha
136a0 72 65 64 43 61 63 68 65 20 7b 20 63 68 61 6e 6e redCache { chann
136b0 65 6c 20 65 6e 61 62 6c 65 20 7b 71 75 69 65 74 el enable {quiet
136c0 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 false} } {..
136d0 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
136e0 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 . object
136f0 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
13700 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
13710 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
13720 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 ata.SQLite.Unsaf
13730 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 20 5c eNativeMethods \
13740 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 71 .. sq
13750 6c 69 74 65 33 5f 65 6e 61 62 6c 65 5f 73 68 61 lite3_enable_sha
13760 72 65 64 5f 63 61 63 68 65 20 5b 65 78 70 72 20 red_cache [expr
13770 69 6e 74 28 24 65 6e 61 62 6c 65 29 5d 0d 0a 20 int($enable)]..
13780 20 20 20 20 20 7d 20 72 65 73 75 6c 74 5d 20 3d } result] =
13790 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
137a0 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
137b0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
137c0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
137d0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
137e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
137f0 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 74 "---- call sqlit
13800 65 33 5f 65 6e 61 62 6c 65 5f 73 68 61 72 65 64 e3_enable_shared
13810 5f 63 61 63 68 65 28 22 20 24 65 6e 61 62 6c 65 _cache(" $enable
13820 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
13830 20 20 22 29 2e 2e 2e 20 6f 6b 3a 20 22 20 24 72 ")... ok: " $r
13840 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 esult \n]..
13850 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c }.. } el
13860 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 se {.. if
13870 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
13880 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 {.. tpu
13890 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
138a0 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
138b0 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 "---- c
138c0 61 6c 6c 20 73 71 6c 69 74 65 33 5f 65 6e 61 62 all sqlite3_enab
138d0 6c 65 5f 73 68 61 72 65 64 5f 63 61 63 68 65 28 le_shared_cache(
138e0 22 20 24 65 6e 61 62 6c 65 20 5c 0d 0a 20 20 20 " $enable \..
138f0 20 20 20 20 20 20 20 20 20 20 20 22 29 2e 2e 2e ")...
13900 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 error: " \n\t $
13910 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 result \n]..
13920 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
13930 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
13940 6f 63 20 73 65 74 75 70 44 62 20 7b 0d 0a 20 20 oc setupDb {..
13950 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 4e 61 fileNa
13960 6d 65 20 7b 6d 6f 64 65 20 22 22 7d 20 7b 64 61 me {mode ""} {da
13970 74 65 54 69 6d 65 46 6f 72 6d 61 74 20 22 22 7d teTimeFormat ""}
13980 20 7b 64 61 74 65 54 69 6d 65 4b 69 6e 64 20 22 {dateTimeKind "
13990 22 7d 20 7b 66 6c 61 67 73 20 22 22 7d 0d 0a 20 "} {flags ""}..
139a0 20 20 20 20 20 20 20 20 20 20 20 7b 65 78 74 72 {extr
139b0 61 20 22 22 7d 20 7b 71 75 61 6c 69 66 79 20 74 a ""} {qualify t
139c0 72 75 65 7d 20 7b 64 65 6c 65 74 65 20 74 72 75 rue} {delete tru
139d0 65 7d 20 7b 75 72 69 20 66 61 6c 73 65 7d 0d 0a e} {uri false}..
139e0 20 20 20 20 20 20 20 20 20 20 20 20 7b 74 65 6d {tem
139f0 70 6f 72 61 72 79 20 74 72 75 65 7d 20 7b 76 61 porary true} {va
13a00 72 4e 61 6d 65 20 64 62 7d 20 7b 71 75 69 65 74 rName db} {quiet
13a10 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 false} } {..
13a20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
13a30 54 45 3a 20 46 69 72 73 74 2c 20 73 65 65 20 69 TE: First, see i
13a40 66 20 6f 75 72 20 63 61 6c 6c 65 72 20 68 61 73 f our caller has
13a50 20 72 65 71 75 65 73 74 65 64 20 61 6e 20 69 6e requested an in
13a60 2d 6d 65 6d 6f 72 79 20 64 61 74 61 62 61 73 65 -memory database
13a70 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
13a80 20 20 73 65 74 20 69 73 4d 65 6d 6f 72 79 20 5b set isMemory [
13a90 69 73 4d 65 6d 6f 72 79 44 62 20 24 66 69 6c 65 isMemoryDb $file
13aa0 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 Name].... #
13ab0 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
13ac0 46 6f 72 20 6e 6f 77 2c 20 61 6c 6c 20 74 65 73 For now, all tes
13ad0 74 20 64 61 74 61 62 61 73 65 73 20 75 73 65 64 t databases used
13ae0 20 62 79 20 74 68 65 20 74 65 73 74 20 73 75 69 by the test sui
13af0 74 65 20 61 72 65 20 70 6c 61 63 65 64 0d 0a 20 te are placed..
13b00 20 20 20 20 20 23 20 20 20 20 20 20 20 69 6e 74 # int
13b10 6f 20 74 68 65 20 64 61 74 61 62 61 73 65 20 64 o the database d
13b20 69 72 65 63 74 6f 72 79 2e 20 20 45 61 63 68 20 irectory. Each
13b30 64 61 74 61 62 61 73 65 20 61 6e 64 20 72 65 6c database and rel
13b40 61 74 65 64 20 66 69 6c 65 73 0d 0a 20 20 20 20 ated files..
13b50 20 20 23 20 20 20 20 20 20 20 75 73 65 64 20 62 # used b
13b60 79 20 61 20 74 65 73 74 20 73 68 6f 75 6c 64 20 y a test should
13b70 62 65 20 63 6c 65 61 6e 65 64 20 75 70 20 62 79 be cleaned up by
13b80 20 74 68 61 74 20 74 65 73 74 20 75 73 69 6e 67 that test using
13b90 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 the.. #
13ba0 20 20 20 20 22 63 6c 65 61 6e 75 70 44 62 22 20 "cleanupDb"
13bb0 70 72 6f 63 65 64 75 72 65 2c 20 62 65 6c 6f 77 procedure, below
13bc0 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
13bd0 20 20 69 66 20 7b 21 24 69 73 4d 65 6d 6f 72 79 if {!$isMemory
13be0 20 26 26 20 24 71 75 61 6c 69 66 79 7d 20 74 68 && $qualify} th
13bf0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 en {.. se
13c00 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 t fileName [file
13c10 20 6a 6f 69 6e 20 5b 67 65 74 44 61 74 61 62 61 join [getDataba
13c20 73 65 44 69 72 65 63 74 6f 72 79 5d 20 5b 66 69 seDirectory] [fi
13c30 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d le tail $fileNam
13c40 65 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a e]].. }....
13c50 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
13c60 20 4e 4f 54 45 3a 20 42 79 20 64 65 66 61 75 6c NOTE: By defaul
13c70 74 2c 20 64 65 6c 65 74 65 20 61 6e 79 20 70 72 t, delete any pr
13c80 65 2d 65 78 69 73 74 69 6e 67 20 64 61 74 61 62 e-existing datab
13c90 61 73 65 20 77 69 74 68 20 74 68 65 20 73 61 6d ase with the sam
13ca0 65 20 66 69 6c 65 0d 0a 20 20 20 20 20 20 23 20 e file.. #
13cb0 20 20 20 20 20 20 6e 61 6d 65 20 69 66 20 69 74 name if it
13cc0 20 63 75 72 72 65 6e 74 6c 79 20 65 78 69 73 74 currently exist
13cd0 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 s... #..
13ce0 20 20 20 69 66 20 7b 21 24 69 73 4d 65 6d 6f 72 if {!$isMemor
13cf0 79 20 26 26 20 24 64 65 6c 65 74 65 20 26 26 20 y && $delete &&
13d00 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 [file exists $fi
13d10 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d leName]} then {.
13d20 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
13d30 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 # NOTE: Atte
13d40 6d 70 74 20 74 6f 20 64 65 6c 65 74 65 20 61 6e mpt to delete an
13d50 79 20 70 72 65 2d 65 78 69 73 74 69 6e 67 20 64 y pre-existing d
13d60 61 74 61 62 61 73 65 20 77 69 74 68 20 74 68 65 atabase with the
13d70 20 73 61 6d 65 20 66 69 6c 65 0d 0a 20 20 20 20 same file..
13d80 20 20 20 20 23 20 20 20 20 20 20 20 6e 61 6d 65 # name
13d90 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
13da0 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
13db0 20 7b 66 69 6c 65 20 64 65 6c 65 74 65 20 24 66 {file delete $f
13dc0 69 6c 65 4e 61 6d 65 7d 20 65 72 72 6f 72 5d 7d ileName} error]}
13dd0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
13de0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
13df0 23 20 4e 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 # NOTE: We someh
13e00 6f 77 20 66 61 69 6c 65 64 20 74 6f 20 64 65 6c ow failed to del
13e10 65 74 65 20 74 68 65 20 66 69 6c 65 2c 20 72 65 ete the file, re
13e20 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 port why...
13e30 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
13e40 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
13e50 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
13e60 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
13e70 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
13e80 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
13e90 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 "==== WA
13ea0 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f RNING: failed to
13eb0 20 64 65 6c 65 74 65 20 64 61 74 61 62 61 73 65 delete database
13ec0 20 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e file \"" $fileN
13ed0 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ame \..
13ee0 20 20 20 20 20 20 20 22 5c 22 20 64 75 72 69 6e "\" durin
13ef0 67 20 73 65 74 75 70 2c 20 65 72 72 6f 72 3a 20 g setup, error:
13f00 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e " \n\t $error \n
13f10 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
13f20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
13f30 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
13f40 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 # NOTE: Ref
13f50 65 72 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 er to the specif
13f60 69 65 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e ied variable (e.
13f70 67 2e 20 22 64 62 22 29 20 69 6e 20 74 68 65 20 g. "db") in the
13f80 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a context of our..
13f90 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 61 # ca
13fa0 6c 6c 65 72 2e 20 20 54 68 65 20 68 61 6e 64 6c ller. The handl
13fb0 65 20 74 6f 20 74 68 65 20 6f 70 65 6e 65 64 20 e to the opened
13fc0 64 61 74 61 62 61 73 65 20 77 69 6c 6c 20 62 65 database will be
13fd0 20 73 74 6f 72 65 64 20 74 68 65 72 65 2e 0d 0a stored there...
13fe0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 75 #.. u
13ff0 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 pvar 1 $varName
14000 64 62 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 db.... #..
14010 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 74 61 # NOTE: Sta
14020 72 74 20 62 75 69 6c 64 69 6e 67 20 74 68 65 20 rt building the
14030 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e connection strin
14040 67 2e 20 20 54 68 65 20 6f 6e 6c 79 20 72 65 71 g. The only req
14050 75 69 72 65 64 20 70 6f 72 74 69 6f 6e 0d 0a 20 uired portion..
14060 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 66 20 # of
14070 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 the connection s
14080 74 72 69 6e 67 20 69 73 20 74 68 65 20 64 61 74 tring is the dat
14090 61 20 73 6f 75 72 63 65 2c 20 77 68 69 63 68 20 a source, which
140a0 63 6f 6e 74 61 69 6e 73 20 74 68 65 0d 0a 20 20 contains the..
140b0 20 20 20 20 23 20 20 20 20 20 20 20 64 61 74 61 # data
140c0 62 61 73 65 20 66 69 6c 65 20 6e 61 6d 65 20 69 base file name i
140d0 74 73 65 6c 66 2e 20 20 49 66 20 6f 75 72 20 63 tself. If our c
140e0 61 6c 6c 65 72 20 77 61 6e 74 73 20 74 6f 20 75 aller wants to u
140f0 73 65 20 61 20 55 52 49 20 61 73 0d 0a 20 20 20 se a URI as..
14100 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 64 # the d
14110 61 74 61 20 73 6f 75 72 63 65 2c 20 75 73 65 20 ata source, use
14120 74 68 65 20 46 75 6c 6c 55 72 69 20 63 6f 6e 6e the FullUri conn
14130 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 20 70 72 ection string pr
14140 6f 70 65 72 74 79 20 74 6f 0d 0a 20 20 20 20 20 operty to..
14150 20 23 20 20 20 20 20 20 20 70 72 65 76 65 6e 74 # prevent
14160 20 74 68 65 20 64 61 74 61 20 73 6f 75 72 63 65 the data source
14170 20 73 74 72 69 6e 67 20 66 72 6f 6d 20 62 65 69 string from bei
14180 6e 67 20 6d 61 6e 67 6c 65 64 2e 0d 0a 20 20 20 ng mangled...
14190 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
141a0 24 75 72 69 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 $uri} then {..
141b0 20 20 20 20 20 20 73 65 74 20 63 6f 6e 6e 65 63 set connec
141c0 74 69 6f 6e 20 7b 46 75 6c 6c 55 72 69 3d 24 7b tion {FullUri=${
141d0 66 69 6c 65 4e 61 6d 65 7d 7d 0d 0a 20 20 20 20 fileName}}..
141e0 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
141f0 20 20 20 20 73 65 74 20 63 6f 6e 6e 65 63 74 69 set connecti
14200 6f 6e 20 7b 44 61 74 61 20 53 6f 75 72 63 65 3d on {Data Source=
14210 24 7b 66 69 6c 65 4e 61 6d 65 7d 7d 0d 0a 20 20 ${fileName}}..
14220 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 }.... #
14230 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
14240 53 69 6e 63 65 20 74 68 69 73 20 70 72 6f 63 65 Since this proce
14250 64 75 72 65 20 68 61 73 20 6e 6f 20 73 70 65 63 dure has no spec
14260 69 61 6c 20 6b 6e 6f 77 6c 65 64 67 65 20 6f 66 ial knowledge of
14270 20 77 68 61 74 20 74 68 65 20 64 65 66 61 75 6c what the defaul
14280 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 t.. #
14290 20 73 65 74 74 69 6e 67 20 69 73 20 66 6f 72 20 setting is for
142a0 74 68 65 20 54 6f 46 75 6c 6c 50 61 74 68 20 63 the ToFullPath c
142b0 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 onnection string
142c0 20 70 72 6f 70 65 72 79 2c 20 61 6c 77 61 79 73 propery, always
142d0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
142e0 61 64 64 20 74 68 65 20 76 61 6c 75 65 20 77 65 add the value we
142f0 20 6b 6e 6f 77 20 61 62 6f 75 74 20 74 6f 20 74 know about to t
14300 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 he connection st
14310 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 23 0d 0a ring... #..
14320 20 20 20 20 20 20 61 70 70 65 6e 64 20 63 6f 6e append con
14330 6e 65 63 74 69 6f 6e 20 7b 3b 54 6f 46 75 6c 6c nection {;ToFull
14340 50 61 74 68 3d 24 7b 71 75 61 6c 69 66 79 7d 7d Path=${qualify}}
14350 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
14360 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 6f 75 # NOTE: If ou
14370 72 20 63 61 6c 6c 65 72 20 73 70 65 63 69 66 69 r caller specifi
14380 65 64 20 61 20 6a 6f 75 72 6e 61 6c 20 6d 6f 64 ed a journal mod
14390 65 2c 20 61 64 64 20 74 68 65 20 6e 65 63 65 73 e, add the neces
143a0 73 61 72 79 20 70 6f 72 74 69 6f 6e 0d 0a 20 20 sary portion..
143b0 20 20 20 20 23 20 20 20 20 20 20 20 6f 66 20 74 # of t
143c0 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 he connection st
143d0 72 69 6e 67 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 ring now...
143e0 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 #.. if {[s
143f0 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6d 6f tring length $mo
14400 64 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d de] > 0} then {.
14410 0a 20 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 . append
14420 63 6f 6e 6e 65 63 74 69 6f 6e 20 7b 3b 4a 6f 75 connection {;Jou
14430 72 6e 61 6c 20 4d 6f 64 65 3d 24 7b 6d 6f 64 65 rnal Mode=${mode
14440 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }}.. }....
14450 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
14460 4e 4f 54 45 3a 20 49 66 20 6f 75 72 20 63 61 6c NOTE: If our cal
14470 6c 65 72 20 73 70 65 63 69 66 69 65 64 20 61 20 ler specified a
14480 44 61 74 65 54 69 6d 65 20 66 6f 72 6d 61 74 2c DateTime format,
14490 20 61 64 64 20 74 68 65 20 6e 65 63 65 73 73 61 add the necessa
144a0 72 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ry.. #
144b0 20 20 70 6f 72 74 69 6f 6e 20 6f 66 20 74 68 65 portion of the
144c0 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 connection stri
144d0 6e 67 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 23 ng now... #
144e0 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
144f0 69 6e 67 20 6c 65 6e 67 74 68 20 24 64 61 74 65 ing length $date
14500 54 69 6d 65 46 6f 72 6d 61 74 5d 20 3e 20 30 7d TimeFormat] > 0}
14510 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
14520 20 61 70 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 append connecti
14530 6f 6e 20 7b 3b 44 61 74 65 54 69 6d 65 46 6f 72 on {;DateTimeFor
14540 6d 61 74 3d 24 7b 64 61 74 65 54 69 6d 65 46 6f mat=${dateTimeFo
14550 72 6d 61 74 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d rmat}}.. }.
14560 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
14570 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 6f 75 72 # NOTE: If our
14580 20 63 61 6c 6c 65 72 20 73 70 65 63 69 66 69 65 caller specifie
14590 64 20 61 20 44 61 74 65 54 69 6d 65 4b 69 6e 64 d a DateTimeKind
145a0 2c 20 61 64 64 20 74 68 65 20 6e 65 63 65 73 73 , add the necess
145b0 61 72 79 20 70 6f 72 74 69 6f 6e 0d 0a 20 20 20 ary portion..
145c0 20 20 20 23 20 20 20 20 20 20 20 6f 66 20 74 68 # of th
145d0 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 e connection str
145e0 69 6e 67 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 ing now...
145f0 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 #.. if {[st
14600 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 64 61 74 ring length $dat
14610 65 54 69 6d 65 4b 69 6e 64 5d 20 3e 20 30 7d 20 eTimeKind] > 0}
14620 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
14630 61 70 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 6f append connectio
14640 6e 20 7b 3b 44 61 74 65 54 69 6d 65 4b 69 6e 64 n {;DateTimeKind
14650 3d 24 7b 64 61 74 65 54 69 6d 65 4b 69 6e 64 7d =${dateTimeKind}
14660 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
14670 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
14680 4f 54 45 3a 20 46 69 67 75 72 65 20 6f 75 74 20 OTE: Figure out
14690 77 68 61 74 20 74 68 65 20 66 69 6e 61 6c 20 66 what the final f
146a0 6c 61 67 73 20 66 6f 72 20 74 68 69 73 20 63 6f lags for this co
146b0 6e 6e 65 63 74 69 6f 6e 20 6e 65 65 64 20 74 6f nnection need to
146c0 20 62 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 be... #..
146d0 20 20 20 20 20 73 65 74 20 66 6c 61 67 73 20 5b set flags [
146e0 67 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 46 6c 61 getConnectionFla
146f0 67 73 20 24 66 69 6c 65 4e 61 6d 65 20 24 66 6c gs $fileName $fl
14700 61 67 73 20 24 71 75 69 65 74 5d 0d 0a 0d 0a 20 ags $quiet]....
14710 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
14720 4e 4f 54 45 3a 20 49 66 20 6f 75 72 20 63 61 6c NOTE: If our cal
14730 6c 65 72 20 73 70 65 63 69 66 69 65 64 20 73 6f ler specified so
14740 6d 65 20 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 me SQLiteConnect
14750 69 6f 6e 46 6c 61 67 73 2c 20 61 64 64 20 74 68 ionFlags, add th
14760 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
14770 20 6e 65 63 65 73 73 61 72 79 20 70 6f 72 74 69 necessary porti
14780 6f 6e 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63 on of the connec
14790 74 69 6f 6e 20 73 74 72 69 6e 67 20 6e 6f 77 2e tion string now.
147a0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
147b0 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
147c0 67 74 68 20 24 66 6c 61 67 73 5d 20 3e 20 30 7d gth $flags] > 0}
147d0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
147e0 20 61 70 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 append connecti
147f0 6f 6e 20 7b 3b 46 6c 61 67 73 3d 24 7b 66 6c 61 on {;Flags=${fla
14800 67 73 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d gs}}.. }...
14810 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
14820 23 20 4e 4f 54 45 3a 20 49 66 20 6f 75 72 20 63 # NOTE: If our c
14830 61 6c 6c 65 72 20 73 70 65 63 69 66 69 65 64 20 aller specified
14840 61 6e 20 65 78 74 72 61 20 70 61 79 6c 6f 61 64 an extra payload
14850 20 74 6f 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 to the connecti
14860 6f 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 on.. #
14870 20 20 73 74 72 69 6e 67 2c 20 61 70 70 65 6e 64 string, append
14880 20 69 74 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 it now...
14890 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 #.. if {[st
148a0 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 65 78 74 ring length $ext
148b0 72 61 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d ra] > 0} then {.
148c0 0a 20 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 . append
148d0 63 6f 6e 6e 65 63 74 69 6f 6e 20 5c 3b 20 24 65 connection \; $e
148e0 78 74 72 61 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d xtra.. }...
148f0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
14900 23 20 4e 4f 54 45 3a 20 4f 70 65 6e 20 74 68 65 # NOTE: Open the
14910 20 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 database connec
14920 74 69 6f 6e 20 6e 6f 77 2c 20 70 6c 61 63 69 6e tion now, placin
14930 67 20 74 68 65 20 6f 70 61 71 75 65 20 68 61 6e g the opaque han
14940 64 6c 65 20 76 61 6c 75 65 0d 0a 20 20 20 20 20 dle value..
14950 20 23 20 20 20 20 20 20 20 69 6e 74 6f 20 74 68 # into th
14960 65 20 76 61 72 69 61 62 6c 65 20 73 70 65 63 69 e variable speci
14970 66 69 65 64 20 62 79 20 6f 75 72 20 63 61 6c 6c fied by our call
14980 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 er... #..
14990 20 20 20 20 73 65 74 20 64 62 20 5b 73 71 6c 20 set db [sql
149a0 6f 70 65 6e 20 2d 74 79 70 65 20 53 51 4c 69 74 open -type SQLit
149b0 65 20 5b 73 75 62 73 74 20 24 63 6f 6e 6e 65 63 e [subst $connec
149c0 74 69 6f 6e 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 tion]]....
149d0 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
149e0 20 43 6f 6e 66 69 67 75 72 65 20 74 68 65 20 74 Configure the t
149f0 65 6d 70 6f 72 61 72 79 20 64 69 72 65 63 74 6f emporary directo
14a00 72 79 20 66 6f 72 20 74 68 65 20 6e 65 77 6c 79 ry for the newly
14a10 20 6f 70 65 6e 65 64 20 64 61 74 61 62 61 73 65 opened database
14a20 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
14a30 63 6f 6e 6e 65 63 74 69 6f 6e 20 6e 6f 77 20 75 connection now u
14a40 6e 6c 65 73 73 20 6f 75 72 20 63 61 6c 6c 65 72 nless our caller
14a50 20 66 6f 72 62 69 64 73 20 69 74 2e 0d 0a 20 20 forbids it...
14a60 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
14a70 7b 24 74 65 6d 70 6f 72 61 72 79 20 26 26 20 21 {$temporary && !
14a80 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
14a90 6f 28 73 65 74 54 65 6d 70 6f 72 61 72 79 44 69 o(setTemporaryDi
14aa0 72 65 63 74 6f 72 79 29 5d 7d 20 74 68 65 6e 20 rectory)]} then
14ab0 7b 0d 0a 20 20 20 20 20 20 20 20 73 71 6c 20 65 {.. sql e
14ac0 78 65 63 75 74 65 20 24 64 62 20 5b 61 70 70 65 xecute $db [appe
14ad0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
14ae0 20 20 20 20 20 20 22 50 52 41 47 4d 41 20 74 65 "PRAGMA te
14af0 6d 70 5f 73 74 6f 72 65 5f 64 69 72 65 63 74 6f mp_store_directo
14b00 72 79 20 3d 20 5c 22 22 20 5b 67 65 74 54 65 6d ry = \"" [getTem
14b10 70 6f 72 61 72 79 44 69 72 65 63 74 6f 72 79 5d poraryDirectory]
14b20 20 5c 22 5c 3b 5d 0d 0a 20 20 20 20 20 20 7d 0d \"\;].. }.
14b30 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
14b40 20 20 23 20 4e 4f 54 45 3a 20 50 65 72 66 6f 72 # NOTE: Perfor
14b50 6d 20 61 6e 79 20 65 78 74 72 61 20 70 65 72 2d m any extra per-
14b60 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 65 74 75 70 connection setup
14b70 20 66 6f 72 20 74 68 65 20 6e 65 77 6c 79 20 6f for the newly o
14b80 70 65 6e 65 64 0d 0a 20 20 20 20 20 20 23 20 20 pened.. #
14b90 20 20 20 20 20 64 61 74 61 62 61 73 65 20 6e 6f database no
14ba0 77 20 75 6e 6c 65 73 73 20 6f 75 72 20 63 61 6c w unless our cal
14bb0 6c 65 72 20 66 6f 72 62 69 64 73 20 69 74 2e 0d ler forbids it..
14bc0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
14bd0 73 65 74 20 65 78 65 63 75 74 65 4f 6e 53 65 74 set executeOnSet
14be0 75 70 20 5b 67 65 74 45 78 65 63 75 74 65 4f 6e up [getExecuteOn
14bf0 53 65 74 75 70 5d 0d 0a 0d 0a 20 20 20 20 20 20 Setup]....
14c00 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
14c10 74 68 20 24 65 78 65 63 75 74 65 4f 6e 53 65 74 th $executeOnSet
14c20 75 70 5d 20 3e 20 30 20 26 26 20 5c 0d 0a 20 20 up] > 0 && \..
14c30 20 20 20 20 20 20 20 20 21 5b 69 6e 66 6f 20 65 ![info e
14c40 78 69 73 74 73 20 3a 3a 6e 6f 28 65 78 65 63 75 xists ::no(execu
14c50 74 65 4f 6e 53 65 74 75 70 29 5d 7d 20 74 68 65 teOnSetup)]} the
14c60 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
14c70 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
14c80 54 68 69 73 20 63 6f 6d 6d 61 6e 64 20 6d 61 79 This command may
14c90 20 72 61 69 73 65 20 61 6e 20 65 72 72 6f 72 3b raise an error;
14ca0 20 69 66 20 73 6f 2c 20 74 68 61 74 20 69 73 20 if so, that is
14cb0 66 69 6e 65 2c 20 61 73 0d 0a 20 20 20 20 20 20 fine, as..
14cc0 20 20 23 20 20 20 20 20 20 20 74 68 65 20 65 6e # the en
14cd0 63 6c 6f 73 69 6e 67 20 74 65 73 74 20 77 69 6c closing test wil
14ce0 6c 20 74 68 65 6e 20 66 61 69 6c 2e 20 20 54 68 l then fail. Th
14cf0 65 20 5b 73 75 62 73 74 5d 20 63 6f 6d 6d 61 6e e [subst] comman
14d00 64 20 69 73 0d 0a 20 20 20 20 20 20 20 20 23 20 d is.. #
14d10 20 20 20 20 20 20 75 73 65 64 20 6f 6e 20 74 68 used on th
14d20 65 20 53 51 4c 20 69 6e 20 63 61 73 65 20 69 74 e SQL in case it
14d30 20 6e 65 65 64 73 20 74 6f 20 72 65 66 65 72 20 needs to refer
14d40 74 6f 20 73 74 61 74 65 20 69 6e 20 6f 75 72 0d to state in our.
14d50 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
14d60 20 63 6f 6e 74 65 78 74 2e 0d 0a 20 20 20 20 20 context...
14d70 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 71 #.. sq
14d80 6c 20 65 78 65 63 75 74 65 20 24 64 62 20 5b 73 l execute $db [s
14d90 75 62 73 74 20 24 65 78 65 63 75 74 65 4f 6e 53 ubst $executeOnS
14da0 65 74 75 70 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a etup].. }..
14db0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
14dc0 20 23 20 4e 4f 54 45 3a 20 41 6c 77 61 79 73 20 # NOTE: Always
14dd0 72 65 74 75 72 6e 20 74 68 65 20 63 6f 6e 6e 65 return the conne
14de0 63 74 69 6f 6e 20 68 61 6e 64 6c 65 20 75 70 6f ction handle upo
14df0 6e 20 73 75 63 63 65 73 73 2e 0d 0a 20 20 20 20 n success...
14e00 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 72 #.. retur
14e10 6e 20 24 64 62 0d 0a 20 20 20 20 7d 0d 0a 0c 0d n $db.. }....
14e20 0a 20 20 20 20 70 72 6f 63 20 67 65 74 44 62 43 . proc getDbC
14e30 6f 6e 6e 65 63 74 69 6f 6e 20 7b 20 7b 76 61 72 onnection { {var
14e40 4e 61 6d 65 20 64 62 7d 20 7d 20 7b 0d 0a 20 20 Name db} } {..
14e50 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
14e60 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 74 68 OTE: Refer to th
14e70 65 20 73 70 65 63 69 66 69 65 64 20 76 61 72 69 e specified vari
14e80 61 62 6c 65 20 28 65 2e 67 2e 20 22 64 62 22 29 able (e.g. "db")
14e90 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 20 in the context
14ea0 6f 66 20 6f 75 72 0d 0a 20 20 20 20 20 20 23 20 of our.. #
14eb0 20 20 20 20 20 20 63 61 6c 6c 65 72 2e 20 20 54 caller. T
14ec0 68 65 20 68 61 6e 64 6c 65 20 74 6f 20 74 68 65 he handle to the
14ed0 20 64 61 74 61 62 61 73 65 20 70 72 65 76 69 6f database previo
14ee0 75 73 6c 79 20 6f 70 65 6e 65 64 20 76 69 61 20 usly opened via
14ef0 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 the.. #
14f00 20 20 20 5b 73 65 74 75 70 44 62 5d 20 70 72 6f [setupDb] pro
14f10 63 65 64 75 72 65 20 73 68 6f 75 6c 64 20 62 65 cedure should be
14f20 20 73 74 6f 72 65 64 20 74 68 65 72 65 2e 0d 0a stored there...
14f30 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 75 #.. u
14f40 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 pvar 1 $varName
14f50 64 62 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 db.... #..
14f60 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 # NOTE: Thi
14f70 73 20 72 65 74 75 72 6e 73 20 74 68 65 20 41 44 s returns the AD
14f80 4f 2e 4e 45 54 20 49 44 62 43 6f 6e 6e 65 63 74 O.NET IDbConnect
14f90 69 6f 6e 20 6f 62 6a 65 63 74 20 69 6e 73 74 61 ion object insta
14fa0 6e 63 65 20 66 6f 72 20 74 68 65 0d 0a 20 20 20 nce for the..
14fb0 20 20 20 23 20 20 20 20 20 20 20 73 70 65 63 69 # speci
14fc0 66 69 65 64 20 64 61 74 61 62 73 65 20 68 61 6e fied databse han
14fd0 64 6c 65 2e 20 20 53 69 6e 63 65 20 67 65 74 74 dle. Since gett
14fe0 69 6e 67 20 74 68 69 73 20 6f 62 6a 65 63 74 20 ing this object
14ff0 72 65 6c 69 65 73 20 75 70 6f 6e 0d 0a 20 20 20 relies upon..
15000 20 20 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 # Eagle
15010 20 69 6e 74 65 72 6e 61 6c 73 2c 20 67 72 65 61 internals, grea
15020 74 20 63 61 72 65 20 73 68 6f 75 6c 64 20 62 65 t care should be
15030 20 74 61 6b 65 6e 20 74 6f 20 61 76 6f 69 64 20 taken to avoid
15040 64 69 73 70 6f 73 69 6e 67 20 6f 66 0d 0a 20 20 disposing of..
15050 20 20 20 20 23 20 20 20 20 20 20 20 74 68 69 73 # this
15060 20 6f 62 6a 65 63 74 20 6f 72 20 6f 74 68 65 72 object or other
15070 77 69 73 65 20 70 75 74 74 69 6e 67 20 69 74 20 wise putting it
15080 69 6e 74 6f 20 61 6e 20 69 6e 76 61 6c 69 64 20 into an invalid
15090 73 74 61 74 65 2e 0d 0a 20 20 20 20 20 20 23 0d state... #.
150a0 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f . if {[info
150b0 20 65 78 69 73 74 73 20 64 62 5d 7d 20 74 68 65 exists db]} the
150c0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
150d0 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
150e0 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
150f0 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
15100 62 6c 69 63 20 2d 6f 62 6a 65 63 74 66 6c 61 67 blic -objectflag
15110 73 20 2b 4e 6f 44 69 73 70 6f 73 65 20 2d 61 6c s +NoDispose -al
15120 69 61 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ias \..
15130 20 20 20 20 20 49 6e 74 65 72 70 72 65 74 65 72 Interpreter
15140 2e 47 65 74 41 63 74 69 76 65 2e 63 6f 6e 6e 65 .GetActive.conne
15150 63 74 69 6f 6e 73 20 49 74 65 6d 20 24 64 62 0d ctions Item $db.
15160 0a 20 20 20 20 20 20 20 20 7d 20 72 65 73 75 6c . } resul
15170 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d t] == 0} then {.
15180 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
15190 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
151a0 53 75 63 63 65 73 73 2c 20 72 65 74 75 72 6e 20 Success, return
151b0 74 68 65 20 6f 70 61 71 75 65 20 6f 62 6a 65 63 the opaque objec
151c0 74 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 t handle...
151d0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
151e0 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 6c 74 return $result
151f0 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
15200 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d {.. #.
15210 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 . # NOT
15220 45 3a 20 46 61 69 6c 75 72 65 2c 20 72 65 70 6f E: Failure, repo
15230 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 rt why...
15240 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
15250 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
15260 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
15270 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
15280 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 "==== WARNING
15290 3a 20 66 61 69 6c 65 64 20 74 6f 20 67 65 74 20 : failed to get
152a0 63 6f 6e 6e 65 63 74 69 6f 6e 20 68 61 6e 64 6c connection handl
152b0 65 20 66 6f 72 20 64 61 74 61 62 61 73 65 20 5c e for database \
152c0 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 "" \..
152d0 20 20 20 20 24 64 62 20 22 5c 22 2c 20 65 72 72 $db "\", err
152e0 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 72 65 73 75 or: " \n\t $resu
152f0 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 lt \n]..
15300 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
15310 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
15320 4f 54 45 3a 20 46 61 69 6c 75 72 65 2c 20 72 65 OTE: Failure, re
15330 74 75 72 6e 20 61 6e 20 6f 62 76 69 6f 75 73 6c turn an obviousl
15340 79 20 69 6e 76 61 6c 69 64 20 6f 70 61 71 75 65 y invalid opaque
15350 20 6f 62 6a 65 63 74 20 68 61 6e 64 6c 65 2e 0d object handle..
15360 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
15370 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 7d return "".. }
15380 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 66 72 ..... proc fr
15390 65 65 44 62 43 6f 6e 6e 65 63 74 69 6f 6e 20 7b eeDbConnection {
153a0 20 7b 76 61 72 4e 61 6d 65 20 63 6f 6e 6e 65 63 {varName connec
153b0 74 69 6f 6e 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 tion} } {..
153c0 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
153d0 3a 20 52 65 66 65 72 20 74 6f 20 74 68 65 20 73 : Refer to the s
153e0 70 65 63 69 66 69 65 64 20 76 61 72 69 61 62 6c pecified variabl
153f0 65 20 28 65 2e 67 2e 20 22 63 6f 6e 6e 65 63 74 e (e.g. "connect
15400 69 6f 6e 22 29 20 69 6e 20 74 68 65 0d 0a 20 20 ion") in the..
15410 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 74 # cont
15420 65 78 74 20 6f 66 20 6f 75 72 20 63 61 6c 6c 65 ext of our calle
15430 72 2e 20 20 54 68 65 20 6f 70 61 71 75 65 20 6f r. The opaque o
15440 62 6a 65 63 74 20 68 61 6e 64 6c 65 20 66 6f 72 bject handle for
15450 20 61 6e 20 41 44 4f 2e 4e 45 54 0d 0a 20 20 20 an ADO.NET..
15460 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 6e 65 # conne
15470 63 74 69 6f 6e 20 70 72 65 76 69 6f 75 73 6c 79 ction previously
15480 20 72 65 74 75 72 6e 65 64 20 62 79 20 5b 67 65 returned by [ge
15490 74 44 62 43 6f 6e 6e 65 63 74 69 6f 6e 5d 20 73 tDbConnection] s
154a0 68 6f 75 6c 64 20 62 65 0d 0a 20 20 20 20 20 20 hould be..
154b0 23 20 20 20 20 20 20 20 73 74 6f 72 65 64 20 74 # stored t
154c0 68 65 72 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a here... #..
154d0 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 76 upvar 1 $v
154e0 61 72 4e 61 6d 65 20 63 6f 6e 6e 65 63 74 69 6f arName connectio
154f0 6e 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 n.... #..
15500 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 # NOTE: Atte
15510 6d 70 74 20 74 6f 20 72 65 6d 6f 76 65 20 74 68 mpt to remove th
15520 65 20 6f 70 61 71 75 65 20 6f 62 6a 65 63 74 20 e opaque object
15530 68 61 6e 64 6c 65 20 66 72 6f 6d 20 74 68 65 20 handle from the
15540 69 6e 74 65 72 70 72 65 74 65 72 0d 0a 20 20 20 interpreter..
15550 20 20 20 23 20 20 20 20 20 20 20 6e 6f 77 2e 20 # now.
15560 20 54 68 69 73 20 5b 6f 62 6a 65 63 74 20 64 69 This [object di
15570 73 70 6f 73 65 5d 20 63 61 6c 6c 20 77 69 6c 6c spose] call will
15580 20 6e 6f 74 20 61 63 74 75 61 6c 6c 79 20 64 69 not actually di
15590 73 70 6f 73 65 20 6f 66 20 74 68 65 0d 0a 20 20 spose of the..
155a0 20 20 20 20 23 20 20 20 20 20 20 20 75 6e 64 65 # unde
155b0 72 6c 79 69 6e 67 20 6f 62 6a 65 63 74 20 62 65 rlying object be
155c0 63 61 75 73 65 20 74 68 65 20 2b 4e 6f 44 69 73 cause the +NoDis
155d0 70 6f 73 65 20 66 6c 61 67 20 77 61 73 20 73 65 pose flag was se
155e0 74 20 6f 6e 20 69 74 0d 0a 20 20 20 20 20 20 23 t on it.. #
155f0 20 20 20 20 20 20 20 64 75 72 69 6e 67 20 63 72 during cr
15600 65 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 6f 70 eation of the op
15610 61 71 75 65 20 6f 62 6a 65 63 74 20 68 61 6e 64 aque object hand
15620 6c 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 le... #..
15630 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
15640 69 73 74 73 20 63 6f 6e 6e 65 63 74 69 6f 6e 5d ists connection]
15650 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
15660 20 5b 63 61 74 63 68 20 7b 6f 62 6a 65 63 74 20 [catch {object
15670 64 69 73 70 6f 73 65 20 24 63 6f 6e 6e 65 63 74 dispose $connect
15680 69 6f 6e 7d 20 65 72 72 6f 72 5d 7d 20 74 68 65 ion} error]} the
15690 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
156a0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
156b0 57 65 20 73 6f 6d 65 68 6f 77 20 66 61 69 6c 65 We somehow faile
156c0 64 20 74 6f 20 72 65 6d 6f 76 65 20 74 68 65 20 d to remove the
156d0 68 61 6e 64 6c 65 2c 20 72 65 70 6f 72 74 20 77 handle, report w
156e0 68 79 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a hy... #..
156f0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
15700 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
15710 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
15720 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 "==== W
15730 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 ARNING: failed t
15740 6f 20 72 65 6d 6f 76 65 20 63 6f 6e 6e 65 63 74 o remove connect
15750 69 6f 6e 20 68 61 6e 64 6c 65 20 5c 22 22 20 24 ion handle \"" $
15760 63 6f 6e 6e 65 63 74 69 6f 6e 20 5c 0d 0a 20 20 connection \..
15770 20 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 65 "\", e
15780 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 rror: " \n\t $er
15790 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d ror \n].. }
157a0 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
157b0 70 72 6f 63 20 61 64 64 44 62 43 6f 6e 6e 65 63 proc addDbConnec
157c0 74 69 6f 6e 20 7b 20 63 6f 6e 6e 65 63 74 69 6f tion { connectio
157d0 6e 20 7b 76 61 72 4e 61 6d 65 20 64 62 7d 20 7d n {varName db} }
157e0 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
157f0 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 # NOTE: Refer
15800 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 to the specifie
15810 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e d variable (e.g.
15820 20 22 64 62 22 29 20 69 6e 20 74 68 65 20 63 6f "db") in the co
15830 6e 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a 20 20 ntext of our..
15840 20 20 20 20 23 20 20 20 20 20 20 20 63 61 6c 6c # call
15850 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 er... #..
15860 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 upvar 1 $var
15870 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 20 20 20 Name db....
15880 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
15890 3a 20 43 72 65 61 74 65 20 61 20 63 6f 72 72 65 : Create a corre
158a0 63 74 6c 79 20 66 6f 72 6d 61 74 74 65 64 20 6e ctly formatted n
158b0 61 6d 65 20 66 6f 72 20 74 68 65 20 64 61 74 61 ame for the data
158c0 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 base connection
158d0 74 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 to.. #
158e0 20 20 62 65 20 61 64 64 65 64 20 74 6f 20 74 68 be added to th
158f0 65 20 6c 69 73 74 20 6d 61 6e 61 67 65 64 20 62 e list managed b
15900 79 20 74 68 65 20 45 61 67 6c 65 20 69 6e 74 65 y the Eagle inte
15910 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 20 20 20 rpreter...
15920 23 0d 0a 20 20 20 20 20 20 73 65 74 20 64 62 20 #.. set db
15930 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d [object invoke -
15940 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
15950 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 45 61 \.. Ea
15960 67 6c 65 2e 5f 43 6f 6d 70 6f 6e 65 6e 74 73 2e gle._Components.
15970 50 72 69 76 61 74 65 2e 46 6f 72 6d 61 74 4f 70 Private.FormatOp
15980 73 20 44 61 74 61 62 61 73 65 4f 62 6a 65 63 74 s DatabaseObject
15990 4e 61 6d 65 20 24 63 6f 6e 6e 65 63 74 69 6f 6e Name $connection
159a0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 53 51 \.. SQ
159b0 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 20 5b LiteConnection [
159c0 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 49 6e object invoke In
159d0 74 65 72 70 72 65 74 65 72 2e 47 65 74 41 63 74 terpreter.GetAct
159e0 69 76 65 20 4e 65 78 74 49 64 5d 5d 0d 0a 0d 0a ive NextId]]....
159f0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
15a00 20 4e 4f 54 45 3a 20 41 64 64 20 74 68 65 20 64 NOTE: Add the d
15a10 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 atabase connecti
15a20 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 79 20 6f on provided by o
15a30 75 72 20 63 61 6c 6c 65 72 20 74 6f 20 74 68 65 ur caller to the
15a40 20 6c 69 73 74 0d 0a 20 20 20 20 20 20 23 20 20 list.. #
15a50 20 20 20 20 20 6f 66 20 74 68 6f 73 65 20 6b 6e of those kn
15a60 6f 77 6e 20 74 6f 20 74 68 65 20 45 61 67 6c 65 own to the Eagle
15a70 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 interpreter...
15a80 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 6f 62 #.. ob
15a90 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 ject invoke -fla
15aa0 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 49 6e gs +NonPublic In
15ab0 74 65 72 70 72 65 74 65 72 2e 47 65 74 41 63 74 terpreter.GetAct
15ac0 69 76 65 2e 63 6f 6e 6e 65 63 74 69 6f 6e 73 20 ive.connections
15ad0 41 64 64 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 Add \..
15ae0 20 24 64 62 20 24 63 6f 6e 6e 65 63 74 69 6f 6e $db $connection
15af0 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
15b00 70 72 6f 63 20 67 65 74 52 6f 77 73 46 72 6f 6d proc getRowsFrom
15b10 44 61 74 61 54 61 62 6c 65 20 7b 20 64 61 74 61 DataTable { data
15b20 54 61 62 6c 65 20 7d 20 7b 0d 0a 20 20 20 20 20 Table } {..
15b30 20 73 65 74 20 72 6f 77 73 20 5b 6c 69 73 74 5d set rows [list]
15b40 0d 0a 20 20 20 20 20 20 73 65 74 20 63 6f 75 6e .. set coun
15b50 74 20 5b 24 64 61 74 61 54 61 62 6c 65 20 43 6f t [$dataTable Co
15b60 6c 75 6d 6e 73 2e 43 6f 75 6e 74 5d 0d 0a 0d 0a lumns.Count]....
15b70 20 20 20 20 20 20 66 6f 72 20 7b 73 65 74 20 69 for {set i
15b80 6e 64 65 78 20 30 7d 20 7b 24 69 6e 64 65 78 20 ndex 0} {$index
15b90 3c 20 24 63 6f 75 6e 74 7d 20 7b 69 6e 63 72 20 < $count} {incr
15ba0 69 6e 64 65 78 7d 20 7b 0d 0a 20 20 20 20 20 20 index} {..
15bb0 20 20 73 65 74 20 64 61 74 61 43 6f 6c 75 6d 6e set dataColumn
15bc0 20 5b 24 64 61 74 61 54 61 62 6c 65 20 2d 61 6c [$dataTable -al
15bd0 69 61 73 20 43 6f 6c 75 6d 6e 73 2e 67 65 74 5f ias Columns.get_
15be0 49 74 65 6d 20 24 69 6e 64 65 78 5d 0d 0a 20 20 Item $index]..
15bf0 20 20 20 20 20 20 73 65 74 20 6e 61 6d 65 73 28 set names(
15c00 24 69 6e 64 65 78 29 20 5b 24 64 61 74 61 43 6f $index) [$dataCo
15c10 6c 75 6d 6e 20 43 6f 6c 75 6d 6e 4e 61 6d 65 5d lumn ColumnName]
15c20 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
15c30 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 61 63 object foreac
15c40 68 20 2d 61 6c 69 61 73 20 64 61 74 61 52 6f 77 h -alias dataRow
15c50 20 5b 73 65 74 20 64 61 74 61 52 6f 77 73 20 5b [set dataRows [
15c60 24 64 61 74 61 54 61 62 6c 65 20 52 6f 77 73 5d $dataTable Rows]
15c70 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 ] {.. set
15c80 20 72 6f 77 20 5b 6c 69 73 74 5d 0d 0a 0d 0a 20 row [list]....
15c90 20 20 20 20 20 20 20 66 6f 72 20 7b 73 65 74 20 for {set
15ca0 69 6e 64 65 78 20 30 7d 20 7b 24 69 6e 64 65 78 index 0} {$index
15cb0 20 3c 20 24 63 6f 75 6e 74 7d 20 7b 69 6e 63 72 < $count} {incr
15cc0 20 69 6e 64 65 78 7d 20 7b 0d 0a 20 20 20 20 20 index} {..
15cd0 20 20 20 20 20 73 65 74 20 76 61 6c 75 65 20 5b set value [
15ce0 24 64 61 74 61 52 6f 77 20 2d 63 72 65 61 74 65 $dataRow -create
15cf0 20 2d 61 6c 69 61 73 20 67 65 74 5f 49 74 65 6d -alias get_Item
15d00 20 24 69 6e 64 65 78 5d 0d 0a 0d 0a 20 20 20 20 $index]....
15d10 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
15d20 67 20 6c 65 6e 67 74 68 20 24 76 61 6c 75 65 5d g length $value]
15d30 20 3e 20 30 20 26 26 20 5c 0d 0a 20 20 20 20 20 > 0 && \..
15d40 20 20 20 20 20 20 20 20 20 21 5b 6f 62 6a 65 63 ![objec
15d50 74 20 69 6e 76 6f 6b 65 20 43 6f 6e 76 65 72 74 t invoke Convert
15d60 20 49 73 44 42 4e 75 6c 6c 20 24 76 61 6c 75 65 IsDBNull $value
15d70 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
15d80 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 72 lappend r
15d90 6f 77 20 5b 6c 69 73 74 20 24 6e 61 6d 65 73 28 ow [list $names(
15da0 24 69 6e 64 65 78 29 20 5b 24 76 61 6c 75 65 20 $index) [$value
15db0 54 6f 53 74 72 69 6e 67 5d 5d 0d 0a 20 20 20 20 ToString]]..
15dc0 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
15dd0 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 lapp
15de0 65 6e 64 20 72 6f 77 20 5b 6c 69 73 74 20 24 6e end row [list $n
15df0 61 6d 65 73 28 24 69 6e 64 65 78 29 5d 0d 0a 20 ames($index)]..
15e00 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
15e10 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
15e20 20 6c 61 70 70 65 6e 64 20 72 6f 77 73 20 24 72 lappend rows $r
15e30 6f 77 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 ow.. }....
15e40 20 20 20 20 20 72 65 74 75 72 6e 20 24 72 6f 77 return $row
15e50 73 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 s.. }.....
15e60 20 70 72 6f 63 20 64 75 6d 70 52 6f 77 73 46 72 proc dumpRowsFr
15e70 6f 6d 44 61 74 61 54 61 62 6c 65 20 7b 20 63 68 omDataTable { ch
15e80 61 6e 6e 65 6c 20 72 6f 77 73 20 7d 20 7b 0d 0a annel rows } {..
15e90 20 20 20 20 20 20 73 65 74 20 73 65 71 75 65 6e set sequen
15ea0 63 65 20 31 0d 0a 0d 0a 20 20 20 20 20 20 66 6f ce 1.... fo
15eb0 72 65 61 63 68 20 72 6f 77 20 24 72 6f 77 73 20 reach row $rows
15ec0 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
15ed0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
15ee0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
15ef0 20 20 20 20 20 5b 65 78 70 72 20 7b 24 73 65 71 [expr {$seq
15f00 75 65 6e 63 65 20 3e 20 31 20 3f 20 22 5c 6e 22 uence > 1 ? "\n"
15f10 20 3a 20 22 22 7d 5d 20 22 2d 2d 2d 2d 20 52 4f : ""}] "---- RO
15f20 57 20 23 22 20 24 73 65 71 75 65 6e 63 65 20 3a W #" $sequence :
15f30 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 66 \n].... f
15f40 6f 72 65 61 63 68 20 70 61 69 72 20 24 72 6f 77 oreach pair $row
15f50 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 {.. if
15f60 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 70 61 69 72 {[llength $pair
15f70 5d 20 3e 3d 20 32 7d 20 74 68 65 6e 20 7b 0d 0a ] >= 2} then {..
15f80 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
15f90 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
15fa0 6e 64 41 72 67 73 20 5c 74 20 5c 0d 0a 20 20 20 ndArgs \t \..
15fb0 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 6c 69 [li
15fc0 73 74 20 5b 6c 69 6e 64 65 78 20 24 70 61 69 72 st [lindex $pair
15fd0 20 30 5d 5d 20 22 3a 20 22 20 5b 6c 69 73 74 20 0]] ": " [list
15fe0 5b 6c 69 6e 64 65 78 20 24 70 61 69 72 20 31 5d [lindex $pair 1]
15ff0 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 ] \n]..
16000 20 7d 20 65 6c 73 65 69 66 20 7b 5b 6c 6c 65 6e } elseif {[llen
16010 67 74 68 20 24 70 61 69 72 5d 20 3d 3d 20 31 7d gth $pair] == 1}
16020 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
16030 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
16040 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
16050 5c 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 \t \..
16060 20 20 20 20 20 20 5b 6c 69 73 74 20 5b 6c 69 6e [list [lin
16070 64 65 78 20 24 70 61 69 72 20 30 5d 5d 20 22 3a dex $pair 0]] ":
16080 20 3c 6e 75 6c 6c 3e 5c 6e 22 5d 0d 0a 20 20 20 <null>\n"]..
16090 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
160a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
160b0 74 73 20 24 63 68 61 6e 6e 65 6c 20 5c 74 3c 65 ts $channel \t<e
160c0 6d 70 74 79 3e 5c 6e 3b 20 23 20 4e 4f 54 45 3a mpty>\n; # NOTE:
160d0 20 4e 6f 20 64 61 74 61 3f 0d 0a 20 20 20 20 20 No data?..
160e0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
160f0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 6e 63 }.... inc
16100 72 20 73 65 71 75 65 6e 63 65 0d 0a 20 20 20 20 r sequence..
16110 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
16120 20 20 20 70 72 6f 63 20 63 6c 65 61 6e 75 70 44 proc cleanupD
16130 62 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7b 76 61 b { fileName {va
16140 72 4e 61 6d 65 20 64 62 7d 20 7b 63 6f 6c 6c 65 rName db} {colle
16150 63 74 20 74 72 75 65 7d 20 7b 71 75 61 6c 69 66 ct true} {qualif
16160 79 20 74 72 75 65 7d 0d 0a 20 20 20 20 20 20 20 y true}..
16170 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 64 {d
16180 65 6c 65 74 65 20 74 72 75 65 7d 20 7d 20 7b 0d elete true} } {.
16190 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
161a0 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
161b0 74 6f 20 66 6f 72 63 65 20 61 6c 6c 20 70 65 6e to force all pen
161c0 64 69 6e 67 20 22 67 61 72 62 61 67 65 22 20 6f ding "garbage" o
161d0 62 6a 65 63 74 73 20 74 6f 20 62 65 20 63 6f 6c bjects to be col
161e0 6c 65 63 74 65 64 2c 0d 0a 20 20 20 20 20 20 23 lected,.. #
161f0 20 20 20 20 20 20 20 69 6e 63 6c 75 64 69 6e 67 including
16200 20 53 51 4c 69 74 65 20 73 74 61 74 65 6d 65 6e SQLite statemen
16210 74 73 20 61 6e 64 20 62 61 63 6b 75 70 20 6f 62 ts and backup ob
16220 6a 65 63 74 73 3b 20 74 68 69 73 20 73 68 6f 75 jects; this shou
16230 6c 64 20 61 6c 6c 6f 77 0d 0a 20 20 20 20 20 20 ld allow..
16240 23 20 20 20 20 20 20 20 74 68 65 20 75 6e 64 65 # the unde
16250 72 6c 79 69 6e 67 20 64 61 74 61 62 61 73 65 20 rlying database
16260 66 69 6c 65 20 74 6f 20 62 65 20 64 65 6c 65 74 file to be delet
16270 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ed... #..
16280 20 20 20 20 69 66 20 7b 24 63 6f 6c 6c 65 63 74 if {$collect
16290 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
162a0 20 20 63 6f 6c 6c 65 63 74 47 61 72 62 61 67 65 collectGarbage
162b0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
162c0 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
162d0 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
162e0 54 45 3a 20 52 65 66 65 72 20 74 6f 20 74 68 65 TE: Refer to the
162f0 20 73 70 65 63 69 66 69 65 64 20 76 61 72 69 61 specified varia
16300 62 6c 65 20 28 65 2e 67 2e 20 22 64 62 22 29 20 ble (e.g. "db")
16310 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 20 6f in the context o
16320 66 20 6f 75 72 0d 0a 20 20 20 20 20 20 23 20 20 f our.. #
16330 20 20 20 20 20 63 61 6c 6c 65 72 2e 20 20 54 68 caller. Th
16340 65 20 68 61 6e 64 6c 65 20 74 6f 20 74 68 65 20 e handle to the
16350 64 61 74 61 62 61 73 65 20 70 72 65 76 69 6f 75 database previou
16360 73 6c 79 20 6f 70 65 6e 65 64 20 76 69 61 20 74 sly opened via t
16370 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 he.. #
16380 20 20 5b 73 65 74 75 70 44 62 5d 20 70 72 6f 63 [setupDb] proc
16390 65 64 75 72 65 20 73 68 6f 75 6c 64 20 62 65 20 edure should be
163a0 73 74 6f 72 65 64 20 74 68 65 72 65 2e 0d 0a 20 stored there...
163b0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 75 70 #.. up
163c0 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 64 var 1 $varName d
163d0 62 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 b.... #..
163e0 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 6c 6f 73 # NOTE: Clos
163f0 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e e the connection
16400 20 74 6f 20 74 68 65 20 64 61 74 61 62 61 73 65 to the database
16410 20 6e 6f 77 2e 20 20 54 68 69 73 20 73 68 6f 75 now. This shou
16420 6c 64 20 61 6c 6c 6f 77 20 75 73 0d 0a 20 20 20 ld allow us..
16430 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 64 65 # to de
16440 6c 65 74 65 20 74 68 65 20 75 6e 64 65 72 6c 79 lete the underly
16450 69 6e 67 20 64 61 74 61 62 61 73 65 20 66 69 6c ing database fil
16460 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e... #..
16470 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 if {[info exi
16480 73 74 73 20 64 62 5d 20 26 26 20 5b 63 61 74 63 sts db] && [catc
16490 68 20 7b 73 71 6c 20 63 6c 6f 73 65 20 24 64 62 h {sql close $db
164a0 7d 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b } error]} then {
164b0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
164c0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 65 20 # NOTE: We
164d0 73 6f 6d 65 68 6f 77 20 66 61 69 6c 65 64 20 74 somehow failed t
164e0 6f 20 63 6c 6f 73 65 20 74 68 65 20 64 61 74 61 o close the data
164f0 62 61 73 65 2c 20 72 65 70 6f 72 74 20 77 68 79 base, report why
16500 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
16510 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
16520 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
16530 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
16540 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 "==== WAR
16550 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 NING: failed to
16560 63 6c 6f 73 65 20 64 61 74 61 62 61 73 65 20 5c close database \
16570 22 22 20 24 64 62 20 22 5c 22 2c 20 65 72 72 6f "" $db "\", erro
16580 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 r: " \..
16590 20 20 20 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 \n\t $error
165a0 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a \n].. }....
165b0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
165c0 20 4e 4f 54 45 3a 20 46 69 72 73 74 2c 20 73 65 NOTE: First, se
165d0 65 20 69 66 20 6f 75 72 20 63 61 6c 6c 65 72 20 e if our caller
165e0 68 61 73 20 72 65 71 75 65 73 74 65 64 20 61 6e has requested an
165f0 20 69 6e 2d 6d 65 6d 6f 72 79 20 64 61 74 61 62 in-memory datab
16600 61 73 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ase... #..
16610 20 20 20 20 20 73 65 74 20 69 73 4d 65 6d 6f 72 set isMemor
16620 79 20 5b 69 73 4d 65 6d 6f 72 79 44 62 20 24 66 y [isMemoryDb $f
16630 69 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 ileName]....
16640 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
16650 45 3a 20 42 75 69 6c 64 20 74 68 65 20 66 75 6c E: Build the ful
16660 6c 20 70 61 74 68 20 74 6f 20 74 68 65 20 64 61 l path to the da
16670 74 61 62 61 73 65 20 66 69 6c 65 20 6e 61 6d 65 tabase file name
16680 2e 20 20 46 6f 72 20 6e 6f 77 2c 20 61 6c 6c 20 . For now, all
16690 74 65 73 74 0d 0a 20 20 20 20 20 20 23 20 20 20 test.. #
166a0 20 20 20 20 64 61 74 61 62 61 73 65 20 66 69 6c database fil
166b0 65 73 20 61 72 65 20 73 74 6f 72 65 64 20 69 6e es are stored in
166c0 20 74 68 65 20 74 65 6d 70 6f 72 61 72 79 20 64 the temporary d
166d0 69 72 65 63 74 6f 72 79 2e 0d 0a 20 20 20 20 20 irectory...
166e0 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 24 #.. if {!$
166f0 69 73 4d 65 6d 6f 72 79 20 26 26 20 24 71 75 61 isMemory && $qua
16700 6c 69 66 79 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 lify} then {..
16710 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 set fileNa
16720 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 me [file join [g
16730 65 74 44 61 74 61 62 61 73 65 44 69 72 65 63 74 etDatabaseDirect
16740 6f 72 79 5d 20 5b 66 69 6c 65 20 74 61 69 6c 20 ory] [file tail
16750 24 66 69 6c 65 4e 61 6d 65 5d 5d 0d 0a 20 20 20 $fileName]]..
16760 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
16770 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 . # NOTE: C
16780 68 65 63 6b 20 69 66 20 74 68 65 20 66 69 6c 65 heck if the file
16790 20 73 74 69 6c 6c 20 65 78 69 73 74 73 2e 0d 0a still exists...
167a0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
167b0 66 20 7b 21 24 69 73 4d 65 6d 6f 72 79 20 26 26 f {!$isMemory &&
167c0 20 24 64 65 6c 65 74 65 20 26 26 20 5b 66 69 6c $delete && [fil
167d0 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 e exists $fileNa
167e0 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 me]} then {..
167f0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
16800 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 64 65 6c # NOTE: Skip del
16810 65 74 69 6e 67 20 64 61 74 61 62 61 73 65 20 66 eting database f
16820 69 6c 65 73 20 69 66 20 73 6f 6d 65 62 6f 64 79 iles if somebody
16830 20 73 65 74 73 20 74 68 65 20 67 6c 6f 62 61 6c sets the global
16840 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
16850 20 20 76 61 72 69 61 62 6c 65 20 74 6f 20 70 72 variable to pr
16860 65 76 65 6e 74 20 69 74 2e 0d 0a 20 20 20 20 20 event it...
16870 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 #.. if
16880 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
16890 3a 3a 6e 6f 28 63 6c 65 61 6e 75 70 44 62 46 69 ::no(cleanupDbFi
168a0 6c 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 le)]} then {..
168b0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
168c0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 # NOTE: Att
168d0 65 6d 70 74 20 74 6f 20 64 65 6c 65 74 65 20 74 empt to delete t
168e0 68 65 20 74 65 73 74 20 64 61 74 61 62 61 73 65 he test database
168f0 20 66 69 6c 65 20 6e 6f 77 2e 0d 0a 20 20 20 20 file now...
16900 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
16910 20 20 20 69 66 20 7b 5b 73 65 74 20 63 6f 64 65 if {[set code
16920 20 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 64 65 [catch {file de
16930 6c 65 74 65 20 24 66 69 6c 65 4e 61 6d 65 7d 20 lete $fileName}
16940 65 72 72 6f 72 5d 5d 7d 20 74 68 65 6e 20 7b 0d error]]} then {.
16950 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
16960 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f # NO
16970 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 20 66 TE: We somehow f
16980 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20 ailed to delete
16990 74 68 65 20 66 69 6c 65 2c 20 72 65 70 6f 72 74 the file, report
169a0 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 why...
169b0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
169c0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
169d0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
169e0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
169f0 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 "==== WAR
16a00 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 NING: failed to
16a10 64 65 6c 65 74 65 20 64 61 74 61 62 61 73 65 20 delete database
16a20 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 file \"" $fileNa
16a30 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 me \..
16a40 20 20 20 20 20 20 22 5c 22 20 64 75 72 69 6e 67 "\" during
16a50 20 63 6c 65 61 6e 75 70 2c 20 65 72 72 6f 72 3a cleanup, error:
16a60 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c " \n\t $error \
16a70 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d n].. }.
16a80 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 . } else
16a90 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a {.. #..
16aa0 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
16ab0 3a 20 53 68 6f 77 20 74 68 61 74 20 77 65 20 73 : Show that we s
16ac0 6b 69 70 70 65 64 20 64 65 6c 65 74 69 6e 67 20 kipped deleting
16ad0 74 68 65 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 the file...
16ae0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
16af0 20 20 73 65 74 20 63 6f 64 65 20 30 0d 0a 0d 0a set code 0....
16b00 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
16b10 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
16b20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
16b30 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d "==
16b40 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 73 6b 69 70 == WARNING: skip
16b50 70 65 64 20 64 65 6c 65 74 69 6e 67 20 64 61 74 ped deleting dat
16b60 61 62 61 73 65 20 66 69 6c 65 20 5c 22 22 20 24 abase file \"" $
16b70 66 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 fileName \..
16b80 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 64 75 "\" du
16b90 72 69 6e 67 20 63 6c 65 61 6e 75 70 5c 6e 22 5d ring cleanup\n"]
16ba0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
16bb0 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
16bc0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
16bd0 23 20 4e 4f 54 45 3a 20 54 68 65 20 66 69 6c 65 # NOTE: The file
16be0 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 2c does not exist,
16bf0 20 73 75 63 63 65 73 73 21 0d 0a 20 20 20 20 20 success!..
16c00 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 #.. se
16c10 74 20 63 6f 64 65 20 30 0d 0a 20 20 20 20 20 20 t code 0..
16c20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 }.... retur
16c30 6e 20 24 63 6f 64 65 0d 0a 20 20 20 20 7d 0d 0a n $code.. }..
16c40 0c 0d 0a 20 20 20 20 70 72 6f 63 20 73 61 76 65 ... proc save
16c50 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 61 EnvironmentVaria
16c60 62 6c 65 73 20 7b 20 6e 61 6d 65 73 20 7b 76 61 bles { names {va
16c70 72 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d 0a 20 rName ""} } {..
16c80 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
16c90 4e 4f 54 45 3a 20 46 6f 72 20 65 61 63 68 20 6e NOTE: For each n
16ca0 61 6d 65 2c 20 64 6f 65 73 20 74 68 65 20 6c 69 ame, does the li
16cb0 76 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 ve environment v
16cc0 61 72 69 61 62 6c 65 20 65 78 69 73 74 3f 20 20 ariable exist?
16cd0 49 66 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 If.. #
16ce0 20 20 73 6f 2c 20 73 61 76 65 20 74 68 65 20 76 so, save the v
16cf0 61 6c 75 65 20 66 6f 72 20 6c 61 74 65 72 3b 20 alue for later;
16d00 6f 74 68 65 72 77 69 73 65 2c 20 6d 61 6b 65 20 otherwise, make
16d10 73 75 72 65 20 74 68 65 20 73 61 76 65 64 0d 0a sure the saved..
16d20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 61 # va
16d30 6c 75 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 lue does not exi
16d40 73 74 20 65 69 74 68 65 72 2e 20 20 54 68 65 20 st either. The
16d50 6c 69 76 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 live environment
16d60 20 76 61 72 69 61 62 6c 65 73 0d 0a 20 20 20 20 variables..
16d70 20 20 23 20 20 20 20 20 20 20 41 52 45 20 4e 4f # ARE NO
16d80 54 20 63 68 61 6e 67 65 64 20 62 79 20 74 68 69 T changed by thi
16d90 73 20 70 72 6f 63 65 64 75 72 65 2e 0d 0a 20 20 s procedure...
16da0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
16db0 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
16dc0 24 76 61 72 4e 61 6d 65 5d 20 3d 3d 20 30 7d 20 $varName] == 0}
16dd0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
16de0 73 65 74 20 76 61 72 4e 61 6d 65 20 73 61 76 65 set varName save
16df0 64 45 6e 76 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d dEnv.. }...
16e00 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 . upvar 1 $
16e10 76 61 72 4e 61 6d 65 20 73 61 76 65 64 45 6e 76 varName savedEnv
16e20 0d 0a 0d 0a 20 20 20 20 20 20 66 6f 72 65 61 63 .... foreac
16e30 68 20 6e 61 6d 65 20 24 6e 61 6d 65 73 20 7b 0d h name $names {.
16e40 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e . if {[in
16e50 66 6f 20 65 78 69 73 74 73 20 3a 3a 65 6e 76 28 fo exists ::env(
16e60 24 6e 61 6d 65 29 5d 7d 20 74 68 65 6e 20 7b 0d $name)]} then {.
16e70 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73 . set s
16e80 61 76 65 64 45 6e 76 28 24 6e 61 6d 65 29 20 24 avedEnv($name) $
16e90 3a 3a 65 6e 76 28 24 6e 61 6d 65 29 0d 0a 20 20 ::env($name)..
16ea0 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
16eb0 20 20 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 unset
16ec0 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 73 61 76 65 -nocomplain save
16ed0 64 45 6e 76 28 24 6e 61 6d 65 29 0d 0a 20 20 20 dEnv($name)..
16ee0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d }.. }.
16ef0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
16f00 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 69 # NOTE: This i
16f10 73 20 73 65 6c 66 2d 63 6c 65 61 6e 69 6e 67 2e s self-cleaning.
16f20 20 20 49 66 20 6e 6f 20 73 61 76 65 64 20 65 6e If no saved en
16f30 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 vironment variab
16f40 6c 65 73 20 6e 6f 77 0d 0a 20 20 20 20 20 20 23 les now.. #
16f50 20 20 20 20 20 20 20 65 78 69 73 74 2c 20 72 65 exist, re
16f60 6d 6f 76 65 20 74 68 65 20 61 72 72 61 79 2e 0d move the array..
16f70 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
16f80 69 66 20 7b 5b 61 72 72 61 79 20 73 69 7a 65 20 if {[array size
16f90 73 61 76 65 64 45 6e 76 5d 20 3d 3d 20 30 7d 20 savedEnv] == 0}
16fa0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
16fb0 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 unset -nocomplai
16fc0 6e 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 n savedEnv..
16fd0 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
16fe0 20 20 20 70 72 6f 63 20 72 65 73 74 6f 72 65 45 proc restoreE
16ff0 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 nvironmentVariab
17000 6c 65 73 20 7b 20 6e 61 6d 65 73 20 7b 76 61 72 les { names {var
17010 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 Name ""} } {..
17020 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
17030 4f 54 45 3a 20 46 6f 72 20 65 61 63 68 20 6e 61 OTE: For each na
17040 6d 65 2c 20 64 6f 65 73 20 74 68 65 20 73 61 76 me, does the sav
17050 65 64 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 ed environment v
17060 61 72 69 61 62 6c 65 20 65 78 69 73 74 3f 20 20 ariable exist?
17070 49 66 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 If.. #
17080 20 20 73 6f 2c 20 72 65 73 74 6f 72 65 20 74 68 so, restore th
17090 65 20 73 61 76 65 64 20 76 61 6c 75 65 20 61 6e e saved value an
170a0 64 20 75 6e 73 65 74 20 69 74 3b 20 6f 74 68 65 d unset it; othe
170b0 72 77 69 73 65 2c 20 6d 61 6b 65 20 73 75 72 65 rwise, make sure
170c0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
170d0 74 68 65 20 6c 69 76 65 20 65 6e 76 69 72 6f 6e the live environ
170e0 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 20 64 6f ment variable do
170f0 65 73 20 6e 6f 74 20 65 78 69 73 74 20 65 69 74 es not exist eit
17100 68 65 72 20 28 69 2e 65 2e 20 69 74 0d 0a 20 20 her (i.e. it..
17110 20 20 20 20 23 20 20 20 20 20 20 20 77 61 73 20 # was
17120 6e 6f 74 20 73 65 74 20 74 6f 20 62 65 67 69 6e not set to begin
17130 20 77 69 74 68 29 2e 20 20 42 6f 74 68 20 73 61 with). Both sa
17140 76 65 64 20 61 6e 64 20 6c 69 76 65 20 65 6e 76 ved and live env
17150 69 72 6f 6e 6d 65 6e 74 0d 0a 20 20 20 20 20 20 ironment..
17160 23 20 20 20 20 20 20 20 76 61 72 69 61 62 6c 65 # variable
17170 73 20 41 52 45 20 63 68 61 6e 67 65 64 20 62 79 s ARE changed by
17180 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 2e this procedure.
17190 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
171a0 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
171b0 67 74 68 20 24 76 61 72 4e 61 6d 65 5d 20 3d 3d gth $varName] ==
171c0 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
171d0 20 20 20 20 73 65 74 20 76 61 72 4e 61 6d 65 20 set varName
171e0 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 20 20 savedEnv..
171f0 7d 0d 0a 0d 0a 20 20 20 20 20 20 75 70 76 61 72 }.... upvar
17200 20 31 20 24 76 61 72 4e 61 6d 65 20 73 61 76 65 1 $varName save
17210 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 66 6f dEnv.... fo
17220 72 65 61 63 68 20 6e 61 6d 65 20 24 6e 61 6d 65 reach name $name
17230 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 s {.. if
17240 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 73 61 {[info exists sa
17250 76 65 64 45 6e 76 28 24 6e 61 6d 65 29 5d 7d 20 vedEnv($name)]}
17260 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
17270 20 20 73 65 74 20 3a 3a 65 6e 76 28 24 6e 61 6d set ::env($nam
17280 65 29 20 24 73 61 76 65 64 45 6e 76 28 24 6e 61 e) $savedEnv($na
17290 6d 65 29 0d 0a 20 20 20 20 20 20 20 20 20 20 75 me).. u
172a0 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e nset -nocomplain
172b0 20 73 61 76 65 64 45 6e 76 28 24 6e 61 6d 65 29 savedEnv($name)
172c0 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
172d0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 75 6e {.. un
172e0 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 set -nocomplain
172f0 3a 3a 65 6e 76 28 24 6e 61 6d 65 29 0d 0a 20 20 ::env($name)..
17300 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
17310 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
17320 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 # NOTE: This
17330 69 73 20 73 65 6c 66 2d 63 6c 65 61 6e 69 6e 67 is self-cleaning
17340 2e 20 20 49 66 20 6e 6f 20 73 61 76 65 64 20 65 . If no saved e
17350 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 nvironment varia
17360 62 6c 65 73 20 6e 6f 77 0d 0a 20 20 20 20 20 20 bles now..
17370 23 20 20 20 20 20 20 20 65 78 69 73 74 2c 20 72 # exist, r
17380 65 6d 6f 76 65 20 74 68 65 20 61 72 72 61 79 2e emove the array.
17390 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
173a0 20 69 66 20 7b 5b 61 72 72 61 79 20 73 69 7a 65 if {[array size
173b0 20 73 61 76 65 64 45 6e 76 5d 20 3d 3d 20 30 7d savedEnv] == 0}
173c0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
173d0 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 unset -nocompla
173e0 69 6e 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 in savedEnv..
173f0 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
17400 20 20 20 20 70 72 6f 63 20 73 61 76 65 53 51 4c proc saveSQL
17410 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 45 6e 76 iteConnectionEnv
17420 69 72 6f 6e 6d 65 6e 74 20 7b 7d 20 7b 0d 0a 20 ironment {} {..
17430 20 20 20 20 20 75 70 76 61 72 20 31 20 73 61 76 upvar 1 sav
17440 65 64 45 6e 76 20 73 61 76 65 64 45 6e 76 0d 0a edEnv savedEnv..
17450 0d 0a 20 20 20 20 20 20 73 61 76 65 45 6e 76 69 .. saveEnvi
17460 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 6c 65 73 ronmentVariables
17470 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 [list \..
17480 20 20 20 20 44 65 66 61 75 6c 74 46 6c 61 67 73 DefaultFlags
17490 5f 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f _SQLiteConnectio
174a0 6e 20 4e 6f 5f 53 51 4c 69 74 65 43 6f 6e 6e 65 n No_SQLiteConne
174b0 63 74 69 6f 6e 4e 65 77 50 61 72 73 65 72 5d 20 ctionNewParser]
174c0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 73 61 76 \.. sav
174d0 65 64 45 6e 76 0d 0a 20 20 20 20 7d 0d 0a 0c 0d edEnv.. }....
174e0 0a 20 20 20 20 70 72 6f 63 20 72 65 73 74 6f 72 . proc restor
174f0 65 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f eSQLiteConnectio
17500 6e 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 7b 7d 20 nEnvironment {}
17510 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 {.. upvar 1
17520 20 73 61 76 65 64 45 6e 76 20 73 61 76 65 64 45 savedEnv savedE
17530 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 72 65 73 74 nv.... rest
17540 6f 72 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 oreEnvironmentVa
17550 72 69 61 62 6c 65 73 20 5b 6c 69 73 74 20 5c 0d riables [list \.
17560 0a 20 20 20 20 20 20 20 20 20 20 44 65 66 61 75 . Defau
17570 6c 74 46 6c 61 67 73 5f 53 51 4c 69 74 65 43 6f ltFlags_SQLiteCo
17580 6e 6e 65 63 74 69 6f 6e 20 4e 6f 5f 53 51 4c 69 nnection No_SQLi
17590 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 4e 65 77 50 teConnectionNewP
175a0 61 72 73 65 72 5d 20 5c 0d 0a 20 20 20 20 20 20 arser] \..
175b0 20 20 20 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 savedEnv..
175c0 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
175d0 20 73 61 76 65 53 51 4c 69 74 65 43 6f 6e 76 65 saveSQLiteConve
175e0 72 74 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 7b 7d rtEnvironment {}
175f0 20 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 {.. upvar
17600 31 20 73 61 76 65 64 45 6e 76 20 73 61 76 65 64 1 savedEnv saved
17610 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 73 61 76 Env.... sav
17620 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 eEnvironmentVari
17630 61 62 6c 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 ables [list \..
17640 20 20 20 20 20 20 20 20 20 55 73 65 5f 53 51 4c Use_SQL
17650 69 74 65 43 6f 6e 76 65 72 74 5f 44 65 66 61 75 iteConvert_Defau
17660 6c 74 44 62 54 79 70 65 20 55 73 65 5f 53 51 4c ltDbType Use_SQL
17670 69 74 65 43 6f 6e 76 65 72 74 5f 44 65 66 61 75 iteConvert_Defau
17680 6c 74 54 79 70 65 4e 61 6d 65 5d 20 5c 0d 0a 20 ltTypeName] \..
17690 20 20 20 20 20 20 20 20 20 73 61 76 65 64 45 6e savedEn
176a0 76 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 v.. }.....
176b0 20 70 72 6f 63 20 72 65 73 74 6f 72 65 53 51 4c proc restoreSQL
176c0 69 74 65 43 6f 6e 76 65 72 74 45 6e 76 69 72 6f iteConvertEnviro
176d0 6e 6d 65 6e 74 20 7b 7d 20 7b 0d 0a 20 20 20 20 nment {} {..
176e0 20 20 75 70 76 61 72 20 31 20 73 61 76 65 64 45 upvar 1 savedE
176f0 6e 76 20 73 61 76 65 64 45 6e 76 0d 0a 0d 0a 20 nv savedEnv....
17700 20 20 20 20 20 72 65 73 74 6f 72 65 45 6e 76 69 restoreEnvi
17710 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 6c 65 73 ronmentVariables
17720 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 [list \..
17730 20 20 20 20 55 73 65 5f 53 51 4c 69 74 65 43 6f Use_SQLiteCo
17740 6e 76 65 72 74 5f 44 65 66 61 75 6c 74 44 62 54 nvert_DefaultDbT
17750 79 70 65 20 55 73 65 5f 53 51 4c 69 74 65 43 6f ype Use_SQLiteCo
17760 6e 76 65 72 74 5f 44 65 66 61 75 6c 74 54 79 70 nvert_DefaultTyp
17770 65 4e 61 6d 65 5d 20 5c 0d 0a 20 20 20 20 20 20 eName] \..
17780 20 20 20 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 savedEnv..
17790 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
177a0 20 73 65 74 75 70 44 62 49 6e 74 65 72 72 75 70 setupDbInterrup
177b0 74 43 61 6c 6c 62 61 63 6b 20 7b 20 63 68 61 6e tCallback { chan
177c0 6e 65 6c 20 6c 6f 67 20 7d 20 7b 0d 0a 20 20 20 nel log } {..
177d0 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
177e0 6c 20 22 2d 2d 2d 2d 20 73 65 74 74 69 6e 67 20 l "---- setting
177f0 75 70 20 64 65 62 75 67 67 65 72 20 69 6e 74 65 up debugger inte
17800 72 72 75 70 74 20 63 61 6c 6c 62 61 63 6b 2e 2e rrupt callback..
17810 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 . ".... if
17820 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
17830 20 20 20 73 61 76 65 45 6e 76 69 72 6f 6e 6d 65 saveEnvironme
17840 6e 74 56 61 72 69 61 62 6c 65 73 20 5b 6c 69 73 ntVariables [lis
17850 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 t \..
17860 20 71 75 69 65 74 46 69 6e 64 49 6e 74 65 72 70 quietFindInterp
17870 72 65 74 65 72 54 65 73 74 50 61 74 68 20 71 75 reterTestPath qu
17880 69 65 74 53 65 74 75 70 49 6e 74 65 72 70 72 65 ietSetupInterpre
17890 74 65 72 54 65 73 74 50 61 74 68 5d 0d 0a 0d 0a terTestPath]....
178a0 20 20 20 20 20 20 20 20 74 72 79 20 7b 0d 0a 20 try {..
178b0 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
178c0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 50 72 # NOTE: Pr
178d0 65 76 65 6e 74 20 74 68 65 20 76 65 6e 64 6f 72 event the vendor
178e0 20 73 63 72 69 70 74 20 66 72 6f 6d 20 62 65 69 script from bei
178f0 6e 67 20 6e 6f 69 73 79 20 77 68 65 6e 20 63 72 ng noisy when cr
17900 65 61 74 69 6e 67 0d 0a 20 20 20 20 20 20 20 20 eating..
17910 20 20 23 20 20 20 20 20 20 20 74 68 65 20 69 73 # the is
17920 6f 6c 61 74 65 64 20 69 6e 74 65 72 70 72 65 74 olated interpret
17930 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 er... #
17940 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
17950 3a 3a 65 6e 76 28 71 75 69 65 74 46 69 6e 64 49 ::env(quietFindI
17960 6e 74 65 72 70 72 65 74 65 72 54 65 73 74 50 61 nterpreterTestPa
17970 74 68 29 20 31 0d 0a 20 20 20 20 20 20 20 20 20 th) 1..
17980 20 73 65 74 20 3a 3a 65 6e 76 28 71 75 69 65 74 set ::env(quiet
17990 53 65 74 75 70 49 6e 74 65 72 70 72 65 74 65 72 SetupInterpreter
179a0 54 65 73 74 50 61 74 68 29 20 31 0d 0a 0d 0a 20 TestPath) 1....
179b0 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
179c0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4d 61 # NOTE: Ma
179d0 6b 65 20 73 75 72 65 20 74 68 65 20 73 63 72 69 ke sure the scri
179e0 70 74 20 64 65 62 75 67 67 65 72 20 61 6e 64 20 pt debugger and
179f0 74 68 65 20 69 73 6f 6c 61 74 65 64 20 69 6e 74 the isolated int
17a00 65 72 70 72 65 74 65 72 0d 0a 20 20 20 20 20 20 erpreter..
17a10 20 20 20 20 23 20 20 20 20 20 20 20 61 72 65 20 # are
17a20 73 65 74 75 70 20 61 6e 64 20 72 65 61 64 79 20 setup and ready
17a30 66 6f 72 20 75 73 65 2e 0d 0a 20 20 20 20 20 20 for use...
17a40 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
17a50 20 64 65 62 75 67 20 73 65 74 75 70 20 74 72 75 debug setup tru
17a60 65 20 74 72 75 65 0d 0a 0d 0a 20 20 20 20 20 20 e true....
17a70 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
17a80 20 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 20 74 68 # NOTE: Load th
17a90 65 20 6e 65 63 65 73 73 61 72 79 20 70 61 63 6b e necessary pack
17aa0 61 67 65 73 20 69 6e 74 6f 20 74 68 65 20 69 73 ages into the is
17ab0 6f 6c 61 74 65 64 20 69 6e 74 65 72 70 72 65 74 olated interpret
17ac0 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 er... #
17ad0 0d 0a 20 20 20 20 20 20 20 20 20 20 64 65 62 75 .. debu
17ae0 67 20 65 76 61 6c 20 7b 0d 0a 20 20 20 20 20 20 g eval {..
17af0 20 20 20 20 20 20 70 61 63 6b 61 67 65 20 72 65 package re
17b00 71 75 69 72 65 20 45 61 67 6c 65 0d 0a 20 20 20 quire Eagle..
17b10 20 20 20 20 20 20 20 20 20 70 61 63 6b 61 67 65 package
17b20 20 72 65 71 75 69 72 65 20 45 61 67 6c 65 2e 4c require Eagle.L
17b30 69 62 72 61 72 79 0d 0a 20 20 20 20 20 20 20 20 ibrary..
17b40 20 20 20 20 70 61 63 6b 61 67 65 20 72 65 71 75 package requ
17b50 69 72 65 20 45 61 67 6c 65 2e 54 65 73 74 0d 0a ire Eagle.Test..
17b60 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
17b70 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
17b80 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 6f # NOTE: Co
17b90 70 79 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 py the necessary
17ba0 20 76 61 72 69 61 62 6c 65 73 20 69 6e 74 6f 20 variables into
17bb0 74 68 65 20 69 73 6f 6c 61 74 65 64 20 69 6e 74 the isolated int
17bc0 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 20 20 erpreter...
17bd0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
17be0 20 20 64 65 62 75 67 20 69 6e 76 6f 6b 65 20 30 debug invoke 0
17bf0 20 73 65 74 20 3a 3a 74 65 73 74 5f 63 68 61 6e set ::test_chan
17c00 6e 65 6c 20 24 63 68 61 6e 6e 65 6c 3b 20 23 20 nel $channel; #
17c10 4e 4f 54 45 3a 20 46 6f 72 20 5b 74 70 75 74 73 NOTE: For [tputs
17c20 5d 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 64 65 ]... de
17c30 62 75 67 20 69 6e 76 6f 6b 65 20 30 20 73 65 74 bug invoke 0 set
17c40 20 3a 3a 74 65 73 74 5f 6c 6f 67 20 24 6c 6f 67 ::test_log $log
17c50 3b 20 23 20 4e 4f 54 45 3a 20 46 6f 72 20 5b 74 ; # NOTE: For [t
17c60 6c 6f 67 5d 2e 0d 0a 0d 0a 20 20 20 20 20 20 20 log].....
17c70 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
17c80 23 20 4e 4f 54 45 3a 20 49 6e 73 74 61 6c 6c 20 # NOTE: Install
17c90 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 63 72 the callback scr
17ca0 69 70 74 20 74 6f 20 62 65 20 65 76 61 6c 75 61 ipt to be evalua
17cb0 74 65 64 20 69 6e 20 74 68 65 20 69 73 6f 6c 61 ted in the isola
17cc0 74 65 64 0d 0a 20 20 20 20 20 20 20 20 20 20 23 ted.. #
17cd0 20 20 20 20 20 20 20 69 6e 74 65 72 70 72 65 74 interpret
17ce0 65 72 20 77 68 65 6e 20 74 68 69 73 20 69 6e 74 er when this int
17cf0 65 72 70 72 65 74 65 72 20 69 73 20 69 6e 74 65 erpreter is inte
17d00 72 72 75 70 74 65 64 20 62 79 20 73 63 72 69 70 rrupted by scrip
17d10 74 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 t.. #
17d20 20 20 20 20 20 63 61 6e 63 65 6c 6c 61 74 69 6f cancellatio
17d30 6e 2c 20 65 74 63 2e 0d 0a 20 20 20 20 20 20 20 n, etc...
17d40 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
17d50 64 65 62 75 67 20 63 61 6c 6c 62 61 63 6b 20 61 debug callback a
17d60 70 70 6c 79 20 7b 7b 73 65 6e 64 65 72 20 65 7d pply {{sender e}
17d70 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
17d80 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 #.. #
17d90 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 NOTE: Check if
17da0 74 68 69 73 20 64 65 62 75 67 67 65 72 20 63 61 this debugger ca
17db0 6c 6c 62 61 63 6b 20 69 73 20 6f 6e 65 20 74 68 llback is one th
17dc0 61 74 20 77 65 20 63 61 72 65 20 61 62 6f 75 74 at we care about
17dd0 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 ... #
17de0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 .. se
17df0 74 20 69 6e 74 65 72 72 75 70 74 54 79 70 65 73 t interruptTypes
17e00 20 5b 73 70 6c 69 74 20 5b 24 65 20 49 6e 74 65 [split [$e Inte
17e10 72 72 75 70 74 54 79 70 65 5d 20 22 2c 20 22 5d rruptType] ", "]
17e20 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
17e30 69 66 20 7b 22 43 61 6e 63 65 6c 65 64 22 20 69 if {"Canceled" i
17e40 6e 20 24 69 6e 74 65 72 72 75 70 74 54 79 70 65 n $interruptType
17e50 73 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 s || \..
17e60 20 20 20 20 20 20 20 20 22 55 6e 77 6f 75 6e 64 "Unwound
17e70 22 20 69 6e 20 24 69 6e 74 65 72 72 75 70 74 54 " in $interruptT
17e80 79 70 65 73 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ypes} then {..
17e90 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
17ea0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e # N
17eb0 4f 54 45 3a 20 4d 61 6b 65 20 73 75 72 65 20 74 OTE: Make sure t
17ec0 68 65 20 5b 6f 62 6a 65 63 74 5d 20 63 6f 6d 6d he [object] comm
17ed0 61 6e 64 20 69 73 20 61 76 61 69 6c 61 62 6c 65 and is available
17ee0 2e 20 20 53 69 6e 63 65 0d 0a 20 20 20 20 20 20 . Since..
17ef0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
17f00 74 68 69 73 20 69 73 20 61 6e 20 69 73 6f 6c 61 this is an isola
17f10 74 65 64 20 69 6e 74 65 72 70 72 65 74 65 72 2c ted interpreter,
17f20 20 63 68 65 63 6b 20 66 6f 72 20 69 74 20 74 68 check for it th
17f30 65 20 68 61 72 64 0d 0a 20 20 20 20 20 20 20 20 e hard..
17f40 20 20 20 20 20 20 23 20 20 20 20 20 20 20 77 61 # wa
17f50 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 y...
17f60 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
17f70 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 if {[llength
17f80 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e 64 73 20 6f [info commands o
17f90 62 6a 65 63 74 5d 5d 20 3e 20 30 7d 20 74 68 65 bject]] > 0} the
17fa0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
17fb0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
17fc0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
17fd0 49 74 65 72 61 74 65 20 74 68 72 6f 75 67 68 20 Iterate through
17fe0 61 6c 6c 20 64 61 74 61 62 61 73 65 20 63 6f 6e all database con
17ff0 6e 65 63 74 69 6f 6e 73 20 6b 6e 6f 77 6e 20 74 nections known t
18000 6f 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 20 o the..
18010 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 70 # p
18020 61 72 65 6e 74 20 69 6e 74 65 72 70 72 65 74 65 arent interprete
18030 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 r...
18040 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
18050 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 66 6f object fo
18060 72 65 61 63 68 20 2d 61 6c 69 61 73 20 70 61 69 reach -alias pai
18070 72 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 r [object invoke
18080 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c -flags +NonPubl
18090 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ic \..
180a0 20 20 20 20 20 20 20 20 20 20 24 65 20 49 6e 74 $e Int
180b0 65 72 70 72 65 74 65 72 2e 63 6f 6e 6e 65 63 74 erpreter.connect
180c0 69 6f 6e 73 5d 20 7b 0d 0a 20 20 20 20 20 20 20 ions] {..
180d0 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
180e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
180f0 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
18100 74 6f 20 63 61 6e 63 65 6c 20 61 6e 79 20 53 51 to cancel any SQ
18110 4c 20 71 75 65 72 69 65 73 20 69 6e 20 70 72 6f L queries in pro
18120 67 72 65 73 73 20 6f 6e 0d 0a 20 20 20 20 20 20 gress on..
18130 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 #
18140 20 20 20 20 74 68 69 73 20 64 61 74 61 62 61 73 this databas
18150 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0d 0a 20 e connection...
18160 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18170 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
18180 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
18190 20 7b 24 70 61 69 72 20 56 61 6c 75 65 2e 43 61 {$pair Value.Ca
181a0 6e 63 65 6c 7d 20 65 72 72 6f 72 5d 7d 20 74 68 ncel} error]} th
181b0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
181c0 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
181d0 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
181e0 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 6e 20 5c [appendArgs \n \
181f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
18200 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
18210 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
18220 74 6f 20 63 61 6e 63 65 6c 20 71 75 65 72 79 20 to cancel query
18230 66 6f 72 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 for " \..
18240 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18250 20 22 63 6f 6e 6e 65 63 74 69 6f 6e 20 5c 22 22 "connection \""
18260 20 5b 24 70 61 69 72 20 4b 65 79 5d 20 22 5c 22 [$pair Key] "\"
18270 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 , error: " \n\t
18280 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
18290 20 20 20 20 20 20 20 20 20 20 20 24 65 72 72 6f $erro
182a0 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 r \n]..
182b0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
182c0 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
182d0 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 } e
182e0 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
182f0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
18300 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
18310 70 65 6e 64 41 72 67 73 20 5c 6e 20 5c 0d 0a 20 pendArgs \n \..
18320 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18330 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 "==== WARNING
18340 3a 20 63 61 6e 6e 6f 74 20 63 61 6e 63 65 6c 20 : cannot cancel
18350 61 6e 79 20 71 75 65 72 69 65 73 3a 20 22 20 5c any queries: " \
18360 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
18370 20 20 20 20 20 20 22 74 68 65 20 5c 22 6f 62 6a "the \"obj
18380 65 63 74 5c 22 20 63 6f 6d 6d 61 6e 64 20 69 73 ect\" command is
18390 20 6e 6f 74 20 61 76 61 69 6c 61 62 6c 65 5c 6e not available\n
183a0 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 "]..
183b0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
183c0 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 7d }.. }}
183d0 0d 0a 20 20 20 20 20 20 20 20 7d 20 66 69 6e 61 .. } fina
183e0 6c 6c 79 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lly {..
183f0 20 72 65 73 74 6f 72 65 45 6e 76 69 72 6f 6e 6d restoreEnvironm
18400 65 6e 74 56 61 72 69 61 62 6c 65 73 20 5b 6c 69 entVariables [li
18410 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 st \..
18420 20 20 20 20 71 75 69 65 74 46 69 6e 64 49 6e 74 quietFindInt
18430 65 72 70 72 65 74 65 72 54 65 73 74 50 61 74 68 erpreterTestPath
18440 20 71 75 69 65 74 53 65 74 75 70 49 6e 74 65 72 quietSetupInter
18450 70 72 65 74 65 72 54 65 73 74 50 61 74 68 5d 0d preterTestPath].
18460 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
18470 20 20 7d 20 65 72 72 6f 72 5d 20 3d 3d 20 30 7d } error] == 0}
18480 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
18490 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 69 addConstraint i
184a0 6e 74 65 72 72 75 70 74 43 61 6c 6c 62 61 63 6b nterruptCallback
184b0 2e 73 71 6c 69 74 65 33 0d 0a 0d 0a 20 20 20 20 .sqlite3....
184c0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
184d0 65 6c 20 79 65 73 5c 6e 0d 0a 20 20 20 20 20 20 el yes\n..
184e0 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
184f0 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
18500 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 6e 6f [appendArgs "no
18510 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 , error: " \n\t
18520 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 $error \n]..
18530 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
18540 20 20 20 70 72 6f 63 20 63 6c 65 61 6e 75 70 46 proc cleanupF
18550 69 6c 65 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7b ile { fileName {
18560 63 6f 6c 6c 65 63 74 20 74 72 75 65 7d 20 7b 66 collect true} {f
18570 6f 72 63 65 20 66 61 6c 73 65 7d 20 7d 20 7b 0d orce false} } {.
18580 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
18590 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
185a0 74 6f 20 66 6f 72 63 65 20 61 6c 6c 20 70 65 6e to force all pen
185b0 64 69 6e 67 20 22 67 61 72 62 61 67 65 22 20 6f ding "garbage" o
185c0 62 6a 65 63 74 73 20 74 6f 20 62 65 20 63 6f 6c bjects to be col
185d0 6c 65 63 74 65 64 2c 0d 0a 20 20 20 20 20 20 23 lected,.. #
185e0 20 20 20 20 20 20 20 69 6e 63 6c 75 64 69 6e 67 including
185f0 20 53 51 4c 69 74 65 20 73 74 61 74 65 6d 65 6e SQLite statemen
18600 74 73 20 61 6e 64 20 62 61 63 6b 75 70 20 6f 62 ts and backup ob
18610 6a 65 63 74 73 3b 20 74 68 69 73 20 73 68 6f 75 jects; this shou
18620 6c 64 20 61 6c 6c 6f 77 0d 0a 20 20 20 20 20 20 ld allow..
18630 23 20 20 20 20 20 20 20 74 68 65 20 75 6e 64 65 # the unde
18640 72 6c 79 69 6e 67 20 64 61 74 61 62 61 73 65 20 rlying database
18650 66 69 6c 65 20 74 6f 20 62 65 20 64 65 6c 65 74 file to be delet
18660 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ed... #..
18670 20 20 20 20 69 66 20 7b 24 63 6f 6c 6c 65 63 74 if {$collect
18680 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
18690 20 20 63 6f 6c 6c 65 63 74 47 61 72 62 61 67 65 collectGarbage
186a0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
186b0 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
186c0 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
186d0 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 65 TE: Check if the
186e0 20 66 69 6c 65 20 73 74 69 6c 6c 20 65 78 69 73 file still exis
186f0 74 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ts... #..
18700 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 if {[file ex
18710 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d ists $fileName]}
18720 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
18730 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
18740 54 45 3a 20 53 6b 69 70 20 64 65 6c 65 74 69 6e TE: Skip deletin
18750 67 20 74 65 73 74 20 66 69 6c 65 73 20 69 66 20 g test files if
18760 73 6f 6d 65 62 6f 64 79 20 73 65 74 73 20 74 68 somebody sets th
18770 65 20 67 6c 6f 62 61 6c 20 76 61 72 69 61 62 6c e global variabl
18780 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
18790 20 20 20 74 6f 20 70 72 65 76 65 6e 74 20 69 74 to prevent it
187a0 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
187b0 20 20 20 20 20 20 69 66 20 7b 24 66 6f 72 63 65 if {$force
187c0 20 7c 7c 20 21 5b 69 6e 66 6f 20 65 78 69 73 74 || ![info exist
187d0 73 20 3a 3a 6e 6f 28 63 6c 65 61 6e 75 70 46 69 s ::no(cleanupFi
187e0 6c 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 le)]} then {..
187f0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
18800 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 # NOTE: Att
18810 65 6d 70 74 20 74 6f 20 64 65 6c 65 74 65 20 74 empt to delete t
18820 68 65 20 74 65 73 74 20 66 69 6c 65 20 6e 6f 77 he test file now
18830 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
18840 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 if {[s
18850 65 74 20 63 6f 64 65 20 5b 63 61 74 63 68 20 7b et code [catch {
18860 66 69 6c 65 20 64 65 6c 65 74 65 20 24 66 69 6c file delete $fil
18870 65 4e 61 6d 65 7d 20 65 72 72 6f 72 5d 5d 7d 20 eName} error]]}
18880 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
18890 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
188a0 20 20 20 23 20 4e 4f 54 45 3a 20 57 65 20 73 6f # NOTE: We so
188b0 6d 65 68 6f 77 20 66 61 69 6c 65 64 20 74 6f 20 mehow failed to
188c0 64 65 6c 65 74 65 20 74 68 65 20 66 69 6c 65 2c delete the file,
188d0 20 72 65 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 report why...
188e0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
188f0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
18900 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
18910 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
18920 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d "=
18930 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 === WARNING: fai
18940 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20 74 65 led to delete te
18950 73 74 20 66 69 6c 65 20 5c 22 22 20 24 66 69 6c st file \"" $fil
18960 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 eName \..
18970 20 20 20 20 20 20 20 20 20 22 5c 22 20 64 75 72 "\" dur
18980 69 6e 67 20 63 6c 65 61 6e 75 70 2c 20 65 72 72 ing cleanup, err
18990 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f or: " \n\t $erro
189a0 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 r \n]..
189b0 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c }.. } el
189c0 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
189d0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
189e0 4f 54 45 3a 20 53 68 6f 77 20 74 68 61 74 20 77 OTE: Show that w
189f0 65 20 73 6b 69 70 70 65 64 20 64 65 6c 65 74 69 e skipped deleti
18a00 6e 67 20 74 68 65 20 66 69 6c 65 2e 0d 0a 20 20 ng the file...
18a10 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
18a20 20 20 20 20 20 73 65 74 20 63 6f 64 65 20 30 0d set code 0.
18a30 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 ... tpu
18a40 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
18a50 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
18a60 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
18a70 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 73 "==== WARNING: s
18a80 6b 69 70 70 65 64 20 64 65 6c 65 74 69 6e 67 20 kipped deleting
18a90 74 65 73 74 20 66 69 6c 65 20 5c 22 22 20 24 66 test file \"" $f
18aa0 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 ileName \..
18ab0 20 20 20 20 20 20 20 20 20 22 5c 22 20 64 75 72 "\" dur
18ac0 69 6e 67 20 63 6c 65 61 6e 75 70 5c 6e 22 5d 0d ing cleanup\n"].
18ad0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
18ae0 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
18af0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
18b00 20 4e 4f 54 45 3a 20 54 68 65 20 66 69 6c 65 20 NOTE: The file
18b10 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 2c 20 does not exist,
18b20 73 75 63 63 65 73 73 21 0d 0a 20 20 20 20 20 20 success!..
18b30 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 #.. set
18b40 20 63 6f 64 65 20 30 0d 0a 20 20 20 20 20 20 7d code 0.. }
18b50 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e .... return
18b60 20 24 63 6f 64 65 0d 0a 20 20 20 20 7d 0d 0a 0c $code.. }...
18b70 0d 0a 20 20 20 20 70 72 6f 63 20 63 6c 65 61 6e .. proc clean
18b80 75 70 4d 65 6d 6f 72 79 20 7b 20 76 61 72 4e 61 upMemory { varNa
18b90 6d 65 20 7b 71 75 69 65 74 20 66 61 6c 73 65 7d me {quiet false}
18ba0 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b } {.. if {
18bb0 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 [haveSQLiteObjec
18bc0 74 43 6f 6d 6d 61 6e 64 5d 20 26 26 20 5c 0d 0a tCommand] && \..
18bd0 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
18be0 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 6d g length $varNam
18bf0 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a e] > 0} then {..
18c00 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
18c10 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 # NOTE: Refer
18c20 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 to the specifie
18c30 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e d variable (e.g.
18c40 20 22 63 6f 6e 6e 65 63 74 69 6f 6e 22 29 20 69 "connection") i
18c50 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 n the.. #
18c60 20 20 20 20 20 20 20 63 6f 6e 74 65 78 74 20 6f context o
18c70 66 20 6f 75 72 20 63 61 6c 6c 65 72 2e 20 20 54 f our caller. T
18c80 68 65 20 6f 70 61 71 75 65 20 6f 62 6a 65 63 74 he opaque object
18c90 20 68 61 6e 64 6c 65 20 66 6f 72 20 61 6e 0d 0a handle for an..
18ca0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
18cb0 41 44 4f 2e 4e 45 54 20 63 6f 6e 6e 65 63 74 69 ADO.NET connecti
18cc0 6f 6e 20 70 72 65 76 69 6f 75 73 6c 79 20 72 65 on previously re
18cd0 74 75 72 6e 65 64 20 62 79 20 5b 67 65 74 44 62 turned by [getDb
18ce0 43 6f 6e 6e 65 63 74 69 6f 6e 5d 0d 0a 20 20 20 Connection]..
18cf0 20 20 20 20 20 23 20 20 20 20 20 20 20 73 68 6f # sho
18d00 75 6c 64 20 62 65 20 73 74 6f 72 65 64 20 74 68 uld be stored th
18d10 65 72 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ere... #.
18d20 0a 20 20 20 20 20 20 20 20 75 70 76 61 72 20 31 . upvar 1
18d30 20 24 76 61 72 4e 61 6d 65 20 63 6f 6e 6e 65 63 $varName connec
18d40 74 69 6f 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 tion....
18d50 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 if {[catch {..
18d60 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 object i
18d70 6e 76 6f 6b 65 20 24 63 6f 6e 6e 65 63 74 69 6f nvoke $connectio
18d80 6e 20 52 65 6c 65 61 73 65 4d 65 6d 6f 72 79 0d n ReleaseMemory.
18d90 0a 20 20 20 20 20 20 20 20 7d 20 72 65 73 75 6c . } resul
18da0 74 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 t]} then {..
18db0 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
18dc0 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
18dd0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
18de0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
18df0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
18e00 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d "===
18e10 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 = WARNING: faile
18e20 64 20 74 6f 20 72 65 6c 65 61 73 65 20 64 61 74 d to release dat
18e30 61 62 61 73 65 20 6d 65 6d 6f 72 79 2c 20 65 72 abase memory, er
18e40 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 ror: " \..
18e50 20 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 \n\t $
18e60 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 result \n]..
18e70 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
18e80 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }.. }....
18e90 20 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 if {[llengt
18ea0 68 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e 64 73 h [info commands
18eb0 20 64 65 62 75 67 5d 5d 20 3e 20 30 7d 20 74 68 debug]] > 0} th
18ec0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 en {.. if
18ed0 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
18ee0 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 uplevel 1
18ef0 5b 6c 69 73 74 20 64 65 62 75 67 20 70 75 72 67 [list debug purg
18f00 65 5d 0d 0a 20 20 20 20 20 20 20 20 7d 20 72 65 e].. } re
18f10 73 75 6c 74 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 sult]} then {..
18f20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
18f30 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
18f40 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
18f50 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
18f60 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
18f70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
18f80 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 ==== WARNING: fa
18f90 69 6c 65 64 20 74 6f 20 70 75 72 67 65 20 63 61 iled to purge ca
18fa0 6c 6c 20 66 72 61 6d 65 2c 20 65 72 72 6f 72 3a ll frame, error:
18fb0 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 " \..
18fc0 20 20 20 20 20 20 5c 6e 5c 74 20 24 72 65 73 75 \n\t $resu
18fd0 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 lt \n]..
18fe0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
18ff0 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 .. if {[c
19000 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
19010 20 20 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 uplevel 1 [lis
19020 74 20 64 65 62 75 67 20 63 6c 65 61 6e 75 70 5d t debug cleanup]
19030 0d 0a 20 20 20 20 20 20 20 20 7d 20 72 65 73 75 .. } resu
19040 6c 74 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 lt]} then {..
19050 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
19060 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
19070 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
19080 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
19090 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
190a0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d "==
190b0 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c == WARNING: fail
190c0 65 64 20 74 6f 20 63 6c 65 61 6e 75 70 20 69 6e ed to cleanup in
190d0 74 65 72 70 72 65 74 65 72 2c 20 65 72 72 6f 72 terpreter, error
190e0 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 : " \..
190f0 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 72 65 73 \n\t $res
19100 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ult \n]..
19110 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
19120 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b ... if {[
19130 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
19140 20 20 20 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 uplevel 1 [li
19150 73 74 20 64 65 62 75 67 20 63 6f 6c 6c 65 63 74 st debug collect
19160 5d 0d 0a 20 20 20 20 20 20 20 20 7d 20 72 65 73 ].. } res
19170 75 6c 74 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ult]} then {..
19180 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
19190 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
191a0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
191b0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
191c0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
191d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d "=
191e0 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 === WARNING: fai
191f0 6c 65 64 20 74 6f 20 63 6f 6c 6c 65 63 74 20 67 led to collect g
19200 61 72 62 61 67 65 2c 20 65 72 72 6f 72 3a 20 22 arbage, error: "
19210 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
19220 20 20 20 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 \n\t $result
19230 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
19240 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
19250 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
19260 0a 20 20 20 20 70 72 6f 63 20 73 65 74 75 70 4d . proc setupM
19270 65 6d 6f 72 79 43 6f 75 6e 74 65 72 73 20 7b 20 emoryCounters {
19280 76 61 72 4e 61 6d 65 20 7d 20 7b 0d 0a 20 20 20 varName } {..
19290 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 if {[haveSQLi
192a0 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d teObjectCommand]
192b0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
192c0 20 20 75 70 76 61 72 20 31 20 24 76 61 72 4e 61 upvar 1 $varNa
192d0 6d 65 20 63 6f 75 6e 74 65 72 0d 0a 0d 0a 20 20 me counter....
192e0 20 20 20 20 20 20 73 65 74 20 63 6f 75 6e 74 65 set counte
192f0 72 28 31 29 20 5b 6f 62 6a 65 63 74 20 63 72 65 r(1) [object cre
19300 61 74 65 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 20 ate -alias \..
19310 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
19320 2e 44 69 61 67 6e 6f 73 74 69 63 73 2e 50 65 72 .Diagnostics.Per
19330 66 6f 72 6d 61 6e 63 65 43 6f 75 6e 74 65 72 20 formanceCounter
19340 50 72 6f 63 65 73 73 20 5c 0d 0a 20 20 20 20 20 Process \..
19350 20 20 20 20 20 20 20 22 57 6f 72 6b 69 6e 67 20 "Working
19360 53 65 74 22 20 5b 66 69 6c 65 20 72 6f 6f 74 6e Set" [file rootn
19370 61 6d 65 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 ame [file tail $
19380 3a 3a 62 69 6e 5f 66 69 6c 65 5d 5d 5d 0d 0a 0d ::bin_file]]]...
19390 0a 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 75 . set cou
193a0 6e 74 65 72 28 32 29 20 5b 6f 62 6a 65 63 74 20 nter(2) [object
193b0 63 72 65 61 74 65 20 2d 61 6c 69 61 73 20 5c 0d create -alias \.
193c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 . Sys
193d0 74 65 6d 2e 44 69 61 67 6e 6f 73 74 69 63 73 2e tem.Diagnostics.
193e0 50 65 72 66 6f 72 6d 61 6e 63 65 43 6f 75 6e 74 PerformanceCount
193f0 65 72 20 50 72 6f 63 65 73 73 20 5c 0d 0a 20 20 er Process \..
19400 20 20 20 20 20 20 20 20 20 20 22 57 6f 72 6b 69 "Worki
19410 6e 67 20 53 65 74 20 50 65 61 6b 22 20 5b 66 69 ng Set Peak" [fi
19420 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 5b 66 69 6c le rootname [fil
19430 65 20 74 61 69 6c 20 24 3a 3a 62 69 6e 5f 66 69 e tail $::bin_fi
19440 6c 65 5d 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 le]]]....
19450 20 73 65 74 20 63 6f 75 6e 74 65 72 28 33 29 20 set counter(3)
19460 5b 6f 62 6a 65 63 74 20 63 72 65 61 74 65 20 2d [object create -
19470 61 6c 69 61 73 20 5c 0d 0a 20 20 20 20 20 20 20 alias \..
19480 20 20 20 20 20 53 79 73 74 65 6d 2e 44 69 61 67 System.Diag
19490 6e 6f 73 74 69 63 73 2e 50 65 72 66 6f 72 6d 61 nostics.Performa
194a0 6e 63 65 43 6f 75 6e 74 65 72 20 50 72 6f 63 65 nceCounter Proce
194b0 73 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ss \..
194c0 20 20 22 50 72 69 76 61 74 65 20 42 79 74 65 73 "Private Bytes
194d0 22 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d 65 " [file rootname
194e0 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 3a 3a 62 [file tail $::b
194f0 69 6e 5f 66 69 6c 65 5d 5d 5d 0d 0a 20 20 20 20 in_file]]]..
19500 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 }.... ret
19510 75 72 6e 20 22 22 0d 0a 20 20 20 20 7d 0d 0a 0c urn "".. }...
19520 0d 0a 20 20 20 20 70 72 6f 63 20 72 65 70 6f 72 .. proc repor
19530 74 4d 65 6d 6f 72 79 43 6f 75 6e 74 65 72 73 20 tMemoryCounters
19540 7b 20 63 68 61 6e 6e 65 6c 20 76 61 72 4e 61 6d { channel varNam
19550 65 20 70 72 65 66 69 78 20 7d 20 7b 0d 0a 20 20 e prefix } {..
19560 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c if {[haveSQL
19570 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 iteObjectCommand
19580 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
19590 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 4e upvar 1 $varN
195a0 61 6d 65 20 63 6f 75 6e 74 65 72 0d 0a 0d 0a 20 ame counter....
195b0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
195c0 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
195d0 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
195e0 20 22 2d 2d 2d 2d 20 22 20 24 70 72 65 66 69 78 "---- " $prefix
195f0 20 22 20 63 6f 75 6e 74 65 72 20 5c 22 22 20 5c " counter \"" \
19600 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 6f .. [o
19610 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 24 63 6f bject invoke $co
19620 75 6e 74 65 72 28 31 29 20 43 6f 75 6e 74 65 72 unter(1) Counter
19630 4e 61 6d 65 5d 20 22 5c 22 20 76 61 6c 75 65 20 Name] "\" value
19640 69 73 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 is " \..
19650 20 20 20 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f [object invo
19660 6b 65 20 24 63 6f 75 6e 74 65 72 28 31 29 20 52 ke $counter(1) R
19670 61 77 56 61 6c 75 65 5d 20 5c 6e 5d 0d 0a 0d 0a awValue] \n]....
19680 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
19690 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
196a0 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
196b0 20 20 22 2d 2d 2d 2d 20 22 20 24 70 72 65 66 69 "---- " $prefi
196c0 78 20 22 20 63 6f 75 6e 74 65 72 20 5c 22 22 20 x " counter \""
196d0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
196e0 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 24 63 object invoke $c
196f0 6f 75 6e 74 65 72 28 32 29 20 43 6f 75 6e 74 65 ounter(2) Counte
19700 72 4e 61 6d 65 5d 20 22 5c 22 20 76 61 6c 75 65 rName] "\" value
19710 20 69 73 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 is " \..
19720 20 20 20 20 20 5b 6f 62 6a 65 63 74 20 69 6e 76 [object inv
19730 6f 6b 65 20 24 63 6f 75 6e 74 65 72 28 32 29 20 oke $counter(2)
19740 52 61 77 56 61 6c 75 65 5d 20 5c 6e 5d 0d 0a 0d RawValue] \n]...
19750 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
19760 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
19770 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
19780 20 20 20 22 2d 2d 2d 2d 20 22 20 24 70 72 65 66 "---- " $pref
19790 69 78 20 22 20 63 6f 75 6e 74 65 72 20 5c 22 22 ix " counter \""
197a0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
197b0 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 24 [object invoke $
197c0 63 6f 75 6e 74 65 72 28 33 29 20 43 6f 75 6e 74 counter(3) Count
197d0 65 72 4e 61 6d 65 5d 20 22 5c 22 20 76 61 6c 75 erName] "\" valu
197e0 65 20 69 73 20 22 20 5c 0d 0a 20 20 20 20 20 20 e is " \..
197f0 20 20 20 20 20 20 5b 6f 62 6a 65 63 74 20 69 6e [object in
19800 76 6f 6b 65 20 24 63 6f 75 6e 74 65 72 28 33 29 voke $counter(3)
19810 20 52 61 77 56 61 6c 75 65 5d 20 5c 6e 5d 0d 0a RawValue] \n]..
19820 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
19830 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 6f 6c 6c ... proc coll
19840 65 63 74 47 61 72 62 61 67 65 20 7b 20 63 68 61 ectGarbage { cha
19850 6e 6e 65 6c 20 7b 6d 69 6c 6c 69 73 65 63 6f 6e nnel {millisecon
19860 64 73 20 31 30 30 30 7d 20 7b 71 75 69 65 74 20 ds 1000} {quiet
19870 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 true} } {..
19880 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 if {[haveSQLite
19890 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 ObjectCommand]}
198a0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
198b0 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 if {[catch {..
198c0 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 object i
198d0 6e 76 6f 6b 65 20 47 43 20 47 65 74 54 6f 74 61 nvoke GC GetTota
198e0 6c 4d 65 6d 6f 72 79 20 66 61 6c 73 65 0d 0a 20 lMemory false..
198f0 20 20 20 20 20 20 20 7d 20 72 65 73 75 6c 74 5d } result]
19900 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
19910 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
19920 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
19930 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
19940 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
19950 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
19960 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6d 65 "---- me
19970 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 79 20 74 mory in use by t
19980 68 65 20 43 4c 52 20 62 65 66 6f 72 65 20 63 6f he CLR before co
19990 6c 6c 65 63 74 69 6f 6e 2e 2e 2e 20 22 20 5c 0d llection... " \.
199a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
199b0 20 24 72 65 73 75 6c 74 20 22 20 62 79 74 65 73 $result " bytes
199c0 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
199d0 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 }.. } els
199e0 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 e {.. t
199f0 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
19a00 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
19a10 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d "====
19a20 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 WARNING: failed
19a30 20 74 6f 20 67 65 74 20 43 4c 52 20 6d 65 6d 6f to get CLR memo
19a40 72 79 20 75 73 61 67 65 2c 20 65 72 72 6f 72 3a ry usage, error:
19a50 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 " \..
19a60 20 20 20 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 \n\t $result
19a70 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d \n].. }.
19a80 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
19a90 20 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ##############
19aa0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19ab0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19ac0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19ad0 23 23 23 23 23 23 23 23 23 23 23 0d 0a 0d 0a 20 ###########....
19ae0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
19af0 4e 4f 54 45 3a 20 52 65 70 65 61 74 65 64 6c 79 NOTE: Repeatedly
19b00 20 61 74 74 65 6d 70 74 20 74 6f 20 63 6f 6c 6c attempt to coll
19b10 65 63 74 20 67 61 72 62 61 67 65 20 75 6e 74 69 ect garbage unti
19b20 6c 20 74 68 65 20 61 6c 6c 6f 74 74 65 64 20 6e l the allotted n
19b30 75 6d 62 65 72 0d 0a 20 20 20 20 20 20 23 20 20 umber.. #
19b40 20 20 20 20 20 6f 66 20 6d 69 6c 6c 69 73 65 63 of millisec
19b50 6f 6e 64 73 20 68 61 73 20 65 6c 61 70 73 65 64 onds has elapsed
19b60 2e 20 20 41 6c 77 61 79 73 20 61 74 74 65 6d 70 . Always attemp
19b70 74 20 74 6f 20 63 6f 6c 6c 65 63 74 20 67 61 72 t to collect gar
19b80 62 61 67 65 0d 0a 20 20 20 20 20 20 23 20 20 20 bage.. #
19b90 20 20 20 20 61 74 20 6c 65 61 73 74 20 6f 6e 63 at least onc
19ba0 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e... #..
19bb0 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 if {[haveSQLi
19bc0 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d teObjectCommand]
19bd0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
19be0 20 20 73 65 74 20 73 74 61 72 74 20 5b 63 6c 6f set start [clo
19bf0 63 6b 20 73 65 63 6f 6e 64 73 5d 0d 0a 20 20 20 ck seconds]..
19c00 20 20 20 20 20 73 65 74 20 73 74 6f 70 20 5b 65 set stop [e
19c10 78 70 72 20 7b 24 73 74 61 72 74 20 2b 20 28 24 xpr {$start + ($
19c20 6d 69 6c 6c 69 73 65 63 6f 6e 64 73 20 2f 20 31 milliseconds / 1
19c30 30 30 30 29 7d 5d 0d 0a 0d 0a 20 20 20 20 20 20 000)}]....
19c40 20 20 64 6f 20 7b 0d 0a 20 20 20 20 20 20 20 20 do {..
19c50 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
19c60 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 NOTE: Attempt t
19c70 6f 20 66 6f 72 63 65 20 61 20 66 75 6c 6c 20 67 o force a full g
19c80 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f arbage collectio
19c90 6e 20 6e 6f 77 2e 20 20 52 65 70 6f 72 74 20 61 n now. Report a
19ca0 6e 79 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 ny.. #
19cb0 20 20 20 20 20 20 65 72 72 6f 72 20 74 68 61 74 error that
19cc0 20 69 73 20 65 6e 63 6f 75 6e 74 65 72 65 64 20 is encountered
19cd0 69 66 20 77 65 20 66 61 69 6c 2e 0d 0a 20 20 20 if we fail...
19ce0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
19cf0 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
19d00 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6f 62 .. ob
19d10 6a 65 63 74 20 69 6e 76 6f 6b 65 20 47 43 20 47 ject invoke GC G
19d20 65 74 54 6f 74 61 6c 4d 65 6d 6f 72 79 20 74 72 etTotalMemory tr
19d30 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 ue.. }
19d40 65 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a error]} then {..
19d50 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
19d60 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
19d70 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
19d80 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
19d90 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
19da0 66 75 6c 6c 20 67 61 72 62 61 67 65 20 63 6f 6c full garbage col
19db0 6c 65 63 74 69 6f 6e 2c 20 65 72 72 6f 72 3a 20 lection, error:
19dc0 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
19dd0 20 20 20 20 20 5c 6e 5c 74 20 24 65 72 72 6f 72 \n\t $error
19de0 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
19df0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 73 }.... s
19e00 65 74 20 6e 6f 77 20 5b 63 6c 6f 63 6b 20 73 65 et now [clock se
19e10 63 6f 6e 64 73 5d 0d 0a 20 20 20 20 20 20 20 20 conds]..
19e20 7d 20 77 68 69 6c 65 20 7b 24 73 74 61 72 74 20 } while {$start
19e30 3c 3d 20 24 6e 6f 77 20 26 26 20 24 6e 6f 77 20 <= $now && $now
19e40 3c 20 24 73 74 6f 70 7d 0d 0a 20 20 20 20 20 20 < $stop}..
19e50 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 23 23 23 23 }.... #####
19e60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19e70 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19e80 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19e90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
19ea0 23 23 23 23 0d 0a 0d 0a 20 20 20 20 20 20 69 66 ####.... if
19eb0 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a {[haveSQLiteObj
19ec0 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 ectCommand]} the
19ed0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
19ee0 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
19ef0 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
19f00 6b 65 20 47 43 20 47 65 74 54 6f 74 61 6c 4d 65 ke GC GetTotalMe
19f10 6d 6f 72 79 20 66 61 6c 73 65 0d 0a 20 20 20 20 mory false..
19f20 20 20 20 20 7d 20 72 65 73 75 6c 74 5d 20 3d 3d } result] ==
19f30 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
19f40 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
19f50 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
19f60 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
19f70 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
19f80 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
19f90 20 20 20 20 20 22 2d 2d 2d 2d 20 6d 65 6d 6f 72 "---- memor
19fa0 79 20 69 6e 20 75 73 65 20 62 79 20 74 68 65 20 y in use by the
19fb0 43 4c 52 20 61 66 74 65 72 20 63 6f 6c 6c 65 63 CLR after collec
19fc0 74 69 6f 6e 2e 2e 2e 20 22 20 5c 0d 0a 20 20 20 tion... " \..
19fd0 20 20 20 20 20 20 20 20 20 20 20 20 20 24 72 65 $re
19fe0 73 75 6c 74 20 22 20 62 79 74 65 73 5c 6e 22 5d sult " bytes\n"]
19ff0 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1a000 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
1a010 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
1a020 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
1a030 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
1a040 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 "==== WAR
1a050 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 NING: failed to
1a060 67 65 74 20 43 4c 52 20 6d 65 6d 6f 72 79 20 75 get CLR memory u
1a070 73 61 67 65 2c 20 65 72 72 6f 72 3a 20 22 20 5c sage, error: " \
1a080 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1a090 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d \n\t $result \n]
1a0a0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
1a0b0 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
1a0c0 20 20 20 20 70 72 6f 63 20 67 65 74 53 51 4c 69 proc getSQLi
1a0d0 74 65 48 61 6e 64 6c 65 43 6f 75 6e 74 73 20 7b teHandleCounts {
1a0e0 20 63 68 61 6e 6e 65 6c 20 7b 71 75 69 65 74 20 channel {quiet
1a0f0 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 false} } {..
1a100 20 20 73 65 74 20 72 65 73 75 6c 74 20 5b 6c 69 set result [li
1a110 73 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 st].... if
1a120 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 {[haveSQLiteObje
1a130 63 74 43 6f 6d 6d 61 6e 64 5d 20 26 26 20 5c 0d ctCommand] && \.
1a140 0a 20 20 20 20 20 20 20 20 20 20 5b 68 61 76 65 . [have
1a150 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 SQLiteDefineCons
1a160 74 61 6e 74 20 43 4f 55 4e 54 5f 48 41 4e 44 4c tant COUNT_HANDL
1a170 45 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 E]} then {..
1a180 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
1a190 20 4e 4f 54 45 3a 20 41 64 64 20 65 61 63 68 20 NOTE: Add each
1a1a0 63 72 69 74 69 63 61 6c 20 68 61 6e 64 6c 65 20 critical handle
1a1b0 63 6f 75 6e 74 20 74 6f 20 74 68 65 20 72 65 73 count to the res
1a1c0 75 6c 74 69 6e 67 20 6c 69 73 74 2e 0d 0a 20 20 ulting list...
1a1d0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1a1e0 20 66 6f 72 65 61 63 68 20 6e 61 6d 65 20 5b 6c foreach name [l
1a1f0 69 73 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 43 6f ist connectionCo
1a200 75 6e 74 20 73 74 61 74 65 6d 65 6e 74 43 6f 75 unt statementCou
1a210 6e 74 20 62 61 63 6b 75 70 43 6f 75 6e 74 5d 20 nt backupCount]
1a220 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 {.. if
1a230 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
1a240 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
1a250 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e voke -flags +Non
1a260 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 Public \..
1a270 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
1a280 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 44 65 62 .Data.SQLite.Deb
1a290 75 67 44 61 74 61 20 24 6e 61 6d 65 0d 0a 20 20 ugData $name..
1a2a0 20 20 20 20 20 20 20 20 7d 20 76 61 6c 75 65 5d } value]
1a2b0 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
1a2c0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
1a2d0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1a2e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
1a2f0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
1a300 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
1a310 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
1a320 2d 2d 2d 20 63 72 69 74 69 63 61 6c 20 68 61 6e --- critical han
1a330 64 6c 65 20 63 6f 75 6e 74 20 5c 22 22 20 24 6e dle count \"" $n
1a340 61 6d 65 20 22 5c 22 20 69 73 20 22 20 24 76 61 ame "\" is " $va
1a350 6c 75 65 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 lue \n]..
1a360 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1a370 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 72 65 lappend re
1a380 73 75 6c 74 20 24 76 61 6c 75 65 0d 0a 20 20 20 sult $value..
1a390 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
1a3a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
1a3b0 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
1a3c0 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
1a3d0 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d "====
1a3e0 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 WARNING: failed
1a3f0 20 74 6f 20 67 65 74 20 63 72 69 74 69 63 61 6c to get critical
1a400 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 20 5c 22 handle count \"
1a410 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
1a420 20 20 20 20 20 24 6e 61 6d 65 20 22 5c 22 2c 20 $name "\",
1a430 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 76 error: " \n\t $v
1a440 61 6c 75 65 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 alue \n]..
1a450 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1a460 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 .. } elseif
1a470 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
1a480 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
1a490 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 # NOTE: Th
1a4a0 65 20 61 63 74 75 61 6c 20 68 61 6e 64 6c 65 20 e actual handle
1a4b0 63 6f 75 6e 74 73 20 61 72 65 20 6e 6f 74 20 61 counts are not a
1a4c0 76 61 69 6c 61 62 6c 65 3b 20 74 68 65 72 65 66 vailable; theref
1a4d0 6f 72 65 2c 20 6a 75 73 74 0d 0a 20 20 20 20 20 ore, just..
1a4e0 20 20 20 23 20 20 20 20 20 20 20 72 65 74 75 72 # retur
1a4f0 6e 20 61 6e 20 65 6d 70 74 79 20 6c 69 73 74 2e n an empty list.
1a500 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1a510 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1a520 6e 65 6c 20 22 2d 2d 2d 2d 20 63 72 69 74 69 63 nel "---- critic
1a530 61 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 73 al handle counts
1a540 20 75 6e 61 76 61 69 6c 61 62 6c 65 5c 6e 22 0d unavailable\n".
1a550 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
1a560 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 6c 74 return $result
1a570 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
1a580 70 72 6f 63 20 73 68 75 74 64 6f 77 6e 53 51 4c proc shutdownSQL
1a590 69 74 65 20 7b 20 63 68 61 6e 6e 65 6c 20 7b 66 ite { channel {f
1a5a0 6f 72 63 65 20 66 61 6c 73 65 7d 20 7b 71 75 69 orce false} {qui
1a5b0 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 et false} } {..
1a5c0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
1a5d0 4e 4f 54 45 3a 20 4d 61 6b 65 20 73 75 72 65 20 NOTE: Make sure
1a5e0 74 68 61 74 20 53 51 4c 69 74 65 20 63 6f 72 65 that SQLite core
1a5f0 20 6c 69 62 72 61 72 79 20 69 73 20 63 6f 6d 70 library is comp
1a600 6c 65 74 65 6c 79 20 73 68 75 74 64 6f 77 6e 2e letely shutdown.
1a610 20 20 54 68 69 73 0d 0a 20 20 20 20 20 20 23 20 This.. #
1a620 20 20 20 20 20 20 69 73 20 75 73 65 64 20 62 79 is used by
1a630 20 74 65 73 74 73 20 74 68 61 74 20 63 68 61 6e tests that chan
1a640 67 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e ge configuration
1a650 20 6f 70 74 69 6f 6e 73 20 61 6e 64 2f 6f 72 20 options and/or
1a660 74 68 6f 73 65 0d 0a 20 20 20 20 20 20 23 20 20 those.. #
1a670 20 20 20 20 20 74 68 61 74 20 6e 65 65 64 20 74 that need t
1a680 6f 20 6d 61 6b 65 20 73 75 72 65 20 6c 6f 67 67 o make sure logg
1a690 69 6e 67 20 69 73 20 69 6e 69 74 69 61 6c 69 7a ing is initializ
1a6a0 65 64 20 28 69 2e 65 2e 20 6a 75 73 74 20 69 6e ed (i.e. just in
1a6b0 20 63 61 73 65 0d 0a 20 20 20 20 20 20 23 20 20 case.. #
1a6c0 20 20 20 20 20 74 68 65 20 53 51 4c 69 74 65 20 the SQLite
1a6d0 63 6f 72 65 20 6c 69 62 72 61 72 79 20 77 61 73 core library was
1a6e0 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 69 6e 20 initialized in
1a6f0 74 68 65 20 70 72 6f 63 65 73 73 20 70 72 69 6f the process prio
1a700 72 20 74 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 r to.. #
1a710 20 20 20 20 74 68 65 20 53 51 4c 69 74 65 4c 6f the SQLiteLo
1a720 67 20 63 6c 61 73 73 20 62 65 69 6e 67 20 61 62 g class being ab
1a730 6c 65 20 74 6f 20 73 65 74 75 70 20 69 74 73 20 le to setup its
1a740 6c 6f 67 67 69 6e 67 20 63 61 6c 6c 62 61 63 6b logging callback
1a750 29 2e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 )... #
1a760 20 20 4e 6f 72 6d 61 6c 6c 79 2c 20 74 68 69 73 Normally, this
1a770 20 73 68 6f 75 6c 64 20 6f 6e 6c 79 20 62 65 20 should only be
1a780 70 65 72 66 6f 72 6d 65 64 20 69 66 20 53 51 4c performed if SQL
1a790 69 74 65 20 69 73 20 6c 6f 61 64 65 64 20 61 6e ite is loaded an
1a7a0 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 d.. #
1a7b0 20 72 65 61 64 79 20 66 6f 72 20 75 73 65 20 62 ready for use b
1a7c0 79 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 y the test suite
1a7d0 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
1a7e0 20 20 69 66 20 7b 24 66 6f 72 63 65 20 7c 7c 20 if {$force ||
1a7f0 5b 69 73 53 51 4c 69 74 65 52 65 61 64 79 5d 7d [isSQLiteReady]}
1a800 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1a810 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 42 55 #.. # BU
1a820 47 46 49 58 3a 20 4d 61 6b 65 20 73 75 72 65 20 GFIX: Make sure
1a830 74 68 61 74 20 61 6e 79 20 22 6c 65 61 6b 65 64 that any "leaked
1a840 22 20 74 72 61 6e 73 61 63 74 69 6f 6e 73 20 61 " transactions a
1a850 6e 64 2f 6f 72 20 63 6f 6e 6e 65 63 74 69 6f 6e nd/or connection
1a860 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 s.. #
1a870 20 20 20 20 20 61 72 65 20 63 6c 65 61 6e 65 64 are cleaned
1a880 20 75 70 20 62 65 66 6f 72 65 20 63 61 6c 6c 69 up before calli
1a890 6e 67 20 74 68 65 20 6e 61 74 69 76 65 20 73 68 ng the native sh
1a8a0 75 74 64 6f 77 6e 20 66 75 6e 63 74 69 6f 6e 2e utdown function.
1a8b0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1a8c0 20 20 20 20 20 66 6f 72 65 61 63 68 20 74 72 61 foreach tra
1a8d0 6e 73 61 63 74 69 6f 6e 20 5b 69 6e 66 6f 20 74 nsaction [info t
1a8e0 72 61 6e 73 61 63 74 69 6f 6e 73 5d 20 7b 0d 0a ransactions] {..
1a8f0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 if {[s
1a900 74 72 69 6e 67 20 6d 61 74 63 68 20 5c 0d 0a 20 tring match \..
1a910 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 Sys
1a920 74 65 6d 23 44 61 74 61 23 53 51 4c 69 74 65 23 tem#Data#SQLite#
1a930 53 51 4c 69 74 65 54 72 61 6e 73 61 63 74 69 6f SQLiteTransactio
1a940 6e 23 2a 20 24 74 72 61 6e 73 61 63 74 69 6f 6e n#* $transaction
1a950 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1a960 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
1a970 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 h {..
1a980 20 20 20 73 71 6c 20 74 72 61 6e 73 61 63 74 69 sql transacti
1a990 6f 6e 20 72 6f 6c 6c 62 61 63 6b 20 24 74 72 61 on rollback $tra
1a9a0 6e 73 61 63 74 69 6f 6e 0d 0a 20 20 20 20 20 20 nsaction..
1a9b0 20 20 20 20 20 20 7d 20 65 72 72 6f 72 5d 20 3d } error] =
1a9c0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
1a9d0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
1a9e0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1a9f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1aa00 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1aa10 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1aa20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1aa30 20 20 22 2d 2d 2d 2d 20 72 6f 6c 6c 65 64 20 62 "---- rolled b
1aa40 61 63 6b 20 6c 65 61 6b 65 64 20 74 72 61 6e 73 ack leaked trans
1aa50 61 63 74 69 6f 6e 20 5c 22 22 20 5c 0d 0a 20 20 action \"" \..
1aa60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1aa70 20 20 24 74 72 61 6e 73 61 63 74 69 6f 6e 20 5c $transaction \
1aa80 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 "\n]..
1aa90 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
1aaa0 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
1aab0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
1aac0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1aad0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1aae0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1aaf0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1ab00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ab10 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a "==== WARNING:
1ab20 20 66 61 69 6c 65 64 20 74 6f 20 72 6f 6c 6c 62 failed to rollb
1ab30 61 63 6b 20 6c 65 61 6b 65 64 20 74 72 61 6e 73 ack leaked trans
1ab40 61 63 74 69 6f 6e 20 5c 22 22 20 5c 0d 0a 20 20 action \"" \..
1ab50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ab60 20 20 24 74 72 61 6e 73 61 63 74 69 6f 6e 20 22 $transaction "
1ab70 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c \", error: " \n\
1ab80 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 t $error \n]..
1ab90 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
1aba0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
1abb0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1abc0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1abd0 66 6f 72 65 61 63 68 20 64 62 20 5b 69 6e 66 6f foreach db [info
1abe0 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 5d 20 7b 0d connections] {.
1abf0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
1ac00 73 74 72 69 6e 67 20 6d 61 74 63 68 20 5c 0d 0a string match \..
1ac10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 Sy
1ac20 73 74 65 6d 23 44 61 74 61 23 53 51 4c 69 74 65 stem#Data#SQLite
1ac30 23 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f #SQLiteConnectio
1ac40 6e 23 2a 20 24 64 62 5d 7d 20 74 68 65 6e 20 7b n#* $db]} then {
1ac50 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
1ac60 20 7b 5b 63 61 74 63 68 20 7b 73 71 6c 20 63 6c {[catch {sql cl
1ac70 6f 73 65 20 24 64 62 7d 20 65 72 72 6f 72 5d 20 ose $db} error]
1ac80 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
1ac90 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
1aca0 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
1acb0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1acc0 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
1acd0 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
1ace0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1acf0 20 20 20 22 2d 2d 2d 2d 20 63 6c 6f 73 65 64 20 "---- closed
1ad00 6c 65 61 6b 65 64 20 64 61 74 61 62 61 73 65 20 leaked database
1ad10 5c 22 22 20 24 64 62 20 5c 22 5c 6e 5d 0d 0a 20 \"" $db \"\n]..
1ad20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
1ad30 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c } el
1ad40 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
1ad50 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
1ad60 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1ad70 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1ad80 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1ad90 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
1ada0 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d "====
1adb0 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 WARNING: failed
1adc0 20 74 6f 20 63 6c 6f 73 65 20 6c 65 61 6b 65 64 to close leaked
1add0 20 64 61 74 61 62 61 73 65 20 5c 22 22 20 5c 0d database \"" \.
1ade0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1adf0 20 20 20 20 20 24 64 62 20 22 5c 22 2c 20 65 72 $db "\", er
1ae00 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 ror: " \n\t $err
1ae10 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 or \n]..
1ae20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1ae30 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1ae40 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
1ae50 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1ae60 20 20 20 20 20 23 20 42 55 47 46 49 58 3a 20 42 # BUGFIX: B
1ae70 65 66 6f 72 65 20 63 61 6c 6c 69 6e 67 20 74 68 efore calling th
1ae80 65 20 6e 61 74 69 76 65 20 73 68 75 74 64 6f 77 e native shutdow
1ae90 6e 20 66 75 6e 63 74 69 6f 6e 2c 20 6d 61 6b 65 n function, make
1aea0 20 73 75 72 65 20 62 6f 74 68 0d 0a 20 20 20 20 sure both..
1aeb0 20 20 20 20 23 20 20 20 20 20 20 20 20 20 6f 66 # of
1aec0 20 74 68 65 20 50 52 41 47 4d 41 20 72 65 6c 61 the PRAGMA rela
1aed0 74 65 64 20 64 69 72 65 63 74 6f 72 79 20 6e 61 ted directory na
1aee0 6d 65 73 20 61 72 65 20 66 72 65 65 64 2e 0d 0a mes are freed...
1aef0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1af00 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 checkForSQLit
1af10 65 44 69 72 65 63 74 6f 72 69 65 73 20 24 63 68 eDirectories $ch
1af20 61 6e 6e 65 6c 20 74 72 75 65 0d 0a 0d 0a 20 20 annel true....
1af30 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
1af40 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 {.. ob
1af50 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 ject invoke -fla
1af60 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d gs +NonPublic \.
1af70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 . S
1af80 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1af90 65 2e 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 e.UnsafeNativeMe
1afa0 74 68 6f 64 73 20 73 71 6c 69 74 65 33 5f 73 68 thods sqlite3_sh
1afb0 75 74 64 6f 77 6e 0d 0a 20 20 20 20 20 20 20 20 utdown..
1afc0 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 } result] == 0}
1afd0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1afe0 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
1aff0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1b000 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
1b010 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
1b020 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1b030 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 "---- call sqli
1b040 74 65 33 5f 73 68 75 74 64 6f 77 6e 28 29 2e 2e te3_shutdown()..
1b050 2e 20 6f 6b 3a 20 22 20 24 72 65 73 75 6c 74 20 . ok: " $result
1b060 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
1b070 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
1b080 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 {.. if
1b090 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
1b0a0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
1b0b0 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
1b0c0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
1b0d0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
1b0e0 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 5f -- call sqlite3_
1b0f0 73 68 75 74 64 6f 77 6e 28 29 2e 2e 2e 20 65 72 shutdown()... er
1b100 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 72 65 73 ror: " \n\t $res
1b110 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ult \n]..
1b120 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
1b130 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d . }.. }.
1b140 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 65 70 .... proc rep
1b150 6f 72 74 53 51 4c 69 74 65 52 65 73 6f 75 72 63 ortSQLiteResourc
1b160 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
1b170 20 20 63 68 61 6e 6e 65 6c 20 7b 71 75 69 65 74 channel {quiet
1b180 20 66 61 6c 73 65 7d 20 7b 72 65 73 65 74 20 74 false} {reset t
1b190 72 75 65 7d 20 7b 63 6f 6c 6c 65 63 74 20 74 72 rue} {collect tr
1b1a0 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ue} } {.. #
1b1b0 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
1b1c0 49 66 20 61 76 61 69 6c 61 62 6c 65 2c 20 72 65 If available, re
1b1d0 70 6f 72 74 20 6f 6e 20 28 61 6e 64 20 70 6f 73 port on (and pos
1b1e0 73 69 62 6c 79 20 72 65 73 65 74 29 20 74 68 65 sibly reset) the
1b1f0 20 72 75 6e 74 69 6d 65 0d 0a 20 20 20 20 20 20 runtime..
1b200 23 20 20 20 20 20 20 20 63 6f 6e 66 69 67 75 72 # configur
1b210 61 74 69 6f 6e 20 73 74 61 74 69 73 74 69 63 73 ation statistics
1b220 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
1b230 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 if {[haveSQLit
1b240 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 20 eObjectCommand]
1b250 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
1b260 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 [haveConstraint
1b270 62 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 74 69 buildConfigurati
1b280 6f 6e 2e 44 65 62 75 67 5d 20 26 26 20 5b 63 61 on.Debug] && [ca
1b290 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f tch {.. o
1b2a0 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c bject invoke -fl
1b2b0 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 2d ags +NonPublic -
1b2c0 61 6c 69 61 73 20 5c 0d 0a 20 20 20 20 20 20 20 alias \..
1b2d0 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
1b2e0 2e 53 51 4c 69 74 65 2e 44 65 62 75 67 44 61 74 .SQLite.DebugDat
1b2f0 61 20 73 65 74 74 69 6e 67 52 65 61 64 43 6f 75 a settingReadCou
1b300 6e 74 73 0d 0a 20 20 20 20 20 20 7d 20 73 65 74 nts.. } set
1b310 74 69 6e 67 52 65 61 64 43 6f 75 6e 74 73 5d 20 tingReadCounts]
1b320 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
1b330 20 20 20 20 20 20 73 65 74 20 6e 61 6d 65 43 6f set nameCo
1b340 75 6e 74 20 5b 24 73 65 74 74 69 6e 67 52 65 61 unt [$settingRea
1b350 64 43 6f 75 6e 74 73 20 43 6f 75 6e 74 5d 0d 0a dCounts Count]..
1b360 20 20 20 20 20 20 20 20 73 65 74 20 76 61 6c 75 set valu
1b370 65 43 6f 75 6e 74 20 30 0d 0a 0d 0a 20 20 20 20 eCount 0....
1b380 20 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 61 object forea
1b390 63 68 20 2d 61 6c 69 61 73 20 70 61 69 72 20 24 ch -alias pair $
1b3a0 73 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e 74 settingReadCount
1b3b0 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 s {.. i
1b3c0 6e 63 72 20 76 61 6c 75 65 43 6f 75 6e 74 20 5b ncr valueCount [
1b3d0 24 70 61 69 72 20 56 61 6c 75 65 5d 0d 0a 0d 0a $pair Value]....
1b3e0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
1b3f0 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
1b400 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
1b410 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
1b420 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
1b430 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
1b440 65 74 74 69 6e 67 20 5c 22 22 20 5b 24 70 61 69 etting \"" [$pai
1b450 72 20 4b 65 79 5d 20 22 5c 22 20 77 61 73 20 72 r Key] "\" was r
1b460 65 61 64 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 ead " \..
1b470 20 20 20 20 20 20 20 20 20 5b 24 70 61 69 72 20 [$pair
1b480 56 61 6c 75 65 5d 20 22 20 74 69 6d 65 73 5c 6e Value] " times\n
1b490 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d "].. }.
1b4a0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
1b4b0 20 20 20 20 20 20 69 66 20 7b 24 72 65 73 65 74 if {$reset
1b4c0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1b4d0 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
1b4e0 24 73 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e $settingReadCoun
1b4f0 74 73 20 43 6c 65 61 72 7d 20 65 72 72 6f 72 5d ts Clear} error]
1b500 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
1b510 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
1b520 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1b530 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
1b540 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
1b550 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
1b560 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
1b570 2d 2d 2d 20 72 65 73 65 74 20 73 65 74 74 69 6e --- reset settin
1b580 67 20 73 74 61 74 69 73 74 69 63 73 20 66 6f 72 g statistics for
1b590 20 74 68 65 20 70 72 65 76 69 6f 75 73 20 22 20 the previous "
1b5a0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1b5b0 20 20 20 20 20 24 6e 61 6d 65 43 6f 75 6e 74 20 $nameCount
1b5c0 22 20 6e 61 6d 65 73 20 61 6e 64 20 22 20 24 76 " names and " $v
1b5d0 61 6c 75 65 43 6f 75 6e 74 20 22 20 76 61 6c 75 alueCount " valu
1b5e0 65 73 20 72 65 61 64 5c 6e 22 5d 0d 0a 20 20 20 es read\n"]..
1b5f0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1b600 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
1b610 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1b620 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
1b630 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1b640 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
1b650 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
1b660 74 6f 20 72 65 73 65 74 20 73 65 74 74 69 6e 67 to reset setting
1b670 20 73 74 61 74 69 73 74 69 63 73 20 66 6f 72 20 statistics for
1b680 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
1b690 20 20 20 20 20 22 74 68 65 20 70 72 65 76 69 6f "the previo
1b6a0 75 73 20 22 20 24 6e 61 6d 65 43 6f 75 6e 74 20 us " $nameCount
1b6b0 22 20 6e 61 6d 65 73 20 61 6e 64 20 22 20 24 76 " names and " $v
1b6c0 61 6c 75 65 43 6f 75 6e 74 20 5c 0d 0a 20 20 20 alueCount \..
1b6d0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 20 76 " v
1b6e0 61 6c 75 65 73 20 72 65 61 64 2c 20 65 72 72 6f alues read, erro
1b6f0 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 r: " \n\t $error
1b700 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
1b710 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
1b720 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 }.... i
1b730 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 f {[haveSQLiteOb
1b740 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 20 26 26 20 jectCommand] &&
1b750 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 68 61 \.. [ha
1b760 76 65 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f veSQLiteDefineCo
1b770 6e 73 74 61 6e 74 20 49 4e 54 45 52 4f 50 5f 56 nstant INTEROP_V
1b780 49 52 54 55 41 4c 5f 54 41 42 4c 45 5d 20 26 26 IRTUAL_TABLE] &&
1b790 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 68 \.. [h
1b7a0 61 76 65 53 51 4c 69 74 65 44 65 66 69 6e 65 43 aveSQLiteDefineC
1b7b0 6f 6e 73 74 61 6e 74 20 54 52 41 43 4b 5f 4d 45 onstant TRACK_ME
1b7c0 4d 4f 52 59 5f 42 59 54 45 53 5d 7d 20 74 68 65 MORY_BYTES]} the
1b7d0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
1b7e0 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
1b7f0 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
1b800 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d s $channel "----
1b810 20 63 75 72 72 65 6e 74 20 6d 65 6d 6f 72 79 20 current memory
1b820 69 6e 20 75 73 65 20 62 79 20 53 51 4c 69 74 65 in use by SQLite
1b830 4d 65 6d 6f 72 79 2e 2e 2e 20 22 0d 0a 20 20 20 Memory... "..
1b840 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1b850 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
1b860 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
1b870 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
1b880 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 NonPublic \..
1b890 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 Syste
1b8a0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 m.Data.SQLite.SQ
1b8b0 4c 69 74 65 4d 65 6d 6f 72 79 20 62 79 74 65 73 LiteMemory bytes
1b8c0 41 6c 6c 6f 63 61 74 65 64 0d 0a 20 20 20 20 20 Allocated..
1b8d0 20 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 } memory] ==
1b8e0 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
1b8f0 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
1b900 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1b910 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1b920 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1b930 20 24 6d 65 6d 6f 72 79 20 22 20 62 79 74 65 73 $memory " bytes
1b940 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
1b950 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 }.. } els
1b960 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 e {.. s
1b970 65 74 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 et memory unknow
1b980 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 n.... i
1b990 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
1b9a0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1b9b0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1b9c0 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f appendArgs $memo
1b9d0 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 ry \n]..
1b9e0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
1b9f0 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 .. if {!$
1ba00 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
1ba10 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1ba20 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 6d 61 channel "---- ma
1ba30 78 69 6d 75 6d 20 6d 65 6d 6f 72 79 20 69 6e 20 ximum memory in
1ba40 75 73 65 20 62 79 20 53 51 4c 69 74 65 4d 65 6d use by SQLiteMem
1ba50 6f 72 79 2e 2e 2e 20 22 0d 0a 20 20 20 20 20 20 ory... "..
1ba60 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
1ba70 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
1ba80 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
1ba90 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e voke -flags +Non
1baa0 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 Public \..
1bab0 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
1bac0 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 ata.SQLite.SQLit
1bad0 65 4d 65 6d 6f 72 79 20 6d 61 78 69 6d 75 6d 42 eMemory maximumB
1bae0 79 74 65 73 41 6c 6c 6f 63 61 74 65 64 0d 0a 20 ytesAllocated..
1baf0 20 20 20 20 20 20 20 7d 20 6d 65 6d 6f 72 79 5d } memory]
1bb00 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
1bb10 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
1bb20 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
1bb30 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
1bb40 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
1bb50 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 22 20 62 Args $memory " b
1bb60 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 ytes\n"]..
1bb70 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1bb80 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
1bb90 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e set memory un
1bba0 6b 6e 6f 77 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 known....
1bbb0 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
1bbc0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1bbd0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1bbe0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 el [appendArgs $
1bbf0 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 memory \n]..
1bc00 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1bc10 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }.. }....
1bc20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
1bc30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1bc40 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1bc50 20 22 2d 2d 2d 2d 20 63 75 72 72 65 6e 74 20 6d "---- current m
1bc60 65 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 79 20 emory in use by
1bc70 53 51 4c 69 74 65 2e 2e 2e 20 22 0d 0a 20 20 20 SQLite... "..
1bc80 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 }.... if
1bc90 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a {[haveSQLiteObj
1bca0 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 ectCommand]} the
1bcb0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
1bcc0 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
1bcd0 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
1bce0 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
1bcf0 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 blic \..
1bd00 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 System.Dat
1bd10 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e a.SQLite.UnsafeN
1bd20 61 74 69 76 65 4d 65 74 68 6f 64 73 20 73 71 6c ativeMethods sql
1bd30 69 74 65 33 5f 6d 65 6d 6f 72 79 5f 75 73 65 64 ite3_memory_used
1bd40 0d 0a 20 20 20 20 20 20 20 20 7d 20 6d 65 6d 6f .. } memo
1bd50 72 79 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b ry] == 0} then {
1bd60 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
1bd70 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
1bd80 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
1bd90 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
1bda0 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 endArgs $memory
1bdb0 22 20 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 " bytes\n"]..
1bdc0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1bdd0 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
1bde0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1bdf0 20 20 20 23 20 4e 4f 54 45 3a 20 4d 61 79 62 65 # NOTE: Maybe
1be00 20 74 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 the SQLite core
1be10 20 6c 69 62 72 61 72 79 20 69 73 20 75 6e 61 76 library is unav
1be20 61 69 6c 61 62 6c 65 3f 0d 0a 20 20 20 20 20 20 ailable?..
1be30 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
1be40 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e set memory unkn
1be50 6f 77 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 own....
1be60 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
1be70 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1be80 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1be90 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 [appendArgs $me
1bea0 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 mory \n]..
1beb0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1bec0 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
1bed0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 6d 65 .. set me
1bee0 6d 6f 72 79 20 75 6e 61 76 61 69 6c 61 62 6c 65 mory unavailable
1bef0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
1bf00 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
1bf10 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
1bf20 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
1bf30 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e dArgs $memory \n
1bf40 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 ].. }..
1bf50 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 }.... s
1bf60 65 74 20 72 65 73 75 6c 74 20 24 6d 65 6d 6f 72 et result $memor
1bf70 79 3b 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 y; # NOTE: Retur
1bf80 6e 20 6d 65 6d 6f 72 79 20 69 6e 2d 75 73 65 20 n memory in-use
1bf90 74 6f 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d 0a to our caller...
1bfa0 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 .. if {!$qu
1bfb0 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
1bfc0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1bfd0 6e 65 6c 20 22 2d 2d 2d 2d 20 6d 61 78 69 6d 75 nel "---- maximu
1bfe0 6d 20 6d 65 6d 6f 72 79 20 69 6e 20 75 73 65 20 m memory in use
1bff0 62 79 20 53 51 4c 69 74 65 2e 2e 2e 20 22 0d 0a by SQLite... "..
1c000 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1c010 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 if {[haveSQLite
1c020 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 ObjectCommand]}
1c030 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1c040 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 if {[catch {..
1c050 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 object i
1c060 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f nvoke -flags +No
1c070 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 nPublic \..
1c080 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e System.
1c090 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 Data.SQLite.Unsa
1c0a0 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 20 feNativeMethods
1c0b0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1c0c0 20 73 71 6c 69 74 65 33 5f 6d 65 6d 6f 72 79 5f sqlite3_memory_
1c0d0 68 69 67 68 77 61 74 65 72 20 30 0d 0a 20 20 20 highwater 0..
1c0e0 20 20 20 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d } memory] =
1c0f0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
1c100 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
1c110 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
1c120 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
1c130 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1c140 67 73 20 24 6d 65 6d 6f 72 79 20 22 20 62 79 74 gs $memory " byt
1c150 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 es\n"]..
1c160 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 }.. } e
1c170 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
1c180 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 #.. #
1c190 4e 4f 54 45 3a 20 4d 61 79 62 65 20 74 68 65 20 NOTE: Maybe the
1c1a0 53 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 SQLite core libr
1c1b0 61 72 79 20 69 73 20 75 6e 61 76 61 69 6c 61 62 ary is unavailab
1c1c0 6c 65 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 23 le?.. #
1c1d0 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
1c1e0 6d 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e 0d 0a memory unknown..
1c1f0 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
1c200 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
1c210 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
1c220 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
1c230 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 endArgs $memory
1c240 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
1c250 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
1c260 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
1c270 20 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 set memory
1c280 75 6e 61 76 61 69 6c 61 62 6c 65 0d 0a 0d 0a 20 unavailable....
1c290 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
1c2a0 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
1c2b0 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1c2c0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1c2d0 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 $memory \n]..
1c2e0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
1c2f0 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 63 .... if {$c
1c300 6f 6c 6c 65 63 74 7d 20 74 68 65 6e 20 7b 0d 0a ollect} then {..
1c310 20 20 20 20 20 20 20 20 63 6f 6c 6c 65 63 74 47 collectG
1c320 61 72 62 61 67 65 20 24 63 68 61 6e 6e 65 6c 0d arbage $channel.
1c330 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
1c340 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
1c350 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 hen {.. t
1c360 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d puts $channel "-
1c370 2d 2d 2d 20 63 75 72 72 65 6e 74 20 6d 65 6d 6f --- current memo
1c380 72 79 20 69 6e 20 75 73 65 20 62 79 20 74 68 65 ry in use by the
1c390 20 43 4c 52 2e 2e 2e 20 22 0d 0a 20 20 20 20 20 CLR... "..
1c3a0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b }.... if {
1c3b0 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 [haveSQLiteObjec
1c3c0 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 tCommand]} then
1c3d0 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b {.. if {[
1c3e0 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
1c3f0 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
1c400 20 47 43 20 47 65 74 54 6f 74 61 6c 4d 65 6d 6f GC GetTotalMemo
1c410 72 79 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 ry false..
1c420 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 30 } memory] == 0
1c430 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1c440 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
1c450 69 73 20 69 6e 74 65 67 65 72 20 2d 73 74 72 69 is integer -stri
1c460 63 74 20 24 6d 65 6d 6f 72 79 5d 7d 20 74 68 65 ct $memory]} the
1c470 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1c480 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
1c490 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1c4a0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1c4b0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 el [appendArgs $
1c4c0 6d 65 6d 6f 72 79 20 22 20 62 79 74 65 73 5c 6e memory " bytes\n
1c4d0 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 "]..
1c4e0 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 }.. } e
1c4f0 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
1c500 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 69 6e set memory in
1c510 76 61 6c 69 64 0d 0a 0d 0a 20 20 20 20 20 20 20 valid....
1c520 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
1c530 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1c540 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
1c550 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1c560 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a gs $memory \n]..
1c570 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
1c580 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1c590 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
1c5a0 20 20 20 20 20 20 20 20 73 65 74 20 6d 65 6d 6f set memo
1c5b0 72 79 20 75 6e 6b 6e 6f 77 6e 0d 0a 0d 0a 20 20 ry unknown....
1c5c0 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
1c5d0 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
1c5e0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1c5f0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1c600 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d rgs $memory \n].
1c610 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
1c620 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
1c630 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
1c640 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e 61 76 set memory unav
1c650 61 69 6c 61 62 6c 65 0d 0a 0d 0a 20 20 20 20 20 ailable....
1c660 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
1c670 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1c680 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1c690 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 [appendArgs $me
1c6a0 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 mory \n]..
1c6b0 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
1c6c0 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 return $re
1c6d0 73 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a sult.. }.....
1c6e0 20 20 20 20 70 72 6f 63 20 63 68 65 63 6b 46 6f proc checkFo
1c6f0 72 53 51 4c 69 74 65 44 69 72 65 63 74 6f 72 69 rSQLiteDirectori
1c700 65 73 20 7b 20 63 68 61 6e 6e 65 6c 20 7b 72 65 es { channel {re
1c710 73 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a set false} } {..
1c720 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
1c730 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 NOTE: Check if
1c740 74 68 65 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 the sqlite3_win3
1c750 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 20 2_set_directory
1c760 66 75 6e 63 74 69 6f 6e 20 69 73 20 61 76 61 69 function is avai
1c770 6c 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 23 0d lable... #.
1c780 0a 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 . tputs $ch
1c790 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 annel \..
1c7a0 20 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e "---- checkin
1c7b0 67 20 66 6f 72 20 66 75 6e 63 74 69 6f 6e 20 73 g for function s
1c7c0 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 qlite3_win32_set
1c7d0 5f 64 69 72 65 63 74 6f 72 79 2e 2e 2e 20 22 0d _directory... ".
1c7e0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
1c7f0 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 63 # NOTE: This c
1c800 61 6c 6c 20 74 6f 20 74 68 65 20 73 71 6c 69 74 all to the sqlit
1c810 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 e3_win32_set_dir
1c820 65 63 74 6f 72 79 20 66 75 6e 63 74 69 6f 6e 20 ectory function
1c830 75 73 65 73 20 74 68 65 0d 0a 20 20 20 20 20 20 uses the..
1c840 23 20 20 20 20 20 20 20 69 6e 76 61 6c 69 64 20 # invalid
1c850 76 61 6c 75 65 20 30 20 66 6f 72 20 74 68 65 20 value 0 for the
1c860 66 69 72 73 74 20 61 72 67 75 6d 65 6e 74 2e 20 first argument.
1c870 20 54 68 69 73 20 63 6f 64 65 20 69 73 20 64 65 This code is de
1c880 73 69 67 6e 65 64 0d 0a 20 20 20 20 20 20 23 20 signed.. #
1c890 20 20 20 20 20 20 74 6f 20 63 68 65 63 6b 20 69 to check i
1c8a0 66 20 63 61 6c 6c 69 6e 67 20 74 68 65 20 66 75 f calling the fu
1c8b0 6e 63 74 69 6f 6e 20 77 69 6c 6c 20 72 61 69 73 nction will rais
1c8c0 65 20 61 6e 20 65 78 63 65 70 74 69 6f 6e 20 28 e an exception (
1c8d0 69 2e 65 2e 0d 0a 20 20 20 20 20 20 23 20 20 20 i.e... #
1c8e0 20 20 20 20 74 68 65 20 61 63 74 75 61 6c 20 72 the actual r
1c8f0 65 73 75 6c 74 20 6f 66 20 74 68 65 20 66 75 6e esult of the fun
1c900 63 74 69 6f 6e 20 64 6f 65 73 20 6e 6f 74 20 6d ction does not m
1c910 61 74 74 65 72 20 61 73 20 6c 6f 6e 67 20 61 73 atter as long as
1c920 20 6e 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 20 no.. #
1c930 20 20 20 64 69 72 65 63 74 6f 72 79 20 69 73 20 directory is
1c940 63 68 61 6e 67 65 64 29 2e 0d 0a 20 20 20 20 20 changed)...
1c950 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 #.. if {[i
1c960 73 57 69 6e 64 6f 77 73 5d 20 26 26 20 5b 63 61 sWindows] && [ca
1c970 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f tch {.. o
1c980 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c bject invoke -fl
1c990 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c ags +NonPublic \
1c9a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 79 .. Sy
1c9b0 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
1c9c0 2e 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 .UnsafeNativeMet
1c9d0 68 6f 64 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 hods \..
1c9e0 20 20 20 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 sqlite3_win3
1c9f0 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 20 2_set_directory
1ca00 30 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 7d 5d 0 null.. }]
1ca10 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
1ca20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1ca30 20 20 23 20 4e 4f 54 45 3a 20 43 61 6c 6c 69 6e # NOTE: Callin
1ca40 67 20 74 68 65 20 73 71 6c 69 74 65 33 5f 77 69 g the sqlite3_wi
1ca50 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 n32_set_director
1ca60 79 20 66 75 6e 63 74 69 6f 6e 20 64 6f 65 73 20 y function does
1ca70 6e 6f 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 not.. #
1ca80 20 20 20 20 20 63 61 75 73 65 20 61 6e 20 65 78 cause an ex
1ca90 63 65 70 74 69 6f 6e 3b 20 74 68 65 72 65 66 6f ception; therefo
1caa0 72 65 2c 20 69 74 20 6d 75 73 74 20 62 65 20 61 re, it must be a
1cab0 76 61 69 6c 61 62 6c 65 20 28 69 2e 65 2e 0d 0a vailable (i.e...
1cac0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1cad0 65 76 65 6e 20 74 68 6f 75 67 68 20 69 74 20 73 even though it s
1cae0 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 20 66 hould return a f
1caf0 61 69 6c 75 72 65 20 72 65 74 75 72 6e 20 63 6f ailure return co
1cb00 64 65 20 69 6e 20 74 68 69 73 0d 0a 20 20 20 20 de in this..
1cb10 20 20 20 20 23 20 20 20 20 20 20 20 63 61 73 65 # case
1cb20 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 )... #..
1cb30 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 addConstr
1cb40 61 69 6e 74 20 73 71 6c 69 74 65 33 5f 77 69 6e aint sqlite3_win
1cb50 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 32_set_directory
1cb60 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 .... tput
1cb70 73 20 24 63 68 61 6e 6e 65 6c 20 79 65 73 5c 6e s $channel yes\n
1cb80 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
1cb90 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 # NOTE: D
1cba0 6f 65 73 20 6f 75 72 20 63 61 6c 6c 65 72 20 77 oes our caller w
1cbb0 61 6e 74 20 74 6f 20 72 65 73 65 74 20 74 68 65 ant to reset the
1cbc0 20 64 69 72 65 63 74 6f 72 69 65 73 3f 0d 0a 20 directories?..
1cbd0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1cbe0 20 20 69 66 20 7b 24 72 65 73 65 74 7d 20 74 68 if {$reset} th
1cbf0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1cc00 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
1cc10 4f 54 45 3a 20 4e 6f 77 20 6d 61 6b 65 20 73 75 OTE: Now make su
1cc20 72 65 20 74 68 65 20 64 61 74 61 62 61 73 65 20 re the database
1cc30 61 6e 64 20 74 65 6d 70 6f 72 61 72 79 20 64 69 and temporary di
1cc40 72 65 63 74 6f 72 69 65 73 20 61 72 65 0d 0a 20 rectories are..
1cc50 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
1cc60 20 72 65 73 65 74 20 74 68 65 69 72 20 64 65 66 reset their def
1cc70 61 75 6c 74 20 76 61 6c 75 65 73 2c 20 77 68 69 ault values, whi
1cc80 63 68 20 73 68 6f 75 6c 64 20 62 65 20 6e 75 6c ch should be nul
1cc90 6c 20 66 6f 72 20 62 6f 74 68 2e 0d 0a 20 20 20 l for both...
1cca0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 53 # S
1ccb0 69 6e 63 65 20 74 68 65 20 73 71 6c 69 74 65 33 ince the sqlite3
1ccc0 5f 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 _win32_set_direc
1ccd0 74 6f 72 79 20 66 75 6e 63 74 69 6f 6e 20 69 73 tory function is
1cce0 20 61 76 61 69 6c 61 62 6c 65 2c 0d 0a 20 20 20 available,..
1ccf0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 75 # u
1cd00 73 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 se it...
1cd10 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 66 #.. f
1cd20 6f 72 20 7b 73 65 74 20 69 6e 64 65 78 20 31 7d or {set index 1}
1cd30 20 7b 24 69 6e 64 65 78 20 3c 20 33 7d 20 7b 69 {$index < 3} {i
1cd40 6e 63 72 20 69 6e 64 65 78 7d 20 7b 0d 0a 20 20 ncr index} {..
1cd50 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 if {[c
1cd60 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
1cd70 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 object inv
1cd80 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 oke -flags +NonP
1cd90 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 ublic \..
1cda0 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 Syste
1cdb0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e m.Data.SQLite.Un
1cdc0 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 safeNativeMethod
1cdd0 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
1cde0 20 20 20 20 20 20 20 73 71 6c 69 74 65 33 5f 77 sqlite3_w
1cdf0 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f in32_set_directo
1ce00 72 79 20 24 69 6e 64 65 78 20 6e 75 6c 6c 0d 0a ry $index null..
1ce10 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 72 65 } re
1ce20 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e sult] == 0} then
1ce30 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1ce40 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1ce50 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1ce60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ce70 20 20 22 2d 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c "---- call sql
1ce80 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 ite3_win32_set_d
1ce90 69 72 65 63 74 6f 72 79 28 22 20 24 69 6e 64 65 irectory(" $inde
1cea0 78 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 x \..
1ceb0 20 20 20 20 20 20 20 22 2c 20 6e 75 6c 6c 29 2e ", null).
1cec0 2e 2e 20 6f 6b 3a 20 22 20 24 72 65 73 75 6c 74 .. ok: " $result
1ced0 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
1cee0 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
1cef0 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
1cf00 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
1cf10 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1cf20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1cf30 63 61 6c 6c 20 73 71 6c 69 74 65 33 5f 77 69 6e call sqlite3_win
1cf40 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 32_set_directory
1cf50 28 22 20 24 69 6e 64 65 78 20 5c 0d 0a 20 20 20 (" $index \..
1cf60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1cf70 2c 20 6e 75 6c 6c 29 2e 2e 2e 20 65 72 72 6f 72 , null)... error
1cf80 3a 20 22 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 : " \n\t $result
1cf90 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
1cfa0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
1cfb0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
1cfc0 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
1cfd0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1cfe0 6e 65 6c 20 6e 6f 5c 6e 0d 0a 0d 0a 20 20 20 20 nel no\n....
1cff0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
1d000 20 4e 4f 54 45 3a 20 44 6f 65 73 20 6f 75 72 20 NOTE: Does our
1d010 63 61 6c 6c 65 72 20 77 61 6e 74 20 74 6f 20 72 caller want to r
1d020 65 73 65 74 20 74 68 65 20 64 69 72 65 63 74 6f eset the directo
1d030 72 69 65 73 3f 20 20 54 68 69 73 20 63 61 6e 20 ries? This can
1d040 6f 6e 6c 79 0d 0a 20 20 20 20 20 20 20 20 23 20 only.. #
1d050 20 20 20 20 20 20 62 65 20 70 65 72 66 6f 72 6d be perform
1d060 65 64 20 69 66 20 53 51 4c 69 74 65 20 69 73 20 ed if SQLite is
1d070 6c 6f 61 64 65 64 20 61 6e 64 20 72 65 61 64 79 loaded and ready
1d080 20 66 6f 72 20 75 73 65 20 62 79 20 74 68 65 20 for use by the
1d090 74 65 73 74 0d 0a 20 20 20 20 20 20 20 20 23 20 test.. #
1d0a0 20 20 20 20 20 20 73 75 69 74 65 2e 0d 0a 20 20 suite...
1d0b0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1d0c0 20 69 66 20 7b 24 72 65 73 65 74 20 26 26 20 5b if {$reset && [
1d0d0 69 73 53 51 4c 69 74 65 52 65 61 64 79 5d 7d 20 isSQLiteReady]}
1d0e0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1d0f0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
1d100 20 4e 4f 54 45 3a 20 4e 6f 77 20 6d 61 6b 65 20 NOTE: Now make
1d110 73 75 72 65 20 74 68 65 20 64 61 74 61 62 61 73 sure the databas
1d120 65 20 61 6e 64 20 74 65 6d 70 6f 72 61 72 79 20 e and temporary
1d130 64 69 72 65 63 74 6f 72 69 65 73 20 61 72 65 0d directories are.
1d140 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
1d150 20 20 20 72 65 73 65 74 20 74 68 65 69 72 20 64 reset their d
1d160 65 66 61 75 6c 74 20 76 61 6c 75 65 73 2c 20 77 efault values, w
1d170 68 69 63 68 20 73 68 6f 75 6c 64 20 62 65 20 6e hich should be n
1d180 75 6c 6c 20 66 6f 72 20 62 6f 74 68 2e 0d 0a 20 ull for both...
1d190 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
1d1a0 20 53 69 6e 63 65 20 74 68 65 20 73 71 6c 69 74 Since the sqlit
1d1b0 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 e3_win32_set_dir
1d1c0 65 63 74 6f 72 79 20 66 75 6e 63 74 69 6f 6e 20 ectory function
1d1d0 64 6f 65 73 20 6e 6f 74 0d 0a 20 20 20 20 20 20 does not..
1d1e0 20 20 20 20 23 20 20 20 20 20 20 20 61 70 70 65 # appe
1d1f0 61 72 20 74 6f 20 62 65 20 61 76 61 69 6c 61 62 ar to be availab
1d200 6c 65 2c 20 75 73 65 20 74 68 65 20 61 73 73 6f le, use the asso
1d210 63 69 61 74 65 64 20 50 52 41 47 4d 41 20 63 6f ciated PRAGMA co
1d220 6d 6d 61 6e 64 73 0d 0a 20 20 20 20 20 20 20 20 mmands..
1d230 20 20 23 20 20 20 20 20 20 20 69 6e 73 74 65 61 # instea
1d240 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d d... #.
1d250 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 . forea
1d260 63 68 20 64 69 72 65 63 74 6f 72 79 20 5b 6c 69 ch directory [li
1d270 73 74 20 64 61 74 61 5f 73 74 6f 72 65 5f 64 69 st data_store_di
1d280 72 65 63 74 6f 72 79 20 74 65 6d 70 5f 73 74 6f rectory temp_sto
1d290 72 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 7b 0d re_directory] {.
1d2a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 . set
1d2b0 20 73 71 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 sql [appendArgs
1d2c0 20 22 50 52 41 47 4d 41 20 22 20 24 64 69 72 65 "PRAGMA " $dire
1d2d0 63 74 6f 72 79 20 22 20 3d 20 5c 22 5c 22 3b 22 ctory " = \"\";"
1d2e0 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ]....
1d2f0 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 65 78 65 if {[catch {exe
1d300 63 75 74 65 53 71 6c 20 24 73 71 6c 7d 20 72 65 cuteSql $sql} re
1d310 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e sult] == 0} then
1d320 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1d330 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1d340 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1d350 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1d360 20 20 22 2d 2d 2d 2d 20 65 78 65 63 75 74 65 20 "---- execute
1d370 50 52 41 47 4d 41 20 22 20 24 64 69 72 65 63 74 PRAGMA " $direct
1d380 6f 72 79 20 22 2e 2e 2e 20 6f 6b 3a 20 5c 22 22 ory "... ok: \""
1d390 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1d3a0 20 20 20 20 20 20 24 72 65 73 75 6c 74 20 5c 22 $result \"
1d3b0 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 \n]..
1d3c0 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
1d3d0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1d3e0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1d3f0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
1d400 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 65 "---- e
1d410 78 65 63 75 74 65 20 50 52 41 47 4d 41 20 22 20 xecute PRAGMA "
1d420 24 64 69 72 65 63 74 6f 72 79 20 22 2e 2e 2e 20 $directory "...
1d430 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 error: " \..
1d440 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 6e \n
1d450 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a \t $result \n]..
1d460 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
1d470 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1d480 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
1d490 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
1d4a0 20 23 20 4e 4f 54 45 3a 20 46 69 6e 61 6c 6c 79 # NOTE: Finally
1d4b0 2c 20 73 68 6f 77 20 74 68 65 20 63 75 72 72 65 , show the curre
1d4c0 6e 74 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 nt value of the
1d4d0 64 61 74 61 62 61 73 65 20 61 6e 64 20 74 65 6d database and tem
1d4e0 70 6f 72 61 72 79 0d 0a 20 20 20 20 20 20 23 20 porary.. #
1d4f0 20 20 20 20 20 20 64 69 72 65 63 74 6f 72 69 65 directorie
1d500 73 2e 20 20 54 68 69 73 20 63 61 6e 20 6f 6e 6c s. This can onl
1d510 79 20 62 65 20 70 65 72 66 6f 72 6d 65 64 20 69 y be performed i
1d520 66 20 53 51 4c 69 74 65 20 69 73 20 6c 6f 61 64 f SQLite is load
1d530 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ed.. #
1d540 20 20 61 6e 64 20 72 65 61 64 79 20 66 6f 72 20 and ready for
1d550 75 73 65 20 62 79 20 74 68 65 20 74 65 73 74 20 use by the test
1d560 73 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 23 0d suite... #.
1d570 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 73 53 51 . if {[isSQ
1d580 4c 69 74 65 52 65 61 64 79 5d 7d 20 74 68 65 6e LiteReady]} then
1d590 20 7b 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 {.. fore
1d5a0 61 63 68 20 64 69 72 65 63 74 6f 72 79 20 5b 6c ach directory [l
1d5b0 69 73 74 20 64 61 74 61 5f 73 74 6f 72 65 5f 64 ist data_store_d
1d5c0 69 72 65 63 74 6f 72 79 20 74 65 6d 70 5f 73 74 irectory temp_st
1d5d0 6f 72 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 7b ore_directory] {
1d5e0 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
1d5f0 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
1d600 6e 64 41 72 67 73 20 22 2d 2d 2d 2d 20 63 68 65 ndArgs "---- che
1d610 63 6b 69 6e 67 20 22 20 24 64 69 72 65 63 74 6f cking " $directo
1d620 72 79 20 22 2e 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 ry "... "]....
1d630 20 20 20 20 20 20 20 20 73 65 74 20 73 71 6c 20 set sql
1d640 5b 61 70 70 65 6e 64 41 72 67 73 20 22 50 52 41 [appendArgs "PRA
1d650 47 4d 41 20 22 20 24 64 69 72 65 63 74 6f 72 79 GMA " $directory
1d660 20 5c 3b 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 \;]....
1d670 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 65 78 if {[catch {ex
1d680 65 63 75 74 65 53 71 6c 20 24 73 71 6c 20 73 63 ecuteSql $sql sc
1d690 61 6c 61 72 7d 20 72 65 73 75 6c 74 5d 20 3d 3d alar} result] ==
1d6a0 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
1d6b0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
1d6c0 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1d6d0 67 73 20 22 6f 6b 3a 20 5c 22 22 20 24 72 65 73 gs "ok: \"" $res
1d6e0 75 6c 74 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 ult \"\n]..
1d6f0 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
1d700 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
1d710 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
1d720 64 41 72 67 73 20 22 65 72 72 6f 72 3a 20 22 20 dArgs "error: "
1d730 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d \n\t $result \n]
1d740 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
1d750 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1d760 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
1d770 20 70 72 6f 63 20 6c 6f 61 64 53 51 4c 69 74 65 proc loadSQLite
1d780 54 65 73 74 53 65 74 74 69 6e 67 73 20 7b 20 63 TestSettings { c
1d790 68 61 6e 6e 65 6c 20 7b 73 75 66 66 69 78 20 22 hannel {suffix "
1d7a0 22 7d 20 7b 71 75 69 65 74 20 66 61 6c 73 65 7d "} {quiet false}
1d7b0 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
1d7c0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 # NOTE: Ski
1d7d0 70 20 6c 6f 61 64 69 6e 67 20 74 68 65 20 73 65 p loading the se
1d7e0 74 74 69 6e 67 73 20 69 66 20 74 68 65 69 72 20 ttings if their
1d7f0 75 73 61 67 65 20 68 61 73 20 62 65 65 6e 20 64 usage has been d
1d800 69 73 61 62 6c 65 64 2e 0d 0a 20 20 20 20 20 20 isabled...
1d810 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 69 #.. if {![i
1d820 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
1d830 73 71 6c 69 74 65 54 65 73 74 53 65 74 74 69 6e sqliteTestSettin
1d840 67 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 gs)]} then {..
1d850 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1d860 20 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 20 63 75 # NOTE: Load cu
1d870 73 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 61 6e stom per-user an
1d880 64 2f 6f 72 20 70 65 72 2d 68 6f 73 74 20 74 65 d/or per-host te
1d890 73 74 20 73 65 74 74 69 6e 67 73 20 6e 6f 77 2e st settings now.
1d8a0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1d8b0 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 if {[info e
1d8c0 78 69 73 74 73 20 3a 3a 74 63 6c 5f 70 6c 61 74 xists ::tcl_plat
1d8d0 66 6f 72 6d 28 75 73 65 72 29 5d 7d 20 74 68 65 form(user)]} the
1d8e0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 n {.. s
1d8f0 65 74 20 75 73 65 72 53 65 74 74 69 6e 67 73 46 et userSettingsF
1d900 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f ileName [file jo
1d910 69 6e 20 5b 67 65 74 43 6f 6d 6d 6f 6e 44 69 72 in [getCommonDir
1d920 65 63 74 6f 72 79 5d 20 5c 0d 0a 20 20 20 20 20 ectory] \..
1d930 20 20 20 20 20 20 20 20 20 5b 61 70 70 65 6e 64 [append
1d940 41 72 67 73 20 73 65 74 74 69 6e 67 73 20 24 73 Args settings $s
1d950 75 66 66 69 78 20 2e 20 24 3a 3a 74 63 6c 5f 70 uffix . $::tcl_p
1d960 6c 61 74 66 6f 72 6d 28 75 73 65 72 29 20 2e 65 latform(user) .e
1d970 61 67 6c 65 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 agle]]....
1d980 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 if {[file ex
1d990 69 73 74 73 20 24 75 73 65 72 53 65 74 74 69 6e ists $userSettin
1d9a0 67 73 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 gsFileName]} the
1d9b0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1d9c0 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
1d9d0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1d9e0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1d9f0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
1da00 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1da10 20 20 20 20 22 2d 2d 2d 2d 20 6c 6f 61 64 69 6e "---- loadin
1da20 67 20 70 65 72 2d 75 73 65 72 20 74 65 73 74 20 g per-user test
1da30 73 65 74 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 settings file \"
1da40 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
1da50 20 20 20 20 20 20 20 24 75 73 65 72 53 65 74 74 $userSett
1da60 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 5c 22 2e ingsFileName \".
1da70 2e 2e 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 ..\n]..
1da80 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
1da90 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
1daa0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1dab0 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 uplevel 1 [list
1dac0 73 6f 75 72 63 65 20 24 75 73 65 72 53 65 74 74 source $userSett
1dad0 69 6e 67 73 46 69 6c 65 4e 61 6d 65 5d 0d 0a 20 ingsFileName]..
1dae0 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 72 72 } err
1daf0 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 or]} then {..
1db00 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
1db10 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1db20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1db30 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1db40 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1db50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1db60 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a "==== WARNING:
1db70 20 66 61 69 6c 65 64 20 74 6f 20 6c 6f 61 64 20 failed to load
1db80 70 65 72 2d 75 73 65 72 20 73 65 74 74 69 6e 67 per-user setting
1db90 73 20 66 69 6c 65 20 5c 22 22 20 5c 0d 0a 20 20 s file \"" \..
1dba0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1dbb0 20 20 24 75 73 65 72 53 65 74 74 69 6e 67 73 46 $userSettingsF
1dbc0 69 6c 65 4e 61 6d 65 20 22 5c 22 2c 20 65 72 72 ileName "\", err
1dbd0 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f or: " \n\t $erro
1dbe0 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 r \n]..
1dbf0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1dc00 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
1dc10 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
1dc20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
1dc30 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
1dc40 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
1dc50 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
1dc60 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1dc70 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1dc80 73 6b 69 70 70 65 64 20 6c 6f 61 64 69 6e 67 20 skipped loading
1dc90 70 65 72 2d 75 73 65 72 20 74 65 73 74 20 73 65 per-user test se
1dca0 74 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 22 20 ttings file \""
1dcb0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1dcc0 20 20 20 20 20 24 75 73 65 72 53 65 74 74 69 6e $userSettin
1dcd0 67 73 46 69 6c 65 4e 61 6d 65 20 22 5c 22 2c 20 gsFileName "\",
1dce0 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 it does not exis
1dcf0 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 t\n"]..
1dd00 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
1dd10 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
1dd20 20 20 20 20 20 20 20 20 23 23 23 23 23 23 23 23 ########
1dd30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1dd40 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1dd50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1dd60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0d ###############.
1dd70 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b ... if {[
1dd80 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 63 info exists ::tc
1dd90 6c 5f 70 6c 61 74 66 6f 72 6d 28 68 6f 73 74 29 l_platform(host)
1dda0 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1ddb0 20 20 20 20 20 73 65 74 20 68 6f 73 74 53 65 74 set hostSet
1ddc0 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 5b 66 tingsFileName [f
1ddd0 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 43 6f 6d ile join [getCom
1dde0 6d 6f 6e 44 69 72 65 63 74 6f 72 79 5d 20 5c 0d monDirectory] \.
1ddf0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b . [
1de00 61 70 70 65 6e 64 41 72 67 73 20 73 65 74 74 69 appendArgs setti
1de10 6e 67 73 20 24 73 75 66 66 69 78 20 2e 20 24 3a ngs $suffix . $:
1de20 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 68 6f :tcl_platform(ho
1de30 73 74 29 20 2e 65 61 67 6c 65 5d 5d 0d 0a 0d 0a st) .eagle]]....
1de40 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 66 if {[f
1de50 69 6c 65 20 65 78 69 73 74 73 20 24 68 6f 73 74 ile exists $host
1de60 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 SettingsFileName
1de70 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1de80 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
1de90 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
1dea0 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
1deb0 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
1dec0 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1ded0 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1dee0 6c 6f 61 64 69 6e 67 20 70 65 72 2d 68 6f 73 74 loading per-host
1def0 20 74 65 73 74 20 73 65 74 74 69 6e 67 73 20 66 test settings f
1df00 69 6c 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 ile \"" \..
1df10 20 20 20 20 20 20 20 20 20 20 20 20 20 24 68 6f $ho
1df20 73 74 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 stSettingsFileNa
1df30 6d 65 20 5c 22 2e 2e 2e 5c 6e 5d 0d 0a 20 20 20 me \"...\n]..
1df40 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
1df50 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 if {[c
1df60 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
1df70 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 uplevel 1
1df80 5b 6c 69 73 74 20 73 6f 75 72 63 65 20 24 68 6f [list source $ho
1df90 73 74 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 stSettingsFileNa
1dfa0 6d 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 me]..
1dfb0 20 7d 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e 20 } error]} then
1dfc0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1dfd0 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
1dfe0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1dff0 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1e000 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1e010 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1e020 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 "==== WA
1e030 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f RNING: failed to
1e040 20 6c 6f 61 64 20 70 65 72 2d 68 6f 73 74 20 73 load per-host s
1e050 65 74 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 22 ettings file \""
1e060 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1e070 20 20 20 20 20 20 20 20 24 68 6f 73 74 53 65 74 $hostSet
1e080 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 22 5c tingsFileName "\
1e090 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 ", error: " \n\t
1e0a0 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 $error \n]..
1e0b0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
1e0c0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1e0d0 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
1e0e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
1e0f0 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
1e100 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1e110 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1e120 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1e130 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1e140 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 6c 6f "---- skipped lo
1e150 61 64 69 6e 67 20 70 65 72 2d 68 6f 73 74 20 74 ading per-host t
1e160 65 73 74 20 73 65 74 74 69 6e 67 73 20 66 69 6c est settings fil
1e170 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 e \"" \..
1e180 20 20 20 20 20 20 20 20 20 20 20 24 68 6f 73 74 $host
1e190 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 SettingsFileName
1e1a0 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f "\", it does no
1e1b0 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 t exist\n"]..
1e1c0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
1e1d0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1e1e0 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 }.. }..
1e1f0 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
1e200 72 75 6e 53 51 4c 69 74 65 54 65 73 74 50 72 6f runSQLiteTestPro
1e210 6c 6f 67 75 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 logue {} {..
1e220 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1e230 45 3a 20 53 6b 69 70 20 72 75 6e 6e 69 6e 67 20 E: Skip running
1e240 6f 75 72 20 63 75 73 74 6f 6d 20 70 72 6f 6c 6f our custom prolo
1e250 67 75 65 20 69 66 20 74 68 65 20 6d 61 69 6e 20 gue if the main
1e260 6f 6e 65 20 68 61 73 20 62 65 65 6e 0d 0a 20 20 one has been..
1e270 20 20 20 20 23 20 20 20 20 20 20 20 73 6b 69 70 # skip
1e280 70 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ped... #..
1e290 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
1e2a0 65 78 69 73 74 73 20 3a 3a 6e 6f 28 70 72 6f 6c exists ::no(prol
1e2b0 6f 67 75 65 2e 65 61 67 6c 65 29 5d 7d 20 74 68 ogue.eagle)]} th
1e2c0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
1e2d0 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
1e2e0 20 4c 6f 61 64 20 74 68 65 20 22 62 65 66 6f 72 Load the "befor
1e2f0 65 2d 63 6f 6e 73 74 72 61 69 6e 74 73 22 20 63 e-constraints" c
1e300 75 73 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 61 ustom per-user a
1e310 6e 64 2f 6f 72 20 70 65 72 2d 68 6f 73 74 0d 0a nd/or per-host..
1e320 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1e330 74 65 73 74 20 73 65 74 74 69 6e 67 73 20 6e 6f test settings no
1e340 77 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 w... #..
1e350 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 uplevel 1
1e360 20 5b 6c 69 73 74 20 6c 6f 61 64 53 51 4c 69 74 [list loadSQLit
1e370 65 54 65 73 74 53 65 74 74 69 6e 67 73 20 24 3a eTestSettings $:
1e380 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 2e 62 :test_channel .b
1e390 65 66 6f 72 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 efore]....
1e3a0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
1e3b0 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 OTE: Check if th
1e3c0 65 20 5b 6f 62 6a 65 63 74 5d 20 63 6f 6d 6d 61 e [object] comma
1e3d0 6e 64 20 69 73 20 61 76 61 69 6c 61 62 6c 65 3b nd is available;
1e3e0 20 69 66 20 6e 6f 74 2c 20 61 64 64 20 73 6f 6d if not, add som
1e3f0 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
1e400 20 20 20 73 68 69 6d 73 20 74 6f 20 6d 61 6b 65 shims to make
1e410 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 20 the test suite
1e420 72 75 6e 20 73 6d 6f 6f 74 68 65 72 2e 0d 0a 20 run smoother...
1e430 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1e440 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 checkForSQLite
1e450 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 20 24 3a ObjectCommand $:
1e460 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d :test_channel...
1e470 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1e480 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 65 74 65 # NOTE: Dete
1e490 72 6d 69 6e 65 20 74 68 65 20 6e 61 6d 65 73 20 rmine the names
1e4a0 6f 66 20 74 68 65 20 6e 61 74 69 76 65 20 70 6c of the native pl
1e4b0 61 74 66 6f 72 6d 20 61 6e 64 20 61 72 63 68 69 atform and archi
1e4c0 74 65 63 74 75 72 65 2e 0d 0a 20 20 20 20 20 20 tecture...
1e4d0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 #.. set
1e4e0 20 70 6c 61 74 66 6f 72 6d 20 5b 67 65 74 42 75 platform [getBu
1e4f0 69 6c 64 50 6c 61 74 66 6f 72 6d 20 74 72 75 65 ildPlatform true
1e500 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 61 ].. set a
1e510 72 63 68 69 74 65 63 74 75 72 65 20 5b 61 72 63 rchitecture [arc
1e520 68 69 74 65 63 74 75 72 65 46 6f 72 50 6c 61 74 hitectureForPlat
1e530 66 6f 72 6d 20 24 70 6c 61 74 66 6f 72 6d 5d 0d form $platform].
1e540 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
1e550 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 # NOTE: Sh
1e560 6f 77 20 74 68 65 20 70 6c 61 74 66 6f 72 6d 20 ow the platform
1e570 61 6e 64 20 61 72 63 68 69 74 65 63 74 75 72 65 and architecture
1e580 20 75 73 65 64 20 74 6f 20 68 65 6c 70 20 6c 6f used to help lo
1e590 63 61 74 65 20 74 68 65 0d 0a 20 20 20 20 20 20 cate the..
1e5a0 20 20 23 20 20 20 20 20 20 20 6e 61 74 69 76 65 # native
1e5b0 20 62 75 69 6c 64 20 66 69 6c 65 73 2e 0d 0a 20 build files...
1e5c0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1e5d0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1e5e0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1e5f0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
1e600 20 20 20 22 2d 2d 2d 2d 20 70 6c 61 74 66 6f 72 "---- platfor
1e610 6d 20 66 6f 72 20 6c 6f 63 61 74 69 6e 67 20 6e m for locating n
1e620 61 74 69 76 65 20 62 75 69 6c 64 20 66 69 6c 65 ative build file
1e630 73 20 69 73 20 5c 22 22 20 5c 0d 0a 20 20 20 20 s is \"" \..
1e640 20 20 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 $platfor
1e650 6d 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 m \"\n]....
1e660 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
1e670 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
1e680 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1e690 20 20 20 20 22 2d 2d 2d 2d 20 61 72 63 68 69 74 "---- archit
1e6a0 65 63 74 75 72 65 20 66 6f 72 20 6c 6f 63 61 74 ecture for locat
1e6b0 69 6e 67 20 6e 61 74 69 76 65 20 62 75 69 6c 64 ing native build
1e6c0 20 66 69 6c 65 73 20 69 73 20 5c 22 22 20 5c 0d files is \"" \.
1e6d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 61 72 . $ar
1e6e0 63 68 69 74 65 63 74 75 72 65 20 5c 22 5c 6e 5d chitecture \"\n]
1e6f0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
1e700 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 # NOTE: B
1e710 75 69 6c 64 20 61 20 6c 69 73 74 20 6f 66 20 63 uild a list of c
1e720 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 69 6c onfiguration fil
1e730 65 73 20 74 68 61 74 20 77 65 20 68 61 6e 64 6c es that we handl
1e740 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 e... #..
1e750 20 20 20 20 20 20 20 73 65 74 20 63 6f 6e 66 69 set confi
1e760 67 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 gFileNames [list
1e770 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1e780 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
1e790 74 65 2e 64 6c 6c 2e 63 6f 6e 66 69 67 5d 0d 0a te.dll.config]..
1e7a0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1e7b0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 # NOTE: Bui
1e7c0 6c 64 20 61 20 6c 69 73 74 20 6f 66 20 61 75 78 ld a list of aux
1e7d0 69 6c 69 61 72 79 20 4d 61 6e 61 67 65 64 20 44 iliary Managed D
1e7e0 65 62 75 67 67 69 6e 67 20 41 73 73 69 73 74 61 ebugging Assista
1e7f0 6e 74 73 20 28 4d 44 41 29 0d 0a 20 20 20 20 20 nts (MDA)..
1e800 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 66 69 # confi
1e810 67 75 72 61 74 69 6f 6e 20 66 69 6c 65 73 20 74 guration files t
1e820 68 61 74 20 77 65 20 68 61 6e 64 6c 65 2e 0d 0a hat we handle...
1e830 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1e840 20 20 20 73 65 74 20 6d 64 61 43 6f 6e 66 69 67 set mdaConfig
1e850 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 20 FileNames [list
1e860 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 45 \.. E
1e870 61 67 6c 65 53 68 65 6c 6c 33 32 2e 65 78 65 2e agleShell32.exe.
1e880 6d 64 61 2e 63 6f 6e 66 69 67 20 49 6e 73 74 61 mda.config Insta
1e890 6c 6c 65 72 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e ller.exe.mda.con
1e8a0 66 69 67 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 fig \..
1e8b0 20 20 20 74 65 73 74 2e 65 78 65 2e 6d 64 61 2e test.exe.mda.
1e8c0 63 6f 6e 66 69 67 20 74 65 73 74 6c 69 6e 71 2e config testlinq.
1e8d0 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 69 67 20 5c exe.mda.config \
1e8e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 65 .. te
1e8f0 73 74 65 66 36 2e 65 78 65 2e 6d 64 61 2e 63 6f stef6.exe.mda.co
1e900 6e 66 69 67 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 nfig]....
1e910 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
1e920 54 45 3a 20 42 75 69 6c 64 20 74 68 65 20 6c 69 TE: Build the li
1e930 73 74 20 6f 66 20 65 78 74 65 72 6e 61 6c 20 66 st of external f
1e940 69 6c 65 73 20 74 68 61 74 20 77 65 20 68 61 6e iles that we han
1e950 64 6c 65 2e 20 20 53 6f 6d 65 20 6f 66 0d 0a 20 dle. Some of..
1e960 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
1e970 68 65 73 65 20 66 69 6c 65 73 20 6d 61 79 20 62 hese files may b
1e980 65 20 6e 61 74 69 76 65 20 61 6e 64 2f 6f 72 20 e native and/or
1e990 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 69 managed assembli
1e9a0 65 73 20 74 68 61 74 20 61 72 65 0d 0a 20 20 20 es that are..
1e9b0 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 71 # req
1e9c0 75 69 72 65 64 20 74 6f 20 70 65 72 66 6f 72 6d uired to perform
1e9d0 20 76 61 72 69 6f 75 73 20 74 65 73 74 73 2e 0d various tests..
1e9e0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
1e9f0 20 20 20 20 73 65 74 20 65 78 74 65 72 6e 61 6c set external
1ea00 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 20 FileNames [list
1ea10 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b \.. [
1ea20 66 69 6c 65 20 6a 6f 69 6e 20 45 6e 74 69 74 79 file join Entity
1ea30 46 72 61 6d 65 77 6f 72 6b 20 6c 69 62 20 5b 73 Framework lib [s
1ea40 74 72 69 6e 67 20 6d 61 70 20 5b 6c 69 73 74 20 tring map [list
1ea50 46 78 20 22 22 5d 20 5b 73 74 72 69 6e 67 20 5c Fx ""] [string \
1ea60 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6d 61 .. ma
1ea70 70 20 5b 6c 69 73 74 20 6e 65 74 46 78 34 35 31 p [list netFx451
1ea80 20 6e 65 74 46 78 34 35 20 6e 65 74 46 78 34 35 netFx45 netFx45
1ea90 32 20 6e 65 74 46 78 34 35 20 6e 65 74 46 78 34 2 netFx45 netFx4
1eaa0 36 20 6e 65 74 46 78 34 35 20 5c 0d 0a 20 20 20 6 netFx45 \..
1eab0 20 20 20 20 20 20 20 20 20 6e 65 74 46 78 34 36 netFx46
1eac0 31 20 6e 65 74 46 78 34 35 5d 20 5b 67 65 74 42 1 netFx45] [getB
1ead0 75 69 6c 64 4e 65 74 46 78 5d 5d 5d 20 45 6e 74 uildNetFx]]] Ent
1eae0 69 74 79 46 72 61 6d 65 77 6f 72 6b 2e 64 6c 6c ityFramework.dll
1eaf0 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d ]].... #.
1eb00 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
1eb10 20 42 75 69 6c 64 20 74 68 65 20 6c 69 73 74 20 Build the list
1eb20 6f 66 20 6e 61 74 69 76 65 20 61 73 73 65 6d 62 of native assemb
1eb30 6c 79 20 66 69 6c 65 73 20 74 68 61 74 20 77 65 ly files that we
1eb40 20 68 61 6e 64 6c 65 2e 20 20 54 68 65 0d 0a 20 handle. The..
1eb50 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 # r
1eb60 65 61 73 6f 6e 20 74 68 65 20 22 53 79 73 74 65 eason the "Syste
1eb70 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c m.Data.SQLite.dl
1eb80 6c 22 20 66 69 6c 65 20 69 73 20 69 6e 63 6c 75 l" file is inclu
1eb90 64 65 64 20 68 65 72 65 20 69 73 0d 0a 20 20 20 ded here is..
1eba0 20 20 20 20 20 23 20 20 20 20 20 20 20 62 65 63 # bec
1ebb0 61 75 73 65 20 69 74 20 63 6f 75 6c 64 20 62 65 ause it could be
1ebc0 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 the mixed-mode
1ebd0 61 73 73 65 6d 62 6c 79 2e 0d 0a 20 20 20 20 20 assembly...
1ebe0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 #.. se
1ebf0 74 20 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 t nativeFileName
1ec00 73 20 5b 6c 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 s [list]....
1ec10 20 20 20 20 65 76 61 6c 20 6c 61 70 70 65 6e 64 eval lappend
1ec20 20 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 nativeFileNames
1ec30 20 5b 67 65 74 4e 61 74 69 76 65 4c 69 62 72 61 [getNativeLibra
1ec40 72 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d ryFileNamesOnly]
1ec50 0d 0a 20 20 20 20 20 20 20 20 65 76 61 6c 20 6c .. eval l
1ec60 61 70 70 65 6e 64 20 6e 61 74 69 76 65 46 69 6c append nativeFil
1ec70 65 4e 61 6d 65 73 20 5b 67 65 74 49 6e 74 65 72 eNames [getInter
1ec80 6f 70 41 73 73 65 6d 62 6c 79 46 69 6c 65 4e 61 opAssemblyFileNa
1ec90 6d 65 73 4f 6e 6c 79 5d 0d 0a 0d 0a 20 20 20 20 mesOnly]....
1eca0 20 20 20 20 6c 61 70 70 65 6e 64 20 6e 61 74 69 lappend nati
1ecb0 76 65 46 69 6c 65 4e 61 6d 65 73 20 53 79 73 74 veFileNames Syst
1ecc0 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 em.Data.SQLite.d
1ecd0 6c 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d ll.... #.
1ece0 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
1ecf0 20 42 75 69 6c 64 20 74 68 65 20 6c 69 73 74 20 Build the list
1ed00 6f 66 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d of managed assem
1ed10 62 6c 79 20 66 69 6c 65 73 20 74 68 61 74 20 77 bly files that w
1ed20 65 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 e handle...
1ed30 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 #.. se
1ed40 74 20 6d 61 6e 61 67 65 64 46 69 6c 65 4e 61 6d t managedFileNam
1ed50 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 es [list \..
1ed60 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
1ed70 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 20 53 ata.SQLite.dll S
1ed80 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1ed90 65 2e 4c 69 6e 71 2e 64 6c 6c 20 5c 0d 0a 20 20 e.Linq.dll \..
1eda0 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
1edb0 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 45 46 36 .Data.SQLite.EF6
1edc0 2e 64 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 .dll]....
1edd0 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
1ede0 54 45 3a 20 52 65 6d 6f 76 65 20 61 6e 79 20 74 TE: Remove any t
1edf0 65 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 est constraints
1ee00 74 68 61 74 20 72 65 66 65 72 20 74 6f 20 74 68 that refer to th
1ee10 65 20 6e 61 74 69 76 65 20 61 6e 64 2f 6f 72 0d e native and/or.
1ee20 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
1ee30 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c managed assembl
1ee40 79 20 66 69 6c 65 73 20 74 68 61 74 20 77 65 20 y files that we
1ee50 68 61 6e 64 6c 65 20 75 6e 6c 65 73 73 20 66 6f handle unless fo
1ee60 72 62 69 64 64 65 6e 20 66 72 6f 6d 0d 0a 20 20 rbidden from..
1ee70 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 6f # do
1ee80 69 6e 67 20 73 6f 2e 0d 0a 20 20 20 20 20 20 20 ing so...
1ee90 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b #.. if {
1eea0 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
1eeb0 6e 6f 28 73 71 6c 69 74 65 52 65 6d 6f 76 65 43 no(sqliteRemoveC
1eec0 6f 6e 73 74 72 61 69 6e 74 73 29 5d 7d 20 74 68 onstraints)]} th
1eed0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1eee0 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 foreach fileName
1eef0 20 24 63 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 $configFileName
1ef00 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
1ef10 20 72 65 6d 6f 76 65 43 6f 6e 73 74 72 61 69 6e removeConstrain
1ef20 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 t [appendArgs fi
1ef30 6c 65 5f 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a le_ $fileName]..
1ef40 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
1ef50 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 foreach
1ef60 20 66 69 6c 65 4e 61 6d 65 20 24 6d 64 61 43 6f fileName $mdaCo
1ef70 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d nfigFileNames {.
1ef80 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 6d . rem
1ef90 6f 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 oveConstraint [a
1efa0 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 ppendArgs file_
1efb0 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 $fileName]..
1efc0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1efd0 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
1efe0 65 4e 61 6d 65 20 24 65 78 74 65 72 6e 61 6c 46 eName $externalF
1eff0 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 ileNames {..
1f000 20 20 20 20 20 20 20 20 72 65 6d 6f 76 65 43 6f removeCo
1f010 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
1f020 41 72 67 73 20 66 69 6c 65 5f 20 5b 66 69 6c 65 Args file_ [file
1f030 20 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d 65 5d tail $fileName]
1f040 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
1f050 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 .. fore
1f060 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6e 61 ach fileName $na
1f070 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d tiveFileNames {.
1f080 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 6d . rem
1f090 6f 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 oveConstraint [a
1f0a0 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 ppendArgs file_
1f0b0 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 20 20 $fileName]..
1f0c0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1f0d0 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
1f0e0 65 4e 61 6d 65 20 24 6d 61 6e 61 67 65 64 46 69 eName $managedFi
1f0f0 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
1f100 20 20 20 20 20 20 20 72 65 6d 6f 76 65 43 6f 6e removeCon
1f110 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
1f120 72 67 73 20 66 69 6c 65 5f 20 24 66 69 6c 65 4e rgs file_ $fileN
1f130 61 6d 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 ame]..
1f140 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
1f150 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1f160 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 # NOTE: Skip
1f170 61 6c 6c 20 53 79 73 74 65 6d 2e 44 61 74 61 2e all System.Data.
1f180 53 51 4c 69 74 65 20 72 65 6c 61 74 65 64 20 66 SQLite related f
1f190 69 6c 65 20 68 61 6e 64 6c 69 6e 67 20 28 64 65 ile handling (de
1f1a0 6c 65 74 69 6e 67 2c 0d 0a 20 20 20 20 20 20 20 leting,..
1f1b0 20 23 20 20 20 20 20 20 20 63 6f 70 79 69 6e 67 # copying
1f1c0 2c 20 61 6e 64 20 6c 6f 61 64 69 6e 67 29 20 69 , and loading) i
1f1d0 66 20 69 6e 73 74 72 75 63 74 65 64 2e 0d 0a 20 f instructed...
1f1e0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1f1f0 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
1f200 73 74 73 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 46 sts ::no(sqliteF
1f210 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
1f220 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
1f230 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 # NOTE: S
1f240 6b 69 70 20 74 72 79 69 6e 67 20 74 6f 20 64 65 kip trying to de
1f250 6c 65 74 65 20 61 6e 79 20 66 69 6c 65 73 20 69 lete any files i
1f260 66 20 69 6e 73 74 72 75 63 74 65 64 2e 0d 0a 20 f instructed...
1f270 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
1f280 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
1f290 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c exists ::no(del
1f2a0 65 74 65 53 71 6c 69 74 65 46 69 6c 65 73 29 5d eteSqliteFiles)]
1f2b0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1f2c0 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
1f2d0 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c exists ::no(del
1f2e0 65 74 65 53 71 6c 69 74 65 43 6f 6e 66 69 67 46 eteSqliteConfigF
1f2f0 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
1f300 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
1f310 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
1f320 63 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 configFileNames
1f330 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1f340 20 20 20 74 72 79 44 65 6c 65 74 65 42 69 6e 61 tryDeleteBina
1f350 72 79 46 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 ryFile $fileName
1f360 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1f370 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d }.. }
1f380 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
1f390 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
1f3a0 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c s ::no(deleteSql
1f3b0 69 74 65 45 78 74 65 72 6e 61 6c 46 69 6c 65 73 iteExternalFiles
1f3c0 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 )]} then {..
1f3d0 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 foreac
1f3e0 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d 64 61 43 h fileName $mdaC
1f3f0 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b onfigFileNames {
1f400 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1f410 20 20 74 72 79 44 65 6c 65 74 65 42 75 69 6c 64 tryDeleteBuild
1f420 46 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 0d 0a File $fileName..
1f430 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
1f440 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
1f450 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d foreach fileNam
1f460 65 20 24 65 78 74 65 72 6e 61 6c 46 69 6c 65 4e e $externalFileN
1f470 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 ames {..
1f480 20 20 20 20 20 20 20 20 74 72 79 44 65 6c 65 74 tryDelet
1f490 65 42 69 6e 61 72 79 46 69 6c 65 20 24 66 69 6c eBinaryFile $fil
1f4a0 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 eName..
1f4b0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1f4c0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
1f4d0 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
1f4e0 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 exists ::no(dele
1f4f0 74 65 53 71 6c 69 74 65 4e 61 74 69 76 65 46 69 teSqliteNativeFi
1f500 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 les)]} then {..
1f510 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 if
1f520 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
1f530 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 65 :no(deleteSqlite
1f540 49 6d 70 6c 69 63 69 74 46 69 6c 65 73 29 5d 7d ImplicitFiles)]}
1f550 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1f560 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 foreach
1f570 20 66 69 6c 65 4e 61 6d 65 20 24 6e 61 74 69 76 fileName $nativ
1f580 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 eFileNames {..
1f590 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1f5a0 74 72 79 44 65 6c 65 74 65 41 73 73 65 6d 62 6c tryDeleteAssembl
1f5b0 79 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 y $fileName..
1f5c0 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
1f5d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
1f5e0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
1f5f0 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
1f600 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 ts ::no(deleteSq
1f610 6c 69 74 65 4e 6f 6e 49 6d 70 6c 69 63 69 74 46 liteNonImplicitF
1f620 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
1f630 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1f640 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
1f650 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c s ::no(deleteSql
1f660 69 74 65 50 6c 61 74 66 6f 72 6d 46 69 6c 65 73 itePlatformFiles
1f670 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 )] && \..
1f680 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 [st
1f690 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 ring length $pla
1f6a0 74 66 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 65 6e tform] > 0} then
1f6b0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1f6c0 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 foreach fi
1f6d0 6c 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 46 69 leName $nativeFi
1f6e0 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
1f6f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
1f700 72 79 44 65 6c 65 74 65 41 73 73 65 6d 62 6c 79 ryDeleteAssembly
1f710 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 $fileName $plat
1f720 66 6f 72 6d 0d 0a 20 20 20 20 20 20 20 20 20 20 form..
1f730 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1f740 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
1f750 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1f760 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
1f770 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c s ::no(deleteSql
1f780 69 74 65 41 72 63 68 69 74 65 63 74 75 72 65 46 iteArchitectureF
1f790 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 iles)] && \..
1f7a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1f7b0 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
1f7c0 24 61 72 63 68 69 74 65 63 74 75 72 65 5d 20 3e $architecture] >
1f7d0 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
1f7e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
1f7f0 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
1f800 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 nativeFileNames
1f810 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1f820 20 20 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 tryDelete
1f830 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 Assembly $fileNa
1f840 6d 65 20 24 61 72 63 68 69 74 65 63 74 75 72 65 me $architecture
1f850 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
1f860 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
1f870 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1f880 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1f890 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1f8a0 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
1f8b0 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 fo exists ::no(d
1f8c0 65 6c 65 74 65 53 71 6c 69 74 65 4d 61 6e 61 67 eleteSqliteManag
1f8d0 65 64 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 edFiles)]} then
1f8e0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1f8f0 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d foreach fileNam
1f900 65 20 24 6d 61 6e 61 67 65 64 46 69 6c 65 4e 61 e $managedFileNa
1f910 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 mes {..
1f920 20 20 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 tryDelete
1f930 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 Assembly $fileNa
1f940 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 me..
1f950 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
1f960 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d }.. }.
1f970 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
1f980 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
1f990 3a 20 43 68 65 63 6b 20 66 6f 72 20 74 68 65 20 : Check for the
1f9a0 22 61 75 74 6f 53 65 6c 65 63 74 22 20 72 75 6e "autoSelect" run
1f9b0 74 69 6d 65 20 6f 70 74 69 6f 6e 2e 20 20 49 66 time option. If
1f9c0 20 70 72 65 73 65 6e 74 2c 0d 0a 20 20 20 20 20 present,..
1f9d0 20 20 20 20 20 23 20 20 20 20 20 20 20 61 74 74 # att
1f9e0 65 6d 70 74 20 74 6f 20 61 75 74 6f 6d 61 74 69 empt to automati
1f9f0 63 61 6c 6c 79 20 73 65 6c 65 63 74 20 74 68 65 cally select the
1fa00 20 66 69 72 73 74 20 61 76 61 69 6c 61 62 6c 65 first available
1fa10 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 .. #
1fa20 20 20 20 20 62 75 69 6c 64 20 28 6f 72 20 22 72 build (or "r
1fa30 65 6c 65 61 73 65 22 29 20 6f 66 20 53 51 4c 69 elease") of SQLi
1fa40 74 65 20 61 6e 64 20 53 79 73 74 65 6d 2e 44 61 te and System.Da
1fa50 74 61 2e 53 51 4c 69 74 65 0d 0a 20 20 20 20 20 ta.SQLite..
1fa60 20 20 20 20 20 23 20 20 20 20 20 20 20 66 6f 72 # for
1fa70 20 75 73 65 20 77 69 74 68 20 74 68 65 20 74 65 use with the te
1fa80 73 74 20 73 75 69 74 65 2e 0d 0a 20 20 20 20 20 st suite...
1fa90 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1faa0 20 20 69 66 20 7b 5b 68 61 73 52 75 6e 74 69 6d if {[hasRuntim
1fab0 65 4f 70 74 69 6f 6e 20 61 75 74 6f 53 65 6c 65 eOption autoSele
1fac0 63 74 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ct]} then {..
1fad0 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 63 if {![c
1fae0 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 42 75 69 heckForSQLiteBui
1faf0 6c 64 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e lds $::test_chan
1fb00 6e 65 6c 20 74 72 75 65 5d 7d 20 74 68 65 6e 20 nel true]} then
1fb10 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1fb20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 52 checkForSQLiteR
1fb30 65 6c 65 61 73 65 73 20 24 3a 3a 74 65 73 74 5f eleases $::test_
1fb40 63 68 61 6e 6e 65 6c 20 74 72 75 65 0d 0a 20 20 channel true..
1fb50 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
1fb60 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
1fb70 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1fb80 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 # NOTE: Skip
1fb90 74 72 79 69 6e 67 20 74 6f 20 76 65 72 69 66 79 trying to verify
1fba0 20 74 68 65 20 62 75 69 6c 64 20 64 69 72 65 63 the build direc
1fbb0 74 6f 72 79 20 69 66 20 69 6e 73 74 72 75 63 74 tory if instruct
1fbc0 65 64 3b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 ed;.. #
1fbd0 20 20 20 20 20 20 20 6f 74 68 65 72 77 69 73 65 otherwise
1fbe0 2c 20 6d 61 6b 65 20 73 75 72 65 20 69 74 20 61 , make sure it a
1fbf0 63 74 75 61 6c 6c 79 20 65 78 69 73 74 73 20 6f ctually exists o
1fc00 72 20 68 61 6c 74 20 74 68 65 20 65 6e 74 69 72 r halt the entir
1fc10 65 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 e.. #
1fc20 20 20 20 20 20 74 65 73 74 69 6e 67 20 70 72 6f testing pro
1fc30 63 65 73 73 20 69 66 20 69 74 20 64 6f 65 73 20 cess if it does
1fc40 6e 6f 74 20 65 78 69 73 74 2e 0d 0a 20 20 20 20 not exist...
1fc50 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1fc60 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
1fc70 69 73 74 73 20 3a 3a 6e 6f 28 76 65 72 69 66 79 ists ::no(verify
1fc80 42 75 69 6c 64 44 69 72 65 63 74 6f 72 79 29 5d BuildDirectory)]
1fc90 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1fca0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1fcb0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 20 # NOTE: At
1fcc0 74 68 69 73 20 70 6f 69 6e 74 2c 20 74 68 65 20 this point, the
1fcd0 62 75 69 6c 64 20 64 69 72 65 63 74 6f 72 79 20 build directory
1fce0 4d 55 53 54 20 65 78 69 73 74 20 61 73 20 61 0d MUST exist as a.
1fcf0 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 . #
1fd00 20 20 20 20 20 76 61 6c 69 64 20 64 69 72 65 63 valid direc
1fd10 74 6f 72 79 20 66 6f 72 20 74 68 65 20 74 65 73 tory for the tes
1fd20 74 69 6e 67 20 70 72 6f 63 65 73 73 20 74 6f 20 ting process to
1fd30 63 6f 6e 74 69 6e 75 65 2e 0d 0a 20 20 20 20 20 continue...
1fd40 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1fd50 20 20 20 20 20 20 73 65 74 20 64 69 72 65 63 74 set direct
1fd60 6f 72 79 20 5b 67 65 74 42 75 69 6c 64 44 69 72 ory [getBuildDir
1fd70 65 63 74 6f 72 79 5d 0d 0a 0d 0a 20 20 20 20 20 ectory]....
1fd80 20 20 20 20 20 20 20 69 66 20 7b 21 5b 66 69 6c if {![fil
1fd90 65 20 65 78 69 73 74 73 20 24 64 69 72 65 63 74 e exists $direct
1fda0 6f 72 79 5d 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 ory] || \..
1fdb0 20 20 20 20 20 20 20 20 20 20 20 21 5b 66 69 6c ![fil
1fdc0 65 20 69 73 64 69 72 65 63 74 6f 72 79 20 24 64 e isdirectory $d
1fdd0 69 72 65 63 74 6f 72 79 5d 7d 20 74 68 65 6e 20 irectory]} then
1fde0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
1fdf0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
1fe00 20 20 23 20 4e 4f 54 45 3a 20 4a 75 73 74 20 70 # NOTE: Just p
1fe10 72 69 6f 72 20 74 6f 20 61 63 74 75 61 6c 6c 79 rior to actually
1fe20 20 68 61 6c 74 69 6e 67 20 74 68 65 20 74 65 73 halting the tes
1fe30 74 69 6e 67 20 70 72 6f 63 65 73 73 2c 0d 0a 20 ting process,..
1fe40 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 #
1fe50 20 20 20 20 20 61 64 64 20 61 6e 20 65 72 72 6f add an erro
1fe60 72 20 74 6f 20 74 68 65 20 74 65 73 74 20 6c 6f r to the test lo
1fe70 67 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 20 g file...
1fe80 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1fe90 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
1fea0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
1feb0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
1fec0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1fed0 2d 2d 2d 2d 20 63 6f 75 6c 64 20 6e 6f 74 20 76 ---- could not v
1fee0 65 72 69 66 79 20 62 75 69 6c 64 20 64 69 72 65 erify build dire
1fef0 63 74 6f 72 79 20 5c 22 22 20 24 64 69 72 65 63 ctory \"" $direc
1ff00 74 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 tory \..
1ff10 20 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 61 "\", a
1ff20 6c 6c 20 74 65 73 74 69 6e 67 20 68 61 6c 74 65 ll testing halte
1ff30 64 5c 6e 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 d\n"]....
1ff40 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1ff50 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1ff60 52 61 69 73 69 6e 67 20 61 20 73 63 72 69 70 74 Raising a script
1ff70 20 65 72 72 6f 72 20 66 72 6f 6d 20 74 68 69 73 error from this
1ff80 20 70 6f 69 6e 74 20 73 68 6f 75 6c 64 20 68 61 point should ha
1ff90 6c 74 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 lt..
1ffa0 20 20 23 20 20 20 20 20 20 20 74 68 65 20 74 65 # the te
1ffb0 73 74 69 6e 67 20 70 72 6f 63 65 73 73 2e 0d 0a sting process...
1ffc0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
1ffd0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 . e
1ffe0 72 72 6f 72 20 5b 61 70 70 65 6e 64 41 72 67 73 rror [appendArgs
1fff0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
20000 20 20 20 20 20 20 22 63 6f 75 6c 64 20 6e 6f 74 "could not
20010 20 76 65 72 69 66 79 20 62 75 69 6c 64 20 64 69 verify build di
20020 72 65 63 74 6f 72 79 20 5c 22 22 20 24 64 69 72 rectory \"" $dir
20030 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 ectory \..
20040 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 2c "\",
20050 20 61 6c 6c 20 74 65 73 74 69 6e 67 20 68 61 6c all testing hal
20060 74 65 64 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 ted"]..
20070 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
20080 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 23 }.... #
20090 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f .. # NO
200a0 54 45 3a 20 53 6b 69 70 20 74 72 79 69 6e 67 20 TE: Skip trying
200b0 74 6f 20 63 6f 70 79 20 61 6e 79 20 66 69 6c 65 to copy any file
200c0 73 20 69 66 20 69 6e 73 74 72 75 63 74 65 64 2e s if instructed.
200d0 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
200e0 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
200f0 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
20100 63 6f 70 79 53 71 6c 69 74 65 46 69 6c 65 73 29 copySqliteFiles)
20110 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
20120 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
20130 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f o exists ::no(co
20140 70 79 53 71 6c 69 74 65 43 6f 6e 66 69 67 46 69 pySqliteConfigFi
20150 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 les)]} then {..
20160 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 for
20170 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 63 each fileName $c
20180 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b onfigFileNames {
20190 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
201a0 20 20 74 72 79 43 6f 70 79 42 75 69 6c 64 46 69 tryCopyBuildFi
201b0 6c 65 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 le $fileName..
201c0 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
201d0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
201e0 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
201f0 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
20200 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 45 78 74 no(copySqliteExt
20210 65 72 6e 61 6c 46 69 6c 65 73 29 5d 7d 20 74 68 ernalFiles)]} th
20220 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
20230 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
20240 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 6f 70 # NOTE: Cop
20250 79 20 74 68 65 20 4d 61 6e 61 67 65 64 20 44 65 y the Managed De
20260 62 75 67 67 69 6e 67 20 41 73 73 69 73 74 61 6e bugging Assistan
20270 74 73 20 28 4d 44 41 29 20 63 6f 6e 66 69 67 75 ts (MDA) configu
20280 72 61 74 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 ration..
20290 20 20 20 20 20 20 23 20 20 20 20 20 20 20 66 69 # fi
202a0 6c 65 20 66 6f 72 20 74 68 65 20 45 61 67 6c 65 le for the Eagle
202b0 20 73 68 65 6c 6c 20 74 6f 20 74 68 65 20 62 75 shell to the bu
202c0 69 6c 64 20 6f 75 74 70 75 74 20 64 69 72 65 63 ild output direc
202d0 74 6f 72 79 2c 0d 0a 20 20 20 20 20 20 20 20 20 tory,..
202e0 20 20 20 20 20 23 20 20 20 20 20 20 20 77 68 69 # whi
202f0 6c 65 20 75 73 69 6e 67 20 65 61 63 68 20 6f 66 le using each of
20300 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 the names of th
20310 65 20 76 61 72 69 6f 75 73 20 6c 65 67 61 63 79 e various legacy
20320 20 74 65 73 74 0d 0a 20 20 20 20 20 20 20 20 20 test..
20330 20 20 20 20 20 23 20 20 20 20 20 20 20 65 78 65 # exe
20340 63 75 74 61 62 6c 65 73 2e 20 20 54 68 69 73 20 cutables. This
20350 77 69 6c 6c 20 68 65 6c 70 20 74 6f 20 6d 61 6b will help to mak
20360 65 20 73 75 72 65 20 74 68 61 74 20 61 6c 6c 20 e sure that all
20370 74 68 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 the..
20380 20 20 20 23 20 20 20 20 20 20 20 6c 65 67 61 63 # legac
20390 79 20 74 65 73 74 73 20 72 75 6e 20 77 69 74 68 y tests run with
203a0 20 65 78 61 63 74 6c 79 20 74 68 65 20 73 61 6d exactly the sam
203b0 65 20 73 65 74 20 6f 66 20 4d 61 6e 61 67 65 64 e set of Managed
203c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
203d0 23 20 20 20 20 20 20 20 44 65 62 75 67 67 69 6e # Debuggin
203e0 67 20 41 73 73 69 73 74 61 6e 74 73 20 63 6f 6e g Assistants con
203f0 66 69 67 75 72 65 64 2e 0d 0a 20 20 20 20 20 20 figured...
20400 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
20410 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 foreach
20420 20 66 69 6c 65 4e 61 6d 65 20 24 6d 64 61 43 6f fileName $mdaCo
20430 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d nfigFileNames {.
20440 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
20450 20 74 72 79 43 6f 70 79 42 69 6e 61 72 79 46 69 tryCopyBinaryFi
20460 6c 65 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 le EagleShell.ex
20470 65 2e 6d 64 61 2e 63 6f 6e 66 69 67 20 22 22 20 e.mda.config ""
20480 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 $fileName..
20490 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
204a0 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
204b0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e # N
204c0 4f 54 45 3a 20 43 6f 70 79 20 74 68 65 20 65 78 OTE: Copy the ex
204d0 74 65 72 6e 61 6c 20 62 69 6e 61 72 69 65 73 2c ternal binaries,
204e0 20 69 66 20 61 6e 79 2c 20 74 6f 20 74 68 65 20 if any, to the
204f0 64 69 72 65 63 74 6f 72 79 20 74 68 61 74 0d 0a directory that..
20500 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
20510 20 20 20 20 20 20 63 6f 6e 74 61 69 6e 73 20 74 contains t
20520 68 65 20 45 61 67 6c 65 20 73 68 65 6c 6c 2e 20 he Eagle shell.
20530 20 54 68 69 73 20 69 73 20 74 79 70 69 63 61 6c This is typical
20540 6c 79 20 75 73 65 64 20 74 6f 20 6d 61 6b 65 0d ly used to make.
20550 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
20560 20 20 20 20 20 20 20 73 75 72 65 20 61 73 73 65 sure asse
20570 6d 62 6c 69 65 73 20 72 65 66 65 72 65 6e 63 65 mblies reference
20580 64 20 62 79 20 74 68 65 20 6f 6e 65 73 20 62 65 d by the ones be
20590 69 6e 67 20 74 65 73 74 65 64 20 61 72 65 0d 0a ing tested are..
205a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
205b0 20 20 20 20 20 20 61 76 61 69 6c 61 62 6c 65 20 available
205c0 64 75 72 69 6e 67 20 74 68 65 20 74 65 73 74 69 during the testi
205d0 6e 67 20 70 72 6f 63 65 73 73 2e 0d 0a 20 20 20 ng process...
205e0 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
205f0 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 fore
20600 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 65 78 ach fileName $ex
20610 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d 65 73 20 ternalFileNames
20620 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
20630 20 20 20 74 72 79 43 6f 70 79 45 78 74 65 72 6e tryCopyExtern
20640 61 6c 46 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 alFile $fileName
20650 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
20660 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d }.. }
20670 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
20680 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
20690 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 s ::no(copySqlit
206a0 65 4e 61 74 69 76 65 46 69 6c 65 73 29 5d 7d 20 eNativeFiles)]}
206b0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
206c0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
206d0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 # NOTE: I
206e0 66 20 74 68 65 20 74 65 73 74 20 70 6c 61 74 66 f the test platf
206f0 6f 72 6d 20 69 73 20 6c 69 6b 65 6c 79 20 74 68 orm is likely th
20700 65 20 64 65 66 61 75 6c 74 20 66 6f 72 20 74 68 e default for th
20710 69 73 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 is..
20720 20 20 23 20 20 20 20 20 20 20 6d 61 63 68 69 6e # machin
20730 65 2c 20 61 6c 73 6f 20 74 72 79 20 74 6f 20 63 e, also try to c
20740 6f 70 79 20 74 68 65 20 6e 61 74 69 76 65 20 66 opy the native f
20750 69 6c 65 73 20 74 6f 20 74 68 65 0d 0a 20 20 20 iles to the..
20760 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 #
20770 20 20 20 62 69 6e 61 72 79 20 6c 6f 63 61 74 69 binary locati
20780 6f 6e 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 on...
20790 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
207a0 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
207b0 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 xists ::no(copyS
207c0 71 6c 69 74 65 49 6d 70 6c 69 63 69 74 46 69 6c qliteImplicitFil
207d0 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 es)] && \..
207e0 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 69 73 [is
207f0 44 65 66 61 75 6c 74 42 75 69 6c 64 50 6c 61 74 DefaultBuildPlat
20800 66 6f 72 6d 20 74 72 75 65 5d 7d 20 74 68 65 6e form true]} then
20810 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
20820 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
20830 4e 61 6d 65 20 24 6e 61 74 69 76 65 46 69 6c 65 Name $nativeFile
20840 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 Names {..
20850 20 20 20 20 20 20 20 20 20 20 20 74 72 79 43 6f tryCo
20860 70 79 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 pyAssembly $file
20870 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 Name..
20880 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
20890 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
208a0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
208b0 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
208c0 28 63 6f 70 79 53 71 6c 69 74 65 4e 6f 6e 49 6d (copySqliteNonIm
208d0 70 6c 69 63 69 74 46 69 6c 65 73 29 5d 7d 20 74 plicitFiles)]} t
208e0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
208f0 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
20900 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f o exists ::no(co
20910 70 79 53 71 6c 69 74 65 50 6c 61 74 66 6f 72 6d pySqlitePlatform
20920 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 Files)] && \..
20930 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20940 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
20950 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 7d $platform] > 0}
20960 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
20970 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 forea
20980 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6e 61 74 ch fileName $nat
20990 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a iveFileNames {..
209a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
209b0 20 20 20 20 74 72 79 43 6f 70 79 41 73 73 65 6d tryCopyAssem
209c0 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 bly $fileName $p
209d0 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 20 20 20 20 latform..
209e0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
209f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
20a00 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
20a10 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
20a20 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 ists ::no(copySq
20a30 6c 69 74 65 41 72 63 68 69 74 65 63 74 75 72 65 liteArchitecture
20a40 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 Files)] && \..
20a50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20a60 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
20a70 20 24 61 72 63 68 69 74 65 63 74 75 72 65 5d 20 $architecture]
20a80 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
20a90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 f
20aa0 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 oreach fileName
20ab0 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 $nativeFileNames
20ac0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
20ad0 20 20 20 20 20 20 20 20 74 72 79 43 6f 70 79 41 tryCopyA
20ae0 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d ssembly $fileNam
20af0 65 20 24 61 72 63 68 69 74 65 63 74 75 72 65 0d e $architecture.
20b00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
20b10 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
20b20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
20b30 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
20b40 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
20b50 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
20b60 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f o exists ::no(co
20b70 70 79 53 71 6c 69 74 65 4d 61 6e 61 67 65 64 46 pySqliteManagedF
20b80 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
20b90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
20ba0 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
20bb0 6d 61 6e 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 managedFileNames
20bc0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
20bd0 20 20 20 20 74 72 79 43 6f 70 79 41 73 73 65 6d tryCopyAssem
20be0 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 bly $fileName..
20bf0 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
20c00 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
20c10 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
20c20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
20c30 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 # NOTE: Ski
20c40 70 20 74 72 79 69 6e 67 20 74 6f 20 6c 6f 61 64 p trying to load
20c50 20 61 6e 79 20 66 69 6c 65 73 20 69 66 20 69 6e any files if in
20c60 73 74 72 75 63 74 65 64 2e 0d 0a 20 20 20 20 20 structed...
20c70 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
20c80 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
20c90 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c sts ::no(loadSql
20ca0 69 74 65 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e iteFiles)]} then
20cb0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
20cc0 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
20cd0 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 s ::no(loadSqlit
20ce0 65 49 6d 70 6c 69 63 69 74 46 69 6c 65 73 29 5d eImplicitFiles)]
20cf0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
20d00 20 20 20 20 20 20 20 20 74 72 79 4c 6f 61 64 41 tryLoadA
20d10 73 73 65 6d 62 6c 79 20 53 79 73 74 65 6d 2e 44 ssembly System.D
20d20 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 0d 0a ata.SQLite.dll..
20d30 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d }...
20d40 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
20d50 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
20d60 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 65 4c 69 :no(loadSqliteLi
20d70 6e 71 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 nqFiles)]} then
20d80 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
20d90 20 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 6c 79 tryLoadAssembly
20da0 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c System.Data.SQL
20db0 69 74 65 2e 4c 69 6e 71 2e 64 6c 6c 0d 0a 20 20 ite.Linq.dll..
20dc0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
20dd0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
20de0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
20df0 6f 28 6c 6f 61 64 53 71 6c 69 74 65 45 66 36 46 o(loadSqliteEf6F
20e00 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
20e10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 tr
20e20 79 4c 6f 61 64 41 73 73 65 6d 62 6c 79 20 53 79 yLoadAssembly Sy
20e30 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
20e40 2e 45 46 36 2e 64 6c 6c 0d 0a 20 20 20 20 20 20 .EF6.dll..
20e50 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
20e60 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
20e70 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f o exists ::no(lo
20e80 61 64 53 71 6c 69 74 65 4e 6f 6e 49 6d 70 6c 69 adSqliteNonImpli
20e90 63 69 74 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e citFiles)]} then
20ea0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
20eb0 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
20ec0 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c sts ::no(loadSql
20ed0 69 74 65 50 6c 61 74 66 6f 72 6d 46 69 6c 65 73 itePlatformFiles
20ee0 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 )] && \..
20ef0 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 [stri
20f00 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 ng length $platf
20f10 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b orm] > 0} then {
20f20 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
20f30 20 20 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 6c tryLoadAssembl
20f40 79 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 y System.Data.SQ
20f50 4c 69 74 65 2e 64 6c 6c 20 24 70 6c 61 74 66 6f Lite.dll $platfo
20f60 72 6d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 rm..
20f70 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
20f80 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
20f90 65 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 exists ::no(load
20fa0 53 71 6c 69 74 65 41 72 63 68 69 74 65 63 74 75 SqliteArchitectu
20fb0 72 65 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a reFiles)] && \..
20fc0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20fd0 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
20fe0 20 24 61 72 63 68 69 74 65 63 74 75 72 65 5d 20 $architecture]
20ff0 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
21000 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 try
21010 4c 6f 61 64 41 73 73 65 6d 62 6c 79 20 53 79 73 LoadAssembly Sys
21020 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
21030 64 6c 6c 20 24 61 72 63 68 69 74 65 63 74 75 72 dll $architectur
21040 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e..
21050 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
21060 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
21070 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
21080 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
21090 65 4e 61 6d 65 4f 6e 6c 79 20 5b 67 65 74 4e 61 eNameOnly [getNa
210a0 74 69 76 65 4c 69 62 72 61 72 79 46 69 6c 65 4e tiveLibraryFileN
210b0 61 6d 65 73 4f 6e 6c 79 5d 20 7b 0d 0a 20 20 20 amesOnly] {..
210c0 20 20 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a catch {..
210d0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
210e0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
210f0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
21100 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
21110 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 "---- file vers
21120 69 6f 6e 20 6f 66 20 5c 22 22 20 24 66 69 6c 65 ion of \"" $file
21130 4e 61 6d 65 4f 6e 6c 79 20 22 5c 22 2e 2e 2e 20 NameOnly "\"...
21140 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 \"" \..
21150 20 20 20 20 20 20 20 5b 66 69 6c 65 20 76 65 72 [file ver
21160 73 69 6f 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 sion [getBinaryF
21170 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d ileName $fileNam
21180 65 4f 6e 6c 79 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 eOnly]] \"\n]..
21190 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
211a0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
211b0 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d foreach fileNam
211c0 65 4f 6e 6c 79 20 5b 67 65 74 49 6e 74 65 72 6f eOnly [getIntero
211d0 70 41 73 73 65 6d 62 6c 79 46 69 6c 65 4e 61 6d pAssemblyFileNam
211e0 65 73 4f 6e 6c 79 5d 20 7b 0d 0a 20 20 20 20 20 esOnly] {..
211f0 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 catch {..
21200 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
21210 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
21220 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
21230 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
21240 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 6f ---- file versio
21250 6e 20 6f 66 20 5c 22 22 20 24 66 69 6c 65 4e 61 n of \"" $fileNa
21260 6d 65 4f 6e 6c 79 20 22 5c 22 2e 2e 2e 20 5c 22 meOnly "\"... \"
21270 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
21280 20 20 20 20 20 5b 66 69 6c 65 20 76 65 72 73 69 [file versi
21290 6f 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c on [getBinaryFil
212a0 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 4f eName $fileNameO
212b0 6e 6c 79 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 20 20 nly]] \"\n]..
212c0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
212d0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 63 }.... c
212e0 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
212f0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
21300 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
21310 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
21320 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 "---- file
21330 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 53 79 73 version of \"Sys
21340 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
21350 64 6c 6c 5c 22 2e 2e 2e 20 5c 22 22 20 5c 0d 0a dll\"... \"" \..
21360 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 [f
21370 69 6c 65 20 76 65 72 73 69 6f 6e 20 5b 67 65 74 ile version [get
21380 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 53 BinaryFileName S
21390 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
213a0 65 2e 64 6c 6c 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 e.dll]] \"\n]..
213b0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
213c0 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 catch {..
213d0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
213e0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
213f0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
21400 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
21410 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 file version of
21420 5c 22 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 \"System.Data.SQ
21430 4c 69 74 65 2e 4c 69 6e 71 2e 64 6c 6c 5c 22 2e Lite.Linq.dll\".
21440 2e 2e 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 .. \"" \..
21450 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 76 65 [file ve
21460 72 73 69 6f 6e 20 5b 67 65 74 42 69 6e 61 72 79 rsion [getBinary
21470 46 69 6c 65 4e 61 6d 65 20 53 79 73 74 65 6d 2e FileName System.
21480 44 61 74 61 2e 53 51 4c 69 74 65 2e 4c 69 6e 71 Data.SQLite.Linq
21490 2e 64 6c 6c 5d 5d 20 5c 0d 0a 20 20 20 20 20 20 .dll]] \..
214a0 20 20 20 20 20 20 20 20 5c 22 5c 6e 5d 0d 0a 20 \"\n]..
214b0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
214c0 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 catch {..
214d0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
214e0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
214f0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
21500 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
21510 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 file version of
21520 5c 22 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 \"System.Data.SQ
21530 4c 69 74 65 2e 45 46 36 2e 64 6c 6c 5c 22 2e 2e Lite.EF6.dll\"..
21540 2e 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 . \"" \..
21550 20 20 20 20 20 20 20 5b 66 69 6c 65 20 76 65 72 [file ver
21560 73 69 6f 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 sion [getBinaryF
21570 69 6c 65 4e 61 6d 65 20 53 79 73 74 65 6d 2e 44 ileName System.D
21580 61 74 61 2e 53 51 4c 69 74 65 2e 45 46 36 2e 64 ata.SQLite.EF6.d
21590 6c 6c 5d 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 ll]] \..
215a0 20 20 20 20 20 20 5c 22 5c 6e 5d 0d 0a 20 20 20 \"\n]..
215b0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
215c0 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
215d0 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 ngth $platform]
215e0 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
215f0 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
21600 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 5b 67 65 74 ileNameOnly [get
21610 4e 61 74 69 76 65 4c 69 62 72 61 72 79 46 69 6c NativeLibraryFil
21620 65 4e 61 6d 65 73 4f 6e 6c 79 5d 20 7b 0d 0a 20 eNamesOnly] {..
21630 20 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 catch
21640 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
21650 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
21660 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
21670 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
21680 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 "---- f
21690 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c ile version of \
216a0 22 22 20 24 70 6c 61 74 66 6f 72 6d 20 5c 0d 0a "" $platform \..
216b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
216c0 20 20 2f 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c / $fileNameOnl
216d0 79 20 22 5c 22 2e 2e 2e 20 5c 22 22 20 5b 66 69 y "\"... \"" [fi
216e0 6c 65 20 76 65 72 73 69 6f 6e 20 5c 0d 0a 20 20 le version \..
216f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
21700 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 [getBinaryFileNa
21710 6d 65 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 me $fileNameOnly
21720 20 24 70 6c 61 74 66 6f 72 6d 5d 5d 20 5c 22 5c $platform]] \"\
21730 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 n]..
21740 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
21750 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 .. fore
21760 61 63 68 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 ach fileNameOnly
21770 20 5b 67 65 74 49 6e 74 65 72 6f 70 41 73 73 65 [getInteropAsse
21780 6d 62 6c 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c mblyFileNamesOnl
21790 79 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 y] {..
217a0 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 catch {..
217b0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
217c0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
217d0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
217e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
217f0 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 "---- file versi
21800 6f 6e 20 6f 66 20 5c 22 22 20 24 70 6c 61 74 66 on of \"" $platf
21810 6f 72 6d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 orm \..
21820 20 20 20 20 20 20 20 20 20 2f 20 24 66 69 6c 65 / $file
21830 4e 61 6d 65 4f 6e 6c 79 20 22 5c 22 2e 2e 2e 20 NameOnly "\"...
21840 5c 22 22 20 5b 66 69 6c 65 20 76 65 72 73 69 6f \"" [file versio
21850 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n \..
21860 20 20 20 20 20 20 20 5b 67 65 74 42 69 6e 61 72 [getBinar
21870 79 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e yFileName $fileN
21880 61 6d 65 4f 6e 6c 79 20 24 70 6c 61 74 66 6f 72 ameOnly $platfor
21890 6d 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 m]] \"\n]..
218a0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
218b0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
218c0 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 catch {..
218d0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
218e0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
218f0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
21900 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
21910 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 -- file version
21920 6f 66 20 5c 22 22 20 24 70 6c 61 74 66 6f 72 6d of \"" $platform
21930 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
21940 20 20 20 20 22 2f 53 79 73 74 65 6d 2e 44 61 74 "/System.Dat
21950 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5c 22 2e 2e a.SQLite.dll\"..
21960 2e 20 5c 22 22 20 5b 66 69 6c 65 20 76 65 72 73 . \"" [file vers
21970 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ion \..
21980 20 20 20 20 20 20 20 5b 67 65 74 42 69 6e 61 72 [getBinar
21990 79 46 69 6c 65 4e 61 6d 65 20 53 79 73 74 65 6d yFileName System
219a0 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c .Data.SQLite.dll
219b0 20 24 70 6c 61 74 66 6f 72 6d 5d 5d 20 5c 22 5c $platform]] \"\
219c0 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d n].. }.
219d0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
219e0 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
219f0 67 20 6c 65 6e 67 74 68 20 24 61 72 63 68 69 74 g length $archit
21a00 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 74 68 65 ecture] > 0} the
21a10 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 n {.. f
21a20 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 4f oreach fileNameO
21a30 6e 6c 79 20 5b 67 65 74 4e 61 74 69 76 65 4c 69 nly [getNativeLi
21a40 62 72 61 72 79 46 69 6c 65 4e 61 6d 65 73 4f 6e braryFileNamesOn
21a50 6c 79 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 ly] {..
21a60 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 catch {..
21a70 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
21a80 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
21a90 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
21aa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
21ab0 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 "---- file vers
21ac0 69 6f 6e 20 6f 66 20 5c 22 22 20 24 61 72 63 68 ion of \"" $arch
21ad0 69 74 65 63 74 75 72 65 20 5c 0d 0a 20 20 20 20 itecture \..
21ae0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 /
21af0 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 22 5c $fileNameOnly "\
21b00 22 2e 2e 2e 20 5c 22 22 20 5b 66 69 6c 65 20 76 "... \"" [file v
21b10 65 72 73 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 ersion \..
21b20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
21b30 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 BinaryFileName $
21b40 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 61 72 fileNameOnly $ar
21b50 63 68 69 74 65 63 74 75 72 65 5d 5d 20 5c 22 5c chitecture]] \"\
21b60 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 n]..
21b70 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
21b80 0d 0a 20 20 20 20 20 20 20 20 20 20 63 61 74 63 .. catc
21b90 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 h {..
21ba0 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
21bb0 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
21bc0 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
21bd0 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 "---- file
21be0 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 20 version of \""
21bf0 24 61 72 63 68 69 74 65 63 74 75 72 65 20 5c 0d $architecture \.
21c00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
21c10 20 2f 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 / $fileNameOnly
21c20 20 22 5c 22 2e 2e 2e 20 5c 22 22 20 5b 66 69 6c "\"... \"" [fil
21c30 65 20 76 65 72 73 69 6f 6e 20 5c 0d 0a 20 20 20 e version \..
21c40 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 [ge
21c50 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 tBinaryFileName
21c60 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 61 $fileNameOnly $a
21c70 72 63 68 69 74 65 63 74 75 72 65 5d 5d 20 5c 22 rchitecture]] \"
21c80 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
21c90 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 63 61 .... ca
21ca0 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
21cb0 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
21cc0 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
21cd0 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
21ce0 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 "---- fi
21cf0 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 le version of \"
21d00 22 20 24 61 72 63 68 69 74 65 63 74 75 72 65 20 " $architecture
21d10 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
21d20 20 20 20 22 2f 53 79 73 74 65 6d 2e 44 61 74 61 "/System.Data
21d30 2e 53 51 4c 69 74 65 2e 64 6c 6c 5c 22 2e 2e 2e .SQLite.dll\"...
21d40 20 5c 22 22 20 5b 66 69 6c 65 20 76 65 72 73 69 \"" [file versi
21d50 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 on \..
21d60 20 20 20 20 20 20 5b 67 65 74 42 69 6e 61 72 79 [getBinary
21d70 46 69 6c 65 4e 61 6d 65 20 53 79 73 74 65 6d 2e FileName System.
21d80 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 20 Data.SQLite.dll
21d90 24 61 72 63 68 69 74 65 63 74 75 72 65 5d 5d 20 $architecture]]
21da0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
21db0 20 20 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 \"\n]..
21dc0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
21dd0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
21de0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 47 # NOTE: G
21df0 72 61 62 20 74 68 65 20 6c 69 73 74 20 6f 66 20 rab the list of
21e00 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 69 managed assembli
21e10 65 73 20 66 6f 72 20 74 68 65 20 63 75 72 72 65 es for the curre
21e20 6e 74 20 70 72 6f 63 65 73 73 0d 0a 20 20 20 20 nt process..
21e30 20 20 20 20 23 20 20 20 20 20 20 20 61 6e 64 20 # and
21e40 72 65 70 6f 72 74 20 6f 6e 20 74 68 65 20 53 79 report on the Sy
21e50 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
21e60 20 72 65 6c 61 74 65 64 20 6f 6e 65 73 2e 0d 0a related ones...
21e70 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
21e80 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 if {[haveSQLi
21e90 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d teObjectCommand]
21ea0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
21eb0 20 20 20 20 73 65 74 20 61 73 73 65 6d 62 6c 69 set assembli
21ec0 65 73 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b es [object invok
21ed0 65 20 41 70 70 44 6f 6d 61 69 6e 2e 43 75 72 72 e AppDomain.Curr
21ee0 65 6e 74 44 6f 6d 61 69 6e 20 47 65 74 41 73 73 entDomain GetAss
21ef0 65 6d 62 6c 69 65 73 5d 0d 0a 0d 0a 20 20 20 20 emblies]....
21f00 20 20 20 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 object for
21f10 65 61 63 68 20 61 73 73 65 6d 62 6c 79 20 24 61 each assembly $a
21f20 73 73 65 6d 62 6c 69 65 73 20 7b 0d 0a 20 20 20 ssemblies {..
21f30 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 if {[st
21f40 72 69 6e 67 20 6d 61 74 63 68 20 5c 7b 53 79 73 ring match \{Sys
21f50 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2a tem.Data.SQLite*
21f60 20 24 61 73 73 65 6d 62 6c 79 5d 7d 20 74 68 65 $assembly]} the
21f70 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
21f80 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
21f90 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
21fa0 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
21fb0 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
21fc0 66 6f 75 6e 64 20 6c 6f 61 64 65 64 20 61 73 73 found loaded ass
21fd0 65 6d 62 6c 79 3a 20 22 20 24 61 73 73 65 6d 62 embly: " $assemb
21fe0 6c 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 ly \n]..
21ff0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
22000 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
22010 0a 20 20 20 20 20 20 20 20 63 61 74 63 68 20 7b . catch {
22020 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
22030 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
22040 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 l \..
22050 20 20 20 22 2d 2d 2d 2d 20 64 65 66 69 6e 65 20 "---- define
22060 63 6f 6e 73 74 61 6e 74 73 20 66 6f 72 20 5c 22 constants for \"
22070 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
22080 74 65 5c 22 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 te\"... "....
22090 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
220a0 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 h {..
220b0 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
220c0 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
220d0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
220e0 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e System.Data.
220f0 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 44 SQLite.SQLite3 D
22100 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 73 0d 0a efineConstants..
22110 20 20 20 20 20 20 20 20 20 20 7d 20 64 65 66 69 } defi
22120 6e 65 43 6f 6e 73 74 61 6e 74 73 5d 20 3d 3d 20 neConstants] ==
22130 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
22140 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
22150 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
22160 70 65 6e 64 41 72 67 73 20 5b 66 6f 72 6d 61 74 pendArgs [format
22170 4c 69 73 74 20 5b 6c 73 6f 72 74 20 5c 0d 0a 20 List [lsort \..
22180 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 $
22190 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 73 5d defineConstants]
221a0 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d 0d 0a 20 20 <none>] \n]..
221b0 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
221c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
221d0 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
221e0 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d 0a 20 nel unknown\n..
221f0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
22200 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
22210 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 catch {..
22220 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
22230 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 t_channel \..
22240 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
22250 20 73 6f 75 72 63 65 20 76 65 72 73 69 6f 6e 20 source version
22260 6f 66 20 5c 22 53 79 73 74 65 6d 2e 44 61 74 61 of \"System.Data
22270 2e 53 51 4c 69 74 65 2e 64 6c 6c 5c 22 2e 2e 2e .SQLite.dll\"...
22280 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 "....
22290 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 if {[catch {..
222a0 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
222b0 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
222c0 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 NonPublic \..
222d0 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 Sys
222e0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
222f0 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e SQLiteConnection
22300 20 50 72 6f 76 69 64 65 72 56 65 72 73 69 6f 6e ProviderVersion
22310 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 76 65 .. } ve
22320 72 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 rsion] == 0} the
22330 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
22340 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
22350 67 74 68 20 24 76 65 72 73 69 6f 6e 5d 20 3d 3d gth $version] ==
22360 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
22370 20 20 20 20 20 20 20 20 20 20 73 65 74 20 76 65 set ve
22380 72 73 69 6f 6e 20 6e 75 6c 6c 0d 0a 20 20 20 20 rsion null..
22390 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
223a0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
223b0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
223c0 70 65 6e 64 41 72 67 73 20 24 76 65 72 73 69 6f pendArgs $versio
223d0 6e 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 n \n]..
223e0 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
223f0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
22400 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 75 6e 6b test_channel unk
22410 6e 6f 77 6e 5c 6e 0d 0a 20 20 20 20 20 20 20 20 nown\n..
22420 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
22430 0d 0a 20 20 20 20 20 20 20 20 63 61 74 63 68 20 .. catch
22440 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 {.. tpu
22450 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
22460 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 el \..
22470 20 20 20 20 22 2d 2d 2d 2d 20 73 6f 75 72 63 65 "---- source
22480 20 63 68 65 63 6b 6f 75 74 20 6f 66 20 5c 22 53 checkout of \"S
22490 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
224a0 65 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 0d 0a 0d 0a e.dll\"... "....
224b0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 if {[c
224c0 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
224d0 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b object invok
224e0 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 e -flags +NonPub
224f0 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 lic \..
22500 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 System.Da
22510 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 ta.SQLite.SQLite
22520 43 6f 6e 6e 65 63 74 69 6f 6e 20 50 72 6f 76 69 Connection Provi
22530 64 65 72 53 6f 75 72 63 65 49 64 0d 0a 20 20 20 derSourceId..
22540 20 20 20 20 20 20 20 7d 20 73 6f 75 72 63 65 49 } sourceI
22550 64 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d d] == 0} then {.
22560 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
22570 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
22580 24 73 6f 75 72 63 65 49 64 5d 20 3d 3d 20 30 7d $sourceId] == 0}
22590 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
225a0 20 20 20 20 20 20 20 73 65 74 20 73 6f 75 72 63 set sourc
225b0 65 49 64 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 eId null..
225c0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
225d0 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
225e0 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
225f0 6e 64 41 72 67 73 20 24 73 6f 75 72 63 65 49 64 ndArgs $sourceId
22600 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
22610 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
22620 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
22630 65 73 74 5f 63 68 61 6e 6e 65 6c 20 75 6e 6b 6e est_channel unkn
22640 6f 77 6e 5c 6e 0d 0a 20 20 20 20 20 20 20 20 20 own\n..
22650 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
22660 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
22670 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 # NOTE: Chec
22680 6b 20 74 68 65 20 61 76 61 69 6c 61 62 6c 65 20 k the available
22690 62 75 69 6c 64 73 20 28 61 6e 64 20 22 72 65 6c builds (and "rel
226a0 65 61 73 65 73 22 29 20 6f 66 20 53 51 4c 69 74 eases") of SQLit
226b0 65 20 61 6e 64 0d 0a 20 20 20 20 20 20 20 20 23 e and.. #
226c0 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 System.Da
226d0 74 61 2e 53 51 4c 69 74 65 2e 0d 0a 20 20 20 20 ta.SQLite...
226e0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 63 #.. c
226f0 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 42 75 69 heckForSQLiteBui
22700 6c 64 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e lds $::test_chan
22710 6e 65 6c 0d 0a 20 20 20 20 20 20 20 20 63 68 65 nel.. che
22720 63 6b 46 6f 72 53 51 4c 69 74 65 52 65 6c 65 61 ckForSQLiteRelea
22730 73 65 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e ses $::test_chan
22740 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 nel.... #
22750 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
22760 3a 20 4e 6f 77 2c 20 77 65 20 6e 65 65 64 20 74 : Now, we need t
22770 6f 20 6b 6e 6f 77 20 69 66 20 74 68 65 20 53 51 o know if the SQ
22780 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 Lite core librar
22790 79 20 69 73 20 61 76 61 69 6c 61 62 6c 65 0d 0a y is available..
227a0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
227b0 28 69 2e 65 2e 20 62 65 63 61 75 73 65 20 74 68 (i.e. because th
227c0 65 20 6d 61 6e 61 67 65 64 2d 6f 6e 6c 79 20 53 e managed-only S
227d0 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
227e0 65 20 61 73 73 65 6d 62 6c 79 20 63 61 6e 0d 0a e assembly can..
227f0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
22800 6c 6f 61 64 20 77 69 74 68 6f 75 74 20 69 74 3b load without it;
22810 20 68 6f 77 65 76 65 72 2c 20 69 74 20 63 61 6e however, it can
22820 6e 6f 74 20 64 6f 20 61 6e 79 74 68 69 6e 67 20 not do anything
22830 75 73 65 66 75 6c 20 77 69 74 68 6f 75 74 0d 0a useful without..
22840 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
22850 69 74 29 2e 20 20 49 66 20 77 65 20 61 72 65 20 it). If we are
22860 75 73 69 6e 67 20 74 68 65 20 6d 69 78 65 64 2d using the mixed-
22870 6d 6f 64 65 20 61 73 73 65 6d 62 6c 79 20 61 6e mode assembly an
22880 64 20 77 65 20 61 6c 72 65 61 64 79 0d 0a 20 20 d we already..
22890 20 20 20 20 20 20 23 20 20 20 20 20 20 20 66 6f # fo
228a0 75 6e 64 20 69 74 20 28 61 62 6f 76 65 29 2c 20 und it (above),
228b0 74 68 69 73 20 73 68 6f 75 6c 64 20 61 6c 77 61 this should alwa
228c0 79 73 20 73 75 63 63 65 65 64 2e 0d 0a 20 20 20 ys succeed...
228d0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
228e0 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 4c 69 checkForSQLiteLi
228f0 62 72 61 72 79 20 24 3a 3a 74 65 73 74 5f 63 68 brary $::test_ch
22900 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 annel....
22910 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
22920 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 65 TE: Check if the
22930 20 53 51 4c 69 74 65 20 69 6e 74 65 72 6f 70 20 SQLite interop
22940 61 73 73 65 6d 62 6c 79 20 69 73 20 61 76 61 69 assembly is avai
22950 6c 61 62 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 lable...
22960 23 0d 0a 20 20 20 20 20 20 20 20 63 68 65 63 6b #.. check
22970 46 6f 72 53 51 4c 69 74 65 49 6e 74 65 72 6f 70 ForSQLiteInterop
22980 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
22990 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
229a0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 # NOTE: C
229b0 68 65 63 6b 20 74 68 65 20 53 51 4c 69 74 65 20 heck the SQLite
229c0 64 61 74 61 62 61 73 65 20 61 6e 64 20 74 65 6d database and tem
229d0 70 6f 72 61 72 79 20 64 69 72 65 63 74 6f 72 69 porary directori
229e0 65 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a es... #..
229f0 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
22a00 53 51 4c 69 74 65 44 69 72 65 63 74 6f 72 69 65 SQLiteDirectorie
22a10 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
22a20 6c 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a l.... #..
22a30 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
22a40 41 74 74 65 6d 70 74 20 74 6f 20 64 65 74 65 72 Attempt to deter
22a50 6d 69 6e 65 20 69 66 20 76 61 72 69 6f 75 73 20 mine if various
22a60 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 6f 70 74 compile-time opt
22a70 69 6f 6e 73 20 6e 65 65 64 65 64 20 66 6f 72 0d ions needed for.
22a80 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
22a90 20 74 65 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 test constraint
22aa0 73 20 77 65 72 65 20 65 6e 61 62 6c 65 64 20 66 s were enabled f
22ab0 6f 72 20 74 68 65 20 6d 61 6e 61 67 65 64 20 61 or the managed a
22ac0 73 73 65 6d 62 6c 79 2e 20 20 54 68 65 72 65 0d ssembly. There.
22ad0 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
22ae0 20 61 72 65 20 73 6f 6d 65 20 63 6f 6d 70 69 6c are some compil
22af0 65 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 73 20 74 e-time options t
22b00 68 61 74 20 6d 75 73 74 20 61 6c 73 6f 20 68 61 hat must also ha
22b10 76 65 20 62 65 65 6e 20 65 6e 61 62 6c 65 64 0d ve been enabled.
22b20 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
22b30 20 66 6f 72 20 74 68 65 20 69 6e 74 65 72 6f 70 for the interop
22b40 20 61 73 73 65 6d 62 6c 79 20 69 6e 20 6f 72 64 assembly in ord
22b50 65 72 20 74 6f 20 62 65 20 65 66 66 65 63 74 69 er to be effecti
22b60 76 65 2e 20 20 46 6f 72 20 74 68 6f 73 65 0d 0a ve. For those..
22b70 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
22b80 6f 70 74 69 6f 6e 73 2c 20 69 74 20 77 69 6c 6c options, it will
22b90 20 62 65 20 61 73 73 75 6d 65 64 20 74 68 61 74 be assumed that
22ba0 20 69 74 20 77 61 73 20 65 6e 61 62 6c 65 64 20 it was enabled
22bb0 66 6f 72 20 74 68 65 20 69 6e 74 65 72 6f 70 0d for the interop.
22bc0 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
22bd0 20 61 73 73 65 6d 62 6c 79 20 69 66 20 69 74 20 assembly if it
22be0 77 61 73 20 65 6e 61 62 6c 65 64 20 66 6f 72 20 was enabled for
22bf0 74 68 65 20 6d 61 6e 61 67 65 64 20 61 73 73 65 the managed asse
22c00 6d 62 6c 79 2e 0d 0a 20 20 20 20 20 20 20 20 23 mbly... #
22c10 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 .. foreac
22c20 68 20 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 h defineConstant
22c30 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 [list \..
22c40 20 20 20 20 20 20 43 48 45 43 4b 5f 53 54 41 54 CHECK_STAT
22c50 45 20 43 4f 55 4e 54 5f 48 41 4e 44 4c 45 20 44 E COUNT_HANDLE D
22c60 45 42 55 47 20 49 4e 54 45 52 4f 50 5f 43 4f 44 EBUG INTEROP_COD
22c70 45 43 20 49 4e 54 45 52 4f 50 5f 44 45 42 55 47 EC INTEROP_DEBUG
22c80 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
22c90 49 4e 54 45 52 4f 50 5f 45 58 54 45 4e 53 49 4f INTEROP_EXTENSIO
22ca0 4e 5f 46 55 4e 43 54 49 4f 4e 53 20 49 4e 54 45 N_FUNCTIONS INTE
22cb0 52 4f 50 5f 46 54 53 35 5f 45 58 54 45 4e 53 49 ROP_FTS5_EXTENSI
22cc0 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ON \..
22cd0 20 20 49 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 44 INTEROP_INCLUD
22ce0 45 5f 43 45 52 4f 44 20 49 4e 54 45 52 4f 50 5f E_CEROD INTEROP_
22cf0 49 4e 43 4c 55 44 45 5f 45 58 54 52 41 20 49 4e INCLUDE_EXTRA IN
22d00 54 45 52 4f 50 5f 49 4e 43 4c 55 44 45 5f 53 45 TEROP_INCLUDE_SE
22d10 45 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 E \..
22d20 20 49 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 44 45 INTEROP_INCLUDE
22d30 5f 5a 49 50 56 46 53 20 49 4e 54 45 52 4f 50 5f _ZIPVFS INTEROP_
22d40 4a 53 4f 4e 31 5f 45 58 54 45 4e 53 49 4f 4e 20 JSON1_EXTENSION
22d50 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 49 \.. I
22d60 4e 54 45 52 4f 50 5f 4c 45 47 41 43 59 5f 43 4c NTEROP_LEGACY_CL
22d70 4f 53 45 20 49 4e 54 45 52 4f 50 5f 4c 4f 47 20 OSE INTEROP_LOG
22d80 49 4e 54 45 52 4f 50 5f 50 45 52 43 45 4e 54 49 INTEROP_PERCENTI
22d90 4c 45 5f 45 58 54 45 4e 53 49 4f 4e 20 5c 0d 0a LE_EXTENSION \..
22da0 20 20 20 20 20 20 20 20 20 20 20 20 49 4e 54 45 INTE
22db0 52 4f 50 5f 52 45 47 45 58 50 5f 45 58 54 45 4e ROP_REGEXP_EXTEN
22dc0 53 49 4f 4e 20 49 4e 54 45 52 4f 50 5f 54 45 53 SION INTEROP_TES
22dd0 54 5f 45 58 54 45 4e 53 49 4f 4e 20 5c 0d 0a 20 T_EXTENSION \..
22de0 20 20 20 20 20 20 20 20 20 20 20 49 4e 54 45 52 INTER
22df0 4f 50 5f 54 4f 54 59 50 45 5f 45 58 54 45 4e 53 OP_TOTYPE_EXTENS
22e00 49 4f 4e 20 49 4e 54 45 52 4f 50 5f 56 49 52 54 ION INTEROP_VIRT
22e10 55 41 4c 5f 54 41 42 4c 45 20 4e 45 54 5f 32 30 UAL_TABLE NET_20
22e20 20 4e 45 54 5f 33 35 20 5c 0d 0a 20 20 20 20 20 NET_35 \..
22e30 20 20 20 20 20 20 20 4e 45 54 5f 34 30 20 4e 45 NET_40 NE
22e40 54 5f 34 35 20 4e 45 54 5f 34 35 31 20 4e 45 54 T_45 NET_451 NET
22e50 5f 34 35 32 20 4e 45 54 5f 34 36 20 4e 45 54 5f _452 NET_46 NET_
22e60 34 36 31 20 4e 45 54 5f 43 4f 4d 50 41 43 54 5f 461 NET_COMPACT_
22e70 32 30 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 \..
22e80 20 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 PLATFORM_COMPA
22e90 43 54 46 52 41 4d 45 57 4f 52 4b 20 50 52 45 4c CTFRAMEWORK PREL
22ea0 4f 41 44 5f 4e 41 54 49 56 45 5f 4c 49 42 52 41 OAD_NATIVE_LIBRA
22eb0 52 59 20 52 45 54 41 52 47 45 54 41 42 4c 45 20 RY RETARGETABLE
22ec0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 \.. S
22ed0 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 20 53 QLITE_STANDARD S
22ee0 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 5f 4c QLITE_STANDARD_L
22ef0 49 42 52 41 52 59 5f 4e 41 4d 45 20 54 48 52 4f IBRARY_NAME THRO
22f00 57 5f 4f 4e 5f 44 49 53 50 4f 53 45 44 20 5c 0d W_ON_DISPOSED \.
22f10 0a 20 20 20 20 20 20 20 20 20 20 20 20 54 52 41 . TRA
22f20 43 45 20 54 52 41 43 45 5f 43 4f 4e 4e 45 43 54 CE TRACE_CONNECT
22f30 49 4f 4e 20 54 52 41 43 45 5f 44 45 54 45 43 54 ION TRACE_DETECT
22f40 49 4f 4e 20 54 52 41 43 45 5f 48 41 4e 44 4c 45 ION TRACE_HANDLE
22f50 20 54 52 41 43 45 5f 50 52 45 4c 4f 41 44 20 5c TRACE_PRELOAD \
22f60 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 54 52 .. TR
22f70 41 43 45 5f 53 48 41 52 45 44 20 54 52 41 43 45 ACE_SHARED TRACE
22f80 5f 53 54 41 54 45 4d 45 4e 54 20 54 52 41 43 45 _STATEMENT TRACE
22f90 5f 57 41 52 4e 49 4e 47 20 54 52 41 43 4b 5f 4d _WARNING TRACK_M
22fa0 45 4d 4f 52 59 5f 42 59 54 45 53 20 5c 0d 0a 20 EMORY_BYTES \..
22fb0 20 20 20 20 20 20 20 20 20 20 20 55 53 45 5f 45 USE_E
22fc0 4e 54 49 54 59 5f 46 52 41 4d 45 57 4f 52 4b 5f NTITY_FRAMEWORK_
22fd0 36 20 55 53 45 5f 49 4e 54 45 52 4f 50 5f 44 4c 6 USE_INTEROP_DL
22fe0 4c 20 55 53 45 5f 50 52 45 50 41 52 45 5f 56 32 L USE_PREPARE_V2
22ff0 20 57 49 4e 44 4f 57 53 5d 20 7b 0d 0a 20 20 20 WINDOWS] {..
23000 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
23010 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 # NOTE: Chec
23020 6b 20 69 66 20 74 68 65 20 63 6f 6d 70 69 6c 65 k if the compile
23030 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 20 69 73 20 -time option is
23040 6c 69 73 74 65 64 20 69 6e 20 74 68 65 20 6c 69 listed in the li
23050 73 74 20 6f 66 0d 0a 20 20 20 20 20 20 20 20 20 st of..
23060 20 23 20 20 20 20 20 20 20 22 64 65 66 69 6e 65 # "define
23070 20 63 6f 6e 73 74 61 6e 74 73 22 20 6b 65 70 74 constants" kept
23080 20 74 72 61 63 6b 20 6f 66 20 62 79 20 74 68 65 track of by the
23090 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c managed assembl
230a0 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d y... #.
230b0 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b . check
230c0 46 6f 72 53 51 4c 69 74 65 44 65 66 69 6e 65 43 ForSQLiteDefineC
230d0 6f 6e 73 74 61 6e 74 20 24 3a 3a 74 65 73 74 5f onstant $::test_
230e0 63 68 61 6e 6e 65 6c 20 24 64 65 66 69 6e 65 43 channel $defineC
230f0 6f 6e 73 74 61 6e 74 0d 0a 20 20 20 20 20 20 20 onstant..
23100 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d }.... #.
23110 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
23120 20 43 68 65 63 6b 20 69 66 20 74 68 65 20 53 79 Check if the Sy
23130 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
23140 20 70 72 6f 76 69 64 65 72 20 77 61 73 20 63 6f provider was co
23150 6d 70 69 6c 65 64 20 77 69 74 68 0d 0a 20 20 20 mpiled with..
23160 20 20 20 20 20 23 20 20 20 20 20 20 20 73 75 70 # sup
23170 70 6f 72 74 20 66 6f 72 20 61 6e 79 20 65 6e 63 port for any enc
23180 72 79 70 74 65 64 20 64 61 74 61 62 61 73 65 73 rypted databases
23190 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
231a0 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 if {[haveS
231b0 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 QLiteDefineConst
231c0 61 6e 74 20 49 4e 54 45 52 4f 50 5f 43 4f 44 45 ant INTEROP_CODE
231d0 43 5d 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 C] || \..
231e0 20 20 20 20 20 5b 68 61 76 65 53 51 4c 69 74 65 [haveSQLite
231f0 44 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 20 49 DefineConstant I
23200 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 44 45 5f 53 NTEROP_INCLUDE_S
23210 45 45 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 EE]} then {..
23220 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
23230 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 65 73 2c # NOTE: Yes,
23240 20 61 64 64 20 67 65 6e 65 72 69 63 20 63 6f 6e add generic con
23250 73 74 72 61 69 6e 74 20 66 6f 72 20 75 73 65 20 straint for use
23260 62 79 20 74 68 65 20 74 65 73 74 20 73 75 69 74 by the test suit
23270 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d e... #.
23280 0a 20 20 20 20 20 20 20 20 20 20 61 64 64 43 6f . addCo
23290 6e 73 74 72 61 69 6e 74 20 53 79 73 74 65 6d 2e nstraint System.
232a0 44 61 74 61 2e 53 51 4c 69 74 65 2e 45 6e 63 72 Data.SQLite.Encr
232b0 79 70 74 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 yption..
232c0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a }.... #..
232d0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
232e0 43 68 65 63 6b 20 74 68 65 20 63 75 72 72 65 6e Check the curren
232f0 74 20 62 75 69 6c 64 20 79 65 61 72 2e 20 20 42 t build year. B
23300 61 73 69 63 61 6c 6c 79 2c 20 74 68 69 73 20 69 asically, this i
23310 6e 64 69 63 61 74 65 73 0d 0a 20 20 20 20 20 20 ndicates..
23320 20 20 23 20 20 20 20 20 20 20 77 68 69 63 68 20 # which
23330 76 65 72 73 69 6f 6e 20 6f 66 20 4d 53 42 75 69 version of MSBui
23340 6c 64 20 61 6e 64 2f 6f 72 20 56 69 73 75 61 6c ld and/or Visual
23350 20 53 74 75 64 69 6f 20 77 61 73 20 75 73 65 64 Studio was used
23360 20 74 6f 0d 0a 20 20 20 20 20 20 20 20 23 20 20 to.. #
23370 20 20 20 20 20 63 6f 6d 70 69 6c 65 20 74 68 65 compile the
23380 20 61 73 73 65 6d 62 6c 79 20 62 69 6e 61 72 69 assembly binari
23390 65 73 20 75 6e 64 65 72 20 74 65 73 74 2e 0d 0a es under test...
233a0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
233b0 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
233c0 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 _channel \..
233d0 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 "---- ch
233e0 65 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 74 65 ecking for Syste
233f0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 62 75 m.Data.SQLite bu
23400 69 6c 64 20 79 65 61 72 2e 2e 2e 20 22 0d 0a 0d ild year... "...
23410 0a 20 20 20 20 20 20 20 20 73 65 74 20 79 65 61 . set yea
23420 72 20 5b 67 65 74 42 75 69 6c 64 59 65 61 72 5d r [getBuildYear]
23430 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e .. addCon
23440 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
23450 72 67 73 20 62 75 69 6c 64 59 65 61 72 2e 20 24 rgs buildYear. $
23460 79 65 61 72 5d 0d 0a 20 20 20 20 20 20 20 20 74 year].. t
23470 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
23480 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
23490 20 5c 22 20 24 79 65 61 72 20 5c 22 5c 6e 5d 0d \" $year \"\n].
234a0 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
234b0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 # NOTE: Ch
234c0 65 63 6b 20 74 68 65 20 63 75 72 72 65 6e 74 20 eck the current
234d0 62 75 69 6c 64 20 2e 4e 45 54 20 46 72 61 6d 65 build .NET Frame
234e0 77 6f 72 6b 2e 20 20 42 61 73 69 63 61 6c 6c 79 work. Basically
234f0 2c 20 74 68 69 73 0d 0a 20 20 20 20 20 20 20 20 , this..
23500 23 20 20 20 20 20 20 20 69 6e 64 69 63 61 74 65 # indicate
23510 73 20 77 68 69 63 68 20 76 65 72 73 69 6f 6e 20 s which version
23520 6f 66 20 74 68 65 20 2e 4e 45 54 20 46 72 61 6d of the .NET Fram
23530 65 77 6f 72 6b 20 69 73 20 62 65 69 6e 67 0d 0a ework is being..
23540 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
23550 75 73 65 64 20 62 79 20 74 68 65 20 61 73 73 65 used by the asse
23560 6d 62 6c 79 20 62 69 6e 61 72 69 65 73 20 75 6e mbly binaries un
23570 64 65 72 20 74 65 73 74 2e 0d 0a 20 20 20 20 20 der test...
23580 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 70 #.. tp
23590 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
235a0 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 nel \..
235b0 20 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e "---- checkin
235c0 67 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 61 74 g for System.Dat
235d0 61 2e 53 51 4c 69 74 65 20 62 75 69 6c 64 20 2e a.SQLite build .
235e0 4e 45 54 20 46 72 61 6d 65 77 6f 72 6b 2e 2e 2e NET Framework...
235f0 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 ".... se
23600 74 20 6e 65 74 46 78 20 5b 67 65 74 42 75 69 6c t netFx [getBuil
23610 64 4e 65 74 46 78 5d 0d 0a 20 20 20 20 20 20 20 dNetFx]..
23620 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 5b addConstraint [
23630 61 70 70 65 6e 64 41 72 67 73 20 62 75 69 6c 64 appendArgs build
23640 46 72 61 6d 65 77 6f 72 6b 2e 20 24 6e 65 74 46 Framework. $netF
23650 78 5d 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 x].. tput
23660 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
23670 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 22 l [appendArgs \"
23680 20 24 6e 65 74 46 78 20 5c 22 5c 6e 5d 0d 0a 0d $netFx \"\n]...
23690 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
236a0 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 # NOTE: Chec
236b0 6b 20 74 68 65 20 63 75 72 72 65 6e 74 20 62 75 k the current bu
236c0 69 6c 64 20 63 6f 6e 66 69 67 75 72 61 74 69 6f ild configuratio
236d0 6e 2e 20 20 54 68 69 73 20 73 68 6f 75 6c 64 20 n. This should
236e0 6e 6f 72 6d 61 6c 6c 79 0d 0a 20 20 20 20 20 20 normally..
236f0 20 20 23 20 20 20 20 20 20 20 62 65 20 65 69 74 # be eit
23700 68 65 72 20 22 44 65 62 75 67 22 20 6f 72 20 22 her "Debug" or "
23710 52 65 6c 65 61 73 65 22 2e 0d 0a 20 20 20 20 20 Release"...
23720 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 74 70 #.. tp
23730 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
23740 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 nel \..
23750 20 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e "---- checkin
23760 67 20 66 6f 72 20 53 79 73 74 65 6d 2e 44 61 74 g for System.Dat
23770 61 2e 53 51 4c 69 74 65 20 62 75 69 6c 64 20 63 a.SQLite build c
23780 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2e 2e 2e 20 onfiguration...
23790 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 ".... set
237a0 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 5b configuration [
237b0 67 65 74 42 75 69 6c 64 43 6f 6e 66 69 67 75 72 getBuildConfigur
237c0 61 74 69 6f 6e 5d 0d 0a 20 20 20 20 20 20 20 20 ation]..
237d0 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 addConstraint [a
237e0 70 70 65 6e 64 41 72 67 73 20 62 75 69 6c 64 43 ppendArgs buildC
237f0 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2e 20 24 63 onfiguration. $c
23800 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5d 0d 0a 20 onfiguration]..
23810 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
23820 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
23830 70 65 6e 64 41 72 67 73 20 5c 22 20 24 63 6f 6e pendArgs \" $con
23840 66 69 67 75 72 61 74 69 6f 6e 20 5c 22 5c 6e 5d figuration \"\n]
23850 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
23860 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 # NOTE: T
23870 72 79 20 74 6f 20 73 65 74 75 70 20 61 6e 20 69 ry to setup an i
23880 6e 74 65 72 72 75 70 74 20 63 61 6c 6c 62 61 63 nterrupt callbac
23890 6b 20 75 73 69 6e 67 20 74 68 65 20 73 63 72 69 k using the scri
238a0 70 74 20 64 65 62 75 67 67 65 72 0d 0a 20 20 20 pt debugger..
238b0 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 61 # tha
238c0 74 20 77 69 6c 6c 20 63 61 6e 63 65 6c 20 61 6c t will cancel al
238d0 6c 20 53 51 4c 20 71 75 65 72 69 65 73 20 69 6e l SQL queries in
238e0 20 70 72 6f 67 72 65 73 73 20 66 6f 72 20 61 6c progress for al
238f0 6c 20 64 61 74 61 62 61 73 65 0d 0a 20 20 20 20 l database..
23900 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 6e # conn
23910 65 63 74 69 6f 6e 73 20 6b 6e 6f 77 6e 20 74 6f ections known to
23920 20 74 68 69 73 20 69 6e 74 65 72 70 72 65 74 65 this interprete
23930 72 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 r... #..
23940 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
23950 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 73 71 o exists ::no(sq
23960 6c 69 74 65 49 6e 74 65 72 72 75 70 74 43 61 6c liteInterruptCal
23970 6c 62 61 63 6b 29 5d 7d 20 74 68 65 6e 20 7b 0d lback)]} then {.
23980 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 75 70 . setup
23990 44 62 49 6e 74 65 72 72 75 70 74 43 61 6c 6c 62 DbInterruptCallb
239a0 61 63 6b 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e ack $::test_chan
239b0 6e 65 6c 20 24 3a 3a 74 65 73 74 5f 6c 6f 67 0d nel $::test_log.
239c0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
239d0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
239e0 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 66 # NOTE: Check f
239f0 6f 72 20 74 68 65 20 6e 61 74 69 76 65 20 72 75 or the native ru
23a00 6e 74 69 6d 65 20 6f 70 74 69 6f 6e 2c 20 77 68 ntime option, wh
23a10 69 63 68 20 77 6f 75 6c 64 20 6d 65 61 6e 20 77 ich would mean w
23a20 65 20 61 72 65 0d 0a 20 20 20 20 20 20 20 20 23 e are.. #
23a30 20 20 20 20 20 20 20 75 73 69 6e 67 20 74 68 65 using the
23a40 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 73 65 mixed-mode asse
23a50 6d 62 6c 79 2e 0d 0a 20 20 20 20 20 20 20 20 23 mbly... #
23a60 0d 0a 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 .. checkF
23a70 6f 72 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 orRuntimeOption
23a80 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
23a90 6e 61 74 69 76 65 0d 0a 0d 0a 20 20 20 20 20 20 native....
23aa0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
23ab0 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 OTE: Check if th
23ac0 65 20 74 65 73 74 20 73 75 69 74 65 20 73 68 6f e test suite sho
23ad0 75 6c 64 20 63 6f 75 6e 74 20 74 68 65 20 6e 75 uld count the nu
23ae0 6d 62 65 72 20 6f 66 20 63 6f 6e 6e 65 63 74 69 mber of connecti
23af0 6f 6e 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ons.. #
23b00 20 20 20 20 20 22 6f 70 65 6e 65 64 22 20 61 6e "opened" an
23b10 64 20 22 63 6c 6f 73 65 64 22 20 66 72 6f 6d 20 d "closed" from
23b20 74 68 65 20 70 6f 6f 6c 20 77 68 65 6e 20 64 65 the pool when de
23b30 74 65 72 6d 69 6e 69 6e 67 20 69 66 20 61 20 74 termining if a t
23b40 65 73 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 est.. #
23b50 20 20 20 20 20 70 61 73 73 65 64 2e 20 20 44 69 passed. Di
23b60 73 61 62 6c 69 6e 67 20 74 68 69 73 20 62 65 68 sabling this beh
23b70 61 76 69 6f 72 20 69 73 20 73 6f 6d 65 74 69 6d avior is sometim
23b80 65 73 20 6e 65 63 65 73 73 61 72 79 20 28 65 2e es necessary (e.
23b90 67 2e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 g... #
23ba0 20 20 20 20 64 75 72 69 6e 67 20 74 68 65 20 72 during the r
23bb0 65 6c 65 61 73 65 20 74 65 73 74 69 6e 67 20 70 elease testing p
23bc0 72 6f 63 65 73 73 29 20 62 65 63 61 75 73 65 20 rocess) because
23bd0 74 68 65 72 65 20 61 72 65 20 73 65 76 65 72 61 there are severa
23be0 6c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 l.. #
23bf0 20 20 20 74 65 73 74 73 20 74 68 61 74 20 72 65 tests that re
23c00 6c 79 20 6f 6e 20 74 68 65 20 22 6f 70 65 6e 65 ly on the "opene
23c10 64 20 66 72 6f 6d 20 70 6f 6f 6c 22 20 63 6f 75 d from pool" cou
23c20 6e 74 20 62 65 69 6e 67 20 67 72 65 61 74 65 72 nt being greater
23c30 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
23c40 20 20 74 68 61 6e 20 7a 65 72 6f 2e 20 20 54 68 than zero. Th
23c50 65 73 65 20 74 65 73 74 73 20 6d 61 79 20 66 61 ese tests may fa
23c60 69 6c 20 64 75 65 20 74 6f 20 74 68 65 20 6e 6f il due to the no
23c70 6e 2d 64 65 74 65 72 6d 69 6e 69 73 74 69 63 0d n-deterministic.
23c80 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
23c90 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 behavior of the
23ca0 20 43 4c 52 20 47 43 2c 20 65 76 65 6e 20 77 68 CLR GC, even wh
23cb0 65 6e 20 74 68 65 72 65 20 69 73 20 6e 6f 20 62 en there is no b
23cc0 75 67 20 69 6e 20 74 68 65 20 63 6f 64 65 0d 0a ug in the code..
23cd0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
23ce0 62 65 69 6e 67 20 74 65 73 74 65 64 2e 0d 0a 20 being tested...
23cf0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
23d00 20 20 63 68 65 63 6b 46 6f 72 52 75 6e 74 69 6d checkForRuntim
23d10 65 4f 70 74 69 6f 6e 20 24 3a 3a 74 65 73 74 5f eOption $::test_
23d20 63 68 61 6e 6e 65 6c 20 6e 6f 50 6f 6f 6c 43 6f channel noPoolCo
23d30 75 6e 74 73 0d 0a 0d 0a 20 20 20 20 20 20 20 20 unts....
23d40 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
23d50 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 65 20 E: Check if the
23d60 74 65 73 74 20 73 75 69 74 65 20 73 68 6f 75 6c test suite shoul
23d70 64 20 75 73 65 20 73 68 61 72 65 64 2d 63 61 63 d use shared-cac
23d80 68 65 20 6d 6f 64 65 2e 0d 0a 20 20 20 20 20 20 he mode...
23d90 20 20 23 0d 0a 20 20 20 20 20 20 20 20 63 68 65 #.. che
23da0 63 6b 46 6f 72 52 75 6e 74 69 6d 65 4f 70 74 69 ckForRuntimeOpti
23db0 6f 6e 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e on $::test_chann
23dc0 65 6c 20 73 68 61 72 65 64 43 61 63 68 65 0d 0a el sharedCache..
23dd0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
23de0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 70 # NOTE: Rep
23df0 6f 72 74 20 74 68 65 20 72 65 73 6f 75 72 63 65 ort the resource
23e00 20 75 73 61 67 65 20 70 72 69 6f 72 20 74 6f 20 usage prior to
23e10 72 75 6e 6e 69 6e 67 20 61 6e 79 20 74 65 73 74 running any test
23e20 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 s... #..
23e30 20 20 20 20 20 20 20 72 65 70 6f 72 74 53 51 4c reportSQL
23e40 69 74 65 52 65 73 6f 75 72 63 65 73 20 24 3a 3a iteResources $::
23e50 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a test_channel....
23e60 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
23e70 20 20 20 23 20 4e 4f 54 45 3a 20 47 72 61 62 20 # NOTE: Grab
23e80 74 68 65 20 6c 69 73 74 20 6f 66 20 6e 61 74 69 the list of nati
23e90 76 65 20 6d 6f 64 75 6c 65 73 20 66 6f 72 20 74 ve modules for t
23ea0 68 65 20 63 75 72 72 65 6e 74 20 70 72 6f 63 65 he current proce
23eb0 73 73 20 61 6e 64 0d 0a 20 20 20 20 20 20 20 20 ss and..
23ec0 23 20 20 20 20 20 20 20 72 65 70 6f 72 74 20 6f # report o
23ed0 6e 20 74 68 65 20 53 79 73 74 65 6d 2e 44 61 74 n the System.Dat
23ee0 61 2e 53 51 4c 69 74 65 20 72 65 6c 61 74 65 64 a.SQLite related
23ef0 20 6f 6e 65 73 2e 0d 0a 20 20 20 20 20 20 20 20 ones...
23f00 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
23f10 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 haveSQLiteObject
23f20 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b Command]} then {
23f30 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
23f40 6d 6f 64 75 6c 65 73 20 5b 6f 62 6a 65 63 74 20 modules [object
23f50 69 6e 76 6f 6b 65 20 5c 0d 0a 20 20 20 20 20 20 invoke \..
23f60 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
23f70 69 61 67 6e 6f 73 74 69 63 73 2e 50 72 6f 63 65 iagnostics.Proce
23f80 73 73 2e 47 65 74 43 75 72 72 65 6e 74 50 72 6f ss.GetCurrentPro
23f90 63 65 73 73 20 4d 6f 64 75 6c 65 73 5d 0d 0a 0d cess Modules]...
23fa0 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 . objec
23fb0 74 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 61 73 t foreach -alias
23fc0 20 6d 6f 64 75 6c 65 20 24 6d 6f 64 75 6c 65 73 module $modules
23fd0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
23fe0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 #.. #
23ff0 20 4e 4f 54 45 3a 20 54 68 65 20 6d 6f 64 75 6c NOTE: The modul
24000 65 20 66 69 6c 65 20 6e 61 6d 65 20 68 65 72 65 e file name here
24010 20 6d 75 73 74 20 62 65 20 6e 6f 72 6d 61 6c 69 must be normali
24020 7a 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 zed...
24030 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
24040 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 set fileName [f
24050 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a 65 20 5b 24 ile normalize [$
24060 6d 6f 64 75 6c 65 20 46 69 6c 65 4e 61 6d 65 5d module FileName]
24070 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 ].. s
24080 65 74 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 et fileNameOnly
24090 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 [file tail $file
240a0 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 Name]....
240b0 20 20 20 20 20 69 66 20 7b 5b 6c 73 65 61 72 63 if {[lsearc
240c0 68 20 2d 65 78 61 63 74 20 2d 6e 6f 63 61 73 65 h -exact -nocase
240d0 20 2d 2d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 -- \..
240e0 20 20 20 20 20 20 20 5b 67 65 74 4e 61 74 69 76 [getNativ
240f0 65 4c 69 62 72 61 72 79 46 69 6c 65 4e 61 6d 65 eLibraryFileName
24100 73 4f 6e 6c 79 5d 20 24 66 69 6c 65 4e 61 6d 65 sOnly] $fileName
24110 4f 6e 6c 79 5d 20 21 3d 20 2d 31 7d 20 74 68 65 Only] != -1} the
24120 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
24130 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
24140 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
24150 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
24160 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
24170 66 6f 75 6e 64 20 6c 6f 61 64 65 64 20 53 51 4c found loaded SQL
24180 69 74 65 20 6e 61 74 69 76 65 20 6c 69 62 72 61 ite native libra
24190 72 79 20 6d 6f 64 75 6c 65 3a 20 22 20 5c 0d 0a ry module: " \..
241a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
241b0 20 20 24 66 69 6c 65 4e 61 6d 65 20 5c 6e 5d 0d $fileName \n].
241c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 . } e
241d0 6c 73 65 69 66 20 7b 5b 6c 73 65 61 72 63 68 20 lseif {[lsearch
241e0 2d 65 78 61 63 74 20 2d 6e 6f 63 61 73 65 20 2d -exact -nocase -
241f0 2d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 - \..
24200 20 20 20 20 20 5b 67 65 74 49 6e 74 65 72 6f 70 [getInterop
24210 41 73 73 65 6d 62 6c 79 46 69 6c 65 4e 61 6d 65 AssemblyFileName
24220 73 4f 6e 6c 79 5d 20 24 66 69 6c 65 4e 61 6d 65 sOnly] $fileName
24230 4f 6e 6c 79 5d 20 21 3d 20 2d 31 7d 20 74 68 65 Only] != -1} the
24240 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
24250 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
24260 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
24270 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
24280 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
24290 66 6f 75 6e 64 20 6c 6f 61 64 65 64 20 53 51 4c found loaded SQL
242a0 69 74 65 20 69 6e 74 65 72 6f 70 20 61 73 73 65 ite interop asse
242b0 6d 62 6c 79 20 6d 6f 64 75 6c 65 3a 20 22 20 5c mbly module: " \
242c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
242d0 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 20 5c 6e $fileName \n
242e0 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
242f0 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
24300 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
24310 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 catch {..
24320 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
24330 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a test_channel \..
24340 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
24350 2d 2d 2d 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 --- compile-time
24360 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 53 51 4c options for SQL
24370 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 ite core library
24380 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 ... "....
24390 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
243a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 6f 62 6a . obj
243b0 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 ect invoke -flag
243c0 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a s +NonPublic \..
243d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
243e0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
243f0 74 65 2e 53 51 4c 69 74 65 33 20 53 51 4c 69 74 te.SQLite3 SQLit
24400 65 43 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 0d eCompileOptions.
24410 0a 20 20 20 20 20 20 20 20 20 20 7d 20 63 6f 6d . } com
24420 70 69 6c 65 4f 70 74 69 6f 6e 73 5d 20 3d 3d 20 pileOptions] ==
24430 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
24440 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
24450 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
24460 70 65 6e 64 41 72 67 73 20 5b 66 6f 72 6d 61 74 pendArgs [format
24470 4c 69 73 74 20 5b 6c 73 6f 72 74 20 5c 0d 0a 20 List [lsort \..
24480 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 $
24490 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 5d 20 compileOptions]
244a0 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d 0d 0a 20 20 20 <none>] \n]..
244b0 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
244c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
244d0 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
244e0 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d 0a 20 20 el unknown\n..
244f0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
24500 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
24510 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
24520 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
24530 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 _channel \..
24540 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
24550 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 6f 70 74 compile-time opt
24560 69 6f 6e 73 20 66 6f 72 20 53 51 4c 69 74 65 20 ions for SQLite
24570 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 interop assembly
24580 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 ... "....
24590 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
245a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 6f 62 6a . obj
245b0 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 ect invoke -flag
245c0 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a s +NonPublic \..
245d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
245e0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
245f0 74 65 2e 53 51 4c 69 74 65 33 20 49 6e 74 65 72 te.SQLite3 Inter
24600 6f 70 43 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 opCompileOptions
24610 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 63 6f .. } co
24620 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 5d 20 3d 3d mpileOptions] ==
24630 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
24640 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
24650 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
24660 70 70 65 6e 64 41 72 67 73 20 5b 66 6f 72 6d 61 ppendArgs [forma
24670 74 4c 69 73 74 20 5b 6c 73 6f 72 74 20 5c 0d 0a tList [lsort \..
24680 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
24690 24 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 5d $compileOptions]
246a0 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d 0d 0a 20 20 <none>] \n]..
246b0 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
246c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
246d0 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
246e0 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d 0a 20 nel unknown\n..
246f0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
24700 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
24710 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
24720 54 45 3a 20 53 68 6f 77 20 74 68 65 20 61 63 74 TE: Show the act
24730 69 76 65 20 74 65 73 74 20 63 6f 6e 73 74 72 61 ive test constra
24740 69 6e 74 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 ints... #
24750 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
24760 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
24770 5b 61 70 70 65 6e 64 41 72 67 73 20 22 2d 2d 2d [appendArgs "---
24780 2d 20 63 6f 6e 73 74 72 61 69 6e 74 73 3a 20 22 - constraints: "
24790 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
247a0 5b 66 6f 72 6d 61 74 4c 69 73 74 20 5b 6c 73 6f [formatList [lso
247b0 72 74 20 5b 67 65 74 43 6f 6e 73 74 72 61 69 6e rt [getConstrain
247c0 74 73 5d 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d ts]] <none>] \n]
247d0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
247e0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 # NOTE: S
247f0 61 76 65 20 74 68 65 20 74 65 73 74 20 63 6f 6e ave the test con
24800 73 74 72 61 69 6e 74 73 20 66 6f 72 20 75 73 65 straints for use
24810 20 62 79 20 74 68 72 65 61 64 73 20 63 72 65 61 by threads crea
24820 74 65 64 20 69 6e 20 74 68 69 73 0d 0a 20 20 20 ted in this..
24830 20 20 20 20 20 23 20 20 20 20 20 20 20 61 70 70 # app
24840 6c 69 63 61 74 69 6f 6e 20 64 6f 6d 61 69 6e 2e lication domain.
24850 20 20 54 68 69 73 20 69 73 20 6e 65 63 65 73 73 This is necess
24860 61 72 79 20 62 65 63 61 75 73 65 20 61 6c 6c 20 ary because all
24870 74 68 65 20 45 61 67 6c 65 0d 0a 20 20 20 20 20 the Eagle..
24880 20 20 20 23 20 20 20 20 20 20 20 22 74 65 73 74 # "test
24890 20 63 6f 6e 74 65 78 74 22 20 69 6e 66 6f 72 6d context" inform
248a0 61 74 69 6f 6e 20 69 73 20 70 65 72 2d 74 68 72 ation is per-thr
248b0 65 61 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ead... #.
248c0 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 . if {![i
248d0 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 73 nfo exists ::tes
248e0 74 5f 63 6f 6e 73 74 72 61 69 6e 74 73 5d 7d 20 t_constraints]}
248f0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
24900 20 20 73 65 74 20 3a 3a 74 65 73 74 5f 63 6f 6e set ::test_con
24910 73 74 72 61 69 6e 74 73 20 24 3a 3a 65 61 67 6c straints $::eagl
24920 65 5f 74 65 73 74 73 28 63 6f 6e 73 74 72 61 69 e_tests(constrai
24930 6e 74 73 29 0d 0a 20 20 20 20 20 20 20 20 7d 0d nts).. }.
24940 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
24950 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4c 6f # NOTE: Lo
24960 61 64 20 74 68 65 20 22 61 66 74 65 72 2d 63 6f ad the "after-co
24970 6e 73 74 72 61 69 6e 74 73 22 20 63 75 73 74 6f nstraints" custo
24980 6d 20 70 65 72 2d 75 73 65 72 20 61 6e 64 2f 6f m per-user and/o
24990 72 20 70 65 72 2d 68 6f 73 74 0d 0a 20 20 20 20 r per-host..
249a0 20 20 20 20 23 20 20 20 20 20 20 20 74 65 73 74 # test
249b0 20 73 65 74 74 69 6e 67 73 20 6e 6f 77 2e 0d 0a settings now...
249c0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
249d0 20 20 20 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 uplevel 1 [li
249e0 73 74 20 6c 6f 61 64 53 51 4c 69 74 65 54 65 73 st loadSQLiteTes
249f0 74 53 65 74 74 69 6e 67 73 20 24 3a 3a 74 65 73 tSettings $::tes
24a00 74 5f 63 68 61 6e 6e 65 6c 20 2e 61 66 74 65 72 t_channel .after
24a10 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ].... #..
24a20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
24a30 49 66 20 6e 65 63 65 73 73 61 72 79 2c 20 65 6e If necessary, en
24a40 61 62 6c 65 20 73 68 61 72 65 64 2d 63 61 63 68 able shared-cach
24a50 65 20 6d 6f 64 65 20 6e 6f 77 2e 0d 0a 20 20 20 e mode now...
24a60 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
24a70 69 66 20 7b 5b 68 61 73 52 75 6e 74 69 6d 65 4f if {[hasRuntimeO
24a80 70 74 69 6f 6e 20 73 68 61 72 65 64 43 61 63 68 ption sharedCach
24a90 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
24aa0 20 20 20 20 20 20 65 6e 61 62 6c 65 53 68 61 72 enableShar
24ab0 65 64 43 61 63 68 65 20 24 3a 3a 74 65 73 74 5f edCache $::test_
24ac0 63 68 61 6e 6e 65 6c 20 74 72 75 65 0d 0a 20 20 channel true..
24ad0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
24ae0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
24af0 4e 4f 54 45 3a 20 53 68 6f 77 20 77 68 65 6e 20 NOTE: Show when
24b00 6f 75 72 20 74 65 73 74 73 20 61 63 74 75 61 6c our tests actual
24b10 6c 79 20 62 65 67 61 6e 20 28 6e 6f 77 29 2e 0d ly began (now)..
24b20 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
24b30 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
24b40 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
24b50 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
24b60 20 20 20 20 20 22 2d 2d 2d 2d 20 53 79 73 74 65 "---- Syste
24b70 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 74 65 m.Data.SQLite te
24b80 73 74 73 20 62 65 67 61 6e 20 61 74 20 22 20 5c sts began at " \
24b90 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 63 .. [c
24ba0 6c 6f 63 6b 20 66 6f 72 6d 61 74 20 5b 63 6c 6f lock format [clo
24bb0 63 6b 20 73 65 63 6f 6e 64 73 5d 5d 20 5c 6e 5d ck seconds]] \n]
24bc0 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
24bd0 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 75 ..... proc ru
24be0 6e 53 51 4c 69 74 65 54 65 73 74 46 69 6c 65 73 nSQLiteTestFiles
24bf0 50 72 6f 6c 6f 67 75 65 20 7b 7d 20 7b 0d 0a 20 Prologue {} {..
24c00 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 7b uplevel 1 {
24c10 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
24c20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 65 74 # NOTE: Set
24c30 75 70 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 up the variables
24c40 20 74 68 61 74 20 72 65 66 65 72 20 74 6f 20 74 that refer to t
24c50 68 65 20 76 61 72 69 6f 75 73 20 6e 6f 6e 2d 64 he various non-d
24c60 61 74 61 20 66 69 6c 65 73 0d 0a 20 20 20 20 20 ata files..
24c70 20 20 20 23 20 20 20 20 20 20 20 72 65 71 75 69 # requi
24c80 72 65 64 20 62 79 20 74 68 65 20 74 65 73 74 73 red by the tests
24c90 20 69 6e 20 74 68 69 73 20 66 69 6c 65 2e 0d 0a in this file...
24ca0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
24cb0 20 20 20 73 65 74 20 65 6e 74 69 74 79 46 72 61 set entityFra
24cc0 6d 65 77 6f 72 6b 44 6c 6c 46 69 6c 65 20 5c 0d meworkDllFile \.
24cd0 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 . [ge
24ce0 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 45 tBuildFileName E
24cf0 6e 74 69 74 79 46 72 61 6d 65 77 6f 72 6b 2e 64 ntityFramework.d
24d00 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 ll].... s
24d10 65 74 20 69 6e 73 74 61 6c 6c 65 72 45 78 65 46 et installerExeF
24d20 69 6c 65 20 5b 67 65 74 42 75 69 6c 64 46 69 6c ile [getBuildFil
24d30 65 4e 61 6d 65 20 49 6e 73 74 61 6c 6c 65 72 2e eName Installer.
24d40 65 78 65 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 exe].. se
24d50 74 20 73 71 6c 69 74 65 44 65 73 69 67 6e 65 72 t sqliteDesigner
24d60 44 6c 6c 46 69 6c 65 20 5b 67 65 74 42 75 69 6c DllFile [getBuil
24d70 64 46 69 6c 65 4e 61 6d 65 20 53 51 4c 69 74 65 dFileName SQLite
24d80 2e 44 65 73 69 67 6e 65 72 2e 64 6c 6c 5d 0d 0a .Designer.dll]..
24d90 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 73 79 .. set sy
24da0 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 44 6c stemDataSQLiteDl
24db0 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 lFile \..
24dc0 20 20 20 20 20 5b 67 65 74 42 75 69 6c 64 46 69 [getBuildFi
24dd0 6c 65 4e 61 6d 65 20 53 79 73 74 65 6d 2e 44 61 leName System.Da
24de0 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 5d 0d 0a ta.SQLite.dll]..
24df0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 73 79 .. set sy
24e00 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 4c 69 stemDataSQLiteLi
24e10 6e 71 44 6c 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 nqDllFile \..
24e20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 75 69 [getBui
24e30 6c 64 46 69 6c 65 4e 61 6d 65 20 53 79 73 74 65 ldFileName Syste
24e40 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 4c 69 m.Data.SQLite.Li
24e50 6e 71 2e 64 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 20 nq.dll]....
24e60 20 20 20 73 65 74 20 73 79 73 74 65 6d 44 61 74 set systemDat
24e70 61 53 51 4c 69 74 65 45 66 36 44 6c 6c 46 69 6c aSQLiteEf6DllFil
24e80 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
24e90 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 [getBuildFileNa
24ea0 6d 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 me System.Data.S
24eb0 51 4c 69 74 65 2e 45 46 36 2e 64 6c 6c 5d 0d 0a QLite.EF6.dll]..
24ec0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 65 .. set te
24ed0 73 74 45 78 65 46 69 6c 65 20 5b 67 65 74 42 75 stExeFile [getBu
24ee0 69 6c 64 46 69 6c 65 4e 61 6d 65 20 74 65 73 74 ildFileName test
24ef0 2e 65 78 65 5d 0d 0a 20 20 20 20 20 20 20 20 73 .exe].. s
24f00 65 74 20 74 65 73 74 4c 69 6e 71 45 78 65 46 69 et testLinqExeFi
24f10 6c 65 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 le [getBuildFile
24f20 4e 61 6d 65 20 74 65 73 74 6c 69 6e 71 2e 65 78 Name testlinq.ex
24f30 65 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 e].. set
24f40 74 65 73 74 45 66 36 45 78 65 46 69 6c 65 20 5b testEf6ExeFile [
24f50 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 getBuildFileName
24f60 20 74 65 73 74 65 66 36 2e 65 78 65 5d 0d 0a 0d testef6.exe]...
24f70 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
24f80 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 65 74 75 # NOTE: Setu
24f90 70 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 20 p the variables
24fa0 74 68 61 74 20 72 65 66 65 72 20 74 6f 20 74 68 that refer to th
24fb0 65 20 76 61 72 69 6f 75 73 20 64 61 74 61 20 66 e various data f
24fc0 69 6c 65 73 0d 0a 20 20 20 20 20 20 20 20 23 20 iles.. #
24fd0 20 20 20 20 20 20 72 65 71 75 69 72 65 64 20 62 required b
24fe0 79 20 74 68 65 20 74 65 73 74 73 20 69 6e 20 74 y the tests in t
24ff0 68 69 73 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 his file...
25000 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 #.. se
25010 74 20 74 65 73 74 4c 69 6e 71 4f 75 74 46 69 6c t testLinqOutFil
25020 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 e [file nativena
25030 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d me [file join \.
25040 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 . [ge
25050 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 tSQLiteTestDataP
25060 61 74 68 5d 20 74 65 73 74 6c 69 6e 71 2e 6f 75 ath] testlinq.ou
25070 74 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 t]].... s
25080 65 74 20 6e 6f 72 74 68 77 69 6e 64 45 66 44 62 et northwindEfDb
25090 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 File [file nativ
250a0 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
250b0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
250c0 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 5b 66 [file dirname [f
250d0 69 6c 65 20 64 69 72 6e 61 6d 65 20 5b 67 65 74 ile dirname [get
250e0 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 SQLiteTestDataPa
250f0 74 68 5d 5d 5d 20 5c 0d 0a 20 20 20 20 20 20 20 th]]] \..
25100 20 20 20 20 20 74 65 73 74 6c 69 6e 71 20 6e 6f testlinq no
25110 72 74 68 77 69 6e 64 45 46 2e 64 62 5d 5d 0d 0a rthwindEF.db]]..
25120 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 6e 6f .. set no
25130 6e 57 61 6c 44 62 46 69 6c 65 20 5b 66 69 6c 65 nWalDbFile [file
25140 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c nativename [fil
25150 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 e join \..
25160 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 [getSQLite
25170 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 6e 6f TestDataPath] no
25180 6e 57 61 6c 2e 64 62 5d 5d 0d 0a 0d 0a 20 20 20 nWal.db]]....
25190 20 20 20 20 20 73 65 74 20 77 61 6c 44 62 46 69 set walDbFi
251a0 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e le [file nativen
251b0 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c ame [file join \
251c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 .. [g
251d0 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 etSQLiteTestData
251e0 50 61 74 68 5d 20 77 61 6c 2e 64 62 5d 5d 0d 0a Path] wal.db]]..
251f0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
25200 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 # NOTE: The
25210 20 76 61 72 69 6f 75 73 20 69 6e 73 74 61 6c 6c various install
25220 2f 75 6e 69 6e 73 74 61 6c 6c 20 6c 6f 67 20 66 /uninstall log f
25230 69 6c 65 73 20 75 73 65 64 20 74 6f 20 74 65 73 iles used to tes
25240 74 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 t the.. #
25250 20 20 20 20 20 20 20 64 65 73 69 67 6e 2d 74 69 design-ti
25260 6d 65 20 63 6f 6d 70 6f 6e 65 6e 74 20 69 6e 73 me component ins
25270 74 61 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 20 taller...
25280 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 #.. set
25290 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 30 testInstallVs200
252a0 35 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 5LogFile [file n
252b0 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 ativename [file
252c0 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 join \..
252d0 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 [getSQLiteTe
252e0 73 74 44 61 74 61 50 61 74 68 5d 20 49 6e 73 74 stDataPath] Inst
252f0 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 30 aller_Test_Vs200
25300 35 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 5.log]]....
25310 20 20 20 73 65 74 20 74 65 73 74 49 6e 73 74 61 set testInsta
25320 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c 65 20 llVs2008LogFile
25330 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
25340 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 [file join \..
25350 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 [getS
25360 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 74 QLiteTestDataPat
25370 68 5d 20 49 6e 73 74 61 6c 6c 65 72 5f 54 65 73 h] Installer_Tes
25380 74 5f 56 73 32 30 30 38 2e 6c 6f 67 5d 5d 0d 0a t_Vs2008.log]]..
25390 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 74 65 .. set te
253a0 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 30 4c stInstallVs2010L
253b0 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 ogFile [file nat
253c0 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f ivename [file jo
253d0 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 in \..
253e0 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 [getSQLiteTest
253f0 44 61 74 61 50 61 74 68 5d 20 49 6e 73 74 61 6c DataPath] Instal
25400 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 31 30 2e ler_Test_Vs2010.
25410 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 log]]....
25420 20 73 65 74 20 74 65 73 74 49 6e 73 74 61 6c 6c set testInstall
25430 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 20 5b 66 Vs2012LogFile [f
25440 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b ile nativename [
25450 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 file join \..
25460 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c [getSQL
25470 69 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d iteTestDataPath]
25480 20 49 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f Installer_Test_
25490 56 73 32 30 31 32 2e 6c 6f 67 5d 5d 0d 0a 0d 0a Vs2012.log]]....
254a0 20 20 20 20 20 20 20 20 73 65 74 20 74 65 73 74 set test
254b0 49 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f 67 InstallVs2013Log
254c0 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 File [file nativ
254d0 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
254e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
254f0 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 [getSQLiteTestDa
25500 74 61 50 61 74 68 5d 20 49 6e 73 74 61 6c 6c 65 taPath] Installe
25510 72 5f 54 65 73 74 5f 56 73 32 30 31 33 2e 6c 6f r_Test_Vs2013.lo
25520 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 g]].... s
25530 65 74 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 et testInstallVs
25540 32 30 31 35 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 2015LogFile [fil
25550 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 e nativename [fi
25560 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 le join \..
25570 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 [getSQLit
25580 65 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 49 eTestDataPath] I
25590 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 nstaller_Test_Vs
255a0 32 30 31 35 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 2015.log]]....
255b0 20 20 20 20 20 20 73 65 74 20 74 65 73 74 55 6e set testUn
255c0 69 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 installVs2005Log
255d0 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 File [file nativ
255e0 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
255f0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
25600 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 [getSQLiteTestDa
25610 74 61 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c taPath] Uninstal
25620 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 30 35 2e ler_Test_Vs2005.
25630 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 log]]....
25640 20 73 65 74 20 74 65 73 74 55 6e 69 6e 73 74 61 set testUninsta
25650 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c 65 20 llVs2008LogFile
25660 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
25670 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 [file join \..
25680 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 [getS
25690 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 74 QLiteTestDataPat
256a0 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 72 5f 54 h] Uninstaller_T
256b0 65 73 74 5f 56 73 32 30 30 38 2e 6c 6f 67 5d 5d est_Vs2008.log]]
256c0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 .... set
256d0 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
256e0 30 31 30 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 010LogFile [file
256f0 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c nativename [fil
25700 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 e join \..
25710 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 65 [getSQLite
25720 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 55 6e TestDataPath] Un
25730 69 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 installer_Test_V
25740 73 32 30 31 30 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 s2010.log]]....
25750 20 20 20 20 20 20 20 73 65 74 20 74 65 73 74 55 set testU
25760 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f ninstallVs2012Lo
25770 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 gFile [file nati
25780 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 vename [file joi
25790 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n \..
257a0 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 [getSQLiteTestD
257b0 61 74 61 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 ataPath] Uninsta
257c0 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 31 32 ller_Test_Vs2012
257d0 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 .log]]....
257e0 20 20 73 65 74 20 74 65 73 74 55 6e 69 6e 73 74 set testUninst
257f0 61 6c 6c 56 73 32 30 31 33 4c 6f 67 46 69 6c 65 allVs2013LogFile
25800 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d [file nativenam
25810 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a e [file join \..
25820 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
25830 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 SQLiteTestDataPa
25840 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 72 5f th] Uninstaller_
25850 54 65 73 74 5f 56 73 32 30 31 33 2e 6c 6f 67 5d Test_Vs2013.log]
25860 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 ].... set
25870 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 testUninstallVs
25880 32 30 31 35 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 2015LogFile [fil
25890 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 e nativename [fi
258a0 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 le join \..
258b0 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 [getSQLit
258c0 65 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 55 eTestDataPath] U
258d0 6e 69 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f ninstaller_Test_
258e0 56 73 32 30 31 35 2e 6c 6f 67 5d 5d 0d 0a 0d 0a Vs2015.log]]....
258f0 20 20 20 20 20 20 20 20 23 23 23 23 23 23 23 23 ########
25900 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25910 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25920 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
25930 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0d ###############.
25940 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 ... if {!
25950 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 [haveConstraint
25960 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 [appendArgs file
25970 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 _ \..
25980 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 65 6e 74 [file tail $ent
25990 69 74 79 46 72 61 6d 65 77 6f 72 6b 44 6c 6c 46 ityFrameworkDllF
259a0 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
259b0 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
259c0 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
259d0 6e 6e 65 6c 20 24 65 6e 74 69 74 79 46 72 61 6d nnel $entityFram
259e0 65 77 6f 72 6b 44 6c 6c 46 69 6c 65 0d 0a 20 20 eworkDllFile..
259f0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
25a00 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e if {![haveCon
25a10 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
25a20 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 rgs file_ \..
25a30 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 [file t
25a40 61 69 6c 20 24 69 6e 73 74 61 6c 6c 65 72 45 78 ail $installerEx
25a50 65 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b eFile]]]} then {
25a60 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
25a70 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
25a80 68 61 6e 6e 65 6c 20 24 69 6e 73 74 61 6c 6c 65 hannel $installe
25a90 72 45 78 65 46 69 6c 65 20 49 6e 73 74 61 6c 6c rExeFile Install
25aa0 65 72 2e 65 78 65 0d 0a 20 20 20 20 20 20 20 20 er.exe..
25ab0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 }.... if
25ac0 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e {![haveConstrain
25ad0 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 t [appendArgs fi
25ae0 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 le_ \..
25af0 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 73 [file tail $s
25b00 71 6c 69 74 65 44 65 73 69 67 6e 65 72 44 6c 6c qliteDesignerDll
25b10 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d File]]]} then {.
25b20 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b . check
25b30 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 ForFile $test_ch
25b40 61 6e 6e 65 6c 20 24 73 71 6c 69 74 65 44 65 73 annel $sqliteDes
25b50 69 67 6e 65 72 44 6c 6c 46 69 6c 65 0d 0a 20 20 ignerDllFile..
25b60 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
25b70 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e if {![haveCon
25b80 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
25b90 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 rgs file_ \..
25ba0 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 [file t
25bb0 61 69 6c 20 24 73 79 73 74 65 6d 44 61 74 61 53 ail $systemDataS
25bc0 51 4c 69 74 65 44 6c 6c 46 69 6c 65 5d 5d 5d 7d QLiteDllFile]]]}
25bd0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
25be0 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 checkForFile
25bf0 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 73 $test_channel $s
25c00 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 44 ystemDataSQLiteD
25c10 6c 6c 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 llFile..
25c20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 }.... if
25c30 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e {![haveConstrain
25c40 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 t [appendArgs fi
25c50 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 le_ \..
25c60 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 73 [file tail $s
25c70 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 4c ystemDataSQLiteL
25c80 69 6e 71 44 6c 6c 46 69 6c 65 5d 5d 5d 7d 20 74 inqDllFile]]]} t
25c90 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
25ca0 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
25cb0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 73 79 73 est_channel $sys
25cc0 74 65 6d 44 61 74 61 53 51 4c 69 74 65 4c 69 6e temDataSQLiteLin
25cd0 71 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 20 20 20 qDllFile..
25ce0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
25cf0 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
25d00 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
25d10 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
25d20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
25d30 24 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 $systemDataSQLit
25d40 65 45 66 36 44 6c 6c 46 69 6c 65 5d 5d 5d 7d 20 eEf6DllFile]]]}
25d50 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
25d60 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
25d70 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 73 79 test_channel $sy
25d80 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 45 66 stemDataSQLiteEf
25d90 36 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 20 20 20 6DllFile..
25da0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
25db0 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
25dc0 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
25dd0 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
25de0 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
25df0 24 74 65 73 74 45 78 65 46 69 6c 65 5d 5d 5d 7d $testExeFile]]]}
25e00 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
25e10 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 checkForFile
25e20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 $test_channel $t
25e30 65 73 74 45 78 65 46 69 6c 65 20 74 65 73 74 2e estExeFile test.
25e40 65 78 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a exe.. }..
25e50 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b .. if {![
25e60 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
25e70 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
25e80 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
25e90 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 [file tail $test
25ea0 4c 69 6e 71 45 78 65 46 69 6c 65 5d 5d 5d 7d 20 LinqExeFile]]]}
25eb0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
25ec0 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
25ed0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 test_channel $te
25ee0 73 74 4c 69 6e 71 45 78 65 46 69 6c 65 20 74 65 stLinqExeFile te
25ef0 73 74 6c 69 6e 71 2e 65 78 65 0d 0a 20 20 20 20 stlinq.exe..
25f00 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
25f10 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 if {![haveConst
25f20 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
25f30 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 s file_ \..
25f40 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 [file tai
25f50 6c 20 24 74 65 73 74 45 66 36 45 78 65 46 69 6c l $testEf6ExeFil
25f60 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 e]]]} then {..
25f70 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
25f80 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e File $test_chann
25f90 65 6c 20 24 74 65 73 74 45 66 36 45 78 65 46 69 el $testEf6ExeFi
25fa0 6c 65 20 74 65 73 74 65 66 36 2e 65 78 65 0d 0a le testef6.exe..
25fb0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
25fc0 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 if {![haveC
25fd0 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e onstraint [appen
25fe0 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 dArgs file_ \..
25ff0 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 [file
26000 20 74 61 69 6c 20 24 74 65 73 74 4c 69 6e 71 4f tail $testLinqO
26010 75 74 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 utFile]]]} then
26020 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 {.. che
26030 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f ckForFile $test_
26040 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 4c 69 6e channel $testLin
26050 71 4f 75 74 46 69 6c 65 0d 0a 20 20 20 20 20 20 qOutFile..
26060 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
26070 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
26080 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
26090 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
260a0 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
260b0 24 6e 6f 72 74 68 77 69 6e 64 45 66 44 62 46 69 $northwindEfDbFi
260c0 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 le]]]} then {..
260d0 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f checkFo
260e0 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e rFile $test_chan
260f0 6e 65 6c 20 24 6e 6f 72 74 68 77 69 6e 64 45 66 nel $northwindEf
26100 44 62 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 DbFile..
26110 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 }.... if
26120 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e {![haveConstrain
26130 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 t [appendArgs fi
26140 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 le_ \..
26150 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 6e [file tail $n
26160 6f 6e 57 61 6c 44 62 46 69 6c 65 5d 5d 5d 7d 20 onWalDbFile]]]}
26170 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
26180 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
26190 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 6e 6f test_channel $no
261a0 6e 57 61 6c 44 62 46 69 6c 65 0d 0a 20 20 20 20 nWalDbFile..
261b0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
261c0 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 if {![haveConst
261d0 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
261e0 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 s file_ \..
261f0 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 [file tai
26200 6c 20 24 77 61 6c 44 62 46 69 6c 65 5d 5d 5d 7d l $walDbFile]]]}
26210 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
26220 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 checkForFile
26230 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 77 $test_channel $w
26240 61 6c 44 62 46 69 6c 65 0d 0a 20 20 20 20 20 20 alDbFile..
26250 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
26260 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
26270 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
26280 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
26290 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
262a0 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 $testInstallVs20
262b0 30 35 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 05LogFile]]]} th
262c0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
262d0 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 checkForFile $te
262e0 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 st_channel $test
262f0 49 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 InstallVs2005Log
26300 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d File.. }.
26310 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 ... if {!
26320 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 [haveConstraint
26330 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 [appendArgs file
26340 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 _ \..
26350 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 [file tail $tes
26360 74 49 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f tInstallVs2008Lo
26370 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b gFile]]]} then {
26380 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
26390 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
263a0 68 61 6e 6e 65 6c 20 24 74 65 73 74 49 6e 73 74 hannel $testInst
263b0 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c 65 allVs2008LogFile
263c0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
263d0 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
263e0 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
263f0 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
26400 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
26410 6c 65 20 74 61 69 6c 20 24 74 65 73 74 49 6e 73 le tail $testIns
26420 74 61 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 6c tallVs2010LogFil
26430 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 e]]]} then {..
26440 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
26450 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e File $test_chann
26460 65 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 el $testInstallV
26470 73 32 30 31 30 4c 6f 67 46 69 6c 65 0d 0a 20 20 s2010LogFile..
26480 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
26490 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e if {![haveCon
264a0 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
264b0 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 rgs file_ \..
264c0 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 [file t
264d0 61 69 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c ail $testInstall
264e0 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 5d 5d 5d Vs2012LogFile]]]
264f0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
26500 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 checkForFile
26510 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 $test_channel $
26520 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 testInstallVs201
26530 32 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 2LogFile..
26540 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 }.... i
26550 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 f {![haveConstra
26560 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
26570 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 file_ \..
26580 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 [file tail
26590 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 $testInstallVs20
265a0 31 33 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 13LogFile]]]} th
265b0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
265c0 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 checkForFile $te
265d0 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 st_channel $test
265e0 49 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f 67 InstallVs2013Log
265f0 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d File.. }.
26600 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 ... if {!
26610 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 [haveConstraint
26620 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 [appendArgs file
26630 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 _ \..
26640 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 [file tail $tes
26650 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f tInstallVs2015Lo
26660 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b gFile]]]} then {
26670 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 .. chec
26680 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
26690 68 61 6e 6e 65 6c 20 24 74 65 73 74 49 6e 73 74 hannel $testInst
266a0 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 allVs2015LogFile
266b0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
266c0 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
266d0 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
266e0 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
266f0 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
26700 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 6e 69 le tail $testUni
26710 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 nstallVs2005LogF
26720 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
26730 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
26740 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
26750 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e 73 74 nnel $testUninst
26760 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 69 6c 65 allVs2005LogFile
26770 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
26780 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
26790 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
267a0 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
267b0 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
267c0 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 6e 69 le tail $testUni
267d0 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 nstallVs2008LogF
267e0 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
267f0 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
26800 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
26810 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e 73 74 nnel $testUninst
26820 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c 65 allVs2008LogFile
26830 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
26840 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
26850 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
26860 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
26870 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
26880 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 6e 69 le tail $testUni
26890 6e 73 74 61 6c 6c 56 73 32 30 31 30 4c 6f 67 46 nstallVs2010LogF
268a0 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
268b0 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
268c0 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
268d0 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e 73 74 nnel $testUninst
268e0 61 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 6c 65 allVs2010LogFile
268f0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
26900 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
26910 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
26920 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
26930 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
26940 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 6e 69 le tail $testUni
26950 6e 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 nstallVs2012LogF
26960 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
26970 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
26980 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
26990 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e 73 74 nnel $testUninst
269a0 61 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 allVs2012LogFile
269b0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
269c0 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
269d0 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
269e0 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
269f0 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
26a00 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 6e 69 le tail $testUni
26a10 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f 67 46 nstallVs2013LogF
26a20 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
26a30 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
26a40 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
26a50 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e 73 74 nnel $testUninst
26a60 61 6c 6c 56 73 32 30 31 33 4c 6f 67 46 69 6c 65 allVs2013LogFile
26a70 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
26a80 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 if {![hav
26a90 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
26aa0 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d endArgs file_ \.
26ab0 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
26ac0 6c 65 20 74 61 69 6c 20 24 74 65 73 74 55 6e 69 le tail $testUni
26ad0 6e 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 nstallVs2015LogF
26ae0 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a ile]]]} then {..
26af0 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
26b00 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
26b10 6e 6e 65 6c 20 24 74 65 73 74 55 6e 69 6e 73 74 nnel $testUninst
26b20 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 allVs2015LogFile
26b30 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
26b40 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
26b50 20 20 20 20 70 72 6f 63 20 72 75 6e 53 51 4c 69 proc runSQLi
26b60 74 65 54 65 73 74 46 69 6c 65 73 45 70 69 6c 6f teTestFilesEpilo
26b70 67 75 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 gue {} {..
26b80 75 70 6c 65 76 65 6c 20 31 20 7b 0d 0a 20 20 20 uplevel 1 {..
26b90 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f unset -noco
26ba0 6d 70 6c 61 69 6e 20 5c 0d 0a 20 20 20 20 20 20 mplain \..
26bb0 20 20 20 20 20 20 74 65 73 74 55 6e 69 6e 73 74 testUninst
26bc0 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 allVs2015LogFile
26bd0 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 testUninstallVs
26be0 32 30 31 33 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 2013LogFile \..
26bf0 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 55 testU
26c00 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f ninstallVs2012Lo
26c10 67 46 69 6c 65 20 74 65 73 74 55 6e 69 6e 73 74 gFile testUninst
26c20 61 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 6c 65 allVs2010LogFile
26c30 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
26c40 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
26c50 30 30 38 4c 6f 67 46 69 6c 65 20 74 65 73 74 55 008LogFile testU
26c60 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f ninstallVs2005Lo
26c70 67 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 gFile \..
26c80 20 20 20 20 20 74 65 73 74 49 6e 73 74 61 6c 6c testInstall
26c90 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 20 74 65 Vs2015LogFile te
26ca0 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c stInstallVs2013L
26cb0 6f 67 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 ogFile \..
26cc0 20 20 20 20 20 20 74 65 73 74 49 6e 73 74 61 6c testInstal
26cd0 6c 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 20 74 lVs2012LogFile t
26ce0 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 30 estInstallVs2010
26cf0 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 LogFile \..
26d00 20 20 20 20 20 20 20 74 65 73 74 49 6e 73 74 61 testInsta
26d10 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c 65 20 llVs2008LogFile
26d20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 30 testInstallVs200
26d30 35 4c 6f 67 46 69 6c 65 0d 0a 0d 0a 20 20 20 20 5LogFile....
26d40 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d unset -nocom
26d50 70 6c 61 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 plain \..
26d60 20 20 20 20 20 6e 6f 72 74 68 77 69 6e 64 45 66 northwindEf
26d70 44 62 46 69 6c 65 20 74 65 73 74 4c 69 6e 71 4f DbFile testLinqO
26d80 75 74 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 utFile \..
26d90 20 20 20 20 20 20 77 61 6c 44 62 46 69 6c 65 20 walDbFile
26da0 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 0d 0a 0d 0a nonWalDbFile....
26db0 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 2d 6e unset -n
26dc0 6f 63 6f 6d 70 6c 61 69 6e 20 5c 0d 0a 20 20 20 ocomplain \..
26dd0 20 20 20 20 20 20 20 20 20 74 65 73 74 45 66 36 testEf6
26de0 45 78 65 46 69 6c 65 20 74 65 73 74 4c 69 6e 71 ExeFile testLinq
26df0 45 78 65 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 ExeFile \..
26e00 20 20 20 20 20 20 20 74 65 73 74 45 78 65 46 69 testExeFi
26e10 6c 65 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c le systemDataSQL
26e20 69 74 65 45 66 36 44 6c 6c 46 69 6c 65 20 5c 0d iteEf6DllFile \.
26e30 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 79 73 . sys
26e40 74 65 6d 44 61 74 61 53 51 4c 69 74 65 4c 69 6e temDataSQLiteLin
26e50 71 44 6c 6c 46 69 6c 65 20 73 79 73 74 65 6d 44 qDllFile systemD
26e60 61 74 61 53 51 4c 69 74 65 44 6c 6c 46 69 6c 65 ataSQLiteDllFile
26e70 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
26e80 73 71 6c 69 74 65 44 65 73 69 67 6e 65 72 44 6c sqliteDesignerDl
26e90 6c 46 69 6c 65 20 69 6e 73 74 61 6c 6c 65 72 45 lFile installerE
26ea0 78 65 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 xeFile \..
26eb0 20 20 20 20 20 20 65 6e 74 69 74 79 46 72 61 6d entityFram
26ec0 65 77 6f 72 6b 44 6c 6c 46 69 6c 65 0d 0a 20 20 eworkDllFile..
26ed0 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
26ee0 0a 20 20 20 20 70 72 6f 63 20 72 75 6e 53 51 4c . proc runSQL
26ef0 69 74 65 54 65 73 74 45 70 69 6c 6f 67 75 65 20 iteTestEpilogue
26f00 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 {} {.. #..
26f10 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 # NOTE: Ski
26f20 70 20 72 75 6e 6e 69 6e 67 20 6f 75 72 20 63 75 p running our cu
26f30 73 74 6f 6d 20 65 70 69 6c 6f 67 75 65 20 69 66 stom epilogue if
26f40 20 74 68 65 20 6d 61 69 6e 20 6f 6e 65 20 68 61 the main one ha
26f50 73 20 62 65 65 6e 0d 0a 20 20 20 20 20 20 23 20 s been.. #
26f60 20 20 20 20 20 20 73 6b 69 70 70 65 64 2e 0d 0a skipped...
26f70 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
26f80 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
26f90 20 3a 3a 6e 6f 28 65 70 69 6c 6f 67 75 65 2e 65 ::no(epilogue.e
26fa0 61 67 6c 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a agle)]} then {..
26fb0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
26fc0 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 # NOTE: Show
26fd0 77 68 65 6e 20 6f 75 72 20 74 65 73 74 73 20 61 when our tests a
26fe0 63 74 75 61 6c 6c 79 20 65 6e 64 65 64 20 28 6e ctually ended (n
26ff0 6f 77 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ow)... #.
27000 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
27010 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
27020 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
27030 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
27040 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
27050 74 65 20 74 65 73 74 73 20 65 6e 64 65 64 20 61 te tests ended a
27060 74 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 t " \..
27070 20 20 20 5b 63 6c 6f 63 6b 20 66 6f 72 6d 61 74 [clock format
27080 20 5b 63 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d [clock seconds]
27090 5d 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 ] \n]....
270a0 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
270b0 54 45 3a 20 4c 6f 61 64 20 74 68 65 20 22 65 70 TE: Load the "ep
270c0 69 6c 6f 67 75 65 22 20 63 75 73 74 6f 6d 20 70 ilogue" custom p
270d0 65 72 2d 75 73 65 72 20 61 6e 64 2f 6f 72 20 70 er-user and/or p
270e0 65 72 2d 68 6f 73 74 20 74 65 73 74 0d 0a 20 20 er-host test..
270f0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 65 # se
27100 74 74 69 6e 67 73 20 6e 6f 77 2e 0d 0a 20 20 20 ttings now...
27110 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
27120 75 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 uplevel 1 [list
27130 6c 6f 61 64 53 51 4c 69 74 65 54 65 73 74 53 65 loadSQLiteTestSe
27140 74 74 69 6e 67 73 20 24 3a 3a 74 65 73 74 5f 63 ttings $::test_c
27150 68 61 6e 6e 65 6c 20 2e 65 70 69 6c 6f 67 75 65 hannel .epilogue
27160 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ].... #..
27170 20 20 20 20 20 20 20 20 23 20 42 55 47 46 49 58 # BUGFIX
27180 3a 20 42 65 66 6f 72 65 20 63 68 65 63 6b 69 6e : Before checkin
27190 67 20 74 68 65 20 66 69 6e 61 6c 20 72 65 73 6f g the final reso
271a0 75 72 63 65 73 20 69 6e 20 75 73 65 20 62 79 20 urces in use by
271b0 53 51 4c 69 74 65 2c 20 6d 61 6b 65 0d 0a 20 20 SQLite, make..
271c0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 #
271d0 73 75 72 65 20 62 6f 74 68 20 6f 66 20 74 68 65 sure both of the
271e0 20 50 52 41 47 4d 41 20 72 65 6c 61 74 65 64 20 PRAGMA related
271f0 64 69 72 65 63 74 6f 72 79 20 6e 61 6d 65 73 20 directory names
27200 61 72 65 20 66 72 65 65 64 2e 0d 0a 20 20 20 20 are freed...
27210 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 63 #.. c
27220 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 44 69 72 heckForSQLiteDir
27230 65 63 74 6f 72 69 65 73 20 24 3a 3a 74 65 73 74 ectories $::test
27240 5f 63 68 61 6e 6e 65 6c 20 74 72 75 65 0d 0a 0d _channel true...
27250 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
27260 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 6c 73 6f # NOTE: Also
27270 20 72 65 70 6f 72 74 20 74 68 65 20 72 65 73 6f report the reso
27280 75 72 63 65 20 75 73 61 67 65 20 61 66 74 65 72 urce usage after
27290 20 72 75 6e 6e 69 6e 67 20 74 68 65 20 74 65 73 running the tes
272a0 74 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ts... #..
272b0 20 20 20 20 20 20 20 20 72 65 70 6f 72 74 53 51 reportSQ
272c0 4c 69 74 65 52 65 73 6f 75 72 63 65 73 20 24 3a LiteResources $:
272d0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d :test_channel...
272e0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
272f0 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 70 6f # NOTE: Repo
27300 72 74 20 74 68 65 20 63 72 69 74 69 63 61 6c 20 rt the critical
27310 68 61 6e 64 6c 65 20 63 6f 75 6e 74 73 20 61 66 handle counts af
27320 74 65 72 20 72 75 6e 6e 69 6e 67 20 74 68 65 20 ter running the
27330 74 65 73 74 73 2e 0d 0a 20 20 20 20 20 20 20 20 tests...
27340 23 0d 0a 20 20 20 20 20 20 20 20 67 65 74 53 51 #.. getSQ
27350 4c 69 74 65 48 61 6e 64 6c 65 43 6f 75 6e 74 73 LiteHandleCounts
27360 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
27370 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
27380 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 # NOTE: I
27390 66 20 6e 65 63 65 73 73 61 72 79 2c 20 64 69 73 f necessary, dis
273a0 61 62 6c 65 20 73 68 61 72 65 64 2d 63 61 63 68 able shared-cach
273b0 65 20 6d 6f 64 65 20 6e 6f 77 2e 0d 0a 20 20 20 e mode now...
273c0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
273d0 69 66 20 7b 5b 68 61 73 52 75 6e 74 69 6d 65 4f if {[hasRuntimeO
273e0 70 74 69 6f 6e 20 73 68 61 72 65 64 43 61 63 68 ption sharedCach
273f0 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
27400 20 20 20 20 20 20 65 6e 61 62 6c 65 53 68 61 72 enableShar
27410 65 64 43 61 63 68 65 20 24 3a 3a 74 65 73 74 5f edCache $::test_
27420 63 68 61 6e 6e 65 6c 20 66 61 6c 73 65 0d 0a 20 channel false..
27430 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
27440 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
27450 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ###############
27460 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
27470 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
27480 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
27490 23 23 23 23 23 23 23 23 23 23 23 23 0d 0a 20 20 ############..
274a0 20 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ##############
274b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 20 ###############
274c0 45 4e 44 20 45 61 67 6c 65 20 4f 4e 4c 59 20 23 END Eagle ONLY #
274d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
274e0 23 23 23 23 23 23 23 23 23 23 23 23 23 0d 0a 20 #############..
274f0 20 20 20 23 23 23 23 23 23 23 23 23 23 23 23 23 #############
27500 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
27510 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
27520 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
27530 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0d 0a ##############..
27540 20 20 7d 0d 0a 0d 0a 20 20 23 0d 0a 20 20 23 20 }.... #.. #
27550 4e 4f 54 45 3a 20 53 61 76 65 20 74 68 65 20 6e NOTE: Save the n
27560 61 6d 65 20 6f 66 20 74 68 65 20 64 69 72 65 63 ame of the direc
27570 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e 67 20 tory containing
27580 74 68 69 73 20 66 69 6c 65 2e 0d 0a 20 20 23 0d this file... #.
27590 0a 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 . if {![info ex
275a0 69 73 74 73 20 63 6f 6d 6d 6f 6e 5f 64 69 72 65 ists common_dire
275b0 63 74 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a ctory]} then {..
275c0 20 20 20 20 73 65 74 20 63 6f 6d 6d 6f 6e 5f 64 set common_d
275d0 69 72 65 63 74 6f 72 79 20 5b 66 69 6c 65 20 64 irectory [file d
275e0 69 72 6e 61 6d 65 20 5b 69 6e 66 6f 20 73 63 72 irname [info scr
275f0 69 70 74 5d 5d 0d 0a 20 20 7d 0d 0a 0d 0a 20 20 ipt]].. }....
27600 23 0d 0a 20 20 23 20 4e 4f 54 45 3a 20 50 72 6f #.. # NOTE: Pro
27610 76 69 64 65 20 74 68 65 20 53 79 73 74 65 6d 2e vide the System.
27620 44 61 74 61 2e 53 51 4c 69 74 65 20 74 65 73 74 Data.SQLite test
27630 20 70 61 63 6b 61 67 65 20 74 6f 20 74 68 65 20 package to the
27640 69 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 interpreter...
27650 23 0d 0a 20 20 70 61 63 6b 61 67 65 20 70 72 6f #.. package pro
27660 76 69 64 65 20 53 79 73 74 65 6d 2e 44 61 74 61 vide System.Data
27670 2e 53 51 4c 69 74 65 2e 54 65 73 74 20 31 2e 30 .SQLite.Test 1.0
27680 0d 0a 7d 0d 0a ..}..