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 67 65 74 53 51 4c . proc getSQL
0590: 69 74 65 43 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e iteCompileOption
05a0: 50 72 65 66 69 78 20 7b 7d 20 7b 0d 0a 20 20 20 Prefix {} {..
05b0: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
05c0: 54 45 3a 20 53 65 65 20 69 66 20 74 68 65 20 63 TE: See if the c
05d0: 6f 6d 70 69 6c 65 20 6f 70 74 69 6f 6e 20 70 72 ompile option pr
05e0: 65 66 69 78 20 73 65 74 74 69 6e 67 20 68 61 73 efix setting has
05f0: 20 62 65 65 6e 20 6f 76 65 72 72 69 64 64 65 6e been overridden
0600: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
0610: 62 79 20 74 68 65 20 75 73 65 72 20 28 65 2e 67 by the user (e.g
0620: 2e 20 6f 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 . on the command
0630: 20 6c 69 6e 65 29 2e 0d 0a 20 20 20 20 20 20 23 line)... #
0640: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 .. if {[inf
0650: 6f 20 65 78 69 73 74 73 20 3a 3a 63 6f 6d 70 69 o exists ::compi
0660: 6c 65 5f 6f 70 74 69 6f 6e 5f 70 72 65 66 69 78 le_option_prefix
0670: 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] && \..
0680: 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
0690: 20 24 3a 3a 63 6f 6d 70 69 6c 65 5f 6f 70 74 69 $::compile_opti
06a0: 6f 6e 5f 70 72 65 66 69 78 5d 20 3e 20 30 7d 20 on_prefix] > 0}
06b0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
06c0: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
06d0: 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 69 E: Use the speci
06e0: 66 69 65 64 20 63 6f 6d 70 69 6c 65 20 6f 70 74 fied compile opt
06f0: 69 6f 6e 20 70 72 65 66 69 78 2e 0d 0a 20 20 20 ion prefix...
0700: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
0710: 72 65 74 75 72 6e 20 24 3a 3a 63 6f 6d 70 69 6c return $::compil
0720: 65 5f 6f 70 74 69 6f 6e 5f 70 72 65 66 69 78 0d e_option_prefix.
0730: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
0740: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
0750: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
0760: 74 68 65 20 64 65 66 61 75 6c 74 20 63 6f 6d 70 the default comp
0770: 69 6c 65 20 6f 70 74 69 6f 6e 20 70 72 65 66 69 ile option prefi
0780: 78 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 x... #..
0790: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 6f return co
07a0: 6d 70 69 6c 65 4f 70 74 69 6f 6e 2e 53 51 4c 69 mpileOption.SQLi
07b0: 74 65 2e 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 te... }..
07c0: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
07d0: 20 68 61 76 65 53 51 4c 69 74 65 44 65 66 69 6e haveSQLiteDefin
07e0: 65 43 6f 6e 73 74 61 6e 74 20 7b 20 6e 61 6d 65 eConstant { name
07f0: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 72 65 74 75 } {.. retu
0800: 72 6e 20 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 rn [haveConstrai
0810: 6e 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 nt \..
0820: 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 67 65 74 [appendArgs [get
0830: 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 SQLiteDefineCons
0840: 74 61 6e 74 50 72 65 66 69 78 5d 20 24 6e 61 6d tantPrefix] $nam
0850: 65 5d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 e]].. }.....
0860: 20 20 20 70 72 6f 63 20 68 61 76 65 53 51 4c 69 proc haveSQLi
0870: 74 65 43 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 20 teCompileOption
0880: 7b 20 6e 61 6d 65 20 7d 20 7b 0d 0a 20 20 20 20 { name } {..
0890: 20 20 72 65 74 75 72 6e 20 5b 68 61 76 65 43 6f return [haveCo
08a0: 6e 73 74 72 61 69 6e 74 20 5c 0d 0a 20 20 20 20 nstraint \..
08b0: 20 20 20 20 20 20 5b 61 70 70 65 6e 64 41 72 67 [appendArg
08c0: 73 20 5b 67 65 74 53 51 4c 69 74 65 43 6f 6d 70 s [getSQLiteComp
08d0: 69 6c 65 4f 70 74 69 6f 6e 50 72 65 66 69 78 5d ileOptionPrefix]
08e0: 20 24 6e 61 6d 65 5d 5d 0d 0a 20 20 20 20 7d 0d $name]].. }.
08f0: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 .... proc get
0900: 42 75 69 6c 64 59 65 61 72 20 7b 7d 20 7b 0d 0a BuildYear {} {..
0910: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
0920: 20 4e 4f 54 45 3a 20 53 65 65 20 69 66 20 74 68 NOTE: See if th
0930: 65 20 22 79 65 61 72 22 20 73 65 74 74 69 6e 67 e "year" setting
0940: 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 has been overri
0950: 64 64 65 6e 20 62 79 20 74 68 65 20 75 73 65 72 dden by the user
0960: 20 28 65 2e 67 2e 0d 0a 20 20 20 20 20 20 23 20 (e.g... #
0970: 20 20 20 20 20 20 6f 6e 20 74 68 65 20 63 6f 6d on the com
0980: 6d 61 6e 64 20 6c 69 6e 65 29 2e 20 20 54 68 69 mand line). Thi
0990: 73 20 68 65 6c 70 73 20 63 6f 6e 74 72 6f 6c 20 s helps control
09a0: 65 78 61 63 74 6c 79 20 77 68 69 63 68 20 73 65 exactly which se
09b0: 74 20 6f 66 0d 0a 20 20 20 20 20 20 23 20 20 20 t of.. #
09c0: 20 20 20 20 62 69 6e 61 72 69 65 73 20 77 65 20 binaries we
09d0: 61 72 65 20 74 65 73 74 69 6e 67 2c 20 74 68 6f are testing, tho
09e0: 73 65 20 70 72 6f 64 75 63 65 64 20 75 73 69 6e se produced usin
09f0: 67 20 74 68 65 20 56 69 73 75 61 6c 20 53 74 75 g the Visual Stu
0a00: 64 69 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 20 dio.. #
0a10: 20 20 20 32 30 30 35 2c 20 32 30 30 38 2c 20 32 2005, 2008, 2
0a20: 30 31 30 2c 20 32 30 31 32 2c 20 32 30 31 33 2c 010, 2012, 2013,
0a30: 20 32 30 31 35 2c 20 6f 72 20 32 30 31 37 20 62 2015, or 2017 b
0a40: 75 69 6c 64 20 73 79 73 74 65 6d 73 2e 20 20 54 uild systems. T
0a50: 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 o.. #
0a60: 20 6f 76 65 72 72 69 64 65 20 74 68 69 73 20 76 override this v
0a70: 61 6c 75 65 20 76 69 61 20 74 68 65 20 63 6f 6d alue via the com
0a80: 6d 61 6e 64 20 6c 69 6e 65 2c 20 65 6e 74 65 72 mand line, enter
0a90: 20 61 20 63 6f 6d 6d 61 6e 64 20 73 69 6d 69 6c a command simil
0aa0: 61 72 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ar.. #
0ab0: 20 20 74 6f 20 6f 6e 65 20 6f 66 20 74 68 65 20 to one of the
0ac0: 66 6f 6c 6c 6f 77 69 6e 67 20 28 61 6c 6c 20 6f following (all o
0ad0: 6e 20 6f 6e 65 20 6c 69 6e 65 29 3a 0d 0a 20 20 n one line):..
0ae0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 #.. #
0af0: 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e EagleShell.
0b00: 65 78 65 20 2d 61 6e 79 49 6e 69 74 69 61 6c 69 exe -anyInitiali
0b10: 7a 65 20 22 73 65 74 20 74 65 73 74 5f 79 65 61 ze "set test_yea
0b20: 72 20 32 30 30 35 22 0d 0a 20 20 20 20 20 20 23 r 2005".. #
0b30: 20 20 20 20 20 20 20 20 20 2d 66 69 6c 65 20 2e -file .
0b40: 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 \path\to\all.eag
0b50: 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 le.. #..
0b60: 20 20 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 # Eagle
0b70: 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 49 6e Shell.exe -anyIn
0b80: 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 74 65 itialize "set te
0b90: 73 74 5f 79 65 61 72 20 32 30 30 38 22 0d 0a 20 st_year 2008"..
0ba0: 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 2d # -
0bb0: 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 file .\path\to\a
0bc0: 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 20 20 20 ll.eagle..
0bd0: 23 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 #.. #
0be0: 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 20 EagleShell.exe
0bf0: 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a 65 20 22 -anyInitialize "
0c00: 73 65 74 20 74 65 73 74 5f 79 65 61 72 20 32 30 set test_year 20
0c10: 31 30 22 0d 0a 20 20 20 20 20 20 23 20 20 20 20 10".. #
0c20: 20 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 -file .\pat
0c30: 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a h\to\all.eagle..
0c40: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
0c50: 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c EagleShel
0c60: 6c 2e 65 78 65 20 2d 61 6e 79 49 6e 69 74 69 61 l.exe -anyInitia
0c70: 6c 69 7a 65 20 22 73 65 74 20 74 65 73 74 5f 79 lize "set test_y
0c80: 65 61 72 20 32 30 31 32 22 0d 0a 20 20 20 20 20 ear 2012"..
0c90: 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 6c 65 # -file
0ca0: 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 .\path\to\all.e
0cb0: 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a 20 agle.. #..
0cc0: 20 20 20 20 20 23 20 20 20 20 20 20 20 45 61 67 # Eag
0cd0: 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 leShell.exe -any
0ce0: 49 6e 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 Initialize "set
0cf0: 74 65 73 74 5f 79 65 61 72 20 32 30 31 33 22 0d test_year 2013".
0d00: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 . #
0d10: 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c 74 6f -file .\path\to
0d20: 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 20 20 \all.eagle..
0d30: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 20 20 20 #.. #
0d40: 20 20 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 EagleShell.ex
0d50: 65 20 2d 61 6e 79 49 6e 69 74 69 61 6c 69 7a 65 e -anyInitialize
0d60: 20 22 73 65 74 20 74 65 73 74 5f 79 65 61 72 20 "set test_year
0d70: 32 30 31 35 22 0d 0a 20 20 20 20 20 20 23 20 20 2015".. #
0d80: 20 20 20 20 20 20 20 2d 66 69 6c 65 20 2e 5c 70 -file .\p
0d90: 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 ath\to\all.eagle
0da0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
0db0: 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 # EagleSh
0dc0: 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 49 6e 69 74 ell.exe -anyInit
0dd0: 69 61 6c 69 7a 65 20 22 73 65 74 20 74 65 73 74 ialize "set test
0de0: 5f 79 65 61 72 20 32 30 31 37 22 0d 0a 20 20 20 _year 2017"..
0df0: 20 20 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 # -fi
0e00: 6c 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c le .\path\to\all
0e10: 2e 65 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d .eagle.. #.
0e20: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 45 . # E
0e30: 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d 61 agleShell.exe -a
0e40: 6e 79 49 6e 69 74 69 61 6c 69 7a 65 20 22 75 6e nyInitialize "un
0e50: 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 set -nocomplain
0e60: 74 65 73 74 5f 79 65 61 72 22 0d 0a 20 20 20 20 test_year"..
0e70: 20 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 6c # -fil
0e80: 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e e .\path\to\all.
0e90: 65 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a eagle.. #..
0ea0: 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 if {[info
0eb0: 65 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 79 65 exists ::test_ye
0ec0: 61 72 5d 20 26 26 20 5b 73 74 72 69 6e 67 20 6c ar] && [string l
0ed0: 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 79 65 ength $::test_ye
0ee0: 61 72 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d ar] > 0} then {.
0ef0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
0f00: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
0f10: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 74 65 the specified te
0f20: 73 74 20 79 65 61 72 2e 20 20 49 66 20 74 68 69 st year. If thi
0f30: 73 20 76 61 72 69 61 62 6c 65 20 69 73 20 6e 6f s variable is no
0f40: 74 20 73 65 74 2c 20 74 68 65 0d 0a 20 20 20 20 t set, the..
0f50: 20 20 20 20 23 20 20 20 20 20 20 20 64 65 66 61 # defa
0f60: 75 6c 74 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 ult value will b
0f70: 65 20 62 61 73 65 64 20 6f 6e 20 77 68 65 74 68 e based on wheth
0f80: 65 72 20 6f 72 20 6e 6f 74 20 45 61 67 6c 65 20 er or not Eagle
0f90: 68 61 73 20 62 65 65 6e 0d 0a 20 20 20 20 20 20 has been..
0fa0: 20 20 23 20 20 20 20 20 20 20 63 6f 6d 70 69 6c # compil
0fb0: 65 64 20 61 67 61 69 6e 73 74 20 74 68 65 20 43 ed against the C
0fc0: 4c 52 20 76 32 2e 30 20 6f 72 20 43 4c 52 20 76 LR v2.0 or CLR v
0fd0: 34 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 4.0... #.
0fe0: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
0ff0: 24 3a 3a 74 65 73 74 5f 79 65 61 72 0d 0a 20 20 $::test_year..
1000: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
1010: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1020: 20 23 20 4e 4f 54 45 3a 20 49 66 20 45 61 67 6c # NOTE: If Eagl
1030: 65 20 68 61 73 20 62 65 65 6e 20 63 6f 6d 70 69 e has been compi
1040: 6c 65 64 20 61 67 61 69 6e 73 74 20 74 68 65 20 led against the
1050: 43 4c 52 20 76 34 2e 30 2c 20 75 73 65 20 22 32 CLR v4.0, use "2
1060: 30 31 30 22 20 62 79 0d 0a 20 20 20 20 20 20 20 010" by..
1070: 20 23 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 # default
1080: 20 28 77 65 20 63 6f 75 6c 64 20 75 73 65 20 22 (we could use "
1090: 32 30 31 32 22 2c 20 22 32 30 31 33 22 2c 20 22 2012", "2013", "
10a0: 32 30 31 35 22 2c 20 6f 72 20 22 32 30 31 37 22 2015", or "2017"
10b0: 20 69 6e 20 74 68 61 74 0d 0a 20 20 20 20 20 20 in that..
10c0: 20 20 23 20 20 20 20 20 20 20 63 61 73 65 20 61 # case a
10d0: 73 20 77 65 6c 6c 29 20 61 73 20 74 68 65 20 74 s well) as the t
10e0: 65 73 74 20 79 65 61 72 3b 20 6f 74 68 65 72 77 est year; otherw
10f0: 69 73 65 2c 20 75 73 65 20 22 32 30 30 38 22 20 ise, use "2008"
1100: 62 79 20 64 65 66 61 75 6c 74 0d 0a 20 20 20 20 by default..
1110: 20 20 20 20 23 20 20 20 20 20 20 20 28 77 65 20 # (we
1120: 63 6f 75 6c 64 20 75 73 65 20 22 32 30 30 35 22 could use "2005"
1130: 20 69 6e 20 74 68 61 74 20 63 61 73 65 20 61 73 in that case as
1140: 20 77 65 6c 6c 29 2e 20 20 49 66 20 61 6e 6f 74 well). If anot
1150: 68 65 72 20 6d 61 6a 6f 72 0d 0a 20 20 20 20 20 her major..
1160: 20 20 20 23 20 20 20 20 20 20 20 5b 69 6e 63 6f # [inco
1170: 6d 70 61 74 69 62 6c 65 5d 20 76 65 72 73 69 6f mpatible] versio
1180: 6e 20 6f 66 20 74 68 65 20 43 4c 52 20 69 73 20 n of the CLR is
1190: 72 65 6c 65 61 73 65 64 2c 20 74 68 69 73 20 63 released, this c
11a0: 68 65 63 6b 20 77 69 6c 6c 0d 0a 20 20 20 20 20 heck will..
11b0: 20 20 20 23 20 20 20 20 20 20 20 68 61 76 65 20 # have
11c0: 74 6f 20 62 65 20 63 68 61 6e 67 65 64 2e 20 20 to be changed.
11d0: 54 68 65 20 64 65 66 61 75 6c 74 20 74 65 73 74 The default test
11e0: 20 79 65 61 72 20 74 6f 20 75 73 65 20 66 6f 72 year to use for
11f0: 20 61 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 a.. #
1200: 20 20 20 20 70 61 72 74 69 63 75 6c 61 72 20 43 particular C
1210: 4c 52 20 76 65 72 73 69 6f 6e 20 6d 61 79 20 62 LR version may b
1220: 65 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 e overridden by
1230: 73 65 74 74 69 6e 67 20 74 68 65 20 67 6c 6f 62 setting the glob
1240: 61 6c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 al.. #
1250: 20 20 20 20 76 61 72 69 61 62 6c 65 20 22 74 65 variable "te
1260: 73 74 5f 79 65 61 72 5f 63 6c 72 5f 76 24 58 22 st_year_clr_v$X"
1270: 2c 20 77 68 65 72 65 20 22 24 58 22 20 6d 61 79 , where "$X" may
1280: 20 5b 63 75 72 72 65 6e 74 6c 79 5d 20 62 65 0d [currently] be.
1290: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
12a0: 20 65 69 74 68 65 72 20 22 32 22 20 6f 72 20 22 either "2" or "
12b0: 34 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 4"... #..
12c0: 20 20 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 if {[hav
12d0: 65 43 6f 6e 73 74 72 61 69 6e 74 20 69 6d 61 67 eConstraint imag
12e0: 65 52 75 6e 74 69 6d 65 34 30 5d 7d 20 74 68 65 eRuntime40]} the
12f0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 n {.. i
1300: 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 f {[info exists
1310: 3a 3a 74 65 73 74 5f 79 65 61 72 5f 63 6c 72 5f ::test_year_clr_
1320: 76 34 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 v4] && \..
1330: 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
1340: 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 79 length $::test_y
1350: 65 61 72 5f 63 6c 72 5f 76 34 5d 20 3e 20 30 7d ear_clr_v4] > 0}
1360: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1370: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1380: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
1390: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 74 65 the specified te
13a0: 73 74 20 79 65 61 72 20 66 6f 72 20 74 68 65 20 st year for the
13b0: 43 4c 52 20 76 34 2e 30 2e 0d 0a 20 20 20 20 20 CLR v4.0...
13c0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
13d0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
13e0: 74 65 73 74 5f 79 65 61 72 5f 63 6c 72 5f 76 34 test_year_clr_v4
13f0: 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c .. } el
1400: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
1410: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
1420: 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 # NOTE: Use the
1430: 20 64 65 66 61 75 6c 74 20 74 65 73 74 20 79 65 default test ye
1440: 61 72 20 66 6f 72 20 74 68 65 20 43 4c 52 20 76 ar for the CLR v
1450: 34 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 4.0...
1460: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
1470: 20 72 65 74 75 72 6e 20 32 30 31 30 3b 20 23 20 return 2010; #
1480: 54 4f 44 4f 3a 20 47 6f 6f 64 20 22 66 61 6c 6c TODO: Good "fall
1490: 62 61 63 6b 22 20 64 65 66 61 75 6c 74 3f 0d 0a back" default?..
14a0: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
14b0: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
14c0: 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e if {[in
14d0: 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 73 74 fo exists ::test
14e0: 5f 79 65 61 72 5f 63 6c 72 5f 76 32 5d 20 26 26 _year_clr_v2] &&
14f0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1500: 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
1510: 20 24 3a 3a 74 65 73 74 5f 79 65 61 72 5f 63 6c $::test_year_cl
1520: 72 5f 76 32 5d 20 3e 20 30 7d 20 74 68 65 6e 20 r_v2] > 0} then
1530: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 {.. #
1540: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 .. #
1550: 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 NOTE: Use the sp
1560: 65 63 69 66 69 65 64 20 74 65 73 74 20 79 65 61 ecified test yea
1570: 72 20 66 6f 72 20 74 68 65 20 43 4c 52 20 76 32 r for the CLR v2
1580: 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 .0...
1590: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
15a0: 72 65 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f 79 return $::test_y
15b0: 65 61 72 5f 63 6c 72 5f 76 32 0d 0a 20 20 20 20 ear_clr_v2..
15c0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
15d0: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
15e0: 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 # NOT
15f0: 45 3a 20 55 73 65 20 74 68 65 20 64 65 66 61 75 E: Use the defau
1600: 6c 74 20 74 65 73 74 20 79 65 61 72 20 66 6f 72 lt test year for
1610: 20 74 68 65 20 43 4c 52 20 76 32 2e 30 2e 0d 0a the CLR v2.0...
1620: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
1630: 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 retur
1640: 6e 20 32 30 30 38 3b 20 23 20 54 4f 44 4f 3a 20 n 2008; # TODO:
1650: 47 6f 6f 64 20 22 66 61 6c 6c 62 61 63 6b 22 20 Good "fallback"
1660: 64 65 66 61 75 6c 74 3f 0d 0a 20 20 20 20 20 20 default?..
1670: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1680: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
1690: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
16a0: 74 42 75 69 6c 64 4e 61 74 69 76 65 59 65 61 72 tBuildNativeYear
16b0: 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 {} {.. if
16c0: 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a {[info exists ::
16d0: 74 65 73 74 5f 6e 61 74 69 76 65 5f 79 65 61 72 test_native_year
16e0: 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] && \..
16f0: 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
1700: 20 24 3a 3a 74 65 73 74 5f 6e 61 74 69 76 65 5f $::test_native_
1710: 79 65 61 72 5d 20 3e 20 30 7d 20 74 68 65 6e 20 year] > 0} then
1720: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
1730: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 # NOTE: Us
1740: 65 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 e the specified
1750: 74 65 73 74 20 79 65 61 72 20 66 6f 72 20 6e 61 test year for na
1760: 74 69 76 65 20 62 69 6e 61 72 69 65 73 2e 20 20 tive binaries.
1770: 49 66 20 74 68 69 73 0d 0a 20 20 20 20 20 20 20 If this..
1780: 20 23 20 20 20 20 20 20 20 76 61 72 69 61 62 6c # variabl
1790: 65 20 69 73 20 6e 6f 74 20 73 65 74 2c 20 74 68 e is not set, th
17a0: 65 20 76 61 6c 75 65 20 72 65 74 75 72 6e 65 64 e value returned
17b0: 20 62 79 20 5b 67 65 74 42 75 69 6c 64 59 65 61 by [getBuildYea
17c0: 72 5d 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 r].. #
17d0: 20 20 20 20 77 69 6c 6c 20 62 65 20 75 73 65 64 will be used
17e0: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
17f0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
1800: 74 65 73 74 5f 6e 61 74 69 76 65 5f 79 65 61 72 test_native_year
1810: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
1820: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1830: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 61 6c # NOTE: Fal
1840: 6c 62 61 63 6b 20 6f 6e 20 74 68 65 20 28 6e 6f lback on the (no
1850: 72 6d 61 6c 29 20 62 75 69 6c 64 20 79 65 61 72 rmal) build year
1860: 20 66 6f 72 20 6d 61 6e 61 67 65 64 20 62 69 6e for managed bin
1870: 61 72 69 65 73 2e 0d 0a 20 20 20 20 20 20 20 20 aries...
1880: 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 #.. retur
1890: 6e 20 5b 67 65 74 42 75 69 6c 64 59 65 61 72 5d n [getBuildYear]
18a0: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
18b0: 0d 0a 0c 0d 0a 20 20 20 20 23 0d 0a 20 20 20 20 ..... #..
18c0: 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 6f # NOTE: This pro
18d0: 63 65 64 75 72 65 20 69 73 20 6f 6e 6c 79 20 75 cedure is only u
18e0: 73 65 64 20 77 68 65 6e 20 61 64 64 69 6e 67 20 sed when adding
18f0: 73 68 69 6d 6d 65 64 20 74 65 73 74 20 63 6f 6e shimmed test con
1900: 73 74 72 61 69 6e 74 73 2e 0d 0a 20 20 20 20 23 straints... #
1910: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 75 .. proc getBu
1920: 69 6c 64 43 6c 72 56 65 72 73 69 6f 6e 20 7b 7d ildClrVersion {}
1930: 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 {.. if {[i
1940: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 73 nfo exists ::tes
1950: 74 5f 63 6c 72 5d 20 26 26 20 5b 73 74 72 69 6e t_clr] && [strin
1960: 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 g length $::test
1970: 5f 63 6c 72 5d 20 3e 20 30 7d 20 74 68 65 6e 20 _clr] > 0} then
1980: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
1990: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 # NOTE: Us
19a0: 65 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 e the specified
19b0: 74 65 73 74 20 76 65 72 73 69 6f 6e 20 66 6f 72 test version for
19c0: 20 74 68 65 20 43 4c 52 2e 20 20 49 66 20 74 68 the CLR. If th
19d0: 69 73 20 76 61 72 69 61 62 6c 65 0d 0a 20 20 20 is variable..
19e0: 20 20 20 20 20 23 20 20 20 20 20 20 20 69 73 20 # is
19f0: 6e 6f 74 20 73 65 74 2c 20 74 68 65 20 64 65 66 not set, the def
1a00: 61 75 6c 74 20 76 61 6c 75 65 20 77 69 6c 6c 20 ault value will
1a10: 62 65 20 62 61 73 65 64 20 6f 6e 20 77 68 65 74 be based on whet
1a20: 68 65 72 20 6f 72 20 6e 6f 74 0d 0a 20 20 20 20 her or not..
1a30: 20 20 20 20 23 20 20 20 20 20 20 20 45 61 67 6c # Eagl
1a40: 65 20 68 61 73 20 62 65 65 6e 20 63 6f 6d 70 69 e has been compi
1a50: 6c 65 64 20 61 67 61 69 6e 73 74 20 74 68 65 20 led against the
1a60: 43 4c 52 20 76 32 2e 30 20 6f 72 20 43 4c 52 20 CLR v2.0 or CLR
1a70: 76 34 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 23 v4.0... #
1a80: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
1a90: 20 24 3a 3a 74 65 73 74 5f 63 6c 72 0d 0a 20 20 $::test_clr..
1aa0: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
1ab0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1ac0: 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 # NOTE: Check i
1ad0: 66 20 45 61 67 6c 65 20 68 61 73 20 62 65 65 6e f Eagle has been
1ae0: 20 63 6f 6d 70 69 6c 65 64 20 61 67 61 69 6e 73 compiled agains
1af0: 74 20 74 68 65 20 43 4c 52 20 76 34 2e 30 2e 20 t the CLR v4.0.
1b00: 20 49 66 20 73 6f 2c 0d 0a 20 20 20 20 20 20 20 If so,..
1b10: 20 23 20 20 20 20 20 20 20 6a 75 73 74 20 75 73 # just us
1b20: 65 20 74 68 61 74 20 43 4c 52 20 76 65 72 73 69 e that CLR versi
1b30: 6f 6e 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 on. Otherwise,
1b40: 75 73 65 20 74 68 65 20 76 65 72 73 69 6f 6e 20 use the version
1b50: 66 6f 72 20 74 68 65 0d 0a 20 20 20 20 20 20 20 for the..
1b60: 20 23 20 20 20 20 20 20 20 43 4c 52 20 76 32 2e # CLR v2.
1b70: 30 2e 20 20 49 66 20 61 6e 6f 74 68 65 72 20 6d 0. If another m
1b80: 61 6a 6f 72 20 5b 69 6e 63 6f 6d 70 61 74 69 62 ajor [incompatib
1b90: 6c 65 5d 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 le] version of t
1ba0: 68 65 20 43 4c 52 0d 0a 20 20 20 20 20 20 20 20 he CLR..
1bb0: 23 20 20 20 20 20 20 20 69 73 20 72 65 6c 65 61 # is relea
1bc0: 73 65 64 2c 20 74 68 69 73 20 63 68 65 63 6b 20 sed, this check
1bd0: 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 62 65 20 will have to be
1be0: 63 68 61 6e 67 65 64 2e 20 20 54 68 65 20 64 65 changed. The de
1bf0: 66 61 75 6c 74 0d 0a 20 20 20 20 20 20 20 20 23 fault.. #
1c00: 20 20 20 20 20 20 20 76 65 72 73 69 6f 6e 20 76 version v
1c10: 61 6c 75 65 20 66 6f 72 20 61 20 70 61 72 74 69 alue for a parti
1c20: 63 75 6c 61 72 20 43 4c 52 20 76 65 72 73 69 6f cular CLR versio
1c30: 6e 20 6d 61 79 20 62 65 20 6f 76 65 72 72 69 64 n may be overrid
1c40: 64 65 6e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 den.. #
1c50: 20 20 20 20 20 62 79 20 73 65 74 74 69 6e 67 20 by setting
1c60: 74 68 65 20 67 6c 6f 62 61 6c 20 76 61 72 69 61 the global varia
1c70: 62 6c 65 20 22 74 65 73 74 5f 63 6c 72 5f 76 24 ble "test_clr_v$
1c80: 58 22 2c 20 77 68 65 72 65 20 22 24 58 22 20 6d X", where "$X" m
1c90: 61 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ay.. #
1ca0: 20 20 20 20 5b 63 75 72 72 65 6e 74 6c 79 5d 20 [currently]
1cb0: 62 65 20 65 69 74 68 65 72 20 22 32 22 20 6f 72 be either "2" or
1cc0: 20 22 34 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 "4"... #
1cd0: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 68 .. if {[h
1ce0: 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 69 6d aveConstraint im
1cf0: 61 67 65 52 75 6e 74 69 6d 65 34 30 5d 7d 20 74 ageRuntime40]} t
1d00: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1d10: 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
1d20: 73 20 3a 3a 74 65 73 74 5f 63 6c 72 5f 76 34 5d s ::test_clr_v4]
1d30: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
1d40: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
1d50: 67 74 68 20 24 3a 3a 74 65 73 74 5f 63 6c 72 5f gth $::test_clr_
1d60: 76 34 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d v4] > 0} then {.
1d70: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
1d80: 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f # NO
1d90: 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 TE: Use the spec
1da0: 69 66 69 65 64 20 74 65 73 74 20 76 65 72 73 69 ified test versi
1db0: 6f 6e 20 66 6f 72 20 74 68 65 20 43 4c 52 20 76 on for the CLR v
1dc0: 34 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 4.0...
1dd0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
1de0: 20 72 65 74 75 72 6e 20 24 3a 3a 74 65 73 74 5f return $::test_
1df0: 63 6c 72 5f 76 34 0d 0a 20 20 20 20 20 20 20 20 clr_v4..
1e00: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
1e10: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1e20: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 # NOTE: U
1e30: 73 65 20 74 68 65 20 64 65 66 61 75 6c 74 20 74 se the default t
1e40: 65 73 74 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 est version for
1e50: 74 68 65 20 43 4c 52 20 76 34 2e 30 2e 0d 0a 20 the CLR v4.0...
1e60: 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
1e70: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
1e80: 20 34 2e 30 2e 33 30 33 31 39 3b 20 23 20 54 4f 4.0.30319; # TO
1e90: 44 4f 3a 20 47 6f 6f 64 20 22 66 61 6c 6c 62 61 DO: Good "fallba
1ea0: 63 6b 22 20 64 65 66 61 75 6c 74 3f 0d 0a 20 20 ck" default?..
1eb0: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1ec0: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
1ed0: 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f if {[info
1ee0: 20 65 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 63 exists ::test_c
1ef0: 6c 72 5f 76 32 5d 20 26 26 20 5c 0d 0a 20 20 20 lr_v2] && \..
1f00: 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 [stri
1f10: 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 ng length $::tes
1f20: 74 5f 63 6c 72 5f 76 32 5d 20 3e 20 30 7d 20 74 t_clr_v2] > 0} t
1f30: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1f40: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
1f50: 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 # NOTE: Use th
1f60: 65 20 73 70 65 63 69 66 69 65 64 20 74 65 73 74 e specified test
1f70: 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 74 68 65 version for the
1f80: 20 43 4c 52 20 76 32 2e 30 2e 0d 0a 20 20 20 20 CLR v2.0...
1f90: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
1fa0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a return $:
1fb0: 3a 74 65 73 74 5f 63 6c 72 5f 76 32 0d 0a 20 20 :test_clr_v2..
1fc0: 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
1fd0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d .. #.
1fe0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e . # N
1ff0: 4f 54 45 3a 20 55 73 65 20 74 68 65 20 64 65 66 OTE: Use the def
2000: 61 75 6c 74 20 74 65 73 74 20 76 65 72 73 69 6f ault test versio
2010: 6e 20 66 6f 72 20 74 68 65 20 43 4c 52 20 76 32 n for the CLR v2
2020: 2e 30 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 .0...
2030: 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
2040: 72 65 74 75 72 6e 20 32 2e 30 2e 35 30 37 32 37 return 2.0.50727
2050: 3b 20 23 20 54 4f 44 4f 3a 20 47 6f 6f 64 20 22 ; # TODO: Good "
2060: 66 61 6c 6c 62 61 63 6b 22 20 64 65 66 61 75 6c fallback" defaul
2070: 74 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d t?.. }.
2080: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
2090: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
20a0: 20 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 proc getBuild
20b0: 59 65 61 72 73 20 7b 7d 20 7b 0d 0a 20 20 20 20 Years {} {..
20c0: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
20d0: 45 3a 20 53 65 65 20 69 66 20 74 68 65 20 6c 69 E: See if the li
20e0: 73 74 20 6f 66 20 74 65 73 74 20 79 65 61 72 73 st of test years
20f0: 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 has been overri
2100: 64 64 65 6e 20 62 79 20 74 68 65 20 75 73 65 72 dden by the user
2110: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
2120: 28 65 2e 67 2e 20 6f 6e 20 74 68 65 20 63 6f 6d (e.g. on the com
2130: 6d 61 6e 64 20 6c 69 6e 65 29 2e 0d 0a 20 20 20 mand line)...
2140: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
2150: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
2160: 65 73 74 5f 79 65 61 72 73 5d 20 26 26 20 5b 6c est_years] && [l
2170: 6c 65 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 79 length $::test_y
2180: 65 61 72 73 5d 20 3e 20 30 7d 20 74 68 65 6e 20 ears] > 0} then
2190: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
21a0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 # NOTE: Us
21b0: 65 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 e the specified
21c0: 6c 69 73 74 20 6f 66 20 74 65 73 74 20 79 65 61 list of test yea
21d0: 72 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a rs... #..
21e0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
21f0: 3a 3a 74 65 73 74 5f 79 65 61 72 73 0d 0a 20 20 ::test_years..
2200: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
2210: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
2220: 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 # NOTE: Use the
2230: 20 64 65 66 61 75 6c 74 20 6c 69 73 74 20 6f 66 default list of
2240: 20 74 65 73 74 20 79 65 61 72 73 20 28 69 2e 65 test years (i.e
2250: 2e 20 61 6c 6c 29 2e 0d 0a 20 20 20 20 20 20 20 . all)...
2260: 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 #.. retu
2270: 72 6e 20 5b 6c 69 73 74 20 32 30 30 35 20 32 30 rn [list 2005 20
2280: 30 38 20 32 30 31 30 20 32 30 31 32 20 32 30 31 08 2010 2012 201
2290: 33 20 32 30 31 35 20 32 30 31 37 20 4e 65 74 53 3 2015 2017 NetS
22a0: 74 61 6e 64 61 72 64 32 30 5d 0d 0a 20 20 20 20 tandard20]..
22b0: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
22c0: 20 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 proc getBuild
22d0: 4e 65 74 46 78 20 7b 7d 20 7b 0d 0a 20 20 20 20 NetFx {} {..
22e0: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
22f0: 45 3a 20 53 65 65 20 69 66 20 74 68 65 20 74 65 E: See if the te
2300: 73 74 20 2e 4e 45 54 20 46 72 61 6d 65 77 6f 72 st .NET Framewor
2310: 6b 20 73 65 74 74 69 6e 67 20 68 61 73 20 62 65 k setting has be
2320: 65 6e 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 en overridden by
2330: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
2340: 74 68 65 20 75 73 65 72 20 28 65 2e 67 2e 20 6f the user (e.g. o
2350: 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 n the command li
2360: 6e 65 29 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ne)... #..
2370: 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 if {[info e
2380: 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 6e 65 74 xists ::test_net
2390: 5f 66 78 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 _fx] && \..
23a0: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
23b0: 67 74 68 20 24 3a 3a 74 65 73 74 5f 6e 65 74 5f gth $::test_net_
23c0: 66 78 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d fx] > 0} then {.
23d0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
23e0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
23f0: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 74 65 the specified te
2400: 73 74 20 2e 4e 45 54 20 46 72 61 6d 65 77 6f 72 st .NET Framewor
2410: 6b 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 k... #..
2420: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a return $:
2430: 3a 74 65 73 74 5f 6e 65 74 5f 66 78 0d 0a 20 20 :test_net_fx..
2440: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
2450: 20 20 20 20 20 20 73 65 74 20 79 65 61 72 20 5b set year [
2460: 67 65 74 42 75 69 6c 64 59 65 61 72 5d 0d 0a 20 getBuildYear]..
2470: 20 20 20 20 20 20 20 73 65 74 20 79 65 61 72 56 set yearV
2480: 61 72 4e 61 6d 65 20 5b 61 70 70 65 6e 64 41 72 arName [appendAr
2490: 67 73 20 3a 3a 74 65 73 74 5f 6e 65 74 5f 66 78 gs ::test_net_fx
24a0: 5f 20 24 79 65 61 72 5d 0d 0a 0d 0a 20 20 20 20 _ $year]....
24b0: 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
24c0: 69 73 74 73 20 24 79 65 61 72 56 61 72 4e 61 6d ists $yearVarNam
24d0: 65 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 e] && \..
24e0: 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
24f0: 67 74 68 20 5b 73 65 74 20 24 79 65 61 72 56 61 gth [set $yearVa
2500: 72 4e 61 6d 65 5d 5d 20 3e 20 30 7d 20 74 68 65 rName]] > 0} the
2510: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 n {.. #
2520: 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f .. # NO
2530: 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 TE: Use the spec
2540: 69 66 69 65 64 20 74 65 73 74 20 2e 4e 45 54 20 ified test .NET
2550: 46 72 61 6d 65 77 6f 72 6b 2c 20 62 61 73 65 64 Framework, based
2560: 20 6f 6e 20 74 68 65 20 62 75 69 6c 64 0d 0a 20 on the build..
2570: 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
2580: 20 79 65 61 72 2e 0d 0a 20 20 20 20 20 20 20 20 year...
2590: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 72 #.. r
25a0: 65 74 75 72 6e 20 5b 73 65 74 20 24 79 65 61 72 eturn [set $year
25b0: 56 61 72 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 VarName]..
25c0: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
25d0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
25e0: 20 20 20 23 20 4e 4f 54 45 3a 20 46 61 6c 6c 62 # NOTE: Fallb
25f0: 61 63 6b 20 74 6f 20 74 68 65 20 22 77 65 6c 6c ack to the "well
2600: 20 6b 6e 6f 77 6e 22 20 2e 4e 45 54 20 46 72 61 known" .NET Fra
2610: 6d 65 77 6f 72 6b 20 76 65 72 73 69 6f 6e 20 74 mework version t
2620: 68 61 74 0d 0a 20 20 20 20 20 20 20 20 20 20 23 hat.. #
2630: 20 20 20 20 20 20 20 69 73 20 6d 6f 73 74 20 63 is most c
2640: 6c 6f 73 65 6c 79 20 61 73 73 6f 63 69 61 74 65 losely associate
2650: 64 20 77 69 74 68 20 61 20 70 61 72 74 69 63 75 d with a particu
2660: 6c 61 72 20 76 65 72 73 69 6f 6e 20 6f 66 0d 0a lar version of..
2670: 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
2680: 20 20 56 69 73 75 61 6c 20 53 74 75 64 69 6f 2e Visual Studio.
2690: 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
26a0: 20 20 20 20 20 20 20 20 20 73 77 69 74 63 68 20 switch
26b0: 2d 65 78 61 63 74 20 2d 2d 20 24 79 65 61 72 20 -exact -- $year
26c0: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 32 {.. 2
26d0: 30 30 35 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 005 {..
26e0: 20 20 20 20 20 72 65 74 75 72 6e 20 6e 65 74 46 return netF
26f0: 78 32 30 0d 0a 20 20 20 20 20 20 20 20 20 20 20 x20..
2700: 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
2710: 32 30 30 38 20 7b 0d 0a 20 20 20 20 20 20 20 20 2008 {..
2720: 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 65 74 return net
2730: 46 78 33 35 0d 0a 20 20 20 20 20 20 20 20 20 20 Fx35..
2740: 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
2750: 20 32 30 31 30 20 7b 0d 0a 20 20 20 20 20 20 20 2010 {..
2760: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 65 return ne
2770: 74 46 78 34 30 0d 0a 20 20 20 20 20 20 20 20 20 tFx40..
2780: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
2790: 20 20 32 30 31 32 20 7b 0d 0a 20 20 20 20 20 20 2012 {..
27a0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e return n
27b0: 65 74 46 78 34 35 0d 0a 20 20 20 20 20 20 20 20 etFx45..
27c0: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
27d0: 20 20 20 32 30 31 33 20 7b 0d 0a 20 20 20 20 20 2013 {..
27e0: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
27f0: 6e 65 74 46 78 34 35 31 3b 20 23 20 54 4f 44 4f netFx451; # TODO
2800: 3a 20 4f 72 20 22 6e 65 74 46 78 34 35 32 22 3f : Or "netFx452"?
2810: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
2820: 0a 20 20 20 20 20 20 20 20 20 20 20 20 32 30 31 . 201
2830: 35 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 5 {..
2840: 20 20 20 72 65 74 75 72 6e 20 6e 65 74 46 78 34 return netFx4
2850: 36 3b 20 23 20 54 4f 44 4f 3a 20 4f 72 20 22 6e 6; # TODO: Or "n
2860: 65 74 46 78 34 36 31 22 20 2f 20 22 6e 65 74 46 etFx461" / "netF
2870: 78 34 36 32 22 3f 0d 0a 20 20 20 20 20 20 20 20 x462"?..
2880: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
2890: 20 20 20 32 30 31 37 20 7b 0d 0a 20 20 20 20 20 2017 {..
28a0: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
28b0: 6e 65 74 46 78 34 37 3b 20 23 20 54 4f 44 4f 3a netFx47; # TODO:
28c0: 20 4f 72 20 22 6e 65 74 46 78 34 37 31 22 20 2f Or "netFx471" /
28d0: 20 22 6e 65 74 46 78 34 37 32 22 3f 0d 0a 20 20 "netFx472"?..
28e0: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
28f0: 20 20 20 20 20 20 20 20 20 4e 65 74 53 74 61 6e NetStan
2900: 64 61 72 64 32 30 20 7b 0d 0a 20 20 20 20 20 20 dard20 {..
2910: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e return n
2920: 65 74 53 74 61 6e 64 61 72 64 32 30 0d 0a 20 20 etStandard20..
2930: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
2940: 20 20 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 default
2950: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
2960: 20 20 72 65 74 75 72 6e 20 6e 65 74 46 78 33 35 return netFx35
2970: 3b 20 23 20 54 4f 44 4f 3a 20 47 6f 6f 64 20 22 ; # TODO: Good "
2980: 66 61 6c 6c 62 61 63 6b 22 20 64 65 66 61 75 6c fallback" defaul
2990: 74 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 t?..
29a0: 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
29b0: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
29c0: 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
29d0: 20 20 23 0d 0a 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
29e0: 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 This procedure
29f0: 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 6e 6f should return no
2a00: 6e 2d 7a 65 72 6f 20 69 66 20 74 68 65 20 63 6f n-zero if the co
2a10: 6e 66 69 67 75 72 65 64 20 74 65 73 74 0d 0a 20 nfigured test..
2a20: 20 20 20 23 20 20 20 20 20 20 20 70 6c 61 74 66 # platf
2a30: 6f 72 6d 20 69 73 20 6d 6f 73 74 20 6c 69 6b 65 orm is most like
2a40: 6c 79 20 74 68 65 20 64 65 66 61 75 6c 74 20 66 ly the default f
2a50: 6f 72 20 74 68 69 73 20 6d 61 63 68 69 6e 65 2e or this machine.
2a60: 0d 0a 20 20 20 20 23 0d 0a 20 20 20 20 70 72 6f .. #.. pro
2a70: 63 20 69 73 44 65 66 61 75 6c 74 42 75 69 6c 64 c isDefaultBuild
2a80: 50 6c 61 74 66 6f 72 6d 20 7b 20 7b 76 65 72 62 Platform { {verb
2a90: 6f 73 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 ose true} } {..
2aa0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
2ab0: 4e 4f 54 45 3a 20 52 75 6e 6e 69 6e 67 20 6f 6e NOTE: Running on
2ac0: 20 57 6f 57 36 34 20 69 73 20 6e 65 76 65 72 20 WoW64 is never
2ad0: 74 68 65 20 64 65 66 61 75 6c 74 20 70 6c 61 74 the default plat
2ae0: 66 6f 72 6d 2e 0d 0a 20 20 20 20 20 20 23 0d 0a form... #..
2af0: 20 20 20 20 20 20 69 66 20 7b 5b 69 73 52 75 6e if {[isRun
2b00: 6e 69 6e 67 57 6f 57 36 34 5d 7d 20 74 68 65 6e ningWoW64]} then
2b10: 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
2b20: 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b $verbose} then {
2b30: 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
2b40: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
2b50: 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 l \..
2b60: 20 20 20 22 2d 2d 2d 2d 20 64 65 74 65 63 74 65 "---- detecte
2b70: 64 20 6e 6f 6e 2d 64 65 66 61 75 6c 74 20 70 6c d non-default pl
2b80: 61 74 66 6f 72 6d 20 28 57 6f 57 36 34 29 5c 6e atform (WoW64)\n
2b90: 22 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a ".. }....
2ba0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 return f
2bb0: 61 6c 73 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d alse.. }...
2bc0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
2bd0: 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 68 61 73 # NOTE: This has
2be0: 20 61 20 67 6f 6f 64 20 63 68 61 6e 63 65 20 6f a good chance o
2bf0: 66 20 62 65 69 6e 67 20 74 68 65 20 64 65 66 61 f being the defa
2c00: 75 6c 74 20 70 6c 61 74 66 6f 72 6d 2e 0d 0a 20 ult platform...
2c10: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
2c20: 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e {$verbose} then
2c30: 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 {.. tput
2c40: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
2c50: 6c 20 22 2d 2d 2d 2d 20 64 65 74 65 63 74 65 64 l "---- detected
2c60: 20 64 65 66 61 75 6c 74 20 70 6c 61 74 66 6f 72 default platfor
2c70: 6d 5c 6e 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d m\n".. }...
2c80: 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 . return tr
2c90: 75 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 ue.. }.....
2ca0: 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 50 proc getBuildP
2cb0: 6c 61 74 66 6f 72 6d 20 7b 20 6e 61 74 69 76 65 latform { native
2cc0: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b } {.. if {
2cd0: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
2ce0: 65 73 74 5f 70 6c 61 74 66 6f 72 6d 5d 20 26 26 est_platform] &&
2cf0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 \.. [s
2d00: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a tring length $::
2d10: 74 65 73 74 5f 70 6c 61 74 66 6f 72 6d 5d 20 3e test_platform] >
2d20: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
2d30: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
2d40: 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 NOTE: Use the s
2d50: 70 65 63 69 66 69 65 64 20 74 65 73 74 20 70 6c pecified test pl
2d60: 61 74 66 6f 72 6d 2e 20 20 49 66 20 74 68 69 73 atform. If this
2d70: 20 76 61 72 69 61 62 6c 65 20 69 73 20 6e 6f 74 variable is not
2d80: 20 73 65 74 2c 0d 0a 20 20 20 20 20 20 20 20 23 set,.. #
2d90: 20 20 20 20 20 20 20 74 68 65 20 64 65 66 61 75 the defau
2da0: 6c 74 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 65 lt value will be
2db0: 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 6d 61 based on the ma
2dc0: 63 68 69 6e 65 20 61 72 63 68 69 74 65 63 74 75 chine architectu
2dd0: 72 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a re... #..
2de0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b return [
2df0: 65 78 70 72 20 7b 24 6e 61 74 69 76 65 20 3f 20 expr {$native ?
2e00: 24 3a 3a 74 65 73 74 5f 70 6c 61 74 66 6f 72 6d $::test_platform
2e10: 20 3a 20 22 22 7d 5d 0d 0a 20 20 20 20 20 20 7d : ""}].. }
2e20: 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 elseif {[info e
2e30: 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 6d 61 63 xists ::test_mac
2e40: 68 69 6e 65 5d 20 26 26 20 5c 0d 0a 20 20 20 20 hine] && \..
2e50: 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 [string le
2e60: 6e 67 74 68 20 24 3a 3a 74 65 73 74 5f 6d 61 63 ngth $::test_mac
2e70: 68 69 6e 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 hine] > 0} then
2e80: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
2e90: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 6f # NOTE: Fo
2ea0: 72 20 6e 61 74 69 76 65 20 62 75 69 6c 64 73 2c r native builds,
2eb0: 20 72 65 74 75 72 6e 20 74 68 65 20 70 6c 61 74 return the plat
2ec0: 66 6f 72 6d 20 6e 61 6d 65 20 63 6f 72 72 65 73 form name corres
2ed0: 70 6f 6e 64 69 6e 67 20 74 6f 0d 0a 20 20 20 20 ponding to..
2ee0: 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 # the
2ef0: 74 65 73 74 20 6d 61 63 68 69 6e 65 20 61 72 63 test machine arc
2f00: 68 69 74 65 63 74 75 72 65 3b 20 6f 74 68 65 72 hitecture; other
2f10: 77 69 73 65 2c 20 72 65 74 75 72 6e 20 61 6e 20 wise, return an
2f20: 65 6d 70 74 79 0d 0a 20 20 20 20 20 20 20 20 23 empty.. #
2f30: 20 20 20 20 20 20 20 73 74 72 69 6e 67 2e 0d 0a string...
2f40: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
2f50: 20 20 20 72 65 74 75 72 6e 20 5b 65 78 70 72 20 return [expr
2f60: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 24 6e 61 {.. $na
2f70: 74 69 76 65 20 3f 20 5b 6d 61 63 68 69 6e 65 54 tive ? [machineT
2f80: 6f 50 6c 61 74 66 6f 72 6d 20 24 3a 3a 74 65 73 oPlatform $::tes
2f90: 74 5f 6d 61 63 68 69 6e 65 5d 20 3a 20 22 22 0d t_machine] : "".
2fa0: 0a 20 20 20 20 20 20 20 20 7d 5d 0d 0a 20 20 20 . }]..
2fb0: 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e } elseif {[in
2fc0: 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 63 6c 5f fo exists ::tcl_
2fd0: 70 6c 61 74 66 6f 72 6d 28 6d 61 63 68 69 6e 65 platform(machine
2fe0: 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 )]} then {..
2ff0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
3000: 20 4e 4f 54 45 3a 20 46 6f 72 20 6e 61 74 69 76 NOTE: For nativ
3010: 65 20 62 75 69 6c 64 73 2c 20 72 65 74 75 72 6e e builds, return
3020: 20 74 68 65 20 70 6c 61 74 66 6f 72 6d 20 6e 61 the platform na
3030: 6d 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 me corresponding
3040: 20 74 6f 0d 0a 20 20 20 20 20 20 20 20 23 20 20 to.. #
3050: 20 20 20 20 20 74 68 65 20 6d 61 63 68 69 6e 65 the machine
3060: 20 61 72 63 68 69 74 65 63 74 75 72 65 3b 20 6f architecture; o
3070: 74 68 65 72 77 69 73 65 2c 20 72 65 74 75 72 6e therwise, return
3080: 20 61 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 an empty string
3090: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
30a0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 65 78 return [ex
30b0: 70 72 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 pr {..
30c0: 24 6e 61 74 69 76 65 20 3f 20 5b 6d 61 63 68 69 $native ? [machi
30d0: 6e 65 54 6f 50 6c 61 74 66 6f 72 6d 20 24 3a 3a neToPlatform $::
30e0: 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 6d 61 63 tcl_platform(mac
30f0: 68 69 6e 65 29 5d 20 3a 20 22 22 0d 0a 20 20 20 hine)] : ""..
3100: 20 20 20 20 20 7d 5d 0d 0a 20 20 20 20 20 20 7d }].. }
3110: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
3120: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
3130: 54 45 3a 20 4e 6f 20 6d 61 63 68 69 6e 65 20 61 TE: No machine a
3140: 72 63 68 69 74 65 63 74 75 72 65 20 69 73 20 61 rchitecture is a
3150: 76 61 69 6c 61 62 6c 65 2c 20 72 65 74 75 72 6e vailable, return
3160: 20 61 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 an empty string
3170: 2e 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 ... #
3180: 20 20 20 49 74 20 69 73 20 69 6d 70 6f 72 74 61 It is importa
3190: 6e 74 20 74 6f 20 72 65 74 75 72 6e 20 61 6e 20 nt to return an
31a0: 65 6d 70 74 79 20 73 74 72 69 6e 67 20 68 65 72 empty string her
31b0: 65 20 62 65 63 61 75 73 65 20 74 68 65 0d 0a 20 e because the..
31c0: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 # r
31d0: 65 73 75 6c 74 20 6f 66 20 74 68 69 73 20 70 72 esult of this pr
31e0: 6f 63 65 64 75 72 65 20 6d 61 79 20 62 65 20 75 ocedure may be u
31f0: 73 65 64 20 77 69 74 68 20 5b 66 69 6c 65 20 6a sed with [file j
3200: 6f 69 6e 5d 2e 0d 0a 20 20 20 20 20 20 20 20 23 oin]... #
3210: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
3220: 20 22 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 "".. }..
3230: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
3240: 20 67 65 74 42 75 69 6c 64 43 6f 6e 66 69 67 75 getBuildConfigu
3250: 72 61 74 69 6f 6e 20 7b 7d 20 7b 0d 0a 20 20 20 ration {} {..
3260: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
3270: 54 45 3a 20 53 65 65 20 69 66 20 74 68 65 20 22 TE: See if the "
3280: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 22 20 73 configuration" s
3290: 65 74 74 69 6e 67 20 68 61 73 20 62 65 65 6e 20 etting has been
32a0: 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 overridden by th
32b0: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
32c0: 20 75 73 65 72 20 28 65 2e 67 2e 20 6f 6e 20 74 user (e.g. on t
32d0: 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 29 he command line)
32e0: 2e 20 20 54 68 69 73 20 68 65 6c 70 73 20 63 6f . This helps co
32f0: 6e 74 72 6f 6c 20 65 78 61 63 74 6c 79 0d 0a 20 ntrol exactly..
3300: 20 20 20 20 20 23 20 20 20 20 20 20 20 77 68 69 # whi
3310: 63 68 20 73 65 74 20 6f 66 20 62 69 6e 61 72 69 ch set of binari
3320: 65 73 20 77 65 20 61 72 65 20 74 65 73 74 69 6e es we are testin
3330: 67 20 28 69 2e 65 2e 20 74 68 6f 73 65 20 62 75 g (i.e. those bu
3340: 69 6c 74 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 ilt in the..
3350: 20 20 23 20 20 20 20 20 20 20 22 44 65 62 75 67 # "Debug
3360: 22 20 6f 72 20 22 52 65 6c 65 61 73 65 22 20 62 " or "Release" b
3370: 75 69 6c 64 20 63 6f 6e 66 69 67 75 72 61 74 69 uild configurati
3380: 6f 6e 73 29 2e 20 20 54 6f 20 6f 76 65 72 72 69 ons). To overri
3390: 64 65 20 74 68 69 73 0d 0a 20 20 20 20 20 20 23 de this.. #
33a0: 20 20 20 20 20 20 20 76 61 6c 75 65 20 76 69 61 value via
33b0: 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e the command lin
33c0: 65 2c 20 65 6e 74 65 72 20 61 20 63 6f 6d 6d 61 e, enter a comma
33d0: 6e 64 20 73 69 6d 69 6c 61 72 20 74 6f 20 6f 6e nd similar to on
33e0: 65 20 6f 66 0d 0a 20 20 20 20 20 20 23 20 20 20 e of.. #
33f0: 20 20 20 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e the followin
3400: 67 20 28 61 6c 6c 20 6f 6e 20 6f 6e 65 20 6c 69 g (all on one li
3410: 6e 65 29 3a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ne):.. #..
3420: 20 20 20 20 20 23 20 20 20 20 20 20 20 45 61 67 # Eag
3430: 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 leShell.exe -any
3440: 49 6e 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 Initialize "set
3450: 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 test_configurati
3460: 6f 6e 20 44 65 62 75 67 22 0d 0a 20 20 20 20 20 on Debug"..
3470: 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 6c 65 # -file
3480: 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 .\path\to\all.e
3490: 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a 20 agle.. #..
34a0: 20 20 20 20 20 23 20 20 20 20 20 20 20 45 61 67 # Eag
34b0: 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d 61 6e 79 leShell.exe -any
34c0: 49 6e 69 74 69 61 6c 69 7a 65 20 22 73 65 74 20 Initialize "set
34d0: 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 test_configurati
34e0: 6f 6e 20 52 65 6c 65 61 73 65 22 0d 0a 20 20 20 on Release"..
34f0: 20 20 20 23 20 20 20 20 20 20 20 20 20 2d 66 69 # -fi
3500: 6c 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c le .\path\to\all
3510: 2e 65 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 0d .eagle.. #.
3520: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 45 . # E
3530: 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 20 2d 66 agleShell.exe -f
3540: 69 6c 65 20 2e 5c 70 61 74 68 5c 74 6f 5c 61 6c ile .\path\to\al
3550: 6c 2e 65 61 67 6c 65 20 2d 70 72 65 54 65 73 74 l.eagle -preTest
3560: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
3570: 20 20 22 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 "unset -nocomp
3580: 6c 61 69 6e 20 74 65 73 74 5f 63 6f 6e 66 69 67 lain test_config
3590: 75 72 61 74 69 6f 6e 22 0d 0a 20 20 20 20 20 20 uration"..
35a0: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e #.. if {[in
35b0: 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 65 73 74 fo exists ::test
35c0: 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5d 20 _configuration]
35d0: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
35e0: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
35f0: 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 ::test_configura
3600: 74 69 6f 6e 5d 20 3e 20 30 7d 20 74 68 65 6e 20 tion] > 0} then
3610: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
3620: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 # NOTE: Us
3630: 65 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 e the specified
3640: 74 65 73 74 20 63 6f 6e 66 69 67 75 72 61 74 69 test configurati
3650: 6f 6e 2e 20 20 54 68 65 20 64 65 66 61 75 6c 74 on. The default
3660: 20 76 61 6c 75 65 20 75 73 65 64 0d 0a 20 20 20 value used..
3670: 20 20 20 20 20 23 20 20 20 20 20 20 20 66 6f 72 # for
3680: 20 74 68 69 73 20 76 61 72 69 61 62 6c 65 20 69 this variable i
3690: 73 20 74 79 70 69 63 61 6c 6c 79 20 22 52 65 6c s typically "Rel
36a0: 65 61 73 65 22 2c 20 61 73 20 73 65 74 20 62 79 ease", as set by
36b0: 20 74 68 65 20 74 65 73 74 0d 0a 20 20 20 20 20 the test..
36c0: 20 20 20 23 20 20 20 20 20 20 20 73 75 69 74 65 # suite
36d0: 20 69 74 73 65 6c 66 2e 0d 0a 20 20 20 20 20 20 itself...
36e0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
36f0: 75 72 6e 20 24 3a 3a 74 65 73 74 5f 63 6f 6e 66 urn $::test_conf
3700: 69 67 75 72 61 74 69 6f 6e 0d 0a 20 20 20 20 20 iguration..
3710: 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
3720: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
3730: 4e 4f 54 45 3a 20 4e 6f 72 6d 61 6c 6c 79 2c 20 NOTE: Normally,
3740: 77 65 20 77 69 6c 6c 20 6e 65 76 65 72 20 68 69 we will never hi
3750: 74 20 74 68 69 73 20 63 61 73 65 20 62 65 63 61 t this case beca
3760: 75 73 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 use the value of
3770: 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 the.. #
3780: 20 20 20 20 20 20 74 65 73 74 20 63 6f 6e 66 69 test confi
3790: 67 75 72 61 74 69 6f 6e 20 76 61 72 69 61 62 6c guration variabl
37a0: 65 20 69 73 20 61 6c 77 61 79 73 20 73 65 74 20 e is always set
37b0: 62 79 20 74 68 65 20 74 65 73 74 20 73 75 69 74 by the test suit
37c0: 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
37d0: 20 20 20 69 74 73 65 6c 66 3b 20 68 6f 77 65 76 itself; howev
37e0: 65 72 2c 20 69 74 20 63 61 6e 20 62 65 20 6f 76 er, it can be ov
37f0: 65 72 72 69 64 64 65 6e 20 75 73 69 6e 67 20 74 erridden using t
3800: 68 65 20 75 6e 73 65 74 20 63 6f 6d 6d 61 6e 64 he unset command
3810: 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
3820: 20 20 66 72 6f 6d 20 74 68 65 20 2d 70 72 65 54 from the -preT
3830: 65 73 74 20 6f 70 74 69 6f 6e 20 74 6f 20 74 68 est option to th
3840: 65 20 74 65 73 74 20 73 75 69 74 65 2e 0d 0a 20 e test suite...
3850: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
3860: 20 20 72 65 74 75 72 6e 20 24 3a 3a 65 61 67 6c return $::eagl
3870: 65 5f 70 6c 61 74 66 6f 72 6d 28 63 6f 6e 66 69 e_platform(confi
3880: 67 75 72 61 74 69 6f 6e 29 0d 0a 20 20 20 20 20 guration)..
3890: 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
38a0: 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c 64 43 proc getBuildC
38b0: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 53 75 66 66 onfigurationSuff
38c0: 69 78 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ix {} {.. #
38d0: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
38e0: 53 65 65 20 69 66 20 74 68 65 20 74 65 73 74 20 See if the test
38f0: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 73 75 configuration su
3900: 66 66 69 78 20 68 61 73 20 62 65 65 6e 20 6f 76 ffix has been ov
3910: 65 72 72 69 64 64 65 6e 20 62 79 0d 0a 20 20 20 erridden by..
3920: 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 75 # the u
3930: 73 65 72 20 28 65 2e 67 2e 20 6f 6e 20 74 68 65 ser (e.g. on the
3940: 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 29 2e 0d command line)..
3950: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
3960: 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
3970: 20 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 ::test_configur
3980: 61 74 69 6f 6e 5f 73 75 66 66 69 78 5d 20 26 26 ation_suffix] &&
3990: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 \.. [s
39a0: 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a tring length $::
39b0: 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 test_configurati
39c0: 6f 6e 5f 73 75 66 66 69 78 5d 20 3e 20 30 7d 20 on_suffix] > 0}
39d0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
39e0: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
39f0: 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 69 E: Use the speci
3a00: 66 69 65 64 20 74 65 73 74 20 63 6f 6e 66 69 67 fied test config
3a10: 75 72 61 74 69 6f 6e 20 73 75 66 66 69 78 2e 0d uration suffix..
3a20: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
3a30: 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 74 65 return $::te
3a40: 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e st_configuration
3a50: 5f 73 75 66 66 69 78 0d 0a 20 20 20 20 20 20 7d _suffix.. }
3a60: 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
3a70: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
3a80: 54 45 3a 20 55 73 65 20 74 68 65 20 64 65 66 61 TE: Use the defa
3a90: 75 6c 74 20 74 65 73 74 20 63 6f 6e 66 69 67 75 ult test configu
3aa0: 72 61 74 69 6f 6e 20 73 75 66 66 69 78 2c 20 77 ration suffix, w
3ab0: 68 69 63 68 20 73 68 6f 75 6c 64 20 62 65 0d 0a hich should be..
3ac0: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
3ad0: 61 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2e an empty string.
3ae0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
3af0: 20 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a return ""..
3b00: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
3b10: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 ... proc getB
3b20: 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 74 69 6f uildConfiguratio
3b30: 6e 73 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ns {} {.. #
3b40: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
3b50: 53 65 65 20 69 66 20 74 68 65 20 6c 69 73 74 20 See if the list
3b60: 6f 66 20 74 65 73 74 20 63 6f 6e 66 69 67 75 72 of test configur
3b70: 61 74 69 6f 6e 73 20 68 61 73 20 62 65 65 6e 20 ations has been
3b80: 6f 76 65 72 72 69 64 64 65 6e 20 62 79 0d 0a 20 overridden by..
3b90: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 # the
3ba0: 20 75 73 65 72 20 28 65 2e 67 2e 20 6f 6e 20 74 user (e.g. on t
3bb0: 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 29 he command line)
3bc0: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
3bd0: 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
3be0: 74 73 20 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 67 ts ::test_config
3bf0: 75 72 61 74 69 6f 6e 73 5d 20 26 26 20 5c 0d 0a urations] && \..
3c00: 20 20 20 20 20 20 20 20 20 20 5b 6c 6c 65 6e 67 [lleng
3c10: 74 68 20 24 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 th $::test_confi
3c20: 67 75 72 61 74 69 6f 6e 73 5d 20 3e 20 30 7d 20 gurations] > 0}
3c30: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
3c40: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
3c50: 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 69 E: Use the speci
3c60: 66 69 65 64 20 6c 69 73 74 20 6f 66 20 74 65 73 fied list of tes
3c70: 74 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 73 t configurations
3c80: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
3c90: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
3ca0: 74 65 73 74 5f 63 6f 6e 66 69 67 75 72 61 74 69 test_configurati
3cb0: 6f 6e 73 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 ons.. } els
3cc0: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a e {.. #..
3cd0: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
3ce0: 55 73 65 20 74 68 65 20 64 65 66 61 75 6c 74 20 Use the default
3cf0: 6c 69 73 74 20 6f 66 20 74 65 73 74 20 63 6f 6e list of test con
3d00: 66 69 67 75 72 61 74 69 6f 6e 73 2e 0d 0a 20 20 figurations...
3d10: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
3d20: 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 44 65 return [list De
3d30: 62 75 67 20 52 65 6c 65 61 73 65 5d 0d 0a 20 20 bug Release]..
3d40: 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
3d50: 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 75 69 . proc getBui
3d60: 6c 64 45 78 74 72 61 20 7b 7d 20 7b 0d 0a 20 20 ldExtra {} {..
3d70: 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
3d80: 69 73 74 73 20 3a 3a 74 65 73 74 5f 65 78 74 72 ists ::test_extr
3d90: 61 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 a] && \..
3da0: 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 [string lengt
3db0: 68 20 24 3a 3a 74 65 73 74 5f 65 78 74 72 61 5d h $::test_extra]
3dc0: 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
3dd0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
3de0: 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 68 65 # NOTE: Use the
3df0: 20 73 70 65 63 69 66 69 65 64 20 65 78 74 72 61 specified extra
3e00: 20 6f 75 74 70 75 74 20 64 69 72 65 63 74 6f 72 output director
3e10: 79 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 y... #..
3e20: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a return $:
3e30: 3a 74 65 73 74 5f 65 78 74 72 61 0d 0a 20 20 20 :test_extra..
3e40: 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 73 } elseif {[is
3e50: 44 6f 74 4e 65 74 43 6f 72 65 5d 7d 20 74 68 65 DotNetCore]} the
3e60: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
3e70: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
3e80: 52 75 6e 6e 69 6e 67 20 6f 6e 20 2e 4e 45 54 20 Running on .NET
3e90: 43 6f 72 65 2c 20 75 73 65 20 74 68 65 20 65 78 Core, use the ex
3ea0: 74 72 61 20 6f 75 74 70 75 74 20 64 69 72 65 63 tra output direc
3eb0: 74 6f 72 79 20 66 6f 72 0d 0a 20 20 20 20 20 20 tory for..
3ec0: 20 20 23 20 20 20 20 20 20 20 6c 69 62 72 61 72 # librar
3ed0: 79 20 66 69 6c 65 73 2e 0d 0a 20 20 20 20 20 20 y files...
3ee0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
3ef0: 75 72 6e 20 6e 65 74 73 74 61 6e 64 61 72 64 32 urn netstandard2
3f00: 2e 30 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 .0.. } else
3f10: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
3f20: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4e # NOTE: N
3f30: 6f 20 65 78 74 72 61 20 6f 75 74 70 75 74 20 64 o extra output d
3f40: 69 72 65 63 74 6f 72 79 20 69 73 20 72 65 71 75 irectory is requ
3f50: 69 72 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 ired... #
3f60: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
3f70: 20 22 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 "".. }..
3f80: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
3f90: 20 67 65 74 42 75 69 6c 64 45 78 74 72 61 73 20 getBuildExtras
3fa0: 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 {} {.. #..
3fb0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 65 65 # NOTE: See
3fc0: 20 69 66 20 74 68 65 20 6c 69 73 74 20 6f 66 20 if the list of
3fd0: 65 78 74 72 61 20 6f 75 74 70 75 74 20 64 69 72 extra output dir
3fe0: 65 63 74 6f 72 69 65 73 20 68 61 73 20 62 65 65 ectories has bee
3ff0: 6e 20 6f 76 65 72 72 69 64 64 65 6e 0d 0a 20 20 n overridden..
4000: 20 20 20 20 23 20 20 20 20 20 20 20 62 79 20 74 # by t
4010: 68 65 20 75 73 65 72 20 28 65 2e 67 2e 20 6f 6e he user (e.g. on
4020: 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e the command lin
4030: 65 29 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 e)... #..
4040: 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
4050: 69 73 74 73 20 3a 3a 74 65 73 74 5f 65 78 74 72 ists ::test_extr
4060: 61 73 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 as] && \..
4070: 20 20 20 20 5b 6c 6c 65 6e 67 74 68 20 24 3a 3a [llength $::
4080: 74 65 73 74 5f 65 78 74 72 61 73 5d 20 3e 20 30 test_extras] > 0
4090: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
40a0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
40b0: 4f 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 OTE: Use the spe
40c0: 63 69 66 69 65 64 20 6c 69 73 74 20 6f 66 20 65 cified list of e
40d0: 78 74 72 61 20 6f 75 74 70 75 74 20 64 69 72 65 xtra output dire
40e0: 63 74 6f 72 69 65 73 2e 0d 0a 20 20 20 20 20 20 ctories...
40f0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
4100: 75 72 6e 20 24 3a 3a 74 65 73 74 5f 65 78 74 72 urn $::test_extr
4110: 61 73 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 as.. } else
4120: 69 66 20 7b 5b 69 73 44 6f 74 4e 65 74 43 6f 72 if {[isDotNetCor
4130: 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
4140: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
4150: 20 4e 4f 54 45 3a 20 52 75 6e 6e 69 6e 67 20 6f NOTE: Running o
4160: 6e 20 2e 4e 45 54 20 43 6f 72 65 2c 20 70 72 69 n .NET Core, pri
4170: 6f 72 69 74 69 7a 65 20 69 74 73 20 65 78 74 72 oritize its extr
4180: 61 20 6f 75 74 70 75 74 20 64 69 72 65 63 74 6f a output directo
4190: 72 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ry.. #
41a0: 20 20 20 20 66 6f 72 20 6c 69 62 72 61 72 79 20 for library
41b0: 66 69 6c 65 73 2e 0d 0a 20 20 20 20 20 20 20 20 files...
41c0: 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 #.. retur
41d0: 6e 20 5b 6c 69 73 74 20 6e 65 74 73 74 61 6e 64 n [list netstand
41e0: 61 72 64 32 2e 30 20 22 22 5d 0d 0a 20 20 20 20 ard2.0 ""]..
41f0: 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
4200: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
4210: 20 4e 4f 54 45 3a 20 55 73 65 20 64 65 66 61 75 NOTE: Use defau
4220: 6c 74 20 6c 69 73 74 20 6f 66 20 65 78 74 72 61 lt list of extra
4230: 20 6f 75 74 70 75 74 20 64 69 72 65 63 74 6f 72 output director
4240: 69 65 73 2c 20 77 68 69 63 68 20 69 73 20 6f 6e ies, which is on
4250: 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
4260: 20 20 20 65 6d 70 74 79 20 73 74 72 69 6e 67 20 empty string
4270: 28 6e 6f 2d 6f 70 29 2e 0d 0a 20 20 20 20 20 20 (no-op)...
4280: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
4290: 75 72 6e 20 5b 6c 69 73 74 20 22 22 5d 0d 0a 20 urn [list ""]..
42a0: 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c }.. }...
42b0: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 75 .. proc getBu
42c0: 69 6c 64 42 61 73 65 44 69 72 65 63 74 6f 72 79 ildBaseDirectory
42d0: 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a {} {.. #..
42e0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 # NOTE: Fi
42f0: 67 75 72 65 20 6f 75 74 20 74 68 65 20 62 61 73 gure out the bas
4300: 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 e directory wher
4310: 65 20 61 6c 6c 20 74 68 65 20 62 75 69 6c 64 73 e all the builds
4320: 20 73 68 6f 75 6c 64 20 62 65 0d 0a 20 20 20 20 should be..
4330: 20 20 23 20 20 20 20 20 20 20 6c 6f 63 61 74 65 # locate
4340: 64 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 62 65 d. This will be
4350: 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 74 the directory t
4360: 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 hat contains the
4370: 20 61 63 74 75 61 6c 0d 0a 20 20 20 20 20 20 23 actual.. #
4380: 20 20 20 20 20 20 20 62 75 69 6c 64 20 6f 75 74 build out
4390: 70 75 74 20 64 69 72 65 63 74 6f 72 79 20 28 65 put directory (e
43a0: 2e 67 2e 20 70 61 72 65 6e 74 20 6f 66 20 22 62 .g. parent of "b
43b0: 69 6e 22 29 2e 0d 0a 20 20 20 20 20 20 23 0d 0a in")... #..
43c0: 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 if {[info
43d0: 65 78 69 73 74 73 20 3a 3a 62 75 69 6c 64 5f 62 exists ::build_b
43e0: 61 73 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 ase_directory] &
43f0: 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b & \.. [
4400: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a string length $:
4410: 3a 62 75 69 6c 64 5f 62 61 73 65 5f 64 69 72 65 :build_base_dire
4420: 63 74 6f 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e ctory] > 0} then
4430: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
4440: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 # NOTE: T
4450: 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 he location of t
4460: 68 65 20 62 75 69 6c 64 20 62 61 73 65 20 64 69 he build base di
4470: 72 65 63 74 6f 72 79 20 68 61 73 20 62 65 65 6e rectory has been
4480: 20 6f 76 65 72 72 69 64 64 65 6e 3b 0d 0a 20 20 overridden;..
4490: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 # th
44a0: 65 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 20 erefore, use it
44b0: 76 65 72 62 61 74 69 6d 2e 0d 0a 20 20 20 20 20 verbatim...
44c0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 #.. re
44d0: 74 75 72 6e 20 24 3a 3a 62 75 69 6c 64 5f 62 61 turn $::build_ba
44e0: 73 65 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 se_directory..
44f0: 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 } elseif {[i
4500: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 63 6f 6d nfo exists ::com
4510: 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 79 5d 20 26 mon_directory] &
4520: 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b & \.. [
4530: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a string length $:
4540: 3a 63 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 6f 72 :common_director
4550: 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a y] > 0} then {..
4560: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
4570: 20 20 20 23 20 4e 4f 54 45 3a 20 4e 65 78 74 2c # NOTE: Next,
4580: 20 66 61 6c 6c 62 61 63 6b 20 74 6f 20 74 68 65 fallback to the
4590: 20 67 72 61 6e 64 70 61 72 65 6e 74 20 64 69 72 grandparent dir
45a0: 65 63 74 6f 72 79 20 6f 66 20 74 68 65 20 6f 6e ectory of the on
45b0: 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 e.. #
45c0: 20 20 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 containing th
45d0: 69 73 20 66 69 6c 65 20 28 69 2e 65 2e 20 22 63 is file (i.e. "c
45e0: 6f 6d 6d 6f 6e 2e 65 61 67 6c 65 22 29 2c 20 69 ommon.eagle"), i
45f0: 66 20 61 76 61 69 6c 61 62 6c 65 2e 0d 0a 20 20 f available...
4600: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
4610: 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 64 69 return [file di
4620: 72 6e 61 6d 65 20 5b 66 69 6c 65 20 64 69 72 6e rname [file dirn
4630: 61 6d 65 20 24 3a 3a 63 6f 6d 6d 6f 6e 5f 64 69 ame $::common_di
4640: 72 65 63 74 6f 72 79 5d 5d 0d 0a 20 20 20 20 20 rectory]]..
4650: 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 6f } elseif {[info
4660: 20 65 78 69 73 74 73 20 3a 3a 70 61 74 68 5d 20 exists ::path]
4670: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
4680: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
4690: 3a 3a 70 61 74 68 5d 20 3e 20 30 7d 20 74 68 65 ::path] > 0} the
46a0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
46b0: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
46c0: 46 69 6e 61 6c 6c 79 2c 20 66 61 6c 6c 62 61 63 Finally, fallbac
46d0: 6b 20 74 6f 20 74 68 65 20 70 61 72 65 6e 74 20 k to the parent
46e0: 64 69 72 65 63 74 6f 72 79 20 6f 66 20 74 68 65 directory of the
46f0: 20 45 61 67 6c 65 54 65 73 74 0d 0a 20 20 20 20 EagleTest..
4700: 20 20 20 20 23 20 20 20 20 20 20 20 70 61 74 68 # path
4710: 2e 20 20 54 68 65 20 45 61 67 6c 65 54 65 73 74 . The EagleTest
4720: 20 70 61 63 6b 61 67 65 20 67 75 61 72 61 6e 74 package guarant
4730: 65 65 73 20 74 68 61 74 20 74 68 69 73 20 76 61 ees that this va
4740: 72 69 61 62 6c 65 0d 0a 20 20 20 20 20 20 20 20 riable..
4750: 23 20 20 20 20 20 20 20 77 69 6c 6c 20 62 65 20 # will be
4760: 73 65 74 20 74 6f 20 74 68 65 20 64 69 72 65 63 set to the direc
4770: 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e 67 20 tory containing
4780: 74 68 65 20 66 69 72 73 74 20 66 69 6c 65 20 74 the first file t
4790: 6f 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 o.. #
47a0: 20 20 20 65 78 65 63 75 74 65 20 74 68 65 20 5b execute the [
47b0: 72 75 6e 54 65 73 74 50 72 6f 6c 6f 67 75 65 5d runTestPrologue]
47c0: 20 73 63 72 69 70 74 20 6c 69 62 72 61 72 79 20 script library
47d0: 70 72 6f 63 65 64 75 72 65 2e 0d 0a 20 20 20 20 procedure...
47e0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
47f0: 65 74 75 72 6e 20 5b 66 69 6c 65 20 64 69 72 6e eturn [file dirn
4800: 61 6d 65 20 24 3a 3a 70 61 74 68 5d 0d 0a 20 20 ame $::path]..
4810: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
4820: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
4830: 20 23 20 4e 4f 54 45 3a 20 4e 6f 20 70 61 74 68 # NOTE: No path
4840: 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2c 20 72 is available, r
4850: 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 73 eturn an empty s
4860: 74 72 69 6e 67 2e 20 20 54 68 69 73 20 70 6f 69 tring. This poi
4870: 6e 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 nt.. #
4880: 20 20 20 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 should not b
4890: 65 20 72 65 61 63 68 65 64 2e 0d 0a 20 20 20 20 e reached...
48a0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
48b0: 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 20 20 eturn ""..
48c0: 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
48d0: 20 70 72 6f 63 20 67 65 74 53 51 4c 69 74 65 54 proc getSQLiteT
48e0: 65 73 74 44 61 74 61 50 61 74 68 20 7b 7d 20 7b estDataPath {} {
48f0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
4900: 20 23 20 4e 4f 54 45 3a 20 46 69 67 75 72 65 20 # NOTE: Figure
4910: 6f 75 74 20 74 68 65 20 64 69 72 65 63 74 6f 72 out the director
4920: 79 20 77 68 65 72 65 20 61 6c 6c 20 74 68 65 20 y where all the
4930: 74 65 73 74 20 64 61 74 61 20 66 69 6c 65 73 20 test data files
4940: 73 68 6f 75 6c 64 0d 0a 20 20 20 20 20 20 23 20 should.. #
4950: 20 20 20 20 20 20 62 65 20 6c 6f 63 61 74 65 64 be located
4960: 2e 20 20 54 68 69 73 20 73 68 6f 75 6c 64 20 62 . This should b
4970: 65 20 74 68 65 20 22 64 61 74 61 22 20 64 69 72 e the "data" dir
4980: 65 63 74 6f 72 79 20 62 65 6e 65 61 74 68 20 74 ectory beneath t
4990: 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 he.. #
49a0: 20 20 64 69 72 65 63 74 6f 72 79 20 63 6f 6e 74 directory cont
49b0: 61 69 6e 69 6e 67 20 74 68 65 20 61 63 74 75 61 aining the actua
49c0: 6c 20 74 65 73 74 20 73 63 72 69 70 74 73 2e 0d l test scripts..
49d0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
49e0: 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 6a 6f 69 return [file joi
49f0: 6e 20 24 3a 3a 70 61 74 68 20 64 61 74 61 5d 0d n $::path data].
4a00: 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
4a10: 72 6f 63 20 69 73 52 75 6e 6e 69 6e 67 57 6f 57 roc isRunningWoW
4a20: 36 34 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 64 {} {.. #
4a30: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
4a40: 46 6f 72 20 6e 6f 77 2c 20 6a 75 73 74 20 75 73 For now, just us
4a50: 65 20 74 68 65 20 65 78 69 73 74 69 6e 67 20 74 e the existing t
4a60: 65 73 74 20 63 6f 6e 73 74 72 61 69 6e 74 20 66 est constraint f
4a70: 6f 72 20 64 65 74 65 63 74 69 6e 67 0d 0a 20 20 or detecting..
4a80: 20 20 20 20 23 20 20 20 20 20 20 20 61 20 57 6f # a Wo
4a90: 57 36 34 20 70 72 6f 63 65 73 73 2e 0d 0a 20 20 W64 process...
4aa0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 #.. ret
4ab0: 75 72 6e 20 5b 68 61 76 65 43 6f 6e 73 74 72 61 urn [haveConstra
4ac0: 69 6e 74 20 77 6f 77 36 34 5d 0d 0a 20 20 20 20 int wow64]..
4ad0: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 69 }..... proc i
4ae0: 73 4d 69 78 65 64 4d 6f 64 65 41 73 73 65 6d 62 sMixedModeAssemb
4af0: 6c 79 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7b 76 ly { fileName {v
4b00: 61 72 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d 0a arName ""} } {..
4b10: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
4b20: 20 4e 4f 54 45 3a 20 46 69 72 73 74 2c 20 6d 61 NOTE: First, ma
4b30: 6b 65 20 73 75 72 65 20 74 68 65 20 74 65 73 74 ke sure the test
4b40: 20 73 75 69 74 65 20 69 6e 66 72 61 73 74 72 75 suite infrastru
4b50: 63 74 75 72 65 20 69 73 20 61 6c 6c 6f 77 65 64 cture is allowed
4b60: 20 74 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 20 to.. #
4b70: 20 20 20 75 73 65 20 74 68 65 20 5b 65 78 65 63 use the [exec
4b80: 5d 20 63 6f 6d 6d 61 6e 64 2e 0d 0a 20 20 20 20 ] command...
4b90: 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
4ba0: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
4bb0: 6f 28 65 78 65 63 29 5d 20 26 26 20 21 5b 69 6e o(exec)] && ![in
4bc0: 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 fo exists ::no(c
4bd0: 6f 72 46 6c 61 67 73 29 5d 7d 20 74 68 65 6e 20 orFlags)]} then
4be0: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
4bf0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 # NOTE: If
4c00: 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 the location of
4c10: 20 43 6f 72 46 6c 61 67 73 20 69 73 20 70 72 65 CorFlags is pre
4c20: 73 65 6e 74 20 69 6e 20 74 68 65 20 65 6e 76 69 sent in the envi
4c30: 72 6f 6e 6d 65 6e 74 2c 0d 0a 20 20 20 20 20 20 ronment,..
4c40: 20 20 23 20 20 20 20 20 20 20 75 73 65 20 69 74 # use it
4c50: 3b 20 6f 74 68 65 72 77 69 73 65 20 61 73 73 75 ; otherwise assu
4c60: 6d 65 20 69 74 20 69 73 20 69 6e 20 74 68 65 20 me it is in the
4c70: 50 41 54 48 2e 0d 0a 20 20 20 20 20 20 20 20 23 PATH... #
4c80: 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 63 6f .. set co
4c90: 72 46 6c 61 67 73 20 5b 65 78 70 72 20 7b 0d 0a rFlags [expr {..
4ca0: 20 20 20 20 20 20 20 20 20 20 5b 69 6e 66 6f 20 [info
4cb0: 65 78 69 73 74 73 20 3a 3a 65 6e 76 28 43 6f 72 exists ::env(Cor
4cc0: 46 6c 61 67 73 29 5d 20 3f 20 24 3a 3a 65 6e 76 Flags)] ? $::env
4cd0: 28 43 6f 72 46 6c 61 67 73 29 20 3a 20 22 43 6f (CorFlags) : "Co
4ce0: 72 46 6c 61 67 73 22 0d 0a 20 20 20 20 20 20 20 rFlags"..
4cf0: 20 7d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 }].... #
4d00: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
4d10: 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 65 78 65 : Attempt to exe
4d20: 63 75 74 65 20 43 6f 72 46 6c 61 67 73 20 6f 6e cute CorFlags on
4d30: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 66 the specified f
4d40: 69 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ile... #.
4d50: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 . if {[ca
4d60: 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
4d70: 20 65 78 65 63 20 2d 2d 20 24 63 6f 72 46 6c 61 exec -- $corFla
4d80: 67 73 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e gs [file nativen
4d90: 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a ame $fileName]..
4da0: 20 20 20 20 20 20 20 20 7d 20 65 78 65 63 5d 20 } exec]
4db0: 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
4dc0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
4dd0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 # NOTE: If
4de0: 72 65 71 75 65 73 74 65 64 20 62 79 20 6f 75 72 requested by our
4df0: 20 63 61 6c 6c 65 72 2c 20 61 74 74 65 6d 70 74 caller, attempt
4e00: 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68 to determine th
4e10: 65 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 e.. #
4e20: 20 20 20 20 20 70 6c 61 74 66 6f 72 6d 20 66 6f platform fo
4e30: 72 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 r the specified
4e40: 66 69 6c 65 20 61 73 20 77 65 6c 6c 2e 0d 0a 20 file as well...
4e50: 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
4e60: 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
4e70: 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 6d g length $varNam
4e80: 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a e] > 0} then {..
4e90: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
4ea0: 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 # NOT
4eb0: 45 3a 20 53 74 6f 72 65 20 74 68 65 20 70 6c 61 E: Store the pla
4ec0: 74 66 6f 72 6d 20 69 6e 20 74 68 65 20 6e 61 6d tform in the nam
4ed0: 65 64 20 76 61 72 69 61 62 6c 65 20 69 6e 20 74 ed variable in t
4ee0: 68 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 he..
4ef0: 23 20 20 20 20 20 20 20 63 6f 6e 74 65 78 74 20 # context
4f00: 6f 66 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d 0a of our caller...
4f10: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
4f20: 20 20 20 20 20 20 20 20 20 20 20 75 70 76 61 72 upvar
4f30: 20 31 20 24 76 61 72 4e 61 6d 65 20 70 6c 61 74 1 $varName plat
4f40: 66 6f 72 6d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 form....
4f50: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
4f60: 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d # NOTE: Attem
4f70: 70 74 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 pt to extract th
4f80: 65 20 50 45 20 6c 69 6e 65 20 66 72 6f 6d 20 74 e PE line from t
4f90: 68 65 20 63 61 70 74 75 72 65 64 0d 0a 20 20 20 he captured..
4fa0: 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
4fb0: 20 6f 75 74 70 75 74 2e 20 20 49 66 20 74 68 69 output. If thi
4fc0: 73 20 76 61 6c 75 65 20 69 73 20 22 50 45 33 32 s value is "PE32
4fd0: 22 20 6f 72 20 22 50 45 33 32 2b 22 2c 20 74 68 " or "PE32+", th
4fe0: 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 e.. #
4ff0: 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c 79 20 assembly
5000: 66 69 6c 65 20 69 73 20 33 32 2d 62 69 74 20 6f file is 32-bit o
5010: 72 20 36 34 2d 62 69 74 2c 20 72 65 73 70 65 63 r 64-bit, respec
5020: 74 69 76 65 6c 79 3b 0d 0a 20 20 20 20 20 20 20 tively;..
5030: 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 74 68 # oth
5040: 65 72 77 69 73 65 2c 20 69 74 73 20 74 79 70 65 erwise, its type
5050: 20 69 73 20 75 6e 6b 6e 6f 77 6e 2e 0d 0a 20 20 is unknown...
5060: 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
5070: 20 20 20 20 20 20 20 20 20 73 65 74 20 70 61 74 set pat
5080: 74 65 72 6e 20 7b 5e 50 45 20 20 20 20 20 20 20 tern {^PE
5090: 20 3a 20 28 50 45 33 32 7c 50 45 33 32 5c 2b 29 : (PE32|PE32\+)
50a0: 5c 73 2b 24 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 \s+$}....
50b0: 20 20 20 20 20 69 66 20 7b 5b 72 65 67 65 78 70 if {[regexp
50c0: 20 2d 6c 69 6e 65 20 2d 2d 20 24 70 61 74 74 65 -line -- $patte
50d0: 72 6e 20 24 65 78 65 63 20 64 75 6d 6d 79 20 70 rn $exec dummy p
50e0: 65 33 32 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 e32]} then {..
50f0: 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
5100: 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 48 # H
5110: 41 43 4b 3a 20 54 68 69 73 20 5b 73 77 69 74 63 ACK: This [switc
5120: 68 5d 20 61 73 73 75 6d 65 73 20 74 68 61 74 20 h] assumes that
5130: 33 32 2d 62 69 74 20 65 78 65 63 75 74 61 62 6c 32-bit executabl
5140: 65 73 20 61 72 65 0d 0a 20 20 20 20 20 20 20 20 es are..
5150: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 6c # al
5160: 77 61 79 73 20 78 38 36 20 61 6e 64 20 74 68 61 ways x86 and tha
5170: 74 20 36 34 2d 62 69 74 20 65 78 65 63 75 74 61 t 64-bit executa
5180: 62 6c 65 73 20 61 72 65 20 61 6c 77 61 79 73 0d bles are always.
5190: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
51a0: 20 20 20 20 20 20 20 78 36 34 2e 0d 0a 20 20 20 x64...
51b0: 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
51c0: 20 20 20 20 20 20 20 20 20 20 20 20 73 77 69 74 swit
51d0: 63 68 20 2d 65 78 61 63 74 20 2d 2d 20 24 70 65 ch -exact -- $pe
51e0: 33 32 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 32 {..
51f0: 20 20 20 20 20 20 50 45 33 32 20 7b 0d 0a 20 20 PE32 {..
5200: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5210: 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 57 69 6e set platform Win
5220: 33 32 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 32..
5230: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
5240: 20 20 20 20 20 20 20 50 45 33 32 2b 20 7b 0d 0a PE32+ {..
5250: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
5260: 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 78 set platform x
5270: 36 34 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 64..
5280: 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
5290: 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 20 7b default {
52a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
52b0: 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d set platform
52c0: 20 22 22 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ""..
52d0: 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
52e0: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
52f0: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
5300: 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 set
5310: 20 70 6c 61 74 66 6f 72 6d 20 22 22 0d 0a 20 20 platform ""..
5320: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
5330: 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
5340: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
5350: 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d # NOTE: Attem
5360: 70 74 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 pt to extract th
5370: 65 20 49 4c 4f 4e 4c 59 20 6c 69 6e 65 20 66 72 e ILONLY line fr
5380: 6f 6d 20 74 68 65 20 63 61 70 74 75 72 65 64 0d om the captured.
5390: 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
53a0: 20 20 20 6f 75 74 70 75 74 2e 20 20 49 66 20 74 output. If t
53b0: 68 69 73 20 76 61 6c 75 65 20 69 73 20 7a 65 72 his value is zer
53c0: 6f 2c 20 74 68 65 20 73 70 65 63 69 66 69 65 64 o, the specified
53d0: 20 66 69 6c 65 20 6d 75 73 74 0d 0a 20 20 20 20 file must..
53e0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 65 # be
53f0: 20 61 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 a mixed-mode as
5400: 73 65 6d 62 6c 79 3b 20 6f 74 68 65 72 77 69 73 sembly; otherwis
5410: 65 2c 20 69 74 20 63 6f 6e 74 61 69 6e 73 20 6f e, it contains o
5420: 6e 6c 79 0d 0a 20 20 20 20 20 20 20 20 20 20 23 nly.. #
5430: 20 20 20 20 20 20 20 6d 61 6e 61 67 65 64 20 63 managed c
5440: 6f 6d 70 6f 6e 65 6e 74 73 2e 0d 0a 20 20 20 20 omponents...
5450: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
5460: 20 20 20 73 65 74 20 70 61 74 74 65 72 6e 20 7b set pattern {
5470: 5e 49 4c 4f 4e 4c 59 20 20 20 20 3a 20 28 30 7c ^ILONLY : (0|
5480: 31 29 5c 73 2b 24 7d 0d 0a 0d 0a 20 20 20 20 20 1)\s+$}....
5490: 20 20 20 20 20 69 66 20 7b 21 5b 72 65 67 65 78 if {![regex
54a0: 70 20 2d 6c 69 6e 65 20 2d 2d 20 24 70 61 74 74 p -line -- $patt
54b0: 65 72 6e 20 24 65 78 65 63 20 64 75 6d 6d 79 20 ern $exec dummy
54c0: 69 6c 4f 6e 6c 79 5d 7d 20 74 68 65 6e 20 7b 0d ilOnly]} then {.
54d0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 . ret
54e0: 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 urn false..
54f0: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
5500: 20 20 20 20 69 66 20 7b 21 24 69 6c 4f 6e 6c 79 if {!$ilOnly
5510: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
5520: 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
5530: 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a e.. }..
5540: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
5550: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 }.... #..
5560: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 # NOTE: If
5570: 74 68 65 20 74 65 73 74 20 73 75 69 74 65 20 63 the test suite c
5580: 61 6e 6e 6f 74 20 75 73 65 20 5b 65 78 65 63 5d annot use [exec]
5590: 20 6f 72 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 or execution of
55a0: 20 43 6f 72 46 6c 61 67 73 0d 0a 20 20 20 20 20 CorFlags..
55b0: 20 23 20 20 20 20 20 20 20 66 61 69 6c 65 64 2c # failed,
55c0: 20 72 65 74 75 72 6e 20 66 61 6c 73 65 2e 0d 0a return false...
55d0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 #.. r
55e0: 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 eturn false..
55f0: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
5600: 69 73 44 61 72 77 69 6e 20 7b 7d 20 7b 0d 0a 20 isDarwin {} {..
5610: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 65 78 70 return [exp
5620: 72 20 7b 0d 0a 20 20 20 20 20 20 20 20 5b 69 6e r {.. [in
5630: 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 63 6c 5f fo exists ::tcl_
5640: 70 6c 61 74 66 6f 72 6d 28 6f 73 29 5d 20 26 26 platform(os)] &&
5650: 20 24 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d $::tcl_platform
5660: 28 6f 73 29 20 65 71 20 22 44 61 72 77 69 6e 22 (os) eq "Darwin"
5670: 0d 0a 20 20 20 20 20 20 7d 5d 0d 0a 20 20 20 20 .. }]..
5680: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 }..... proc g
5690: 65 74 4e 61 74 69 76 65 4c 69 62 72 61 72 79 46 etNativeLibraryF
56a0: 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 20 7b 7d 20 ileNamesOnly {}
56b0: 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
56c0: 20 20 23 20 4e 4f 54 45 3a 20 46 69 72 73 74 2c # NOTE: First,
56d0: 20 63 68 65 63 6b 20 69 66 20 74 68 65 20 6c 69 check if the li
56e0: 73 74 20 6f 66 20 6e 61 74 69 76 65 20 6c 69 62 st of native lib
56f0: 72 61 72 79 20 66 69 6c 65 20 6e 61 6d 65 73 20 rary file names
5700: 68 61 73 20 62 65 65 6e 0d 0a 20 20 20 20 20 20 has been..
5710: 23 20 20 20 20 20 20 20 6d 61 6e 75 61 6c 6c 79 # manually
5720: 20 6f 76 65 72 72 69 64 64 65 6e 2e 0d 0a 20 20 overridden...
5730: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
5740: 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a {[info exists ::
5750: 6e 61 74 69 76 65 5f 6c 69 62 72 61 72 79 5f 66 native_library_f
5760: 69 6c 65 5f 6e 61 6d 65 73 5d 20 26 26 20 5c 0d ile_names] && \.
5770: 0a 20 20 20 20 20 20 20 20 20 20 5b 6c 6c 65 6e . [llen
5780: 67 74 68 20 24 3a 3a 6e 61 74 69 76 65 5f 6c 69 gth $::native_li
5790: 62 72 61 72 79 5f 66 69 6c 65 5f 6e 61 6d 65 73 brary_file_names
57a0: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
57b0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
57c0: 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 69 # NOTE: The li
57d0: 73 74 20 6f 66 20 6e 61 74 69 76 65 20 6c 69 62 st of native lib
57e0: 72 61 72 79 20 66 69 6c 65 20 6e 61 6d 65 73 20 rary file names
57f0: 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 has been overrid
5800: 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 den;.. #
5810: 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c therefore,
5820: 20 75 73 65 20 69 74 20 76 65 72 62 61 74 69 6d use it verbatim
5830: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
5840: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
5850: 6e 61 74 69 76 65 5f 6c 69 62 72 61 72 79 5f 66 native_library_f
5860: 69 6c 65 5f 6e 61 6d 65 73 0d 0a 20 20 20 20 20 ile_names..
5870: 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 73 57 69 } elseif {[isWi
5880: 6e 64 6f 77 73 5d 7d 20 74 68 65 6e 20 7b 0d 0a ndows]} then {..
5890: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
58a0: 20 20 20 23 20 4e 4f 54 45 3a 20 4f 74 68 65 72 # NOTE: Other
58b0: 77 69 73 65 2c 20 6f 6e 20 57 69 6e 33 32 2c 20 wise, on Win32,
58c0: 61 6c 77 61 79 73 20 75 73 65 20 74 68 65 20 73 always use the s
58d0: 74 61 6e 64 61 72 64 20 6e 61 74 69 76 65 20 6c tandard native l
58e0: 69 62 72 61 72 79 0d 0a 20 20 20 20 20 20 20 20 ibrary..
58f0: 23 20 20 20 20 20 20 20 66 69 6c 65 20 6e 61 6d # file nam
5900: 65 20 22 73 71 6c 69 74 65 33 2e 64 6c 6c 22 2e e "sqlite3.dll".
5910: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
5920: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 return [lis
5930: 74 20 73 71 6c 69 74 65 33 2e 64 6c 6c 5d 0d 0a t sqlite3.dll]..
5940: 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b } elseif {
5950: 5b 69 73 44 6f 74 4e 65 74 43 6f 72 65 5d 7d 20 [isDotNetCore]}
5960: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
5970: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 #.. #
5980: 20 20 20 57 68 65 6e 20 72 75 6e 6e 69 6e 67 20 When running
5990: 6f 6e 20 2e 4e 45 54 20 43 6f 72 65 2c 20 72 65 on .NET Core, re
59a0: 74 75 72 6e 20 74 68 65 20 73 61 6d 65 20 6e 61 turn the same na
59b0: 74 69 76 65 20 6c 69 62 72 61 72 79 0d 0a 20 20 tive library..
59c0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 66 69 # fi
59d0: 6c 65 20 6e 61 6d 65 20 74 68 61 74 20 69 73 20 le name that is
59e0: 75 73 65 64 20 6f 6e 20 57 69 6e 64 6f 77 73 20 used on Windows
59f0: 28 69 2e 65 2e 20 6f 74 68 65 72 77 69 73 65 2c (i.e. otherwise,
5a00: 20 61 73 73 75 6d 65 0d 0a 20 20 20 20 20 20 20 assume..
5a10: 20 23 20 20 20 20 20 20 20 77 65 20 61 72 65 20 # we are
5a20: 72 75 6e 6e 69 6e 67 20 6f 6e 20 4d 6f 6e 6f 20 running on Mono
5a30: 61 6e 64 20 75 73 65 20 69 74 73 20 50 2f 49 6e and use its P/In
5a40: 76 6f 6b 65 20 63 6f 6e 76 65 6e 74 69 6f 6e 73 voke conventions
5a50: 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 )... #..
5a60: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c return [l
5a70: 69 73 74 20 73 71 6c 69 74 65 33 2e 64 6c 6c 5d ist sqlite3.dll]
5a80: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 .. } elseif
5a90: 20 7b 5b 69 73 44 61 72 77 69 6e 5d 7d 20 74 68 {[isDarwin]} th
5aa0: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
5ab0: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
5ac0: 20 57 68 65 6e 20 72 75 6e 6e 69 6e 67 20 6f 6e When running on
5ad0: 20 44 61 72 77 69 6e 20 28 69 2e 65 2e 20 74 68 Darwin (i.e. th
5ae0: 65 20 6b 65 72 6e 65 6c 20 6f 66 20 69 4f 53 20 e kernel of iOS
5af0: 2f 20 4d 61 63 20 4f 53 20 58 29 2c 0d 0a 20 20 / Mac OS X),..
5b00: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 # re
5b10: 74 75 72 6e 20 74 68 65 20 4d 61 63 20 4f 53 20 turn the Mac OS
5b20: 58 20 6e 61 74 69 76 65 20 6c 69 62 72 61 72 79 X native library
5b30: 20 66 69 6c 65 20 6e 61 6d 65 2e 20 20 54 68 69 file name. Thi
5b40: 73 20 66 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 s file..
5b50: 23 20 20 20 20 20 20 20 6e 61 6d 65 20 69 73 20 # name is
5b60: 6e 6f 72 6d 61 6c 6c 79 20 72 65 71 75 69 72 65 normally require
5b70: 64 20 66 6f 72 20 4d 6f 6e 6f 2e 0d 0a 20 20 20 d for Mono...
5b80: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
5b90: 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 6c 69 62 return [list lib
5ba0: 73 71 6c 69 74 65 33 2e 64 79 6c 69 62 5d 0d 0a sqlite3.dylib]..
5bb0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
5bc0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
5bd0: 20 20 20 23 20 4e 4f 54 45 3a 20 4f 74 68 65 72 # NOTE: Other
5be0: 77 69 73 65 2c 20 72 65 74 75 72 6e 20 74 68 65 wise, return the
5bf0: 20 67 65 6e 65 72 69 63 20 50 4f 53 49 58 20 6e generic POSIX n
5c00: 61 74 69 76 65 20 6c 69 62 72 61 72 79 20 66 69 ative library fi
5c10: 6c 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 le.. #
5c20: 20 20 20 20 6e 61 6d 65 2e 20 20 54 68 69 73 20 name. This
5c30: 66 69 6c 65 20 6e 61 6d 65 20 69 73 20 6e 6f 72 file name is nor
5c40: 6d 61 6c 6c 79 20 72 65 71 75 69 72 65 64 20 66 mally required f
5c50: 6f 72 20 4d 6f 6e 6f 2e 0d 0a 20 20 20 20 20 20 or Mono...
5c60: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
5c70: 75 72 6e 20 5b 6c 69 73 74 20 6c 69 62 73 71 6c urn [list libsql
5c80: 69 74 65 33 2e 73 6f 5d 0d 0a 20 20 20 20 20 20 ite3.so]..
5c90: 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
5ca0: 20 70 72 6f 63 20 67 65 74 49 6e 74 65 72 6f 70 proc getInterop
5cb0: 41 73 73 65 6d 62 6c 79 46 69 6c 65 4e 61 6d 65 AssemblyFileName
5cc0: 73 4f 6e 6c 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 sOnly {} {..
5cd0: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
5ce0: 45 3a 20 46 69 72 73 74 2c 20 63 68 65 63 6b 20 E: First, check
5cf0: 69 66 20 74 68 65 20 6c 69 73 74 20 6f 66 20 69 if the list of i
5d00: 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 nterop assembly
5d10: 66 69 6c 65 20 6e 61 6d 65 73 20 68 61 73 20 62 file names has b
5d20: 65 65 6e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 een.. #
5d30: 20 20 20 6d 61 6e 75 61 6c 6c 79 20 6f 76 65 72 manually over
5d40: 72 69 64 64 65 6e 2e 0d 0a 20 20 20 20 20 20 23 ridden... #
5d50: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 .. if {[inf
5d60: 6f 20 65 78 69 73 74 73 20 3a 3a 69 6e 74 65 72 o exists ::inter
5d70: 6f 70 5f 61 73 73 65 6d 62 6c 79 5f 66 69 6c 65 op_assembly_file
5d80: 5f 6e 61 6d 65 73 5d 20 26 26 20 5c 0d 0a 20 20 _names] && \..
5d90: 20 20 20 20 20 20 20 20 5b 6c 6c 65 6e 67 74 68 [llength
5da0: 20 24 3a 3a 69 6e 74 65 72 6f 70 5f 61 73 73 65 $::interop_asse
5db0: 6d 62 6c 79 5f 66 69 6c 65 5f 6e 61 6d 65 73 5d mbly_file_names]
5dc0: 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
5dd0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
5de0: 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 69 73 # NOTE: The lis
5df0: 74 20 6f 66 20 69 6e 74 65 72 6f 70 20 61 73 73 t of interop ass
5e00: 65 6d 62 6c 79 20 66 69 6c 65 20 6e 61 6d 65 73 embly file names
5e10: 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 has been overri
5e20: 64 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 dden;.. #
5e30: 20 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 therefore
5e40: 2c 20 75 73 65 20 69 74 20 76 65 72 62 61 74 69 , use it verbati
5e50: 6d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 m... #..
5e60: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a return $:
5e70: 3a 69 6e 74 65 72 6f 70 5f 61 73 73 65 6d 62 6c :interop_assembl
5e80: 79 5f 66 69 6c 65 5f 6e 61 6d 65 73 0d 0a 20 20 y_file_names..
5e90: 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 } elseif {[i
5ea0: 73 57 69 6e 64 6f 77 73 5d 7d 20 74 68 65 6e 20 sWindows]} then
5eb0: 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
5ec0: 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4f 74 # NOTE: Ot
5ed0: 68 65 72 77 69 73 65 2c 20 6f 6e 20 57 69 6e 33 herwise, on Win3
5ee0: 32 2c 20 61 6c 77 61 79 73 20 75 73 65 20 74 68 2, always use th
5ef0: 65 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 e interop assemb
5f00: 6c 79 20 66 69 6c 65 0d 0a 20 20 20 20 20 20 20 ly file..
5f10: 20 23 20 20 20 20 20 20 20 6e 61 6d 65 20 22 53 # name "S
5f20: 51 4c 69 74 65 2e 49 6e 74 65 72 6f 70 2e 64 6c QLite.Interop.dl
5f30: 6c 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a l"... #..
5f40: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b return [
5f50: 6c 69 73 74 20 53 51 4c 69 74 65 2e 49 6e 74 65 list SQLite.Inte
5f60: 72 6f 70 2e 64 6c 6c 5d 0d 0a 20 20 20 20 20 20 rop.dll]..
5f70: 7d 20 65 6c 73 65 69 66 20 7b 5b 69 73 44 6f 74 } elseif {[isDot
5f80: 4e 65 74 43 6f 72 65 5d 7d 20 74 68 65 6e 20 7b NetCore]} then {
5f90: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
5fa0: 20 20 20 20 20 23 20 20 20 20 20 20 20 57 68 65 # Whe
5fb0: 6e 20 72 75 6e 6e 69 6e 67 20 6f 6e 20 2e 4e 45 n running on .NE
5fc0: 54 20 43 6f 72 65 2c 20 72 65 74 75 72 6e 20 74 T Core, return t
5fd0: 68 65 20 73 61 6d 65 20 69 6e 74 65 72 70 20 61 he same interp a
5fe0: 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 20 20 ssembly..
5ff0: 20 23 20 20 20 20 20 20 20 66 69 6c 65 20 6e 61 # file na
6000: 6d 65 20 74 68 61 74 20 69 73 20 75 73 65 64 20 me that is used
6010: 6f 6e 20 57 69 6e 64 6f 77 73 20 28 69 2e 65 2e on Windows (i.e.
6020: 20 6f 74 68 65 72 77 69 73 65 2c 20 61 73 73 75 otherwise, assu
6030: 6d 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 me.. #
6040: 20 20 20 20 77 65 20 61 72 65 20 72 75 6e 6e 69 we are runni
6050: 6e 67 20 6f 6e 20 4d 6f 6e 6f 20 61 6e 64 20 75 ng on Mono and u
6060: 73 65 20 69 74 73 20 50 2f 49 6e 76 6f 6b 65 20 se its P/Invoke
6070: 63 6f 6e 76 65 6e 74 69 6f 6e 73 29 2e 0d 0a 20 conventions)...
6080: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
6090: 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 53 return [list S
60a0: 51 4c 69 74 65 2e 49 6e 74 65 72 6f 70 2e 64 6c QLite.Interop.dl
60b0: 6c 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 l].. } else
60c0: 69 66 20 7b 5b 69 73 44 61 72 77 69 6e 5d 7d 20 if {[isDarwin]}
60d0: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
60e0: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
60f0: 45 3a 20 57 68 65 6e 20 72 75 6e 6e 69 6e 67 20 E: When running
6100: 6f 6e 20 44 61 72 77 69 6e 20 28 69 2e 65 2e 20 on Darwin (i.e.
6110: 74 68 65 20 6b 65 72 6e 65 6c 20 6f 66 20 69 4f the kernel of iO
6120: 53 20 2f 20 4d 61 63 20 4f 53 20 58 29 2c 0d 0a S / Mac OS X),..
6130: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
6140: 72 65 74 75 72 6e 20 74 68 65 20 4d 61 63 20 4f return the Mac O
6150: 53 20 58 20 69 6e 74 65 72 70 20 61 73 73 65 6d S X interp assem
6160: 62 6c 79 20 66 69 6c 65 20 6e 61 6d 65 2e 20 20 bly file name.
6170: 54 68 69 73 20 66 69 6c 65 0d 0a 20 20 20 20 20 This file..
6180: 20 20 20 23 20 20 20 20 20 20 20 6e 61 6d 65 20 # name
6190: 69 73 20 6e 6f 72 6d 61 6c 6c 79 20 72 65 71 75 is normally requ
61a0: 69 72 65 64 20 66 6f 72 20 4d 6f 6e 6f 2e 0d 0a ired for Mono...
61b0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
61c0: 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 return [list
61d0: 6c 69 62 53 51 4c 69 74 65 2e 49 6e 74 65 72 6f libSQLite.Intero
61e0: 70 2e 64 79 6c 69 62 5d 0d 0a 20 20 20 20 20 20 p.dylib]..
61f0: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
6200: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
6210: 4f 54 45 3a 20 4f 74 68 65 72 77 69 73 65 2c 20 OTE: Otherwise,
6220: 72 65 74 75 72 6e 20 74 68 65 20 67 65 6e 65 72 return the gener
6230: 69 63 20 50 4f 53 49 58 20 69 6e 74 65 72 70 20 ic POSIX interp
6240: 61 73 73 65 6d 62 6c 79 20 66 69 6c 65 0d 0a 20 assembly file..
6250: 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6e # n
6260: 61 6d 65 2e 20 20 54 68 69 73 20 66 69 6c 65 20 ame. This file
6270: 6e 61 6d 65 20 69 73 20 6e 6f 72 6d 61 6c 6c 79 name is normally
6280: 20 72 65 71 75 69 72 65 64 20 66 6f 72 20 4d 6f required for Mo
6290: 6e 6f 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a no... #..
62a0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b return [
62b0: 6c 69 73 74 20 6c 69 62 53 51 4c 69 74 65 2e 49 list libSQLite.I
62c0: 6e 74 65 72 6f 70 2e 73 6f 5d 0d 0a 20 20 20 20 nterop.so]..
62d0: 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
62e0: 20 20 20 70 72 6f 63 20 67 65 74 43 6f 72 65 45 proc getCoreE
62f0: 78 74 65 6e 73 69 6f 6e 42 69 6e 61 72 79 46 69 xtensionBinaryFi
6300: 6c 65 4e 61 6d 65 20 7b 20 7b 64 65 66 61 75 6c leName { {defaul
6310: 74 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 t ""} } {..
6320: 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 67 set fileName [g
6330: 65 74 43 6f 72 65 42 69 6e 61 72 79 46 69 6c 65 etCoreBinaryFile
6340: 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 Name].... i
6350: 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 f {[file exists
6360: 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e $fileName]} then
6370: 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 {.. retu
6380: 72 6e 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 rn $fileName..
6390: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 }.... r
63a0: 65 74 75 72 6e 20 24 64 65 66 61 75 6c 74 0d 0a eturn $default..
63b0: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
63c0: 6f 63 20 69 73 42 75 69 6c 64 41 76 61 69 6c 61 oc isBuildAvaila
63d0: 62 6c 65 20 7b 20 6e 61 74 69 76 65 20 64 69 72 ble { native dir
63e0: 65 63 74 6f 72 79 20 7b 76 61 72 4e 61 6d 65 20 ectory {varName
63f0: 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 ""} } {.. #
6400: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
6410: 42 75 69 6c 64 20 74 68 65 20 66 75 6c 6c 79 20 Build the fully
6420: 71 75 61 6c 69 66 69 65 64 20 66 69 6c 65 20 6e qualified file n
6430: 61 6d 65 20 66 6f 72 20 74 68 65 20 70 72 69 6d ame for the prim
6440: 61 72 79 20 61 73 73 65 6d 62 6c 79 0d 0a 20 20 ary assembly..
6450: 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 74 # cont
6460: 61 69 6e 69 6e 67 20 74 68 65 20 53 79 73 74 65 aining the Syste
6470: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 6d 61 m.Data.SQLite ma
6480: 6e 61 67 65 64 20 63 6f 6d 70 6f 6e 65 6e 74 73 naged components
6490: 2e 20 20 49 74 0d 0a 20 20 20 20 20 20 23 20 20 . It.. #
64a0: 20 20 20 20 20 73 68 6f 75 6c 64 20 62 65 20 6e should be n
64b0: 6f 74 65 64 20 74 68 61 74 20 74 68 69 73 20 61 oted that this a
64c0: 73 73 65 6d 62 6c 79 20 66 69 6c 65 20 6d 61 79 ssembly file may
64d0: 20 61 6c 73 6f 20 63 6f 6e 74 61 69 6e 20 74 68 also contain th
64e0: 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
64f0: 20 6e 61 74 69 76 65 20 63 6f 6d 70 6f 6e 65 6e native componen
6500: 74 73 2c 20 69 66 20 61 20 6e 61 74 69 76 65 20 ts, if a native
6510: 62 75 69 6c 64 20 69 73 20 69 6e 20 75 73 65 2e build is in use.
6520: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
6530: 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 set fileName [f
6540: 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b ile nativename [
6550: 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 65 63 file join $direc
6560: 74 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 tory \..
6570: 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
6580: 4c 69 74 65 2e 64 6c 6c 5d 5d 0d 0a 0d 0a 20 20 Lite.dll]]....
6590: 20 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 if {![file e
65a0: 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d xists $fileName]
65b0: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
65c0: 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a return false..
65d0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
65e0: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
65f0: 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 61 75 74 : Attempt to aut
6600: 6f 6d 61 74 69 63 61 6c 6c 79 20 64 65 74 65 63 omatically detec
6610: 74 20 69 66 20 74 68 65 20 70 72 69 6d 61 72 79 t if the primary
6620: 20 61 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 assembly..
6630: 20 23 20 20 20 20 20 20 20 63 6f 6e 74 61 69 6e # contain
6640: 73 20 61 6e 79 20 6e 61 74 69 76 65 20 63 6f 6d s any native com
6650: 70 6f 6e 65 6e 74 73 2c 20 69 66 20 6e 65 63 65 ponents, if nece
6660: 73 73 61 72 79 2e 0d 0a 20 20 20 20 20 20 23 0d ssary... #.
6670: 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 . if {[stri
6680: 6e 67 20 6c 65 6e 67 74 68 20 24 6e 61 74 69 76 ng length $nativ
6690: 65 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d e] == 0} then {.
66a0: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 . if {[st
66b0: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 72 ring length $var
66c0: 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 Name] > 0} then
66d0: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 75 70 76 {.. upv
66e0: 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 24 76 ar 1 $varName $v
66f0: 61 72 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 arName..
6700: 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 }.... set
6710: 20 6e 61 74 69 76 65 20 5b 69 73 4d 69 78 65 64 native [isMixed
6720: 4d 6f 64 65 41 73 73 65 6d 62 6c 79 20 24 66 69 ModeAssembly $fi
6730: 6c 65 4e 61 6d 65 20 24 76 61 72 4e 61 6d 65 5d leName $varName]
6740: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
6750: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
6760: 54 45 3a 20 49 66 20 74 68 65 20 70 72 69 6d 61 TE: If the prima
6770: 72 79 20 61 73 73 65 6d 62 6c 79 20 61 6c 73 6f ry assembly also
6780: 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 6e 61 contains the na
6790: 74 69 76 65 20 63 6f 6d 70 6f 6e 65 6e 74 73 2c tive components,
67a0: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
67b0: 77 65 20 68 61 76 65 20 65 76 65 72 79 74 68 69 we have everythi
67c0: 6e 67 20 77 65 20 6e 65 65 64 2e 0d 0a 20 20 20 ng we need...
67d0: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
67e0: 24 6e 61 74 69 76 65 7d 20 74 68 65 6e 20 7b 0d $native} then {.
67f0: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
6800: 74 72 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d true.. }...
6810: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
6820: 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 6d # NOTE: If the m
6830: 61 63 68 69 6e 65 20 6e 61 6d 65 20 69 73 20 75 achine name is u
6840: 6e 61 76 61 69 6c 61 62 6c 65 2c 20 74 68 65 72 navailable, ther
6850: 65 20 69 73 20 6e 6f 74 68 69 6e 67 20 65 6c 73 e is nothing els
6860: 65 20 77 65 0d 0a 20 20 20 20 20 20 23 20 20 20 e we.. #
6870: 20 20 20 20 63 61 6e 20 64 6f 2e 0d 0a 20 20 20 can do...
6880: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
6890: 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
68a0: 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 6d 61 63 tcl_platform(mac
68b0: 68 69 6e 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a hine)]} then {..
68c0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 66 return f
68d0: 61 6c 73 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d alse.. }...
68e0: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
68f0: 23 20 4e 4f 54 45 3a 20 57 68 61 74 20 69 73 20 # NOTE: What is
6900: 74 68 65 20 61 72 63 68 69 74 65 63 74 75 72 65 the architecture
6910: 20 66 6f 72 20 74 68 69 73 20 6d 61 63 68 69 6e for this machin
6920: 65 3f 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e?.. #..
6930: 20 20 20 73 65 74 20 61 72 63 68 69 74 65 63 74 set architect
6940: 75 72 65 20 5b 6d 61 63 68 69 6e 65 54 6f 50 6c ure [machineToPl
6950: 61 74 66 6f 72 6d 20 24 3a 3a 74 63 6c 5f 70 6c atform $::tcl_pl
6960: 61 74 66 6f 72 6d 28 6d 61 63 68 69 6e 65 29 20 atform(machine)
6970: 74 72 75 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 true].... #
6980: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
6990: 57 68 61 74 20 69 73 20 74 68 65 20 70 6c 61 74 What is the plat
69a0: 66 6f 72 6d 20 66 6f 72 20 74 68 69 73 20 6d 61 form for this ma
69b0: 63 68 69 6e 65 3f 0d 0a 20 20 20 20 20 20 23 0d chine?.. #.
69c0: 0a 20 20 20 20 20 20 73 65 74 20 70 6c 61 74 66 . set platf
69d0: 6f 72 6d 20 5b 6d 61 63 68 69 6e 65 54 6f 50 6c orm [machineToPl
69e0: 61 74 66 6f 72 6d 20 24 3a 3a 74 63 6c 5f 70 6c atform $::tcl_pl
69f0: 61 74 66 6f 72 6d 28 6d 61 63 68 69 6e 65 29 5d atform(machine)]
6a00: 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
6a10: 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 # NOTE: Build
6a20: 20 74 68 65 20 66 75 6c 6c 79 20 71 75 61 6c 69 the fully quali
6a30: 66 69 65 64 20 66 69 6c 65 20 6e 61 6d 65 20 66 fied file name f
6a40: 6f 72 20 74 68 65 20 69 6e 74 65 72 6f 70 20 61 or the interop a
6a50: 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 20 20 23 ssembly.. #
6a60: 20 20 20 20 20 20 20 63 6f 6e 74 61 69 6e 69 6e containin
6a70: 67 20 74 68 65 20 53 79 73 74 65 6d 2e 44 61 74 g the System.Dat
6a80: 61 2e 53 51 4c 69 74 65 20 6e 61 74 69 76 65 20 a.SQLite native
6a90: 63 6f 6d 70 6f 6e 65 6e 74 73 2e 20 20 49 66 20 components. If
6aa0: 74 68 69 73 0d 0a 20 20 20 20 20 20 23 20 20 20 this.. #
6ab0: 20 20 20 20 66 69 6c 65 20 65 78 69 73 74 73 2c file exists,
6ac0: 20 77 65 20 73 68 6f 75 6c 64 20 68 61 76 65 20 we should have
6ad0: 65 76 65 72 79 74 68 69 6e 67 20 77 65 20 6e 65 everything we ne
6ae0: 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ed... #..
6af0: 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
6b00: 4e 61 6d 65 4f 6e 6c 79 20 5b 67 65 74 49 6e 74 NameOnly [getInt
6b10: 65 72 6f 70 41 73 73 65 6d 62 6c 79 46 69 6c 65 eropAssemblyFile
6b20: 4e 61 6d 65 73 4f 6e 6c 79 5d 20 7b 0d 0a 20 20 NamesOnly] {..
6b30: 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 set fileNa
6b40: 6d 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e me [file nativen
6b50: 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 ame [file join $
6b60: 64 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 directory \..
6b70: 20 20 20 20 20 20 20 20 20 24 61 72 63 68 69 74 $archit
6b80: 65 63 74 75 72 65 20 24 66 69 6c 65 4e 61 6d 65 ecture $fileName
6b90: 4f 6e 6c 79 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 Only]]....
6ba0: 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 if {[file exis
6bb0: 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 ts $fileName]} t
6bc0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
6bd0: 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 return true..
6be0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
6bf0: 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 set fileName
6c00: 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
6c10: 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 [file join $dir
6c20: 65 63 74 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 ectory \..
6c30: 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 6d 20 $platform
6c40: 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d 5d 0d $fileNameOnly]].
6c50: 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b ... if {[
6c60: 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c file exists $fil
6c70: 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a eName]} then {..
6c80: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
6c90: 20 74 72 75 65 0d 0a 20 20 20 20 20 20 20 20 7d true.. }
6ca0: 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 .... set
6cb0: 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6e fileName [file n
6cc0: 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 ativename [file
6cd0: 6a 6f 69 6e 20 24 64 69 72 65 63 74 6f 72 79 20 join $directory
6ce0: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 \.. $
6cf0: 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d 5d 0d 0a fileNameOnly]]..
6d00: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 66 .. if {[f
6d10: 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 ile exists $file
6d20: 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 Name]} then {..
6d30: 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 return
6d40: 74 72 75 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d true.. }.
6d50: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
6d60: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
6d70: 45 3a 20 42 75 69 6c 64 20 74 68 65 20 66 75 6c E: Build the ful
6d80: 6c 79 20 71 75 61 6c 69 66 69 65 64 20 66 69 6c ly qualified fil
6d90: 65 20 6e 61 6d 65 20 66 6f 72 20 74 68 65 20 53 e name for the S
6da0: 51 4c 69 74 65 20 63 6f 72 65 0d 0a 20 20 20 20 QLite core..
6db0: 20 20 23 20 20 20 20 20 20 20 6c 69 62 72 61 72 # librar
6dc0: 79 2e 20 20 49 66 20 74 68 69 73 20 66 69 6c 65 y. If this file
6dd0: 20 65 78 69 73 74 73 2c 20 77 65 20 73 68 6f 75 exists, we shou
6de0: 6c 64 20 68 61 76 65 20 65 76 65 72 79 74 68 69 ld have everythi
6df0: 6e 67 20 77 65 0d 0a 20 20 20 20 20 20 23 20 20 ng we.. #
6e00: 20 20 20 20 20 6e 65 65 64 2e 0d 0a 20 20 20 20 need...
6e10: 20 20 23 0d 0a 20 20 20 20 20 20 66 6f 72 65 61 #.. forea
6e20: 63 68 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 ch fileNameOnly
6e30: 5b 67 65 74 4e 61 74 69 76 65 4c 69 62 72 61 72 [getNativeLibrar
6e40: 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d 20 yFileNamesOnly]
6e50: 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 66 {.. set f
6e60: 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6e 61 ileName [file na
6e70: 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a tivename [file j
6e80: 6f 69 6e 20 24 64 69 72 65 63 74 6f 72 79 20 5c oin $directory \
6e90: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 61 .. $a
6ea0: 72 63 68 69 74 65 63 74 75 72 65 20 24 66 69 6c rchitecture $fil
6eb0: 65 4e 61 6d 65 4f 6e 6c 79 5d 5d 0d 0a 0d 0a 20 eNameOnly]]....
6ec0: 20 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 if {[file
6ed0: 20 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d exists $fileNam
6ee0: 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 e]} then {..
6ef0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
6f00: 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a e.. }....
6f10: 20 20 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 set file
6f20: 4e 61 6d 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 Name [file nativ
6f30: 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
6f40: 20 24 64 69 72 65 63 74 6f 72 79 20 5c 0d 0a 20 $directory \..
6f50: 20 20 20 20 20 20 20 20 20 20 20 24 70 6c 61 74 $plat
6f60: 66 6f 72 6d 20 24 66 69 6c 65 4e 61 6d 65 4f 6e form $fileNameOn
6f70: 6c 79 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ly]]....
6f80: 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 if {[file exists
6f90: 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 $fileName]} the
6fa0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 72 n {.. r
6fb0: 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 eturn true..
6fc0: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
6fd0: 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 set fileName [f
6fe0: 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b ile nativename [
6ff0: 66 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 65 63 file join $direc
7000: 74 6f 72 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 tory \..
7010: 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c $fileNameOnl
7020: 79 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 y]].... i
7030: 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 f {[file exists
7040: 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e $fileName]} then
7050: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 {.. re
7060: 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 turn true..
7070: 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
7080: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
7090: 23 20 4e 4f 54 45 3a 20 4f 6e 65 20 6f 72 20 6d # NOTE: One or m
70a0: 6f 72 65 20 6e 61 74 69 76 65 20 63 6f 6d 70 6f ore native compo
70b0: 6e 65 6e 74 73 20 6e 65 65 64 65 64 20 62 79 20 nents needed by
70c0: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
70d0: 74 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 te.. #
70e0: 20 20 61 72 65 20 6d 69 73 73 69 6e 67 2e 0d 0a are missing...
70f0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 #.. r
7100: 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 eturn false..
7110: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
7120: 69 73 52 65 6c 65 61 73 65 41 76 61 69 6c 61 62 isReleaseAvailab
7130: 6c 65 20 7b 20 64 69 72 65 63 74 6f 72 79 20 7b le { directory {
7140: 76 61 72 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d varName ""} } {.
7150: 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 . if {[stri
7160: 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e 61 ng length $varNa
7170: 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d me] > 0} then {.
7180: 0a 20 20 20 20 20 20 20 20 75 70 76 61 72 20 31 . upvar 1
7190: 20 24 76 61 72 4e 61 6d 65 20 24 76 61 72 4e 61 $varName $varNa
71a0: 6d 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 me.. }....
71b0: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 69 73 42 return [isB
71c0: 75 69 6c 64 41 76 61 69 6c 61 62 6c 65 20 22 22 uildAvailable ""
71d0: 20 24 64 69 72 65 63 74 6f 72 79 20 24 76 61 72 $directory $var
71e0: 4e 61 6d 65 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d Name].. }....
71f0: 0a 20 20 20 20 70 72 6f 63 20 6a 6f 69 6e 42 75 . proc joinBu
7200: 69 6c 64 44 69 72 65 63 74 6f 72 79 20 7b 20 6e ildDirectory { n
7210: 61 74 69 76 65 20 70 61 74 68 20 79 65 61 72 20 ative path year
7220: 70 6c 61 74 66 6f 72 6d 20 63 6f 6e 66 69 67 75 platform configu
7230: 72 61 74 69 6f 6e 20 65 78 74 72 61 20 7d 20 7b ration extra } {
7240: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
7250: 20 23 20 4e 4f 54 45 3a 20 46 69 67 75 72 65 20 # NOTE: Figure
7260: 6f 75 74 20 61 6e 64 20 74 68 65 6e 20 72 65 74 out and then ret
7270: 75 72 6e 20 74 68 65 20 66 75 6c 6c 79 20 71 75 urn the fully qu
7280: 61 6c 69 66 69 65 64 20 70 61 74 68 20 74 6f 20 alified path to
7290: 74 68 65 20 62 75 69 6c 64 0d 0a 20 20 20 20 20 the build..
72a0: 20 23 20 20 20 20 20 20 20 64 69 72 65 63 74 6f # directo
72b0: 72 79 20 62 61 73 65 64 20 6f 6e 20 61 6c 6c 20 ry based on all
72c0: 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 70 72 the arguments pr
72d0: 6f 76 69 64 65 64 20 62 79 20 6f 75 72 20 63 61 ovided by our ca
72e0: 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a ller... #..
72f0: 20 20 20 20 20 20 69 66 20 7b 24 6e 61 74 69 76 if {$nativ
7300: 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 e} then {..
7310: 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 return [file
7320: 6a 6f 69 6e 20 24 70 61 74 68 20 62 69 6e 20 24 join $path bin $
7330: 79 65 61 72 20 24 70 6c 61 74 66 6f 72 6d 20 24 year $platform $
7340: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 24 65 configuration $e
7350: 78 74 72 61 5d 0d 0a 20 20 20 20 20 20 7d 20 65 xtra].. } e
7360: 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 lse {.. r
7370: 65 74 75 72 6e 20 5b 66 69 6c 65 20 6a 6f 69 6e eturn [file join
7380: 20 24 70 61 74 68 20 62 69 6e 20 24 79 65 61 72 $path bin $year
7390: 20 24 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 $configuration
73a0: 62 69 6e 20 24 65 78 74 72 61 5d 0d 0a 20 20 20 bin $extra]..
73b0: 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
73c0: 20 20 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c proc getBuil
73d0: 64 44 69 72 65 63 74 6f 72 79 20 7b 20 6d 61 6e dDirectory { man
73e0: 61 67 65 64 4f 6e 6c 79 20 7d 20 7b 0d 0a 20 20 agedOnly } {..
73f0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
7400: 4f 54 45 3a 20 53 65 65 20 69 66 20 74 68 65 20 OTE: See if the
7410: 22 6e 61 74 69 76 65 22 20 72 75 6e 74 69 6d 65 "native" runtime
7420: 20 6f 70 74 69 6f 6e 20 68 61 73 20 62 65 65 6e option has been
7430: 20 73 65 74 2e 20 20 49 66 20 73 6f 2c 20 75 73 set. If so, us
7440: 65 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 e the.. #
7450: 20 20 20 20 20 64 69 72 65 63 74 6f 72 79 20 66 directory f
7460: 6f 72 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 or the mixed-mod
7470: 65 20 61 73 73 65 6d 62 6c 79 20 28 61 2e 6b 2e e assembly (a.k.
7480: 61 2e 20 74 68 65 20 6e 61 74 69 76 65 20 69 6e a. the native in
7490: 74 65 72 6f 70 0d 0a 20 20 20 20 20 20 23 20 20 terop.. #
74a0: 20 20 20 20 20 61 73 73 65 6d 62 6c 79 29 2e 20 assembly).
74b0: 20 54 6f 20 65 6e 61 62 6c 65 20 74 68 69 73 20 To enable this
74c0: 6f 70 74 69 6f 6e 20 76 69 61 20 74 68 65 20 63 option via the c
74d0: 6f 6d 6d 61 6e 64 20 6c 69 6e 65 2c 20 65 6e 74 ommand line, ent
74e0: 65 72 20 61 0d 0a 20 20 20 20 20 20 23 20 20 20 er a.. #
74f0: 20 20 20 20 63 6f 6d 6d 61 6e 64 20 73 69 6d 69 command simi
7500: 6c 61 72 20 74 6f 20 6f 6e 65 20 6f 66 20 74 68 lar to one of th
7510: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 28 61 6c 6c e following (all
7520: 20 6f 6e 20 6f 6e 65 20 6c 69 6e 65 29 3a 0d 0a on one line):..
7530: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
7540: 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 65 6c EagleShel
7550: 6c 2e 65 78 65 20 2d 69 6e 69 74 69 61 6c 69 7a l.exe -initializ
7560: 65 20 2d 72 75 6e 74 69 6d 65 4f 70 74 69 6f 6e e -runtimeOption
7570: 20 6e 61 74 69 76 65 0d 0a 20 20 20 20 20 20 23 native.. #
7580: 20 20 20 20 20 20 20 20 20 2d 66 69 6c 65 20 2e -file .
7590: 5c 70 61 74 68 5c 74 6f 5c 61 6c 6c 2e 65 61 67 \path\to\all.eag
75a0: 6c 65 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 le.. #..
75b0: 20 20 20 23 20 20 20 20 20 20 20 54 6f 20 65 6e # To en
75c0: 61 62 6c 65 20 74 68 69 73 20 6f 70 74 69 6f 6e able this option
75d0: 20 76 69 61 20 74 68 65 20 63 6f 6d 6d 61 6e 64 via the command
75e0: 20 6c 69 6e 65 20 70 72 69 6f 72 20 74 6f 20 74 line prior to t
75f0: 68 65 20 22 62 65 74 61 20 31 36 22 0d 0a 20 20 he "beta 16"..
7600: 20 20 20 20 23 20 20 20 20 20 20 20 72 65 6c 65 # rele
7610: 61 73 65 20 6f 66 20 45 61 67 6c 65 2c 20 74 68 ase of Eagle, th
7620: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f 6d 6d e following comm
7630: 61 6e 64 20 6d 75 73 74 20 62 65 20 75 73 65 64 and must be used
7640: 20 69 6e 73 74 65 61 64 0d 0a 20 20 20 20 20 20 instead..
7650: 23 20 20 20 20 20 20 20 28 61 6c 73 6f 20 61 6c # (also al
7660: 6c 20 6f 6e 20 6f 6e 65 20 6c 69 6e 65 29 3a 0d l on one line):.
7670: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
7680: 23 20 20 20 20 20 20 20 45 61 67 6c 65 53 68 65 # EagleShe
7690: 6c 6c 2e 65 78 65 20 2d 69 6e 69 74 69 61 6c 69 ll.exe -initiali
76a0: 7a 65 20 2d 70 6f 73 74 49 6e 69 74 69 61 6c 69 ze -postInitiali
76b0: 7a 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ze.. #
76c0: 20 20 20 20 22 6f 62 6a 65 63 74 20 69 6e 76 6f "object invo
76d0: 6b 65 20 49 6e 74 65 72 70 72 65 74 65 72 2e 47 ke Interpreter.G
76e0: 65 74 41 63 74 69 76 65 20 41 64 64 52 75 6e 74 etActive AddRunt
76f0: 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 69 76 65 imeOption native
7700: 22 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 ".. #
7710: 20 20 20 2d 66 69 6c 65 20 2e 5c 70 61 74 68 5c -file .\path\
7720: 74 6f 5c 61 6c 6c 2e 65 61 67 6c 65 0d 0a 20 20 to\all.eagle..
7730: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
7740: 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a {[info exists ::
7750: 62 75 69 6c 64 5f 64 69 72 65 63 74 6f 72 79 5d build_directory]
7760: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
7770: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
7780: 24 3a 3a 62 75 69 6c 64 5f 64 69 72 65 63 74 6f $::build_directo
7790: 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d ry] > 0} then {.
77a0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
77b0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 # NOTE: The
77c0: 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 location of the
77d0: 62 75 69 6c 64 20 64 69 72 65 63 74 6f 72 79 20 build directory
77e0: 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 69 64 has been overrid
77f0: 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 den;.. #
7800: 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c therefore,
7810: 20 75 73 65 20 69 74 20 76 65 72 62 61 74 69 6d use it verbatim
7820: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
7830: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
7840: 62 75 69 6c 64 5f 64 69 72 65 63 74 6f 72 79 0d build_directory.
7850: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
7860: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
7870: 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 # NOTE: If t
7880: 68 65 20 22 6e 61 74 69 76 65 22 20 72 75 6e 74 he "native" runt
7890: 69 6d 65 20 6f 70 74 69 6f 6e 20 69 73 20 73 65 ime option is se
78a0: 74 2c 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 t, the mixed-mod
78b0: 65 20 61 73 73 65 6d 62 6c 79 0d 0a 20 20 20 20 e assembly..
78c0: 20 20 20 20 23 20 20 20 20 20 20 20 69 73 20 62 # is b
78d0: 65 69 6e 67 20 74 65 73 74 65 64 2e 20 20 49 6e eing tested. In
78e0: 20 74 68 61 74 20 63 61 73 65 2c 20 74 68 65 20 that case, the
78f0: 70 61 74 68 20 74 6f 20 74 68 65 20 62 75 69 6c path to the buil
7900: 64 20 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 d directory..
7910: 20 20 20 20 20 23 20 20 20 20 20 20 20 77 69 6c # wil
7920: 6c 20 63 6f 6e 74 61 69 6e 20 74 68 65 20 70 6c l contain the pl
7930: 61 74 66 6f 72 6d 20 6e 61 6d 65 20 61 6e 64 20 atform name and
7940: 61 6c 6c 20 74 68 65 20 62 69 6e 61 72 69 65 73 all the binaries
7950: 20 75 6e 64 65 72 20 74 65 73 74 0d 0a 20 20 20 under test..
7960: 20 20 20 20 20 23 20 20 20 20 20 20 20 73 68 6f # sho
7970: 75 6c 64 20 62 65 20 70 72 65 73 65 6e 74 20 69 uld be present i
7980: 6e 20 74 68 61 74 20 64 69 72 65 63 74 6f 72 79 n that directory
7990: 2e 20 20 49 66 20 74 68 65 20 22 6e 61 74 69 76 . If the "nativ
79a0: 65 22 20 72 75 6e 74 69 6d 65 0d 0a 20 20 20 20 e" runtime..
79b0: 20 20 20 20 23 20 20 20 20 20 20 20 6f 70 74 69 # opti
79c0: 6f 6e 20 69 73 20 6e 6f 74 20 73 65 74 2c 20 74 on is not set, t
79d0: 68 65 20 62 75 69 6c 64 20 64 69 72 65 63 74 6f he build directo
79e0: 72 79 20 77 69 6c 6c 20 62 65 20 63 6f 6e 73 69 ry will be consi
79f0: 64 65 72 65 64 20 74 6f 20 62 65 0d 0a 20 20 20 dered to be..
7a00: 20 20 20 20 20 23 20 20 20 20 20 20 20 22 70 6c # "pl
7a10: 61 74 66 6f 72 6d 2d 6e 65 75 74 72 61 6c 22 2c atform-neutral",
7a20: 20 77 69 74 68 20 74 68 65 20 6e 6f 74 61 62 6c with the notabl
7a30: 65 20 65 78 63 65 70 74 69 6f 6e 20 6f 66 20 61 e exception of a
7a40: 6e 79 20 6e 61 74 69 76 65 0d 0a 20 20 20 20 20 ny native..
7a50: 20 20 20 23 20 20 20 20 20 20 20 61 73 73 65 6d # assem
7a60: 62 6c 79 20 28 65 2e 67 2e 20 22 53 51 4c 69 74 bly (e.g. "SQLit
7a70: 65 2e 49 6e 74 65 72 6f 70 2e 64 6c 6c 22 29 20 e.Interop.dll")
7a80: 63 6f 70 69 65 64 20 74 68 65 72 65 20 64 75 72 copied there dur
7a90: 69 6e 67 20 74 68 65 0d 0a 20 20 20 20 20 20 20 ing the..
7aa0: 20 23 20 20 20 20 20 20 20 62 75 69 6c 64 20 70 # build p
7ab0: 72 6f 63 65 73 73 20 69 74 73 65 6c 66 2e 20 20 rocess itself.
7ac0: 49 66 20 74 68 65 20 62 75 69 6c 64 20 70 72 6f If the build pro
7ad0: 63 65 73 73 20 73 6f 6d 65 68 6f 77 20 64 6f 65 cess somehow doe
7ae0: 73 20 6e 6f 74 0d 0a 20 20 20 20 20 20 20 20 23 s not.. #
7af0: 20 20 20 20 20 20 20 63 6f 70 79 20 74 68 65 20 copy the
7b00: 6e 61 74 69 76 65 20 61 73 73 65 6d 62 6c 79 20 native assembly
7b10: 66 6f 72 20 74 68 69 73 20 70 6c 61 74 66 6f 72 for this platfor
7b20: 6d 2c 20 6d 6f 73 74 20 6f 66 20 74 68 65 20 74 m, most of the t
7b30: 65 73 74 73 0d 0a 20 20 20 20 20 20 20 20 23 20 ests.. #
7b40: 20 20 20 20 20 20 69 6e 20 74 68 65 20 73 75 69 in the sui
7b50: 74 65 20 77 69 6c 6c 20 73 69 6d 70 6c 79 20 62 te will simply b
7b60: 65 20 73 6b 69 70 70 65 64 2e 20 20 47 65 6e 65 e skipped. Gene
7b70: 72 61 6c 6c 79 20 73 70 65 61 6b 69 6e 67 2c 20 rally speaking,
7b80: 74 68 65 72 65 0d 0a 20 20 20 20 20 20 20 20 23 there.. #
7b90: 20 20 20 20 20 20 20 61 72 65 20 74 77 6f 20 77 are two w
7ba0: 61 79 73 20 74 6f 20 62 75 69 6c 64 20 74 68 65 ays to build the
7bb0: 20 62 69 6e 61 72 69 65 73 20 77 68 65 6e 20 70 binaries when p
7bc0: 72 65 70 61 72 69 6e 67 20 74 6f 20 72 75 6e 20 reparing to run
7bd0: 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 the.. #
7be0: 20 20 20 20 20 74 65 73 74 20 73 75 69 74 65 3a test suite:
7bf0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
7c00: 20 20 20 20 20 23 20 20 20 20 20 20 20 31 2e 20 # 1.
7c10: 42 75 69 6c 64 20 74 68 65 20 73 65 70 61 72 61 Build the separa
7c20: 74 65 20 6d 61 6e 61 67 65 64 20 61 6e 64 20 6e te managed and n
7c30: 61 74 69 76 65 20 61 73 73 65 6d 62 6c 69 65 73 ative assemblies
7c40: 20 75 73 69 6e 67 20 73 6f 6d 65 0d 0a 20 20 20 using some..
7c50: 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 20 #
7c60: 63 6f 6d 6d 61 6e 64 73 20 73 69 6d 69 6c 61 72 commands similar
7c70: 20 74 6f 3a 0d 0a 20 20 20 20 20 20 20 20 23 0d to:.. #.
7c80: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
7c90: 20 20 20 20 62 75 69 6c 64 2e 62 61 74 20 24 7b build.bat ${
7ca0: 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 7d 4d 61 Configuration}Ma
7cb0: 6e 61 67 65 64 4f 6e 6c 79 20 24 7b 50 6c 61 74 nagedOnly ${Plat
7cc0: 66 6f 72 6d 7d 0d 0a 20 20 20 20 20 20 20 20 23 form}.. #
7cd0: 20 20 20 20 20 20 20 20 20 20 62 75 69 6c 64 2e build.
7ce0: 62 61 74 20 24 7b 43 6f 6e 66 69 67 75 72 61 74 bat ${Configurat
7cf0: 69 6f 6e 7d 4e 61 74 69 76 65 4f 6e 6c 79 20 24 ion}NativeOnly $
7d00: 7b 50 6c 61 74 66 6f 72 6d 7d 0d 0a 20 20 20 20 {Platform}..
7d10: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
7d20: 20 20 20 20 20 20 20 20 20 20 57 68 65 72 65 20 Where
7d30: 24 7b 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 7d ${Configuration}
7d40: 20 69 73 20 65 69 74 68 65 72 20 22 44 65 62 75 is either "Debu
7d50: 67 22 20 6f 72 20 22 52 65 6c 65 61 73 65 22 20 g" or "Release"
7d60: 61 6e 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 and.. #
7d70: 20 20 20 20 20 20 20 20 24 7b 50 6c 61 74 66 6f ${Platfo
7d80: 72 6d 7d 20 69 73 20 65 69 74 68 65 72 20 22 57 rm} is either "W
7d90: 69 6e 33 32 22 20 6f 72 20 22 78 36 34 22 2e 0d in32" or "x64"..
7da0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
7db0: 20 20 20 20 23 20 20 20 20 20 20 20 32 2e 20 42 # 2. B
7dc0: 75 69 6c 64 20 74 68 65 20 6d 69 78 65 64 2d 6d uild the mixed-m
7dd0: 6f 64 65 20 61 73 73 65 6d 62 6c 79 20 75 73 69 ode assembly usi
7de0: 6e 67 20 61 20 63 6f 6d 6d 61 6e 64 20 73 69 6d ng a command sim
7df0: 69 6c 61 72 20 74 6f 3a 0d 0a 20 20 20 20 20 20 ilar to:..
7e00: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 20 #.. #
7e10: 20 20 20 20 20 20 20 20 62 75 69 6c 64 2e 62 61 build.ba
7e20: 74 20 24 7b 43 6f 6e 66 69 67 75 72 61 74 69 6f t ${Configuratio
7e30: 6e 7d 20 24 7b 50 6c 61 74 66 6f 72 6d 7d 0d 0a n} ${Platform}..
7e40: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
7e50: 20 20 20 23 20 20 20 20 20 20 20 20 20 20 57 68 # Wh
7e60: 65 72 65 20 24 7b 43 6f 6e 66 69 67 75 72 61 74 ere ${Configurat
7e70: 69 6f 6e 7d 20 69 73 20 65 69 74 68 65 72 20 22 ion} is either "
7e80: 44 65 62 75 67 22 20 6f 72 20 22 52 65 6c 65 61 Debug" or "Relea
7e90: 73 65 22 20 61 6e 64 0d 0a 20 20 20 20 20 20 20 se" and..
7ea0: 20 23 20 20 20 20 20 20 20 20 20 20 24 7b 50 6c # ${Pl
7eb0: 61 74 66 6f 72 6d 7d 20 69 73 20 65 69 74 68 65 atform} is eithe
7ec0: 72 20 22 57 69 6e 33 32 22 20 6f 72 20 22 78 36 r "Win32" or "x6
7ed0: 34 22 2e 20 20 49 66 20 74 68 69 73 20 63 6f 6d 4". If this com
7ee0: 6d 61 6e 64 20 69 73 0d 0a 20 20 20 20 20 20 20 mand is..
7ef0: 20 23 20 20 20 20 20 20 20 20 20 20 75 73 65 64 # used
7f00: 2c 20 76 61 72 69 6f 75 73 20 74 65 73 74 73 20 , various tests
7f10: 74 68 61 74 20 72 65 71 75 69 72 65 20 73 75 70 that require sup
7f20: 70 6c 65 6d 65 6e 74 61 72 79 20 6d 61 6e 61 67 plementary manag
7f30: 65 64 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ed.. #
7f40: 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c 69 65 assemblie
7f50: 73 20 28 65 2e 67 2e 20 4c 49 4e 51 29 20 6d 61 s (e.g. LINQ) ma
7f60: 79 20 62 65 20 73 6b 69 70 70 65 64 20 75 6e 6c y be skipped unl
7f70: 65 73 73 20 74 68 6f 73 65 20 62 69 6e 61 72 69 ess those binari
7f80: 65 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 es.. #
7f90: 20 20 20 20 20 20 20 61 72 65 20 73 75 62 73 65 are subse
7fa0: 71 75 65 6e 74 6c 79 20 63 6f 70 69 65 64 20 69 quently copied i
7fb0: 6e 74 6f 20 74 68 65 20 63 6f 72 72 65 63 74 20 nto the correct
7fc0: 64 69 72 65 63 74 6f 72 79 20 28 69 2e 65 2e 20 directory (i.e.
7fd0: 62 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 by.. #
7fe0: 20 20 20 20 20 20 20 22 74 65 73 74 5f 61 6c 6c "test_all
7ff0: 2e 62 61 74 22 29 2e 0d 0a 20 20 20 20 20 20 20 .bat")...
8000: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 #.. #
8010: 20 20 20 20 4e 6f 74 65 20 74 68 61 74 20 61 6c Note that al
8020: 6c 20 6f 66 20 74 68 65 20 62 75 69 6c 64 20 63 l of the build c
8030: 6f 6d 6d 61 6e 64 73 20 61 62 6f 76 65 20 77 69 ommands above wi
8040: 6c 6c 20 64 65 66 61 75 6c 74 20 74 6f 20 75 73 ll default to us
8050: 69 6e 67 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ing.. #
8060: 20 20 20 20 20 74 68 65 20 6c 61 74 65 73 74 20 the latest
8070: 76 65 72 73 69 6f 6e 20 6f 66 20 4d 53 42 75 69 version of MSBui
8080: 6c 64 20 61 76 61 69 6c 61 62 6c 65 20 61 6e 64 ld available and
8090: 20 74 68 65 20 22 74 65 73 74 5f 79 65 61 72 22 the "test_year"
80a0: 20 6d 61 79 0d 0a 20 20 20 20 20 20 20 20 23 20 may.. #
80b0: 20 20 20 20 20 20 6e 65 65 64 20 74 6f 20 62 65 need to be
80c0: 20 61 64 6a 75 73 74 65 64 20 61 63 63 6f 72 64 adjusted accord
80d0: 69 6e 67 6c 79 20 74 6f 20 61 63 74 75 61 6c 6c ingly to actuall
80e0: 79 20 72 75 6e 20 74 68 65 20 74 65 73 74 20 73 y run the test s
80f0: 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 uite... #
8100: 20 20 20 20 20 20 20 52 65 66 65 72 20 74 6f 20 Refer to
8110: 74 68 65 20 63 6f 6d 6d 65 6e 74 73 20 69 6e 20 the comments in
8120: 5b 67 65 74 42 75 69 6c 64 59 65 61 72 5d 20 66 [getBuildYear] f
8130: 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 or more informat
8140: 69 6f 6e 20 6f 6e 0d 0a 20 20 20 20 20 20 20 20 ion on..
8150: 23 20 20 20 20 20 20 20 68 6f 77 20 74 6f 20 73 # how to s
8160: 65 74 20 74 68 69 73 20 76 61 72 69 61 62 6c 65 et this variable
8170: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
8180: 20 20 20 20 20 20 73 65 74 20 6e 61 74 69 76 65 set native
8190: 20 5b 65 78 70 72 20 7b 21 24 6d 61 6e 61 67 65 [expr {!$manage
81a0: 64 4f 6e 6c 79 20 26 26 20 5b 68 61 73 52 75 6e dOnly && [hasRun
81b0: 74 69 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 69 76 timeOption nativ
81c0: 65 5d 7d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 e]}]....
81d0: 72 65 74 75 72 6e 20 5b 6a 6f 69 6e 42 75 69 6c return [joinBuil
81e0: 64 44 69 72 65 63 74 6f 72 79 20 24 6e 61 74 69 dDirectory $nati
81f0: 76 65 20 5b 67 65 74 42 75 69 6c 64 42 61 73 65 ve [getBuildBase
8200: 44 69 72 65 63 74 6f 72 79 5d 20 5c 0d 0a 20 20 Directory] \..
8210: 20 20 20 20 20 20 20 20 20 20 5b 65 78 70 72 20 [expr
8220: 7b 24 6d 61 6e 61 67 65 64 4f 6e 6c 79 20 3f 20 {$managedOnly ?
8230: 5b 67 65 74 42 75 69 6c 64 59 65 61 72 5d 20 3a [getBuildYear] :
8240: 20 5b 67 65 74 42 75 69 6c 64 4e 61 74 69 76 65 [getBuildNative
8250: 59 65 61 72 5d 7d 5d 20 5c 0d 0a 20 20 20 20 20 Year]}] \..
8260: 20 20 20 20 20 20 20 5b 67 65 74 42 75 69 6c 64 [getBuild
8270: 50 6c 61 74 66 6f 72 6d 20 24 6e 61 74 69 76 65 Platform $native
8280: 5d 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 67 ] [appendArgs [g
8290: 65 74 42 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 etBuildConfigura
82a0: 74 69 6f 6e 5d 20 5c 0d 0a 20 20 20 20 20 20 20 tion] \..
82b0: 20 20 20 20 20 5b 67 65 74 42 75 69 6c 64 43 6f [getBuildCo
82c0: 6e 66 69 67 75 72 61 74 69 6f 6e 53 75 66 66 69 nfigurationSuffi
82d0: 78 5d 5d 20 5b 65 78 70 72 20 7b 24 6d 61 6e 61 x]] [expr {$mana
82e0: 67 65 64 4f 6e 6c 79 20 3f 20 5c 0d 0a 20 20 20 gedOnly ? \..
82f0: 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 75 69 [getBui
8300: 6c 64 45 78 74 72 61 5d 20 3a 20 22 22 7d 5d 5d ldExtra] : ""}]]
8310: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
8320: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
8330: 74 52 65 6c 65 61 73 65 56 65 72 73 69 6f 6e 20 tReleaseVersion
8340: 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 {} {.. #..
8350: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 69 67 # NOTE: Fig
8360: 75 72 65 20 6f 75 74 20 74 68 65 20 72 65 6c 65 ure out the rele
8370: 61 73 65 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 ase version for
8380: 75 73 65 20 77 69 74 68 20 74 68 65 20 62 75 69 use with the bui
8390: 6c 64 20 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 ld directory..
83a0: 20 20 20 20 23 20 20 20 20 20 20 20 77 68 65 6e # when
83b0: 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 61 76 checking for av
83c0: 61 69 6c 61 62 6c 65 20 72 65 6c 65 61 73 65 73 ailable releases
83d0: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
83e0: 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 if {[info exis
83f0: 74 73 20 3a 3a 72 65 6c 65 61 73 65 5f 76 65 72 ts ::release_ver
8400: 73 69 6f 6e 5d 20 26 26 20 5c 0d 0a 20 20 20 20 sion] && \..
8410: 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 [string le
8420: 6e 67 74 68 20 24 3a 3a 72 65 6c 65 61 73 65 5f ngth $::release_
8430: 76 65 72 73 69 6f 6e 5d 20 3e 20 30 7d 20 74 68 version] > 0} th
8440: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
8450: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
8460: 20 54 68 65 20 72 65 6c 65 61 73 65 20 76 65 72 The release ver
8470: 73 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 6f 76 sion has been ov
8480: 65 72 72 69 64 64 65 6e 3b 20 74 68 65 72 65 66 erridden; theref
8490: 6f 72 65 2c 20 75 73 65 20 69 74 0d 0a 20 20 20 ore, use it..
84a0: 20 20 20 20 20 23 20 20 20 20 20 20 20 76 65 72 # ver
84b0: 62 61 74 69 6d 2e 0d 0a 20 20 20 20 20 20 20 20 batim...
84c0: 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 #.. retur
84d0: 6e 20 24 3a 3a 72 65 6c 65 61 73 65 5f 76 65 72 n $::release_ver
84e0: 73 69 6f 6e 0d 0a 20 20 20 20 20 20 7d 20 65 6c sion.. } el
84f0: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d se {.. #.
8500: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
8510: 20 4e 6f 20 72 65 6c 65 61 73 65 20 76 65 72 73 No release vers
8520: 69 6f 6e 20 69 73 20 61 76 61 69 6c 61 62 6c 65 ion is available
8530: 2c 20 72 65 74 75 72 6e 20 61 6e 20 65 6d 70 74 , return an empt
8540: 79 20 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 20 y string...
8550: 20 20 20 23 20 20 20 20 20 20 20 49 74 20 69 73 # It is
8560: 20 69 6d 70 6f 72 74 61 6e 74 20 74 6f 20 72 65 important to re
8570: 74 75 72 6e 20 61 6e 20 65 6d 70 74 79 20 73 74 turn an empty st
8580: 72 69 6e 67 20 68 65 72 65 20 62 65 63 61 75 73 ring here becaus
8590: 65 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 e the.. #
85a0: 20 20 20 20 20 20 20 72 65 73 75 6c 74 20 6f 66 result of
85b0: 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 this procedure
85c0: 6d 61 79 20 62 65 20 75 73 65 64 20 77 69 74 68 may be used with
85d0: 20 5b 66 69 6c 65 20 6a 6f 69 6e 5d 2e 0d 0a 20 [file join]...
85e0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
85f0: 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 return ""..
8600: 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
8610: 20 20 20 20 70 72 6f 63 20 67 65 74 42 75 69 6c proc getBuil
8620: 64 46 69 6c 65 4e 61 6d 65 20 7b 20 66 69 6c 65 dFileName { file
8630: 4e 61 6d 65 20 6d 61 6e 61 67 65 64 4f 6e 6c 79 Name managedOnly
8640: 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7d {platform ""} }
8650: 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
8660: 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 # NOTE: Retur
8670: 6e 73 20 74 68 65 20 73 70 65 63 69 66 69 65 64 ns the specified
8680: 20 66 69 6c 65 20 6e 61 6d 65 20 61 73 20 69 66 file name as if
8690: 20 69 74 20 77 65 72 65 20 6c 6f 63 61 74 65 64 it were located
86a0: 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 23 in the.. #
86b0: 20 20 20 20 20 20 20 62 75 69 6c 64 20 64 69 72 build dir
86c0: 65 63 74 6f 72 79 2c 20 64 69 73 63 61 72 64 69 ectory, discardi
86d0: 6e 67 20 61 6e 79 20 64 69 72 65 63 74 6f 72 79 ng any directory
86e0: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 70 72 65 information pre
86f0: 73 65 6e 74 0d 0a 20 20 20 20 20 20 23 20 20 20 sent.. #
8700: 20 20 20 20 69 6e 20 74 68 65 20 66 69 6c 65 20 in the file
8710: 6e 61 6d 65 20 61 73 20 70 72 6f 76 69 64 65 64 name as provided
8720: 20 62 79 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d by our caller..
8730: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
8740: 73 65 74 20 72 65 73 75 6c 74 20 5b 66 69 6c 65 set result [file
8750: 20 6e 61 74 69 76 65 6e 61 6d 65 20 5c 0d 0a 20 nativename \..
8760: 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 6a [file j
8770: 6f 69 6e 20 5b 67 65 74 42 75 69 6c 64 44 69 72 oin [getBuildDir
8780: 65 63 74 6f 72 79 20 24 6d 61 6e 61 67 65 64 4f ectory $managedO
8790: 6e 6c 79 5d 20 24 70 6c 61 74 66 6f 72 6d 20 5c nly] $platform \
87a0: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c .. [fil
87b0: 65 20 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d 65 e tail $fileName
87c0: 5d 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a ]]].... #..
87d0: 20 20 20 20 20 20 23 20 48 41 43 4b 3a 20 57 68 # HACK: Wh
87e0: 65 6e 20 72 75 6e 6e 69 6e 67 20 6f 6e 20 57 6f en running on Wo
87f0: 57 36 34 2c 20 61 73 73 75 6d 65 20 74 68 65 20 W64, assume the
8800: 74 65 73 74 20 65 78 65 63 75 74 61 62 6c 65 73 test executables
8810: 20 61 72 65 20 70 72 65 73 65 6e 74 0d 0a 20 20 are present..
8820: 20 20 20 20 23 20 20 20 20 20 20 20 77 69 74 68 # with
8830: 20 74 68 65 20 22 33 32 22 20 73 75 66 66 69 78 the "32" suffix
8840: 20 6f 6e 20 74 68 65 6d 2e 0d 0a 20 20 20 20 20 on them...
8850: 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 #.. if {[i
8860: 73 52 75 6e 6e 69 6e 67 57 6f 57 36 34 5d 20 26 sRunningWoW64] &
8870: 26 20 5b 66 69 6c 65 20 65 78 74 65 6e 73 69 6f & [file extensio
8880: 6e 20 24 72 65 73 75 6c 74 5d 20 65 71 20 22 2e n $result] eq ".
8890: 65 78 65 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 exe"} then {..
88a0: 20 20 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 set result
88b0: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 66 69 [appendArgs [fi
88c0: 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 24 72 65 73 le rootname $res
88d0: 75 6c 74 5d 20 33 32 2e 65 78 65 5d 0d 0a 20 20 ult] 32.exe]..
88e0: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 }.... r
88f0: 65 74 75 72 6e 20 24 72 65 73 75 6c 74 0d 0a 20 eturn $result..
8900: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
8910: 63 20 67 65 74 45 78 74 65 72 6e 61 6c 44 69 72 c getExternalDir
8920: 65 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a 20 20 20 ectory {} {..
8930: 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
8940: 54 45 3a 20 54 68 69 73 20 70 72 6f 63 65 64 75 TE: This procedu
8950: 72 65 20 72 65 74 75 72 6e 73 20 74 68 65 20 64 re returns the d
8960: 69 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 irectory where t
8970: 68 65 20 65 78 74 65 72 6e 61 6c 20 62 69 6e 61 he external bina
8980: 72 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 ry.. #
8990: 20 20 66 69 6c 65 73 20 61 72 65 20 6c 6f 63 61 files are loca
89a0: 74 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ted... #..
89b0: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 66 69 6c return [fil
89c0: 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5c 0d 0a e nativename \..
89d0: 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
89e0: 64 69 72 6e 61 6d 65 20 5b 66 69 6c 65 20 64 69 dirname [file di
89f0: 72 6e 61 6d 65 20 5b 66 69 6c 65 20 64 69 72 6e rname [file dirn
8a00: 61 6d 65 20 5b 69 6e 66 6f 20 62 69 6e 61 72 79 ame [info binary
8a10: 5d 5d 5d 5d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d ]]]]].. }....
8a20: 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 69 6e . proc getBin
8a30: 61 72 79 44 69 72 65 63 74 6f 72 79 20 7b 7d 20 aryDirectory {}
8a40: 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
8a50: 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 # NOTE: This p
8a60: 72 6f 63 65 64 75 72 65 20 72 65 74 75 72 6e 73 rocedure returns
8a70: 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 77 the directory w
8a80: 68 65 72 65 20 74 68 65 20 74 65 73 74 20 61 70 here the test ap
8a90: 70 6c 69 63 61 74 69 6f 6e 0d 0a 20 20 20 20 20 plication..
8aa0: 20 23 20 20 20 20 20 20 20 69 74 73 65 6c 66 20 # itself
8ab0: 28 69 2e 65 2e 20 74 68 65 20 45 61 67 6c 65 20 (i.e. the Eagle
8ac0: 73 68 65 6c 6c 29 20 69 73 20 6c 6f 63 61 74 65 shell) is locate
8ad0: 64 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 62 65 d. This will be
8ae0: 20 75 73 65 64 20 61 73 0d 0a 20 20 20 20 20 20 used as..
8af0: 23 20 20 20 20 20 20 20 74 68 65 20 64 65 73 74 # the dest
8b00: 69 6e 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 ination for the
8b10: 63 6f 70 69 65 64 20 53 79 73 74 65 6d 2e 44 61 copied System.Da
8b20: 74 61 2e 53 51 4c 69 74 65 20 6e 61 74 69 76 65 ta.SQLite native
8b30: 20 61 6e 64 0d 0a 20 20 20 20 20 20 23 20 20 20 and.. #
8b40: 20 20 20 20 6d 61 6e 61 67 65 64 20 61 73 73 65 managed asse
8b50: 6d 62 6c 69 65 73 20 28 69 2e 65 2e 20 62 65 63 mblies (i.e. bec
8b60: 61 75 73 65 20 74 68 69 73 20 69 73 20 6f 6e 65 ause this is one
8b70: 20 6f 66 20 74 68 65 20 66 65 77 20 70 6c 61 63 of the few plac
8b80: 65 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 es.. #
8b90: 20 20 77 68 65 72 65 20 74 68 65 20 43 4c 52 20 where the CLR
8ba0: 77 69 6c 6c 20 61 63 74 75 61 6c 6c 79 20 66 69 will actually fi
8bb0: 6e 64 20 61 6e 64 20 6c 6f 61 64 20 74 68 65 6d nd and load them
8bc0: 20 70 72 6f 70 65 72 6c 79 29 2e 0d 0a 20 20 20 properly)...
8bd0: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
8be0: 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 62 [info exists ::b
8bf0: 69 6e 61 72 79 5f 64 69 72 65 63 74 6f 72 79 5d inary_directory]
8c00: 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
8c10: 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 [string length
8c20: 24 3a 3a 62 69 6e 61 72 79 5f 64 69 72 65 63 74 $::binary_direct
8c30: 6f 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ory] > 0} then {
8c40: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
8c50: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 # NOTE: The
8c60: 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 location of the
8c70: 20 62 69 6e 61 72 79 20 64 69 72 65 63 74 6f 72 binary director
8c80: 79 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 y has been overr
8c90: 69 64 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 idden;..
8ca0: 23 20 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 # therefor
8cb0: 65 2c 20 75 73 65 20 69 74 20 76 65 72 62 61 74 e, use it verbat
8cc0: 69 6d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a im... #..
8cd0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 return $
8ce0: 3a 3a 62 69 6e 61 72 79 5f 64 69 72 65 63 74 6f ::binary_directo
8cf0: 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 ry.. } else
8d00: 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 {.. retu
8d10: 72 6e 20 5b 69 6e 66 6f 20 62 69 6e 61 72 79 5d rn [info binary]
8d20: 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
8d30: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
8d40: 74 45 78 74 65 72 6e 61 6c 46 69 6c 65 4e 61 6d tExternalFileNam
8d50: 65 20 7b 20 66 69 6c 65 4e 61 6d 65 20 7d 20 7b e { fileName } {
8d60: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
8d70: 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e 73 # NOTE: Returns
8d80: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 66 the specified f
8d90: 69 6c 65 20 6e 61 6d 65 20 61 73 20 69 66 20 69 ile name as if i
8da0: 74 20 77 65 72 65 20 6c 6f 63 61 74 65 64 20 69 t were located i
8db0: 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 n the.. #
8dc0: 20 20 20 20 20 64 69 72 65 63 74 6f 72 79 20 63 directory c
8dd0: 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 65 78 ontaining the ex
8de0: 74 65 72 6e 61 6c 20 62 69 6e 61 72 69 65 73 2e ternal binaries.
8df0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
8e00: 20 72 65 74 75 72 6e 20 5b 66 69 6c 65 20 6e 61 return [file na
8e10: 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a tivename [file j
8e20: 6f 69 6e 20 5b 67 65 74 45 78 74 65 72 6e 61 6c oin [getExternal
8e30: 44 69 72 65 63 74 6f 72 79 5d 20 24 66 69 6c 65 Directory] $file
8e40: 4e 61 6d 65 5d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c Name]].. }...
8e50: 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 42 69 .. proc getBi
8e60: 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 7b 20 66 naryFileName { f
8e70: 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 ileName {platfor
8e80: 6d 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 m ""} } {..
8e90: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
8ea0: 3a 20 52 65 74 75 72 6e 73 20 74 68 65 20 73 70 : Returns the sp
8eb0: 65 63 69 66 69 65 64 20 66 69 6c 65 20 6e 61 6d ecified file nam
8ec0: 65 20 61 73 20 69 66 20 69 74 20 77 65 72 65 20 e as if it were
8ed0: 6c 6f 63 61 74 65 64 20 69 6e 20 74 68 65 0d 0a located in the..
8ee0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 69 # bi
8ef0: 6e 61 72 79 20 64 69 72 65 63 74 6f 72 79 2c 20 nary directory,
8f00: 64 69 73 63 61 72 64 69 6e 67 20 61 6e 79 20 64 discarding any d
8f10: 69 72 65 63 74 6f 72 79 20 69 6e 66 6f 72 6d 61 irectory informa
8f20: 74 69 6f 6e 20 70 72 65 73 65 6e 74 0d 0a 20 20 tion present..
8f30: 20 20 20 20 23 20 20 20 20 20 20 20 69 6e 20 74 # in t
8f40: 68 65 20 66 69 6c 65 20 6e 61 6d 65 20 61 73 20 he file name as
8f50: 70 72 6f 76 69 64 65 64 20 62 79 20 6f 75 72 20 provided by our
8f60: 63 61 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 23 caller... #
8f70: 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b .. return [
8f80: 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 file nativename
8f90: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 66 69 \.. [fi
8fa0: 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 42 69 6e 61 le join [getBina
8fb0: 72 79 44 69 72 65 63 74 6f 72 79 5d 20 24 70 6c ryDirectory] $pl
8fc0: 61 74 66 6f 72 6d 20 5b 66 69 6c 65 20 74 61 69 atform [file tai
8fd0: 6c 20 24 66 69 6c 65 4e 61 6d 65 5d 5d 5d 0d 0a l $fileName]]]..
8fe0: 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
8ff0: 6f 63 20 67 65 74 43 6f 72 65 42 69 6e 61 72 79 oc getCoreBinary
9000: 46 69 6c 65 4e 61 6d 65 20 7b 20 7b 70 6c 61 74 FileName { {plat
9010: 66 6f 72 6d 20 22 22 7d 20 7b 73 74 61 6e 64 61 form ""} {standa
9020: 72 64 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 rd ""} } {..
9030: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
9040: 45 3a 20 52 65 74 75 72 6e 73 20 74 68 65 20 66 E: Returns the f
9050: 75 6c 6c 20 70 61 74 68 20 66 6f 72 20 74 68 65 ull path for the
9060: 20 66 69 6c 65 20 63 6f 6e 74 61 69 6e 69 6e 67 file containing
9070: 20 74 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 the SQLite core
9080: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
9090: 6e 61 74 69 76 65 20 6c 69 62 72 61 72 79 20 63 native library c
90a0: 6f 64 65 20 66 6f 72 20 74 68 69 73 20 70 6c 61 ode for this pla
90b0: 74 66 6f 72 6d 2e 20 20 46 69 72 73 74 2c 20 63 tform. First, c
90c0: 68 65 63 6b 20 61 6e 64 20 73 65 65 20 69 66 0d heck and see if.
90d0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 . # t
90e0: 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 20 6e he SQLite core n
90f0: 61 74 69 76 65 20 6c 69 62 72 61 72 79 20 68 61 ative library ha
9100: 73 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 6c s already been l
9110: 6f 61 64 65 64 2e 20 20 4e 65 78 74 2c 0d 0a 20 oaded. Next,..
9120: 20 20 20 20 20 23 20 20 20 20 20 20 20 66 61 6c # fal
9130: 6c 62 61 63 6b 20 74 6f 20 77 68 61 74 20 74 68 lback to what th
9140: 65 20 66 75 6c 6c 20 70 61 74 68 20 73 68 6f 75 e full path shou
9150: 6c 64 20 62 65 2c 20 62 61 73 65 64 20 6f 6e 20 ld be, based on
9160: 77 68 65 74 68 65 72 20 74 68 65 0d 0a 20 20 20 whether the..
9170: 20 20 20 23 20 20 20 20 20 20 20 6d 69 78 65 64 # mixed
9180: 2d 6d 6f 64 65 20 61 73 73 65 6d 62 6c 79 20 69 -mode assembly i
9190: 73 20 62 65 69 6e 67 20 75 73 65 64 20 61 6e 64 s being used and
91a0: 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 the name of the
91b0: 20 63 75 72 72 65 6e 74 0d 0a 20 20 20 20 20 20 current..
91c0: 23 20 20 20 20 20 20 20 70 6c 61 74 66 6f 72 6d # platform
91d0: 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
91e0: 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
91f0: 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 object i
9200: 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f nvoke -flags +No
9210: 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 nPublic \..
9220: 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 System.Da
9230: 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 ta.SQLite.Unsafe
9240: 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 20 5f 53 NativeMethods _S
9250: 51 4c 69 74 65 4e 61 74 69 76 65 4d 6f 64 75 6c QLiteNativeModul
9260: 65 46 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 eFileName..
9270: 20 7d 20 66 69 6c 65 4e 61 6d 65 5d 20 3d 3d 20 } fileName] ==
9280: 30 20 26 26 20 5b 73 74 72 69 6e 67 20 6c 65 6e 0 && [string len
9290: 67 74 68 20 24 66 69 6c 65 4e 61 6d 65 5d 20 3e gth $fileName] >
92a0: 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
92b0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
92c0: 20 4e 4f 54 45 3a 20 54 68 65 20 53 51 4c 69 74 NOTE: The SQLit
92d0: 65 20 63 6f 72 65 20 6e 61 74 69 76 65 20 6c 69 e core native li
92e0: 62 72 61 72 79 20 68 61 73 20 61 6c 72 65 61 64 brary has alread
92f0: 79 20 62 65 65 6e 20 6c 6f 61 64 65 64 20 76 69 y been loaded vi
9300: 61 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 a.. #
9310: 20 20 20 74 68 65 20 6e 61 74 69 76 65 20 6c 69 the native li
9320: 62 72 61 72 79 20 70 72 65 2d 6c 6f 61 64 65 72 brary pre-loader
9330: 2e 20 20 52 65 74 75 72 6e 20 74 68 61 74 20 66 . Return that f
9340: 69 6c 65 20 6e 61 6d 65 20 6e 6f 77 2e 0d 0a 20 ile name now...
9350: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
9360: 20 20 72 65 74 75 72 6e 20 24 66 69 6c 65 4e 61 return $fileNa
9370: 6d 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 me.. }....
9380: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
9390: 4e 4f 54 45 3a 20 49 66 20 74 68 65 20 22 6e 61 NOTE: If the "na
93a0: 74 69 76 65 22 20 72 75 6e 74 69 6d 65 20 6f 70 tive" runtime op
93b0: 74 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 73 65 tion has been se
93c0: 74 2c 20 61 6c 77 61 79 73 20 72 65 74 75 72 6e t, always return
93d0: 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 the.. #
93e0: 20 20 20 20 66 69 6c 65 20 6e 61 6d 65 20 66 6f file name fo
93f0: 72 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 r the mixed-mode
9400: 20 61 73 73 65 6d 62 6c 79 2e 0d 0a 20 20 20 20 assembly...
9410: 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
9420: 68 61 73 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e hasRuntimeOption
9430: 20 6e 61 74 69 76 65 5d 7d 20 74 68 65 6e 20 7b native]} then {
9440: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
9450: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 # NOTE: Ret
9460: 75 72 6e 20 74 68 65 20 6d 69 78 65 64 2d 6d 6f urn the mixed-mo
9470: 64 65 20 61 73 73 65 6d 62 6c 79 20 66 69 6c 65 de assembly file
9480: 20 6e 61 6d 65 2e 0d 0a 20 20 20 20 20 20 20 20 name...
9490: 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 #.. retur
94a0: 6e 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 n [file nativena
94b0: 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 me \..
94c0: 20 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 [file join [ge
94d0: 74 42 69 6e 61 72 79 44 69 72 65 63 74 6f 72 79 tBinaryDirectory
94e0: 5d 20 24 70 6c 61 74 66 6f 72 6d 20 53 79 73 74 ] $platform Syst
94f0: 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 em.Data.SQLite.d
9500: 6c 6c 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d ll]].. }...
9510: 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
9520: 23 20 4e 4f 54 45 3a 20 41 72 65 20 77 65 20 61 # NOTE: Are we a
9530: 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 61 75 74 ttempting to aut
9540: 6f 6d 61 74 69 63 61 6c 6c 79 20 64 65 74 65 63 omatically detec
9550: 74 20 77 68 65 74 68 65 72 20 6f 72 20 6e 6f 74 t whether or not
9560: 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 the.. #
9570: 20 20 20 20 69 6e 74 65 72 6f 70 20 61 73 73 65 interop asse
9580: 6d 62 6c 79 20 73 68 6f 75 6c 64 20 62 65 20 75 mbly should be u
9590: 73 65 64 3f 0d 0a 20 20 20 20 20 20 23 0d 0a 20 sed?.. #..
95a0: 20 20 20 20 20 73 65 74 20 61 75 74 6f 6d 61 74 set automat
95b0: 69 63 20 5b 65 78 70 72 20 7b 5b 73 74 72 69 6e ic [expr {[strin
95c0: 67 20 6c 65 6e 67 74 68 20 24 73 74 61 6e 64 61 g length $standa
95d0: 72 64 5d 20 3d 3d 20 30 7d 5d 0d 0a 0d 0a 20 20 rd] == 0}]....
95e0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
95f0: 4f 54 45 3a 20 46 69 72 73 74 2c 20 69 6e 20 65 OTE: First, in e
9600: 69 74 68 65 72 20 22 61 75 74 6f 6d 61 74 69 63 ither "automatic
9610: 22 20 6f 72 20 22 6e 6f 6e 2d 73 74 61 6e 64 61 " or "non-standa
9620: 72 64 22 20 6d 6f 64 65 73 2c 20 61 74 74 65 6d rd" modes, attem
9630: 70 74 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 pt.. #
9640: 20 20 74 6f 20 66 69 6e 64 20 74 68 65 20 6e 61 to find the na
9650: 74 69 76 65 2d 6f 6e 6c 79 20 69 6e 74 65 72 6f tive-only intero
9660: 70 20 61 73 73 65 6d 62 6c 79 2e 0d 0a 20 20 20 p assembly...
9670: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
9680: 24 61 75 74 6f 6d 61 74 69 63 20 7c 7c 20 21 24 $automatic || !$
9690: 73 74 61 6e 64 61 72 64 7d 20 74 68 65 6e 20 7b standard} then {
96a0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
96b0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 # NOTE: Att
96c0: 65 6d 70 74 20 74 6f 20 64 65 74 65 72 6d 69 6e empt to determin
96d0: 65 20 74 68 65 20 6e 61 74 69 76 65 2d 6f 6e 6c e the native-onl
96e0: 79 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 y interop assemb
96f0: 6c 79 20 66 69 6c 65 0d 0a 20 20 20 20 20 20 20 ly file..
9700: 20 23 20 20 20 20 20 20 20 6e 61 6d 65 20 66 6f # name fo
9710: 72 20 74 68 69 73 20 70 6c 61 74 66 6f 72 6d 20 r this platform
9720: 61 6e 64 20 74 68 65 6e 20 72 65 74 75 72 6e 20 and then return
9730: 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a it... #..
9740: 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
9750: 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 5b 67 65 fileNameOnly [ge
9760: 74 49 6e 74 65 72 6f 70 41 73 73 65 6d 62 6c 79 tInteropAssembly
9770: 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d 20 7b FileNamesOnly] {
9780: 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
9790: 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6e fileName [file n
97a0: 61 74 69 76 65 6e 61 6d 65 20 5c 0d 0a 20 20 20 ativename \..
97b0: 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 [file
97c0: 20 6a 6f 69 6e 20 5b 67 65 74 42 69 6e 61 72 79 join [getBinary
97d0: 44 69 72 65 63 74 6f 72 79 5d 20 24 70 6c 61 74 Directory] $plat
97e0: 66 6f 72 6d 20 24 66 69 6c 65 4e 61 6d 65 4f 6e form $fileNameOn
97f0: 6c 79 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ly]]....
9800: 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 if {[file exis
9810: 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 ts $fileName]} t
9820: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
9830: 20 20 20 72 65 74 75 72 6e 20 24 66 69 6c 65 4e return $fileN
9840: 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d ame.. }
9850: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
9860: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
9870: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 . # NOTE: T
9880: 68 65 6e 2c 20 69 6e 20 65 69 74 68 65 72 20 22 hen, in either "
9890: 61 75 74 6f 6d 61 74 69 63 22 20 6f 72 20 22 73 automatic" or "s
98a0: 74 61 6e 64 61 72 64 22 20 6d 6f 64 65 73 2c 20 tandard" modes,
98b0: 61 74 74 65 6d 70 74 20 74 6f 0d 0a 20 20 20 20 attempt to..
98c0: 20 20 23 20 20 20 20 20 20 20 66 69 6e 64 20 74 # find t
98d0: 68 65 20 73 74 61 6e 64 61 72 64 20 53 51 4c 69 he standard SQLi
98e0: 74 65 20 6c 69 62 72 61 72 79 2e 0d 0a 20 20 20 te library...
98f0: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
9900: 24 61 75 74 6f 6d 61 74 69 63 20 7c 7c 20 24 73 $automatic || $s
9910: 74 61 6e 64 61 72 64 7d 20 74 68 65 6e 20 7b 0d tandard} then {.
9920: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
9930: 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 # NOTE: Atte
9940: 6d 70 74 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 mpt to determine
9950: 20 74 68 65 20 6e 61 74 69 76 65 2d 6f 6e 6c 79 the native-only
9960: 20 73 74 61 6e 64 61 72 64 20 53 51 4c 69 74 65 standard SQLite
9970: 20 6c 69 62 72 61 72 79 0d 0a 20 20 20 20 20 20 library..
9980: 20 20 23 20 20 20 20 20 20 20 66 69 6c 65 20 6e # file n
9990: 61 6d 65 20 66 6f 72 20 74 68 69 73 20 70 6c 61 ame for this pla
99a0: 74 66 6f 72 6d 20 61 6e 64 20 74 68 65 6e 20 72 tform and then r
99b0: 65 74 75 72 6e 20 69 74 2e 0d 0a 20 20 20 20 20 eturn it...
99c0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 66 6f #.. fo
99d0: 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 4f 6e reach fileNameOn
99e0: 6c 79 20 5b 67 65 74 4e 61 74 69 76 65 4c 69 62 ly [getNativeLib
99f0: 72 61 72 79 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c raryFileNamesOnl
9a00: 79 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 y] {..
9a10: 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 set fileName [fi
9a20: 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5c 0d le nativename \.
9a30: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b . [
9a40: 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 42 69 file join [getBi
9a50: 6e 61 72 79 44 69 72 65 63 74 6f 72 79 5d 20 24 naryDirectory] $
9a60: 70 6c 61 74 66 6f 72 6d 20 24 66 69 6c 65 4e 61 platform $fileNa
9a70: 6d 65 4f 6e 6c 79 5d 5d 0d 0a 0d 0a 20 20 20 20 meOnly]]....
9a80: 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 if {[file
9a90: 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 exists $fileName
9aa0: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
9ab0: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 66 return $f
9ac0: 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 ileName..
9ad0: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
9ae0: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
9af0: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
9b00: 45 3a 20 57 61 73 20 74 68 65 20 6d 61 6e 61 67 E: Was the manag
9b10: 65 64 20 61 73 73 65 6d 62 6c 79 20 63 6f 6d 70 ed assembly comp
9b20: 69 6c 65 64 20 65 78 70 65 63 74 69 6e 67 20 74 iled expecting t
9b30: 6f 20 64 65 61 6c 20 77 69 74 68 20 74 68 65 0d o deal with the.
9b40: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 . # s
9b50: 74 61 6e 64 61 72 64 20 63 6f 72 65 20 6c 69 62 tandard core lib
9b60: 72 61 72 79 3f 0d 0a 20 20 20 20 20 20 23 0d 0a rary?.. #..
9b70: 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 if {[haveS
9b80: 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 QLiteDefineConst
9b90: 61 6e 74 20 53 51 4c 49 54 45 5f 53 54 41 4e 44 ant SQLITE_STAND
9ba0: 41 52 44 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ARD]} then {..
9bb0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
9bc0: 20 23 20 4e 4f 54 45 3a 20 46 61 6c 6c 62 61 63 # NOTE: Fallbac
9bd0: 6b 20 74 6f 20 72 65 74 75 72 6e 69 6e 67 20 74 k to returning t
9be0: 68 65 20 6e 61 74 69 76 65 2d 6f 6e 6c 79 20 73 he native-only s
9bf0: 74 61 6e 64 61 72 64 20 53 51 4c 69 74 65 20 6c tandard SQLite l
9c00: 69 62 72 61 72 79 0d 0a 20 20 20 20 20 20 20 20 ibrary..
9c10: 23 20 20 20 20 20 20 20 66 69 6c 65 20 6e 61 6d # file nam
9c20: 65 20 66 6f 72 20 74 68 65 20 70 6c 61 74 66 6f e for the platfo
9c30: 72 6d 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a rm... #..
9c40: 20 20 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 set file
9c50: 4e 61 6d 65 73 4f 6e 6c 79 20 5b 67 65 74 4e 61 NamesOnly [getNa
9c60: 74 69 76 65 4c 69 62 72 61 72 79 46 69 6c 65 4e tiveLibraryFileN
9c70: 61 6d 65 73 4f 6e 6c 79 5d 0d 0a 0d 0a 20 20 20 amesOnly]....
9c80: 20 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 if {[llengt
9c90: 68 20 24 66 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 h $fileNamesOnly
9ca0: 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
9cb0: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e return
9cc0: 20 22 22 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a "".. }..
9cd0: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
9ce0: 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d [file nativenam
9cf0: 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a e [file join \..
9d00: 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
9d10: 42 69 6e 61 72 79 44 69 72 65 63 74 6f 72 79 5d BinaryDirectory]
9d20: 20 24 70 6c 61 74 66 6f 72 6d 20 5b 6c 69 6e 64 $platform [lind
9d30: 65 78 20 24 66 69 6c 65 4e 61 6d 65 73 4f 6e 6c ex $fileNamesOnl
9d40: 79 20 30 5d 5d 5d 0d 0a 20 20 20 20 20 20 7d 20 y 0]]].. }
9d50: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
9d60: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
9d70: 45 3a 20 46 61 6c 6c 62 61 63 6b 20 74 6f 20 72 E: Fallback to r
9d80: 65 74 75 72 6e 69 6e 67 20 74 68 65 20 6e 61 74 eturning the nat
9d90: 69 76 65 2d 6f 6e 6c 79 20 69 6e 74 65 72 6f 70 ive-only interop
9da0: 20 61 73 73 65 6d 62 6c 79 20 66 69 6c 65 0d 0a assembly file..
9db0: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
9dc0: 6e 61 6d 65 20 66 6f 72 20 74 68 65 20 70 6c 61 name for the pla
9dd0: 74 66 6f 72 6d 2e 0d 0a 20 20 20 20 20 20 20 20 tform...
9de0: 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 66 #.. set f
9df0: 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 20 5b 67 65 ileNamesOnly [ge
9e00: 74 49 6e 74 65 72 6f 70 41 73 73 65 6d 62 6c 79 tInteropAssembly
9e10: 46 69 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d 0d 0a FileNamesOnly]..
9e20: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 6c .. if {[l
9e30: 6c 65 6e 67 74 68 20 24 66 69 6c 65 4e 61 6d 65 length $fileName
9e40: 73 4f 6e 6c 79 5d 20 3d 3d 20 30 7d 20 74 68 65 sOnly] == 0} the
9e50: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 72 n {.. r
9e60: 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 20 20 eturn ""..
9e70: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 72 }.... r
9e80: 65 74 75 72 6e 20 5b 66 69 6c 65 20 6e 61 74 69 eturn [file nati
9e90: 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 vename [file joi
9ea0: 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n \..
9eb0: 20 5b 67 65 74 42 69 6e 61 72 79 44 69 72 65 63 [getBinaryDirec
9ec0: 74 6f 72 79 5d 20 24 70 6c 61 74 66 6f 72 6d 20 tory] $platform
9ed0: 5b 6c 69 6e 64 65 78 20 24 66 69 6c 65 4e 61 6d [lindex $fileNam
9ee0: 65 73 4f 6e 6c 79 20 30 5d 5d 5d 0d 0a 20 20 20 esOnly 0]]]..
9ef0: 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
9f00: 20 20 20 20 70 72 6f 63 20 67 65 74 43 6f 6d 6d proc getComm
9f10: 6f 6e 44 69 72 65 63 74 6f 72 79 20 7b 7d 20 7b onDirectory {} {
9f20: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
9f30: 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 # NOTE: This pr
9f40: 6f 63 65 64 75 72 65 20 72 65 74 75 72 6e 73 20 ocedure returns
9f50: 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 the directory wh
9f60: 65 72 65 20 74 68 65 20 74 65 73 74 20 73 63 72 ere the test scr
9f70: 69 70 74 73 0d 0a 20 20 20 20 20 20 23 20 20 20 ipts.. #
9f80: 20 20 20 20 73 68 6f 75 6c 64 20 62 65 20 6c 6f should be lo
9f90: 63 61 74 65 64 2e 20 20 42 79 20 64 65 66 61 75 cated. By defau
9fa0: 6c 74 2c 20 74 68 69 73 20 6a 75 73 74 20 72 65 lt, this just re
9fb0: 74 75 72 6e 73 20 74 68 65 20 45 61 67 6c 65 0d turns the Eagle.
9fc0: 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 . # b
9fd0: 69 6e 61 72 79 20 64 69 72 65 63 74 6f 72 79 2e inary directory.
9fe0: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
9ff0: 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
a000: 73 20 3a 3a 63 6f 6d 6d 6f 6e 5f 64 69 72 65 63 s ::common_direc
a010: 74 6f 72 79 5d 20 26 26 20 5c 0d 0a 20 20 20 20 tory] && \..
a020: 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 [string le
a030: 6e 67 74 68 20 24 3a 3a 63 6f 6d 6d 6f 6e 5f 64 ngth $::common_d
a040: 69 72 65 63 74 6f 72 79 5d 20 3e 20 30 7d 20 74 irectory] > 0} t
a050: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
a060: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
a070: 3a 20 54 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f : The location o
a080: 66 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 64 69 72 f the common dir
a090: 65 63 74 6f 72 79 20 68 61 73 20 62 65 65 6e 20 ectory has been
a0a0: 73 65 74 3b 0d 0a 20 20 20 20 20 20 20 20 23 20 set;.. #
a0b0: 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 2c therefore,
a0c0: 20 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 use it...
a0d0: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
a0e0: 75 72 6e 20 24 3a 3a 63 6f 6d 6d 6f 6e 5f 64 69 urn $::common_di
a0f0: 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 7d rectory.. }
a100: 20 65 6c 73 65 69 66 20 7b 5b 69 6e 66 6f 20 65 elseif {[info e
a110: 78 69 73 74 73 20 3a 3a 76 65 6e 64 6f 72 5f 64 xists ::vendor_d
a120: 69 72 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d 0a irectory] && \..
a130: 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e [strin
a140: 67 20 6c 65 6e 67 74 68 20 24 3a 3a 76 65 6e 64 g length $::vend
a150: 6f 72 5f 64 69 72 65 63 74 6f 72 79 5d 20 3e 20 or_directory] >
a160: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
a170: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
a180: 4e 4f 54 45 3a 20 54 68 65 20 6c 6f 63 61 74 69 NOTE: The locati
a190: 6f 6e 20 6f 66 20 74 68 65 20 76 65 6e 64 6f 72 on of the vendor
a1a0: 20 64 69 72 65 63 74 6f 72 79 20 68 61 73 20 62 directory has b
a1b0: 65 65 6e 20 73 65 74 3b 0d 0a 20 20 20 20 20 20 een set;..
a1c0: 20 20 23 20 20 20 20 20 20 20 74 68 65 72 65 66 # theref
a1d0: 6f 72 65 2c 20 75 73 65 20 69 74 2e 0d 0a 20 20 ore, use it...
a1e0: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
a1f0: 20 72 65 74 75 72 6e 20 24 3a 3a 76 65 6e 64 6f return $::vendo
a200: 72 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 r_directory..
a210: 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 6e } elseif {[in
a220: 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 63 6c 5f fo exists ::tcl_
a230: 6c 69 62 72 61 72 79 5d 20 26 26 20 5c 0d 0a 20 library] && \..
a240: 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 [string
a250: 20 6c 65 6e 67 74 68 20 24 3a 3a 74 63 6c 5f 6c length $::tcl_l
a260: 69 62 72 61 72 79 5d 20 3e 20 30 20 26 26 20 5c ibrary] > 0 && \
a270: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c .. [fil
a280: 65 20 69 73 64 69 72 65 63 74 6f 72 79 20 24 3a e isdirectory $:
a290: 3a 74 63 6c 5f 6c 69 62 72 61 72 79 5d 7d 20 74 :tcl_library]} t
a2a0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 hen {.. #
a2b0: 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
a2c0: 3a 20 54 68 65 20 76 61 72 69 61 62 6c 65 20 77 : The variable w
a2d0: 69 74 68 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e ith the location
a2e0: 20 6f 66 20 74 68 65 20 73 63 72 69 70 74 20 6c of the script l
a2f0: 69 62 72 61 72 79 20 69 73 0d 0a 20 20 20 20 20 ibrary is..
a300: 20 20 20 23 20 20 20 20 20 20 20 73 65 74 20 61 # set a
a310: 6e 64 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 nd appears to be
a320: 20 61 20 72 65 61 6c 20 64 69 72 65 63 74 6f 72 a real director
a330: 79 20 28 69 2e 65 2e 20 6e 6f 74 20 65 6d 62 65 y (i.e. not embe
a340: 64 64 65 64 0d 0a 20 20 20 20 20 20 20 20 23 20 dded.. #
a350: 20 20 20 20 20 20 77 69 74 68 69 6e 20 61 20 66 within a f
a360: 69 6c 65 29 3b 20 74 68 65 72 65 66 6f 72 65 2c ile); therefore,
a370: 20 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 20 20 use it...
a380: 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
a390: 75 72 6e 20 24 3a 3a 74 63 6c 5f 6c 69 62 72 61 urn $::tcl_libra
a3a0: 72 79 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 ry.. } else
a3b0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
a3c0: 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 # NOTE: F
a3d0: 61 6c 6c 62 61 63 6b 20 74 6f 20 74 68 65 20 64 allback to the d
a3e0: 69 72 65 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e irectory contain
a3f0: 69 6e 67 20 74 68 65 20 65 78 65 63 75 74 61 62 ing the executab
a400: 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a le... #..
a410: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b return [
a420: 69 6e 66 6f 20 62 69 6e 61 72 79 5d 0d 0a 20 20 info binary]..
a430: 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
a440: 0a 20 20 20 20 70 72 6f 63 20 67 65 74 44 61 74 . proc getDat
a450: 61 62 61 73 65 44 69 72 65 63 74 6f 72 79 20 7b abaseDirectory {
a460: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
a470: 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 # NOTE: This
a480: 20 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 72 procedure retur
a490: 6e 73 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 ns the directory
a4a0: 20 77 68 65 72 65 20 74 68 65 20 74 65 73 74 20 where the test
a4b0: 64 61 74 61 62 61 73 65 73 0d 0a 20 20 20 20 20 databases..
a4c0: 20 23 20 20 20 20 20 20 20 73 68 6f 75 6c 64 20 # should
a4d0: 62 65 20 6c 6f 63 61 74 65 64 2e 20 20 42 79 20 be located. By
a4e0: 64 65 66 61 75 6c 74 2c 20 74 68 69 73 20 6a 75 default, this ju
a4f0: 73 74 20 75 73 65 73 20 74 68 65 20 74 65 6d 70 st uses the temp
a500: 6f 72 61 72 79 0d 0a 20 20 20 20 20 20 23 20 20 orary.. #
a510: 20 20 20 20 20 64 69 72 65 63 74 6f 72 79 20 63 directory c
a520: 6f 6e 66 69 67 75 72 65 64 20 66 6f 72 20 74 68 onfigured for th
a530: 69 73 20 73 79 73 74 65 6d 2e 0d 0a 20 20 20 20 is system...
a540: 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
a550: 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 64 61 info exists ::da
a560: 74 61 62 61 73 65 5f 64 69 72 65 63 74 6f 72 79 tabase_directory
a570: 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] && \..
a580: 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
a590: 20 24 3a 3a 64 61 74 61 62 61 73 65 5f 64 69 72 $::database_dir
a5a0: 65 63 74 6f 72 79 5d 20 3e 20 30 7d 20 74 68 65 ectory] > 0} the
a5b0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
a5c0: 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
a5d0: 54 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 The location of
a5e0: 74 68 65 20 64 61 74 61 62 61 73 65 20 64 69 72 the database dir
a5f0: 65 63 74 6f 72 79 20 68 61 73 20 62 65 65 6e 20 ectory has been
a600: 6f 76 65 72 72 69 64 64 65 6e 3b 0d 0a 20 20 20 overridden;..
a610: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 # the
a620: 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 2e 0d refore, use it..
a630: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
a640: 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 64 61 return $::da
a650: 74 61 62 61 73 65 5f 64 69 72 65 63 74 6f 72 79 tabase_directory
a660: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 69 66 .. } elseif
a670: 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {[info exists :
a680: 3a 73 63 72 61 74 63 68 5f 64 69 72 65 63 74 6f :scratch_directo
a690: 72 79 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 ry] && \..
a6a0: 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 [string leng
a6b0: 74 68 20 24 3a 3a 73 63 72 61 74 63 68 5f 64 69 th $::scratch_di
a6c0: 72 65 63 74 6f 72 79 5d 20 3e 20 30 7d 20 74 68 rectory] > 0} th
a6d0: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d en {.. #.
a6e0: 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
a6f0: 20 54 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 The location of
a700: 20 74 68 65 20 73 63 72 61 74 63 68 20 64 69 72 the scratch dir
a710: 65 63 74 6f 72 79 20 68 61 73 20 62 65 65 6e 20 ectory has been
a720: 6f 76 65 72 72 69 64 64 65 6e 3b 0d 0a 20 20 20 overridden;..
a730: 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 # the
a740: 72 65 66 6f 72 65 2c 20 75 73 65 20 69 74 2e 0d refore, use it..
a750: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
a760: 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a 73 63 return $::sc
a770: 72 61 74 63 68 5f 64 69 72 65 63 74 6f 72 79 0d ratch_directory.
a780: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
a790: 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 . return
a7a0: 5b 67 65 74 54 65 6d 70 6f 72 61 72 79 50 61 74 [getTemporaryPat
a7b0: 68 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 h].. }..
a7c0: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
a7d0: 67 65 74 54 65 6d 70 6f 72 61 72 79 44 69 72 65 getTemporaryDire
a7e0: 63 74 6f 72 79 20 7b 7d 20 7b 0d 0a 20 20 20 20 ctory {} {..
a7f0: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
a800: 45 3a 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 E: This procedur
a810: 65 20 72 65 74 75 72 6e 73 20 74 68 65 20 64 69 e returns the di
a820: 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 68 rectory where th
a830: 65 20 74 65 6d 70 6f 72 61 72 79 20 66 69 6c 65 e temporary file
a840: 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 s.. #
a850: 20 73 68 6f 75 6c 64 20 62 65 20 6c 6f 63 61 74 should be locat
a860: 65 64 2e 20 20 42 79 20 64 65 66 61 75 6c 74 2c ed. By default,
a870: 20 74 68 69 73 20 6a 75 73 74 20 75 73 65 73 20 this just uses
a880: 74 68 65 20 74 65 6d 70 6f 72 61 72 79 0d 0a 20 the temporary..
a890: 20 20 20 20 20 23 20 20 20 20 20 20 20 64 69 72 # dir
a8a0: 65 63 74 6f 72 79 20 63 6f 6e 66 69 67 75 72 65 ectory configure
a8b0: 64 20 66 6f 72 20 74 68 69 73 20 73 79 73 74 65 d for this syste
a8c0: 6d 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 m... #..
a8d0: 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 if {[info exi
a8e0: 73 74 73 20 3a 3a 74 65 6d 70 6f 72 61 72 79 5f sts ::temporary_
a8f0: 64 69 72 65 63 74 6f 72 79 5d 20 26 26 20 5c 0d directory] && \.
a900: 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 . [stri
a910: 6e 67 20 6c 65 6e 67 74 68 20 24 3a 3a 74 65 6d ng length $::tem
a920: 70 6f 72 61 72 79 5f 64 69 72 65 63 74 6f 72 79 porary_directory
a930: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
a940: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
a950: 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6c 6f # NOTE: The lo
a960: 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 74 65 cation of the te
a970: 6d 70 6f 72 61 72 79 20 64 69 72 65 63 74 6f 72 mporary director
a980: 79 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 72 y has been overr
a990: 69 64 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 20 idden;..
a9a0: 23 20 20 20 20 20 20 20 74 68 65 72 65 66 6f 72 # therefor
a9b0: 65 2c 20 75 73 65 20 69 74 2e 0d 0a 20 20 20 20 e, use it...
a9c0: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 #.. r
a9d0: 65 74 75 72 6e 20 24 3a 3a 74 65 6d 70 6f 72 61 eturn $::tempora
a9e0: 72 79 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 ry_directory..
a9f0: 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 } elseif {[i
aa00: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 73 63 72 nfo exists ::scr
aa10: 61 74 63 68 5f 64 69 72 65 63 74 6f 72 79 5d 20 atch_directory]
aa20: 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
aa30: 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
aa40: 3a 3a 73 63 72 61 74 63 68 5f 64 69 72 65 63 74 ::scratch_direct
aa50: 6f 72 79 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ory] > 0} then {
aa60: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
aa70: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 65 # NOTE: The
aa80: 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 location of the
aa90: 20 73 63 72 61 74 63 68 20 64 69 72 65 63 74 6f scratch directo
aaa0: 72 79 20 68 61 73 20 62 65 65 6e 20 6f 76 65 72 ry has been over
aab0: 72 69 64 64 65 6e 3b 0d 0a 20 20 20 20 20 20 20 ridden;..
aac0: 20 23 20 20 20 20 20 20 20 74 68 65 72 65 66 6f # therefo
aad0: 72 65 2c 20 75 73 65 20 69 74 2e 0d 0a 20 20 20 re, use it...
aae0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
aaf0: 72 65 74 75 72 6e 20 24 3a 3a 73 63 72 61 74 63 return $::scratc
ab00: 68 5f 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 h_directory..
ab10: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
ab20: 20 20 20 20 20 72 65 74 75 72 6e 20 5b 67 65 74 return [get
ab30: 54 65 6d 70 6f 72 61 72 79 50 61 74 68 5d 0d 0a TemporaryPath]..
ab40: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
ab50: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 45 ... proc getE
ab60: 78 65 63 75 74 65 4f 6e 53 65 74 75 70 20 7b 7d xecuteOnSetup {}
ab70: 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 {.. if {[i
ab80: 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 65 78 65 nfo exists ::exe
ab90: 63 75 74 65 5f 6f 6e 5f 73 65 74 75 70 5d 20 26 cute_on_setup] &
aba0: 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b & \.. [
abb0: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 3a string length $:
abc0: 3a 65 78 65 63 75 74 65 5f 6f 6e 5f 73 65 74 75 :execute_on_setu
abd0: 70 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a p] > 0} then {..
abe0: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
abf0: 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 # NOTE: Retur
ac00: 6e 20 74 68 65 20 63 6f 6e 66 69 67 75 72 65 64 n the configured
ac10: 20 53 51 4c 20 74 6f 20 65 78 65 63 75 74 65 20 SQL to execute
ac20: 64 75 72 69 6e 67 20 74 68 65 20 63 6f 6e 6e 65 during the conne
ac30: 63 74 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 23 ction.. #
ac40: 20 20 20 20 20 20 20 73 65 74 75 70 20 70 72 6f setup pro
ac50: 63 65 64 75 72 65 20 28 69 2e 65 2e 20 66 6f 72 cedure (i.e. for
ac60: 20 65 76 65 72 79 20 74 65 73 74 20 64 61 74 61 every test data
ac70: 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 29 base connection)
ac80: 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
ac90: 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 3a 3a return $::
aca0: 65 78 65 63 75 74 65 5f 6f 6e 5f 73 65 74 75 70 execute_on_setup
acb0: 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b .. } else {
acc0: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
acd0: 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 79 20 # NOTE: By
ace0: 64 65 66 61 75 6c 74 2c 20 74 68 65 72 65 20 69 default, there i
acf0: 73 20 6e 6f 20 53 51 4c 20 74 6f 20 65 78 65 63 s no SQL to exec
ad00: 75 74 65 20 64 75 72 69 6e 67 20 74 68 65 20 63 ute during the c
ad10: 6f 6e 6e 65 63 74 69 6f 6e 0d 0a 20 20 20 20 20 onnection..
ad20: 20 20 20 23 20 20 20 20 20 20 20 73 65 74 75 70 # setup
ad30: 20 70 72 6f 63 65 64 75 72 65 20 28 69 2e 65 2e procedure (i.e.
ad40: 20 66 6f 72 20 65 76 65 72 79 20 74 65 73 74 20 for every test
ad50: 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 database connect
ad60: 69 6f 6e 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 ion)... #
ad70: 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .. return
ad80: 20 22 22 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 "".. }..
ad90: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
ada0: 20 67 65 74 53 74 72 69 6e 67 4d 61 70 46 6f 72 getStringMapFor
adb0: 54 63 6c 45 73 63 61 70 65 20 7b 7d 20 7b 0d 0a TclEscape {} {..
adc0: 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 return [li
add0: 73 74 20 5c 5c 20 5c 5c 5c 5c 20 5c 5b 20 5c 5c st \\ \\\\ \[ \\
ade0: 5c 5b 20 5c 5d 20 5c 5c 5c 5d 20 5c 24 20 5c 5c \[ \] \\\] \$ \\
adf0: 5c 24 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 \$].. }.....
ae00: 20 20 20 70 72 6f 63 20 67 65 74 54 65 73 74 4f proc getTestO
ae10: 76 65 72 72 69 64 65 73 50 72 65 61 6d 62 6c 65 verridesPreamble
ae20: 20 7b 20 7b 65 78 74 72 61 56 61 72 4e 61 6d 65 { {extraVarName
ae30: 73 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 s ""} } {..
ae40: 20 73 65 74 20 76 61 72 4e 61 6d 65 73 20 5b 6c set varNames [l
ae50: 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d ist].... #.
ae60: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 . # NOTE: I
ae70: 66 20 61 76 61 69 6c 61 62 6c 65 2c 20 73 74 61 f available, sta
ae80: 72 74 20 77 69 74 68 20 74 68 65 20 6d 61 73 74 rt with the mast
ae90: 65 72 20 6c 69 73 74 20 6f 66 20 74 65 73 74 20 er list of test
aea0: 6f 76 65 72 72 69 64 65 0d 0a 20 20 20 20 20 20 override..
aeb0: 23 20 20 20 20 20 20 20 76 61 72 69 61 62 6c 65 # variable
aec0: 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 s... #..
aed0: 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 if {[info exi
aee0: 73 74 73 20 3a 3a 74 65 73 74 5f 6f 76 65 72 72 sts ::test_overr
aef0: 69 64 65 73 5d 20 26 26 20 5c 0d 0a 20 20 20 20 ides] && \..
af00: 20 20 20 20 20 20 5b 6c 6c 65 6e 67 74 68 20 24 [llength $
af10: 3a 3a 74 65 73 74 5f 6f 76 65 72 72 69 64 65 73 ::test_overrides
af20: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
af30: 20 20 20 20 20 20 20 65 76 61 6c 20 6c 61 70 70 eval lapp
af40: 65 6e 64 20 76 61 72 4e 61 6d 65 73 20 24 3a 3a end varNames $::
af50: 74 65 73 74 5f 6f 76 65 72 72 69 64 65 73 0d 0a test_overrides..
af60: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
af70: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
af80: 3a 20 49 66 20 72 65 71 75 65 73 74 65 64 20 62 : If requested b
af90: 79 20 6f 75 72 20 63 61 6c 6c 65 72 2c 20 61 64 y our caller, ad
afa0: 64 20 61 6e 79 20 61 64 64 69 74 69 6f 6e 61 6c d any additional
afb0: 20 76 61 72 69 61 62 6c 65 0d 0a 20 20 20 20 20 variable..
afc0: 20 23 20 20 20 20 20 20 20 6e 61 6d 65 73 20 74 # names t
afd0: 6f 20 63 6f 70 79 20 6e 6f 77 2e 0d 0a 20 20 20 o copy now...
afe0: 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
aff0: 5b 6c 6c 65 6e 67 74 68 20 24 65 78 74 72 61 56 [llength $extraV
b000: 61 72 4e 61 6d 65 73 5d 20 3e 20 30 7d 20 74 68 arNames] > 0} th
b010: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 65 76 en {.. ev
b020: 61 6c 20 6c 61 70 70 65 6e 64 20 76 61 72 4e 61 al lappend varNa
b030: 6d 65 73 20 24 65 78 74 72 61 56 61 72 4e 61 6d mes $extraVarNam
b040: 65 73 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 es.. }....
b050: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
b060: 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 20 NOTE: Build the
b070: 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 20 script fragment
b080: 74 6f 20 62 65 20 72 65 74 75 72 6e 65 64 20 62 to be returned b
b090: 79 20 70 72 6f 63 65 73 73 69 6e 67 20 65 61 63 y processing eac
b0a0: 68 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 h.. #
b0b0: 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 20 61 variable name a
b0c0: 6e 64 20 61 64 64 69 6e 67 20 74 68 65 20 6e 65 nd adding the ne
b0d0: 63 65 63 65 73 73 61 72 79 20 73 63 72 69 70 74 cecessary script
b0e0: 20 66 72 61 67 6d 65 6e 74 73 20 66 6f 72 0d 0a fragments for..
b0f0: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 65 61 # ea
b100: 63 68 20 6f 6e 65 2e 0d 0a 20 20 20 20 20 20 23 ch one... #
b110: 0d 0a 20 20 20 20 20 20 73 65 74 20 72 65 73 75 .. set resu
b120: 6c 74 20 22 22 0d 0a 0d 0a 20 20 20 20 20 20 66 lt "".... f
b130: 6f 72 65 61 63 68 20 76 61 72 4e 61 6d 65 20 24 oreach varName $
b140: 76 61 72 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 varNames {..
b150: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
b160: 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 NOTE: Build the
b170: 20 71 75 61 6c 69 66 69 65 64 20 67 6c 6f 62 61 qualified globa
b180: 6c 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 2e l variable name.
b190: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
b1a0: 20 20 20 20 20 73 65 74 20 66 75 6c 6c 56 61 72 set fullVar
b1b0: 4e 61 6d 65 20 5b 61 70 70 65 6e 64 41 72 67 73 Name [appendArgs
b1c0: 20 3a 3a 20 24 76 61 72 4e 61 6d 65 5d 0d 0a 0d :: $varName]...
b1d0: 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
b1e0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 6f 65 73 # NOTE: Does
b1f0: 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 65 78 the variable ex
b200: 69 73 74 20 69 6e 20 74 68 69 73 20 69 6e 74 65 ist in this inte
b210: 72 70 72 65 74 65 72 20 63 6f 6e 74 65 78 74 3f rpreter context?
b220: 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
b230: 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 if {[info e
b240: 78 69 73 74 73 20 24 66 75 6c 6c 56 61 72 4e 61 xists $fullVarNa
b250: 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 me]} then {..
b260: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
b270: 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 70 70 65 # NOTE: Appe
b280: 6e 64 20 61 20 73 63 72 69 70 74 20 66 72 61 67 nd a script frag
b290: 6d 65 6e 74 20 74 6f 20 74 68 65 20 72 65 73 75 ment to the resu
b2a0: 6c 74 20 74 68 61 74 20 77 69 6c 6c 20 63 6f 72 lt that will cor
b2b0: 72 65 63 74 6c 79 0d 0a 20 20 20 20 20 20 20 20 rectly..
b2c0: 20 20 23 20 20 20 20 20 20 20 63 6f 70 79 20 61 # copy a
b2d0: 6e 79 20 63 6f 6e 74 61 69 6e 65 64 20 76 61 6c ny contained val
b2e0: 75 65 20 74 6f 20 61 6e 6f 74 68 65 72 20 69 6e ue to another in
b2f0: 74 65 72 70 72 65 74 65 72 20 63 6f 6e 74 65 78 terpreter contex
b300: 74 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d t... #.
b310: 0a 20 20 20 20 20 20 20 20 20 20 61 70 70 65 6e . appen
b320: 64 20 72 65 73 75 6c 74 20 5c 6e 20 22 73 65 74 d result \n "set
b330: 20 22 20 24 66 75 6c 6c 56 61 72 4e 61 6d 65 20 " $fullVarName
b340: 22 20 5c 7b 22 20 5b 73 74 72 69 6e 67 20 6d 61 " \{" [string ma
b350: 70 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 p \..
b360: 20 20 20 5b 67 65 74 53 74 72 69 6e 67 4d 61 70 [getStringMap
b370: 46 6f 72 54 63 6c 45 73 63 61 70 65 5d 20 5b 73 ForTclEscape] [s
b380: 65 74 20 24 66 75 6c 6c 56 61 72 4e 61 6d 65 5d et $fullVarName]
b390: 5d 20 5c 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d ] \}.. }.
b3a0: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
b3b0: 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
b3c0: 45 3a 20 49 66 20 74 68 65 20 72 65 73 75 6c 74 E: If the result
b3d0: 20 63 6f 6e 74 61 69 6e 73 20 6f 6e 65 20 6f 72 contains one or
b3e0: 20 6d 6f 72 65 20 73 63 72 69 70 74 20 66 72 61 more script fra
b3f0: 67 6d 65 6e 74 73 2c 20 61 70 70 65 6e 64 20 61 gments, append a
b400: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
b410: 6e 65 77 6c 69 6e 65 2e 0d 0a 20 20 20 20 20 20 newline...
b420: 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 #.. if {[st
b430: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 72 65 73 ring length $res
b440: 75 6c 74 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ult] > 0} then {
b450: 0d 0a 20 20 20 20 20 20 20 20 61 70 70 65 6e 64 .. append
b460: 20 72 65 73 75 6c 74 20 5c 6e 0d 0a 20 20 20 20 result \n..
b470: 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 }.... ret
b480: 75 72 6e 20 24 72 65 73 75 6c 74 0d 0a 20 20 20 urn $result..
b490: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
b4a0: 6d 6f 76 65 53 79 73 74 65 6d 44 61 74 61 53 51 moveSystemDataSQ
b4b0: 4c 69 74 65 44 6c 6c 43 6f 6e 66 69 67 20 7b 20 LiteDllConfig {
b4c0: 7b 72 65 73 74 6f 72 65 20 66 61 6c 73 65 7d 20 {restore false}
b4d0: 7b 76 65 72 62 6f 73 65 20 74 72 75 65 7d 20 7d {verbose true} }
b4e0: 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 64 69 {.. set di
b4f0: 72 65 63 74 6f 72 79 20 5b 67 65 74 42 69 6e 61 rectory [getBina
b500: 72 79 44 69 72 65 63 74 6f 72 79 5d 0d 0a 0d 0a ryDirectory]....
b510: 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
b520: 67 20 6c 65 6e 67 74 68 20 24 64 69 72 65 63 74 g length $direct
b530: 6f 72 79 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ory] == 0} then
b540: 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 24 {.. if {$
b550: 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d verbose} then {.
b560: 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
b570: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
b580: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
b590: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
b5a0: 2d 2d 2d 20 73 6b 69 70 70 65 64 20 6d 6f 76 69 --- skipped movi
b5b0: 6e 67 20 5c 22 53 79 73 74 65 6d 2e 44 61 74 61 ng \"System.Data
b5c0: 2e 53 51 4c 69 74 65 2e 64 6c 6c 2e 63 6f 6e 66 .SQLite.dll.conf
b5d0: 69 67 5c 22 2c 20 22 20 5c 0d 0a 20 20 20 20 20 ig\", " \..
b5e0: 20 20 20 20 20 20 20 20 20 22 6e 6f 20 62 69 6e "no bin
b5f0: 61 72 79 20 64 69 72 65 63 74 6f 72 79 5c 6e 22 ary directory\n"
b600: 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a ].. }....
b610: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 0d 0a return..
b620: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
b630: 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 28 31 29 set fileName(1)
b640: 20 5b 66 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a 65 [file normalize
b650: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 66 \.. [f
b660: 69 6c 65 20 6a 6f 69 6e 20 24 64 69 72 65 63 74 ile join $direct
b670: 6f 72 79 20 53 79 73 74 65 6d 2e 44 61 74 61 2e ory System.Data.
b680: 53 51 4c 69 74 65 2e 64 6c 6c 2e 63 6f 6e 66 69 SQLite.dll.confi
b690: 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 73 65 74 g]].... set
b6a0: 20 66 69 6c 65 4e 61 6d 65 28 32 29 20 5b 61 70 fileName(2) [ap
b6b0: 70 65 6e 64 41 72 67 73 20 24 66 69 6c 65 4e 61 pendArgs $fileNa
b6c0: 6d 65 28 31 29 20 2e 6d 6f 76 65 64 5d 0d 0a 0d me(1) .moved]...
b6d0: 0a 20 20 20 20 20 20 69 66 20 7b 24 72 65 73 74 . if {$rest
b6e0: 6f 72 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ore} then {..
b6f0: 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 if {[file e
b700: 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 28 xists $fileName(
b710: 32 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 2)]} then {..
b720: 20 20 20 20 20 20 20 66 69 6c 65 20 72 65 6e 61 file rena
b730: 6d 65 20 24 66 69 6c 65 4e 61 6d 65 28 32 29 20 me $fileName(2)
b740: 24 66 69 6c 65 4e 61 6d 65 28 31 29 0d 0a 0d 0a $fileName(1)....
b750: 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 76 if {$v
b760: 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a erbose} then {..
b770: 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
b780: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
b790: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
b7a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
b7b0: 20 22 2d 2d 2d 2d 20 6d 6f 76 65 64 20 5c 22 22 "---- moved \""
b7c0: 20 24 66 69 6c 65 4e 61 6d 65 28 32 29 20 22 5c $fileName(2) "\
b7d0: 22 20 74 6f 20 5c 22 22 20 5c 0d 0a 20 20 20 20 " to \"" \..
b7e0: 20 20 20 20 20 20 20 20 20 20 20 20 24 66 69 6c $fil
b7f0: 65 4e 61 6d 65 28 31 29 20 5c 22 5c 6e 5d 0d 0a eName(1) \"\n]..
b800: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
b810: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
b820: 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 76 65 if {$ve
b830: 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 rbose} then {..
b840: 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
b850: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
b860: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
b870: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
b880: 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 6d 6f "---- skipped mo
b890: 76 69 6e 67 20 5c 22 22 20 24 66 69 6c 65 4e 61 ving \"" $fileNa
b8a0: 6d 65 28 32 29 20 5c 0d 0a 20 20 20 20 20 20 20 me(2) \..
b8b0: 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 69 74 "\", it
b8c0: 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 5c does not exist\
b8d0: 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d n"].. }
b8e0: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
b8f0: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
b900: 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 if {[file e
b910: 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 28 xists $fileName(
b920: 31 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 1)]} then {..
b930: 20 20 20 20 20 20 20 66 69 6c 65 20 72 65 6e 61 file rena
b940: 6d 65 20 24 66 69 6c 65 4e 61 6d 65 28 31 29 20 me $fileName(1)
b950: 24 66 69 6c 65 4e 61 6d 65 28 32 29 0d 0a 0d 0a $fileName(2)....
b960: 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 76 if {$v
b970: 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a erbose} then {..
b980: 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
b990: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
b9a0: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
b9b0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
b9c0: 20 22 2d 2d 2d 2d 20 6d 6f 76 65 64 20 5c 22 22 "---- moved \""
b9d0: 20 24 66 69 6c 65 4e 61 6d 65 28 31 29 20 22 5c $fileName(1) "\
b9e0: 22 20 74 6f 20 5c 22 22 20 5c 0d 0a 20 20 20 20 " to \"" \..
b9f0: 20 20 20 20 20 20 20 20 20 20 20 20 24 66 69 6c $fil
ba00: 65 4e 61 6d 65 28 32 29 20 5c 22 5c 6e 5d 0d 0a eName(2) \"\n]..
ba10: 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
ba20: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
ba30: 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 76 65 if {$ve
ba40: 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 rbose} then {..
ba50: 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
ba60: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
ba70: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
ba80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
ba90: 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 6d 6f "---- skipped mo
baa0: 76 69 6e 67 20 5c 22 22 20 24 66 69 6c 65 4e 61 ving \"" $fileNa
bab0: 6d 65 28 31 29 20 5c 0d 0a 20 20 20 20 20 20 20 me(1) \..
bac0: 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 69 74 "\", it
bad0: 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 5c does not exist\
bae0: 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d n"].. }
baf0: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
bb00: 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
bb10: 20 20 20 20 70 72 6f 63 20 77 72 69 74 65 53 79 proc writeSy
bb20: 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 44 6c stemDataSQLiteDl
bb30: 6c 43 6f 6e 66 69 67 20 7b 20 64 61 74 61 20 7b lConfig { data {
bb40: 76 65 72 62 6f 73 65 20 74 72 75 65 7d 20 7d 20 verbose true} }
bb50: 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 64 69 72 {.. set dir
bb60: 65 63 74 6f 72 79 20 5b 67 65 74 42 69 6e 61 72 ectory [getBinar
bb70: 79 44 69 72 65 63 74 6f 72 79 5d 0d 0a 0d 0a 20 yDirectory]....
bb80: 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
bb90: 20 6c 65 6e 67 74 68 20 24 64 69 72 65 63 74 6f length $directo
bba0: 72 79 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b ry] == 0} then {
bbb0: 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 24 76 .. if {$v
bbc0: 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a erbose} then {..
bbd0: 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
bbe0: 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
bbf0: 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
bc00: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
bc10: 2d 2d 20 73 6b 69 70 70 65 64 20 6d 6f 76 69 6e -- skipped movin
bc20: 67 20 5c 22 53 79 73 74 65 6d 2e 44 61 74 61 2e g \"System.Data.
bc30: 53 51 4c 69 74 65 2e 64 6c 6c 2e 63 6f 6e 66 69 SQLite.dll.confi
bc40: 67 5c 22 2c 20 22 20 5c 0d 0a 20 20 20 20 20 20 g\", " \..
bc50: 20 20 20 20 20 20 20 20 22 6e 6f 20 62 69 6e 61 "no bina
bc60: 72 79 20 64 69 72 65 63 74 6f 72 79 5c 6e 22 5d ry directory\n"]
bc70: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
bc80: 20 20 20 20 20 20 20 72 65 74 75 72 6e 0d 0a 20 return..
bc90: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
bca0: 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 set fileName [fi
bcb0: 6c 65 20 6e 6f 72 6d 61 6c 69 7a 65 20 5c 0d 0a le normalize \..
bcc0: 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 [file
bcd0: 6a 6f 69 6e 20 24 64 69 72 65 63 74 6f 72 79 20 join $directory
bce0: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
bcf0: 74 65 2e 64 6c 6c 2e 63 6f 6e 66 69 67 5d 5d 0d te.dll.config]].
bd00: 0a 0d 0a 20 20 20 20 20 20 77 72 69 74 65 46 69 ... writeFi
bd10: 6c 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 64 61 le $fileName $da
bd20: 74 61 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b ta.... if {
bd30: 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b $verbose} then {
bd40: 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
bd50: 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
bd60: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
bd70: 2d 2d 2d 2d 20 77 72 6f 74 65 20 5c 22 53 79 73 ---- wrote \"Sys
bd80: 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
bd90: 64 6c 6c 2e 63 6f 6e 66 69 67 5c 22 5c 6e 22 0d dll.config\"\n".
bda0: 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
bdb0: 20 20 72 65 74 75 72 6e 20 24 66 69 6c 65 4e 61 return $fileNa
bdc0: 6d 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 me.. }.....
bdd0: 20 20 70 72 6f 63 20 6d 6f 76 65 45 61 67 6c 65 proc moveEagle
bde0: 53 68 65 6c 6c 4d 64 61 43 6f 6e 66 69 67 20 7b ShellMdaConfig {
bdf0: 20 7b 72 65 73 74 6f 72 65 20 66 61 6c 73 65 7d {restore false}
be00: 20 7b 76 65 72 62 6f 73 65 20 74 72 75 65 7d 20 {verbose true}
be10: 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 64 } {.. set d
be20: 69 72 65 63 74 6f 72 79 20 5b 67 65 74 42 69 6e irectory [getBin
be30: 61 72 79 44 69 72 65 63 74 6f 72 79 5d 0d 0a 0d aryDirectory]...
be40: 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 . if {[stri
be50: 6e 67 20 6c 65 6e 67 74 68 20 24 64 69 72 65 63 ng length $direc
be60: 74 6f 72 79 5d 20 3d 3d 20 30 7d 20 74 68 65 6e tory] == 0} then
be70: 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
be80: 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b $verbose} then {
be90: 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
bea0: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
beb0: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
bec0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
bed0: 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 6d 6f 76 ---- skipped mov
bee0: 69 6e 67 20 5c 22 45 61 67 6c 65 53 68 65 6c 6c ing \"EagleShell
bef0: 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 69 67 5c .exe.mda.config\
bf00: 22 2c 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 ", " \..
bf10: 20 20 20 20 20 20 22 6e 6f 20 62 69 6e 61 72 79 "no binary
bf20: 20 64 69 72 65 63 74 6f 72 79 5c 6e 22 5d 0d 0a directory\n"]..
bf30: 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
bf40: 20 20 20 20 20 72 65 74 75 72 6e 0d 0a 20 20 20 return..
bf50: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 65 }.... se
bf60: 74 20 66 69 6c 65 4e 61 6d 65 28 31 29 20 5b 66 t fileName(1) [f
bf70: 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a 65 20 5c 0d ile normalize \.
bf80: 0a 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 . [file
bf90: 20 6a 6f 69 6e 20 24 64 69 72 65 63 74 6f 72 79 join $directory
bfa0: 20 45 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 2e EagleShell.exe.
bfb0: 6d 64 61 2e 63 6f 6e 66 69 67 5d 5d 0d 0a 0d 0a mda.config]]....
bfc0: 20 20 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 set fileNa
bfd0: 6d 65 28 32 29 20 5b 61 70 70 65 6e 64 41 72 67 me(2) [appendArg
bfe0: 73 20 24 66 69 6c 65 4e 61 6d 65 28 31 29 20 2e s $fileName(1) .
bff0: 6d 6f 76 65 64 5d 0d 0a 0d 0a 20 20 20 20 20 20 moved]....
c000: 69 66 20 7b 24 72 65 73 74 6f 72 65 7d 20 74 68 if {$restore} th
c010: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 en {.. if
c020: 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {[file exists $
c030: 66 69 6c 65 4e 61 6d 65 28 32 29 5d 7d 20 74 68 fileName(2)]} th
c040: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
c050: 66 69 6c 65 20 72 65 6e 61 6d 65 20 24 66 69 6c file rename $fil
c060: 65 4e 61 6d 65 28 32 29 20 24 66 69 6c 65 4e 61 eName(2) $fileNa
c070: 6d 65 28 31 29 0d 0a 0d 0a 20 20 20 20 20 20 20 me(1)....
c080: 20 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d if {$verbose}
c090: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
c0a0: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
c0b0: 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
c0c0: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
c0d0: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
c0e0: 6d 6f 76 65 64 20 5c 22 22 20 24 66 69 6c 65 4e moved \"" $fileN
c0f0: 61 6d 65 28 32 29 20 22 5c 22 20 74 6f 20 5c 22 ame(2) "\" to \"
c100: 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
c110: 20 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 28 31 $fileName(1
c120: 29 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ) \"\n]..
c130: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 }.. }
c140: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
c150: 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 if {$verbose}
c160: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
c170: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
c180: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
c190: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
c1a0: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
c1b0: 6b 69 70 70 65 64 20 6d 6f 76 69 6e 67 20 5c 22 kipped moving \"
c1c0: 22 20 24 66 69 6c 65 4e 61 6d 65 28 32 29 20 5c " $fileName(2) \
c1d0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
c1e0: 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e "\", it does n
c1f0: 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 ot exist\n"]..
c200: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
c210: 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c }.. } el
c220: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 se {.. if
c230: 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {[file exists $
c240: 66 69 6c 65 4e 61 6d 65 28 31 29 5d 7d 20 74 68 fileName(1)]} th
c250: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
c260: 66 69 6c 65 20 72 65 6e 61 6d 65 20 24 66 69 6c file rename $fil
c270: 65 4e 61 6d 65 28 31 29 20 24 66 69 6c 65 4e 61 eName(1) $fileNa
c280: 6d 65 28 32 29 0d 0a 0d 0a 20 20 20 20 20 20 20 me(2)....
c290: 20 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d if {$verbose}
c2a0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
c2b0: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
c2c0: 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
c2d0: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
c2e0: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
c2f0: 6d 6f 76 65 64 20 5c 22 22 20 24 66 69 6c 65 4e moved \"" $fileN
c300: 61 6d 65 28 31 29 20 22 5c 22 20 74 6f 20 5c 22 ame(1) "\" to \"
c310: 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
c320: 20 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 28 32 $fileName(2
c330: 29 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ) \"\n]..
c340: 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 }.. }
c350: 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
c360: 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d 20 if {$verbose}
c370: 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
c380: 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
c390: 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
c3a0: 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
c3b0: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
c3c0: 6b 69 70 70 65 64 20 6d 6f 76 69 6e 67 20 5c 22 kipped moving \"
c3d0: 22 20 24 66 69 6c 65 4e 61 6d 65 28 31 29 20 5c " $fileName(1) \
c3e0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
c3f0: 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e "\", it does n
c400: 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 ot exist\n"]..
c410: 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
c420: 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
c430: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
c440: 63 20 77 72 69 74 65 45 61 67 6c 65 53 68 65 6c c writeEagleShel
c450: 6c 4d 64 61 43 6f 6e 66 69 67 20 7b 20 64 61 74 lMdaConfig { dat
c460: 61 20 7b 76 65 72 62 6f 73 65 20 74 72 75 65 7d a {verbose true}
c470: 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 } {.. set
c480: 64 69 72 65 63 74 6f 72 79 20 5b 67 65 74 42 69 directory [getBi
c490: 6e 61 72 79 44 69 72 65 63 74 6f 72 79 5d 0d 0a naryDirectory]..
c4a0: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
c4b0: 69 6e 67 20 6c 65 6e 67 74 68 20 24 64 69 72 65 ing length $dire
c4c0: 63 74 6f 72 79 5d 20 3d 3d 20 30 7d 20 74 68 65 ctory] == 0} the
c4d0: 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
c4e0: 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 {$verbose} then
c4f0: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 {.. tpu
c500: 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
c510: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
c520: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
c530: 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 6d 6f "---- skipped mo
c540: 76 69 6e 67 20 5c 22 45 61 67 6c 65 53 68 65 6c ving \"EagleShel
c550: 6c 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 69 67 l.exe.mda.config
c560: 5c 22 2c 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 \", " \..
c570: 20 20 20 20 20 20 20 22 6e 6f 20 62 69 6e 61 72 "no binar
c580: 79 20 64 69 72 65 63 74 6f 72 79 5c 6e 22 5d 0d y directory\n"].
c590: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
c5a0: 20 20 20 20 20 20 72 65 74 75 72 6e 0d 0a 20 20 return..
c5b0: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 }.... s
c5c0: 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c et fileName [fil
c5d0: 65 20 6e 6f 72 6d 61 6c 69 7a 65 20 5c 0d 0a 20 e normalize \..
c5e0: 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 6a [file j
c5f0: 6f 69 6e 20 24 64 69 72 65 63 74 6f 72 79 20 45 oin $directory E
c600: 61 67 6c 65 53 68 65 6c 6c 2e 65 78 65 2e 6d 64 agleShell.exe.md
c610: 61 2e 63 6f 6e 66 69 67 5d 5d 0d 0a 0d 0a 20 20 a.config]]....
c620: 20 20 20 20 77 72 69 74 65 46 69 6c 65 20 24 66 writeFile $f
c630: 69 6c 65 4e 61 6d 65 20 24 64 61 74 61 0d 0a 0d ileName $data...
c640: 0a 20 20 20 20 20 20 69 66 20 7b 24 76 65 72 62 . if {$verb
c650: 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ose} then {..
c660: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
c670: 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 st_channel \..
c680: 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
c690: 77 72 6f 74 65 20 5c 22 45 61 67 6c 65 53 68 65 wrote \"EagleShe
c6a0: 6c 6c 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 69 ll.exe.mda.confi
c6b0: 67 5c 22 5c 6e 22 0d 0a 20 20 20 20 20 20 7d 0d g\"\n".. }.
c6c0: 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 ... return
c6d0: 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 7d $fileName.. }
c6e0: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 ..... proc ge
c6f0: 74 41 70 70 44 6f 6d 61 69 6e 50 72 65 61 6d 62 tAppDomainPreamb
c700: 6c 65 20 7b 20 7b 70 72 65 66 69 78 20 22 22 7d le { {prefix ""}
c710: 20 7b 73 75 66 66 69 78 20 22 22 7d 20 7d 20 7b {suffix ""} } {
c720: 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
c730: 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 # NOTE: This pr
c740: 6f 63 65 64 75 72 65 20 72 65 74 75 72 6e 73 20 ocedure returns
c750: 61 20 74 65 73 74 20 73 65 74 75 70 20 73 63 72 a test setup scr
c760: 69 70 74 20 66 72 61 67 6d 65 6e 74 20 73 75 69 ipt fragment sui
c770: 74 61 62 6c 65 20 66 6f 72 0d 0a 20 20 20 20 20 table for..
c780: 20 23 20 20 20 20 20 20 20 65 76 61 6c 75 61 74 # evaluat
c790: 69 6f 6e 20 62 79 20 61 6e 20 69 6e 74 65 72 70 ion by an interp
c7a0: 72 65 74 65 72 20 63 72 65 61 74 65 64 20 69 6e reter created in
c7b0: 20 61 6e 20 69 73 6f 6c 61 74 65 64 20 61 70 70 an isolated app
c7c0: 6c 69 63 61 74 69 6f 6e 0d 0a 20 20 20 20 20 20 lication..
c7d0: 23 20 20 20 20 20 20 20 64 6f 6d 61 69 6e 2e 20 # domain.
c7e0: 20 54 68 65 20 73 63 72 69 70 74 20 66 72 61 67 The script frag
c7f0: 6d 65 6e 74 20 62 65 69 6e 67 20 72 65 74 75 72 ment being retur
c800: 6e 65 64 20 77 69 6c 6c 20 62 65 20 73 75 72 72 ned will be surr
c810: 6f 75 6e 64 65 64 20 62 79 0d 0a 20 20 20 20 20 ounded by..
c820: 20 23 20 20 20 20 20 20 20 74 68 65 20 70 72 65 # the pre
c830: 66 69 78 20 61 6e 64 20 73 75 66 66 69 78 20 22 fix and suffix "
c840: 73 63 72 69 70 74 20 66 72 61 67 6d 65 6e 74 73 script fragments
c850: 22 20 73 70 65 63 69 66 69 65 64 20 62 79 20 6f " specified by o
c860: 75 72 20 63 61 6c 6c 65 72 2c 0d 0a 20 20 20 20 ur caller,..
c870: 20 20 23 20 20 20 20 20 20 20 69 66 20 61 6e 79 # if any
c880: 2e 20 20 54 68 65 20 65 6e 74 69 72 65 20 73 63 . The entire sc
c890: 72 69 70 74 20 62 65 69 6e 67 20 72 65 74 75 72 ript being retur
c8a0: 6e 65 64 20 77 69 6c 6c 20 62 65 20 73 75 62 73 ned will be subs
c8b0: 74 69 74 75 74 65 64 20 76 69 61 0d 0a 20 20 20 tituted via..
c8c0: 20 20 20 23 20 20 20 20 20 20 20 5b 73 75 62 73 # [subs
c8d0: 74 5d 2c 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 t], in the conte
c8e0: 78 74 20 6f 66 20 6f 75 72 20 63 61 6c 6c 65 72 xt of our caller
c8f0: 2c 20 62 65 66 6f 72 65 20 62 65 69 6e 67 20 72 , before being r
c900: 65 74 75 72 6e 65 64 2e 0d 0a 20 20 20 20 20 20 eturned...
c910: 23 20 20 20 20 20 20 20 54 68 69 73 20 73 74 65 # This ste
c920: 70 20 69 73 20 6e 65 63 65 73 73 61 72 79 20 73 p is necessary s
c930: 6f 20 74 68 61 74 20 73 6f 6d 65 20 6c 69 6d 69 o that some limi
c940: 74 65 64 20 63 6f 6e 74 65 78 74 20 69 6e 66 6f ted context info
c950: 72 6d 61 74 69 6f 6e 2c 0d 0a 20 20 20 20 20 20 rmation,..
c960: 23 20 20 20 20 20 20 20 70 72 69 6d 61 72 69 6c # primaril
c970: 79 20 72 65 6c 61 74 65 64 20 74 6f 20 74 68 65 y related to the
c980: 20 74 65 73 74 69 6e 67 20 64 69 72 65 63 74 6f testing directo
c990: 72 69 65 73 2c 20 63 61 6e 20 62 65 20 74 72 61 ries, can be tra
c9a0: 6e 73 66 65 72 72 65 64 0d 0a 20 20 20 20 20 20 nsferred..
c9b0: 23 20 20 20 20 20 20 20 74 6f 20 74 68 65 20 69 # to the i
c9c0: 6e 74 65 72 70 72 65 74 65 72 20 69 6e 20 74 68 nterpreter in th
c9d0: 65 20 69 73 6f 6c 61 74 65 64 20 61 70 70 6c 69 e isolated appli
c9e0: 63 61 74 69 6f 6e 20 64 6f 6d 61 69 6e 2c 20 6d cation domain, m
c9f0: 61 6b 69 6e 67 20 69 74 0d 0a 20 20 20 20 20 20 aking it..
ca00: 23 20 20 20 20 20 20 20 61 62 6c 65 20 74 6f 20 # able to
ca10: 73 75 63 63 65 73 73 66 75 6c 6c 79 20 72 75 6e successfully run
ca20: 20 74 65 73 74 73 20 74 68 61 74 20 72 65 71 75 tests that requ
ca30: 69 72 65 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 ire one or more
ca40: 6f 66 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 of the.. #
ca50: 20 20 20 20 20 20 66 69 6c 65 73 20 69 6e 20 6f files in o
ca60: 6e 65 20 6f 66 20 74 68 65 20 74 65 73 74 69 6e ne of the testin
ca70: 67 20 64 69 72 65 63 74 6f 72 69 65 73 2e 20 20 g directories.
ca80: 43 61 6c 6c 65 72 73 20 73 68 6f 75 6c 64 20 6b Callers should k
ca90: 65 65 70 20 69 6e 0d 0a 20 20 20 20 20 20 23 20 eep in.. #
caa0: 20 20 20 20 20 20 6d 69 6e 64 20 74 68 61 74 20 mind that
cab0: 74 68 65 20 74 65 73 74 20 73 63 72 69 70 74 20 the test script
cac0: 66 72 61 67 6d 65 6e 74 20 62 65 69 6e 67 20 72 fragment being r
cad0: 65 74 75 72 6e 65 64 20 63 61 6e 6e 6f 74 20 72 eturned cannot r
cae0: 65 6c 79 20 6f 6e 0d 0a 20 20 20 20 20 20 23 20 ely on.. #
caf0: 20 20 20 20 20 20 61 6e 79 20 73 63 72 69 70 74 any script
cb00: 20 6c 69 62 72 61 72 79 20 70 72 6f 63 65 64 75 library procedu
cb10: 72 65 73 20 74 68 61 74 20 61 72 65 20 6e 6f 74 res that are not
cb20: 20 70 72 6f 76 69 64 65 64 20 62 79 20 74 68 65 provided by the
cb30: 20 45 61 67 6c 65 0d 0a 20 20 20 20 20 20 23 20 Eagle.. #
cb40: 20 20 20 20 20 20 6c 69 62 72 61 72 79 20 70 61 library pa
cb50: 63 6b 61 67 65 20 28 69 2e 65 2e 20 22 69 6e 69 ckage (i.e. "ini
cb60: 74 2e 65 61 67 6c 65 22 29 2c 20 69 6e 63 6c 75 t.eagle"), inclu
cb70: 64 69 6e 67 20 74 68 6f 73 65 20 70 72 6f 76 69 ding those provi
cb80: 64 65 64 20 62 79 0d 0a 20 20 20 20 20 20 23 20 ded by.. #
cb90: 20 20 20 20 20 20 74 68 65 20 45 61 67 6c 65 20 the Eagle
cba0: 74 65 73 74 20 70 61 63 6b 61 67 65 2c 20 75 6e test package, un
cbb0: 6c 65 73 73 20 74 68 65 20 66 69 6c 65 20 63 6f less the file co
cbc0: 6e 74 61 69 6e 69 6e 67 20 74 68 65 6d 20 69 73 ntaining them is
cbd0: 20 6c 6f 61 64 65 64 0d 0a 20 20 20 20 20 20 23 loaded.. #
cbe0: 20 20 20 20 20 20 20 6d 61 6e 75 61 6c 6c 79 20 manually
cbf0: 76 69 61 20 73 6f 6d 65 20 6f 74 68 65 72 20 6d via some other m
cc00: 65 63 68 61 6e 69 73 6d 20 28 65 2e 67 2e 20 62 echanism (e.g. b
cc10: 79 20 69 6e 63 6c 75 64 69 6e 67 20 61 70 70 72 y including appr
cc20: 6f 70 72 69 61 74 65 0d 0a 20 20 20 20 20 20 23 opriate.. #
cc30: 20 20 20 20 20 20 20 5b 70 61 63 6b 61 67 65 20 [package
cc40: 72 65 71 75 69 72 65 5d 20 6f 72 20 5b 73 6f 75 require] or [sou
cc50: 72 63 65 5d 20 63 6f 6d 6d 61 6e 64 73 20 69 6e rce] commands in
cc60: 20 74 68 65 20 70 72 65 66 69 78 20 6f 72 20 73 the prefix or s
cc70: 75 66 66 69 78 0d 0a 20 20 20 20 20 20 23 20 20 uffix.. #
cc80: 20 20 20 20 20 73 63 72 69 70 74 20 66 72 61 67 script frag
cc90: 6d 65 6e 74 73 29 2e 20 20 41 6c 73 6f 2c 20 61 ments). Also, a
cca0: 6c 6c 20 76 61 72 69 61 62 6c 65 20 72 65 66 65 ll variable refe
ccb0: 72 65 6e 63 65 73 20 61 6e 64 20 61 6c 6c 20 6e rences and all n
ccc0: 65 73 74 65 64 0d 0a 20 20 20 20 20 20 23 20 20 ested.. #
ccd0: 20 20 20 20 20 63 6f 6d 6d 61 6e 64 73 20 28 69 commands (i
cce0: 2e 65 2e 20 74 68 6f 73 65 20 69 6e 20 73 71 75 .e. those in squ
ccf0: 61 72 65 20 62 72 61 63 6b 65 74 73 29 20 63 6f are brackets) co
cd00: 6e 74 61 69 6e 65 64 20 69 6e 20 74 68 65 20 66 ntained in the f
cd10: 69 6e 61 6c 0d 0a 20 20 20 20 20 20 23 20 20 20 inal.. #
cd20: 20 20 20 20 73 63 72 69 70 74 20 66 72 61 67 6d script fragm
cd30: 65 6e 74 20 77 69 6c 6c 20 65 6e 64 20 75 70 20 ent will end up
cd40: 62 65 69 6e 67 20 65 76 61 6c 75 61 74 65 64 20 being evaluated
cd50: 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 20 6f in the context o
cd60: 66 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 f the.. #
cd70: 20 20 20 20 20 63 61 6c 6c 69 6e 67 20 69 6e 74 calling int
cd80: 65 72 70 72 65 74 65 72 20 61 6e 64 20 6e 6f 74 erpreter and not
cd90: 20 74 68 65 20 74 61 72 67 65 74 20 69 6e 74 65 the target inte
cda0: 72 70 72 65 74 65 72 20 63 72 65 61 74 65 64 20 rpreter created
cdb0: 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 in the.. #
cdc0: 20 20 20 20 20 20 69 73 6f 6c 61 74 65 64 20 61 isolated a
cdd0: 70 70 6c 69 63 61 74 69 6f 6e 20 64 6f 6d 61 69 pplication domai
cde0: 6e 20 75 6e 6c 65 73 73 20 74 68 65 20 64 6f 6c n unless the dol
cdf0: 6c 61 72 20 73 69 67 6e 73 20 61 6e 64 2f 6f 72 lar signs and/or
ce00: 20 73 71 75 61 72 65 0d 0a 20 20 20 20 20 20 23 square.. #
ce10: 20 20 20 20 20 20 20 62 72 61 63 6b 65 74 73 20 brackets
ce20: 61 72 65 20 73 70 65 63 69 61 6c 6c 79 20 71 75 are specially qu
ce30: 6f 74 65 64 20 77 69 74 68 20 62 61 63 6b 73 6c oted with backsl
ce40: 61 73 68 65 73 2e 0d 0a 20 20 20 20 20 20 23 0d ashes... #.
ce50: 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 75 . return [u
ce60: 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 73 plevel 1 [list s
ce70: 75 62 73 74 20 5b 61 70 70 65 6e 64 41 72 67 73 ubst [appendArgs
ce80: 20 24 70 72 65 66 69 78 20 7b 0d 0a 20 20 20 20 $prefix {..
ce90: 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
cea0: 20 4e 4f 54 45 3a 20 54 68 65 20 5c 5b 6f 62 6a NOTE: The \[obj
ceb0: 65 63 74 5c 5d 20 63 6f 6d 6d 61 6e 64 20 6d 61 ect\] command ma
cec0: 79 20 62 65 20 6d 69 73 73 69 6e 67 20 69 6e 20 y be missing in
ced0: 73 6f 6d 65 20 45 61 67 6c 65 20 63 6f 72 65 0d some Eagle core.
cee0: 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
cef0: 20 6c 69 62 72 61 72 79 20 63 6f 6e 66 69 67 75 library configu
cf00: 72 61 74 69 6f 6e 73 2e 20 20 43 6c 6f 6e 69 6e rations. Clonin
cf10: 67 20 61 6e 64 20 75 73 69 6e 67 20 74 68 65 20 g and using the
cf20: 70 72 6f 63 65 64 75 72 65 0d 0a 20 20 20 20 20 procedure..
cf30: 20 20 20 23 20 20 20 20 20 20 20 5c 5b 63 68 61 # \[cha
cf40: 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 69 6d 65 ngeNativeRuntime
cf50: 4f 70 74 69 6f 6e 5c 5d 20 6d 61 79 20 68 65 6c Option\] may hel
cf60: 70 20 74 6f 20 6d 69 74 69 67 61 74 65 20 74 68 p to mitigate th
cf70: 69 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a is... #..
cf80: 20 20 20 20 20 20 20 20 70 72 6f 63 20 63 68 61 proc cha
cf90: 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 69 6d 65 ngeNativeRuntime
cfa0: 4f 70 74 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 Option \..
cfb0: 20 20 20 20 20 20 7b 5b 69 6e 66 6f 20 61 72 67 {[info arg
cfc0: 73 20 63 68 61 6e 67 65 4e 61 74 69 76 65 52 75 s changeNativeRu
cfd0: 6e 74 69 6d 65 4f 70 74 69 6f 6e 5d 7d 20 5c 0d ntimeOption]} \.
cfe0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 7b 5b 69 . {[i
cff0: 6e 66 6f 20 62 6f 64 79 20 63 68 61 6e 67 65 4e nfo body changeN
d000: 61 74 69 76 65 52 75 6e 74 69 6d 65 4f 70 74 69 ativeRuntimeOpti
d010: 6f 6e 5d 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 on]}....
d020: 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
d030: 20 20 20 63 68 61 6e 67 65 4e 61 74 69 76 65 52 changeNativeR
d040: 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 5b 68 61 untimeOption [ha
d050: 73 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 6e sRuntimeOption n
d060: 61 74 69 76 65 5d 0d 0a 20 20 20 20 20 20 20 20 ative]..
d070: 7d 0d 0a 20 20 20 20 20 20 7d 20 5b 67 65 74 54 }.. } [getT
d080: 65 73 74 4f 76 65 72 72 69 64 65 73 50 72 65 61 estOverridesPrea
d090: 6d 62 6c 65 20 5b 6c 69 73 74 20 70 61 74 68 20 mble [list path
d0a0: 74 65 73 74 5f 63 68 61 6e 6e 65 6c 5d 5d 20 24 test_channel]] $
d0b0: 73 75 66 66 69 78 5d 5d 5d 0d 0a 20 20 20 20 7d suffix]]].. }
d0c0: 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 ..... proc tr
d0d0: 79 43 6f 70 79 45 78 74 65 72 6e 61 6c 46 69 6c yCopyExternalFil
d0e0: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
d0f0: 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 fileName {platf
d100: 6f 72 6d 20 22 22 7d 20 7b 6e 65 77 46 69 6c 65 orm ""} {newFile
d110: 4e 61 6d 65 20 22 22 7d 20 7b 76 65 72 62 6f 73 Name ""} {verbos
d120: 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 e true} } {..
d130: 20 20 20 73 65 74 20 73 6f 75 72 63 65 46 69 6c set sourceFil
d140: 65 4e 61 6d 65 20 5b 67 65 74 45 78 74 65 72 6e eName [getExtern
d150: 61 6c 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 alFileName $file
d160: 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 Name].... i
d170: 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 f {![file exists
d180: 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 $sourceFileName
d190: 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
d1a0: 20 20 20 69 66 20 7b 24 76 65 72 62 6f 73 65 7d if {$verbose}
d1b0: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
d1c0: 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
d1d0: 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
d1e0: 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
d1f0: 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6b 69 70 "---- skip
d200: 70 65 64 20 63 6f 70 79 69 6e 67 20 65 78 74 65 ped copying exte
d210: 72 6e 61 6c 20 66 69 6c 65 20 5c 22 22 20 24 73 rnal file \"" $s
d220: 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 5c 0d ourceFileName \.
d230: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
d240: 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 \", it does not
d250: 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 exist\n"]..
d260: 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
d270: 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 20 7d 0d return.. }.
d280: 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 ... if {[st
d290: 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e 65 77 ring length $new
d2a0: 46 69 6c 65 4e 61 6d 65 5d 20 3e 20 30 7d 20 74 FileName] > 0} t
d2b0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 hen {.. s
d2c0: 65 74 20 74 61 72 67 65 74 46 69 6c 65 4e 61 6d et targetFileNam
d2d0: 65 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 e [getBinaryFile
d2e0: 4e 61 6d 65 20 24 6e 65 77 46 69 6c 65 4e 61 6d Name $newFileNam
d2f0: 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 e $platform]..
d300: 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
d310: 20 20 20 20 20 20 73 65 74 20 74 61 72 67 65 74 set target
d320: 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 69 6e FileName [getBin
d330: 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c aryFileName $fil
d340: 65 4e 61 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d eName $platform]
d350: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
d360: 20 20 20 73 65 74 20 74 61 72 67 65 74 44 69 72 set targetDir
d370: 65 63 74 6f 72 79 20 5b 66 69 6c 65 20 64 69 72 ectory [file dir
d380: 6e 61 6d 65 20 24 74 61 72 67 65 74 46 69 6c 65 name $targetFile
d390: 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 Name].... i
d3a0: 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
d3b0: 20 20 20 20 20 69 66 20 7b 21 5b 66 69 6c 65 20 if {![file
d3c0: 65 78 69 73 74 73 20 24 74 61 72 67 65 74 44 69 exists $targetDi
d3d0: 72 65 63 74 6f 72 79 5d 7d 20 74 68 65 6e 20 7b rectory]} then {
d3e0: 0d 0a 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 .. file
d3f0: 20 6d 6b 64 69 72 20 24 74 61 72 67 65 74 44 69 mkdir $targetDi
d400: 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 20 rectory..
d410: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 66 69 }.... fi
d420: 6c 65 20 63 6f 70 79 20 2d 66 6f 72 63 65 20 24 le copy -force $
d430: 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 24 sourceFileName $
d440: 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 0d 0a targetFileName..
d450: 20 20 20 20 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 }] == 0} t
d460: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 hen {.. t
d470: 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
d480: 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
d490: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
d4a0: 22 2d 2d 2d 2d 20 63 6f 70 69 65 64 20 65 78 74 "---- copied ext
d4b0: 65 72 6e 61 6c 20 66 69 6c 65 20 66 72 6f 6d 20 ernal file from
d4c0: 5c 22 22 20 24 73 6f 75 72 63 65 46 69 6c 65 4e \"" $sourceFileN
d4d0: 61 6d 65 20 22 5c 22 20 74 6f 20 5c 22 22 20 5c ame "\" to \"" \
d4e0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 74 .. $t
d4f0: 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 20 5c 22 argetFileName \"
d500: 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 \n].. } els
d510: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 e {.. tpu
d520: 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
d530: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
d540: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d .. "-
d550: 2d 2d 2d 20 66 61 69 6c 65 64 20 74 6f 20 63 6f --- failed to co
d560: 70 79 20 65 78 74 65 72 6e 61 6c 20 66 69 6c 65 py external file
d570: 20 66 72 6f 6d 20 5c 22 22 20 24 73 6f 75 72 63 from \"" $sourc
d580: 65 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 eFileName \..
d590: 20 20 20 20 20 20 20 20 20 22 5c 22 20 74 6f 20 "\" to
d5a0: 5c 22 22 20 24 74 61 72 67 65 74 46 69 6c 65 4e \"" $targetFileN
d5b0: 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 ame \"\n]..
d5c0: 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
d5d0: 20 20 70 72 6f 63 20 74 72 79 43 6f 70 79 42 69 proc tryCopyBi
d5e0: 6e 61 72 79 46 69 6c 65 20 7b 0d 0a 20 20 20 20 naryFile {..
d5f0: 20 20 20 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 fileName
d600: 20 6d 61 6e 61 67 65 64 4f 6e 6c 79 20 7b 70 6c managedOnly {pl
d610: 61 74 66 6f 72 6d 20 22 22 7d 20 7b 6e 65 77 46 atform ""} {newF
d620: 69 6c 65 4e 61 6d 65 20 22 22 7d 0d 0a 20 20 20 ileName ""}..
d630: 20 20 20 20 20 20 20 20 20 7b 76 65 72 62 6f 73 {verbos
d640: 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 e true} } {..
d650: 20 20 20 73 65 74 20 73 6f 75 72 63 65 46 69 6c set sourceFil
d660: 65 4e 61 6d 65 20 5b 67 65 74 42 69 6e 61 72 79 eName [getBinary
d670: 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 4e 61 FileName $fileNa
d680: 6d 65 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 0d me $platform]...
d690: 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 66 69 6c . if {![fil
d6a0: 65 20 65 78 69 73 74 73 20 24 73 6f 75 72 63 65 e exists $source
d6b0: 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 FileName]} then
d6c0: 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 24 {.. if {$
d6d0: 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d verbose} then {.
d6e0: 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
d6f0: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
d700: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
d710: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
d720: 2d 2d 2d 20 73 6b 69 70 70 65 64 20 63 6f 70 79 --- skipped copy
d730: 69 6e 67 20 62 69 6e 61 72 79 20 66 69 6c 65 20 ing binary file
d740: 5c 22 22 20 24 73 6f 75 72 63 65 46 69 6c 65 4e \"" $sourceFileN
d750: 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ame \..
d760: 20 20 20 20 20 22 5c 22 2c 20 69 74 20 64 6f 65 "\", it doe
d770: 73 20 6e 6f 74 20 65 78 69 73 74 5c 6e 22 5d 0d s not exist\n"].
d780: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
d790: 20 20 20 20 20 20 72 65 74 75 72 6e 0d 0a 20 20 return..
d7a0: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 }.... i
d7b0: 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 f {[string lengt
d7c0: 68 20 24 6e 65 77 46 69 6c 65 4e 61 6d 65 5d 20 h $newFileName]
d7d0: 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
d7e0: 20 20 20 20 20 73 65 74 20 74 61 72 67 65 74 46 set targetF
d7f0: 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 75 69 6c ileName [getBuil
d800: 64 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 dFileName \..
d810: 20 20 20 20 20 20 20 20 20 24 6e 65 77 46 69 6c $newFil
d820: 65 4e 61 6d 65 20 24 6d 61 6e 61 67 65 64 4f 6e eName $managedOn
d830: 6c 79 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 20 ly $platform]..
d840: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
d850: 20 20 20 20 20 20 20 73 65 74 20 74 61 72 67 65 set targe
d860: 74 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 75 tFileName [getBu
d870: 69 6c 64 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 ildFileName \..
d880: 20 20 20 20 20 20 20 20 20 20 20 24 66 69 6c 65 $file
d890: 4e 61 6d 65 20 24 6d 61 6e 61 67 65 64 4f 6e 6c Name $managedOnl
d8a0: 79 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 y $platform]..
d8b0: 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 }.... s
d8c0: 65 74 20 74 61 72 67 65 74 44 69 72 65 63 74 6f et targetDirecto
d8d0: 72 79 20 5b 66 69 6c 65 20 64 69 72 6e 61 6d 65 ry [file dirname
d8e0: 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 $targetFileName
d8f0: 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b ].... if {[
d900: 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
d910: 20 69 66 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 if {![file exis
d920: 74 73 20 24 74 61 72 67 65 74 44 69 72 65 63 74 ts $targetDirect
d930: 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ory]} then {..
d940: 20 20 20 20 20 20 20 20 66 69 6c 65 20 6d 6b 64 file mkd
d950: 69 72 20 24 74 61 72 67 65 74 44 69 72 65 63 74 ir $targetDirect
d960: 6f 72 79 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a ory.. }..
d970: 0d 0a 20 20 20 20 20 20 20 20 66 69 6c 65 20 63 .. file c
d980: 6f 70 79 20 2d 66 6f 72 63 65 20 24 73 6f 75 72 opy -force $sour
d990: 63 65 46 69 6c 65 4e 61 6d 65 20 24 74 61 72 67 ceFileName $targ
d9a0: 65 74 46 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 etFileName..
d9b0: 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 }] == 0} then
d9c0: 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 {.. tputs
d9d0: 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
d9e0: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
d9f0: 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
da00: 2d 20 63 6f 70 69 65 64 20 62 69 6e 61 72 79 20 - copied binary
da10: 66 69 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 73 file from \"" $s
da20: 6f 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 22 5c ourceFileName "\
da30: 22 20 74 6f 20 5c 22 22 20 5c 0d 0a 20 20 20 20 " to \"" \..
da40: 20 20 20 20 20 20 20 20 24 74 61 72 67 65 74 46 $targetF
da50: 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 ileName \"\n]..
da60: 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
da70: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
da80: 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
da90: 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
daa0: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 61 "---- fa
dab0: 69 6c 65 64 20 74 6f 20 63 6f 70 79 20 62 69 6e iled to copy bin
dac0: 61 72 79 20 66 69 6c 65 20 66 72 6f 6d 20 5c 22 ary file from \"
dad0: 22 20 24 73 6f 75 72 63 65 46 69 6c 65 4e 61 6d " $sourceFileNam
dae0: 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
daf0: 20 22 5c 22 20 74 6f 20 5c 22 22 20 24 74 61 72 "\" to \"" $tar
db00: 67 65 74 46 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e getFileName \"\n
db10: 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 ].. }..
db20: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 }..... proc t
db30: 72 79 43 6f 70 79 42 75 69 6c 64 46 69 6c 65 20 ryCopyBuildFile
db40: 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 66 {.. f
db50: 69 6c 65 4e 61 6d 65 20 6d 61 6e 61 67 65 64 4f ileName managedO
db60: 6e 6c 79 20 7b 70 6c 61 74 66 6f 72 6d 20 22 22 nly {platform ""
db70: 7d 20 7b 6e 65 77 46 69 6c 65 4e 61 6d 65 20 22 } {newFileName "
db80: 22 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 "}..
db90: 7b 76 65 72 62 6f 73 65 20 74 72 75 65 7d 20 7d {verbose true} }
dba0: 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 73 6f {.. set so
dbb0: 75 72 63 65 46 69 6c 65 4e 61 6d 65 20 5b 67 65 urceFileName [ge
dbc0: 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 24 tBuildFileName $
dbd0: 66 69 6c 65 4e 61 6d 65 20 24 6d 61 6e 61 67 65 fileName $manage
dbe0: 64 4f 6e 6c 79 20 24 70 6c 61 74 66 6f 72 6d 5d dOnly $platform]
dbf0: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b .... if {![
dc00: 66 69 6c 65 20 65 78 69 73 74 73 20 24 73 6f 75 file exists $sou
dc10: 72 63 65 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 rceFileName]} th
dc20: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 en {.. if
dc30: 20 7b 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e {$verbose} then
dc40: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 {.. tp
dc50: 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
dc60: 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
dc70: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
dc80: 20 22 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 63 "---- skipped c
dc90: 6f 70 79 69 6e 67 20 62 75 69 6c 64 20 66 69 6c opying build fil
dca0: 65 20 5c 22 22 20 24 73 6f 75 72 63 65 46 69 6c e \"" $sourceFil
dcb0: 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 eName \..
dcc0: 20 20 20 20 20 20 20 22 5c 22 2c 20 69 74 20 64 "\", it d
dcd0: 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 5c 6e 22 oes not exist\n"
dce0: 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a ].. }....
dcf0: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 0d 0a return..
dd00: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
dd10: 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
dd20: 67 74 68 20 24 6e 65 77 46 69 6c 65 4e 61 6d 65 gth $newFileName
dd30: 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
dd40: 20 20 20 20 20 20 20 73 65 74 20 74 61 72 67 65 set targe
dd50: 74 46 69 6c 65 4e 61 6d 65 20 5b 67 65 74 42 69 tFileName [getBi
dd60: 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 6e 65 naryFileName $ne
dd70: 77 46 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 wFileName $platf
dd80: 6f 72 6d 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c orm].. } el
dd90: 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 se {.. se
dda0: 74 20 74 61 72 67 65 74 46 69 6c 65 4e 61 6d 65 t targetFileName
ddb0: 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e [getBinaryFileN
ddc0: 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 ame $fileName $p
ddd0: 6c 61 74 66 6f 72 6d 5d 0d 0a 20 20 20 20 20 20 latform]..
dde0: 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 65 74 20 74 }.... set t
ddf0: 61 72 67 65 74 44 69 72 65 63 74 6f 72 79 20 5b argetDirectory [
de00: 66 69 6c 65 20 64 69 72 6e 61 6d 65 20 24 74 61 file dirname $ta
de10: 72 67 65 74 46 69 6c 65 4e 61 6d 65 5d 0d 0a 0d rgetFileName]...
de20: 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 . if {[catc
de30: 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 h {.. if
de40: 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {![file exists $
de50: 74 61 72 67 65 74 44 69 72 65 63 74 6f 72 79 5d targetDirectory]
de60: 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
de70: 20 20 20 20 66 69 6c 65 20 6d 6b 64 69 72 20 24 file mkdir $
de80: 74 61 72 67 65 74 44 69 72 65 63 74 6f 72 79 0d targetDirectory.
de90: 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
dea0: 20 20 20 20 20 20 66 69 6c 65 20 63 6f 70 79 20 file copy
deb0: 2d 66 6f 72 63 65 20 24 73 6f 75 72 63 65 46 69 -force $sourceFi
dec0: 6c 65 4e 61 6d 65 20 24 74 61 72 67 65 74 46 69 leName $targetFi
ded0: 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 7d 5d leName.. }]
dee0: 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
def0: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
df00: 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
df10: 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
df20: 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f "---- co
df30: 70 69 65 64 20 62 75 69 6c 64 20 66 69 6c 65 20 pied build file
df40: 66 72 6f 6d 20 5c 22 22 20 24 73 6f 75 72 63 65 from \"" $source
df50: 46 69 6c 65 4e 61 6d 65 20 22 5c 22 20 74 6f 20 FileName "\" to
df60: 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 \"" \..
df70: 20 20 20 24 74 61 72 67 65 74 46 69 6c 65 4e 61 $targetFileNa
df80: 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 me \"\n]..
df90: 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
dfa0: 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
dfb0: 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
dfc0: 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
dfd0: 20 20 20 22 2d 2d 2d 2d 20 66 61 69 6c 65 64 20 "---- failed
dfe0: 74 6f 20 63 6f 70 79 20 62 75 69 6c 64 20 66 69 to copy build fi
dff0: 6c 65 20 66 72 6f 6d 20 5c 22 22 20 24 73 6f 75 le from \"" $sou
e000: 72 63 65 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 rceFileName \..
e010: 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 74 "\" t
e020: 6f 20 5c 22 22 20 24 74 61 72 67 65 74 46 69 6c o \"" $targetFil
e030: 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a 20 20 20 eName \"\n]..
e040: 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
e050: 20 20 20 20 70 72 6f 63 20 74 72 79 44 65 6c 65 proc tryDele
e060: 74 65 42 69 6e 61 72 79 46 69 6c 65 20 7b 20 66 teBinaryFile { f
e070: 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 6f 72 ileName {platfor
e080: 6d 20 22 22 7d 20 7b 76 65 72 62 6f 73 65 20 74 m ""} {verbose t
e090: 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 rue} } {..
e0a0: 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 67 65 set fileName [ge
e0b0: 74 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 tBinaryFileName
e0c0: 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 66 $fileName $platf
e0d0: 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 orm].... if
e0e0: 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 {![file exists
e0f0: 24 66 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e $fileName]} then
e100: 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
e110: 24 76 65 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b $verbose} then {
e120: 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 .. tput
e130: 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
e140: 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
e150: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
e160: 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 64 65 6c ---- skipped del
e170: 65 74 69 6e 67 20 62 69 6e 61 72 79 20 66 69 6c eting binary fil
e180: 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 e \"" $fileName
e190: 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
e1a0: 20 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f "\", it does no
e1b0: 74 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 t exist\n"]..
e1c0: 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
e1d0: 20 20 72 65 74 75 72 6e 0d 0a 20 20 20 20 20 20 return..
e1e0: 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b }.... if {[
e1f0: 63 61 74 63 68 20 7b 66 69 6c 65 20 64 65 6c 65 catch {file dele
e200: 74 65 20 24 66 69 6c 65 4e 61 6d 65 7d 5d 20 3d te $fileName}] =
e210: 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
e220: 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
e230: 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
e240: 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
e250: 20 20 20 20 20 20 22 2d 2d 2d 2d 20 64 65 6c 65 "---- dele
e260: 74 65 64 20 62 69 6e 61 72 79 20 66 69 6c 65 20 ted binary file
e270: 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 22 \"" $fileName \"
e280: 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 \n].. } els
e290: 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 e {.. tpu
e2a0: 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
e2b0: 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
e2c0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d .. "-
e2d0: 2d 2d 2d 20 66 61 69 6c 65 64 20 74 6f 20 64 65 --- failed to de
e2e0: 6c 65 74 65 20 62 69 6e 61 72 79 20 66 69 6c 65 lete binary file
e2f0: 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c \"" $fileName \
e300: 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 "\n].. }..
e310: 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
e320: 63 20 74 72 79 44 65 6c 65 74 65 42 75 69 6c 64 c tryDeleteBuild
e330: 46 69 6c 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 File {..
e340: 20 20 20 20 66 69 6c 65 4e 61 6d 65 20 6d 61 6e fileName man
e350: 61 67 65 64 4f 6e 6c 79 20 7b 70 6c 61 74 66 6f agedOnly {platfo
e360: 72 6d 20 22 22 7d 20 7b 76 65 72 62 6f 73 65 20 rm ""} {verbose
e370: 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 true} } {..
e380: 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 67 set fileName [g
e390: 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 etBuildFileName
e3a0: 24 66 69 6c 65 4e 61 6d 65 20 24 6d 61 6e 61 67 $fileName $manag
e3b0: 65 64 4f 6e 6c 79 20 24 70 6c 61 74 66 6f 72 6d edOnly $platform
e3c0: 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 ].... if {!
e3d0: 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 [file exists $fi
e3e0: 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d leName]} then {.
e3f0: 0a 20 20 20 20 20 20 20 20 69 66 20 7b 24 76 65 . if {$ve
e400: 72 62 6f 73 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 rbose} then {..
e410: 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
e420: 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
e430: 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
e440: 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
e450: 2d 20 73 6b 69 70 70 65 64 20 64 65 6c 65 74 69 - skipped deleti
e460: 6e 67 20 62 75 69 6c 64 20 66 69 6c 65 20 5c 22 ng build file \"
e470: 22 20 24 66 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 " $fileName \..
e480: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 "\"
e490: 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 , it does not ex
e4a0: 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 ist\n"]..
e4b0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 72 65 }.... re
e4c0: 74 75 72 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d turn.. }...
e4d0: 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 . if {[catc
e4e0: 68 20 7b 66 69 6c 65 20 64 65 6c 65 74 65 20 24 h {file delete $
e4f0: 66 69 6c 65 4e 61 6d 65 7d 5d 20 3d 3d 20 30 7d fileName}] == 0}
e500: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
e510: 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
e520: 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
e530: 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
e540: 20 20 22 2d 2d 2d 2d 20 64 65 6c 65 74 65 64 20 "---- deleted
e550: 62 75 69 6c 64 20 66 69 6c 65 20 5c 22 22 20 24 build file \"" $
e560: 66 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a fileName \"\n]..
e570: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
e580: 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
e590: 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
e5a0: 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
e5b0: 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 "---- f
e5c0: 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20 ailed to delete
e5d0: 62 75 69 6c 64 20 66 69 6c 65 20 5c 22 22 20 24 build file \"" $
e5e0: 66 69 6c 65 4e 61 6d 65 20 5c 22 5c 6e 5d 0d 0a fileName \"\n]..
e5f0: 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
e600: 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 79 43 ... proc tryC
e610: 6f 70 79 41 73 73 65 6d 62 6c 79 20 7b 0d 0a 20 opyAssembly {..
e620: 20 20 20 20 20 20 20 20 20 20 20 66 69 6c 65 4e fileN
e630: 61 6d 65 20 6d 61 6e 61 67 65 64 4f 6e 6c 79 20 ame managedOnly
e640: 7b 70 6c 61 74 66 6f 72 6d 20 22 22 7d 20 7b 70 {platform ""} {p
e650: 64 62 20 74 72 75 65 7d 20 7b 76 65 72 62 6f 73 db true} {verbos
e660: 65 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 e true} } {..
e670: 20 20 20 74 72 79 43 6f 70 79 42 75 69 6c 64 46 tryCopyBuildF
e680: 69 6c 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 6d ile $fileName $m
e690: 61 6e 61 67 65 64 4f 6e 6c 79 20 24 70 6c 61 74 anagedOnly $plat
e6a0: 66 6f 72 6d 20 22 22 20 24 76 65 72 62 6f 73 65 form "" $verbose
e6b0: 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 70 .... if {$p
e6c0: 64 62 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 db} then {..
e6d0: 20 20 20 20 74 72 79 43 6f 70 79 42 75 69 6c 64 tryCopyBuild
e6e0: 46 69 6c 65 20 5b 61 70 70 65 6e 64 41 72 67 73 File [appendArgs
e6f0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
e700: 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 24 [file rootname $
e710: 66 69 6c 65 4e 61 6d 65 5d 20 2e 70 64 62 5d 20 fileName] .pdb]
e720: 24 6d 61 6e 61 67 65 64 4f 6e 6c 79 20 24 70 6c $managedOnly $pl
e730: 61 74 66 6f 72 6d 20 22 22 20 24 76 65 72 62 6f atform "" $verbo
e740: 73 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 se.. }..
e750: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
e760: 74 72 79 44 65 6c 65 74 65 41 73 73 65 6d 62 6c tryDeleteAssembl
e770: 79 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 y {..
e780: 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 66 fileName {platf
e790: 6f 72 6d 20 22 22 7d 20 7b 70 64 62 20 74 72 75 orm ""} {pdb tru
e7a0: 65 7d 20 7b 76 65 72 62 6f 73 65 20 74 72 75 65 e} {verbose true
e7b0: 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 72 79 } } {.. try
e7c0: 44 65 6c 65 74 65 42 69 6e 61 72 79 46 69 6c 65 DeleteBinaryFile
e7d0: 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 6c 61 74 $fileName $plat
e7e0: 66 6f 72 6d 20 24 76 65 72 62 6f 73 65 0d 0a 0d form $verbose...
e7f0: 0a 20 20 20 20 20 20 69 66 20 7b 24 70 64 62 7d . if {$pdb}
e800: 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
e810: 20 74 72 79 44 65 6c 65 74 65 42 69 6e 61 72 79 tryDeleteBinary
e820: 46 69 6c 65 20 5b 61 70 70 65 6e 64 41 72 67 73 File [appendArgs
e830: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
e840: 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 24 [file rootname $
e850: 66 69 6c 65 4e 61 6d 65 5d 20 2e 70 64 62 5d 20 fileName] .pdb]
e860: 24 70 6c 61 74 66 6f 72 6d 20 24 76 65 72 62 6f $platform $verbo
e870: 73 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 se.. }..
e880: 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
e890: 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 6c 79 20 tryLoadAssembly
e8a0: 7b 20 66 69 6c 65 4e 61 6d 65 20 7b 70 6c 61 74 { fileName {plat
e8b0: 66 6f 72 6d 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 form ""} } {..
e8c0: 20 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 set fileName
e8d0: 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 4e [getBinaryFileN
e8e0: 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 20 24 70 ame $fileName $p
e8f0: 6c 61 74 66 6f 72 6d 5d 0d 0a 0d 0a 20 20 20 20 latform]....
e900: 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
e910: 20 20 20 20 20 20 20 20 73 65 74 20 61 73 73 65 set asse
e920: 6d 62 6c 79 20 5b 6f 62 6a 65 63 74 20 6c 6f 61 mbly [object loa
e930: 64 20 2d 6c 6f 61 64 74 79 70 65 20 46 69 6c 65 d -loadtype File
e940: 20 2d 61 6c 69 61 73 20 24 66 69 6c 65 4e 61 6d -alias $fileNam
e950: 65 5d 0d 0a 20 20 20 20 20 20 7d 5d 20 3d 3d 20 e].. }] ==
e960: 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
e970: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
e980: 4e 4f 54 45 3a 20 4e 6f 77 2c 20 61 64 64 20 74 NOTE: Now, add t
e990: 68 65 20 6e 65 63 65 73 73 61 72 79 20 74 65 73 he necessary tes
e9a0: 74 20 63 6f 6e 73 74 72 61 69 6e 74 2e 0d 0a 20 t constraint...
e9b0: 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
e9c0: 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 addConstraint
e9d0: 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 5b [file rootname [
e9e0: 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 4e file tail $fileN
e9f0: 61 6d 65 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 ame]]....
ea00: 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
ea10: 54 45 3a 20 47 72 61 62 20 74 68 65 20 69 6d 61 TE: Grab the ima
ea20: 67 65 20 72 75 6e 74 69 6d 65 20 76 65 72 73 69 ge runtime versi
ea30: 6f 6e 20 66 72 6f 6d 20 74 68 65 20 61 73 73 65 on from the asse
ea40: 6d 62 6c 79 20 62 65 63 61 75 73 65 0d 0a 20 20 mbly because..
ea50: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 65 # se
ea60: 76 65 72 61 6c 20 74 65 73 74 73 20 72 65 6c 79 veral tests rely
ea70: 20 6f 6e 20 69 74 20 68 61 76 69 6e 67 20 61 20 on it having a
ea80: 63 65 72 74 61 69 6e 20 76 61 6c 75 65 2e 0d 0a certain value...
ea90: 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
eaa0: 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 addConstraint
eab0: 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 66 69 [appendArgs [fi
eac0: 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d le tail $fileNam
ead0: 65 5d 20 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 e] _ \..
eae0: 20 20 20 20 5b 24 61 73 73 65 6d 62 6c 79 20 49 [$assembly I
eaf0: 6d 61 67 65 52 75 6e 74 69 6d 65 56 65 72 73 69 mageRuntimeVersi
eb00: 6f 6e 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 on]]....
eb10: 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
eb20: 45 3a 20 52 65 74 75 72 6e 20 74 68 65 20 66 75 E: Return the fu
eb30: 6c 6c 20 70 61 74 68 20 6f 66 20 74 68 65 20 6c ll path of the l
eb40: 6f 61 64 65 64 20 66 69 6c 65 2e 0d 0a 20 20 20 oaded file...
eb50: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
eb60: 72 65 74 75 72 6e 20 24 66 69 6c 65 4e 61 6d 65 return $fileName
eb70: 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
eb80: 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 return ""..
eb90: 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
eba0: 20 69 73 53 51 4c 69 74 65 52 65 61 64 79 20 7b isSQLiteReady {
ebb0: 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
ebc0: 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 # NOTE: This
ebd0: 20 70 72 6f 63 65 64 75 72 65 20 6d 75 73 74 20 procedure must
ebe0: 72 65 74 75 72 6e 20 6e 6f 6e 2d 7a 65 72 6f 20 return non-zero
ebf0: 6f 6e 6c 79 20 69 66 20 74 68 65 20 53 51 4c 69 only if the SQLi
ec00: 74 65 20 6e 61 74 69 76 65 0d 0a 20 20 20 20 20 te native..
ec10: 20 23 20 20 20 20 20 20 20 6c 69 62 72 61 72 79 # library
ec20: 20 61 6e 64 20 74 68 65 20 53 79 73 74 65 6d 2e and the System.
ec30: 44 61 74 61 2e 53 51 4c 69 74 65 20 6d 61 6e 61 Data.SQLite mana
ec40: 67 65 64 20 61 73 73 65 6d 62 6c 79 20 61 72 65 ged assembly are
ec50: 20 6c 6f 61 64 65 64 0d 0a 20 20 20 20 20 20 23 loaded.. #
ec60: 20 20 20 20 20 20 20 61 6e 64 20 72 65 61 64 79 and ready
ec70: 20 66 6f 72 20 75 73 65 20 62 79 20 74 68 65 20 for use by the
ec80: 74 65 73 74 20 73 75 69 74 65 2e 20 20 43 75 72 test suite. Cur
ec90: 72 65 6e 74 6c 79 2c 20 74 68 69 73 20 70 72 6f rently, this pro
eca0: 63 65 64 75 72 65 0d 0a 20 20 20 20 20 20 23 20 cedure.. #
ecb0: 20 20 20 20 20 20 73 68 6f 75 6c 64 20 62 65 20 should be
ecc0: 63 61 6c 6c 65 64 20 6f 6e 6c 79 20 61 66 74 65 called only afte
ecd0: 72 20 74 68 65 20 5b 74 72 79 4c 6f 61 64 41 73 r the [tryLoadAs
ece0: 73 65 6d 62 6c 79 5d 20 70 72 6f 63 65 64 75 72 sembly] procedur
ecf0: 65 20 68 61 73 0d 0a 20 20 20 20 20 20 23 20 20 e has.. #
ed00: 20 20 20 20 20 62 65 65 6e 20 63 61 6c 6c 65 64 been called
ed10: 20 74 6f 20 70 72 6f 62 65 20 66 6f 72 20 74 68 to probe for th
ed20: 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 e System.Data.SQ
ed30: 4c 69 74 65 20 6d 61 6e 61 67 65 64 20 61 73 73 Lite managed ass
ed40: 65 6d 62 6c 79 0d 0a 20 20 20 20 20 20 23 20 20 embly.. #
ed50: 20 20 20 20 20 61 6e 64 20 74 68 65 20 5b 63 68 and the [ch
ed60: 65 63 6b 46 6f 72 53 51 4c 69 74 65 5d 20 70 72 eckForSQLite] pr
ed70: 6f 63 65 64 75 72 65 20 68 61 73 20 62 65 65 6e ocedure has been
ed80: 20 63 61 6c 6c 65 64 20 74 6f 20 70 72 6f 62 65 called to probe
ed90: 20 66 6f 72 0d 0a 20 20 20 20 20 20 23 20 20 20 for.. #
eda0: 20 20 20 20 74 68 65 20 53 51 4c 69 74 65 20 6e the SQLite n
edb0: 61 74 69 76 65 20 6c 69 62 72 61 72 79 3b 20 6f ative library; o
edc0: 74 68 65 72 77 69 73 65 2c 20 74 68 69 73 20 70 therwise, this p
edd0: 72 6f 63 65 64 75 72 65 20 77 69 6c 6c 20 73 69 rocedure will si
ede0: 6d 70 6c 79 0d 0a 20 20 20 20 20 20 23 20 20 20 mply.. #
edf0: 20 20 20 20 61 6c 77 61 79 73 20 72 65 74 75 72 always retur
ee00: 6e 20 7a 65 72 6f 2e 0d 0a 20 20 20 20 20 20 23 n zero... #
ee10: 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b .. return [
ee20: 65 78 70 72 20 7b 0d 0a 20 20 20 20 20 20 20 20 expr {..
ee30: 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 [haveConstraint
ee40: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
ee50: 74 65 5d 20 26 26 20 5b 68 61 76 65 43 6f 6e 73 te] && [haveCons
ee60: 74 72 61 69 6e 74 20 53 51 4c 69 74 65 5d 0d 0a traint SQLite]..
ee70: 20 20 20 20 20 20 7d 5d 0d 0a 20 20 20 20 7d 0d }].. }.
ee80: 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 6d 61 74 .... proc mat
ee90: 63 68 50 6c 61 74 66 6f 72 6d 20 7b 20 70 6c 61 chPlatform { pla
eea0: 74 66 6f 72 6d 20 7d 20 7b 0d 0a 20 20 20 20 20 tform } {..
eeb0: 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
eec0: 3a 20 41 6e 20 65 6d 70 74 79 20 73 74 72 69 6e : An empty strin
eed0: 67 20 66 6f 72 20 74 68 65 20 70 6c 61 74 66 6f g for the platfo
eee0: 72 6d 20 6d 65 61 6e 73 20 74 68 61 74 20 74 68 rm means that th
eef0: 65 20 62 75 69 6c 64 20 69 73 20 6e 6f 74 0d 0a e build is not..
ef00: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 5b 70 # [p
ef10: 72 69 6d 61 72 69 6c 79 5d 20 61 20 6e 61 74 69 rimarily] a nati
ef20: 76 65 20 62 75 69 6c 64 3b 20 74 68 65 72 65 66 ve build; theref
ef30: 6f 72 65 2c 20 69 74 20 61 6c 77 61 79 73 20 6d ore, it always m
ef40: 61 74 63 68 65 73 2e 0d 0a 20 20 20 20 20 20 23 atches... #
ef50: 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
ef60: 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 ing length $plat
ef70: 66 6f 72 6d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e form] == 0} then
ef80: 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 {.. retu
ef90: 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 20 7d rn true.. }
efa0: 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
efb0: 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 # NOTE: If th
efc0: 65 20 6d 61 63 68 69 6e 65 20 6e 61 6d 65 20 69 e machine name i
efd0: 73 20 75 6e 61 76 61 69 6c 61 62 6c 65 2c 20 74 s unavailable, t
efe0: 68 65 72 65 20 69 73 20 6e 6f 74 68 69 6e 67 20 here is nothing
eff0: 65 6c 73 65 20 77 65 0d 0a 20 20 20 20 20 20 23 else we.. #
f000: 20 20 20 20 20 20 20 63 61 6e 20 64 6f 2e 0d 0a can do...
f010: 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
f020: 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
f030: 20 3a 3a 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 ::tcl_platform(
f040: 6d 61 63 68 69 6e 65 29 5d 7d 20 74 68 65 6e 20 machine)]} then
f050: 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 {.. retur
f060: 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 7d n false.. }
f070: 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
f080: 20 20 20 23 20 4e 4f 54 45 3a 20 44 6f 65 73 20 # NOTE: Does
f090: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 70 6c the specified pl
f0a0: 61 74 66 6f 72 6d 20 6d 61 74 63 68 20 75 70 20 atform match up
f0b0: 74 6f 20 74 68 65 20 63 75 72 72 65 6e 74 20 70 to the current p
f0c0: 72 6f 63 65 73 73 3f 0d 0a 20 20 20 20 20 20 23 rocess?.. #
f0d0: 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 70 6c 61 .. if {$pla
f0e0: 74 66 6f 72 6d 20 65 71 20 5b 6d 61 63 68 69 6e tform eq [machin
f0f0: 65 54 6f 50 6c 61 74 66 6f 72 6d 20 24 3a 3a 74 eToPlatform $::t
f100: 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 6d 61 63 68 cl_platform(mach
f110: 69 6e 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 ine)]} then {..
f120: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
f130: 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 ue.. }....
f140: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
f150: 4e 4f 54 45 3a 20 54 68 65 20 73 70 65 63 69 66 NOTE: The specif
f160: 69 65 64 20 70 6c 61 74 66 6f 72 6d 20 64 6f 65 ied platform doe
f170: 73 20 6e 6f 74 20 6d 61 74 63 68 20 75 70 20 77 s not match up w
f180: 69 74 68 20 74 68 65 20 70 6c 61 74 66 6f 72 6d ith the platform
f190: 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
f1a0: 66 6f 72 20 74 68 65 20 63 75 72 72 65 6e 74 20 for the current
f1b0: 70 72 6f 63 65 73 73 2e 0d 0a 20 20 20 20 20 20 process...
f1c0: 23 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 #.. return
f1d0: 66 61 6c 73 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d false.. }....
f1e0: 0a 20 20 20 20 70 72 6f 63 20 68 61 76 65 53 51 . proc haveSQ
f1f0: 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e LiteObjectComman
f200: 64 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d d {} {.. #.
f210: 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 . # NOTE: I
f220: 73 20 74 68 65 20 5b 6f 62 6a 65 63 74 5d 20 63 s the [object] c
f230: 6f 6d 6d 61 6e 64 20 63 75 72 72 65 6e 74 6c 79 ommand currently
f240: 20 61 76 61 69 6c 61 62 6c 65 3f 0d 0a 20 20 20 available?..
f250: 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 #.. retu
f260: 72 6e 20 5b 65 78 70 72 20 7b 5b 6c 6c 65 6e 67 rn [expr {[lleng
f270: 74 68 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e 64 th [info command
f280: 73 20 6f 62 6a 65 63 74 5d 5d 20 3e 20 30 7d 5d s object]] > 0}]
f290: 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
f2a0: 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 51 4c proc checkForSQL
f2b0: 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 iteObjectCommand
f2c0: 20 7b 20 63 68 61 6e 6e 65 6c 20 7d 20 7b 0d 0a { channel } {..
f2d0: 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
f2e0: 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 68 65 63 6b nnel "---- check
f2f0: 69 6e 67 20 66 6f 72 20 5c 22 6f 62 6a 65 63 74 ing for \"object
f300: 5c 22 20 63 6f 6d 6d 61 6e 64 20 75 73 61 67 65 \" command usage
f310: 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 69 ... ".... i
f320: 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
f330: 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 4f 62 6a 65 ::no(sqliteObje
f340: 63 74 43 6f 6d 6d 61 6e 64 29 5d 20 26 26 20 5c ctCommand)] && \
f350: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 68 61 76 .. [hav
f360: 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d eSQLiteObjectCom
f370: 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 mand]} then {..
f380: 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
f390: 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a 20 20 20 annel yes\n..
f3a0: 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
f3b0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
f3c0: 23 20 4e 4f 54 45 3a 20 55 6e 6c 65 73 73 20 77 # NOTE: Unless w
f3d0: 65 20 61 72 65 20 66 6f 72 62 69 64 64 65 6e 20 e are forbidden
f3e0: 66 72 6f 6d 20 64 6f 69 6e 67 20 73 6f 2c 20 61 from doing so, a
f3f0: 64 64 20 73 6f 6d 65 20 63 6f 6e 73 74 72 61 69 dd some constrai
f400: 6e 74 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 nts.. #
f410: 20 20 20 20 20 74 68 61 74 20 77 69 6c 6c 20 61 that will a
f420: 6c 6c 6f 77 20 6d 6f 73 74 20 6f 66 20 74 68 65 llow most of the
f430: 20 74 65 73 74 20 73 75 69 74 65 20 74 6f 20 72 test suite to r
f440: 75 6e 20 28 69 2e 65 2e 20 74 68 6f 73 65 0d 0a un (i.e. those..
f450: 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
f460: 74 65 73 74 73 20 74 68 61 74 20 64 6f 20 6e 6f tests that do no
f470: 74 20 64 69 72 65 63 74 6c 79 20 72 65 6c 79 20 t directly rely
f480: 75 70 6f 6e 20 74 68 65 20 5b 6f 62 6a 65 63 74 upon the [object
f490: 5d 20 63 6f 6d 6d 61 6e 64 29 2e 0d 0a 20 20 20 ] command)...
f4a0: 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
f4b0: 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
f4c0: 73 20 3a 3a 6e 6f 28 73 68 69 6d 53 51 4c 69 74 s ::no(shimSQLit
f4d0: 65 41 73 73 65 6d 62 6c 79 43 6f 6e 73 74 72 61 eAssemblyConstra
f4e0: 69 6e 74 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a ints)]} then {..
f4f0: 20 20 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e addCon
f500: 73 74 72 61 69 6e 74 20 53 51 4c 69 74 65 0d 0a straint SQLite..
f510: 20 20 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e addCon
f520: 73 74 72 61 69 6e 74 20 53 51 4c 69 74 65 49 6e straint SQLiteIn
f530: 74 65 72 6f 70 0d 0a 20 20 20 20 20 20 20 20 20 terop..
f540: 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 addConstraint S
f550: 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
f560: 65 0d 0a 20 20 20 20 20 20 20 20 20 20 61 64 64 e.. add
f570: 43 6f 6e 73 74 72 61 69 6e 74 20 53 79 73 74 65 Constraint Syste
f580: 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 45 6e m.Data.SQLite.En
f590: 63 72 79 70 74 69 6f 6e 0d 0a 20 20 20 20 20 20 cryption..
f5a0: 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e addConstrain
f5b0: 74 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 t System.Data.SQ
f5c0: 4c 69 74 65 2e 4c 69 6e 71 0d 0a 0d 0a 20 20 20 Lite.Linq....
f5d0: 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 addConstr
f5e0: 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
f5f0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
f600: 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
f610: 4c 69 74 65 2e 64 6c 6c 5f 76 20 5b 67 65 74 42 Lite.dll_v [getB
f620: 75 69 6c 64 43 6c 72 56 65 72 73 69 6f 6e 5d 5d uildClrVersion]]
f630: 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
f640: 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
f650: 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 73 68 o exists ::no(sh
f660: 69 6d 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f imSQLiteDefineCo
f670: 6e 73 74 61 6e 74 43 6f 6e 73 74 72 61 69 6e 74 nstantConstraint
f680: 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
f690: 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 64 foreach d
f6a0: 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 20 5b 6c efineConstant [l
f6b0: 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ist \..
f6c0: 20 20 20 20 20 49 4e 54 45 52 4f 50 5f 45 58 54 INTEROP_EXT
f6d0: 45 4e 53 49 4f 4e 5f 46 55 4e 43 54 49 4f 4e 53 ENSION_FUNCTIONS
f6e0: 20 49 4e 54 45 52 4f 50 5f 46 54 53 35 5f 45 58 INTEROP_FTS5_EX
f6f0: 54 45 4e 53 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 TENSION \..
f700: 20 20 20 20 20 20 20 20 20 49 4e 54 45 52 4f 50 INTEROP
f710: 5f 4a 53 4f 4e 31 5f 45 58 54 45 4e 53 49 4f 4e _JSON1_EXTENSION
f720: 20 49 4e 54 45 52 4f 50 5f 50 45 52 43 45 4e 54 INTEROP_PERCENT
f730: 49 4c 45 5f 45 58 54 45 4e 53 49 4f 4e 20 5c 0d ILE_EXTENSION \.
f740: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 49 . I
f750: 4e 54 45 52 4f 50 5f 52 45 47 45 58 50 5f 45 58 NTEROP_REGEXP_EX
f760: 54 45 4e 53 49 4f 4e 20 49 4e 54 45 52 4f 50 5f TENSION INTEROP_
f770: 54 45 53 54 5f 45 58 54 45 4e 53 49 4f 4e 20 5c TEST_EXTENSION \
f780: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
f790: 49 4e 54 45 52 4f 50 5f 53 45 53 53 49 4f 4e 5f INTEROP_SESSION_
f7a0: 45 58 54 45 4e 53 49 4f 4e 20 49 4e 54 45 52 4f EXTENSION INTERO
f7b0: 50 5f 53 48 41 31 5f 45 58 54 45 4e 53 49 4f 4e P_SHA1_EXTENSION
f7c0: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
f7d0: 20 20 49 4e 54 45 52 4f 50 5f 54 4f 54 59 50 45 INTEROP_TOTYPE
f7e0: 5f 45 58 54 45 4e 53 49 4f 4e 20 49 4e 54 45 52 _EXTENSION INTER
f7f0: 4f 50 5f 56 49 52 54 55 41 4c 5f 54 41 42 4c 45 OP_VIRTUAL_TABLE
f800: 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
f810: 20 20 55 53 45 5f 49 4e 54 45 52 4f 50 5f 44 4c USE_INTEROP_DL
f820: 4c 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 L] {..
f830: 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 addConstraint
f840: 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
f850: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b [
f860: 67 65 74 53 51 4c 69 74 65 44 65 66 69 6e 65 43 getSQLiteDefineC
f870: 6f 6e 73 74 61 6e 74 50 72 65 66 69 78 5d 20 24 onstantPrefix] $
f880: 64 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 5d 0d defineConstant].
f890: 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
f8a0: 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
f8b0: 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
f8c0: 69 73 74 73 20 3a 3a 6e 6f 28 73 68 69 6d 53 51 ists ::no(shimSQ
f8d0: 4c 69 74 65 56 69 73 75 61 6c 53 74 75 64 69 6f LiteVisualStudio
f8e0: 43 6f 6e 73 74 72 61 69 6e 74 73 29 5d 7d 20 74 Constraints)]} t
f8f0: 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
f900: 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 5b addConstraint [
f910: 61 70 70 65 6e 64 41 72 67 73 20 76 69 73 75 61 appendArgs visua
f920: 6c 53 74 75 64 69 6f 20 5b 67 65 74 42 75 69 6c lStudio [getBuil
f930: 64 59 65 61 72 5d 5d 0d 0a 20 20 20 20 20 20 20 dYear]]..
f940: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 }.... tp
f950: 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c uts $channel no\
f960: 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 n.. }..
f970: 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 }..... proc c
f980: 68 61 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 69 hangeNativeRunti
f990: 6d 65 4f 70 74 69 6f 6e 20 7b 20 6e 61 74 69 76 meOption { nativ
f9a0: 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 e } {.. if
f9b0: 7b 5b 6c 6c 65 6e 67 74 68 20 5b 69 6e 66 6f 20 {[llength [info
f9c0: 63 6f 6d 6d 61 6e 64 73 20 64 65 62 75 67 5d 5d commands debug]]
f9d0: 20 3e 20 30 20 26 26 20 5c 0d 0a 20 20 20 20 20 > 0 && \..
f9e0: 20 20 20 20 20 5b 6c 6c 65 6e 67 74 68 20 5b 69 [llength [i
f9f0: 6e 66 6f 20 73 75 62 63 6f 6d 6d 61 6e 64 73 20 nfo subcommands
fa00: 64 65 62 75 67 20 72 75 6e 74 69 6d 65 6f 70 74 debug runtimeopt
fa10: 69 6f 6e 5d 5d 20 3e 20 30 20 26 26 20 5b 63 61 ion]] > 0 && [ca
fa20: 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 64 tch {.. d
fa30: 65 62 75 67 20 72 75 6e 74 69 6d 65 6f 70 74 69 ebug runtimeopti
fa40: 6f 6e 20 5b 65 78 70 72 20 7b 24 6e 61 74 69 76 on [expr {$nativ
fa50: 65 20 3f 20 22 61 64 64 22 20 3a 20 22 72 65 6d e ? "add" : "rem
fa60: 6f 76 65 22 7d 5d 20 6e 61 74 69 76 65 0d 0a 20 ove"}] native..
fa70: 20 20 20 20 20 7d 5d 20 3d 3d 20 30 7d 20 74 68 }] == 0} th
fa80: 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 en {.. re
fa90: 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 turn true..
faa0: 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b }.... if {
fab0: 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 [haveSQLiteObjec
fac0: 74 43 6f 6d 6d 61 6e 64 5d 20 26 26 20 5b 63 61 tCommand] && [ca
fad0: 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f tch {.. o
fae0: 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 49 6e 74 bject invoke Int
faf0: 65 72 70 72 65 74 65 72 2e 47 65 74 41 63 74 69 erpreter.GetActi
fb00: 76 65 20 5b 65 78 70 72 20 7b 24 6e 61 74 69 76 ve [expr {$nativ
fb10: 65 20 3f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 e ? \..
fb20: 20 20 20 22 41 64 64 52 75 6e 74 69 6d 65 4f 70 "AddRuntimeOp
fb30: 74 69 6f 6e 22 20 3a 20 22 52 65 6d 6f 76 65 52 tion" : "RemoveR
fb40: 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 22 7d 5d 20 untimeOption"}]
fb50: 6e 61 74 69 76 65 0d 0a 20 20 20 20 20 20 7d 5d native.. }]
fb60: 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 == 0} then {..
fb70: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 return tr
fb80: 75 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 ue.. }....
fb90: 20 20 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 return fals
fba0: 65 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 e.. }.....
fbb0: 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 51 proc checkForSQ
fbc0: 4c 69 74 65 42 75 69 6c 64 73 20 7b 20 63 68 61 LiteBuilds { cha
fbd0: 6e 6e 65 6c 20 7b 73 65 6c 65 63 74 20 66 61 6c nnel {select fal
fbe0: 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 se} } {.. #
fbf0: 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
fc00: 43 68 65 63 6b 20 66 6f 72 20 65 76 65 72 79 20 Check for every
fc10: 70 6f 73 73 69 62 6c 65 20 76 61 6c 69 64 20 63 possible valid c
fc20: 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 76 61 ombination of va
fc30: 6c 75 65 73 20 75 73 65 64 20 77 68 65 6e 0d 0a lues used when..
fc40: 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6c 6f # lo
fc50: 63 61 74 69 6e 67 20 6f 75 74 20 74 68 65 20 62 cating out the b
fc60: 75 69 6c 64 20 6f 75 74 70 75 74 20 64 69 72 65 uild output dire
fc70: 63 74 6f 72 79 2c 20 73 68 6f 77 69 6e 67 20 65 ctory, showing e
fc80: 61 63 68 20 61 76 61 69 6c 61 62 6c 65 0d 0a 20 ach available..
fc90: 20 20 20 20 20 23 20 20 20 20 20 20 20 62 75 69 # bui
fca0: 6c 64 20 76 61 72 69 61 74 69 6f 6e 20 61 6c 6f ld variation alo
fcb0: 6e 67 20 74 68 65 20 77 61 79 2e 0d 0a 20 20 20 ng the way...
fcc0: 20 20 20 23 0d 0a 20 20 20 20 20 20 66 6f 72 65 #.. fore
fcd0: 61 63 68 20 6e 61 74 69 76 65 20 5b 6c 69 73 74 ach native [list
fce0: 20 66 61 6c 73 65 20 74 72 75 65 5d 20 7b 0d 0a false true] {..
fcf0: 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
fd00: 79 65 61 72 20 5b 67 65 74 42 75 69 6c 64 59 65 year [getBuildYe
fd10: 61 72 73 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 ars] {..
fd20: 20 20 66 6f 72 65 61 63 68 20 63 6f 6e 66 69 67 foreach config
fd30: 75 72 61 74 69 6f 6e 20 5b 67 65 74 42 75 69 6c uration [getBuil
fd40: 64 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 73 5d dConfigurations]
fd50: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
fd60: 66 6f 72 65 61 63 68 20 65 78 74 72 61 20 5b 67 foreach extra [g
fd70: 65 74 42 75 69 6c 64 45 78 74 72 61 73 5d 20 7b etBuildExtras] {
fd80: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
fd90: 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 #..
fda0: 20 23 20 4e 4f 54 45 3a 20 46 69 67 75 72 65 20 # NOTE: Figure
fdb0: 6f 75 74 20 74 68 65 20 65 66 66 65 63 74 69 76 out the effectiv
fdc0: 65 20 62 75 69 6c 64 20 70 6c 61 74 66 6f 72 6d e build platform
fdd0: 2e 20 20 54 68 69 73 20 69 73 0d 0a 20 20 20 20 . This is..
fde0: 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
fdf0: 20 20 62 61 73 65 64 20 6f 6e 20 77 68 65 74 68 based on wheth
fe00: 65 72 20 6f 72 20 6e 6f 74 20 61 20 5b 70 72 69 er or not a [pri
fe10: 6d 61 72 69 6c 79 5d 20 6e 61 74 69 76 65 20 62 marily] native b
fe20: 75 69 6c 64 0d 0a 20 20 20 20 20 20 20 20 20 20 uild..
fe30: 20 20 20 20 23 20 20 20 20 20 20 20 69 73 20 62 # is b
fe40: 65 69 6e 67 20 75 73 65 64 2e 20 20 46 6f 72 20 eing used. For
fe50: 5b 70 72 69 6d 61 72 69 6c 79 5d 20 6e 6f 6e 2d [primarily] non-
fe60: 6e 61 74 69 76 65 20 62 75 69 6c 64 73 2c 0d 0a native builds,..
fe70: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
fe80: 20 20 20 20 20 20 74 68 69 73 20 77 69 6c 6c 20 this will
fe90: 62 65 20 61 6e 20 65 6d 70 74 79 20 73 74 72 69 be an empty stri
fea0: 6e 67 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ng...
feb0: 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
fec0: 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d set platform
fed0: 20 5b 67 65 74 42 75 69 6c 64 50 6c 61 74 66 6f [getBuildPlatfo
fee0: 72 6d 20 24 6e 61 74 69 76 65 5d 0d 0a 0d 0a 20 rm $native]....
fef0: 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 tpu
ff00: 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
ff10: 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
ff20: 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
ff30: 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 -- checking for
ff40: 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
ff50: 74 65 20 62 75 69 6c 64 20 5c 22 22 20 5b 65 78 te build \"" [ex
ff60: 70 72 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 pr \..
ff70: 20 20 20 20 20 20 20 20 7b 24 6e 61 74 69 76 65 {$native
ff80: 20 3f 20 22 6e 61 74 69 76 65 2f 22 20 3a 20 22 ? "native/" : "
ff90: 22 7d 5d 20 5b 65 78 70 72 20 7b 5b 73 74 72 69 "}] [expr {[stri
ffa0: 6e 67 20 6c 65 6e 67 74 68 20 5c 0d 0a 20 20 20 ng length \..
ffb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 $
ffc0: 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 20 3f 20 platform] > 0 ?
ffd0: 5b 61 70 70 65 6e 64 41 72 67 73 20 24 70 6c 61 [appendArgs $pla
ffe0: 74 66 6f 72 6d 20 2f 5d 20 3a 20 22 22 7d 5d 20 tform /] : ""}]
fff0: 24 79 65 61 72 20 5c 0d 0a 20 20 20 20 20 20 20 $year \..
10000 20 20 20 20 20 20 20 20 20 20 20 2f 20 24 63 6f / $co
10010 6e 66 69 67 75 72 61 74 69 6f 6e 20 22 5c 22 2e nfiguration "\".
10020 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 .. "]....
10030 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
10040 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
10050 42 75 69 6c 64 20 74 68 65 20 66 75 6c 6c 79 20 Build the fully
10060 71 75 61 6c 69 66 69 65 64 20 64 69 72 65 63 74 qualified direct
10070 6f 72 79 20 77 68 65 72 65 20 74 68 65 20 6e 65 ory where the ne
10080 63 65 73 73 61 72 79 0d 0a 20 20 20 20 20 20 20 cessary..
10090 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 # c
100a0 6f 6d 70 6f 6e 65 6e 74 73 20 66 6f 72 20 53 79 omponents for Sy
100b0 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
100c0 20 73 68 6f 75 6c 64 20 62 65 20 66 6f 75 6e 64 should be found
100d0 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
100e0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
100f0 20 20 73 65 74 20 64 69 72 65 63 74 6f 72 79 20 set directory
10100 5b 6a 6f 69 6e 42 75 69 6c 64 44 69 72 65 63 74 [joinBuildDirect
10110 6f 72 79 20 24 6e 61 74 69 76 65 20 5c 0d 0a 20 ory $native \..
10120 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
10130 20 5b 67 65 74 42 75 69 6c 64 42 61 73 65 44 69 [getBuildBaseDi
10140 72 65 63 74 6f 72 79 5d 20 24 79 65 61 72 20 24 rectory] $year $
10150 70 6c 61 74 66 6f 72 6d 20 24 63 6f 6e 66 69 67 platform $config
10160 75 72 61 74 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 uration \..
10170 20 20 20 20 20 20 20 20 20 20 20 20 20 24 65 78 $ex
10180 74 72 61 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 tra]....
10190 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
101a0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 # NOTE: D
101b0 6f 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 20 o the necessary
101c0 66 69 6c 65 73 20 65 78 69 73 74 3f 20 20 43 75 files exist? Cu
101d0 72 72 65 6e 74 6c 79 2c 20 6e 6f 20 6f 74 68 65 rrently, no othe
101e0 72 20 73 74 65 70 73 0d 0a 20 20 20 20 20 20 20 r steps..
101f0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 # a
10200 72 65 20 74 61 6b 65 6e 20 74 6f 20 76 65 72 69 re taken to veri
10210 66 79 20 74 68 69 73 20 62 75 69 6c 64 20 69 73 fy this build is
10220 20 61 63 74 75 61 6c 6c 79 20 76 69 61 62 6c 65 actually viable
10230 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
10240 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
10250 20 20 69 66 20 7b 5b 69 73 42 75 69 6c 64 41 76 if {[isBuildAv
10260 61 69 6c 61 62 6c 65 20 24 6e 61 74 69 76 65 20 ailable $native
10270 24 64 69 72 65 63 74 6f 72 79 5d 7d 20 74 68 65 $directory]} the
10280 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
10290 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
102a0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
102b0 57 68 65 6e 20 69 6e 20 22 73 65 6c 65 63 74 22 When in "select"
102c0 20 6d 6f 64 65 2c 20 61 75 74 6f 6d 61 74 69 63 mode, automatic
102d0 61 6c 6c 79 20 73 65 6c 65 63 74 20 74 68 65 20 ally select the
102e0 66 69 72 73 74 0d 0a 20 20 20 20 20 20 20 20 20 first..
102f0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 # a
10300 76 61 69 6c 61 62 6c 65 20 62 75 69 6c 64 20 6f vailable build o
10310 66 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 f System.Data.SQ
10320 4c 69 74 65 20 61 6e 64 20 74 68 65 6e 20 72 65 Lite and then re
10330 74 75 72 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 turn..
10340 20 20 20 20 20 20 23 20 20 20 20 20 20 20 69 6d # im
10350 6d 65 64 69 61 74 65 6c 79 2e 0d 0a 20 20 20 20 mediately...
10360 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
10370 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 i
10380 66 20 7b 24 73 65 6c 65 63 74 20 26 26 20 5b 6d f {$select && [m
10390 61 74 63 68 50 6c 61 74 66 6f 72 6d 20 24 70 6c atchPlatform $pl
103a0 61 74 66 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d atform]} then {.
103b0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
103c0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
103d0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
103e0 4d 61 6e 75 61 6c 6c 79 20 6f 76 65 72 72 69 64 Manually overrid
103f0 65 20 61 6c 6c 20 74 68 65 20 62 75 69 6c 64 20 e all the build
10400 64 69 72 65 63 74 6f 72 79 20 73 65 6c 65 63 74 directory select
10410 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ion..
10420 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 # r
10430 65 6c 61 74 65 64 20 74 65 73 74 20 73 65 74 74 elated test sett
10440 69 6e 67 73 20 69 6e 20 6f 72 64 65 72 20 74 6f ings in order to
10450 20 66 6f 72 63 65 20 74 68 69 73 20 62 75 69 6c force this buil
10460 64 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 d..
10470 20 20 20 20 20 23 20 20 20 20 20 20 20 6f 66 20 # of
10480 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
10490 74 65 20 74 6f 20 62 65 20 75 73 65 64 2e 0d 0a te to be used...
104a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
104b0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
104c0 20 20 20 20 20 20 20 69 66 20 7b 21 5b 63 68 61 if {![cha
104d0 6e 67 65 4e 61 74 69 76 65 52 75 6e 74 69 6d 65 ngeNativeRuntime
104e0 4f 70 74 69 6f 6e 20 24 6e 61 74 69 76 65 5d 7d Option $native]}
104f0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
10500 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 tpu
10510 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
10520 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
10530 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
10540 20 20 20 22 6e 6f 2c 20 66 61 69 6c 65 64 20 74 "no, failed t
10550 6f 20 22 20 5b 65 78 70 72 20 7b 24 6e 61 74 69 o " [expr {$nati
10560 76 65 20 3f 20 22 61 64 64 22 20 3a 20 22 72 65 ve ? "add" : "re
10570 6d 6f 76 65 22 7d 5d 20 5c 0d 0a 20 20 20 20 20 move"}] \..
10580 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
10590 20 20 20 22 20 74 68 65 20 5c 22 6e 61 74 69 76 " the \"nativ
105a0 65 5c 22 20 72 75 6e 74 69 6d 65 20 6f 70 74 69 e\" runtime opti
105b0 6f 6e 5c 6e 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 on\n"]....
105c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 re
105d0 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 turn false..
105e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
105f0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ...
10600 20 20 20 20 20 73 65 74 20 3a 3a 74 65 73 74 5f set ::test_
10610 79 65 61 72 20 24 79 65 61 72 0d 0a 20 20 20 20 year $year..
10620 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 se
10630 74 20 3a 3a 74 65 73 74 5f 70 6c 61 74 66 6f 72 t ::test_platfor
10640 6d 20 24 70 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 m $platform..
10650 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 s
10660 65 74 20 3a 3a 74 65 73 74 5f 63 6f 6e 66 69 67 et ::test_config
10670 75 72 61 74 69 6f 6e 20 24 63 6f 6e 66 69 67 75 uration $configu
10680 72 61 74 69 6f 6e 0d 0a 0d 0a 20 20 20 20 20 20 ration....
10690 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
106a0 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
106b0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
106c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
106d0 22 79 65 73 2c 20 73 65 6c 65 63 74 65 64 20 28 "yes, selected (
106e0 22 20 5b 65 78 70 72 20 7b 24 6e 61 74 69 76 65 " [expr {$native
106f0 20 3f 20 22 6e 61 74 69 76 65 2f 22 20 3a 20 22 ? "native/" : "
10700 22 7d 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 "}] \..
10710 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 65 78 [ex
10720 70 72 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 pr {[string leng
10730 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 th $platform] >
10740 30 20 3f 20 5b 61 70 70 65 6e 64 41 72 67 73 20 0 ? [appendArgs
10750 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
10760 20 20 20 20 20 20 20 20 20 24 70 6c 61 74 66 6f $platfo
10770 72 6d 20 2f 5d 20 3a 20 22 22 7d 5d 20 24 79 65 rm /] : ""}] $ye
10780 61 72 20 2f 20 24 63 6f 6e 66 69 67 75 72 61 74 ar / $configurat
10790 69 6f 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ion \..
107a0 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 65 78 [ex
107b0 70 72 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 pr {[string leng
107c0 74 68 20 24 65 78 74 72 61 5d 20 3e 20 30 20 3f th $extra] > 0 ?
107d0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 2f 20 5c [appendArgs / \
107e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
107f0 20 20 20 20 20 20 20 20 24 65 78 74 72 61 5d 20 $extra]
10800 3a 20 22 22 7d 5d 20 22 29 5c 6e 22 5d 0d 0a 0d : ""}] ")\n"]...
10810 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
10820 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a return true..
10830 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
10840 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
10850 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
10860 73 20 24 63 68 61 6e 6e 65 6c 20 79 65 73 5c 6e s $channel yes\n
10870 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
10880 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
10890 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
108a0 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 tpu
108b0 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e ts $channel no\n
108c0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
108d0 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d }.. }
108e0 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
108f0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
10900 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 }.... retur
10910 6e 20 66 61 6c 73 65 0d 0a 20 20 20 20 7d 0d 0a n false.. }..
10920 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 68 65 63 ... proc chec
10930 6b 46 6f 72 53 51 4c 69 74 65 52 65 6c 65 61 73 kForSQLiteReleas
10940 65 73 20 7b 20 63 68 61 6e 6e 65 6c 20 7b 73 65 es { channel {se
10950 6c 65 63 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d lect false} } {.
10960 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
10970 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 66 6f # NOTE: Check fo
10980 72 20 70 61 73 74 20 72 65 6c 65 61 73 65 73 20 r past releases
10990 6f 66 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 of System.Data.S
109a0 51 4c 69 74 65 20 69 6e 20 74 68 65 20 64 69 72 QLite in the dir
109b0 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 23 20 ectory.. #
109c0 20 20 20 20 20 20 63 6f 6e 74 61 69 6e 65 64 20 contained
109d0 69 6e 20 74 68 65 20 22 53 79 73 74 65 6d 2e 44 in the "System.D
109e0 61 74 61 2e 53 51 4c 69 74 65 22 20 65 6e 76 69 ata.SQLite" envi
109f0 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 ronment variable
10a00 2c 20 69 66 0d 0a 20 20 20 20 20 20 23 20 20 20 , if.. #
10a10 20 20 20 20 70 72 65 73 65 6e 74 2e 0d 0a 20 20 present...
10a20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
10a30 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a {[info exists ::
10a40 65 6e 76 28 53 79 73 74 65 6d 2e 44 61 74 61 2e env(System.Data.
10a50 53 51 4c 69 74 65 29 5d 20 26 26 20 5c 0d 0a 20 SQLite)] && \..
10a60 20 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 [string
10a70 20 6c 65 6e 67 74 68 20 24 3a 3a 65 6e 76 28 53 length $::env(S
10a80 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
10a90 65 29 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d e)] > 0} then {.
10aa0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
10ab0 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c # NOTE: Buil
10ac0 64 20 74 68 65 20 66 75 6c 6c 79 20 71 75 61 6c d the fully qual
10ad0 69 66 69 65 64 20 64 69 72 65 63 74 6f 72 79 20 ified directory
10ae0 77 68 65 72 65 20 74 68 65 20 6e 65 63 65 73 73 where the necess
10af0 61 72 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ary.. #
10b00 20 20 20 20 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 components
10b10 66 6f 72 20 53 79 73 74 65 6d 2e 44 61 74 61 2e for System.Data.
10b20 53 51 4c 69 74 65 20 73 68 6f 75 6c 64 20 62 65 SQLite should be
10b30 20 66 6f 75 6e 64 2e 0d 0a 20 20 20 20 20 20 20 found...
10b40 20 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 #.. set
10b50 64 69 72 65 63 74 6f 72 79 20 5b 66 69 6c 65 20 directory [file
10b60 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 nativename [file
10b70 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 join \..
10b80 20 20 20 20 20 24 3a 3a 65 6e 76 28 53 79 73 74 $::env(Syst
10b90 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 29 20 em.Data.SQLite)
10ba0 5b 67 65 74 52 65 6c 65 61 73 65 56 65 72 73 69 [getReleaseVersi
10bb0 6f 6e 5d 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 on]]]....
10bc0 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
10bd0 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
10be0 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
10bf0 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 79 checking for Sy
10c00 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
10c10 20 72 65 6c 65 61 73 65 20 5c 22 22 20 5c 0d 0a release \"" \..
10c20 20 20 20 20 20 20 20 20 20 20 20 20 24 64 69 72 $dir
10c30 65 63 74 6f 72 79 20 22 5c 22 2e 2e 2e 20 22 5d ectory "\"... "]
10c40 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
10c50 5b 69 73 52 65 6c 65 61 73 65 41 76 61 69 6c 61 [isReleaseAvaila
10c60 62 6c 65 20 24 64 69 72 65 63 74 6f 72 79 20 70 ble $directory p
10c70 6c 61 74 66 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b latform]} then {
10c80 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
10c90 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
10ca0 70 6c 61 74 66 6f 72 6d 5d 20 3d 3d 20 30 7d 20 platform] == 0}
10cb0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
10cc0 20 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d set platform
10cd0 20 75 6e 6b 6e 6f 77 6e 0d 0a 20 20 20 20 20 20 unknown..
10ce0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
10cf0 20 20 20 69 66 20 7b 24 73 65 6c 65 63 74 20 26 if {$select &
10d00 26 20 5b 6d 61 74 63 68 50 6c 61 74 66 6f 72 6d & [matchPlatform
10d10 20 24 70 6c 61 74 66 6f 72 6d 5d 7d 20 74 68 65 $platform]} the
10d20 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
10d30 20 73 65 74 20 3a 3a 62 75 69 6c 64 5f 64 69 72 set ::build_dir
10d40 65 63 74 6f 72 79 20 24 64 69 72 65 63 74 6f 72 ectory $director
10d50 79 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 y....
10d60 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
10d70 5b 61 70 70 65 6e 64 41 72 67 73 20 22 79 65 73 [appendArgs "yes
10d80 2c 20 73 65 6c 65 63 74 65 64 20 28 22 20 24 70 , selected (" $p
10d90 6c 61 74 66 6f 72 6d 20 22 29 5c 6e 22 5d 0d 0a latform ")\n"]..
10da0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 .. re
10db0 74 75 72 6e 20 74 72 75 65 0d 0a 20 20 20 20 20 turn true..
10dc0 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
10dd0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
10de0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
10df0 64 41 72 67 73 20 22 79 65 73 20 28 22 20 24 70 dArgs "yes (" $p
10e00 6c 61 74 66 6f 72 6d 20 22 29 5c 6e 22 5d 0d 0a latform ")\n"]..
10e10 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
10e20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
10e30 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
10e40 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 0d 0a channel no\n....
10e50 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
10e60 66 69 6c 65 20 65 78 69 73 74 73 20 24 64 69 72 file exists $dir
10e70 65 63 74 6f 72 79 5d 20 7c 7c 20 5c 0d 0a 20 20 ectory] || \..
10e80 20 20 20 20 20 20 20 20 20 20 20 20 21 5b 66 69 ![fi
10e90 6c 65 20 69 73 64 69 72 65 63 74 6f 72 79 20 24 le isdirectory $
10ea0 64 69 72 65 63 74 6f 72 79 5d 7d 20 74 68 65 6e directory]} then
10eb0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
10ec0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
10ed0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
10ee0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
10ef0 2d 2d 2d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 --- environment
10f00 76 61 72 69 61 62 6c 65 20 5c 22 53 79 73 74 65 variable \"Syste
10f10 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 5c 22 20 m.Data.SQLite\"
10f20 69 73 20 61 6e 20 22 20 5c 0d 0a 20 20 20 20 20 is an " \..
10f30 20 20 20 20 20 20 20 20 20 20 20 22 69 6e 76 61 "inva
10f40 6c 69 64 20 64 69 72 65 63 74 6f 72 79 2c 20 73 lid directory, s
10f50 6b 69 70 70 69 6e 67 20 63 68 65 63 6b 20 66 6f kipping check fo
10f60 72 20 72 65 6c 65 61 73 65 73 2e 2e 2e 5c 6e 22 r releases...\n"
10f70 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ]....
10f80 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 return false..
10f90 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
10fa0 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
10fb0 70 61 74 68 20 5b 6c 73 6f 72 74 20 2d 64 65 63 path [lsort -dec
10fc0 72 65 61 73 69 6e 67 20 5b 66 69 6c 65 20 6c 69 reasing [file li
10fd0 73 74 20 24 64 69 72 65 63 74 6f 72 79 20 2a 5d st $directory *]
10fe0 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ] {..
10ff0 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 if {[file exist
11000 73 20 24 70 61 74 68 5d 20 26 26 20 5b 66 69 6c s $path] && [fil
11010 65 20 69 73 64 69 72 65 63 74 6f 72 79 20 24 70 e isdirectory $p
11020 61 74 68 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ath]} then {..
11030 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
11040 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
11050 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
11060 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
11070 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 - checking for S
11080 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
11090 65 20 72 65 6c 65 61 73 65 20 5c 22 22 20 5c 0d e release \"" \.
110a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
110b0 20 20 20 24 70 61 74 68 20 22 5c 22 2e 2e 2e 20 $path "\"...
110c0 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 "]....
110d0 20 20 20 20 69 66 20 7b 5b 69 73 52 65 6c 65 61 if {[isRelea
110e0 73 65 41 76 61 69 6c 61 62 6c 65 20 24 70 61 74 seAvailable $pat
110f0 68 20 70 6c 61 74 66 6f 72 6d 5d 7d 20 74 68 65 h platform]} the
11100 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
11110 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
11120 20 6c 65 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 length $platfor
11130 6d 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d m] == 0} then {.
11140 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
11150 20 20 20 73 65 74 20 70 6c 61 74 66 6f 72 6d 20 set platform
11160 75 6e 6b 6e 6f 77 6e 0d 0a 20 20 20 20 20 20 20 unknown..
11170 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
11180 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
11190 20 7b 24 73 65 6c 65 63 74 20 26 26 20 5b 6d 61 {$select && [ma
111a0 74 63 68 50 6c 61 74 66 6f 72 6d 20 24 70 6c 61 tchPlatform $pla
111b0 74 66 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d 0a tform]} then {..
111c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
111d0 20 20 73 65 74 20 3a 3a 62 75 69 6c 64 5f 64 69 set ::build_di
111e0 72 65 63 74 6f 72 79 20 24 70 61 74 68 0d 0a 0d rectory $path...
111f0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
11200 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
11210 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 79 l [appendArgs "y
11220 65 73 2c 20 73 65 6c 65 63 74 65 64 20 28 22 20 es, selected ("
11230 24 70 6c 61 74 66 6f 72 6d 20 22 29 5c 6e 22 5d $platform ")\n"]
11240 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
11250 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
11260 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e..
11270 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
11280 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
11290 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
112a0 70 70 65 6e 64 41 72 67 73 20 22 79 65 73 20 28 ppendArgs "yes (
112b0 22 20 24 70 6c 61 74 66 6f 72 6d 20 22 29 5c 6e " $platform ")\n
112c0 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 "]..
112d0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
112e0 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
112f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
11300 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e 6f puts $channel no
11310 5c 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \n..
11320 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
11330 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d }.. }.
11340 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
11350 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
11360 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
11370 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
11380 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d .. "-
11390 2d 2d 2d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 --- environment
113a0 76 61 72 69 61 62 6c 65 20 5c 22 53 79 73 74 65 variable \"Syste
113b0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 5c 22 20 m.Data.SQLite\"
113c0 69 73 20 6e 6f 74 20 22 20 5c 0d 0a 20 20 20 20 is not " \..
113d0 20 20 20 20 20 20 20 20 22 73 65 74 2c 20 73 6b "set, sk
113e0 69 70 70 69 6e 67 20 63 68 65 63 6b 20 66 6f 72 ipping check for
113f0 20 72 65 6c 65 61 73 65 73 2e 2e 2e 5c 6e 22 5d releases...\n"]
11400 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
11410 20 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0d return false.
11420 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
11430 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 roc checkForSQLi
11440 74 65 4c 69 62 72 61 72 79 20 7b 20 63 68 61 6e teLibrary { chan
11450 6e 65 6c 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 nel } {.. t
11460 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d puts $channel "-
11470 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 --- checking for
11480 20 53 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 SQLite core lib
11490 72 61 72 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 rary... "....
114a0 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
114b0 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 . object
114c0 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
114d0 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
114e0 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
114f0 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 ata.SQLite.SQLit
11500 65 33 20 53 51 4c 69 74 65 56 65 72 73 69 6f 6e e3 SQLiteVersion
11510 0d 0a 20 20 20 20 20 20 7d 20 76 65 72 73 69 6f .. } versio
11520 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d n] == 0} then {.
11530 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
11540 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 # NOTE: Chec
11550 6b 20 69 66 20 74 68 65 20 72 65 74 75 72 6e 65 k if the returne
11560 64 20 76 65 72 73 69 6f 6e 20 77 61 73 20 6e 75 d version was nu
11570 6c 6c 2e 20 20 49 66 20 73 6f 2c 20 6d 61 6b 65 ll. If so, make
11580 20 69 74 20 65 61 73 79 0d 0a 20 20 20 20 20 20 it easy..
11590 20 20 23 20 20 20 20 20 20 20 74 6f 20 73 70 6f # to spo
115a0 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 t... #..
115b0 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 if {[stri
115c0 6e 67 20 6c 65 6e 67 74 68 20 24 76 65 72 73 69 ng length $versi
115d0 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b on] == 0} then {
115e0 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
115f0 76 65 72 73 69 6f 6e 20 6e 75 6c 6c 0d 0a 20 20 version null..
11600 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
11610 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
11620 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 74 6f NOTE: Attempt to
11630 20 71 75 65 72 79 20 74 68 65 20 46 6f 73 73 69 query the Fossi
11640 6c 20 73 6f 75 72 63 65 20 69 64 65 6e 74 69 66 l source identif
11650 69 65 72 20 66 6f 72 20 74 68 65 20 53 51 4c 69 ier for the SQLi
11660 74 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 te.. #
11670 20 20 20 20 63 6f 72 65 20 6c 69 62 72 61 72 79 core library
11680 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
11690 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 if {[catch
116a0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 {.. ob
116b0 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 ject invoke -fla
116c0 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d gs +NonPublic \.
116d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 . S
116e0 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
116f0 65 2e 53 51 4c 69 74 65 33 20 53 51 4c 69 74 65 e.SQLite3 SQLite
11700 53 6f 75 72 63 65 49 64 0d 0a 20 20 20 20 20 20 SourceId..
11710 20 20 7d 20 73 6f 75 72 63 65 49 64 5d 7d 20 74 } sourceId]} t
11720 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
11730 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 #.. #
11740 4e 4f 54 45 3a 20 57 65 20 66 61 69 6c 65 64 20 NOTE: We failed
11750 74 6f 20 71 75 65 72 79 20 74 68 65 20 46 6f 73 to query the Fos
11760 73 69 6c 20 73 6f 75 72 63 65 20 69 64 65 6e 74 sil source ident
11770 69 66 69 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 ifier...
11780 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 73 #.. s
11790 65 74 20 73 6f 75 72 63 65 49 64 20 75 6e 6b 6e et sourceId unkn
117a0 6f 77 6e 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a own.. }..
117b0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
117c0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 # NOTE: Che
117d0 63 6b 20 69 66 20 74 68 65 20 72 65 74 75 72 6e ck if the return
117e0 65 64 20 46 6f 73 73 69 6c 20 73 6f 75 72 63 65 ed Fossil source
117f0 20 69 64 65 6e 74 69 66 69 65 72 20 77 61 73 20 identifier was
11800 6e 75 6c 6c 2e 20 20 49 66 0d 0a 20 20 20 20 20 null. If..
11810 20 20 20 23 20 20 20 20 20 20 20 73 6f 2c 20 6d # so, m
11820 61 6b 65 20 69 74 20 65 61 73 79 20 74 6f 20 73 ake it easy to s
11830 70 6f 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d pot... #.
11840 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 . if {[st
11850 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 73 6f 75 ring length $sou
11860 72 63 65 49 64 5d 20 3d 3d 20 30 7d 20 74 68 65 rceId] == 0} the
11870 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 n {.. s
11880 65 74 20 73 6f 75 72 63 65 49 64 20 6e 75 6c 6c et sourceId null
11890 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
118a0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
118b0 20 20 23 20 4e 4f 54 45 3a 20 59 65 73 2c 20 74 # NOTE: Yes, t
118c0 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 20 6c he SQLite core l
118d0 69 62 72 61 72 79 20 61 70 70 65 61 72 73 20 74 ibrary appears t
118e0 6f 20 62 65 20 61 76 61 69 6c 61 62 6c 65 2e 0d o be available..
118f0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
11900 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e addConstrain
11910 74 20 53 51 4c 69 74 65 0d 0a 0d 0a 20 20 20 20 t SQLite....
11920 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
11930 20 4e 4f 54 45 3a 20 52 65 63 6f 72 64 20 76 65 NOTE: Record ve
11940 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 53 51 4c rsion of the SQL
11950 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 ite core library
11960 20 66 6f 72 20 6c 61 74 65 72 20 75 73 65 0d 0a for later use..
11970 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
11980 62 79 20 74 65 73 74 20 63 6f 6e 73 74 72 61 69 by test constrai
11990 6e 74 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 nt expressions,
119a0 65 74 63 2e 20 20 49 66 20 74 68 69 73 20 76 61 etc. If this va
119b0 6c 75 65 20 68 61 73 0d 0a 20 20 20 20 20 20 20 lue has..
119c0 20 23 20 20 20 20 20 20 20 61 6c 72 65 61 64 79 # already
119d0 20 62 65 65 6e 20 73 65 74 20 28 6f 72 20 6f 76 been set (or ov
119e0 65 72 72 69 64 64 65 6e 29 2c 20 73 6b 69 70 20 erridden), skip
119f0 73 65 74 74 69 6e 67 20 69 74 2e 0d 0a 20 20 20 setting it...
11a00 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
11a10 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
11a20 73 20 3a 3a 63 6f 72 65 5f 6c 69 62 72 61 72 79 s ::core_library
11a30 5f 76 65 72 73 69 6f 6e 5d 7d 20 74 68 65 6e 20 _version]} then
11a40 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 {.. set
11a50 20 3a 3a 63 6f 72 65 5f 6c 69 62 72 61 72 79 5f ::core_library_
11a60 76 65 72 73 69 6f 6e 20 24 76 65 72 73 69 6f 6e version $version
11a70 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
11a80 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
11a90 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
11aa0 73 20 22 79 65 73 20 28 22 20 24 76 65 72 73 69 s "yes (" $versi
11ab0 6f 6e 20 22 20 22 20 24 73 6f 75 72 63 65 49 64 on " " $sourceId
11ac0 20 22 29 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 7d ")\n"].. }
11ad0 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
11ae0 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
11af0 6e 6f 5c 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 no\n.. }..
11b00 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
11b10 63 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 c checkForSQLite
11b20 49 6e 74 65 72 6f 70 20 7b 20 63 68 61 6e 6e 65 Interop { channe
11b30 6c 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 70 75 l } {.. tpu
11b40 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d ts $channel "---
11b50 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 - checking for S
11b60 51 4c 69 74 65 20 69 6e 74 65 72 6f 70 20 61 73 QLite interop as
11b70 73 65 6d 62 6c 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 sembly... "....
11b80 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
11b90 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 {.. objec
11ba0 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 t invoke -flags
11bb0 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 +NonPublic \..
11bc0 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
11bd0 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c .Data.SQLite.SQL
11be0 69 74 65 33 20 49 6e 74 65 72 6f 70 56 65 72 73 ite3 InteropVers
11bf0 69 6f 6e 0d 0a 20 20 20 20 20 20 7d 20 76 65 72 ion.. } ver
11c00 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 6e sion] == 0} then
11c10 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
11c20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 # NOTE: C
11c30 68 65 63 6b 20 69 66 20 74 68 65 20 72 65 74 75 heck if the retu
11c40 72 6e 65 64 20 76 65 72 73 69 6f 6e 20 77 61 73 rned version was
11c50 20 6e 75 6c 6c 2e 20 20 49 66 20 73 6f 2c 20 6d null. If so, m
11c60 61 6b 65 20 69 74 20 65 61 73 79 0d 0a 20 20 20 ake it easy..
11c70 20 20 20 20 20 23 20 20 20 20 20 20 20 74 6f 20 # to
11c80 73 70 6f 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 spot... #
11c90 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 .. if {[s
11ca0 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 65 tring length $ve
11cb0 72 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 68 65 rsion] == 0} the
11cc0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 n {.. s
11cd0 65 74 20 76 65 72 73 69 6f 6e 20 6e 75 6c 6c 0d et version null.
11ce0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
11cf0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
11d00 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 # NOTE: Attempt
11d10 20 74 6f 20 71 75 65 72 79 20 74 68 65 20 46 6f to query the Fo
11d20 73 73 69 6c 20 73 6f 75 72 63 65 20 69 64 65 6e ssil source iden
11d30 74 69 66 69 65 72 20 66 6f 72 20 74 68 65 20 53 tifier for the S
11d40 51 4c 69 74 65 0d 0a 20 20 20 20 20 20 20 20 23 QLite.. #
11d50 20 20 20 20 20 20 20 63 6f 72 65 20 6c 69 62 72 core libr
11d60 61 72 79 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ary... #.
11d70 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 . if {[ca
11d80 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
11d90 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
11da0 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
11db0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
11dc0 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
11dd0 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 49 6e 74 Lite.SQLite3 Int
11de0 65 72 6f 70 53 6f 75 72 63 65 49 64 0d 0a 20 20 eropSourceId..
11df0 20 20 20 20 20 20 7d 20 73 6f 75 72 63 65 49 64 } sourceId
11e00 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
11e10 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
11e20 20 20 23 20 4e 4f 54 45 3a 20 57 65 20 66 61 69 # NOTE: We fai
11e30 6c 65 64 20 74 6f 20 71 75 65 72 79 20 74 68 65 led to query the
11e40 20 46 6f 73 73 69 6c 20 73 6f 75 72 63 65 20 69 Fossil source i
11e50 64 65 6e 74 69 66 69 65 72 2e 0d 0a 20 20 20 20 dentifier...
11e60 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
11e70 20 20 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 set sourceId
11e80 75 6e 6b 6e 6f 77 6e 0d 0a 20 20 20 20 20 20 20 unknown..
11e90 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d }.... #.
11ea0 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
11eb0 20 43 68 65 63 6b 20 69 66 20 74 68 65 20 72 65 Check if the re
11ec0 74 75 72 6e 65 64 20 46 6f 73 73 69 6c 20 73 6f turned Fossil so
11ed0 75 72 63 65 20 69 64 65 6e 74 69 66 69 65 72 20 urce identifier
11ee0 77 61 73 20 6e 75 6c 6c 2e 20 20 49 66 0d 0a 20 was null. If..
11ef0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 # s
11f00 6f 2c 20 6d 61 6b 65 20 69 74 20 65 61 73 79 20 o, make it easy
11f10 74 6f 20 73 70 6f 74 2e 0d 0a 20 20 20 20 20 20 to spot...
11f20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 #.. if
11f30 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
11f40 24 73 6f 75 72 63 65 49 64 5d 20 3d 3d 20 30 7d $sourceId] == 0}
11f50 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
11f60 20 20 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 set sourceId
11f70 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 20 20 7d 0d null.. }.
11f80 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
11f90 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 65 # NOTE: Be
11fa0 66 6f 72 65 20 61 63 74 75 61 6c 6c 79 20 61 64 fore actually ad
11fb0 64 69 6e 67 20 74 68 65 20 74 65 73 74 20 63 6f ding the test co
11fc0 6e 73 74 72 61 69 6e 74 2c 20 6d 61 6b 65 20 73 nstraint, make s
11fd0 75 72 65 20 74 68 65 0d 0a 20 20 20 20 20 20 20 ure the..
11fe0 20 23 20 20 20 20 20 20 20 76 65 72 73 69 6f 6e # version
11ff0 20 69 73 20 76 61 6c 69 64 20 28 69 2e 65 2e 20 is valid (i.e.
12000 6e 6f 74 20 6a 75 73 74 20 74 68 61 74 20 77 65 not just that we
12010 20 63 6f 75 6c 64 20 71 75 65 72 79 20 69 74 29 could query it)
12020 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
12030 20 20 20 20 20 20 69 66 20 7b 24 76 65 72 73 69 if {$versi
12040 6f 6e 20 6e 65 20 22 6e 75 6c 6c 22 7d 20 74 68 on ne "null"} th
12050 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
12060 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
12070 4f 54 45 3a 20 59 65 73 2c 20 74 68 65 20 53 51 OTE: Yes, the SQ
12080 4c 69 74 65 20 69 6e 74 65 72 6f 70 20 61 73 73 Lite interop ass
12090 65 6d 62 6c 79 20 61 70 70 65 61 72 73 20 74 6f embly appears to
120a0 20 62 65 20 61 76 61 69 6c 61 62 6c 65 2e 0d 0a be available...
120b0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
120c0 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 addConstr
120d0 61 69 6e 74 20 53 51 4c 69 74 65 49 6e 74 65 72 aint SQLiteInter
120e0 6f 70 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 op....
120f0 73 65 74 20 61 6e 73 77 65 72 20 79 65 73 0d 0a set answer yes..
12100 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
12110 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
12120 61 6e 73 77 65 72 20 6e 6f 0d 0a 20 20 20 20 20 answer no..
12130 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
12140 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
12150 61 70 70 65 6e 64 41 72 67 73 20 24 61 6e 73 77 appendArgs $answ
12160 65 72 20 22 20 28 22 20 24 76 65 72 73 69 6f 6e er " (" $version
12170 20 22 20 22 20 24 73 6f 75 72 63 65 49 64 20 22 " " $sourceId "
12180 29 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 7d 20 65 )\n"].. } e
12190 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 lse {.. t
121a0 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e 6f puts $channel no
121b0 5c 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 \n.. }..
121c0 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
121d0 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 44 65 checkForSQLiteDe
121e0 66 69 6e 65 43 6f 6e 73 74 61 6e 74 20 7b 20 63 fineConstant { c
121f0 68 61 6e 6e 65 6c 20 6e 61 6d 65 20 7d 20 7b 0d hannel name } {.
12200 0a 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 . tputs $ch
12210 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
12220 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 22 s \.. "
12230 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f ---- checking fo
12240 72 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 r System.Data.SQ
12250 4c 69 74 65 20 64 65 66 69 6e 65 20 63 6f 6e 73 Lite define cons
12260 74 61 6e 74 20 5c 22 22 20 24 6e 61 6d 65 20 5c tant \"" $name \
12270 0d 0a 20 20 20 20 20 20 20 20 20 20 22 5c 22 2e .. "\".
12280 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 .. "].... i
12290 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
122a0 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
122b0 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
122c0 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 blic \..
122d0 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e System.Data.
122e0 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 44 SQLite.SQLite3 D
122f0 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 73 0d 0a efineConstants..
12300 20 20 20 20 20 20 7d 20 64 65 66 69 6e 65 43 6f } defineCo
12310 6e 73 74 61 6e 74 73 5d 20 3d 3d 20 30 7d 20 74 nstants] == 0} t
12320 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 hen {.. i
12330 66 20 7b 5b 6c 73 65 61 72 63 68 20 2d 65 78 61 f {[lsearch -exa
12340 63 74 20 2d 6e 6f 63 61 73 65 20 24 64 65 66 69 ct -nocase $defi
12350 6e 65 43 6f 6e 73 74 61 6e 74 73 20 24 6e 61 6d neConstants $nam
12360 65 5d 20 21 3d 20 2d 31 7d 20 74 68 65 6e 20 7b e] != -1} then {
12370 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
12380 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
12390 20 59 65 73 2c 20 74 68 69 73 20 64 65 66 69 6e Yes, this defin
123a0 65 20 63 6f 6e 73 74 61 6e 74 20 77 61 73 20 65 e constant was e
123b0 6e 61 62 6c 65 64 20 77 68 65 6e 20 74 68 65 20 nabled when the
123c0 6d 61 6e 61 67 65 64 0d 0a 20 20 20 20 20 20 20 managed..
123d0 20 20 20 23 20 20 20 20 20 20 20 61 73 73 65 6d # assem
123e0 62 6c 79 20 77 61 73 20 63 6f 6d 70 69 6c 65 64 bly was compiled
123f0 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
12400 20 20 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e addCon
12410 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
12420 72 67 73 20 5b 67 65 74 53 51 4c 69 74 65 44 65 rgs [getSQLiteDe
12430 66 69 6e 65 43 6f 6e 73 74 61 6e 74 50 72 65 66 fineConstantPref
12440 69 78 5d 20 24 6e 61 6d 65 5d 0d 0a 0d 0a 20 20 ix] $name]....
12450 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
12460 68 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a 20 20 hannel yes\n..
12470 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
12480 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
12490 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 $channel no\n..
124a0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
124b0 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
124c0 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
124d0 20 65 72 72 6f 72 5c 6e 0d 0a 20 20 20 20 20 20 error\n..
124e0 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 }.. }.....
124f0 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 51 proc checkForSQ
12500 4c 69 74 65 43 6f 6d 70 69 6c 65 4f 70 74 69 6f LiteCompileOptio
12510 6e 20 7b 20 63 68 61 6e 6e 65 6c 20 6e 61 6d 65 n { channel name
12520 20 7d 20 7b 0d 0a 20 20 20 20 20 20 74 70 75 74 } {.. tput
12530 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
12540 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
12550 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 "---- checki
12560 6e 67 20 66 6f 72 20 53 51 4c 69 74 65 20 69 6e ng for SQLite in
12570 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 63 terop assembly c
12580 6f 6d 70 69 6c 65 20 6f 70 74 69 6f 6e 20 5c 22 ompile option \"
12590 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 24 " \.. $
125a0 6e 61 6d 65 20 22 5c 22 2e 2e 2e 20 22 5d 0d 0a name "\"... "]..
125b0 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 .. if {[cat
125c0 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 ch {.. ob
125d0 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 ject invoke -fla
125e0 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d gs +NonPublic \.
125f0 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 . Sys
12600 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
12610 53 51 4c 69 74 65 33 20 49 6e 74 65 72 6f 70 43 SQLite3 InteropC
12620 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 0d 0a 20 ompileOptions..
12630 20 20 20 20 20 7d 20 63 6f 6d 70 69 6c 65 4f 70 } compileOp
12640 74 69 6f 6e 73 5d 20 3d 3d 20 30 7d 20 74 68 65 tions] == 0} the
12650 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
12660 7b 5b 6c 73 65 61 72 63 68 20 2d 65 78 61 63 74 {[lsearch -exact
12670 20 2d 6e 6f 63 61 73 65 20 24 63 6f 6d 70 69 6c -nocase $compil
12680 65 4f 70 74 69 6f 6e 73 20 24 6e 61 6d 65 5d 20 eOptions $name]
12690 21 3d 20 2d 31 7d 20 74 68 65 6e 20 7b 0d 0a 20 != -1} then {..
126a0 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
126b0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 65 # NOTE: Ye
126c0 73 2c 20 74 68 69 73 20 63 6f 6d 70 69 6c 65 20 s, this compile
126d0 6f 70 74 69 6f 6e 20 77 61 73 20 65 6e 61 62 6c option was enabl
126e0 65 64 20 77 68 65 6e 20 74 68 65 20 69 6e 74 65 ed when the inte
126f0 72 6f 70 0d 0a 20 20 20 20 20 20 20 20 20 20 23 rop.. #
12700 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c 79 20 assembly
12710 77 61 73 20 63 6f 6d 70 69 6c 65 64 2e 0d 0a 20 was compiled...
12720 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
12730 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 addConstra
12740 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 int [appendArgs
12750 5b 67 65 74 53 51 4c 69 74 65 43 6f 6d 70 69 6c [getSQLiteCompil
12760 65 4f 70 74 69 6f 6e 50 72 65 66 69 78 5d 20 24 eOptionPrefix] $
12770 6e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 name]....
12780 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
12790 6c 20 79 65 73 5c 6e 0d 0a 20 20 20 20 20 20 20 l yes\n..
127a0 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
127b0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
127c0 6e 65 6c 20 6e 6f 5c 6e 0d 0a 20 20 20 20 20 20 nel no\n..
127d0 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 }.. } els
127e0 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 75 e {.. tpu
127f0 74 73 20 24 63 68 61 6e 6e 65 6c 20 65 72 72 6f ts $channel erro
12800 72 5c 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a r\n.. }....
12810 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
12820 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
12830 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 22 2d \.. "-
12840 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 --- checking for
12850 20 53 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 SQLite core lib
12860 72 61 72 79 20 63 6f 6d 70 69 6c 65 20 6f 70 74 rary compile opt
12870 69 6f 6e 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 ion \"" \..
12880 20 20 20 20 20 24 6e 61 6d 65 20 22 5c 22 2e 2e $name "\"..
12890 2e 20 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 . "].... if
128a0 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
128b0 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b object invok
128c0 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 e -flags +NonPub
128d0 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 lic \..
128e0 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 System.Data.S
128f0 51 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 53 51 QLite.SQLite3 SQ
12900 4c 69 74 65 43 6f 6d 70 69 6c 65 4f 70 74 69 6f LiteCompileOptio
12910 6e 73 0d 0a 20 20 20 20 20 20 7d 20 63 6f 6d 70 ns.. } comp
12920 69 6c 65 4f 70 74 69 6f 6e 73 5d 20 3d 3d 20 30 ileOptions] == 0
12930 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
12940 20 20 69 66 20 7b 5b 6c 73 65 61 72 63 68 20 2d if {[lsearch -
12950 65 78 61 63 74 20 2d 6e 6f 63 61 73 65 20 24 63 exact -nocase $c
12960 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 20 24 6e ompileOptions $n
12970 61 6d 65 5d 20 21 3d 20 2d 31 7d 20 74 68 65 6e ame] != -1} then
12980 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d {.. #.
12990 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 . # NOT
129a0 45 3a 20 59 65 73 2c 20 74 68 69 73 20 63 6f 6d E: Yes, this com
129b0 70 69 6c 65 20 6f 70 74 69 6f 6e 20 77 61 73 20 pile option was
129c0 65 6e 61 62 6c 65 64 20 77 68 65 6e 20 74 68 65 enabled when the
129d0 20 53 51 4c 69 74 65 0d 0a 20 20 20 20 20 20 20 SQLite..
129e0 20 20 20 23 20 20 20 20 20 20 20 63 6f 72 65 20 # core
129f0 6c 69 62 72 61 72 79 20 77 61 73 20 63 6f 6d 70 library was comp
12a00 69 6c 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 iled...
12a10 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 61 64 #.. ad
12a20 64 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 dConstraint [app
12a30 65 6e 64 41 72 67 73 20 5b 67 65 74 53 51 4c 69 endArgs [getSQLi
12a40 74 65 43 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 50 teCompileOptionP
12a50 72 65 66 69 78 5d 20 24 6e 61 6d 65 5d 0d 0a 0d refix] $name]...
12a60 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
12a70 20 24 63 68 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d $channel yes\n.
12a80 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 . } else
12a90 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 {.. tpu
12aa0 74 73 20 24 63 68 61 6e 6e 65 6c 20 6e 6f 5c 6e ts $channel no\n
12ab0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
12ac0 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
12ad0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
12ae0 6e 65 6c 20 65 72 72 6f 72 5c 6e 0d 0a 20 20 20 nel error\n..
12af0 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
12b00 20 20 20 20 70 72 6f 63 20 67 65 74 44 61 74 65 proc getDate
12b10 54 69 6d 65 46 6f 72 6d 61 74 20 7b 20 7b 74 69 TimeFormat { {ti
12b20 6d 65 5a 6f 6e 65 20 74 72 75 65 7d 20 7d 20 7b meZone true} } {
12b30 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
12b40 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 70 72 # NOTE: This pr
12b50 6f 63 65 64 75 72 65 20 73 69 6d 70 6c 79 20 72 ocedure simply r
12b60 65 74 75 72 6e 73 20 74 68 65 20 22 64 65 66 61 eturns the "defa
12b70 75 6c 74 22 20 44 61 74 65 54 69 6d 65 20 66 6f ult" DateTime fo
12b80 72 6d 61 74 20 75 73 65 64 0d 0a 20 20 20 20 20 rmat used..
12b90 20 23 20 20 20 20 20 20 20 62 79 20 74 68 65 20 # by the
12ba0 74 65 73 74 20 73 75 69 74 65 2e 0d 0a 20 20 20 test suite...
12bb0 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
12bc0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 64 [info exists ::d
12bd0 61 74 65 74 69 6d 65 5f 66 6f 72 6d 61 74 5d 20 atetime_format]
12be0 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 && \..
12bf0 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
12c00 3a 3a 64 61 74 65 74 69 6d 65 5f 66 6f 72 6d 61 ::datetime_forma
12c10 74 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a t] > 0} then {..
12c20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
12c30 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 # NOTE: Retur
12c40 6e 20 74 68 65 20 6d 61 6e 75 61 6c 6c 79 20 6f n the manually o
12c50 76 65 72 72 69 64 64 65 6e 20 76 61 6c 75 65 20 verridden value
12c60 66 6f 72 20 74 68 65 20 44 61 74 65 54 69 6d 65 for the DateTime
12c70 20 66 6f 72 6d 61 74 2e 0d 0a 20 20 20 20 20 20 format...
12c80 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 74 #.. ret
12c90 75 72 6e 20 24 3a 3a 64 61 74 65 74 69 6d 65 5f urn $::datetime_
12ca0 66 6f 72 6d 61 74 0d 0a 20 20 20 20 20 20 7d 20 format.. }
12cb0 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
12cc0 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
12cd0 45 3a 20 52 65 74 75 72 6e 20 61 6e 20 49 53 4f E: Return an ISO
12ce0 38 36 30 31 20 44 61 74 65 54 69 6d 65 20 66 6f 8601 DateTime fo
12cf0 72 6d 61 74 20 63 6f 6d 70 61 74 69 62 6c 65 20 rmat compatible
12d00 77 69 74 68 20 53 51 4c 69 74 65 2c 0d 0a 20 20 with SQLite,..
12d10 20 20 20 20 20 20 23 20 20 20 20 20 20 20 53 79 # Sy
12d20 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
12d30 2c 20 61 6e 64 20 73 75 69 74 61 62 6c 65 20 66 , and suitable f
12d40 6f 72 20 72 6f 75 6e 64 2d 74 72 69 70 70 69 6e or round-trippin
12d50 67 20 77 69 74 68 20 74 68 65 0d 0a 20 20 20 20 g with the..
12d60 20 20 20 20 23 20 20 20 20 20 20 20 44 61 74 65 # Date
12d70 54 69 6d 65 20 63 6c 61 73 73 20 6f 66 20 74 68 Time class of th
12d80 65 20 66 72 61 6d 65 77 6f 72 6b 2e 20 20 49 66 e framework. If
12d90 20 74 68 69 73 20 76 61 6c 75 65 20 69 73 20 63 this value is c
12da0 68 61 6e 67 65 64 2c 0d 0a 20 20 20 20 20 20 20 hanged,..
12db0 20 23 20 20 20 20 20 20 20 76 61 72 69 6f 75 73 # various
12dc0 20 74 65 73 74 73 20 6d 61 79 20 66 61 69 6c 2e tests may fail.
12dd0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
12de0 20 20 20 20 20 72 65 74 75 72 6e 20 5b 61 70 70 return [app
12df0 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
12e00 20 20 20 20 20 20 20 22 79 79 79 79 2d 4d 4d 2d "yyyy-MM-
12e10 64 64 20 48 48 3a 6d 6d 3a 73 73 2e 46 46 46 46 dd HH:mm:ss.FFFF
12e20 46 46 46 22 20 5b 65 78 70 72 20 7b 24 74 69 6d FFF" [expr {$tim
12e30 65 5a 6f 6e 65 20 3f 20 22 4b 22 20 3a 20 22 22 eZone ? "K" : ""
12e40 7d 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 }]].. }..
12e50 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
12e60 20 67 65 74 44 61 74 65 54 69 6d 65 54 69 63 6b getDateTimeTick
12e70 73 20 7b 20 76 61 6c 75 65 20 7b 6c 6f 63 61 6c s { value {local
12e80 20 22 22 7d 20 7b 64 65 66 61 75 6c 74 20 22 22 ""} {default ""
12e90 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 } } {.. if
12ea0 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
12eb0 24 76 61 6c 75 65 5d 20 3d 3d 20 30 7d 20 74 68 $value] == 0} th
12ec0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 en {.. re
12ed0 74 75 72 6e 20 24 64 65 66 61 75 6c 74 0d 0a 20 turn $default..
12ee0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
12ef0 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 if {[catch {..
12f00 20 20 20 20 20 20 73 65 74 20 64 61 74 65 54 69 set dateTi
12f10 6d 65 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b me [object invok
12f20 65 20 2d 63 72 65 61 74 65 20 5c 0d 0a 20 20 20 e -create \..
12f30 20 20 20 20 20 20 20 20 20 2d 70 61 72 61 6d 65 -parame
12f40 74 65 72 74 79 70 65 73 20 5b 6c 69 73 74 20 53 tertypes [list S
12f50 74 72 69 6e 67 20 53 74 72 69 6e 67 20 49 46 6f tring String IFo
12f60 72 6d 61 74 50 72 6f 76 69 64 65 72 20 5c 0d 0a rmatProvider \..
12f70 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
12f80 65 6d 2e 47 6c 6f 62 61 6c 69 7a 61 74 69 6f 6e em.Globalization
12f90 2e 44 61 74 65 54 69 6d 65 53 74 79 6c 65 73 5d .DateTimeStyles]
12fa0 20 44 61 74 65 54 69 6d 65 20 50 61 72 73 65 45 DateTime ParseE
12fb0 78 61 63 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 xact \..
12fc0 20 20 20 20 24 76 61 6c 75 65 20 5b 67 65 74 44 $value [getD
12fd0 61 74 65 54 69 6d 65 46 6f 72 6d 61 74 5d 20 6e ateTimeFormat] n
12fe0 75 6c 6c 20 41 64 6a 75 73 74 54 6f 55 6e 69 76 ull AdjustToUniv
12ff0 65 72 73 61 6c 5d 0d 0a 20 20 20 20 20 20 7d 5d ersal].. }]
13000 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
13010 20 20 72 65 74 75 72 6e 20 24 64 65 66 61 75 6c return $defaul
13020 74 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 t.. }....
13030 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
13040 69 73 20 62 6f 6f 6c 65 61 6e 20 2d 73 74 72 69 is boolean -stri
13050 63 74 20 24 6c 6f 63 61 6c 5d 7d 20 74 68 65 6e ct $local]} then
13060 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 {.. set
13070 64 61 74 65 54 69 6d 65 20 5b 6f 62 6a 65 63 74 dateTime [object
13080 20 69 6e 76 6f 6b 65 20 2d 63 72 65 61 74 65 20 invoke -create
13090 44 61 74 65 54 69 6d 65 20 53 70 65 63 69 66 79 DateTime Specify
130a0 4b 69 6e 64 20 5c 0d 0a 20 20 20 20 20 20 20 20 Kind \..
130b0 20 20 20 20 24 64 61 74 65 54 69 6d 65 20 55 74 $dateTime Ut
130c0 63 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 c].. } else
130d0 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 {.. retu
130e0 72 6e 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b rn [object invok
130f0 65 20 24 64 61 74 65 54 69 6d 65 20 54 69 63 6b e $dateTime Tick
13100 73 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 s].. }....
13110 20 20 20 20 20 69 66 20 7b 24 6c 6f 63 61 6c 7d if {$local}
13120 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
13130 20 72 65 74 75 72 6e 20 5b 6f 62 6a 65 63 74 20 return [object
13140 69 6e 76 6f 6b 65 20 24 64 61 74 65 54 69 6d 65 invoke $dateTime
13150 20 54 6f 4c 6f 63 61 6c 54 69 6d 65 2e 54 69 63 ToLocalTime.Tic
13160 6b 73 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 ks].. } els
13170 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 e {.. ret
13180 75 72 6e 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f urn [object invo
13190 6b 65 20 24 64 61 74 65 54 69 6d 65 20 54 6f 55 ke $dateTime ToU
131a0 6e 69 76 65 72 73 61 6c 54 69 6d 65 2e 54 69 63 niversalTime.Tic
131b0 6b 73 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 ks].. }..
131c0 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
131d0 20 67 65 74 50 72 6f 70 65 72 74 69 65 73 20 7b getProperties {
131e0 20 6f 62 6a 65 63 74 20 76 61 72 4e 61 6d 65 20 object varName
131f0 7d 20 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 72 } {.. upvar
13200 20 31 20 24 76 61 72 4e 61 6d 65 20 70 72 6f 70 1 $varName prop
13210 65 72 74 69 65 73 0d 0a 0d 0a 20 20 20 20 20 20 erties....
13220 73 65 74 20 63 6f 75 6e 74 20 30 0d 0a 20 20 20 set count 0..
13230 20 20 20 73 65 74 20 6e 61 6d 65 73 20 5b 6c 69 set names [li
13240 73 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 st].... if
13250 7b 5b 69 73 4f 62 6a 65 63 74 48 61 6e 64 6c 65 {[isObjectHandle
13260 20 24 6f 62 6a 65 63 74 5d 20 26 26 20 24 6f 62 $object] && $ob
13270 6a 65 63 74 20 6e 65 20 22 6e 75 6c 6c 22 7d 20 ject ne "null"}
13280 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
13290 65 76 61 6c 20 6c 61 70 70 65 6e 64 20 6e 61 6d eval lappend nam
132a0 65 73 20 5b 6f 62 6a 65 63 74 20 6d 65 6d 62 65 es [object membe
132b0 72 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 rs \..
132c0 20 20 2d 6d 65 6d 62 65 72 74 79 70 65 73 20 50 -membertypes P
132d0 72 6f 70 65 72 74 79 20 2d 6e 61 6d 65 6f 6e 6c roperty -nameonl
132e0 79 20 24 6f 62 6a 65 63 74 5d 0d 0a 0d 0a 20 20 y $object]....
132f0 20 20 20 20 20 20 65 76 61 6c 20 6c 61 70 70 65 eval lappe
13300 6e 64 20 6e 61 6d 65 73 20 5b 6f 62 6a 65 63 74 nd names [object
13310 20 6d 65 6d 62 65 72 73 20 5c 0d 0a 20 20 20 20 members \..
13320 20 20 20 20 20 20 20 20 2d 6d 65 6d 62 65 72 74 -membert
13330 79 70 65 73 20 46 69 65 6c 64 20 2d 6e 61 6d 65 ypes Field -name
13340 6f 6e 6c 79 20 24 6f 62 6a 65 63 74 5d 0d 0a 20 only $object]..
13350 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
13360 66 6f 72 65 61 63 68 20 6e 61 6d 65 20 24 6e 61 foreach name $na
13370 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 mes {.. i
13380 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
13390 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
133a0 76 6f 6b 65 20 2d 6f 62 6a 65 63 74 66 6c 61 67 voke -objectflag
133b0 73 20 2b 4e 6f 44 69 73 70 6f 73 65 20 24 6f 62 s +NoDispose $ob
133c0 6a 65 63 74 20 24 6e 61 6d 65 0d 0a 20 20 20 20 ject $name..
133d0 20 20 20 20 7d 20 76 61 6c 75 65 5d 20 3d 3d 20 } value] ==
133e0 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
133f0 20 20 20 20 20 69 66 20 7b 5b 69 73 4f 62 6a 65 if {[isObje
13400 63 74 48 61 6e 64 6c 65 20 24 76 61 6c 75 65 5d ctHandle $value]
13410 20 26 26 20 24 76 61 6c 75 65 20 6e 65 20 22 6e && $value ne "n
13420 75 6c 6c 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ull"} then {..
13430 20 20 20 20 20 20 20 20 20 20 73 65 74 20 65 72 set er
13440 72 6f 72 20 6e 75 6c 6c 3b 20 6f 62 6a 65 63 74 ror null; object
13450 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
13460 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 NonPublic \..
13470 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 6d 61 -ma
13480 72 73 68 61 6c 66 6c 61 67 73 20 2b 4e 6f 48 61 rshalflags +NoHa
13490 6e 64 6c 65 20 49 6e 74 65 72 70 72 65 74 65 72 ndle Interpreter
134a0 2e 47 65 74 41 63 74 69 76 65 20 5c 0d 0a 20 20 .GetActive \..
134b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 41 64 Ad
134c0 64 4f 62 6a 65 63 74 52 65 66 65 72 65 6e 63 65 dObjectReference
134d0 20 4f 6b 20 24 76 61 6c 75 65 20 65 72 72 6f 72 Ok $value error
134e0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
134f0 6c 61 70 70 65 6e 64 20 70 72 6f 70 65 72 74 69 lappend properti
13500 65 73 28 6f 62 6a 65 63 74 73 29 20 5b 6c 69 73 es(objects) [lis
13510 74 20 24 6e 61 6d 65 20 24 76 61 6c 75 65 5d 0d t $name $value].
13520 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 . } els
13530 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
13540 20 6c 61 70 70 65 6e 64 20 70 72 6f 70 65 72 74 lappend propert
13550 69 65 73 28 76 61 6c 75 65 73 29 20 5b 6c 69 73 ies(values) [lis
13560 74 20 24 6e 61 6d 65 20 24 76 61 6c 75 65 5d 0d t $name $value].
13570 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a . }....
13580 20 20 20 20 20 20 20 20 20 20 69 6e 63 72 20 63 incr c
13590 6f 75 6e 74 0d 0a 20 20 20 20 20 20 20 20 7d 20 ount.. }
135a0 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
135b0 20 20 6c 61 70 70 65 6e 64 20 70 72 6f 70 65 72 lappend proper
135c0 74 69 65 73 28 65 72 72 6f 72 73 29 20 5b 6c 69 ties(errors) [li
135d0 73 74 20 24 6e 61 6d 65 20 24 3a 3a 65 72 72 6f st $name $::erro
135e0 72 43 6f 64 65 5d 0d 0a 20 20 20 20 20 20 20 20 rCode]..
135f0 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
13600 20 20 20 20 72 65 74 75 72 6e 20 24 63 6f 75 6e return $coun
13610 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 t.. }.....
13620 20 70 72 6f 63 20 67 65 74 41 6c 6c 50 72 6f 70 proc getAllProp
13630 65 72 74 69 65 73 20 7b 20 6f 62 6a 65 63 74 20 erties { object
13640 76 61 72 4e 61 6d 65 20 7d 20 7b 0d 0a 20 20 20 varName } {..
13650 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 4e upvar 1 $varN
13660 61 6d 65 20 70 72 6f 70 65 72 74 69 65 73 0d 0a ame properties..
13670 20 20 20 20 20 20 73 65 74 20 76 61 6c 75 65 20 set value
13680 24 6f 62 6a 65 63 74 0d 0a 0d 0a 20 20 20 20 20 $object....
13690 20 77 68 69 6c 65 20 7b 74 72 75 65 7d 20 7b 0d while {true} {.
136a0 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 . if {![i
136b0 6e 66 6f 20 65 78 69 73 74 73 20 70 72 6f 70 65 nfo exists prope
136c0 72 74 69 65 73 28 73 65 65 6e 4f 62 6a 65 63 74 rties(seenObject
136d0 73 29 5d 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 s)] || \..
136e0 20 20 20 20 20 20 24 76 61 6c 75 65 20 6e 69 20 $value ni
136f0 24 70 72 6f 70 65 72 74 69 65 73 28 73 65 65 6e $properties(seen
13700 4f 62 6a 65 63 74 73 29 7d 20 74 68 65 6e 20 7b Objects)} then {
13710 0d 0a 20 20 20 20 20 20 20 20 20 20 67 65 74 50 .. getP
13720 72 6f 70 65 72 74 69 65 73 20 24 76 61 6c 75 65 roperties $value
13730 20 70 72 6f 70 65 72 74 69 65 73 0d 0a 20 20 20 properties..
13740 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 70 lappend p
13750 72 6f 70 65 72 74 69 65 73 28 73 65 65 6e 4f 62 roperties(seenOb
13760 6a 65 63 74 73 29 20 24 76 61 6c 75 65 0d 0a 20 jects) $value..
13770 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
13780 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
13790 78 69 73 74 73 20 70 72 6f 70 65 72 74 69 65 73 xists properties
137a0 28 6f 62 6a 65 63 74 73 29 5d 7d 20 74 68 65 6e (objects)]} then
137b0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 62 72 {.. br
137c0 65 61 6b 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a eak.. }..
137d0 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 6c .. if {[l
137e0 6c 65 6e 67 74 68 20 24 70 72 6f 70 65 72 74 69 length $properti
137f0 65 73 28 6f 62 6a 65 63 74 73 29 5d 20 3d 3d 20 es(objects)] ==
13800 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
13810 20 20 20 20 20 75 6e 73 65 74 20 70 72 6f 70 65 unset prope
13820 72 74 69 65 73 28 6f 62 6a 65 63 74 73 29 3b 20 rties(objects);
13830 62 72 65 61 6b 0d 0a 20 20 20 20 20 20 20 20 7d break.. }
13840 0d 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 .... set
13850 76 61 6c 75 65 20 5b 6c 69 6e 64 65 78 20 5b 6c value [lindex [l
13860 69 6e 64 65 78 20 24 70 72 6f 70 65 72 74 69 65 index $propertie
13870 73 28 6f 62 6a 65 63 74 73 29 20 30 5d 20 65 6e s(objects) 0] en
13880 64 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 d].. set
13890 70 72 6f 70 65 72 74 69 65 73 28 6f 62 6a 65 63 properties(objec
138a0 74 73 29 20 5b 6c 72 61 6e 67 65 20 24 70 72 6f ts) [lrange $pro
138b0 70 65 72 74 69 65 73 28 6f 62 6a 65 63 74 73 29 perties(objects)
138c0 20 31 20 65 6e 64 5d 0d 0a 20 20 20 20 20 20 7d 1 end].. }
138d0 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 .... if {[i
138e0 6e 66 6f 20 65 78 69 73 74 73 20 70 72 6f 70 65 nfo exists prope
138f0 72 74 69 65 73 28 73 65 65 6e 4f 62 6a 65 63 74 rties(seenObject
13900 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
13910 20 20 20 20 20 66 6f 72 65 61 63 68 20 76 61 6c foreach val
13920 75 65 20 24 70 72 6f 70 65 72 74 69 65 73 28 73 ue $properties(s
13930 65 65 6e 4f 62 6a 65 63 74 73 29 20 7b 0d 0a 20 eenObjects) {..
13940 20 20 20 20 20 20 20 20 20 69 66 20 7b 24 76 61 if {$va
13950 6c 75 65 20 65 71 20 24 6f 62 6a 65 63 74 7d 20 lue eq $object}
13960 63 6f 6e 74 69 6e 75 65 0d 0a 20 20 20 20 20 20 continue..
13970 20 20 20 20 63 61 74 63 68 20 7b 6f 62 6a 65 63 catch {objec
13980 74 20 64 69 73 70 6f 73 65 20 24 76 61 6c 75 65 t dispose $value
13990 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
139a0 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 70 72 unset pr
139b0 6f 70 65 72 74 69 65 73 28 73 65 65 6e 4f 62 6a operties(seenObj
139c0 65 63 74 73 29 0d 0a 20 20 20 20 20 20 7d 0d 0a ects).. }..
139d0 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
139e0 6f 63 20 67 65 74 56 61 72 69 61 62 6c 65 73 20 oc getVariables
139f0 7b 20 76 61 72 4e 61 6d 65 73 20 7b 6f 62 6a 65 { varNames {obje
13a00 63 74 73 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a cts false} } {..
13a10 20 20 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 set result
13a20 20 5b 6c 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 20 [list]....
13a30 20 66 6f 72 65 61 63 68 20 76 61 72 4e 61 6d 65 foreach varName
13a40 20 24 76 61 72 4e 61 6d 65 73 20 7b 0d 0a 20 20 $varNames {..
13a50 20 20 20 20 20 20 69 66 20 7b 5b 75 70 6c 65 76 if {[uplev
13a60 65 6c 20 31 20 5b 6c 69 73 74 20 61 72 72 61 79 el 1 [list array
13a70 20 65 78 69 73 74 73 20 24 76 61 72 4e 61 6d 65 exists $varName
13a80 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 ]]} then {..
13a90 20 20 20 20 20 20 73 65 74 20 61 72 72 61 79 4e set arrayN
13aa0 61 6d 65 20 24 76 61 72 4e 61 6d 65 0d 0a 0d 0a ame $varName....
13ab0 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 foreac
13ac0 68 20 65 6c 65 6d 65 6e 74 4e 61 6d 65 20 5b 75 h elementName [u
13ad0 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 61 plevel 1 [list a
13ae0 72 72 61 79 20 6e 61 6d 65 73 20 24 61 72 72 61 rray names $arra
13af0 79 4e 61 6d 65 5d 5d 20 7b 0d 0a 20 20 20 20 20 yName]] {..
13b00 20 20 20 20 20 20 20 73 65 74 20 6e 61 6d 65 20 set name
13b10 5b 61 70 70 65 6e 64 41 72 67 73 20 24 61 72 72 [appendArgs $arr
13b20 61 79 4e 61 6d 65 20 28 20 24 65 6c 65 6d 65 6e ayName ( $elemen
13b30 74 4e 61 6d 65 20 29 5d 0d 0a 20 20 20 20 20 20 tName )]..
13b40 20 20 20 20 20 20 73 65 74 20 76 61 72 56 61 6c set varVal
13b50 75 65 20 5b 75 70 6c 65 76 65 6c 20 31 20 5b 6c ue [uplevel 1 [l
13b60 69 73 74 20 73 65 74 20 24 6e 61 6d 65 5d 5d 0d ist set $name]].
13b70 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 ... i
13b80 66 20 7b 24 6f 62 6a 65 63 74 73 20 26 26 20 5b f {$objects && [
13b90 69 73 4f 62 6a 65 63 74 48 61 6e 64 6c 65 20 24 isObjectHandle $
13ba0 76 61 72 56 61 6c 75 65 5d 7d 20 74 68 65 6e 20 varValue]} then
13bb0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
13bc0 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 unset -nocompla
13bd0 69 6e 20 70 72 6f 70 65 72 74 69 65 73 0d 0a 20 in properties..
13be0 20 20 20 20 20 20 20 20 20 20 20 20 20 67 65 74 get
13bf0 41 6c 6c 50 72 6f 70 65 72 74 69 65 73 20 24 76 AllProperties $v
13c00 61 72 56 61 6c 75 65 20 70 72 6f 70 65 72 74 69 arValue properti
13c10 65 73 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 es....
13c20 20 20 20 20 6c 61 70 70 65 6e 64 20 72 65 73 75 lappend resu
13c30 6c 74 20 5b 6c 69 73 74 20 24 6e 61 6d 65 20 5b lt [list $name [
13c40 61 72 72 61 79 20 67 65 74 20 70 72 6f 70 65 72 array get proper
13c50 74 69 65 73 5d 5d 0d 0a 20 20 20 20 20 20 20 20 ties]]..
13c60 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
13c70 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 lapp
13c80 65 6e 64 20 72 65 73 75 6c 74 20 5b 6c 69 73 74 end result [list
13c90 20 24 6e 61 6d 65 20 24 76 61 72 56 61 6c 75 65 $name $varValue
13ca0 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
13cb0 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
13cc0 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
13cd0 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 76 . set v
13ce0 61 72 56 61 6c 75 65 20 5b 75 70 6c 65 76 65 6c arValue [uplevel
13cf0 20 31 20 5b 6c 69 73 74 20 73 65 74 20 24 76 61 1 [list set $va
13d00 72 4e 61 6d 65 5d 5d 0d 0a 0d 0a 20 20 20 20 20 rName]]....
13d10 20 20 20 20 20 69 66 20 7b 24 6f 62 6a 65 63 74 if {$object
13d20 73 20 26 26 20 5b 69 73 4f 62 6a 65 63 74 48 61 s && [isObjectHa
13d30 6e 64 6c 65 20 24 76 61 72 56 61 6c 75 65 5d 7d ndle $varValue]}
13d40 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
13d50 20 20 20 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f unset -noco
13d60 6d 70 6c 61 69 6e 20 70 72 6f 70 65 72 74 69 65 mplain propertie
13d70 73 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 67 s.. g
13d80 65 74 41 6c 6c 50 72 6f 70 65 72 74 69 65 73 20 etAllProperties
13d90 24 76 61 72 56 61 6c 75 65 20 70 72 6f 70 65 72 $varValue proper
13da0 74 69 65 73 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ties....
13db0 20 20 20 20 6c 61 70 70 65 6e 64 20 72 65 73 75 lappend resu
13dc0 6c 74 20 5b 6c 69 73 74 20 24 76 61 72 4e 61 6d lt [list $varNam
13dd0 65 20 5b 61 72 72 61 79 20 67 65 74 20 70 72 6f e [array get pro
13de0 70 65 72 74 69 65 73 5d 5d 0d 0a 20 20 20 20 20 perties]]..
13df0 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
13e00 20 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 65 lappe
13e10 6e 64 20 72 65 73 75 6c 74 20 5b 6c 69 73 74 20 nd result [list
13e20 24 76 61 72 4e 61 6d 65 20 24 76 61 72 56 61 6c $varName $varVal
13e30 75 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d ue].. }
13e40 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
13e50 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 }.... re
13e60 74 75 72 6e 20 24 72 65 73 75 6c 74 0d 0a 20 20 turn $result..
13e70 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
13e80 20 65 6e 75 6d 65 72 61 62 6c 65 54 6f 4c 69 73 enumerableToLis
13e90 74 20 7b 20 65 6e 75 6d 65 72 61 62 6c 65 20 7d t { enumerable }
13ea0 20 7b 0d 0a 20 20 20 20 20 20 73 65 74 20 72 65 {.. set re
13eb0 73 75 6c 74 20 5b 6c 69 73 74 5d 0d 0a 0d 0a 20 sult [list]....
13ec0 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
13ed0 20 6c 65 6e 67 74 68 20 24 65 6e 75 6d 65 72 61 length $enumera
13ee0 62 6c 65 5d 20 3d 3d 20 30 20 7c 7c 20 24 65 6e ble] == 0 || $en
13ef0 75 6d 65 72 61 62 6c 65 20 65 71 20 22 6e 75 6c umerable eq "nul
13f00 6c 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 l"} then {..
13f10 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 return $resu
13f20 6c 74 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 lt.. }....
13f30 20 20 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 object fore
13f40 61 63 68 20 2d 61 6c 69 61 73 20 69 74 65 6d 20 ach -alias item
13f50 24 65 6e 75 6d 65 72 61 62 6c 65 20 7b 0d 0a 20 $enumerable {..
13f60 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 if {[stri
13f70 6e 67 20 6c 65 6e 67 74 68 20 24 69 74 65 6d 5d ng length $item]
13f80 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
13f90 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 lappend
13fa0 72 65 73 75 6c 74 20 5b 24 69 74 65 6d 20 54 6f result [$item To
13fb0 53 74 72 69 6e 67 5d 0d 0a 20 20 20 20 20 20 20 String]..
13fc0 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }.. }....
13fd0 20 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 return $res
13fe0 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 ult.. }.....
13ff0 20 20 20 70 72 6f 63 20 63 61 74 63 68 41 6e 64 proc catchAnd
14000 52 65 74 75 72 6e 20 7b 20 73 63 72 69 70 74 20 Return { script
14010 7b 73 74 61 63 6b 54 72 61 63 65 20 66 61 6c 73 {stackTrace fals
14020 65 7d 20 7b 73 74 72 69 63 74 20 74 72 75 65 7d e} {strict true}
14030 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 } {.. #..
14040 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 45 76 61 # NOTE: Eva
14050 6c 75 61 74 65 20 74 68 65 20 73 63 72 69 70 74 luate the script
14060 20 70 72 6f 76 69 64 65 64 20 62 79 20 6f 75 72 provided by our
14070 20 63 61 6c 6c 65 72 20 69 6e 20 74 68 65 69 72 caller in their
14080 20 63 6f 6e 74 65 78 74 2c 0d 0a 20 20 20 20 20 context,..
14090 20 23 20 20 20 20 20 20 20 63 61 70 74 75 72 69 # capturi
140a0 6e 67 20 62 6f 74 68 20 74 68 65 20 72 65 73 75 ng both the resu
140b0 6c 74 20 61 6e 64 20 74 68 65 20 72 65 74 75 72 lt and the retur
140c0 6e 20 63 6f 64 65 2e 0d 0a 20 20 20 20 20 20 23 n code... #
140d0 0d 0a 20 20 20 20 20 20 73 65 74 20 63 6f 64 65 .. set code
140e0 20 5b 63 61 74 63 68 20 7b 75 70 6c 65 76 65 6c [catch {uplevel
140f0 20 31 20 24 73 63 72 69 70 74 7d 20 72 65 73 75 1 $script} resu
14100 6c 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a lt].... #..
14110 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 69 # NOTE: Di
14120 64 20 74 68 65 20 73 63 72 69 70 74 20 70 72 6f d the script pro
14130 76 69 64 65 64 20 62 79 20 6f 75 72 20 63 61 6c vided by our cal
14140 6c 65 72 20 4e 4f 54 20 72 61 69 73 65 20 61 6e ler NOT raise an
14150 20 65 72 72 6f 72 3f 0d 0a 20 20 20 20 20 20 23 error?.. #
14160 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 73 74 72 .. if {$str
14170 69 63 74 20 26 26 20 24 63 6f 64 65 20 3d 3d 20 ict && $code ==
14180 30 20 7c 7c 20 21 24 73 74 72 69 63 74 20 26 26 0 || !$strict &&
14190 20 24 63 6f 64 65 20 21 3d 20 31 7d 20 74 68 65 $code != 1} the
141a0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
141b0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
141c0 53 75 63 63 65 73 73 2e 20 20 52 65 74 75 72 6e Success. Return
141d0 20 61 20 6c 69 73 74 20 77 69 74 68 20 74 68 65 a list with the
141e0 20 72 65 74 75 72 6e 20 63 6f 64 65 20 61 6e 64 return code and
141f0 20 74 68 65 20 72 65 73 75 6c 74 2e 0d 0a 20 20 the result...
14200 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
14210 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 20 24 63 return [list $c
14220 6f 64 65 20 24 72 65 73 75 6c 74 5d 0d 0a 20 20 ode $result]..
14230 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 24 73 } elseif {$s
14240 74 61 63 6b 54 72 61 63 65 7d 20 74 68 65 6e 20 tackTrace} then
14250 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 {.. #..
14260 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 61 # NOTE: Fa
14270 69 6c 75 72 65 2e 20 20 4f 75 72 20 63 61 6c 6c ilure. Our call
14280 65 72 20 77 61 6e 74 73 20 61 20 66 75 6c 6c 20 er wants a full
14290 73 74 61 63 6b 20 74 72 61 63 65 20 28 69 66 20 stack trace (if
142a0 61 70 70 6c 69 63 61 62 6c 65 29 2c 0d 0a 20 20 applicable),..
142b0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 72 65 # re
142c0 74 75 72 6e 20 61 20 6c 69 73 74 20 77 69 74 68 turn a list with
142d0 20 74 68 65 20 72 65 74 75 72 6e 20 63 6f 64 65 the return code
142e0 20 61 6e 64 20 74 68 65 20 72 65 73 75 6c 74 20 and the result
142f0 76 65 72 62 61 74 69 6d 2e 0d 0a 20 20 20 20 20 verbatim...
14300 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 #.. re
14310 74 75 72 6e 20 5b 6c 69 73 74 20 24 63 6f 64 65 turn [list $code
14320 20 24 72 65 73 75 6c 74 5d 0d 0a 20 20 20 20 20 $result]..
14330 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
14340 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
14350 4e 4f 54 45 3a 20 46 61 69 6c 75 72 65 2e 20 20 NOTE: Failure.
14360 4f 75 72 20 63 61 6c 6c 65 72 20 64 6f 65 73 20 Our caller does
14370 6e 6f 74 20 77 61 6e 74 20 61 20 66 75 6c 6c 20 not want a full
14380 73 74 61 63 6b 20 74 72 61 63 65 20 28 69 66 0d stack trace (if.
14390 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
143a0 20 61 70 70 6c 69 63 61 62 6c 65 29 2c 20 72 65 applicable), re
143b0 74 75 72 6e 20 61 20 6c 69 73 74 20 77 69 74 68 turn a list with
143c0 20 74 68 65 20 72 65 74 75 72 6e 20 63 6f 64 65 the return code
143d0 2c 20 74 68 65 20 65 72 72 6f 72 0d 0a 20 20 20 , the error..
143e0 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 64 # cod
143f0 65 20 66 6f 72 20 74 68 65 20 69 6e 74 65 72 70 e for the interp
14400 72 65 74 65 72 2c 20 61 6e 64 20 74 68 65 20 65 reter, and the e
14410 72 72 6f 72 20 6d 65 73 73 61 67 65 20 75 70 20 rror message up
14420 74 6f 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 to the..
14430 23 20 20 20 20 20 20 20 70 6f 69 6e 74 20 77 68 # point wh
14440 65 72 65 20 74 68 65 20 73 74 61 63 6b 20 74 72 ere the stack tr
14450 61 63 65 20 73 68 6f 75 6c 64 20 73 74 61 72 74 ace should start
14460 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
14470 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 return [li
14480 73 74 20 24 63 6f 64 65 20 24 3a 3a 65 72 72 6f st $code $::erro
14490 72 43 6f 64 65 20 5c 0d 0a 20 20 20 20 20 20 20 rCode \..
144a0 20 20 20 20 20 5b 65 78 74 72 61 63 74 53 79 73 [extractSys
144b0 74 65 6d 44 61 74 61 53 51 4c 69 74 65 45 78 63 temDataSQLiteExc
144c0 65 70 74 69 6f 6e 4d 65 73 73 61 67 65 20 24 72 eptionMessage $r
144d0 65 73 75 6c 74 5d 5d 0d 0a 20 20 20 20 20 20 7d esult]].. }
144e0 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
144f0 70 72 6f 63 20 72 65 73 65 74 45 78 63 65 70 74 proc resetExcept
14500 69 6f 6e 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 ion {} {..
14510 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
14520 20 52 65 73 65 74 20 65 78 63 65 70 74 69 6f 6e Reset exception
14530 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 associated with
14540 20 74 68 69 73 20 69 6e 74 65 72 70 72 65 74 65 this interprete
14550 72 20 28 74 6f 20 6e 75 6c 6c 29 2e 0d 0a 20 20 r (to null)...
14560 20 20 20 20 23 20 20 20 20 20 20 20 54 68 69 73 # This
14570 20 28 70 72 69 76 61 74 65 29 20 70 72 6f 70 65 (private) prope
14580 72 74 79 20 69 73 20 6d 61 69 6e 74 61 69 6e 65 rty is maintaine
14590 64 20 6f 6e 20 61 20 70 65 72 2d 74 68 72 65 61 d on a per-threa
145a0 64 20 62 61 73 69 73 2e 0d 0a 20 20 20 20 20 20 d basis...
145b0 23 0d 0a 20 20 20 20 20 20 6f 62 6a 65 63 74 20 #.. object
145c0 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
145d0 6f 6e 50 75 62 6c 69 63 20 49 6e 74 65 72 70 72 onPublic Interpr
145e0 65 74 65 72 2e 47 65 74 41 63 74 69 76 65 20 45 eter.GetActive E
145f0 78 63 65 70 74 69 6f 6e 20 6e 75 6c 6c 0d 0a 20 xception null..
14600 20 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a return ""..
14610 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
14620 6f 63 20 63 61 74 63 68 41 6e 64 53 65 74 45 78 oc catchAndSetEx
14630 63 65 70 74 69 6f 6e 20 7b 20 73 63 72 69 70 74 ception { script
14640 20 7b 76 61 72 4e 61 6d 65 20 22 22 7d 20 7d 20 {varName ""} }
14650 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
14660 20 20 23 20 4e 4f 54 45 3a 20 45 76 61 6c 75 61 # NOTE: Evalua
14670 74 65 20 74 68 65 20 73 63 72 69 70 74 20 70 72 te the script pr
14680 6f 76 69 64 65 64 20 62 79 20 6f 75 72 20 63 61 ovided by our ca
14690 6c 6c 65 72 20 69 6e 20 74 68 65 69 72 20 63 6f ller in their co
146a0 6e 74 65 78 74 2e 0d 0a 20 20 20 20 20 20 23 0d ntext... #.
146b0 0a 20 20 20 20 20 20 63 61 74 63 68 20 7b 75 70 . catch {up
146c0 6c 65 76 65 6c 20 31 20 24 73 63 72 69 70 74 7d level 1 $script}
146d0 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
146e0 20 20 20 23 20 4e 4f 54 45 3a 20 47 72 61 62 20 # NOTE: Grab
146f0 74 68 65 20 28 70 72 69 76 61 74 65 29 20 65 78 the (private) ex
14700 63 65 70 74 69 6f 6e 20 70 72 6f 70 65 72 74 79 ception property
14710 20 66 72 6f 6d 20 74 68 69 73 20 69 6e 74 65 72 from this inter
14720 70 72 65 74 65 72 2c 0d 0a 20 20 20 20 20 20 23 preter,.. #
14730 20 20 20 20 20 20 20 66 6f 72 20 74 68 69 73 20 for this
14740 74 68 72 65 61 64 2c 20 61 6e 64 20 61 64 64 20 thread, and add
14750 61 73 20 61 6e 20 6f 70 61 71 75 65 20 6f 62 6a as an opaque obj
14760 65 63 74 20 68 61 6e 64 6c 65 20 69 6e 20 74 68 ect handle in th
14770 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
14780 20 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 20 context of our
14790 63 61 6c 6c 65 72 2e 0d 0a 20 20 20 20 20 20 23 caller... #
147a0 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
147b0 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e ing length $varN
147c0 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ame] > 0} then {
147d0 0d 0a 20 20 20 20 20 20 20 20 75 70 76 61 72 20 .. upvar
147e0 31 20 24 76 61 72 4e 61 6d 65 20 65 78 63 65 70 1 $varName excep
147f0 74 69 6f 6e 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d tion.. }...
14800 0a 20 20 20 20 20 20 73 65 74 20 65 78 63 65 70 . set excep
14810 74 69 6f 6e 20 5b 6f 62 6a 65 63 74 20 69 6e 76 tion [object inv
14820 6f 6b 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 oke \..
14830 20 2d 61 6c 69 61 73 20 2d 66 6c 61 67 73 20 2b -alias -flags +
14840 4e 6f 6e 50 75 62 6c 69 63 20 49 6e 74 65 72 70 NonPublic Interp
14850 72 65 74 65 72 2e 47 65 74 41 63 74 69 76 65 20 reter.GetActive
14860 45 78 63 65 70 74 69 6f 6e 5d 0d 0a 0d 0a 20 20 Exception]....
14870 20 20 20 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 return ""..
14880 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f }..... pro
14890 63 20 63 6f 6d 70 69 6c 65 43 53 68 61 72 70 57 c compileCSharpW
148a0 69 74 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 ith {..
148b0 20 20 20 74 65 78 74 20 6d 65 6d 6f 72 79 20 73 text memory s
148c0 79 6d 62 6f 6c 73 20 73 74 72 69 63 74 20 72 65 ymbols strict re
148d0 73 75 6c 74 73 56 61 72 4e 61 6d 65 20 65 72 72 sultsVarName err
148e0 6f 72 73 56 61 72 4e 61 6d 65 20 66 69 6c 65 4e orsVarName fileN
148f0 61 6d 65 73 0d 0a 20 20 20 20 20 20 20 20 20 20 ames..
14900 20 20 61 72 67 73 20 7d 20 7b 0d 0a 20 20 20 20 args } {..
14910 20 20 74 72 79 20 7b 0d 0a 20 20 20 20 20 20 20 try {..
14920 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
14930 54 45 3a 20 53 69 6e 63 65 20 77 65 20 61 72 65 TE: Since we are
14940 20 67 6f 69 6e 67 20 74 6f 20 75 73 65 20 74 68 going to use th
14950 69 73 20 6d 65 74 68 6f 64 20 6e 61 6d 65 20 61 is method name a
14960 20 6c 6f 74 2c 20 61 73 73 69 67 6e 0d 0a 20 20 lot, assign..
14970 20 20 20 20 20 20 23 20 20 20 20 20 20 20 69 74 # it
14980 20 74 6f 20 61 20 76 61 72 69 61 62 6c 65 20 66 to a variable f
14990 69 72 73 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 irst... #
149a0 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 61 64 .. set ad
149b0 64 20 52 65 66 65 72 65 6e 63 65 64 41 73 73 65 d ReferencedAsse
149c0 6d 62 6c 69 65 73 2e 41 64 64 0d 0a 0d 0a 20 20 mblies.Add....
149d0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
149e0 20 23 20 4e 4f 54 45 3a 20 43 72 65 61 74 65 20 # NOTE: Create
149f0 74 68 65 20 62 61 73 65 20 63 6f 6d 6d 61 6e 64 the base command
14a00 20 74 6f 20 65 76 61 6c 75 61 74 65 20 61 6e 64 to evaluate and
14a10 20 61 64 64 20 74 68 65 20 70 72 6f 70 65 72 74 add the propert
14a20 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 y.. #
14a30 20 20 20 73 65 74 74 69 6e 67 73 20 74 68 61 74 settings that
14a40 20 61 72 65 20 61 6c 6d 6f 73 74 20 61 6c 77 61 are almost alwa
14a50 79 73 20 6e 65 65 64 65 64 20 62 79 20 6f 75 72 ys needed by our
14a60 20 75 6e 69 74 20 74 65 73 74 73 0d 0a 20 20 20 unit tests..
14a70 20 20 20 20 20 23 20 20 20 20 20 20 20 28 69 2e # (i.
14a80 65 2e 20 74 68 65 20 53 79 73 74 65 6d 20 61 6e e. the System an
14a90 64 20 53 79 73 74 65 6d 2e 44 61 74 61 20 61 73 d System.Data as
14aa0 73 65 6d 62 6c 79 20 72 65 66 65 72 65 6e 63 65 sembly reference
14ab0 73 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a s)... #..
14ac0 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 6d 6d set comm
14ad0 61 6e 64 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 and [list \..
14ae0 20 20 20 20 20 20 20 20 20 63 6f 6d 70 69 6c 65 compile
14af0 43 53 68 61 72 70 20 24 74 65 78 74 20 24 6d 65 CSharp $text $me
14b00 6d 6f 72 79 20 24 73 79 6d 62 6f 6c 73 20 24 73 mory $symbols $s
14b10 74 72 69 63 74 20 72 65 73 75 6c 74 73 20 5c 0d trict results \.
14b20 0a 20 20 20 20 20 20 20 20 20 20 20 20 65 72 72 . err
14b30 6f 72 73 20 24 61 64 64 20 53 79 73 74 65 6d 2e ors $add System.
14b40 64 6c 6c 20 24 61 64 64 20 53 79 73 74 65 6d 2e dll $add System.
14b50 44 61 74 61 2e 64 6c 6c 20 24 61 64 64 20 5c 0d Data.dll $add \.
14b60 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 . Sys
14b70 74 65 6d 2e 54 72 61 6e 73 61 63 74 69 6f 6e 73 tem.Transactions
14b80 2e 64 6c 6c 20 24 61 64 64 20 53 79 73 74 65 6d .dll $add System
14b90 2e 58 6d 6c 2e 64 6c 6c 5d 0d 0a 0d 0a 20 20 20 .Xml.dll]....
14ba0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
14bb0 23 20 4e 4f 54 45 3a 20 41 64 64 20 61 6c 6c 20 # NOTE: Add all
14bc0 74 68 65 20 70 72 6f 76 69 64 65 64 20 66 69 6c the provided fil
14bd0 65 20 6e 61 6d 65 73 20 61 73 20 61 73 73 65 6d e names as assem
14be0 62 6c 79 20 72 65 66 65 72 65 6e 63 65 73 2e 0d bly references..
14bf0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
14c00 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
14c10 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 73 20 Name $fileNames
14c20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6c 61 70 {.. lap
14c30 70 65 6e 64 20 63 6f 6d 6d 61 6e 64 20 24 61 64 pend command $ad
14c40 64 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 d [getBinaryFile
14c50 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 5d 0d Name $fileName].
14c60 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
14c70 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
14c80 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 65 78 74 # NOTE: Add ext
14c90 72 61 20 61 72 67 75 6d 65 6e 74 73 2c 20 69 66 ra arguments, if
14ca0 20 61 6e 79 2c 20 74 6f 20 74 68 65 20 63 6f 6d any, to the com
14cb0 6d 61 6e 64 20 74 6f 20 65 76 61 6c 75 61 74 65 mand to evaluate
14cc0 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
14cd0 20 20 20 20 20 20 65 76 61 6c 20 6c 61 70 70 65 eval lappe
14ce0 6e 64 20 63 6f 6d 6d 61 6e 64 20 24 61 72 67 73 nd command $args
14cf0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
14d00 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 # NOTE: A
14d10 6c 69 61 73 20 74 68 65 20 63 6f 6d 70 69 6c 65 lias the compile
14d20 72 20 6c 6f 63 61 6c 20 72 65 73 75 6c 74 73 20 r local results
14d30 61 6e 64 20 65 72 72 6f 72 73 20 76 61 72 69 61 and errors varia
14d40 62 6c 65 73 20 74 6f 0d 0a 20 20 20 20 20 20 20 bles to..
14d50 20 23 20 20 20 20 20 20 20 74 68 65 20 76 61 72 # the var
14d60 69 61 62 6c 65 20 6e 61 6d 65 73 20 70 72 6f 76 iable names prov
14d70 69 64 65 64 20 62 79 20 6f 75 72 20 63 61 6c 6c ided by our call
14d80 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a er... #..
14d90 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 if {[str
14da0 69 6e 67 20 6c 65 6e 67 74 68 20 24 72 65 73 75 ing length $resu
14db0 6c 74 73 56 61 72 4e 61 6d 65 5d 20 3e 20 30 7d ltsVarName] > 0}
14dc0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
14dd0 20 20 20 75 70 76 61 72 20 31 20 24 72 65 73 75 upvar 1 $resu
14de0 6c 74 73 56 61 72 4e 61 6d 65 20 72 65 73 75 6c ltsVarName resul
14df0 74 73 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d ts.. }...
14e00 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 . if {[st
14e10 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 65 72 72 ring length $err
14e20 6f 72 73 56 61 72 4e 61 6d 65 5d 20 3e 20 30 7d orsVarName] > 0}
14e30 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
14e40 20 20 20 75 70 76 61 72 20 31 20 24 65 72 72 6f upvar 1 $erro
14e50 72 73 56 61 72 4e 61 6d 65 20 65 72 72 6f 72 73 rsVarName errors
14e60 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
14e70 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
14e80 20 20 23 20 4e 4f 54 45 3a 20 45 76 61 6c 75 61 # NOTE: Evalua
14e90 74 65 20 74 68 65 20 63 6f 6e 73 74 72 75 63 74 te the construct
14ea0 65 64 20 5b 63 6f 6d 70 69 6c 65 43 53 68 61 72 ed [compileCShar
14eb0 70 5d 20 63 6f 6d 6d 61 6e 64 20 61 6e 64 0d 0a p] command and..
14ec0 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
14ed0 72 65 74 75 72 6e 20 74 68 65 20 72 65 73 75 6c return the resul
14ee0 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 t... #..
14ef0 20 20 20 20 20 20 20 65 76 61 6c 20 24 63 6f 6d eval $com
14f00 6d 61 6e 64 0d 0a 20 20 20 20 20 20 7d 20 66 69 mand.. } fi
14f10 6e 61 6c 6c 79 20 7b 0d 0a 20 20 20 20 20 20 20 nally {..
14f20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
14f30 54 45 3a 20 49 66 20 74 68 65 20 43 23 20 63 6f TE: If the C# co
14f40 6d 70 69 6c 65 72 20 77 61 73 20 69 6e 76 6f 6b mpiler was invok
14f50 65 64 20 75 73 69 6e 67 20 5b 65 78 65 63 5d 2c ed using [exec],
14f60 20 72 65 73 65 74 20 74 68 65 0d 0a 20 20 20 20 reset the..
14f70 20 20 20 20 23 20 20 20 20 20 20 20 70 72 65 76 # prev
14f80 69 6f 75 73 20 70 72 6f 63 65 73 73 20 69 64 65 ious process ide
14f90 6e 74 69 66 69 65 72 20 6e 6f 77 20 28 69 2e 65 ntifier now (i.e
14fa0 2e 20 74 68 61 74 20 77 61 79 2c 20 69 74 20 64 . that way, it d
14fb0 6f 65 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 oes.. #
14fc0 20 20 20 20 20 6e 6f 74 20 73 68 6f 77 20 75 70 not show up
14fd0 20 61 73 20 62 65 69 6e 67 20 22 6c 65 61 6b 65 as being "leake
14fe0 64 22 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d d")... #.
14ff0 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 73 . if {[is
15000 44 6f 74 4e 65 74 43 6f 72 65 5d 7d 20 74 68 65 DotNetCore]} the
15010 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 n {.. c
15020 61 74 63 68 20 7b 69 6e 66 6f 20 70 72 65 76 69 atch {info previ
15030 6f 75 73 70 69 64 20 74 72 75 65 7d 0d 0a 20 20 ouspid true}..
15040 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
15050 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
15060 70 72 6f 63 20 69 73 4d 65 6d 6f 72 79 44 62 20 proc isMemoryDb
15070 7b 20 66 69 6c 65 4e 61 6d 65 20 7d 20 7b 0d 0a { fileName } {..
15080 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
15090 20 4e 4f 54 45 3a 20 49 73 20 74 68 65 20 73 70 NOTE: Is the sp
150a0 65 63 69 66 69 65 64 20 64 61 74 61 62 61 73 65 ecified database
150b0 20 66 69 6c 65 20 6e 61 6d 65 20 72 65 61 6c 6c file name reall
150c0 79 20 61 6e 20 69 6e 2d 6d 65 6d 6f 72 79 20 64 y an in-memory d
150d0 61 74 61 62 61 73 65 3f 0d 0a 20 20 20 20 20 20 atabase?..
150e0 23 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 #.. return
150f0 5b 65 78 70 72 20 7b 24 66 69 6c 65 4e 61 6d 65 [expr {$fileName
15100 20 65 71 20 22 3a 6d 65 6d 6f 72 79 3a 22 20 7c eq ":memory:" |
15110 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b | \.. [
15120 73 74 72 69 6e 67 20 72 61 6e 67 65 20 24 66 69 string range $fi
15130 6c 65 4e 61 6d 65 20 30 20 31 32 5d 20 65 71 20 leName 0 12] eq
15140 22 66 69 6c 65 3a 3a 6d 65 6d 6f 72 79 3a 22 7d "file::memory:"}
15150 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 ].. }.....
15160 20 70 72 6f 63 20 69 73 54 61 62 6c 65 49 6e 44 proc isTableInD
15170 62 20 7b 20 6e 61 6d 65 20 7b 76 61 72 4e 61 6d b { name {varNam
15180 65 20 64 62 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 e db} } {..
15190 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
151a0 3a 20 52 65 66 65 72 20 74 6f 20 74 68 65 20 73 : Refer to the s
151b0 70 65 63 69 66 69 65 64 20 76 61 72 69 61 62 6c pecified variabl
151c0 65 20 28 65 2e 67 2e 20 22 64 62 22 29 20 69 6e e (e.g. "db") in
151d0 20 74 68 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 the context of
151e0 6f 75 72 0d 0a 20 20 20 20 20 20 23 20 20 20 20 our.. #
151f0 20 20 20 63 61 6c 6c 65 72 2e 20 20 49 74 20 63 caller. It c
15200 6f 6e 74 61 69 6e 73 20 74 68 65 20 64 61 74 61 ontains the data
15210 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 base connection
15220 68 61 6e 64 6c 65 20 74 68 61 74 20 77 69 6c 6c handle that will
15230 20 62 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 be.. #
15240 20 20 20 75 73 65 64 20 74 6f 20 65 78 65 63 75 used to execu
15250 74 65 20 74 68 65 20 71 75 65 72 79 20 75 73 65 te the query use
15260 64 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 69 d to determine i
15270 66 20 74 68 65 20 6e 61 6d 65 64 20 74 61 62 6c f the named tabl
15280 65 20 69 73 0d 0a 20 20 20 20 20 20 23 20 20 20 e is.. #
15290 20 20 20 20 70 72 65 73 65 6e 74 20 69 6e 20 74 present in t
152a0 68 61 74 20 64 61 74 61 62 61 73 65 2e 0d 0a 20 hat database...
152b0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 75 70 #.. up
152c0 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 64 var 1 $varName d
152d0 62 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 b.... #..
152e0 20 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 # NOTE: Use
152f0 74 68 65 20 73 71 6c 69 74 65 5f 6d 61 73 74 65 the sqlite_maste
15300 72 20 74 61 62 6c 65 20 74 6f 20 64 65 74 65 72 r table to deter
15310 6d 69 6e 65 20 69 66 20 74 68 65 20 6e 61 6d 65 mine if the name
15320 64 20 74 61 62 6c 65 20 69 73 0d 0a 20 20 20 20 d table is..
15330 20 20 23 20 20 20 20 20 20 20 70 72 65 73 65 6e # presen
15340 74 20 69 6e 20 74 68 65 20 64 61 74 61 62 61 73 t in the databas
15350 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e... #..
15360 20 20 20 73 65 74 20 73 71 6c 20 7b 0d 0a 20 20 set sql {..
15370 20 20 20 20 20 20 53 45 4c 45 43 54 20 43 4f 55 SELECT COU
15380 4e 54 28 2a 29 20 46 52 4f 4d 20 73 71 6c 69 74 NT(*) FROM sqlit
15390 65 5f 6d 61 73 74 65 72 20 57 48 45 52 45 20 74 e_master WHERE t
153a0 79 70 65 20 3d 20 27 74 61 62 6c 65 27 20 41 4e ype = 'table' AN
153b0 44 20 6e 61 6d 65 20 3d 20 3f 3b 0d 0a 20 20 20 D name = ?;..
153c0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
153d0 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 . # NOTE: R
153e0 65 74 75 72 6e 20 6e 6f 6e 2d 7a 65 72 6f 20 69 eturn non-zero i
153f0 66 20 74 68 65 20 6e 61 6d 65 64 20 74 61 62 6c f the named tabl
15400 65 20 69 73 20 70 72 65 73 65 6e 74 2e 0d 0a 20 e is present...
15410 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 72 65 #.. re
15420 74 75 72 6e 20 5b 65 78 70 72 20 7b 0d 0a 20 20 turn [expr {..
15430 20 20 20 20 20 20 5b 73 71 6c 20 65 78 65 63 75 [sql execu
15440 74 65 20 2d 65 78 65 63 75 74 65 20 73 63 61 6c te -execute scal
15450 61 72 20 24 64 62 20 24 73 71 6c 20 5b 6c 69 73 ar $db $sql [lis
15460 74 20 70 61 72 61 6d 31 20 53 74 72 69 6e 67 20 t param1 String
15470 24 6e 61 6d 65 5d 5d 20 3e 20 30 0d 0a 20 20 20 $name]] > 0..
15480 20 20 20 7d 5d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }].. }....
15490 0a 20 20 20 20 70 72 6f 63 20 67 65 74 44 62 44 . proc getDbD
154a0 65 66 61 75 6c 74 50 61 67 65 53 69 7a 65 20 7b efaultPageSize {
154b0 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b } {.. if {[
154c0 63 61 74 63 68 20 7b 65 78 65 63 75 74 65 53 71 catch {executeSq
154d0 6c 20 22 50 52 41 47 4d 41 20 70 61 67 65 5f 73 l "PRAGMA page_s
154e0 69 7a 65 3b 22 20 73 63 61 6c 61 72 7d 20 72 65 ize;" scalar} re
154f0 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e sult] == 0} then
15500 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 74 75 {.. retu
15510 72 6e 20 24 72 65 73 75 6c 74 0d 0a 20 20 20 20 rn $result..
15520 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
15530 20 20 20 20 72 65 74 75 72 6e 20 30 0d 0a 20 20 return 0..
15540 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
15550 0a 20 20 20 20 70 72 6f 63 20 67 65 74 44 62 44 . proc getDbD
15560 65 66 61 75 6c 74 43 61 63 68 65 53 69 7a 65 20 efaultCacheSize
15570 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b {} {.. if {
15580 5b 63 61 74 63 68 20 7b 65 78 65 63 75 74 65 53 [catch {executeS
15590 71 6c 20 22 50 52 41 47 4d 41 20 63 61 63 68 65 ql "PRAGMA cache
155a0 5f 73 69 7a 65 3b 22 20 73 63 61 6c 61 72 7d 20 _size;" scalar}
155b0 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 result] == 0} th
155c0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 en {.. re
155d0 74 75 72 6e 20 24 72 65 73 75 6c 74 0d 0a 20 20 turn $result..
155e0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
155f0 20 20 20 20 20 20 72 65 74 75 72 6e 20 30 0d 0a return 0..
15600 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
15610 0c 0d 0a 20 20 20 20 70 72 6f 63 20 75 73 65 4c ... proc useL
15620 65 67 61 63 79 44 62 50 61 67 65 41 6e 64 43 61 egacyDbPageAndCa
15630 63 68 65 53 69 7a 65 73 20 7b 20 76 61 72 4e 61 cheSizes { varNa
15640 6d 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d me } {.. #.
15650 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 . # NOTE: R
15660 65 66 65 72 20 74 6f 20 74 68 65 20 73 70 65 63 efer to the spec
15670 69 66 69 65 64 20 76 61 72 69 61 62 6c 65 20 28 ified variable (
15680 65 2e 67 2e 20 22 64 62 22 29 20 69 6e 20 74 68 e.g. "db") in th
15690 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 e context of our
156a0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
156b0 63 61 6c 6c 65 72 2e 20 20 49 74 20 63 6f 6e 74 caller. It cont
156c0 61 69 6e 73 20 74 68 65 20 64 61 74 61 62 61 73 ains the databas
156d0 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 68 61 6e e connection han
156e0 64 6c 65 20 74 68 61 74 20 77 69 6c 6c 20 62 65 dle that will be
156f0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
15700 75 73 65 64 20 74 6f 20 65 78 65 63 75 74 65 20 used to execute
15710 71 75 65 72 69 65 73 20 75 73 65 64 20 74 6f 20 queries used to
15720 73 65 74 20 74 68 65 20 70 61 67 65 20 61 6e 64 set the page and
15730 20 63 61 63 68 65 20 73 69 7a 65 73 2e 0d 0a 20 cache sizes...
15740 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 75 70 #.. up
15750 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 64 var 1 $varName d
15760 62 0d 0a 0d 0a 20 20 20 20 20 20 73 71 6c 20 65 b.... sql e
15770 78 65 63 75 74 65 20 24 64 62 20 7b 0d 0a 20 20 xecute $db {..
15780 20 20 20 20 20 20 50 52 41 47 4d 41 20 70 61 67 PRAGMA pag
15790 65 5f 73 69 7a 65 20 3d 20 31 30 32 34 3b 0d 0a e_size = 1024;..
157a0 20 20 20 20 20 20 20 20 50 52 41 47 4d 41 20 63 PRAGMA c
157b0 61 63 68 65 5f 73 69 7a 65 20 3d 20 32 30 30 30 ache_size = 2000
157c0 3b 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 ;.. }....
157d0 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 73 74 return [list
157e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 \.. [s
157f0 71 6c 20 65 78 65 63 75 74 65 20 2d 65 78 65 63 ql execute -exec
15800 75 74 65 20 73 63 61 6c 61 72 20 24 64 62 20 22 ute scalar $db "
15810 50 52 41 47 4d 41 20 70 61 67 65 5f 73 69 7a 65 PRAGMA page_size
15820 3b 22 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ;"] \..
15830 20 5b 73 71 6c 20 65 78 65 63 75 74 65 20 2d 65 [sql execute -e
15840 78 65 63 75 74 65 20 73 63 61 6c 61 72 20 24 64 xecute scalar $d
15850 62 20 22 50 52 41 47 4d 41 20 63 61 63 68 65 5f b "PRAGMA cache_
15860 73 69 7a 65 3b 22 5d 5d 0d 0a 20 20 20 20 7d 0d size;"]].. }.
15870 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 6e 6f 72 .... proc nor
15880 6d 61 6c 69 7a 65 45 78 63 65 70 74 69 6f 6e 4d malizeExceptionM
15890 65 73 73 61 67 65 20 7b 20 76 61 6c 75 65 20 7d essage { value }
158a0 20 7b 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 {.. if {[s
158b0 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 tring length $va
158c0 6c 75 65 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 lue] == 0} then
158d0 7b 72 65 74 75 72 6e 20 24 76 61 6c 75 65 7d 0d {return $value}.
158e0 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 73 . return [s
158f0 74 72 69 6e 67 20 6d 61 70 20 5b 6c 69 73 74 20 tring map [list
15900 5c 72 5c 6e 20 22 20 3d 3d 3e 20 22 20 5c 6e 20 \r\n " ==> " \n
15910 22 20 3d 3d 3e 20 22 5d 20 24 76 61 6c 75 65 5d " ==> "] $value]
15920 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
15930 70 72 6f 63 20 65 78 74 72 61 63 74 53 79 73 74 proc extractSyst
15940 65 6d 44 61 74 61 53 51 4c 69 74 65 45 78 63 65 emDataSQLiteExce
15950 70 74 69 6f 6e 4d 65 73 73 61 67 65 20 7b 20 76 ptionMessage { v
15960 61 6c 75 65 20 7d 20 7b 0d 0a 20 20 20 20 20 20 alue } {..
15970 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
15980 20 49 66 20 74 68 65 20 73 74 72 69 6e 67 20 63 If the string c
15990 6f 6e 66 6f 72 6d 73 20 74 6f 20 66 6f 72 6d 61 onforms to forma
159a0 74 20 6f 66 20 74 68 65 20 6e 6f 72 6d 61 6c 20 t of the normal
159b0 65 78 63 65 70 74 69 6f 6e 0d 0a 20 20 20 20 20 exception..
159c0 20 23 20 20 20 20 20 20 20 65 72 72 6f 72 20 73 # error s
159d0 74 72 69 6e 67 73 2c 20 65 78 74 72 61 63 74 20 trings, extract
159e0 61 6e 64 20 72 65 74 75 72 6e 20 6f 6e 6c 79 20 and return only
159f0 74 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67 the error messag
15a00 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 e.. #
15a10 20 70 6f 72 74 69 6f 6e 20 69 74 73 65 6c 66 2e portion itself.
15a20 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
15a30 20 73 65 74 20 70 61 74 74 65 72 6e 73 20 5b 6c set patterns [l
15a40 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 7b 53 79 ist \.. {Sy
15a50 73 74 65 6d 5c 2e 44 61 74 61 5c 2e 53 51 4c 69 stem\.Data\.SQLi
15a60 74 65 5c 2e 53 51 4c 69 74 65 45 78 63 65 70 74 te\.SQLiteExcept
15a70 69 6f 6e 20 5c 28 30 78 28 3f 3a 30 7c 38 29 5b ion \(0x(?:0|8)[
15a80 30 2d 39 41 2d 46 61 2d 66 5d 7b 37 7d 5c 29 3a 0-9A-Fa-f]{7}\):
15a90 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 28 2e 2b \.. (.+
15aa0 3f 29 20 20 28 3f 3a 20 29 3f 61 74 7d 20 5c 0d ?) (?: )?at} \.
15ab0 0a 20 20 20 20 20 20 7b 53 79 73 74 65 6d 5c 2e . {System\.
15ac0 44 61 74 61 5c 2e 53 51 4c 69 74 65 5c 2e 53 51 Data\.SQLite\.SQ
15ad0 4c 69 74 65 45 78 63 65 70 74 69 6f 6e 3a 20 28 LiteException: (
15ae0 2e 2b 3f 29 20 20 28 3f 3a 20 29 3f 61 74 7d 20 .+?) (?: )?at}
15af0 5c 0d 0a 20 20 20 20 20 20 7b 45 61 67 6c 65 5c \.. {Eagle\
15b00 2e 5f 43 6f 6d 70 6f 6e 65 6e 74 73 5c 2e 50 75 ._Components\.Pu
15b10 62 6c 69 63 5c 2e 53 63 72 69 70 74 45 78 63 65 blic\.ScriptExce
15b20 70 74 69 6f 6e 3a 20 28 2e 2b 3f 29 20 20 28 3f ption: (.+?) (?
15b30 3a 20 29 3f 61 74 7d 5d 0d 0a 0d 0a 20 20 20 20 : )?at}]....
15b40 20 20 66 6f 72 65 61 63 68 20 70 61 74 74 65 72 foreach patter
15b50 6e 20 24 70 61 74 74 65 72 6e 73 20 7b 0d 0a 20 n $patterns {..
15b60 20 20 20 20 20 20 20 69 66 20 7b 5b 72 65 67 65 if {[rege
15b70 78 70 20 2d 2d 20 24 70 61 74 74 65 72 6e 20 24 xp -- $pattern $
15b80 76 61 6c 75 65 20 64 75 6d 6d 79 20 6d 65 73 73 value dummy mess
15b90 61 67 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 age]} then {..
15ba0 20 20 20 20 20 20 20 20 73 65 74 20 6d 65 73 73 set mess
15bb0 61 67 65 20 5b 73 74 72 69 6e 67 20 6d 61 70 20 age [string map
15bc0 5b 6c 69 73 74 20 5c 72 5c 6e 20 5c 6e 5d 20 5b [list \r\n \n] [
15bd0 73 74 72 69 6e 67 20 74 72 69 6d 20 24 6d 65 73 string trim $mes
15be0 73 61 67 65 5d 5d 0d 0a 20 20 20 20 20 20 20 20 sage]]..
15bf0 20 20 73 65 74 20 6c 69 6e 65 73 20 5b 73 70 6c set lines [spl
15c00 69 74 20 24 6d 65 73 73 61 67 65 20 5c 6e 5d 0d it $message \n].
15c10 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 ... if
15c20 7b 5b 6c 6c 65 6e 67 74 68 20 24 6c 69 6e 65 73 {[llength $lines
15c30 5d 20 3d 3d 20 32 7d 20 74 68 65 6e 20 7b 0d 0a ] == 2} then {..
15c40 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
15c50 5b 6c 69 6e 64 65 78 20 24 6c 69 6e 65 73 20 30 [lindex $lines 0
15c60 5d 20 65 71 20 5b 6c 69 6e 64 65 78 20 24 6c 69 ] eq [lindex $li
15c70 6e 65 73 20 31 5d 7d 20 74 68 65 6e 20 7b 0d 0a nes 1]} then {..
15c80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 re
15c90 74 75 72 6e 20 5b 6c 69 6e 64 65 78 20 24 6c 69 turn [lindex $li
15ca0 6e 65 73 20 30 5d 0d 0a 20 20 20 20 20 20 20 20 nes 0]..
15cb0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
15cc0 20 20 20 20 20 72 65 74 75 72 6e 20 5b 61 70 70 return [app
15cd0 65 6e 64 41 72 67 73 20 5b 6c 69 6e 64 65 78 20 endArgs [lindex
15ce0 24 6c 69 6e 65 73 20 30 5d 20 22 20 2d 2d 20 22 $lines 0] " -- "
15cf0 20 5b 6c 69 6e 64 65 78 20 24 6c 69 6e 65 73 20 [lindex $lines
15d00 31 5d 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 1]].. }
15d10 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 .... re
15d20 74 75 72 6e 20 24 6d 65 73 73 61 67 65 0d 0a 20 turn $message..
15d30 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
15d40 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 }.... retur
15d50 6e 20 24 76 61 6c 75 65 0d 0a 20 20 20 20 7d 0d n $value.. }.
15d60 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 74 72 69 .... proc tri
15d70 6d 53 71 6c 20 7b 20 73 71 6c 20 7d 20 7b 0d 0a mSql { sql } {..
15d80 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 72 65 return [re
15d90 67 73 75 62 20 2d 61 6c 6c 20 2d 2d 20 7b 5c 73 gsub -all -- {\s
15da0 2b 7d 20 5b 73 74 72 69 6e 67 20 74 72 69 6d 20 +} [string trim
15db0 24 73 71 6c 5d 20 22 20 22 5d 0d 0a 20 20 20 20 $sql] " "]..
15dc0 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 65 }..... proc e
15dd0 78 65 63 75 74 65 53 71 6c 20 7b 20 73 71 6c 20 xecuteSql { sql
15de0 7b 65 78 65 63 75 74 65 20 6e 6f 6e 65 7d 20 7b {execute none} {
15df0 66 6f 72 6d 61 74 20 6e 6f 6e 65 7d 20 7b 66 69 format none} {fi
15e00 6c 65 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d 0a leName ""} } {..
15e10 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
15e20 67 20 6c 65 6e 67 74 68 20 24 66 69 6c 65 4e 61 g length $fileNa
15e30 6d 65 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b me] == 0} then {
15e40 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 3a 6d 65 set fileName :me
15e50 6d 6f 72 79 3a 7d 0d 0a 20 20 20 20 20 20 73 65 mory:}.. se
15e60 74 75 70 44 62 20 24 66 69 6c 65 4e 61 6d 65 20 tupDb $fileName
15e70 22 22 20 22 22 20 22 22 20 22 22 20 22 22 20 66 "" "" "" "" "" f
15e80 61 6c 73 65 20 66 61 6c 73 65 20 66 61 6c 73 65 alse false false
15e90 20 66 61 6c 73 65 20 64 62 20 74 72 75 65 0d 0a false db true..
15ea0 0d 0a 20 20 20 20 20 20 74 72 79 20 7b 0d 0a 20 .. try {..
15eb0 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 75 return [u
15ec0 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 5c plevel 1 [list \
15ed0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 71 .. sq
15ee0 6c 20 65 78 65 63 75 74 65 20 2d 65 78 65 63 75 l execute -execu
15ef0 74 65 20 24 65 78 65 63 75 74 65 20 2d 66 6f 72 te $execute -for
15f00 6d 61 74 20 24 66 6f 72 6d 61 74 20 24 64 62 20 mat $format $db
15f10 24 73 71 6c 5d 5d 0d 0a 20 20 20 20 20 20 7d 20 $sql]].. }
15f20 66 69 6e 61 6c 6c 79 20 7b 0d 0a 20 20 20 20 20 finally {..
15f30 20 20 20 73 65 74 20 63 6f 6e 6e 65 63 74 69 6f set connectio
15f40 6e 20 5b 67 65 74 44 62 43 6f 6e 6e 65 63 74 69 n [getDbConnecti
15f50 6f 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 on].... t
15f60 72 79 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ry {..
15f70 63 6c 65 61 6e 75 70 44 62 20 24 66 69 6c 65 4e cleanupDb $fileN
15f80 61 6d 65 20 64 62 20 66 61 6c 73 65 20 66 61 6c ame db false fal
15f90 73 65 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 se false..
15fa0 20 20 7d 20 66 69 6e 61 6c 6c 79 20 7b 0d 0a 20 } finally {..
15fb0 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
15fc0 66 6c 61 67 73 20 24 63 6f 6e 6e 65 63 74 69 6f flags $connectio
15fd0 6e 20 2d 4e 6f 44 69 73 70 6f 73 65 3b 20 66 72 n -NoDispose; fr
15fe0 65 65 44 62 43 6f 6e 6e 65 63 74 69 6f 6e 0d 0a eeDbConnection..
15ff0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
16000 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
16010 20 20 70 72 6f 63 20 68 61 73 4e 6f 46 6c 61 67 proc hasNoFlag
16020 73 20 7b 20 76 61 72 4e 61 6d 65 20 6e 6f 6e 65 s { varName none
16030 20 7d 20 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 } {.. upva
16040 72 20 31 20 24 76 61 72 4e 61 6d 65 20 66 6c 61 r 1 $varName fla
16050 67 73 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b gs.... if {
16060 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 66 6c ![info exists fl
16070 61 67 73 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ags]} then {..
16080 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 return tru
16090 65 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 e.. }....
160a0 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
160b0 6c 65 6e 67 74 68 20 24 66 6c 61 67 73 5d 20 3d length $flags] =
160c0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
160d0 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 return true
160e0 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
160f0 20 20 20 69 66 20 7b 24 6e 6f 6e 65 20 26 26 20 if {$none &&
16100 24 66 6c 61 67 73 20 65 71 20 22 4e 6f 6e 65 22 $flags eq "None"
16110 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
16120 20 20 72 65 74 75 72 6e 20 74 72 75 65 0d 0a 20 return true..
16130 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
16140 72 65 74 75 72 6e 20 66 61 6c 73 65 0d 0a 20 20 return false..
16150 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
16160 20 67 65 74 43 6f 6e 6e 65 63 74 69 6f 6e 46 6c getConnectionFl
16170 61 67 73 20 7b 20 66 69 6c 65 4e 61 6d 65 20 66 ags { fileName f
16180 6c 61 67 73 20 7b 71 75 69 65 74 20 66 61 6c 73 lags {quiet fals
16190 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d e} } {.. #.
161a0 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 . # NOTE: F
161b0 69 67 75 72 65 20 6f 75 74 20 77 68 69 63 68 20 igure out which
161c0 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 6e 61 database file na
161d0 6d 65 20 6f 72 20 63 6f 6e 6e 65 63 74 69 6f 6e me or connection
161e0 20 73 74 72 69 6e 67 20 74 68 65 73 65 0d 0a 20 string these..
161f0 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e # con
16200 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 77 69 nection flags wi
16210 6c 6c 20 61 63 74 75 61 6c 6c 79 20 61 70 70 6c ll actually appl
16220 79 20 74 6f 2e 20 20 54 68 69 73 20 69 73 20 6e y to. This is n
16230 6f 74 20 6e 65 63 65 73 73 61 72 79 0d 0a 20 20 ot necessary..
16240 20 20 20 20 23 20 20 20 20 20 20 20 69 6e 20 71 # in q
16250 75 69 65 74 20 6d 6f 64 65 20 62 65 63 61 75 73 uiet mode becaus
16260 65 20 74 68 69 73 20 69 6e 66 6f 72 6d 61 74 69 e this informati
16270 6f 6e 20 69 73 20 6f 6e 6c 79 20 75 73 65 64 20 on is only used
16280 66 6f 72 20 6c 6f 67 67 69 6e 67 0d 0a 20 20 20 for logging..
16290 20 20 20 23 20 20 20 20 20 20 20 61 6e 64 20 72 # and r
162a0 65 70 6f 72 74 69 6e 67 20 70 75 72 70 6f 73 65 eporting purpose
162b0 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 s... #..
162c0 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
162d0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
162e0 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
162f0 74 68 20 24 66 69 6c 65 4e 61 6d 65 5d 20 3e 20 th $fileName] >
16300 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
16310 20 20 20 20 20 73 65 74 20 64 61 74 61 62 61 73 set databas
16320 65 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 66 e [appendArgs "f
16330 69 6c 65 20 6e 61 6d 65 20 5c 22 22 20 24 66 69 ile name \"" $fi
16340 6c 65 4e 61 6d 65 20 5c 22 5d 0d 0a 20 20 20 20 leName \"]..
16350 20 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 5b 69 } elseif {[i
16360 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 64 61 74 nfo exists ::dat
16370 61 53 6f 75 72 63 65 5d 20 26 26 20 5c 0d 0a 20 aSource] && \..
16380 20 20 20 20 20 20 20 20 20 20 20 21 5b 61 72 72 ![arr
16390 61 79 20 65 78 69 73 74 73 20 3a 3a 64 61 74 61 ay exists ::data
163a0 53 6f 75 72 63 65 5d 7d 20 74 68 65 6e 20 7b 0d Source]} then {.
163b0 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 64 . set d
163c0 61 74 61 62 61 73 65 20 5b 61 70 70 65 6e 64 41 atabase [appendA
163d0 72 67 73 20 22 64 61 74 61 20 73 6f 75 72 63 65 rgs "data source
163e0 20 5c 22 22 20 24 3a 3a 64 61 74 61 53 6f 75 72 \"" $::dataSour
163f0 63 65 20 5c 22 5d 0d 0a 20 20 20 20 20 20 20 20 ce \"]..
16400 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
16410 20 20 20 20 73 65 74 20 64 61 74 61 62 61 73 65 set database
16420 20 3c 75 6e 6b 6e 6f 77 6e 3e 0d 0a 20 20 20 20 <unknown>..
16430 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
16440 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
16450 20 23 20 4e 4f 54 45 3a 20 45 76 65 6e 20 74 68 # NOTE: Even th
16460 6f 75 67 68 20 74 68 65 72 65 20 69 73 20 6f 6e ough there is on
16470 6c 79 20 6f 6e 65 20 73 6f 75 72 63 65 20 6f 66 ly one source of
16480 20 66 6c 61 67 73 20 73 6f 20 66 61 72 2c 20 74 flags so far, t
16490 68 65 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 hey.. #
164a0 20 20 20 6d 75 73 74 20 62 65 20 63 6f 6d 62 69 must be combi
164b0 6e 65 64 20 75 73 69 6e 67 20 74 68 65 20 63 6f ned using the co
164c0 72 72 65 63 74 20 73 79 6e 74 61 78 20 66 6f 72 rrect syntax for
164d0 20 65 6e 75 6d 65 72 61 74 65 64 0d 0a 20 20 20 enumerated..
164e0 20 20 20 23 20 20 20 20 20 20 20 66 6c 61 67 20 # flag
164f0 76 61 6c 75 65 73 20 66 6f 72 20 74 68 65 20 2e values for the .
16500 4e 45 54 20 46 72 61 6d 65 77 6f 72 6b 2e 0d 0a NET Framework...
16510 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 73 #.. s
16520 65 74 20 66 6c 61 67 73 20 5b 63 6f 6d 62 69 6e et flags [combin
16530 65 46 6c 61 67 73 20 24 66 6c 61 67 73 20 22 22 eFlags $flags ""
16540 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ].... #..
16550 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 # NOTE: Show
16560 20 28 61 6e 64 20 6c 6f 67 29 20 74 68 65 20 6c (and log) the l
16570 6f 63 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 ocal connection
16580 66 6c 61 67 73 20 61 6e 64 20 74 68 65 20 61 73 flags and the as
16590 73 6f 63 69 61 74 65 64 0d 0a 20 20 20 20 20 20 sociated..
165a0 23 20 20 20 20 20 20 20 64 61 74 61 20 73 6f 75 # data sou
165b0 72 63 65 20 6f 72 20 66 69 6c 65 20 6e 61 6d 65 rce or file name
165c0 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
165d0 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
165e0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 hen {.. i
165f0 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
16600 20 3a 3a 6e 6f 28 65 6d 69 74 4c 6f 63 61 6c 46 ::no(emitLocalF
16610 6c 61 67 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 lags)] && \..
16620 20 20 20 20 20 20 20 20 20 28 21 5b 69 6e 66 6f (![info
16630 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 exists ::no(emi
16640 74 4c 6f 63 61 6c 46 6c 61 67 73 49 66 4e 6f 6e tLocalFlagsIfNon
16650 65 29 5d 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 e)] || \..
16660 20 20 20 20 20 20 20 21 5b 68 61 73 4e 6f 46 6c ![hasNoFl
16670 61 67 73 20 66 6c 61 67 73 20 66 61 6c 73 65 5d ags flags false]
16680 29 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 )} then {..
16690 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
166a0 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
166b0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
166c0 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6c 6f "---- lo
166d0 63 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 cal connection f
166e0 6c 61 67 73 20 66 6f 72 20 22 20 24 64 61 74 61 lags for " $data
166f0 62 61 73 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 base \..
16700 20 20 20 20 20 20 22 20 61 72 65 3a 20 22 20 5b " are: " [
16710 65 78 70 72 20 7b 21 5b 68 61 73 4e 6f 46 6c 61 expr {![hasNoFla
16720 67 73 20 66 6c 61 67 73 20 66 61 6c 73 65 5d 20 gs flags false]
16730 3f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ? \..
16740 20 20 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c [appendArgs \
16750 22 20 24 66 6c 61 67 73 20 5c 22 5d 20 3a 20 22 " $flags \"] : "
16760 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c 6e 5d 0d 0a 20 <none>"}] \n]..
16770 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
16780 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 }.... #..
16790 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 # NOTE: Show
167a0 20 28 61 6e 64 20 6c 6f 67 29 20 74 68 65 20 73 (and log) the s
167b0 68 61 72 65 64 20 63 6f 6e 6e 65 63 74 69 6f 6e hared connection
167c0 20 66 6c 61 67 73 2e 0d 0a 20 20 20 20 20 20 23 flags... #
167d0 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 .. if {!$qu
167e0 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
167f0 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
16800 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a {.. obj
16810 65 63 74 20 69 6e 76 6f 6b 65 20 53 79 73 74 65 ect invoke Syste
16820 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 m.Data.SQLite.SQ
16830 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 20 53 LiteConnection S
16840 68 61 72 65 64 46 6c 61 67 73 0d 0a 20 20 20 20 haredFlags..
16850 20 20 20 20 7d 20 73 68 61 72 65 64 46 6c 61 67 } sharedFlag
16860 73 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d s] == 0} then {.
16870 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 . if {!
16880 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
16890 6f 28 65 6d 69 74 53 68 61 72 65 64 46 6c 61 67 o(emitSharedFlag
168a0 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 s)] && \..
168b0 20 20 20 20 20 20 20 20 28 21 5b 69 6e 66 6f 20 (![info
168c0 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 exists ::no(emit
168d0 53 68 61 72 65 64 46 6c 61 67 73 49 66 4e 6f 6e SharedFlagsIfNon
168e0 65 29 5d 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 e)] || \..
168f0 20 20 20 20 20 20 20 20 20 21 5b 68 61 73 4e 6f ![hasNo
16900 46 6c 61 67 73 20 73 68 61 72 65 64 46 6c 61 67 Flags sharedFlag
16910 73 20 74 72 75 65 5d 29 7d 20 74 68 65 6e 20 7b s true])} then {
16920 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
16930 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
16940 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
16950 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
16960 20 20 20 22 2d 2d 2d 2d 20 73 68 61 72 65 64 20 "---- shared
16970 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 connection flags
16980 20 66 6f 72 20 22 20 24 64 61 74 61 62 61 73 65 for " $database
16990 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
169a0 20 20 20 20 22 20 61 72 65 3a 20 22 20 5b 65 78 " are: " [ex
169b0 70 72 20 7b 21 5b 68 61 73 4e 6f 46 6c 61 67 73 pr {![hasNoFlags
169c0 20 73 68 61 72 65 64 46 6c 61 67 73 20 74 72 75 sharedFlags tru
169d0 65 5d 20 3f 20 5c 0d 0a 20 20 20 20 20 20 20 20 e] ? \..
169e0 20 20 20 20 20 20 20 20 5b 61 70 70 65 6e 64 41 [appendA
169f0 72 67 73 20 5c 22 20 24 73 68 61 72 65 64 46 6c rgs \" $sharedFl
16a00 61 67 73 20 5c 22 5d 20 3a 20 22 3c 6e 6f 6e 65 ags \"] : "<none
16a10 3e 22 7d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 >"}] \n]..
16a20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
16a30 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
16a40 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
16a50 69 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 53 68 ists ::no(emitSh
16a60 61 72 65 64 46 6c 61 67 73 29 5d 20 26 26 20 5c aredFlags)] && \
16a70 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
16a80 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
16a90 6e 6f 28 65 6d 69 74 53 68 61 72 65 64 46 6c 61 no(emitSharedFla
16aa0 67 73 49 66 55 6e 61 76 61 69 6c 61 62 6c 65 29 gsIfUnavailable)
16ab0 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
16ac0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
16ad0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
16ae0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
16af0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
16b00 2d 20 73 68 61 72 65 64 20 63 6f 6e 6e 65 63 74 - shared connect
16b10 69 6f 6e 20 66 6c 61 67 73 20 66 6f 72 20 22 20 ion flags for "
16b20 24 64 61 74 61 62 61 73 65 20 5c 0d 0a 20 20 20 $database \..
16b30 20 20 20 20 20 20 20 20 20 20 20 20 20 22 20 61 " a
16b40 72 65 3a 20 3c 75 6e 61 76 61 69 6c 61 62 6c 65 re: <unavailable
16b50 3e 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 >\n"]..
16b60 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 }.. }..
16b70 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
16b80 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
16b90 20 53 68 6f 77 20 28 61 6e 64 20 6c 6f 67 29 20 Show (and log)
16ba0 74 68 65 20 64 65 74 65 63 74 65 64 20 67 6c 6f the detected glo
16bb0 62 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 bal connection f
16bc0 6c 61 67 73 2c 20 69 66 20 61 6e 79 2e 0d 0a 20 lags, if any...
16bd0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
16be0 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
16bf0 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 {.. if {!
16c00 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
16c10 6f 28 65 6d 69 74 47 6c 6f 62 61 6c 46 6c 61 67 o(emitGlobalFlag
16c20 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 s)] && \..
16c30 20 20 20 20 20 20 28 21 5b 69 6e 66 6f 20 65 78 (![info ex
16c40 69 73 74 73 20 3a 3a 6e 6f 28 65 6d 69 74 47 6c ists ::no(emitGl
16c50 6f 62 61 6c 46 6c 61 67 73 49 66 4e 6f 6e 65 29 obalFlagsIfNone)
16c60 5d 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 ] || \..
16c70 20 20 20 20 20 21 5b 68 61 73 4e 6f 46 6c 61 67 ![hasNoFlag
16c80 73 20 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 s ::connection_f
16c90 6c 61 67 73 20 66 61 6c 73 65 5d 29 7d 20 74 68 lags false])} th
16ca0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
16cb0 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
16cc0 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
16cd0 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
16ce0 20 20 20 22 2d 2d 2d 2d 20 67 6c 6f 62 61 6c 20 "---- global
16cf0 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 connection flags
16d00 20 61 72 65 3a 20 22 20 5c 0d 0a 20 20 20 20 20 are: " \..
16d10 20 20 20 20 20 20 20 20 20 5b 65 78 70 72 20 7b [expr {
16d20 21 5b 68 61 73 4e 6f 46 6c 61 67 73 20 3a 3a 63 ![hasNoFlags ::c
16d30 6f 6e 6e 65 63 74 69 6f 6e 5f 66 6c 61 67 73 20 onnection_flags
16d40 66 61 6c 73 65 5d 20 3f 20 5c 0d 0a 20 20 20 20 false] ? \..
16d50 20 20 20 20 20 20 20 20 20 20 5b 61 70 70 65 6e [appen
16d60 64 41 72 67 73 20 5c 22 20 24 3a 3a 63 6f 6e 6e dArgs \" $::conn
16d70 65 63 74 69 6f 6e 5f 66 6c 61 67 73 20 5c 22 5d ection_flags \"]
16d80 20 3a 20 22 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c 6e : "<none>"}] \n
16d90 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 ].. }..
16da0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 }.... #
16db0 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 .. # NOTE:
16dc0 49 66 20 74 68 65 72 65 20 61 72 65 20 61 6e 79 If there are any
16dd0 20 67 6c 6f 62 61 6c 20 28 70 65 72 20 74 65 73 global (per tes
16de0 74 20 72 75 6e 29 20 63 6f 6e 6e 65 63 74 69 6f t run) connectio
16df0 6e 20 66 6c 61 67 73 20 63 75 72 72 65 6e 74 6c n flags currentl
16e00 79 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 y.. #
16e10 20 73 65 74 2c 20 75 73 65 20 74 68 65 6d 20 6e set, use them n
16e20 6f 77 20 28 69 2e 65 2e 20 62 79 20 63 6f 6d 62 ow (i.e. by comb
16e30 69 6e 69 6e 67 20 74 68 65 6d 20 77 69 74 68 20 ining them with
16e40 74 68 65 20 6f 6e 65 73 20 66 6f 72 20 74 68 69 the ones for thi
16e50 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 s.. #
16e60 20 63 6f 6e 6e 65 63 74 69 6f 6e 29 2e 0d 0a 20 connection)...
16e70 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
16e80 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {[info exists :
16e90 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5f 66 6c 61 67 :connection_flag
16ea0 73 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 s]} then {..
16eb0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
16ec0 20 4e 4f 54 45 3a 20 43 6f 6d 62 69 6e 65 20 61 NOTE: Combine a
16ed0 6e 64 2f 6f 72 20 72 65 70 6c 61 63 65 20 74 68 nd/or replace th
16ee0 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 e connection fla
16ef0 67 73 20 61 6e 64 20 74 68 65 6e 20 73 68 6f 77 gs and then show
16f00 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 23 20 the.. #
16f10 20 20 20 20 20 20 6e 65 77 20 76 61 6c 75 65 2e new value.
16f20 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
16f30 20 20 20 20 20 73 65 74 20 66 6c 61 67 73 20 5b set flags [
16f40 63 6f 6d 62 69 6e 65 46 6c 61 67 73 20 24 66 6c combineFlags $fl
16f50 61 67 73 20 24 3a 3a 63 6f 6e 6e 65 63 74 69 6f ags $::connectio
16f60 6e 5f 66 6c 61 67 73 5d 0d 0a 0d 0a 20 20 20 20 n_flags]....
16f70 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
16f80 20 4e 4f 54 45 3a 20 53 68 6f 77 20 28 61 6e 64 NOTE: Show (and
16f90 20 6c 6f 67 29 20 74 68 65 20 6e 65 77 20 65 66 log) the new ef
16fa0 66 65 63 74 69 76 65 20 63 6f 6e 6e 65 63 74 69 fective connecti
16fb0 6f 6e 20 66 6c 61 67 73 2e 0d 0a 20 20 20 20 20 on flags...
16fc0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 #.. if
16fd0 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
16fe0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 {.. if
16ff0 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
17000 3a 6e 6f 28 65 6d 69 74 43 6f 6d 62 69 6e 65 64 :no(emitCombined
17010 46 6c 61 67 73 29 5d 20 26 26 20 5c 0d 0a 20 20 Flags)] && \..
17020 20 20 20 20 20 20 20 20 20 20 20 20 28 21 5b 69 (![i
17030 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
17040 65 6d 69 74 43 6f 6d 62 69 6e 65 64 46 6c 61 67 emitCombinedFlag
17050 73 49 66 4e 6f 6e 65 29 5d 20 7c 7c 20 5c 0d 0a sIfNone)] || \..
17060 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 21 !
17070 5b 68 61 73 4e 6f 46 6c 61 67 73 20 66 6c 61 67 [hasNoFlags flag
17080 73 20 66 61 6c 73 65 5d 29 7d 20 74 68 65 6e 20 s false])} then
17090 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
170a0 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
170b0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
170c0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
170d0 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 6d 62 69 6e "---- combin
170e0 65 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c ed connection fl
170f0 61 67 73 20 66 6f 72 20 22 20 24 64 61 74 61 62 ags for " $datab
17100 61 73 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ase \..
17110 20 20 20 20 20 20 20 22 20 61 72 65 3a 20 22 20 " are: "
17120 5b 65 78 70 72 20 7b 21 5b 68 61 73 4e 6f 46 6c [expr {![hasNoFl
17130 61 67 73 20 66 6c 61 67 73 20 66 61 6c 73 65 5d ags flags false]
17140 20 3f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ? \..
17150 20 20 20 20 20 20 5b 61 70 70 65 6e 64 41 72 67 [appendArg
17160 73 20 5c 22 20 24 66 6c 61 67 73 20 5c 22 5d 20 s \" $flags \"]
17170 3a 20 22 3c 6e 6f 6e 65 3e 22 7d 5d 20 5c 6e 5d : "<none>"}] \n]
17180 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
17190 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
171a0 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 }.... retur
171b0 6e 20 24 66 6c 61 67 73 0d 0a 20 20 20 20 7d 0d n $flags.. }.
171c0 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 65 74 .... proc get
171d0 46 6c 61 67 73 50 72 6f 70 65 72 74 79 20 7b 20 FlagsProperty {
171e0 7b 66 6c 61 67 73 20 22 22 7d 20 7b 71 75 69 65 {flags ""} {quie
171f0 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 t false} } {..
17200 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
17210 4f 54 45 3a 20 44 65 74 65 72 6d 69 6e 65 20 77 OTE: Determine w
17220 68 61 74 20 74 68 65 20 63 6f 6d 62 69 6e 65 64 hat the combined
17230 20 28 67 6c 6f 62 61 6c 20 61 6e 64 20 6c 6f 63 (global and loc
17240 61 6c 29 20 63 6f 6e 6e 65 63 74 69 6f 6e 0d 0a al) connection..
17250 20 20 20 20 20 20 23 20 20 20 20 20 20 20 66 6c # fl
17260 61 67 73 20 73 68 6f 75 6c 64 20 62 65 2c 20 70 ags should be, p
17270 6f 73 73 69 62 6c 79 20 71 75 69 65 74 6c 79 2e ossibly quietly.
17280 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
17290 20 73 65 74 20 66 6c 61 67 73 20 5b 67 65 74 43 set flags [getC
172a0 6f 6e 6e 65 63 74 69 6f 6e 46 6c 61 67 73 20 22 onnectionFlags "
172b0 22 20 24 66 6c 61 67 73 20 24 71 75 69 65 74 5d " $flags $quiet]
172c0 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
172d0 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 6e 6f # NOTE: If no
172e0 20 67 6c 6f 62 61 6c 20 6f 72 20 6c 6f 63 61 6c global or local
172f0 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 connection flag
17300 73 20 77 65 72 65 20 73 70 65 63 69 66 69 65 64 s were specified
17310 2c 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 , the.. #
17320 20 20 20 20 20 64 65 66 61 75 6c 74 20 63 6f 6e default con
17330 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 73 68 nection flags sh
17340 6f 75 6c 64 20 62 65 20 75 73 65 64 3b 20 74 68 ould be used; th
17350 65 72 65 66 6f 72 65 2c 20 72 65 74 75 72 6e 0d erefore, return.
17360 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 . # a
17370 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 20 69 n empty string i
17380 6e 20 74 68 61 74 20 63 61 73 65 2e 0d 0a 20 20 n that case...
17390 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
173a0 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
173b0 24 66 6c 61 67 73 5d 20 3d 3d 20 30 7d 20 74 68 $flags] == 0} th
173c0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 72 65 en {.. re
173d0 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 20 20 7d turn "".. }
173e0 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
173f0 20 20 20 23 20 4e 4f 54 45 3a 20 49 6e 20 6f 72 # NOTE: In or
17400 64 65 72 20 74 6f 20 63 68 65 63 6b 20 69 66 20 der to check if
17410 74 68 65 20 64 65 66 61 75 6c 74 20 63 6f 6e 6e the default conn
17420 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 61 72 65 ection flags are
17430 20 62 65 69 6e 67 20 75 73 65 64 0d 0a 20 20 20 being used..
17440 20 20 20 23 20 20 20 20 20 20 20 69 74 20 69 73 # it is
17450 20 6e 65 63 65 73 73 61 72 79 20 74 6f 20 61 74 necessary to at
17460 74 65 6d 70 74 20 61 20 63 6f 6e 76 65 72 73 69 tempt a conversi
17470 6f 6e 20 74 6f 20 74 68 65 20 61 63 74 75 61 6c on to the actual
17480 20 65 6e 75 6d 65 72 61 74 65 64 0d 0a 20 20 20 enumerated..
17490 20 20 20 23 20 20 20 20 20 20 20 74 79 70 65 2e # type.
174a0 20 20 46 61 69 6c 69 6e 67 20 74 68 61 74 2c 20 Failing that,
174b0 74 68 65 20 63 68 65 63 6b 20 61 67 61 69 6e 73 the check agains
174c0 74 20 74 68 65 20 64 65 66 61 75 6c 74 20 76 61 t the default va
174d0 6c 75 65 20 77 69 6c 6c 20 62 65 0d 0a 20 20 20 lue will be..
174e0 20 20 20 23 20 20 20 20 20 20 20 73 6b 69 70 70 # skipp
174f0 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ed... #..
17500 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
17510 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 65 72 .. set er
17520 72 6f 72 20 6e 75 6c 6c 3b 20 23 20 49 47 4e 4f ror null; # IGNO
17530 52 45 44 0d 0a 0d 0a 20 20 20 20 20 20 20 20 6f RED.... o
17540 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 55 74 69 bject invoke Uti
17550 6c 69 74 79 20 54 72 79 50 61 72 73 65 46 6c 61 lity TryParseFla
17560 67 73 45 6e 75 6d 20 22 22 20 5c 0d 0a 20 20 20 gsEnum "" \..
17570 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e System.
17580 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 Data.SQLite.SQLi
17590 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 46 6c 61 67 teConnectionFlag
175a0 73 20 22 22 20 24 66 6c 61 67 73 20 6e 75 6c 6c s "" $flags null
175b0 20 74 72 75 65 20 5c 0d 0a 20 20 20 20 20 20 20 true \..
175c0 20 20 20 20 20 74 72 75 65 20 74 72 75 65 20 65 true true e
175d0 72 72 6f 72 0d 0a 20 20 20 20 20 20 7d 20 76 61 rror.. } va
175e0 6c 75 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 lue]} then {..
175f0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
17600 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 # NOTE: Attempt
17610 69 6e 67 20 74 6f 20 70 61 72 73 65 20 74 68 65 ing to parse the
17620 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 connection flag
17630 73 20 63 61 75 73 65 64 20 61 20 73 63 72 69 70 s caused a scrip
17640 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 t.. #
17650 20 20 20 65 72 72 6f 72 2e 20 20 45 6d 69 74 20 error. Emit
17660 61 20 77 61 72 6e 69 6e 67 20 74 6f 20 74 68 65 a warning to the
17670 20 74 65 73 74 20 6c 6f 67 20 66 69 6c 65 20 61 test log file a
17680 6e 64 20 63 6f 6e 74 69 6e 75 65 0d 0a 20 20 20 nd continue..
17690 20 20 20 20 20 23 20 20 20 20 20 20 20 75 73 69 # usi
176a0 6e 67 20 61 6e 20 65 6d 74 70 79 20 73 74 72 69 ng an emtpy stri
176b0 6e 67 20 69 6e 73 74 65 61 64 2e 0d 0a 20 20 20 ng instead...
176c0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
176d0 74 6c 6f 67 20 5b 61 70 70 65 6e 64 41 72 67 73 tlog [appendArgs
176e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
176f0 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 "==== WARNING: f
17700 61 69 6c 65 64 20 74 6f 20 70 61 72 73 65 20 63 ailed to parse c
17710 6f 6e 6e 65 63 74 69 6f 6e 20 66 6c 61 67 73 2c onnection flags,
17720 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 error: " \..
17730 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 76 \n\t $v
17740 61 6c 75 65 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 alue \n]....
17750 20 20 20 20 73 65 74 20 76 61 6c 75 65 20 22 22 set value ""
17760 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
17770 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
17780 54 45 3a 20 49 66 20 74 68 65 20 63 6f 6d 62 69 TE: If the combi
17790 6e 65 64 20 66 6c 61 67 73 20 73 74 72 69 6e 67 ned flags string
177a0 20 63 6f 75 6c 64 20 6e 6f 74 20 61 63 74 75 61 could not actua
177b0 6c 6c 79 20 62 65 20 63 6f 6e 76 65 72 74 65 64 lly be converted
177c0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
177d0 74 6f 20 74 68 65 20 65 6e 75 6d 65 72 61 74 65 to the enumerate
177e0 64 20 74 79 70 65 20 69 74 20 69 73 20 74 68 65 d type it is the
177f0 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 2c 20 default value,
17800 74 68 65 6e 20 6a 75 73 74 20 75 73 65 0d 0a 20 then just use..
17810 20 20 20 20 20 23 20 20 20 20 20 20 20 69 74 20 # it
17820 76 65 72 62 61 74 69 6d 3b 20 6f 74 68 65 72 77 verbatim; otherw
17830 69 73 65 2c 20 6a 75 73 74 20 72 65 74 75 72 6e ise, just return
17840 20 61 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 an empty string
17850 2e 20 20 49 6e 20 74 68 61 74 0d 0a 20 20 20 20 . In that..
17860 20 20 23 20 20 20 20 20 20 20 63 61 73 65 2c 20 # case,
17870 74 68 65 20 64 65 66 61 75 6c 74 20 63 6f 6e 6e the default conn
17880 65 63 74 69 6f 6e 20 66 6c 61 67 73 20 77 69 6c ection flags wil
17890 6c 20 62 65 20 75 73 65 64 2e 0d 0a 20 20 20 20 l be used...
178a0 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
178b0 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 string length $v
178c0 61 6c 75 65 5d 20 3d 3d 20 30 20 7c 7c 20 24 76 alue] == 0 || $v
178d0 61 6c 75 65 20 6e 65 20 22 44 65 66 61 75 6c 74 alue ne "Default
178e0 22 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 "} then {..
178f0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
17900 57 41 52 4e 49 4e 47 3a 20 54 68 69 73 20 72 65 WARNING: This re
17910 74 75 72 6e 73 20 74 68 65 20 73 74 72 69 6e 67 turns the string
17920 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 63 6f value of the co
17930 6d 62 69 6e 65 64 20 66 6c 61 67 73 2c 20 6e 6f mbined flags, no
17940 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 t.. #
17950 20 20 20 20 20 20 74 68 65 20 65 6e 75 6d 65 72 the enumer
17960 61 74 65 64 20 76 61 6c 75 65 2e 20 20 54 68 69 ated value. Thi
17970 73 20 69 73 20 62 79 20 64 65 73 69 67 6e 20 61 s is by design a
17980 6e 64 20 73 68 6f 75 6c 64 20 6e 6f 74 0d 0a 20 nd should not..
17990 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 #
179a0 20 20 62 65 20 63 68 61 6e 67 65 64 20 77 69 74 be changed wit
179b0 68 6f 75 74 20 63 61 72 65 66 75 6c 20 63 6f 6e hout careful con
179c0 73 69 64 65 72 61 74 69 6f 6e 20 28 65 2e 67 2e sideration (e.g.
179d0 20 69 74 20 77 6f 75 6c 64 0d 0a 20 20 20 20 20 it would..
179e0 20 20 20 23 20 20 20 20 20 20 20 20 20 20 70 72 # pr
179f0 65 76 65 6e 74 20 74 68 65 20 53 51 4c 69 74 65 event the SQLite
17a00 43 6f 6e 6e 65 63 74 69 6f 6e 20 63 6c 61 73 73 Connection class
17a10 20 66 72 6f 6d 20 61 6c 6c 6f 77 69 6e 67 20 69 from allowing i
17a20 6e 76 61 6c 69 64 0d 0a 20 20 20 20 20 20 20 20 nvalid..
17a30 23 20 20 20 20 20 20 20 20 20 20 5b 22 6d 61 67 # ["mag
17a40 69 63 61 6c 22 5d 20 6d 65 74 61 2d 66 6c 61 67 ical"] meta-flag
17a50 73 29 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a s)... #..
17a60 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b return [
17a70 61 70 70 65 6e 64 41 72 67 73 20 22 46 6c 61 67 appendArgs "Flag
17a80 73 3d 22 20 24 66 6c 61 67 73 20 5c 3b 5d 0d 0a s=" $flags \;]..
17a90 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
17aa0 20 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 return ""..
17ab0 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 67 }..... proc g
17ac0 65 74 54 65 73 74 50 72 6f 70 65 72 74 69 65 73 etTestProperties
17ad0 20 7b 20 7b 66 6c 61 67 73 20 22 22 7d 20 7b 71 { {flags ""} {q
17ae0 75 69 65 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d uiet false} } {.
17af0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
17b00 23 20 4e 4f 54 45 3a 20 53 74 61 72 74 20 77 69 # NOTE: Start wi
17b10 74 68 20 22 46 6c 61 67 73 22 20 70 72 6f 70 65 th "Flags" prope
17b20 72 74 79 20 66 6f 72 20 74 68 65 20 6e 65 77 20 rty for the new
17b30 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 69 66 20 61 connection, if a
17b40 6e 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ny... #..
17b50 20 20 20 20 73 65 74 20 72 65 73 75 6c 74 20 5b set result [
17b60 67 65 74 46 6c 61 67 73 50 72 6f 70 65 72 74 79 getFlagsProperty
17b70 20 24 66 6c 61 67 73 20 24 71 75 69 65 74 5d 0d $flags $quiet].
17b80 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
17b90 20 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 74 68 # NOTE: Add th
17ba0 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 63 75 e name of the cu
17bb0 72 72 65 6e 74 20 74 65 73 74 20 66 69 6c 65 2c rrent test file,
17bc0 20 69 66 20 61 76 61 69 6c 61 62 6c 65 2e 20 20 if available.
17bd0 54 68 69 73 20 69 73 0d 0a 20 20 20 20 20 20 23 This is.. #
17be0 20 20 20 20 20 20 20 6f 6e 6c 79 20 75 73 65 64 only used
17bf0 20 66 6f 72 20 64 65 62 75 67 67 69 6e 67 2e 0d for debugging..
17c00 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
17c10 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 if {[info exists
17c20 20 3a 3a 74 65 73 74 5f 66 69 6c 65 5d 7d 20 74 ::test_file]} t
17c30 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 hen {.. a
17c40 70 70 65 6e 64 20 72 65 73 75 6c 74 20 54 65 73 ppend result Tes
17c50 74 46 69 6c 65 3d 20 24 3a 3a 74 65 73 74 5f 66 tFile= $::test_f
17c60 69 6c 65 20 5c 3b 0d 0a 20 20 20 20 20 20 7d 0d ile \;.. }.
17c70 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
17c80 20 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 74 68 # NOTE: Add th
17c90 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 63 75 e name of the cu
17ca0 72 72 65 6e 74 20 74 65 73 74 2c 20 69 66 20 61 rrent test, if a
17cb0 76 61 69 6c 61 62 6c 65 2e 20 20 54 68 69 73 20 vailable. This
17cc0 69 73 20 6f 6e 6c 79 0d 0a 20 20 20 20 20 20 23 is only.. #
17cd0 20 20 20 20 20 20 20 75 73 65 64 20 66 6f 72 20 used for
17ce0 64 65 62 75 67 67 69 6e 67 2e 0d 0a 20 20 20 20 debugging...
17cf0 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b #.. if {[
17d00 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 65 61 info exists ::ea
17d10 67 6c 65 5f 74 65 73 74 73 28 43 75 72 72 65 6e gle_tests(Curren
17d20 74 4e 61 6d 65 29 5d 7d 20 74 68 65 6e 20 7b 0d tName)]} then {.
17d30 0a 20 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 . append
17d40 72 65 73 75 6c 74 20 54 65 73 74 4e 61 6d 65 3d result TestName=
17d50 20 24 3a 3a 65 61 67 6c 65 5f 74 65 73 74 73 28 $::eagle_tests(
17d60 43 75 72 72 65 6e 74 4e 61 6d 65 29 20 5c 3b 0d CurrentName) \;.
17d70 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
17d80 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 6c 74 return $result
17d90 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
17da0 70 72 6f 63 20 65 6e 61 62 6c 65 53 68 61 72 65 proc enableShare
17db0 64 43 61 63 68 65 20 7b 20 63 68 61 6e 6e 65 6c dCache { channel
17dc0 20 65 6e 61 62 6c 65 20 7b 71 75 69 65 74 20 66 enable {quiet f
17dd0 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 alse} } {..
17de0 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
17df0 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
17e00 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e voke -flags +Non
17e10 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 Public \..
17e20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 System.Dat
17e30 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e a.SQLite.UnsafeN
17e40 61 74 69 76 65 4d 65 74 68 6f 64 73 20 5c 0d 0a ativeMethods \..
17e50 20 20 20 20 20 20 20 20 20 20 20 20 73 71 6c 69 sqli
17e60 74 65 33 5f 65 6e 61 62 6c 65 5f 73 68 61 72 65 te3_enable_share
17e70 64 5f 63 61 63 68 65 20 5b 65 78 70 72 20 69 6e d_cache [expr in
17e80 74 28 24 65 6e 61 62 6c 65 29 5d 0d 0a 20 20 20 t($enable)]..
17e90 20 20 20 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 } result] ==
17ea0 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
17eb0 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
17ec0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
17ed0 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
17ee0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
17ef0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
17f00 2d 2d 2d 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 --- call sqlite3
17f10 5f 65 6e 61 62 6c 65 5f 73 68 61 72 65 64 5f 63 _enable_shared_c
17f20 61 63 68 65 28 22 20 24 65 6e 61 62 6c 65 20 5c ache(" $enable \
17f30 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
17f40 22 29 2e 2e 2e 20 6f 6b 3a 20 22 20 24 72 65 73 ")... ok: " $res
17f50 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ult \n]..
17f60 20 7d 0d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 }.. } else
17f70 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
17f80 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
17f90 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
17fa0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
17fb0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
17fc0 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 61 6c "---- cal
17fd0 6c 20 73 71 6c 69 74 65 33 5f 65 6e 61 62 6c 65 l sqlite3_enable
17fe0 5f 73 68 61 72 65 64 5f 63 61 63 68 65 28 22 20 _shared_cache("
17ff0 24 65 6e 61 62 6c 65 20 5c 0d 0a 20 20 20 20 20 $enable \..
18000 20 20 20 20 20 20 20 20 20 22 29 2e 2e 2e 20 65 ")... e
18010 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 72 65 rror: " \n\t $re
18020 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 sult \n]..
18030 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 }.. }..
18040 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
18050 20 73 65 74 75 70 44 62 20 7b 0d 0a 20 20 20 20 setupDb {..
18060 20 20 20 20 20 20 20 20 66 69 6c 65 4e 61 6d 65 fileName
18070 20 7b 6d 6f 64 65 20 22 22 7d 20 7b 64 61 74 65 {mode ""} {date
18080 54 69 6d 65 46 6f 72 6d 61 74 20 22 22 7d 20 7b TimeFormat ""} {
18090 64 61 74 65 54 69 6d 65 4b 69 6e 64 20 22 22 7d dateTimeKind ""}
180a0 20 7b 66 6c 61 67 73 20 22 22 7d 0d 0a 20 20 20 {flags ""}..
180b0 20 20 20 20 20 20 20 20 20 7b 65 78 74 72 61 20 {extra
180c0 22 22 7d 20 7b 71 75 61 6c 69 66 79 20 74 72 75 ""} {qualify tru
180d0 65 7d 20 7b 64 65 6c 65 74 65 20 74 72 75 65 7d e} {delete true}
180e0 20 7b 75 72 69 20 66 61 6c 73 65 7d 0d 0a 20 20 {uri false}..
180f0 20 20 20 20 20 20 20 20 20 20 7b 74 65 6d 70 6f {tempo
18100 72 61 72 79 20 74 72 75 65 7d 20 7b 76 61 72 4e rary true} {varN
18110 61 6d 65 20 64 62 7d 20 7b 71 75 69 65 74 20 66 ame db} {quiet f
18120 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 alse} } {..
18130 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
18140 3a 20 46 69 72 73 74 2c 20 73 65 65 20 69 66 20 : First, see if
18150 6f 75 72 20 63 61 6c 6c 65 72 20 68 61 73 20 72 our caller has r
18160 65 71 75 65 73 74 65 64 20 61 6e 20 69 6e 2d 6d equested an in-m
18170 65 6d 6f 72 79 20 64 61 74 61 62 61 73 65 2e 0d emory database..
18180 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
18190 73 65 74 20 69 73 4d 65 6d 6f 72 79 20 5b 69 73 set isMemory [is
181a0 4d 65 6d 6f 72 79 44 62 20 24 66 69 6c 65 4e 61 MemoryDb $fileNa
181b0 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a me].... #..
181c0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 46 6f # NOTE: Fo
181d0 72 20 6e 6f 77 2c 20 61 6c 6c 20 74 65 73 74 20 r now, all test
181e0 64 61 74 61 62 61 73 65 73 20 75 73 65 64 20 62 databases used b
181f0 79 20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 y the test suite
18200 20 61 72 65 20 70 6c 61 63 65 64 0d 0a 20 20 20 are placed..
18210 20 20 20 23 20 20 20 20 20 20 20 69 6e 74 6f 20 # into
18220 74 68 65 20 64 61 74 61 62 61 73 65 20 64 69 72 the database dir
18230 65 63 74 6f 72 79 2e 20 20 45 61 63 68 20 64 61 ectory. Each da
18240 74 61 62 61 73 65 20 61 6e 64 20 72 65 6c 61 74 tabase and relat
18250 65 64 20 66 69 6c 65 73 0d 0a 20 20 20 20 20 20 ed files..
18260 23 20 20 20 20 20 20 20 75 73 65 64 20 62 79 20 # used by
18270 61 20 74 65 73 74 20 73 68 6f 75 6c 64 20 62 65 a test should be
18280 20 63 6c 65 61 6e 65 64 20 75 70 20 62 79 20 74 cleaned up by t
18290 68 61 74 20 74 65 73 74 20 75 73 69 6e 67 20 74 hat test using t
182a0 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 he.. #
182b0 20 20 22 63 6c 65 61 6e 75 70 44 62 22 20 70 72 "cleanupDb" pr
182c0 6f 63 65 64 75 72 65 2c 20 62 65 6c 6f 77 2e 0d ocedure, below..
182d0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
182e0 69 66 20 7b 21 24 69 73 4d 65 6d 6f 72 79 20 26 if {!$isMemory &
182f0 26 20 24 71 75 61 6c 69 66 79 7d 20 74 68 65 6e & $qualify} then
18300 20 7b 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 {.. set
18310 66 69 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6a fileName [file j
18320 6f 69 6e 20 5b 67 65 74 44 61 74 61 62 61 73 65 oin [getDatabase
18330 44 69 72 65 63 74 6f 72 79 5d 20 5b 66 69 6c 65 Directory] [file
18340 20 74 61 69 6c 20 24 66 69 6c 65 4e 61 6d 65 5d tail $fileName]
18350 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 ].. }....
18360 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
18370 4f 54 45 3a 20 42 79 20 64 65 66 61 75 6c 74 2c OTE: By default,
18380 20 64 65 6c 65 74 65 20 61 6e 79 20 70 72 65 2d delete any pre-
18390 65 78 69 73 74 69 6e 67 20 64 61 74 61 62 61 73 existing databas
183a0 65 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 e with the same
183b0 66 69 6c 65 0d 0a 20 20 20 20 20 20 23 20 20 20 file.. #
183c0 20 20 20 20 6e 61 6d 65 20 69 66 20 69 74 20 63 name if it c
183d0 75 72 72 65 6e 74 6c 79 20 65 78 69 73 74 73 2e urrently exists.
183e0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
183f0 20 69 66 20 7b 21 24 69 73 4d 65 6d 6f 72 79 20 if {!$isMemory
18400 26 26 20 24 64 65 6c 65 74 65 20 26 26 20 5b 66 && $delete && [f
18410 69 6c 65 20 65 78 69 73 74 73 20 24 66 69 6c 65 ile exists $file
18420 4e 61 6d 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 Name]} then {..
18430 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
18440 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 # NOTE: Attemp
18450 74 20 74 6f 20 64 65 6c 65 74 65 20 61 6e 79 20 t to delete any
18460 70 72 65 2d 65 78 69 73 74 69 6e 67 20 64 61 74 pre-existing dat
18470 61 62 61 73 65 20 77 69 74 68 20 74 68 65 20 73 abase with the s
18480 61 6d 65 20 66 69 6c 65 0d 0a 20 20 20 20 20 20 ame file..
18490 20 20 23 20 20 20 20 20 20 20 6e 61 6d 65 2e 0d # name..
184a0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
184b0 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
184c0 66 69 6c 65 20 64 65 6c 65 74 65 20 24 66 69 6c file delete $fil
184d0 65 4e 61 6d 65 7d 20 65 72 72 6f 72 5d 7d 20 74 eName} error]} t
184e0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
184f0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 #.. #
18500 4e 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 NOTE: We somehow
18510 20 66 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 failed to delet
18520 65 20 74 68 65 20 66 69 6c 65 2c 20 72 65 70 6f e the file, repo
18530 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 rt why...
18540 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
18550 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
18560 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
18570 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
18580 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
18590 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
185a0 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e "==== WARN
185b0 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 64 ING: failed to d
185c0 65 6c 65 74 65 20 64 61 74 61 62 61 73 65 20 66 elete database f
185d0 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d ile \"" $fileNam
185e0 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
185f0 20 20 20 20 20 22 5c 22 20 64 75 72 69 6e 67 20 "\" during
18600 73 65 74 75 70 2c 20 65 72 72 6f 72 3a 20 22 20 setup, error: "
18610 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d \n\t $error \n].
18620 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
18630 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
18640 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
18650 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 # NOTE: Refer
18660 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 to the specifie
18670 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e d variable (e.g.
18680 20 22 64 62 22 29 20 69 6e 20 74 68 65 20 63 6f "db") in the co
18690 6e 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a 20 20 ntext of our..
186a0 20 20 20 20 23 20 20 20 20 20 20 20 63 61 6c 6c # call
186b0 65 72 2e 20 20 54 68 65 20 68 61 6e 64 6c 65 20 er. The handle
186c0 74 6f 20 74 68 65 20 6f 70 65 6e 65 64 20 64 61 to the opened da
186d0 74 61 62 61 73 65 20 77 69 6c 6c 20 62 65 20 73 tabase will be s
186e0 74 6f 72 65 64 20 74 68 65 72 65 2e 0d 0a 20 20 tored there...
186f0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 75 70 76 #.. upv
18700 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 64 62 ar 1 $varName db
18710 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
18720 20 20 20 23 20 4e 4f 54 45 3a 20 53 74 61 72 74 # NOTE: Start
18730 20 62 75 69 6c 64 69 6e 67 20 74 68 65 20 63 6f building the co
18740 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 2e nnection string.
18750 20 20 54 68 65 20 6f 6e 6c 79 20 72 65 71 75 69 The only requi
18760 72 65 64 20 70 6f 72 74 69 6f 6e 0d 0a 20 20 20 red portion..
18770 20 20 20 23 20 20 20 20 20 20 20 6f 66 20 74 68 # of th
18780 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 e connection str
18790 69 6e 67 20 69 73 20 74 68 65 20 64 61 74 61 20 ing is the data
187a0 73 6f 75 72 63 65 2c 20 77 68 69 63 68 20 63 6f source, which co
187b0 6e 74 61 69 6e 73 20 74 68 65 0d 0a 20 20 20 20 ntains the..
187c0 20 20 23 20 20 20 20 20 20 20 64 61 74 61 62 61 # databa
187d0 73 65 20 66 69 6c 65 20 6e 61 6d 65 20 69 74 73 se file name its
187e0 65 6c 66 2e 20 20 49 66 20 6f 75 72 20 63 61 6c elf. If our cal
187f0 6c 65 72 20 77 61 6e 74 73 20 74 6f 20 75 73 65 ler wants to use
18800 20 61 20 55 52 49 20 61 73 0d 0a 20 20 20 20 20 a URI as..
18810 20 23 20 20 20 20 20 20 20 74 68 65 20 64 61 74 # the dat
18820 61 20 73 6f 75 72 63 65 2c 20 75 73 65 20 74 68 a source, use th
18830 65 20 46 75 6c 6c 55 72 69 20 63 6f 6e 6e 65 63 e FullUri connec
18840 74 69 6f 6e 20 73 74 72 69 6e 67 20 70 72 6f 70 tion string prop
18850 65 72 74 79 20 74 6f 0d 0a 20 20 20 20 20 20 23 erty to.. #
18860 20 20 20 20 20 20 20 70 72 65 76 65 6e 74 20 74 prevent t
18870 68 65 20 64 61 74 61 20 73 6f 75 72 63 65 20 73 he data source s
18880 74 72 69 6e 67 20 66 72 6f 6d 20 62 65 69 6e 67 tring from being
18890 20 6d 61 6e 67 6c 65 64 2e 0d 0a 20 20 20 20 20 mangled...
188a0 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 75 #.. if {$u
188b0 72 69 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 ri} then {..
188c0 20 20 20 20 73 65 74 20 63 6f 6e 6e 65 63 74 69 set connecti
188d0 6f 6e 20 7b 46 75 6c 6c 55 72 69 3d 24 7b 66 69 on {FullUri=${fi
188e0 6c 65 4e 61 6d 65 7d 7d 0d 0a 20 20 20 20 20 20 leName}}..
188f0 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
18900 20 20 73 65 74 20 63 6f 6e 6e 65 63 74 69 6f 6e set connection
18910 20 7b 44 61 74 61 20 53 6f 75 72 63 65 3d 24 7b {Data Source=${
18920 66 69 6c 65 4e 61 6d 65 7d 7d 0d 0a 20 20 20 20 fileName}}..
18930 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a }.... #..
18940 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 69 # NOTE: Si
18950 6e 63 65 20 74 68 69 73 20 70 72 6f 63 65 64 75 nce this procedu
18960 72 65 20 68 61 73 20 6e 6f 20 73 70 65 63 69 61 re has no specia
18970 6c 20 6b 6e 6f 77 6c 65 64 67 65 20 6f 66 20 77 l knowledge of w
18980 68 61 74 20 74 68 65 20 64 65 66 61 75 6c 74 0d hat the default.
18990 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 . # s
189a0 65 74 74 69 6e 67 20 69 73 20 66 6f 72 20 74 68 etting is for th
189b0 65 20 54 6f 46 75 6c 6c 50 61 74 68 20 63 6f 6e e ToFullPath con
189c0 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 20 70 nection string p
189d0 72 6f 70 65 72 79 2c 20 61 6c 77 61 79 73 0d 0a ropery, always..
189e0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 64 # ad
189f0 64 20 74 68 65 20 76 61 6c 75 65 20 77 65 20 6b d the value we k
18a00 6e 6f 77 20 61 62 6f 75 74 20 74 6f 20 74 68 65 now about to the
18a10 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 connection stri
18a20 6e 67 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 ng... #..
18a30 20 20 20 20 61 70 70 65 6e 64 20 63 6f 6e 6e 65 append conne
18a40 63 74 69 6f 6e 20 7b 3b 54 6f 46 75 6c 6c 50 61 ction {;ToFullPa
18a50 74 68 3d 24 7b 71 75 61 6c 69 66 79 7d 7d 0d 0a th=${qualify}}..
18a60 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
18a70 20 23 20 4e 4f 54 45 3a 20 49 66 20 6f 75 72 20 # NOTE: If our
18a80 63 61 6c 6c 65 72 20 73 70 65 63 69 66 69 65 64 caller specified
18a90 20 61 20 6a 6f 75 72 6e 61 6c 20 6d 6f 64 65 2c a journal mode,
18aa0 20 61 64 64 20 74 68 65 20 6e 65 63 65 73 73 61 add the necessa
18ab0 72 79 20 70 6f 72 74 69 6f 6e 0d 0a 20 20 20 20 ry portion..
18ac0 20 20 23 20 20 20 20 20 20 20 6f 66 20 74 68 65 # of the
18ad0 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 connection stri
18ae0 6e 67 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 23 ng now... #
18af0 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
18b00 69 6e 67 20 6c 65 6e 67 74 68 20 24 6d 6f 64 65 ing length $mode
18b10 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
18b20 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 63 6f append co
18b30 6e 6e 65 63 74 69 6f 6e 20 7b 3b 4a 6f 75 72 6e nnection {;Journ
18b40 61 6c 20 4d 6f 64 65 3d 24 7b 6d 6f 64 65 7d 7d al Mode=${mode}}
18b50 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 .. }....
18b60 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
18b70 54 45 3a 20 49 66 20 6f 75 72 20 63 61 6c 6c 65 TE: If our calle
18b80 72 20 73 70 65 63 69 66 69 65 64 20 61 20 44 61 r specified a Da
18b90 74 65 54 69 6d 65 20 66 6f 72 6d 61 74 2c 20 61 teTime format, a
18ba0 64 64 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 dd the necessary
18bb0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
18bc0 70 6f 72 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 portion of the c
18bd0 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e 67 onnection string
18be0 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 23 0d 0a now... #..
18bf0 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
18c00 67 20 6c 65 6e 67 74 68 20 24 64 61 74 65 54 69 g length $dateTi
18c10 6d 65 46 6f 72 6d 61 74 5d 20 3e 20 30 7d 20 74 meFormat] > 0} t
18c20 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 hen {.. a
18c30 70 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 6f 6e ppend connection
18c40 20 7b 3b 44 61 74 65 54 69 6d 65 46 6f 72 6d 61 {;DateTimeForma
18c50 74 3d 24 7b 64 61 74 65 54 69 6d 65 46 6f 72 6d t=${dateTimeForm
18c60 61 74 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d at}}.. }...
18c70 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
18c80 23 20 4e 4f 54 45 3a 20 49 66 20 6f 75 72 20 63 # NOTE: If our c
18c90 61 6c 6c 65 72 20 73 70 65 63 69 66 69 65 64 20 aller specified
18ca0 61 20 44 61 74 65 54 69 6d 65 4b 69 6e 64 2c 20 a DateTimeKind,
18cb0 61 64 64 20 74 68 65 20 6e 65 63 65 73 73 61 72 add the necessar
18cc0 79 20 70 6f 72 74 69 6f 6e 0d 0a 20 20 20 20 20 y portion..
18cd0 20 23 20 20 20 20 20 20 20 6f 66 20 74 68 65 20 # of the
18ce0 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 72 69 6e connection strin
18cf0 67 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 23 0d g now... #.
18d00 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 . if {[stri
18d10 6e 67 20 6c 65 6e 67 74 68 20 24 64 61 74 65 54 ng length $dateT
18d20 69 6d 65 4b 69 6e 64 5d 20 3e 20 30 7d 20 74 68 imeKind] > 0} th
18d30 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 70 en {.. ap
18d40 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 pend connection
18d50 7b 3b 44 61 74 65 54 69 6d 65 4b 69 6e 64 3d 24 {;DateTimeKind=$
18d60 7b 64 61 74 65 54 69 6d 65 4b 69 6e 64 7d 7d 0d {dateTimeKind}}.
18d70 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 . }....
18d80 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
18d90 45 3a 20 46 69 67 75 72 65 20 6f 75 74 20 77 68 E: Figure out wh
18da0 61 74 20 74 68 65 20 66 69 6e 61 6c 20 66 6c 61 at the final fla
18db0 67 73 20 66 6f 72 20 74 68 69 73 20 63 6f 6e 6e gs for this conn
18dc0 65 63 74 69 6f 6e 20 6e 65 65 64 20 74 6f 20 62 ection need to b
18dd0 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 e... #..
18de0 20 20 20 73 65 74 20 66 6c 61 67 73 20 5b 67 65 set flags [ge
18df0 74 43 6f 6e 6e 65 63 74 69 6f 6e 46 6c 61 67 73 tConnectionFlags
18e00 20 24 66 69 6c 65 4e 61 6d 65 20 24 66 6c 61 67 $fileName $flag
18e10 73 20 24 71 75 69 65 74 5d 0d 0a 0d 0a 20 20 20 s $quiet]....
18e20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f #.. # NO
18e30 54 45 3a 20 49 66 20 6f 75 72 20 63 61 6c 6c 65 TE: If our calle
18e40 72 20 73 70 65 63 69 66 69 65 64 20 73 6f 6d 65 r specified some
18e50 20 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f SQLiteConnectio
18e60 6e 46 6c 61 67 73 2c 20 61 64 64 20 74 68 65 0d nFlags, add the.
18e70 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6e . # n
18e80 65 63 65 73 73 61 72 79 20 70 6f 72 74 69 6f 6e ecessary portion
18e90 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 of the connecti
18ea0 6f 6e 20 73 74 72 69 6e 67 20 6e 6f 77 2e 0d 0a on string now...
18eb0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
18ec0 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 f {[string lengt
18ed0 68 20 24 66 6c 61 67 73 5d 20 3e 20 30 7d 20 74 h $flags] > 0} t
18ee0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 61 hen {.. a
18ef0 70 70 65 6e 64 20 63 6f 6e 6e 65 63 74 69 6f 6e ppend connection
18f00 20 7b 3b 46 6c 61 67 73 3d 24 7b 66 6c 61 67 73 {;Flags=${flags
18f10 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }}.. }....
18f20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
18f30 4e 4f 54 45 3a 20 49 66 20 6f 75 72 20 63 61 6c NOTE: If our cal
18f40 6c 65 72 20 73 70 65 63 69 66 69 65 64 20 61 6e ler specified an
18f50 20 65 78 74 72 61 20 70 61 79 6c 6f 61 64 20 74 extra payload t
18f60 6f 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e o the connection
18f70 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
18f80 73 74 72 69 6e 67 2c 20 61 70 70 65 6e 64 20 69 string, append i
18f90 74 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 23 0d t now... #.
18fa0 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 . if {[stri
18fb0 6e 67 20 6c 65 6e 67 74 68 20 24 65 78 74 72 61 ng length $extra
18fc0 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
18fd0 20 20 20 20 20 20 20 61 70 70 65 6e 64 20 63 6f append co
18fe0 6e 6e 65 63 74 69 6f 6e 20 5c 3b 20 24 65 78 74 nnection \; $ext
18ff0 72 61 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 ra.. }....
19000 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
19010 4e 4f 54 45 3a 20 41 64 64 20 74 68 65 20 6e 61 NOTE: Add the na
19020 6d 65 20 6f 66 20 74 68 65 20 63 75 72 72 65 6e me of the curren
19030 74 20 74 65 73 74 20 66 69 6c 65 2c 20 69 66 20 t test file, if
19040 61 76 61 69 6c 61 62 6c 65 2e 20 20 54 68 69 73 available. This
19050 20 69 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 is.. #
19060 20 20 20 6f 6e 6c 79 20 75 73 65 64 20 66 6f 72 only used for
19070 20 64 65 62 75 67 67 69 6e 67 2e 0d 0a 20 20 20 debugging...
19080 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
19090 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
190a0 65 73 74 5f 66 69 6c 65 5d 7d 20 74 68 65 6e 20 est_file]} then
190b0 7b 0d 0a 20 20 20 20 20 20 20 20 61 70 70 65 6e {.. appen
190c0 64 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 7b 3b 54 d connection {;T
190d0 65 73 74 46 69 6c 65 3d 24 7b 3a 3a 74 65 73 74 estFile=${::test
190e0 5f 66 69 6c 65 7d 7d 0d 0a 20 20 20 20 20 20 7d _file}}.. }
190f0 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
19100 20 20 20 23 20 4e 4f 54 45 3a 20 41 64 64 20 74 # NOTE: Add t
19110 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 63 he name of the c
19120 75 72 72 65 6e 74 20 74 65 73 74 2c 20 69 66 20 urrent test, if
19130 61 76 61 69 6c 61 62 6c 65 2e 20 20 54 68 69 73 available. This
19140 20 69 73 20 6f 6e 6c 79 0d 0a 20 20 20 20 20 20 is only..
19150 23 20 20 20 20 20 20 20 75 73 65 64 20 66 6f 72 # used for
19160 20 64 65 62 75 67 67 69 6e 67 2e 0d 0a 20 20 20 debugging...
19170 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
19180 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 65 [info exists ::e
19190 61 67 6c 65 5f 74 65 73 74 73 28 43 75 72 72 65 agle_tests(Curre
191a0 6e 74 4e 61 6d 65 29 5d 7d 20 74 68 65 6e 20 7b ntName)]} then {
191b0 0d 0a 20 20 20 20 20 20 20 20 61 70 70 65 6e 64 .. append
191c0 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 7b 3b 54 65 connection {;Te
191d0 73 74 4e 61 6d 65 3d 24 7b 3a 3a 65 61 67 6c 65 stName=${::eagle
191e0 5f 74 65 73 74 73 28 43 75 72 72 65 6e 74 4e 61 _tests(CurrentNa
191f0 6d 65 29 7d 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a me)}}.. }..
19200 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
19210 20 23 20 4e 4f 54 45 3a 20 46 6f 72 20 63 6c 61 # NOTE: For cla
19220 72 69 74 79 2c 20 61 70 70 65 6e 64 20 61 20 66 rity, append a f
19230 69 6e 61 6c 20 73 65 6d 69 63 6f 6c 6f 6e 20 74 inal semicolon t
19240 6f 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e o the connection
19250 20 73 74 72 69 6e 67 2e 0d 0a 20 20 20 20 20 20 string...
19260 23 0d 0a 20 20 20 20 20 20 61 70 70 65 6e 64 20 #.. append
19270 63 6f 6e 6e 65 63 74 69 6f 6e 20 5c 3b 0d 0a 0d connection \;...
19280 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
19290 23 20 4e 4f 54 45 3a 20 4f 70 65 6e 20 74 68 65 # NOTE: Open the
192a0 20 64 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 database connec
192b0 74 69 6f 6e 20 6e 6f 77 2c 20 70 6c 61 63 69 6e tion now, placin
192c0 67 20 74 68 65 20 6f 70 61 71 75 65 20 68 61 6e g the opaque han
192d0 64 6c 65 20 76 61 6c 75 65 0d 0a 20 20 20 20 20 dle value..
192e0 20 23 20 20 20 20 20 20 20 69 6e 74 6f 20 74 68 # into th
192f0 65 20 76 61 72 69 61 62 6c 65 20 73 70 65 63 69 e variable speci
19300 66 69 65 64 20 62 79 20 6f 75 72 20 63 61 6c 6c fied by our call
19310 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 er... #..
19320 20 20 20 20 73 65 74 20 64 62 20 5b 73 71 6c 20 set db [sql
19330 6f 70 65 6e 20 2d 74 79 70 65 20 53 51 4c 69 74 open -type SQLit
19340 65 20 5b 73 75 62 73 74 20 24 63 6f 6e 6e 65 63 e [subst $connec
19350 74 69 6f 6e 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 tion]]....
19360 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
19370 20 43 6f 6e 66 69 67 75 72 65 20 74 68 65 20 74 Configure the t
19380 65 6d 70 6f 72 61 72 79 20 64 69 72 65 63 74 6f emporary directo
19390 72 79 20 66 6f 72 20 74 68 65 20 6e 65 77 6c 79 ry for the newly
193a0 20 6f 70 65 6e 65 64 20 64 61 74 61 62 61 73 65 opened database
193b0 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
193c0 63 6f 6e 6e 65 63 74 69 6f 6e 20 6e 6f 77 20 75 connection now u
193d0 6e 6c 65 73 73 20 6f 75 72 20 63 61 6c 6c 65 72 nless our caller
193e0 20 66 6f 72 62 69 64 73 20 69 74 2e 0d 0a 20 20 forbids it...
193f0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
19400 7b 24 74 65 6d 70 6f 72 61 72 79 20 26 26 20 21 {$temporary && !
19410 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
19420 6f 28 73 65 74 54 65 6d 70 6f 72 61 72 79 44 69 o(setTemporaryDi
19430 72 65 63 74 6f 72 79 29 5d 7d 20 74 68 65 6e 20 rectory)]} then
19440 7b 0d 0a 20 20 20 20 20 20 20 20 73 71 6c 20 65 {.. sql e
19450 78 65 63 75 74 65 20 24 64 62 20 5b 61 70 70 65 xecute $db [appe
19460 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
19470 20 20 20 20 20 20 22 50 52 41 47 4d 41 20 74 65 "PRAGMA te
19480 6d 70 5f 73 74 6f 72 65 5f 64 69 72 65 63 74 6f mp_store_directo
19490 72 79 20 3d 20 5c 22 22 20 5b 67 65 74 54 65 6d ry = \"" [getTem
194a0 70 6f 72 61 72 79 44 69 72 65 63 74 6f 72 79 5d poraryDirectory]
194b0 20 5c 22 5c 3b 5d 0d 0a 20 20 20 20 20 20 7d 0d \"\;].. }.
194c0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
194d0 20 20 23 20 4e 4f 54 45 3a 20 50 65 72 66 6f 72 # NOTE: Perfor
194e0 6d 20 61 6e 79 20 65 78 74 72 61 20 70 65 72 2d m any extra per-
194f0 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 65 74 75 70 connection setup
19500 20 66 6f 72 20 74 68 65 20 6e 65 77 6c 79 20 6f for the newly o
19510 70 65 6e 65 64 0d 0a 20 20 20 20 20 20 23 20 20 pened.. #
19520 20 20 20 20 20 64 61 74 61 62 61 73 65 20 6e 6f database no
19530 77 20 75 6e 6c 65 73 73 20 6f 75 72 20 63 61 6c w unless our cal
19540 6c 65 72 20 66 6f 72 62 69 64 73 20 69 74 2e 0d ler forbids it..
19550 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
19560 73 65 74 20 65 78 65 63 75 74 65 4f 6e 53 65 74 set executeOnSet
19570 75 70 20 5b 67 65 74 45 78 65 63 75 74 65 4f 6e up [getExecuteOn
19580 53 65 74 75 70 5d 0d 0a 0d 0a 20 20 20 20 20 20 Setup]....
19590 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
195a0 74 68 20 24 65 78 65 63 75 74 65 4f 6e 53 65 74 th $executeOnSet
195b0 75 70 5d 20 3e 20 30 20 26 26 20 5c 0d 0a 20 20 up] > 0 && \..
195c0 20 20 20 20 20 20 20 20 21 5b 69 6e 66 6f 20 65 ![info e
195d0 78 69 73 74 73 20 3a 3a 6e 6f 28 65 78 65 63 75 xists ::no(execu
195e0 74 65 4f 6e 53 65 74 75 70 29 5d 7d 20 74 68 65 teOnSetup)]} the
195f0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
19600 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
19610 54 68 69 73 20 63 6f 6d 6d 61 6e 64 20 6d 61 79 This command may
19620 20 72 61 69 73 65 20 61 6e 20 65 72 72 6f 72 3b raise an error;
19630 20 69 66 20 73 6f 2c 20 74 68 61 74 20 69 73 20 if so, that is
19640 66 69 6e 65 2c 20 61 73 0d 0a 20 20 20 20 20 20 fine, as..
19650 20 20 23 20 20 20 20 20 20 20 74 68 65 20 65 6e # the en
19660 63 6c 6f 73 69 6e 67 20 74 65 73 74 20 77 69 6c closing test wil
19670 6c 20 74 68 65 6e 20 66 61 69 6c 2e 20 20 54 68 l then fail. Th
19680 65 20 5b 73 75 62 73 74 5d 20 63 6f 6d 6d 61 6e e [subst] comman
19690 64 20 69 73 0d 0a 20 20 20 20 20 20 20 20 23 20 d is.. #
196a0 20 20 20 20 20 20 75 73 65 64 20 6f 6e 20 74 68 used on th
196b0 65 20 53 51 4c 20 69 6e 20 63 61 73 65 20 69 74 e SQL in case it
196c0 20 6e 65 65 64 73 20 74 6f 20 72 65 66 65 72 20 needs to refer
196d0 74 6f 20 73 74 61 74 65 20 69 6e 20 6f 75 72 0d to state in our.
196e0 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
196f0 20 63 6f 6e 74 65 78 74 2e 0d 0a 20 20 20 20 20 context...
19700 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 71 #.. sq
19710 6c 20 65 78 65 63 75 74 65 20 24 64 62 20 5b 73 l execute $db [s
19720 75 62 73 74 20 24 65 78 65 63 75 74 65 4f 6e 53 ubst $executeOnS
19730 65 74 75 70 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a etup].. }..
19740 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
19750 20 23 20 4e 4f 54 45 3a 20 41 6c 77 61 79 73 20 # NOTE: Always
19760 72 65 74 75 72 6e 20 74 68 65 20 63 6f 6e 6e 65 return the conne
19770 63 74 69 6f 6e 20 68 61 6e 64 6c 65 20 75 70 6f ction handle upo
19780 6e 20 73 75 63 63 65 73 73 2e 0d 0a 20 20 20 20 n success...
19790 20 20 23 0d 0a 20 20 20 20 20 20 72 65 74 75 72 #.. retur
197a0 6e 20 24 64 62 0d 0a 20 20 20 20 7d 0d 0a 0c 0d n $db.. }....
197b0 0a 20 20 20 20 70 72 6f 63 20 67 65 74 44 62 43 . proc getDbC
197c0 6f 6e 6e 65 63 74 69 6f 6e 20 7b 20 7b 76 61 72 onnection { {var
197d0 4e 61 6d 65 20 64 62 7d 20 7d 20 7b 0d 0a 20 20 Name db} } {..
197e0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
197f0 4f 54 45 3a 20 52 65 66 65 72 20 74 6f 20 74 68 OTE: Refer to th
19800 65 20 73 70 65 63 69 66 69 65 64 20 76 61 72 69 e specified vari
19810 61 62 6c 65 20 28 65 2e 67 2e 20 22 64 62 22 29 able (e.g. "db")
19820 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 20 in the context
19830 6f 66 20 6f 75 72 0d 0a 20 20 20 20 20 20 23 20 of our.. #
19840 20 20 20 20 20 20 63 61 6c 6c 65 72 2e 20 20 54 caller. T
19850 68 65 20 68 61 6e 64 6c 65 20 74 6f 20 74 68 65 he handle to the
19860 20 64 61 74 61 62 61 73 65 20 70 72 65 76 69 6f database previo
19870 75 73 6c 79 20 6f 70 65 6e 65 64 20 76 69 61 20 usly opened via
19880 74 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 the.. #
19890 20 20 20 5b 73 65 74 75 70 44 62 5d 20 70 72 6f [setupDb] pro
198a0 63 65 64 75 72 65 20 73 68 6f 75 6c 64 20 62 65 cedure should be
198b0 20 73 74 6f 72 65 64 20 74 68 65 72 65 2e 0d 0a stored there...
198c0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 75 #.. u
198d0 70 76 61 72 20 31 20 24 76 61 72 4e 61 6d 65 20 pvar 1 $varName
198e0 64 62 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 db.... #..
198f0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 # NOTE: Thi
19900 73 20 72 65 74 75 72 6e 73 20 74 68 65 20 41 44 s returns the AD
19910 4f 2e 4e 45 54 20 49 44 62 43 6f 6e 6e 65 63 74 O.NET IDbConnect
19920 69 6f 6e 20 6f 62 6a 65 63 74 20 69 6e 73 74 61 ion object insta
19930 6e 63 65 20 66 6f 72 20 74 68 65 0d 0a 20 20 20 nce for the..
19940 20 20 20 23 20 20 20 20 20 20 20 73 70 65 63 69 # speci
19950 66 69 65 64 20 64 61 74 61 62 73 65 20 68 61 6e fied databse han
19960 64 6c 65 2e 20 20 53 69 6e 63 65 20 67 65 74 74 dle. Since gett
19970 69 6e 67 20 74 68 69 73 20 6f 62 6a 65 63 74 20 ing this object
19980 72 65 6c 69 65 73 20 75 70 6f 6e 0d 0a 20 20 20 relies upon..
19990 20 20 20 23 20 20 20 20 20 20 20 45 61 67 6c 65 # Eagle
199a0 20 69 6e 74 65 72 6e 61 6c 73 2c 20 67 72 65 61 internals, grea
199b0 74 20 63 61 72 65 20 73 68 6f 75 6c 64 20 62 65 t care should be
199c0 20 74 61 6b 65 6e 20 74 6f 20 61 76 6f 69 64 20 taken to avoid
199d0 64 69 73 70 6f 73 69 6e 67 20 6f 66 0d 0a 20 20 disposing of..
199e0 20 20 20 20 23 20 20 20 20 20 20 20 74 68 69 73 # this
199f0 20 6f 62 6a 65 63 74 20 6f 72 20 6f 74 68 65 72 object or other
19a00 77 69 73 65 20 70 75 74 74 69 6e 67 20 69 74 20 wise putting it
19a10 69 6e 74 6f 20 61 6e 20 69 6e 76 61 6c 69 64 20 into an invalid
19a20 73 74 61 74 65 2e 0d 0a 20 20 20 20 20 20 23 0d state... #.
19a30 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f . if {[info
19a40 20 65 78 69 73 74 73 20 64 62 5d 7d 20 74 68 65 exists db]} the
19a50 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 n {.. if
19a60 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
19a70 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
19a80 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
19a90 62 6c 69 63 20 2d 6f 62 6a 65 63 74 66 6c 61 67 blic -objectflag
19aa0 73 20 2b 4e 6f 44 69 73 70 6f 73 65 20 2d 61 6c s +NoDispose -al
19ab0 69 61 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ias \..
19ac0 20 20 20 20 20 49 6e 74 65 72 70 72 65 74 65 72 Interpreter
19ad0 2e 47 65 74 41 63 74 69 76 65 2e 63 6f 6e 6e 65 .GetActive.conne
19ae0 63 74 69 6f 6e 73 20 49 74 65 6d 20 24 64 62 0d ctions Item $db.
19af0 0a 20 20 20 20 20 20 20 20 7d 20 72 65 73 75 6c . } resul
19b00 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d t] == 0} then {.
19b10 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
19b20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
19b30 53 75 63 63 65 73 73 2c 20 72 65 74 75 72 6e 20 Success, return
19b40 74 68 65 20 6f 70 61 71 75 65 20 6f 62 6a 65 63 the opaque objec
19b50 74 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 t handle...
19b60 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
19b70 20 20 72 65 74 75 72 6e 20 24 72 65 73 75 6c 74 return $result
19b80 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
19b90 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d {.. #.
19ba0 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 . # NOT
19bb0 45 3a 20 46 61 69 6c 75 72 65 2c 20 72 65 70 6f E: Failure, repo
19bc0 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 rt why...
19bd0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
19be0 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
19bf0 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
19c00 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
19c10 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 "==== WARNING
19c20 3a 20 66 61 69 6c 65 64 20 74 6f 20 67 65 74 20 : failed to get
19c30 63 6f 6e 6e 65 63 74 69 6f 6e 20 68 61 6e 64 6c connection handl
19c40 65 20 66 6f 72 20 64 61 74 61 62 61 73 65 20 5c e for database \
19c50 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 "" \..
19c60 20 20 20 20 24 64 62 20 22 5c 22 2c 20 65 72 72 $db "\", err
19c70 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 72 65 73 75 or: " \n\t $resu
19c80 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 lt \n]..
19c90 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
19ca0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
19cb0 4f 54 45 3a 20 46 61 69 6c 75 72 65 2c 20 72 65 OTE: Failure, re
19cc0 74 75 72 6e 20 61 6e 20 6f 62 76 69 6f 75 73 6c turn an obviousl
19cd0 79 20 69 6e 76 61 6c 69 64 20 6f 70 61 71 75 65 y invalid opaque
19ce0 20 6f 62 6a 65 63 74 20 68 61 6e 64 6c 65 2e 0d object handle..
19cf0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
19d00 72 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 7d return "".. }
19d10 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 66 72 ..... proc fr
19d20 65 65 44 62 43 6f 6e 6e 65 63 74 69 6f 6e 20 7b eeDbConnection {
19d30 20 7b 76 61 72 4e 61 6d 65 20 63 6f 6e 6e 65 63 {varName connec
19d40 74 69 6f 6e 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 tion} } {..
19d50 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
19d60 3a 20 52 65 66 65 72 20 74 6f 20 74 68 65 20 73 : Refer to the s
19d70 70 65 63 69 66 69 65 64 20 76 61 72 69 61 62 6c pecified variabl
19d80 65 20 28 65 2e 67 2e 20 22 63 6f 6e 6e 65 63 74 e (e.g. "connect
19d90 69 6f 6e 22 29 20 69 6e 20 74 68 65 0d 0a 20 20 ion") in the..
19da0 20 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 74 # cont
19db0 65 78 74 20 6f 66 20 6f 75 72 20 63 61 6c 6c 65 ext of our calle
19dc0 72 2e 20 20 54 68 65 20 6f 70 61 71 75 65 20 6f r. The opaque o
19dd0 62 6a 65 63 74 20 68 61 6e 64 6c 65 20 66 6f 72 bject handle for
19de0 20 61 6e 20 41 44 4f 2e 4e 45 54 0d 0a 20 20 20 an ADO.NET..
19df0 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 6e 65 # conne
19e00 63 74 69 6f 6e 20 70 72 65 76 69 6f 75 73 6c 79 ction previously
19e10 20 72 65 74 75 72 6e 65 64 20 62 79 20 5b 67 65 returned by [ge
19e20 74 44 62 43 6f 6e 6e 65 63 74 69 6f 6e 5d 20 73 tDbConnection] s
19e30 68 6f 75 6c 64 20 62 65 0d 0a 20 20 20 20 20 20 hould be..
19e40 23 20 20 20 20 20 20 20 73 74 6f 72 65 64 20 74 # stored t
19e50 68 65 72 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a here... #..
19e60 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 76 upvar 1 $v
19e70 61 72 4e 61 6d 65 20 63 6f 6e 6e 65 63 74 69 6f arName connectio
19e80 6e 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 n.... #..
19e90 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 # NOTE: Atte
19ea0 6d 70 74 20 74 6f 20 72 65 6d 6f 76 65 20 74 68 mpt to remove th
19eb0 65 20 6f 70 61 71 75 65 20 6f 62 6a 65 63 74 20 e opaque object
19ec0 68 61 6e 64 6c 65 20 66 72 6f 6d 20 74 68 65 20 handle from the
19ed0 69 6e 74 65 72 70 72 65 74 65 72 0d 0a 20 20 20 interpreter..
19ee0 20 20 20 23 20 20 20 20 20 20 20 6e 6f 77 2e 20 # now.
19ef0 20 54 68 69 73 20 5b 6f 62 6a 65 63 74 20 64 69 This [object di
19f00 73 70 6f 73 65 5d 20 63 61 6c 6c 20 77 69 6c 6c spose] call will
19f10 20 6e 6f 74 20 61 63 74 75 61 6c 6c 79 20 64 69 not actually di
19f20 73 70 6f 73 65 20 6f 66 20 74 68 65 0d 0a 20 20 spose of the..
19f30 20 20 20 20 23 20 20 20 20 20 20 20 75 6e 64 65 # unde
19f40 72 6c 79 69 6e 67 20 6f 62 6a 65 63 74 20 62 65 rlying object be
19f50 63 61 75 73 65 20 74 68 65 20 2b 4e 6f 44 69 73 cause the +NoDis
19f60 70 6f 73 65 20 66 6c 61 67 20 77 61 73 20 73 65 pose flag was se
19f70 74 20 6f 6e 20 69 74 0d 0a 20 20 20 20 20 20 23 t on it.. #
19f80 20 20 20 20 20 20 20 64 75 72 69 6e 67 20 63 72 during cr
19f90 65 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 6f 70 eation of the op
19fa0 61 71 75 65 20 6f 62 6a 65 63 74 20 68 61 6e 64 aque object hand
19fb0 6c 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 le... #..
19fc0 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
19fd0 69 73 74 73 20 63 6f 6e 6e 65 63 74 69 6f 6e 5d ists connection]
19fe0 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 && \..
19ff0 20 5b 63 61 74 63 68 20 7b 6f 62 6a 65 63 74 20 [catch {object
1a000 64 69 73 70 6f 73 65 20 24 63 6f 6e 6e 65 63 74 dispose $connect
1a010 69 6f 6e 7d 20 65 72 72 6f 72 5d 7d 20 74 68 65 ion} error]} the
1a020 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a n {.. #..
1a030 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1a040 57 65 20 73 6f 6d 65 68 6f 77 20 66 61 69 6c 65 We somehow faile
1a050 64 20 74 6f 20 72 65 6d 6f 76 65 20 74 68 65 20 d to remove the
1a060 68 61 6e 64 6c 65 2c 20 72 65 70 6f 72 74 20 77 handle, report w
1a070 68 79 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a hy... #..
1a080 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
1a090 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 :test_channel [a
1a0a0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
1a0b0 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 "==== W
1a0c0 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 ARNING: failed t
1a0d0 6f 20 72 65 6d 6f 76 65 20 63 6f 6e 6e 65 63 74 o remove connect
1a0e0 69 6f 6e 20 68 61 6e 64 6c 65 20 5c 22 22 20 24 ion handle \"" $
1a0f0 63 6f 6e 6e 65 63 74 69 6f 6e 20 5c 0d 0a 20 20 connection \..
1a100 20 20 20 20 20 20 20 20 20 20 22 5c 22 2c 20 65 "\", e
1a110 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 rror: " \n\t $er
1a120 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d ror \n].. }
1a130 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
1a140 70 72 6f 63 20 61 64 64 44 62 43 6f 6e 6e 65 63 proc addDbConnec
1a150 74 69 6f 6e 20 7b 20 63 6f 6e 6e 65 63 74 69 6f tion { connectio
1a160 6e 20 7b 76 61 72 4e 61 6d 65 20 64 62 7d 20 7d n {varName db} }
1a170 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 {.. #..
1a180 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 65 72 # NOTE: Refer
1a190 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 to the specifie
1a1a0 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e 67 2e d variable (e.g.
1a1b0 20 22 64 62 22 29 20 69 6e 20 74 68 65 20 63 6f "db") in the co
1a1c0 6e 74 65 78 74 20 6f 66 20 6f 75 72 0d 0a 20 20 ntext of our..
1a1d0 20 20 20 20 23 20 20 20 20 20 20 20 63 61 6c 6c # call
1a1e0 65 72 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 er... #..
1a1f0 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 upvar 1 $var
1a200 4e 61 6d 65 20 64 62 0d 0a 0d 0a 20 20 20 20 20 Name db....
1a210 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
1a220 3a 20 43 72 65 61 74 65 20 61 20 63 6f 72 72 65 : Create a corre
1a230 63 74 6c 79 20 66 6f 72 6d 61 74 74 65 64 20 6e ctly formatted n
1a240 61 6d 65 20 66 6f 72 20 74 68 65 20 64 61 74 61 ame for the data
1a250 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 base connection
1a260 74 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 to.. #
1a270 20 20 62 65 20 61 64 64 65 64 20 74 6f 20 74 68 be added to th
1a280 65 20 6c 69 73 74 20 6d 61 6e 61 67 65 64 20 62 e list managed b
1a290 79 20 74 68 65 20 45 61 67 6c 65 20 69 6e 74 65 y the Eagle inte
1a2a0 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 20 20 20 rpreter...
1a2b0 23 0d 0a 20 20 20 20 20 20 73 65 74 20 64 62 20 #.. set db
1a2c0 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d [object invoke -
1a2d0 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
1a2e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 45 61 \.. Ea
1a2f0 67 6c 65 2e 5f 43 6f 6d 70 6f 6e 65 6e 74 73 2e gle._Components.
1a300 50 72 69 76 61 74 65 2e 46 6f 72 6d 61 74 4f 70 Private.FormatOp
1a310 73 20 44 61 74 61 62 61 73 65 4f 62 6a 65 63 74 s DatabaseObject
1a320 4e 61 6d 65 20 24 63 6f 6e 6e 65 63 74 69 6f 6e Name $connection
1a330 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 53 51 \.. SQ
1a340 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 20 5b LiteConnection [
1a350 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 49 6e object invoke In
1a360 74 65 72 70 72 65 74 65 72 2e 47 65 74 41 63 74 terpreter.GetAct
1a370 69 76 65 20 4e 65 78 74 49 64 5d 5d 0d 0a 0d 0a ive NextId]]....
1a380 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
1a390 20 4e 4f 54 45 3a 20 41 64 64 20 74 68 65 20 64 NOTE: Add the d
1a3a0 61 74 61 62 61 73 65 20 63 6f 6e 6e 65 63 74 69 atabase connecti
1a3b0 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 79 20 6f on provided by o
1a3c0 75 72 20 63 61 6c 6c 65 72 20 74 6f 20 74 68 65 ur caller to the
1a3d0 20 6c 69 73 74 0d 0a 20 20 20 20 20 20 23 20 20 list.. #
1a3e0 20 20 20 20 20 6f 66 20 74 68 6f 73 65 20 6b 6e of those kn
1a3f0 6f 77 6e 20 74 6f 20 74 68 65 20 45 61 67 6c 65 own to the Eagle
1a400 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 interpreter...
1a410 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 6f 62 #.. ob
1a420 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 ject invoke -fla
1a430 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 49 6e gs +NonPublic In
1a440 74 65 72 70 72 65 74 65 72 2e 47 65 74 41 63 74 terpreter.GetAct
1a450 69 76 65 2e 63 6f 6e 6e 65 63 74 69 6f 6e 73 20 ive.connections
1a460 41 64 64 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 Add \..
1a470 20 24 64 62 20 24 63 6f 6e 6e 65 63 74 69 6f 6e $db $connection
1a480 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
1a490 70 72 6f 63 20 72 65 6d 6f 76 65 44 62 54 72 61 proc removeDbTra
1a4a0 6e 73 61 63 74 69 6f 6e 20 7b 20 74 72 61 6e 73 nsaction { trans
1a4b0 61 63 74 69 6f 6e 20 7d 20 7b 0d 0a 20 20 20 20 action } {..
1a4c0 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1a4d0 45 3a 20 52 65 6d 6f 76 65 20 74 68 65 20 64 61 E: Remove the da
1a4e0 74 61 62 61 73 65 20 74 72 61 6e 73 61 63 74 69 tabase transacti
1a4f0 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 79 20 6f on provided by o
1a500 75 72 20 63 61 6c 6c 65 72 20 66 72 6f 6d 20 74 ur caller from t
1a510 68 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 he.. #
1a520 20 20 6c 69 73 74 20 6f 66 20 74 68 6f 73 65 20 list of those
1a530 6b 6e 6f 77 6e 20 74 6f 20 74 68 65 20 45 61 67 known to the Eag
1a540 6c 65 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0d le interpreter..
1a550 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
1a560 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 object invoke -f
1a570 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 lags +NonPublic
1a580 49 6e 74 65 72 70 72 65 74 65 72 2e 47 65 74 41 Interpreter.GetA
1a590 63 74 69 76 65 2e 74 72 61 6e 73 61 63 74 69 6f ctive.transactio
1a5a0 6e 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ns \..
1a5b0 52 65 6d 6f 76 65 20 24 74 72 61 6e 73 61 63 74 Remove $transact
1a5c0 69 6f 6e 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 ion.. }.....
1a5d0 20 20 20 70 72 6f 63 20 67 65 74 52 6f 77 73 46 proc getRowsF
1a5e0 72 6f 6d 44 61 74 61 54 61 62 6c 65 20 7b 20 64 romDataTable { d
1a5f0 61 74 61 54 61 62 6c 65 20 7b 76 61 6c 75 65 43 ataTable {valueC
1a600 61 6c 6c 62 61 63 6b 20 22 22 7d 20 7d 20 7b 0d allback ""} } {.
1a610 0a 20 20 20 20 20 20 73 65 74 20 72 6f 77 73 20 . set rows
1a620 5b 6c 69 73 74 5d 0d 0a 20 20 20 20 20 20 73 65 [list].. se
1a630 74 20 63 6f 75 6e 74 20 5b 24 64 61 74 61 54 61 t count [$dataTa
1a640 62 6c 65 20 43 6f 6c 75 6d 6e 73 2e 43 6f 75 6e ble Columns.Coun
1a650 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 66 6f 72 20 t].... for
1a660 7b 73 65 74 20 69 6e 64 65 78 20 30 7d 20 7b 24 {set index 0} {$
1a670 69 6e 64 65 78 20 3c 20 24 63 6f 75 6e 74 7d 20 index < $count}
1a680 7b 69 6e 63 72 20 69 6e 64 65 78 7d 20 7b 0d 0a {incr index} {..
1a690 20 20 20 20 20 20 20 20 73 65 74 20 64 61 74 61 set data
1a6a0 43 6f 6c 75 6d 6e 20 5b 24 64 61 74 61 54 61 62 Column [$dataTab
1a6b0 6c 65 20 2d 61 6c 69 61 73 20 43 6f 6c 75 6d 6e le -alias Column
1a6c0 73 2e 67 65 74 5f 49 74 65 6d 20 24 69 6e 64 65 s.get_Item $inde
1a6d0 78 5d 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 x].. set
1a6e0 6e 61 6d 65 73 28 24 69 6e 64 65 78 29 20 5b 24 names($index) [$
1a6f0 64 61 74 61 43 6f 6c 75 6d 6e 20 43 6f 6c 75 6d dataColumn Colum
1a700 6e 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 7d 0d nName].. }.
1a710 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
1a720 20 20 23 20 4e 4f 54 45 3a 20 53 65 74 75 70 20 # NOTE: Setup
1a730 73 6f 6d 65 20 54 63 6c 20 72 65 74 75 72 6e 20 some Tcl return
1a740 63 6f 64 65 20 63 6f 6e 73 74 61 6e 74 73 2e 0d code constants..
1a750 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
1a760 73 65 74 20 4f 6b 20 30 3b 20 73 65 74 20 45 72 set Ok 0; set Er
1a770 72 6f 72 20 31 3b 20 73 65 74 20 52 65 74 75 72 ror 1; set Retur
1a780 6e 20 32 3b 20 73 65 74 20 42 72 65 61 6b 20 33 n 2; set Break 3
1a790 3b 20 73 65 74 20 43 6f 6e 74 69 6e 75 65 20 34 ; set Continue 4
1a7a0 0d 0a 0d 0a 20 20 20 20 20 20 6f 62 6a 65 63 74 .... object
1a7b0 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 61 73 20 foreach -alias
1a7c0 64 61 74 61 52 6f 77 20 5b 73 65 74 20 64 61 74 dataRow [set dat
1a7d0 61 52 6f 77 73 20 5b 24 64 61 74 61 54 61 62 6c aRows [$dataTabl
1a7e0 65 20 52 6f 77 73 5d 5d 20 7b 0d 0a 20 20 20 20 e Rows]] {..
1a7f0 20 20 20 20 73 65 74 20 72 6f 77 20 5b 6c 69 73 set row [lis
1a800 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 66 6f t].... fo
1a810 72 20 7b 73 65 74 20 69 6e 64 65 78 20 30 7d 20 r {set index 0}
1a820 7b 24 69 6e 64 65 78 20 3c 20 24 63 6f 75 6e 74 {$index < $count
1a830 7d 20 7b 69 6e 63 72 20 69 6e 64 65 78 7d 20 7b } {incr index} {
1a840 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
1a850 76 61 6c 75 65 20 5b 24 64 61 74 61 52 6f 77 20 value [$dataRow
1a860 2d 63 72 65 61 74 65 20 2d 61 6c 69 61 73 20 67 -create -alias g
1a870 65 74 5f 49 74 65 6d 20 24 69 6e 64 65 78 5d 0d et_Item $index].
1a880 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 ... if
1a890 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
1a8a0 24 76 61 6c 75 65 43 61 6c 6c 62 61 63 6b 5d 20 $valueCallback]
1a8b0 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
1a8c0 20 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 64 set cod
1a8d0 65 20 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 e [catch {..
1a8e0 20 20 20 20 20 20 20 20 20 20 24 76 61 6c 75 65 $value
1a8f0 43 61 6c 6c 62 61 63 6b 20 24 64 61 74 61 54 61 Callback $dataTa
1a900 62 6c 65 20 24 64 61 74 61 52 6f 77 20 24 69 6e ble $dataRow $in
1a910 64 65 78 20 24 76 61 6c 75 65 0d 0a 20 20 20 20 dex $value..
1a920 20 20 20 20 20 20 20 20 7d 20 6e 65 77 56 61 6c } newVal
1a930 75 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 ue]....
1a940 20 20 20 69 66 20 7b 24 63 6f 64 65 20 3d 3d 20 if {$code ==
1a950 24 4f 6b 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 $Ok} then {..
1a960 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
1a970 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f # NO
1a980 54 45 3a 20 55 73 65 20 74 68 65 20 73 70 65 63 TE: Use the spec
1a990 69 66 69 65 64 20 28 6e 65 77 3f 29 20 72 6f 77 ified (new?) row
1a9a0 20 76 61 6c 75 65 2e 0d 0a 20 20 20 20 20 20 20 value...
1a9b0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1a9c0 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 lappend
1a9d0 72 6f 77 20 5b 6c 69 73 74 20 24 6e 61 6d 65 73 row [list $names
1a9e0 28 24 69 6e 64 65 78 29 20 24 6e 65 77 56 61 6c ($index) $newVal
1a9f0 75 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ue]..
1aa00 20 7d 20 65 6c 73 65 69 66 20 7b 24 63 6f 64 65 } elseif {$code
1aa10 20 3d 3d 20 24 45 72 72 6f 72 7d 20 74 68 65 6e == $Error} then
1aa20 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1aa30 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
1aa40 20 20 20 23 20 4e 4f 54 45 3a 20 55 73 65 20 74 # NOTE: Use t
1aa50 68 65 20 28 6e 65 77 3f 29 20 4e 55 4c 4c 20 72 he (new?) NULL r
1aa60 6f 77 20 76 61 6c 75 65 2e 0d 0a 20 20 20 20 20 ow value...
1aa70 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
1aa80 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e lappen
1aa90 64 20 72 6f 77 20 5b 6c 69 73 74 20 24 6e 61 6d d row [list $nam
1aaa0 65 73 28 24 69 6e 64 65 78 29 5d 0d 0a 20 20 20 es($index)]..
1aab0 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 69 } elsei
1aac0 66 20 7b 24 63 6f 64 65 20 3d 3d 20 24 52 65 74 f {$code == $Ret
1aad0 75 72 6e 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 urn} then {..
1aae0 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
1aaf0 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f # NO
1ab00 54 45 3a 20 53 6b 69 70 20 72 65 6d 61 69 6e 69 TE: Skip remaini
1ab10 6e 67 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68 ng values for th
1ab20 69 73 20 72 6f 77 2e 0d 0a 20 20 20 20 20 20 20 is row...
1ab30 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1ab40 20 20 20 20 20 20 20 20 62 72 65 61 6b 0d 0a 20 break..
1ab50 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 } els
1ab60 65 69 66 20 7b 24 63 6f 64 65 20 3d 3d 20 24 42 eif {$code == $B
1ab70 72 65 61 6b 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 reak} then {..
1ab80 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
1ab90 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e # N
1aba0 4f 54 45 3a 20 53 6b 69 70 20 70 72 6f 63 65 73 OTE: Skip proces
1abb0 73 69 6e 67 20 74 68 69 73 20 72 6f 77 20 76 61 sing this row va
1abc0 6c 75 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 lue...
1abd0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
1abe0 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 24 63 6f } elseif {$co
1abf0 64 65 20 3d 3d 20 24 43 6f 6e 74 69 6e 75 65 7d de == $Continue}
1ac00 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1ac10 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1ac20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1ac30 55 73 65 20 64 65 66 61 75 6c 74 20 72 6f 77 20 Use default row
1ac40 76 61 6c 75 65 20 68 61 6e 64 6c 69 6e 67 2e 0d value handling..
1ac50 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
1ac60 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
1ac70 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 . } els
1ac80 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
1ac90 20 73 65 74 20 63 6f 64 65 20 24 43 6f 6e 74 69 set code $Conti
1aca0 6e 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d nue.. }
1acb0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 .... if
1acc0 20 7b 24 63 6f 64 65 20 3d 3d 20 24 43 6f 6e 74 {$code == $Cont
1acd0 69 6e 75 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 inue} then {..
1ace0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 if {[s
1acf0 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 tring length $va
1ad00 6c 75 65 5d 20 3e 20 30 20 26 26 20 5c 0d 0a 20 lue] > 0 && \..
1ad10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 21 !
1ad20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 43 [object invoke C
1ad30 6f 6e 76 65 72 74 20 49 73 44 42 4e 75 6c 6c 20 onvert IsDBNull
1ad40 24 76 61 6c 75 65 5d 7d 20 74 68 65 6e 20 7b 0d $value]} then {.
1ad50 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6c . l
1ad60 61 70 70 65 6e 64 20 72 6f 77 20 5b 6c 69 73 74 append row [list
1ad70 20 24 6e 61 6d 65 73 28 24 69 6e 64 65 78 29 20 $names($index)
1ad80 5b 24 76 61 6c 75 65 20 54 6f 53 74 72 69 6e 67 [$value ToString
1ad90 5d 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ]]..
1ada0 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
1adb0 20 20 20 20 20 20 20 20 6c 61 70 70 65 6e 64 20 lappend
1adc0 72 6f 77 20 5b 6c 69 73 74 20 24 6e 61 6d 65 73 row [list $names
1add0 28 24 69 6e 64 65 78 29 5d 0d 0a 20 20 20 20 20 ($index)]..
1ade0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1adf0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1ae00 0d 0a 0d 0a 20 20 20 20 20 20 20 20 6c 61 70 70 .... lapp
1ae10 65 6e 64 20 72 6f 77 73 20 24 72 6f 77 0d 0a 20 end rows $row..
1ae20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
1ae30 72 65 74 75 72 6e 20 24 72 6f 77 73 0d 0a 20 20 return $rows..
1ae40 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 }..... proc
1ae50 20 64 75 6d 70 52 6f 77 73 46 72 6f 6d 44 61 74 dumpRowsFromDat
1ae60 61 54 61 62 6c 65 20 7b 20 63 68 61 6e 6e 65 6c aTable { channel
1ae70 20 72 6f 77 73 20 7d 20 7b 0d 0a 20 20 20 20 20 rows } {..
1ae80 20 73 65 74 20 73 65 71 75 65 6e 63 65 20 31 0d set sequence 1.
1ae90 0a 0d 0a 20 20 20 20 20 20 66 6f 72 65 61 63 68 ... foreach
1aea0 20 72 6f 77 20 24 72 6f 77 73 20 7b 0d 0a 20 20 row $rows {..
1aeb0 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1aec0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1aed0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1aee0 5b 65 78 70 72 20 7b 24 73 65 71 75 65 6e 63 65 [expr {$sequence
1aef0 20 3e 20 31 20 3f 20 22 5c 6e 22 20 3a 20 22 22 > 1 ? "\n" : ""
1af00 7d 5d 20 22 2d 2d 2d 2d 20 52 4f 57 20 23 22 20 }] "---- ROW #"
1af10 24 73 65 71 75 65 6e 63 65 20 3a 5c 6e 5d 0d 0a $sequence :\n]..
1af20 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 .. foreac
1af30 68 20 70 61 69 72 20 24 72 6f 77 20 7b 0d 0a 20 h pair $row {..
1af40 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 6c 6c if {[ll
1af50 65 6e 67 74 68 20 24 70 61 69 72 5d 20 3e 3d 20 ength $pair] >=
1af60 32 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 2} then {..
1af70 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
1af80 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
1af90 73 20 5c 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 s \t \..
1afa0 20 20 20 20 20 20 20 20 5b 6c 69 73 74 20 5b 6c [list [l
1afb0 69 6e 64 65 78 20 24 70 61 69 72 20 30 5d 5d 20 index $pair 0]]
1afc0 22 3a 20 22 20 5b 6c 69 73 74 20 5b 6c 69 6e 64 ": " [list [lind
1afd0 65 78 20 24 70 61 69 72 20 31 5d 5d 20 5c 6e 5d ex $pair 1]] \n]
1afe0 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c .. } el
1aff0 73 65 69 66 20 7b 5b 6c 6c 65 6e 67 74 68 20 24 seif {[llength $
1b000 70 61 69 72 5d 20 3d 3d 20 31 7d 20 74 68 65 6e pair] == 1} then
1b010 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1b020 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
1b030 61 70 70 65 6e 64 41 72 67 73 20 5c 74 20 5c 0d appendArgs \t \.
1b040 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1b050 20 5b 6c 69 73 74 20 5b 6c 69 6e 64 65 78 20 24 [list [lindex $
1b060 70 61 69 72 20 30 5d 5d 20 22 3a 20 3c 6e 75 6c pair 0]] ": <nul
1b070 6c 3e 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 l>\n"]..
1b080 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
1b090 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
1b0a0 68 61 6e 6e 65 6c 20 5c 74 3c 65 6d 70 74 79 3e hannel \t<empty>
1b0b0 5c 6e 3b 20 23 20 4e 4f 54 45 3a 20 4e 6f 20 64 \n; # NOTE: No d
1b0c0 61 74 61 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 ata?..
1b0d0 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
1b0e0 20 20 20 20 20 20 20 20 69 6e 63 72 20 73 65 71 incr seq
1b0f0 75 65 6e 63 65 0d 0a 20 20 20 20 20 20 7d 0d 0a uence.. }..
1b100 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
1b110 6f 63 20 63 6c 65 61 6e 75 70 44 62 20 7b 20 66 oc cleanupDb { f
1b120 69 6c 65 4e 61 6d 65 20 7b 76 61 72 4e 61 6d 65 ileName {varName
1b130 20 64 62 7d 20 7b 63 6f 6c 6c 65 63 74 20 74 72 db} {collect tr
1b140 75 65 7d 20 7b 71 75 61 6c 69 66 79 20 74 72 75 ue} {qualify tru
1b150 65 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 e}..
1b160 20 20 20 20 20 20 20 20 20 7b 64 65 6c 65 74 65 {delete
1b170 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 true} } {..
1b180 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1b190 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 66 6f E: Attempt to fo
1b1a0 72 63 65 20 61 6c 6c 20 70 65 6e 64 69 6e 67 20 rce all pending
1b1b0 22 67 61 72 62 61 67 65 22 20 6f 62 6a 65 63 74 "garbage" object
1b1c0 73 20 74 6f 20 62 65 20 63 6f 6c 6c 65 63 74 65 s to be collecte
1b1d0 64 2c 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 d,.. #
1b1e0 20 20 69 6e 63 6c 75 64 69 6e 67 20 53 51 4c 69 including SQLi
1b1f0 74 65 20 73 74 61 74 65 6d 65 6e 74 73 20 61 6e te statements an
1b200 64 20 62 61 63 6b 75 70 20 6f 62 6a 65 63 74 73 d backup objects
1b210 3b 20 74 68 69 73 20 73 68 6f 75 6c 64 20 61 6c ; this should al
1b220 6c 6f 77 0d 0a 20 20 20 20 20 20 23 20 20 20 20 low.. #
1b230 20 20 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e the underlyin
1b240 67 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 20 g database file
1b250 74 6f 20 62 65 20 64 65 6c 65 74 65 64 2e 0d 0a to be deleted...
1b260 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 #.. i
1b270 66 20 7b 24 63 6f 6c 6c 65 63 74 7d 20 74 68 65 f {$collect} the
1b280 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 63 6f 6c n {.. col
1b290 6c 65 63 74 47 61 72 62 61 67 65 20 24 3a 3a 74 lectGarbage $::t
1b2a0 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 20 20 20 est_channel..
1b2b0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d }.... #.
1b2c0 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 . # NOTE: R
1b2d0 65 66 65 72 20 74 6f 20 74 68 65 20 73 70 65 63 efer to the spec
1b2e0 69 66 69 65 64 20 76 61 72 69 61 62 6c 65 20 28 ified variable (
1b2f0 65 2e 67 2e 20 22 64 62 22 29 20 69 6e 20 74 68 e.g. "db") in th
1b300 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 6f 75 72 e context of our
1b310 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
1b320 63 61 6c 6c 65 72 2e 20 20 54 68 65 20 68 61 6e caller. The han
1b330 64 6c 65 20 74 6f 20 74 68 65 20 64 61 74 61 62 dle to the datab
1b340 61 73 65 20 70 72 65 76 69 6f 75 73 6c 79 20 6f ase previously o
1b350 70 65 6e 65 64 20 76 69 61 20 74 68 65 0d 0a 20 pened via the..
1b360 20 20 20 20 20 23 20 20 20 20 20 20 20 5b 73 65 # [se
1b370 74 75 70 44 62 5d 20 70 72 6f 63 65 64 75 72 65 tupDb] procedure
1b380 20 73 68 6f 75 6c 64 20 62 65 20 73 74 6f 72 65 should be store
1b390 64 20 74 68 65 72 65 2e 0d 0a 20 20 20 20 20 20 d there...
1b3a0 23 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 #.. upvar 1
1b3b0 20 24 76 61 72 4e 61 6d 65 20 64 62 0d 0a 0d 0a $varName db....
1b3c0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 #.. #
1b3d0 20 4e 4f 54 45 3a 20 43 6c 6f 73 65 20 74 68 65 NOTE: Close the
1b3e0 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 74 6f 20 74 connection to t
1b3f0 68 65 20 64 61 74 61 62 61 73 65 20 6e 6f 77 2e he database now.
1b400 20 20 54 68 69 73 20 73 68 6f 75 6c 64 20 61 6c This should al
1b410 6c 6f 77 20 75 73 0d 0a 20 20 20 20 20 20 23 20 low us.. #
1b420 20 20 20 20 20 20 74 6f 20 64 65 6c 65 74 65 20 to delete
1b430 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 64 the underlying d
1b440 61 74 61 62 61 73 65 20 66 69 6c 65 2e 0d 0a 20 atabase file...
1b450 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 #.. if
1b460 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 64 {[info exists d
1b470 62 5d 20 26 26 20 5b 63 61 74 63 68 20 7b 73 71 b] && [catch {sq
1b480 6c 20 63 6c 6f 73 65 20 24 64 62 7d 20 65 72 72 l close $db} err
1b490 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 or]} then {..
1b4a0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1b4b0 23 20 4e 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 # NOTE: We someh
1b4c0 6f 77 20 66 61 69 6c 65 64 20 74 6f 20 63 6c 6f ow failed to clo
1b4d0 73 65 20 74 68 65 20 64 61 74 61 62 61 73 65 2c se the database,
1b4e0 20 72 65 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 report why...
1b4f0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1b500 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
1b510 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1b520 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1b530 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a "==== WARNING:
1b540 20 66 61 69 6c 65 64 20 74 6f 20 63 6c 6f 73 65 failed to close
1b550 20 64 61 74 61 62 61 73 65 20 5c 22 22 20 24 64 database \"" $d
1b560 62 20 22 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 b "\", error: "
1b570 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 5c \.. \
1b580 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a n\t $error \n]..
1b590 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
1b5a0 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
1b5b0 3a 20 46 69 72 73 74 2c 20 73 65 65 20 69 66 20 : First, see if
1b5c0 6f 75 72 20 63 61 6c 6c 65 72 20 68 61 73 20 72 our caller has r
1b5d0 65 71 75 65 73 74 65 64 20 61 6e 20 69 6e 2d 6d equested an in-m
1b5e0 65 6d 6f 72 79 20 64 61 74 61 62 61 73 65 2e 0d emory database..
1b5f0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
1b600 73 65 74 20 69 73 4d 65 6d 6f 72 79 20 5b 69 73 set isMemory [is
1b610 4d 65 6d 6f 72 79 44 62 20 24 66 69 6c 65 4e 61 MemoryDb $fileNa
1b620 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a me].... #..
1b630 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 # NOTE: Bu
1b640 69 6c 64 20 74 68 65 20 66 75 6c 6c 20 70 61 74 ild the full pat
1b650 68 20 74 6f 20 74 68 65 20 64 61 74 61 62 61 73 h to the databas
1b660 65 20 66 69 6c 65 20 6e 61 6d 65 2e 20 20 46 6f e file name. Fo
1b670 72 20 6e 6f 77 2c 20 61 6c 6c 20 74 65 73 74 0d r now, all test.
1b680 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 . # d
1b690 61 74 61 62 61 73 65 20 66 69 6c 65 73 20 61 72 atabase files ar
1b6a0 65 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 e stored in the
1b6b0 74 65 6d 70 6f 72 61 72 79 20 64 69 72 65 63 74 temporary direct
1b6c0 6f 72 79 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ory... #..
1b6d0 20 20 20 20 20 69 66 20 7b 21 24 69 73 4d 65 6d if {!$isMem
1b6e0 6f 72 79 20 26 26 20 24 71 75 61 6c 69 66 79 7d ory && $qualify}
1b6f0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1b700 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 5b 66 set fileName [f
1b710 69 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 44 61 74 ile join [getDat
1b720 61 62 61 73 65 44 69 72 65 63 74 6f 72 79 5d 20 abaseDirectory]
1b730 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 [file tail $file
1b740 4e 61 6d 65 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d Name]].. }.
1b750 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
1b760 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 # NOTE: Check
1b770 69 66 20 74 68 65 20 66 69 6c 65 20 73 74 69 6c if the file stil
1b780 6c 20 65 78 69 73 74 73 3b 20 69 6e 69 74 69 61 l exists; initia
1b790 6c 6c 79 2c 20 61 73 73 75 6d 65 20 61 6c 6c 20 lly, assume all
1b7a0 66 69 6c 65 73 20 77 69 6c 6c 0d 0a 20 20 20 20 files will..
1b7b0 20 20 23 20 20 20 20 20 20 20 62 65 20 64 65 6c # be del
1b7c0 65 74 65 64 20 73 75 63 63 65 73 73 66 75 6c 6c eted successfull
1b7d0 79 2c 20 69 66 20 6e 65 63 65 73 73 61 72 79 2e y, if necessary.
1b7e0 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
1b7f0 20 73 65 74 20 73 75 63 63 65 73 73 20 74 72 75 set success tru
1b800 65 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 e.... if {!
1b810 24 69 73 4d 65 6d 6f 72 79 20 26 26 20 24 64 65 $isMemory && $de
1b820 6c 65 74 65 20 26 26 20 5b 66 69 6c 65 20 65 78 lete && [file ex
1b830 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 5d 7d ists $fileName]}
1b840 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1b850 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
1b860 54 45 3a 20 53 6b 69 70 20 64 65 6c 65 74 69 6e TE: Skip deletin
1b870 67 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 73 g database files
1b880 20 69 66 20 73 6f 6d 65 62 6f 64 79 20 73 65 74 if somebody set
1b890 73 20 74 68 65 20 67 6c 6f 62 61 6c 0d 0a 20 20 s the global..
1b8a0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 61 # va
1b8b0 72 69 61 62 6c 65 20 74 6f 20 70 72 65 76 65 6e riable to preven
1b8c0 74 20 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 t it... #
1b8d0 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b .. if {![
1b8e0 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
1b8f0 28 63 6c 65 61 6e 75 70 44 62 46 69 6c 65 73 29 (cleanupDbFiles)
1b900 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1b910 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1b920 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 # NOTE: Attemp
1b930 74 20 74 6f 20 64 65 6c 65 74 65 20 74 68 65 20 t to delete the
1b940 74 65 73 74 20 57 41 4c 20 66 69 6c 65 2c 20 69 test WAL file, i
1b950 66 20 61 6e 79 2c 20 6e 6f 77 2e 0d 0a 20 20 20 f any, now...
1b960 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1b970 20 20 20 20 73 65 74 20 77 61 6c 46 69 6c 65 4e set walFileN
1b980 61 6d 65 20 5b 61 70 70 65 6e 64 41 72 67 73 20 ame [appendArgs
1b990 24 66 69 6c 65 4e 61 6d 65 20 2d 77 61 6c 5d 0d $fileName -wal].
1b9a0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 ... if
1b9b0 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 77 {[file exists $w
1b9c0 61 6c 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 alFileName]} the
1b9d0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1b9e0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
1b9f0 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 65 72 65 # NOTE: If there
1ba00 20 69 73 20 61 20 57 41 4c 20 66 69 6c 65 2c 20 is a WAL file,
1ba10 69 74 20 73 68 6f 75 6c 64 20 62 65 20 7a 65 72 it should be zer
1ba20 6f 20 62 79 74 65 73 20 61 74 20 74 68 69 73 0d o bytes at this.
1ba30 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 . #
1ba40 20 20 20 20 20 70 6f 69 6e 74 2e 0d 0a 20 20 20 point...
1ba50 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
1ba60 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 65 74 if {[set
1ba70 20 73 69 7a 65 20 5b 66 69 6c 65 20 73 69 7a 65 size [file size
1ba80 20 24 77 61 6c 46 69 6c 65 4e 61 6d 65 5d 5d 20 $walFileName]]
1ba90 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
1baa0 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
1bab0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e # N
1bac0 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 20 OTE: We somehow
1bad0 66 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 failed to delete
1bae0 20 74 68 65 20 57 41 4c 20 66 69 6c 65 2c 20 72 the WAL file, r
1baf0 65 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 20 20 eport why...
1bb00 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
1bb10 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b if {[
1bb20 63 61 74 63 68 20 7b 66 69 6c 65 20 64 65 6c 65 catch {file dele
1bb30 74 65 20 24 77 61 6c 46 69 6c 65 4e 61 6d 65 7d te $walFileName}
1bb40 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d error]} then {.
1bb50 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1bb60 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
1bb70 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
1bb80 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
1bb90 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
1bba0 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
1bbb0 74 6f 20 64 65 6c 65 74 65 20 57 41 4c 20 66 69 to delete WAL fi
1bbc0 6c 65 20 5c 22 22 20 24 77 61 6c 46 69 6c 65 4e le \"" $walFileN
1bbd0 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ame \..
1bbe0 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 64 "\" d
1bbf0 75 72 69 6e 67 20 63 6c 65 61 6e 75 70 2c 20 65 uring cleanup, e
1bc00 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 rror: " \n\t $er
1bc10 72 6f 72 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 ror \n]....
1bc20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73 set s
1bc30 75 63 63 65 73 73 20 66 61 6c 73 65 0d 0a 20 20 uccess false..
1bc40 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
1bc50 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 } els
1bc60 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
1bc70 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
1bc80 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
1bc90 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1bca0 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
1bcb0 57 41 52 4e 49 4e 47 3a 20 57 41 4c 20 66 69 6c WARNING: WAL fil
1bcc0 65 20 5c 22 22 20 24 77 61 6c 46 69 6c 65 4e 61 e \"" $walFileNa
1bcd0 6d 65 20 22 5c 22 20 69 73 20 22 20 24 73 69 7a me "\" is " $siz
1bce0 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
1bcf0 20 20 20 20 20 20 20 22 20 62 79 74 65 73 20 69 " bytes i
1bd00 6e 20 73 69 7a 65 2c 20 73 6b 69 70 70 69 6e 67 n size, skipping
1bd10 20 61 6c 6c 20 66 69 6c 65 20 64 65 6c 65 74 69 all file deleti
1bd20 6f 6e 73 2e 2e 2e 5c 6e 22 5d 0d 0a 0d 0a 20 20 ons...\n"]....
1bd30 20 20 20 20 20 20 20 20 20 20 20 20 72 65 74 75 retu
1bd40 72 6e 20 31 3b 20 23 20 65 72 72 6f 72 0d 0a 20 rn 1; # error..
1bd50 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
1bd60 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
1bd70 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1bd80 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 # NOTE: Atte
1bd90 6d 70 74 20 74 6f 20 64 65 6c 65 74 65 20 74 68 mpt to delete th
1bda0 65 20 74 65 73 74 20 53 48 4d 20 66 69 6c 65 2c e test SHM file,
1bdb0 20 69 66 20 61 6e 79 2c 20 6e 6f 77 2e 0d 0a 20 if any, now...
1bdc0 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
1bdd0 20 20 20 20 20 20 73 65 74 20 73 68 6d 46 69 6c set shmFil
1bde0 65 4e 61 6d 65 20 5b 61 70 70 65 6e 64 41 72 67 eName [appendArg
1bdf0 73 20 24 66 69 6c 65 4e 61 6d 65 20 2d 73 68 6d s $fileName -shm
1be00 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 ].... i
1be10 66 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 f {[file exists
1be20 24 73 68 6d 46 69 6c 65 4e 61 6d 65 5d 20 26 26 $shmFileName] &&
1be30 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1be40 20 20 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 64 [catch {file d
1be50 65 6c 65 74 65 20 24 73 68 6d 46 69 6c 65 4e 61 elete $shmFileNa
1be60 6d 65 7d 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e me} error]} then
1be70 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1be80 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 #.. #
1be90 20 4e 4f 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f NOTE: We someho
1bea0 77 20 66 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 w failed to dele
1beb0 74 65 20 74 68 65 20 53 48 4d 20 66 69 6c 65 2c te the SHM file,
1bec0 20 72 65 70 6f 72 74 20 77 68 79 2e 0d 0a 20 20 report why...
1bed0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
1bee0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1bef0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
1bf00 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1bf10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d "=
1bf20 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 === WARNING: fai
1bf30 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20 53 48 led to delete SH
1bf40 4d 20 66 69 6c 65 20 5c 22 22 20 24 73 68 6d 46 M file \"" $shmF
1bf50 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 ileName \..
1bf60 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 64 "\" d
1bf70 75 72 69 6e 67 20 63 6c 65 61 6e 75 70 2c 20 65 uring cleanup, e
1bf80 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 rror: " \n\t $er
1bf90 72 6f 72 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 ror \n]....
1bfa0 20 20 20 20 20 20 20 73 65 74 20 73 75 63 63 65 set succe
1bfb0 73 73 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 ss false..
1bfc0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
1bfd0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
1bfe0 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 20 # NOTE: Attempt
1bff0 74 6f 20 64 65 6c 65 74 65 20 74 68 65 20 74 65 to delete the te
1c000 73 74 20 64 61 74 61 62 61 73 65 20 66 69 6c 65 st database file
1c010 20 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 20 now...
1c020 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 #.. if
1c030 20 7b 5b 63 61 74 63 68 20 7b 66 69 6c 65 20 64 {[catch {file d
1c040 65 6c 65 74 65 20 24 66 69 6c 65 4e 61 6d 65 7d elete $fileName}
1c050 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b 0d error]} then {.
1c060 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a . #..
1c070 20 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f # NO
1c080 54 45 3a 20 57 65 20 73 6f 6d 65 68 6f 77 20 66 TE: We somehow f
1c090 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20 ailed to delete
1c0a0 74 68 65 20 66 69 6c 65 2c 20 72 65 70 6f 72 74 the file, report
1c0b0 20 77 68 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 why...
1c0c0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
1c0d0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
1c0e0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1c0f0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
1c100 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 "==== WAR
1c110 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 NING: failed to
1c120 64 65 6c 65 74 65 20 64 61 74 61 62 61 73 65 20 delete database
1c130 66 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 file \"" $fileNa
1c140 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 me \..
1c150 20 20 20 20 20 20 22 5c 22 20 64 75 72 69 6e 67 "\" during
1c160 20 63 6c 65 61 6e 75 70 2c 20 65 72 72 6f 72 3a cleanup, error:
1c170 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c " \n\t $error \
1c180 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 n]....
1c190 20 20 73 65 74 20 73 75 63 63 65 73 73 20 66 61 set success fa
1c1a0 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d lse.. }
1c1b0 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
1c1c0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d {.. #.
1c1d0 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 . # NOT
1c1e0 45 3a 20 53 68 6f 77 20 74 68 61 74 20 77 65 20 E: Show that we
1c1f0 73 6b 69 70 70 65 64 20 64 65 6c 65 74 69 6e 67 skipped deleting
1c200 20 74 68 65 20 66 69 6c 65 2e 0d 0a 20 20 20 20 the file...
1c210 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1c220 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
1c230 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
1c240 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1c250 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e "==== WARN
1c260 49 4e 47 3a 20 73 6b 69 70 70 65 64 20 64 65 6c ING: skipped del
1c270 65 74 69 6e 67 20 64 61 74 61 62 61 73 65 20 66 eting database f
1c280 69 6c 65 20 5c 22 22 20 24 66 69 6c 65 4e 61 6d ile \"" $fileNam
1c290 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
1c2a0 20 20 20 22 5c 22 20 64 75 72 69 6e 67 20 63 6c "\" during cl
1c2b0 65 61 6e 75 70 5c 6e 22 5d 0d 0a 20 20 20 20 20 eanup\n"]..
1c2c0 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
1c2d0 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 65 . return [e
1c2e0 78 70 72 20 7b 24 73 75 63 63 65 73 73 20 3f 20 xpr {$success ?
1c2f0 30 20 3a 20 31 7d 5d 0d 0a 20 20 20 20 7d 0d 0a 0 : 1}].. }..
1c300 0c 0d 0a 20 20 20 20 70 72 6f 63 20 73 61 76 65 ... proc save
1c310 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 61 EnvironmentVaria
1c320 62 6c 65 73 20 7b 20 6e 61 6d 65 73 20 7b 76 61 bles { names {va
1c330 72 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d 0a 20 rName ""} } {..
1c340 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
1c350 4e 4f 54 45 3a 20 46 6f 72 20 65 61 63 68 20 6e NOTE: For each n
1c360 61 6d 65 2c 20 64 6f 65 73 20 74 68 65 20 6c 69 ame, does the li
1c370 76 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 ve environment v
1c380 61 72 69 61 62 6c 65 20 65 78 69 73 74 3f 20 20 ariable exist?
1c390 49 66 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 If.. #
1c3a0 20 20 73 6f 2c 20 73 61 76 65 20 74 68 65 20 76 so, save the v
1c3b0 61 6c 75 65 20 66 6f 72 20 6c 61 74 65 72 3b 20 alue for later;
1c3c0 6f 74 68 65 72 77 69 73 65 2c 20 6d 61 6b 65 20 otherwise, make
1c3d0 73 75 72 65 20 74 68 65 20 73 61 76 65 64 0d 0a sure the saved..
1c3e0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 76 61 # va
1c3f0 6c 75 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 lue does not exi
1c400 73 74 20 65 69 74 68 65 72 2e 20 20 54 68 65 20 st either. The
1c410 6c 69 76 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 live environment
1c420 20 76 61 72 69 61 62 6c 65 73 0d 0a 20 20 20 20 variables..
1c430 20 20 23 20 20 20 20 20 20 20 41 52 45 20 4e 4f # ARE NO
1c440 54 20 63 68 61 6e 67 65 64 20 62 79 20 74 68 69 T changed by thi
1c450 73 20 70 72 6f 63 65 64 75 72 65 2e 0d 0a 20 20 s procedure...
1c460 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
1c470 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 {[string length
1c480 24 76 61 72 4e 61 6d 65 5d 20 3d 3d 20 30 7d 20 $varName] == 0}
1c490 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1c4a0 73 65 74 20 76 61 72 4e 61 6d 65 20 73 61 76 65 set varName save
1c4b0 64 45 6e 76 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d dEnv.. }...
1c4c0 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 20 24 . upvar 1 $
1c4d0 76 61 72 4e 61 6d 65 20 73 61 76 65 64 45 6e 76 varName savedEnv
1c4e0 0d 0a 0d 0a 20 20 20 20 20 20 66 6f 72 65 61 63 .... foreac
1c4f0 68 20 6e 61 6d 65 20 24 6e 61 6d 65 73 20 7b 0d h name $names {.
1c500 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 6e . if {[in
1c510 66 6f 20 65 78 69 73 74 73 20 3a 3a 65 6e 76 28 fo exists ::env(
1c520 24 6e 61 6d 65 29 5d 7d 20 74 68 65 6e 20 7b 0d $name)]} then {.
1c530 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 73 . set s
1c540 61 76 65 64 45 6e 76 28 24 6e 61 6d 65 29 20 24 avedEnv($name) $
1c550 3a 3a 65 6e 76 28 24 6e 61 6d 65 29 0d 0a 20 20 ::env($name)..
1c560 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
1c570 20 20 20 20 20 20 20 20 20 20 75 6e 73 65 74 20 unset
1c580 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 73 61 76 65 -nocomplain save
1c590 64 45 6e 76 28 24 6e 61 6d 65 29 0d 0a 20 20 20 dEnv($name)..
1c5a0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d }.. }.
1c5b0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
1c5c0 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 69 # NOTE: This i
1c5d0 73 20 73 65 6c 66 2d 63 6c 65 61 6e 69 6e 67 2e s self-cleaning.
1c5e0 20 20 49 66 20 6e 6f 20 73 61 76 65 64 20 65 6e If no saved en
1c5f0 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 vironment variab
1c600 6c 65 73 20 6e 6f 77 0d 0a 20 20 20 20 20 20 23 les now.. #
1c610 20 20 20 20 20 20 20 65 78 69 73 74 2c 20 72 65 exist, re
1c620 6d 6f 76 65 20 74 68 65 20 61 72 72 61 79 2e 0d move the array..
1c630 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
1c640 69 66 20 7b 5b 61 72 72 61 79 20 73 69 7a 65 20 if {[array size
1c650 73 61 76 65 64 45 6e 76 5d 20 3d 3d 20 30 7d 20 savedEnv] == 0}
1c660 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1c670 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 unset -nocomplai
1c680 6e 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 n savedEnv..
1c690 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
1c6a0 20 20 20 70 72 6f 63 20 72 65 73 74 6f 72 65 45 proc restoreE
1c6b0 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 nvironmentVariab
1c6c0 6c 65 73 20 7b 20 6e 61 6d 65 73 20 7b 76 61 72 les { names {var
1c6d0 4e 61 6d 65 20 22 22 7d 20 7d 20 7b 0d 0a 20 20 Name ""} } {..
1c6e0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
1c6f0 4f 54 45 3a 20 46 6f 72 20 65 61 63 68 20 6e 61 OTE: For each na
1c700 6d 65 2c 20 64 6f 65 73 20 74 68 65 20 73 61 76 me, does the sav
1c710 65 64 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 ed environment v
1c720 61 72 69 61 62 6c 65 20 65 78 69 73 74 3f 20 20 ariable exist?
1c730 49 66 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 If.. #
1c740 20 20 73 6f 2c 20 72 65 73 74 6f 72 65 20 74 68 so, restore th
1c750 65 20 73 61 76 65 64 20 76 61 6c 75 65 20 61 6e e saved value an
1c760 64 20 75 6e 73 65 74 20 69 74 3b 20 6f 74 68 65 d unset it; othe
1c770 72 77 69 73 65 2c 20 6d 61 6b 65 20 73 75 72 65 rwise, make sure
1c780 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
1c790 74 68 65 20 6c 69 76 65 20 65 6e 76 69 72 6f 6e the live environ
1c7a0 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 20 64 6f ment variable do
1c7b0 65 73 20 6e 6f 74 20 65 78 69 73 74 20 65 69 74 es not exist eit
1c7c0 68 65 72 20 28 69 2e 65 2e 20 69 74 0d 0a 20 20 her (i.e. it..
1c7d0 20 20 20 20 23 20 20 20 20 20 20 20 77 61 73 20 # was
1c7e0 6e 6f 74 20 73 65 74 20 74 6f 20 62 65 67 69 6e not set to begin
1c7f0 20 77 69 74 68 29 2e 20 20 42 6f 74 68 20 73 61 with). Both sa
1c800 76 65 64 20 61 6e 64 20 6c 69 76 65 20 65 6e 76 ved and live env
1c810 69 72 6f 6e 6d 65 6e 74 0d 0a 20 20 20 20 20 20 ironment..
1c820 23 20 20 20 20 20 20 20 76 61 72 69 61 62 6c 65 # variable
1c830 73 20 41 52 45 20 63 68 61 6e 67 65 64 20 62 79 s ARE changed by
1c840 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 2e this procedure.
1c850 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
1c860 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e if {[string len
1c870 67 74 68 20 24 76 61 72 4e 61 6d 65 5d 20 3d 3d gth $varName] ==
1c880 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
1c890 20 20 20 20 73 65 74 20 76 61 72 4e 61 6d 65 20 set varName
1c8a0 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 20 20 savedEnv..
1c8b0 7d 0d 0a 0d 0a 20 20 20 20 20 20 75 70 76 61 72 }.... upvar
1c8c0 20 31 20 24 76 61 72 4e 61 6d 65 20 73 61 76 65 1 $varName save
1c8d0 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 66 6f dEnv.... fo
1c8e0 72 65 61 63 68 20 6e 61 6d 65 20 24 6e 61 6d 65 reach name $name
1c8f0 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 s {.. if
1c900 7b 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 73 61 {[info exists sa
1c910 76 65 64 45 6e 76 28 24 6e 61 6d 65 29 5d 7d 20 vedEnv($name)]}
1c920 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1c930 20 20 73 65 74 20 3a 3a 65 6e 76 28 24 6e 61 6d set ::env($nam
1c940 65 29 20 24 73 61 76 65 64 45 6e 76 28 24 6e 61 e) $savedEnv($na
1c950 6d 65 29 0d 0a 20 20 20 20 20 20 20 20 20 20 75 me).. u
1c960 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e nset -nocomplain
1c970 20 73 61 76 65 64 45 6e 76 28 24 6e 61 6d 65 29 savedEnv($name)
1c980 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
1c990 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 75 6e {.. un
1c9a0 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 set -nocomplain
1c9b0 3a 3a 65 6e 76 28 24 6e 61 6d 65 29 0d 0a 20 20 ::env($name)..
1c9c0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
1c9d0 0d 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 .... #..
1c9e0 20 20 20 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 # NOTE: This
1c9f0 69 73 20 73 65 6c 66 2d 63 6c 65 61 6e 69 6e 67 is self-cleaning
1ca00 2e 20 20 49 66 20 6e 6f 20 73 61 76 65 64 20 65 . If no saved e
1ca10 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 nvironment varia
1ca20 62 6c 65 73 20 6e 6f 77 0d 0a 20 20 20 20 20 20 bles now..
1ca30 23 20 20 20 20 20 20 20 65 78 69 73 74 2c 20 72 # exist, r
1ca40 65 6d 6f 76 65 20 74 68 65 20 61 72 72 61 79 2e emove the array.
1ca50 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 .. #..
1ca60 20 69 66 20 7b 5b 61 72 72 61 79 20 73 69 7a 65 if {[array size
1ca70 20 73 61 76 65 64 45 6e 76 5d 20 3d 3d 20 30 7d savedEnv] == 0}
1ca80 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
1ca90 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 unset -nocompla
1caa0 69 6e 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 in savedEnv..
1cab0 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a }.. }.....
1cac0 20 20 20 20 70 72 6f 63 20 73 61 76 65 45 61 67 proc saveEag
1cad0 6c 65 53 68 65 6c 6c 45 6e 76 69 72 6f 6e 6d 65 leShellEnvironme
1cae0 6e 74 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 75 nt {} {.. u
1caf0 70 76 61 72 20 31 20 73 61 76 65 64 45 6e 76 20 pvar 1 savedEnv
1cb00 73 61 76 65 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 savedEnv....
1cb10 20 20 73 61 76 65 45 6e 76 69 72 6f 6e 6d 65 6e saveEnvironmen
1cb20 74 56 61 72 69 61 62 6c 65 73 20 5b 6c 69 73 74 tVariables [list
1cb30 20 4e 6f 4d 75 74 65 78 65 73 5d 20 73 61 76 65 NoMutexes] save
1cb40 64 45 6e 76 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a dEnv.. }.....
1cb50 20 20 20 20 70 72 6f 63 20 72 65 73 74 6f 72 65 proc restore
1cb60 45 61 67 6c 65 53 68 65 6c 6c 45 6e 76 69 72 6f EagleShellEnviro
1cb70 6e 6d 65 6e 74 20 7b 7d 20 7b 0d 0a 20 20 20 20 nment {} {..
1cb80 20 20 75 70 76 61 72 20 31 20 73 61 76 65 64 45 upvar 1 savedE
1cb90 6e 76 20 73 61 76 65 64 45 6e 76 0d 0a 0d 0a 20 nv savedEnv....
1cba0 20 20 20 20 20 72 65 73 74 6f 72 65 45 6e 76 69 restoreEnvi
1cbb0 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 6c 65 73 ronmentVariables
1cbc0 20 5b 6c 69 73 74 20 4e 6f 4d 75 74 65 78 65 73 [list NoMutexes
1cbd0 5d 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 ] savedEnv..
1cbe0 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 73 }..... proc s
1cbf0 61 76 65 4d 64 61 43 6f 6e 66 69 67 45 6e 76 69 aveMdaConfigEnvi
1cc00 72 6f 6e 6d 65 6e 74 20 7b 7d 20 7b 0d 0a 20 20 ronment {} {..
1cc10 20 20 20 20 75 70 76 61 72 20 31 20 73 61 76 65 upvar 1 save
1cc20 64 45 6e 76 20 73 61 76 65 64 45 6e 76 0d 0a 0d dEnv savedEnv...
1cc30 0a 20 20 20 20 20 20 73 61 76 65 45 6e 76 69 72 . saveEnvir
1cc40 6f 6e 6d 65 6e 74 56 61 72 69 61 62 6c 65 73 20 onmentVariables
1cc50 5b 6c 69 73 74 20 43 4f 4d 50 4c 55 53 5f 4d 44 [list COMPLUS_MD
1cc60 41 5d 20 73 61 76 65 64 45 6e 76 0d 0a 20 20 20 A] savedEnv..
1cc70 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
1cc80 72 65 73 74 6f 72 65 4d 64 61 43 6f 6e 66 69 67 restoreMdaConfig
1cc90 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 7b 7d 20 7b Environment {} {
1cca0 0d 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 20 .. upvar 1
1ccb0 73 61 76 65 64 45 6e 76 20 73 61 76 65 64 45 6e savedEnv savedEn
1ccc0 76 0d 0a 0d 0a 20 20 20 20 20 20 72 65 73 74 6f v.... resto
1ccd0 72 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 72 reEnvironmentVar
1cce0 69 61 62 6c 65 73 20 5b 6c 69 73 74 20 43 4f 4d iables [list COM
1ccf0 50 4c 55 53 5f 4d 44 41 5d 20 73 61 76 65 64 45 PLUS_MDA] savedE
1cd00 6e 76 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 nv.. }.....
1cd10 20 20 70 72 6f 63 20 73 61 76 65 47 65 74 53 65 proc saveGetSe
1cd20 74 74 69 6e 67 56 61 6c 75 65 45 6e 76 69 72 6f ttingValueEnviro
1cd30 6e 6d 65 6e 74 20 7b 7d 20 7b 0d 0a 20 20 20 20 nment {} {..
1cd40 20 20 75 70 76 61 72 20 31 20 73 61 76 65 64 45 upvar 1 savedE
1cd50 6e 76 20 73 61 76 65 64 45 6e 76 0d 0a 0d 0a 20 nv savedEnv....
1cd60 20 20 20 20 20 73 61 76 65 45 6e 76 69 72 6f 6e saveEnviron
1cd70 6d 65 6e 74 56 61 72 69 61 62 6c 65 73 20 5b 6c mentVariables [l
1cd80 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ist \..
1cd90 20 4e 6f 5f 45 78 70 61 6e 64 20 4e 6f 5f 53 51 No_Expand No_SQ
1cda0 4c 69 74 65 47 65 74 53 65 74 74 69 6e 67 56 61 LiteGetSettingVa
1cdb0 6c 75 65 20 4e 6f 5f 53 51 4c 69 74 65 58 6d 6c lue No_SQLiteXml
1cdc0 43 6f 6e 66 69 67 46 69 6c 65 5d 20 5c 0d 0a 20 ConfigFile] \..
1cdd0 20 20 20 20 20 20 20 20 20 73 61 76 65 64 45 6e savedEn
1cde0 76 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 v.. }.....
1cdf0 20 70 72 6f 63 20 72 65 73 74 6f 72 65 47 65 74 proc restoreGet
1ce00 53 65 74 74 69 6e 67 56 61 6c 75 65 45 6e 76 69 SettingValueEnvi
1ce10 72 6f 6e 6d 65 6e 74 20 7b 7d 20 7b 0d 0a 20 20 ronment {} {..
1ce20 20 20 20 20 75 70 76 61 72 20 31 20 73 61 76 65 upvar 1 save
1ce30 64 45 6e 76 20 73 61 76 65 64 45 6e 76 0d 0a 0d dEnv savedEnv...
1ce40 0a 20 20 20 20 20 20 72 65 73 74 6f 72 65 45 6e . restoreEn
1ce50 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 6c vironmentVariabl
1ce60 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 es [list \..
1ce70 20 20 20 20 20 20 4e 6f 5f 45 78 70 61 6e 64 20 No_Expand
1ce80 4e 6f 5f 53 51 4c 69 74 65 47 65 74 53 65 74 74 No_SQLiteGetSett
1ce90 69 6e 67 56 61 6c 75 65 20 4e 6f 5f 53 51 4c 69 ingValue No_SQLi
1cea0 74 65 58 6d 6c 43 6f 6e 66 69 67 46 69 6c 65 5d teXmlConfigFile]
1ceb0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 73 61 \.. sa
1cec0 76 65 64 45 6e 76 0d 0a 20 20 20 20 7d 0d 0a 0c vedEnv.. }...
1ced0 0d 0a 20 20 20 20 70 72 6f 63 20 73 61 76 65 53 .. proc saveS
1cee0 51 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 45 QLiteConnectionE
1cef0 6e 76 69 72 6f 6e 6d 65 6e 74 20 7b 7d 20 7b 0d nvironment {} {.
1cf00 0a 20 20 20 20 20 20 75 70 76 61 72 20 31 20 73 . upvar 1 s
1cf10 61 76 65 64 45 6e 76 20 73 61 76 65 64 45 6e 76 avedEnv savedEnv
1cf20 0d 0a 0d 0a 20 20 20 20 20 20 73 61 76 65 45 6e .... saveEn
1cf30 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 6c vironmentVariabl
1cf40 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 es [list \..
1cf50 20 20 20 20 20 20 44 65 66 61 75 6c 74 46 6c 61 DefaultFla
1cf60 67 73 5f 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 gs_SQLiteConnect
1cf70 69 6f 6e 20 4e 6f 5f 53 51 4c 69 74 65 43 6f 6e ion No_SQLiteCon
1cf80 6e 65 63 74 69 6f 6e 4e 65 77 50 61 72 73 65 72 nectionNewParser
1cf90 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 73 ] \.. s
1cfa0 61 76 65 64 45 6e 76 0d 0a 20 20 20 20 7d 0d 0a avedEnv.. }..
1cfb0 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 65 73 74 ... proc rest
1cfc0 6f 72 65 53 51 4c 69 74 65 43 6f 6e 6e 65 63 74 oreSQLiteConnect
1cfd0 69 6f 6e 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 7b ionEnvironment {
1cfe0 7d 20 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 72 } {.. upvar
1cff0 20 31 20 73 61 76 65 64 45 6e 76 20 73 61 76 65 1 savedEnv save
1d000 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 72 65 dEnv.... re
1d010 73 74 6f 72 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 storeEnvironment
1d020 56 61 72 69 61 62 6c 65 73 20 5b 6c 69 73 74 20 Variables [list
1d030 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 44 65 66 \.. Def
1d040 61 75 6c 74 46 6c 61 67 73 5f 53 51 4c 69 74 65 aultFlags_SQLite
1d050 43 6f 6e 6e 65 63 74 69 6f 6e 20 4e 6f 5f 53 51 Connection No_SQ
1d060 4c 69 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 4e 65 LiteConnectionNe
1d070 77 50 61 72 73 65 72 5d 20 5c 0d 0a 20 20 20 20 wParser] \..
1d080 20 20 20 20 20 20 73 61 76 65 64 45 6e 76 0d 0a savedEnv..
1d090 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
1d0a0 6f 63 20 73 61 76 65 53 51 4c 69 74 65 43 6f 6e oc saveSQLiteCon
1d0b0 76 65 72 74 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 vertEnvironment
1d0c0 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 75 70 76 61 {} {.. upva
1d0d0 72 20 31 20 73 61 76 65 64 45 6e 76 20 73 61 76 r 1 savedEnv sav
1d0e0 65 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 20 73 edEnv.... s
1d0f0 61 76 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 aveEnvironmentVa
1d100 72 69 61 62 6c 65 73 20 5b 6c 69 73 74 20 5c 0d riables [list \.
1d110 0a 20 20 20 20 20 20 20 20 20 20 55 73 65 5f 53 . Use_S
1d120 51 4c 69 74 65 43 6f 6e 76 65 72 74 5f 44 65 66 QLiteConvert_Def
1d130 61 75 6c 74 44 62 54 79 70 65 20 55 73 65 5f 53 aultDbType Use_S
1d140 51 4c 69 74 65 43 6f 6e 76 65 72 74 5f 44 65 66 QLiteConvert_Def
1d150 61 75 6c 74 54 79 70 65 4e 61 6d 65 5d 20 5c 0d aultTypeName] \.
1d160 0a 20 20 20 20 20 20 20 20 20 20 73 61 76 65 64 . saved
1d170 45 6e 76 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 Env.. }.....
1d180 20 20 20 70 72 6f 63 20 72 65 73 74 6f 72 65 53 proc restoreS
1d190 51 4c 69 74 65 43 6f 6e 76 65 72 74 45 6e 76 69 QLiteConvertEnvi
1d1a0 72 6f 6e 6d 65 6e 74 20 7b 7d 20 7b 0d 0a 20 20 ronment {} {..
1d1b0 20 20 20 20 75 70 76 61 72 20 31 20 73 61 76 65 upvar 1 save
1d1c0 64 45 6e 76 20 73 61 76 65 64 45 6e 76 0d 0a 0d dEnv savedEnv...
1d1d0 0a 20 20 20 20 20 20 72 65 73 74 6f 72 65 45 6e . restoreEn
1d1e0 76 69 72 6f 6e 6d 65 6e 74 56 61 72 69 61 62 6c vironmentVariabl
1d1f0 65 73 20 5b 6c 69 73 74 20 5c 0d 0a 20 20 20 20 es [list \..
1d200 20 20 20 20 20 20 55 73 65 5f 53 51 4c 69 74 65 Use_SQLite
1d210 43 6f 6e 76 65 72 74 5f 44 65 66 61 75 6c 74 44 Convert_DefaultD
1d220 62 54 79 70 65 20 55 73 65 5f 53 51 4c 69 74 65 bType Use_SQLite
1d230 43 6f 6e 76 65 72 74 5f 44 65 66 61 75 6c 74 54 Convert_DefaultT
1d240 79 70 65 4e 61 6d 65 5d 20 5c 0d 0a 20 20 20 20 ypeName] \..
1d250 20 20 20 20 20 20 73 61 76 65 64 45 6e 76 0d 0a savedEnv..
1d260 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
1d270 6f 63 20 73 65 74 75 70 44 62 49 6e 74 65 72 72 oc setupDbInterr
1d280 75 70 74 43 61 6c 6c 62 61 63 6b 20 7b 20 63 68 uptCallback { ch
1d290 61 6e 6e 65 6c 20 6c 6f 67 20 7d 20 7b 0d 0a 20 annel log } {..
1d2a0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1d2b0 6e 65 6c 20 22 2d 2d 2d 2d 20 73 65 74 74 69 6e nel "---- settin
1d2c0 67 20 75 70 20 64 65 62 75 67 67 65 72 20 69 6e g up debugger in
1d2d0 74 65 72 72 75 70 74 20 63 61 6c 6c 62 61 63 6b terrupt callback
1d2e0 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 69 ... ".... i
1d2f0 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
1d300 20 20 20 20 20 73 61 76 65 45 6e 76 69 72 6f 6e saveEnviron
1d310 6d 65 6e 74 56 61 72 69 61 62 6c 65 73 20 5b 6c mentVariables [l
1d320 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ist \..
1d330 20 20 20 71 75 69 65 74 46 69 6e 64 49 6e 74 65 quietFindInte
1d340 72 70 72 65 74 65 72 54 65 73 74 50 61 74 68 20 rpreterTestPath
1d350 71 75 69 65 74 53 65 74 75 70 49 6e 74 65 72 70 quietSetupInterp
1d360 72 65 74 65 72 54 65 73 74 50 61 74 68 5d 0d 0a reterTestPath]..
1d370 0d 0a 20 20 20 20 20 20 20 20 74 72 79 20 7b 0d .. try {.
1d380 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
1d390 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1d3a0 50 72 65 76 65 6e 74 20 74 68 65 20 76 65 6e 64 Prevent the vend
1d3b0 6f 72 20 73 63 72 69 70 74 20 66 72 6f 6d 20 62 or script from b
1d3c0 65 69 6e 67 20 6e 6f 69 73 79 20 77 68 65 6e 20 eing noisy when
1d3d0 63 72 65 61 74 69 6e 67 0d 0a 20 20 20 20 20 20 creating..
1d3e0 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 # the
1d3f0 69 73 6f 6c 61 74 65 64 20 69 6e 74 65 72 70 72 isolated interpr
1d400 65 74 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 eter...
1d410 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 #.. se
1d420 74 20 3a 3a 65 6e 76 28 71 75 69 65 74 46 69 6e t ::env(quietFin
1d430 64 49 6e 74 65 72 70 72 65 74 65 72 54 65 73 74 dInterpreterTest
1d440 50 61 74 68 29 20 31 0d 0a 20 20 20 20 20 20 20 Path) 1..
1d450 20 20 20 73 65 74 20 3a 3a 65 6e 76 28 71 75 69 set ::env(qui
1d460 65 74 53 65 74 75 70 49 6e 74 65 72 70 72 65 74 etSetupInterpret
1d470 65 72 54 65 73 74 50 61 74 68 29 20 31 0d 0a 0d erTestPath) 1...
1d480 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
1d490 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1d4a0 4d 61 6b 65 20 73 75 72 65 20 74 68 65 20 73 63 Make sure the sc
1d4b0 72 69 70 74 20 64 65 62 75 67 67 65 72 20 61 6e ript debugger an
1d4c0 64 20 74 68 65 20 69 73 6f 6c 61 74 65 64 20 69 d the isolated i
1d4d0 6e 74 65 72 70 72 65 74 65 72 0d 0a 20 20 20 20 nterpreter..
1d4e0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 72 # ar
1d4f0 65 20 73 65 74 75 70 20 61 6e 64 20 72 65 61 64 e setup and read
1d500 79 20 66 6f 72 20 75 73 65 2e 0d 0a 20 20 20 20 y for use...
1d510 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1d520 20 20 20 64 65 62 75 67 20 73 65 74 75 70 20 74 debug setup t
1d530 72 75 65 20 74 72 75 65 0d 0a 0d 0a 20 20 20 20 rue true....
1d540 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1d550 20 20 20 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 20 # NOTE: Load
1d560 74 68 65 20 6e 65 63 65 73 73 61 72 79 20 70 61 the necessary pa
1d570 63 6b 61 67 65 73 20 69 6e 74 6f 20 74 68 65 20 ckages into the
1d580 69 73 6f 6c 61 74 65 64 20 69 6e 74 65 72 70 72 isolated interpr
1d590 65 74 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 eter...
1d5a0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 64 65 #.. de
1d5b0 62 75 67 20 65 76 61 6c 20 7b 0d 0a 20 20 20 20 bug eval {..
1d5c0 20 20 20 20 20 20 20 20 70 61 63 6b 61 67 65 20 package
1d5d0 72 65 71 75 69 72 65 20 45 61 67 6c 65 0d 0a 20 require Eagle..
1d5e0 20 20 20 20 20 20 20 20 20 20 20 70 61 63 6b 61 packa
1d5f0 67 65 20 72 65 71 75 69 72 65 20 45 61 67 6c 65 ge require Eagle
1d600 2e 4c 69 62 72 61 72 79 0d 0a 20 20 20 20 20 20 .Library..
1d610 20 20 20 20 20 20 70 61 63 6b 61 67 65 20 72 65 package re
1d620 71 75 69 72 65 20 45 61 67 6c 65 2e 54 65 73 74 quire Eagle.Test
1d630 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d .. }...
1d640 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
1d650 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
1d660 43 6f 70 79 20 74 68 65 20 6e 65 63 65 73 73 61 Copy the necessa
1d670 72 79 20 76 61 72 69 61 62 6c 65 73 20 69 6e 74 ry variables int
1d680 6f 20 74 68 65 20 69 73 6f 6c 61 74 65 64 20 69 o the isolated i
1d690 6e 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 20 nterpreter...
1d6a0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1d6b0 20 20 20 20 64 65 62 75 67 20 69 6e 76 6f 6b 65 debug invoke
1d6c0 20 30 20 73 65 74 20 3a 3a 74 65 73 74 5f 63 68 0 set ::test_ch
1d6d0 61 6e 6e 65 6c 20 24 63 68 61 6e 6e 65 6c 3b 20 annel $channel;
1d6e0 23 20 4e 4f 54 45 3a 20 46 6f 72 20 5b 74 70 75 # NOTE: For [tpu
1d6f0 74 73 5d 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ts]...
1d700 64 65 62 75 67 20 69 6e 76 6f 6b 65 20 30 20 73 debug invoke 0 s
1d710 65 74 20 3a 3a 74 65 73 74 5f 6c 6f 67 20 24 6c et ::test_log $l
1d720 6f 67 3b 20 23 20 4e 4f 54 45 3a 20 46 6f 72 20 og; # NOTE: For
1d730 5b 74 6c 6f 67 5d 2e 0d 0a 0d 0a 20 20 20 20 20 [tlog].....
1d740 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1d750 20 20 23 20 4e 4f 54 45 3a 20 49 6e 73 74 61 6c # NOTE: Instal
1d760 6c 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 l the callback s
1d770 63 72 69 70 74 20 74 6f 20 62 65 20 65 76 61 6c cript to be eval
1d780 75 61 74 65 64 20 69 6e 20 74 68 65 20 69 73 6f uated in the iso
1d790 6c 61 74 65 64 0d 0a 20 20 20 20 20 20 20 20 20 lated..
1d7a0 20 23 20 20 20 20 20 20 20 69 6e 74 65 72 70 72 # interpr
1d7b0 65 74 65 72 20 77 68 65 6e 20 74 68 69 73 20 69 eter when this i
1d7c0 6e 74 65 72 70 72 65 74 65 72 20 69 73 20 69 6e nterpreter is in
1d7d0 74 65 72 72 75 70 74 65 64 20 62 79 20 73 63 72 terrupted by scr
1d7e0 69 70 74 0d 0a 20 20 20 20 20 20 20 20 20 20 23 ipt.. #
1d7f0 20 20 20 20 20 20 20 63 61 6e 63 65 6c 6c 61 74 cancellat
1d800 69 6f 6e 2c 20 65 74 63 2e 0d 0a 20 20 20 20 20 ion, etc...
1d810 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
1d820 20 20 64 65 62 75 67 20 63 61 6c 6c 62 61 63 6b debug callback
1d830 20 61 70 70 6c 79 20 7b 7b 73 65 6e 64 65 72 20 apply {{sender
1d840 65 7d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 e} {..
1d850 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
1d860 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 # NOTE: Check i
1d870 66 20 74 68 69 73 20 64 65 62 75 67 67 65 72 20 f this debugger
1d880 63 61 6c 6c 62 61 63 6b 20 69 73 20 6f 6e 65 20 callback is one
1d890 74 68 61 74 20 77 65 20 63 61 72 65 20 61 62 6f that we care abo
1d8a0 75 74 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ut...
1d8b0 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
1d8c0 73 65 74 20 69 6e 74 65 72 72 75 70 74 54 79 70 set interruptTyp
1d8d0 65 73 20 5b 73 70 6c 69 74 20 5b 24 65 20 49 6e es [split [$e In
1d8e0 74 65 72 72 75 70 74 54 79 70 65 5d 20 22 2c 20 terruptType] ",
1d8f0 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 "]....
1d900 20 20 69 66 20 7b 22 43 61 6e 63 65 6c 65 64 22 if {"Canceled"
1d910 20 69 6e 20 24 69 6e 74 65 72 72 75 70 74 54 79 in $interruptTy
1d920 70 65 73 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 pes || \..
1d930 20 20 20 20 20 20 20 20 20 20 22 55 6e 77 6f 75 "Unwou
1d940 6e 64 22 20 69 6e 20 24 69 6e 74 65 72 72 75 70 nd" in $interrup
1d950 74 54 79 70 65 73 7d 20 74 68 65 6e 20 7b 0d 0a tTypes} then {..
1d960 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
1d970 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
1d980 20 4e 4f 54 45 3a 20 4d 61 6b 65 20 73 75 72 65 NOTE: Make sure
1d990 20 74 68 65 20 5b 6f 62 6a 65 63 74 5d 20 63 6f the [object] co
1d9a0 6d 6d 61 6e 64 20 69 73 20 61 76 61 69 6c 61 62 mmand is availab
1d9b0 6c 65 2e 20 20 53 69 6e 63 65 0d 0a 20 20 20 20 le. Since..
1d9c0 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 #
1d9d0 20 20 74 68 69 73 20 69 73 20 61 6e 20 69 73 6f this is an iso
1d9e0 6c 61 74 65 64 20 69 6e 74 65 72 70 72 65 74 65 lated interprete
1d9f0 72 2c 20 63 68 65 63 6b 20 66 6f 72 20 69 74 20 r, check for it
1da00 74 68 65 20 68 61 72 64 0d 0a 20 20 20 20 20 20 the hard..
1da10 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
1da20 77 61 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 way...
1da30 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
1da40 20 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e 67 74 if {[llengt
1da50 68 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e 64 73 h [info commands
1da60 20 6f 62 6a 65 63 74 5d 5d 20 3e 20 30 7d 20 74 object]] > 0} t
1da70 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1da80 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
1da90 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
1daa0 3a 20 49 74 65 72 61 74 65 20 74 68 72 6f 75 67 : Iterate throug
1dab0 68 20 61 6c 6c 20 64 61 74 61 62 61 73 65 20 63 h all database c
1dac0 6f 6e 6e 65 63 74 69 6f 6e 73 20 6b 6e 6f 77 6e onnections known
1dad0 20 74 6f 20 74 68 65 0d 0a 20 20 20 20 20 20 20 to the..
1dae0 20 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 #
1daf0 20 70 61 72 65 6e 74 20 69 6e 74 65 72 70 72 65 parent interpre
1db00 74 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 ter...
1db10 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1db20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
1db30 66 6f 72 65 61 63 68 20 2d 61 6c 69 61 73 20 70 foreach -alias p
1db40 61 69 72 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f air [object invo
1db50 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
1db60 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 blic \..
1db70 20 20 20 20 20 20 20 20 20 20 20 20 24 65 20 49 $e I
1db80 6e 74 65 72 70 72 65 74 65 72 2e 63 6f 6e 6e 65 nterpreter.conne
1db90 63 74 69 6f 6e 73 5d 20 7b 0d 0a 20 20 20 20 20 ctions] {..
1dba0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
1dbb0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1dbc0 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 # NOTE: Attemp
1dbd0 74 20 74 6f 20 63 61 6e 63 65 6c 20 61 6e 79 20 t to cancel any
1dbe0 53 51 4c 20 71 75 65 72 69 65 73 20 69 6e 20 70 SQL queries in p
1dbf0 72 6f 67 72 65 73 73 20 6f 6e 0d 0a 20 20 20 20 rogress on..
1dc00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
1dc10 20 20 20 20 20 20 74 68 69 73 20 64 61 74 61 62 this datab
1dc20 61 73 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0d ase connection..
1dc30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1dc40 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
1dc50 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
1dc60 63 68 20 7b 24 70 61 69 72 20 56 61 6c 75 65 2e ch {$pair Value.
1dc70 43 61 6e 63 65 6c 7d 20 65 72 72 6f 72 5d 7d 20 Cancel} error]}
1dc80 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1dc90 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1dca0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
1dcb0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 6e l [appendArgs \n
1dcc0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1dcd0 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d "===
1dce0 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 = WARNING: faile
1dcf0 64 20 74 6f 20 63 61 6e 63 65 6c 20 71 75 65 72 d to cancel quer
1dd00 79 20 66 6f 72 20 22 20 5c 0d 0a 20 20 20 20 20 y for " \..
1dd10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1dd20 20 20 20 22 63 6f 6e 6e 65 63 74 69 6f 6e 20 5c "connection \
1dd30 22 22 20 5b 24 70 61 69 72 20 4b 65 79 5d 20 22 "" [$pair Key] "
1dd40 5c 22 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c \", error: " \n\
1dd50 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 t \..
1dd60 20 20 20 20 20 20 20 20 20 20 20 20 20 24 65 72 $er
1dd70 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ror \n]..
1dd80 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
1dd90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
1dda0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
1ddb0 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 else {..
1ddc0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1ddd0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
1dde0 61 70 70 65 6e 64 41 72 67 73 20 5c 6e 20 5c 0d appendArgs \n \.
1ddf0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1de00 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 "==== WARNI
1de10 4e 47 3a 20 63 61 6e 6e 6f 74 20 63 61 6e 63 65 NG: cannot cance
1de20 6c 20 61 6e 79 20 71 75 65 72 69 65 73 3a 20 22 l any queries: "
1de30 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1de40 20 20 20 20 20 20 20 20 22 74 68 65 20 5c 22 6f "the \"o
1de50 62 6a 65 63 74 5c 22 20 63 6f 6d 6d 61 6e 64 20 bject\" command
1de60 69 73 20 6e 6f 74 20 61 76 61 69 6c 61 62 6c 65 is not available
1de70 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
1de80 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
1de90 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
1dea0 7d 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 66 69 }}.. } fi
1deb0 6e 61 6c 6c 79 20 7b 0d 0a 20 20 20 20 20 20 20 nally {..
1dec0 20 20 20 72 65 73 74 6f 72 65 45 6e 76 69 72 6f restoreEnviro
1ded0 6e 6d 65 6e 74 56 61 72 69 61 62 6c 65 73 20 5b nmentVariables [
1dee0 6c 69 73 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 list \..
1def0 20 20 20 20 20 20 71 75 69 65 74 46 69 6e 64 49 quietFindI
1df00 6e 74 65 72 70 72 65 74 65 72 54 65 73 74 50 61 nterpreterTestPa
1df10 74 68 20 71 75 69 65 74 53 65 74 75 70 49 6e 74 th quietSetupInt
1df20 65 72 70 72 65 74 65 72 54 65 73 74 50 61 74 68 erpreterTestPath
1df30 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 ].. }..
1df40 20 20 20 20 7d 20 65 72 72 6f 72 5d 20 3d 3d 20 } error] ==
1df50 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
1df60 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 addConstraint
1df70 20 69 6e 74 65 72 72 75 70 74 43 61 6c 6c 62 61 interruptCallba
1df80 63 6b 2e 73 71 6c 69 74 65 33 0d 0a 0d 0a 20 20 ck.sqlite3....
1df90 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1dfa0 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a 20 20 20 20 nnel yes\n..
1dfb0 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
1dfc0 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
1dfd0 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 el [appendArgs "
1dfe0 6e 6f 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c no, error: " \n\
1dff0 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 t $error \n]..
1e000 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d }.. }....
1e010 0a 20 20 20 20 70 72 6f 63 20 63 6c 65 61 6e 75 . proc cleanu
1e020 70 46 69 6c 65 20 7b 20 66 69 6c 65 4e 61 6d 65 pFile { fileName
1e030 20 7b 63 6f 6c 6c 65 63 74 20 74 72 75 65 7d 20 {collect true}
1e040 7b 66 6f 72 63 65 20 66 61 6c 73 65 7d 20 7d 20 {force false} }
1e050 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 {.. #..
1e060 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 # NOTE: Attemp
1e070 74 20 74 6f 20 66 6f 72 63 65 20 61 6c 6c 20 70 t to force all p
1e080 65 6e 64 69 6e 67 20 22 67 61 72 62 61 67 65 22 ending "garbage"
1e090 20 6f 62 6a 65 63 74 73 20 74 6f 20 62 65 20 63 objects to be c
1e0a0 6f 6c 6c 65 63 74 65 64 2c 0d 0a 20 20 20 20 20 ollected,..
1e0b0 20 23 20 20 20 20 20 20 20 69 6e 63 6c 75 64 69 # includi
1e0c0 6e 67 20 53 51 4c 69 74 65 20 73 74 61 74 65 6d ng SQLite statem
1e0d0 65 6e 74 73 20 61 6e 64 20 62 61 63 6b 75 70 20 ents and backup
1e0e0 6f 62 6a 65 63 74 73 3b 20 74 68 69 73 20 73 68 objects; this sh
1e0f0 6f 75 6c 64 20 61 6c 6c 6f 77 0d 0a 20 20 20 20 ould allow..
1e100 20 20 23 20 20 20 20 20 20 20 74 68 65 20 75 6e # the un
1e110 64 65 72 6c 79 69 6e 67 20 64 61 74 61 62 61 73 derlying databas
1e120 65 20 66 69 6c 65 20 74 6f 20 62 65 20 64 65 6c e file to be del
1e130 65 74 65 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a eted... #..
1e140 20 20 20 20 20 20 69 66 20 7b 24 63 6f 6c 6c 65 if {$colle
1e150 63 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 ct} then {..
1e160 20 20 20 20 63 6f 6c 6c 65 63 74 47 61 72 62 61 collectGarba
1e170 67 65 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ge $::test_chann
1e180 65 6c 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 el.. }....
1e190 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
1e1a0 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 NOTE: Check if t
1e1b0 68 65 20 66 69 6c 65 20 73 74 69 6c 6c 20 65 78 he file still ex
1e1c0 69 73 74 73 2e 0d 0a 20 20 20 20 20 20 23 0d 0a ists... #..
1e1d0 20 20 20 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 if {[file
1e1e0 65 78 69 73 74 73 20 24 66 69 6c 65 4e 61 6d 65 exists $fileName
1e1f0 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
1e200 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
1e210 4e 4f 54 45 3a 20 53 6b 69 70 20 64 65 6c 65 74 NOTE: Skip delet
1e220 69 6e 67 20 74 65 73 74 20 66 69 6c 65 73 20 69 ing test files i
1e230 66 20 73 6f 6d 65 62 6f 64 79 20 73 65 74 73 20 f somebody sets
1e240 74 68 65 20 67 6c 6f 62 61 6c 20 76 61 72 69 61 the global varia
1e250 62 6c 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ble.. #
1e260 20 20 20 20 20 74 6f 20 70 72 65 76 65 6e 74 20 to prevent
1e270 69 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a it... #..
1e280 20 20 20 20 20 20 20 20 69 66 20 7b 24 66 6f 72 if {$for
1e290 63 65 20 7c 7c 20 21 5b 69 6e 66 6f 20 65 78 69 ce || ![info exi
1e2a0 73 74 73 20 3a 3a 6e 6f 28 63 6c 65 61 6e 75 70 sts ::no(cleanup
1e2b0 46 69 6c 65 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a File)]} then {..
1e2c0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
1e2d0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 # NOTE: A
1e2e0 74 74 65 6d 70 74 20 74 6f 20 64 65 6c 65 74 65 ttempt to delete
1e2f0 20 74 68 65 20 74 65 73 74 20 66 69 6c 65 20 6e the test file n
1e300 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 ow... #
1e310 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
1e320 5b 73 65 74 20 63 6f 64 65 20 5b 63 61 74 63 68 [set code [catch
1e330 20 7b 66 69 6c 65 20 64 65 6c 65 74 65 20 24 66 {file delete $f
1e340 69 6c 65 4e 61 6d 65 7d 20 65 72 72 6f 72 5d 5d ileName} error]]
1e350 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1e360 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1e370 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 57 65 20 # NOTE: We
1e380 73 6f 6d 65 68 6f 77 20 66 61 69 6c 65 64 20 74 somehow failed t
1e390 6f 20 64 65 6c 65 74 65 20 74 68 65 20 66 69 6c o delete the fil
1e3a0 65 2c 20 72 65 70 6f 72 74 20 77 68 79 2e 0d 0a e, report why...
1e3b0 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 #..
1e3c0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
1e3d0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
1e3e0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1e3f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1e400 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 "==== WARNING: f
1e410 61 69 6c 65 64 20 74 6f 20 64 65 6c 65 74 65 20 ailed to delete
1e420 74 65 73 74 20 66 69 6c 65 20 5c 22 22 20 24 66 test file \"" $f
1e430 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 ileName \..
1e440 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 64 "\" d
1e450 75 72 69 6e 67 20 63 6c 65 61 6e 75 70 2c 20 65 uring cleanup, e
1e460 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 rror: " \n\t $er
1e470 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ror \n]..
1e480 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 }.. }
1e490 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
1e4a0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
1e4b0 20 4e 4f 54 45 3a 20 53 68 6f 77 20 74 68 61 74 NOTE: Show that
1e4c0 20 77 65 20 73 6b 69 70 70 65 64 20 64 65 6c 65 we skipped dele
1e4d0 74 69 6e 67 20 74 68 65 20 66 69 6c 65 2e 0d 0a ting the file...
1e4e0 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
1e4f0 20 20 20 20 20 20 20 73 65 74 20 63 6f 64 65 20 set code
1e500 30 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 74 0.... t
1e510 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
1e520 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1e530 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1e540 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a "==== WARNING:
1e550 20 73 6b 69 70 70 65 64 20 64 65 6c 65 74 69 6e skipped deletin
1e560 67 20 74 65 73 74 20 66 69 6c 65 20 5c 22 22 20 g test file \""
1e570 24 66 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 $fileName \..
1e580 20 20 20 20 20 20 20 20 20 20 20 22 5c 22 20 64 "\" d
1e590 75 72 69 6e 67 20 63 6c 65 61 6e 75 70 5c 6e 22 uring cleanup\n"
1e5a0 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 ].. }..
1e5b0 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
1e5c0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1e5d0 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 66 69 6c # NOTE: The fil
1e5e0 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 e does not exist
1e5f0 2c 20 73 75 63 63 65 73 73 21 0d 0a 20 20 20 20 , success!..
1e600 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 #.. s
1e610 65 74 20 63 6f 64 65 20 30 0d 0a 20 20 20 20 20 et code 0..
1e620 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 }.... retu
1e630 72 6e 20 24 63 6f 64 65 0d 0a 20 20 20 20 7d 0d rn $code.. }.
1e640 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 6c 65 .... proc cle
1e650 61 6e 75 70 4d 65 6d 6f 72 79 20 7b 20 76 61 72 anupMemory { var
1e660 4e 61 6d 65 20 7b 71 75 69 65 74 20 66 61 6c 73 Name {quiet fals
1e670 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 e} } {.. if
1e680 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a {[haveSQLiteObj
1e690 65 63 74 43 6f 6d 6d 61 6e 64 5d 20 26 26 20 5c ectCommand] && \
1e6a0 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 73 74 72 .. [str
1e6b0 69 6e 67 20 6c 65 6e 67 74 68 20 24 76 61 72 4e ing length $varN
1e6c0 61 6d 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ame] > 0} then {
1e6d0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
1e6e0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 65 66 # NOTE: Ref
1e6f0 65 72 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 er to the specif
1e700 69 65 64 20 76 61 72 69 61 62 6c 65 20 28 65 2e ied variable (e.
1e710 67 2e 20 22 63 6f 6e 6e 65 63 74 69 6f 6e 22 29 g. "connection")
1e720 20 69 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 20 in the..
1e730 20 23 20 20 20 20 20 20 20 63 6f 6e 74 65 78 74 # context
1e740 20 6f 66 20 6f 75 72 20 63 61 6c 6c 65 72 2e 20 of our caller.
1e750 20 54 68 65 20 6f 70 61 71 75 65 20 6f 62 6a 65 The opaque obje
1e760 63 74 20 68 61 6e 64 6c 65 20 66 6f 72 20 61 6e ct handle for an
1e770 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
1e780 20 20 41 44 4f 2e 4e 45 54 20 63 6f 6e 6e 65 63 ADO.NET connec
1e790 74 69 6f 6e 20 70 72 65 76 69 6f 75 73 6c 79 20 tion previously
1e7a0 72 65 74 75 72 6e 65 64 20 62 79 20 5b 67 65 74 returned by [get
1e7b0 44 62 43 6f 6e 6e 65 63 74 69 6f 6e 5d 0d 0a 20 DbConnection]..
1e7c0 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 # s
1e7d0 68 6f 75 6c 64 20 62 65 20 73 74 6f 72 65 64 20 hould be stored
1e7e0 74 68 65 72 65 2e 0d 0a 20 20 20 20 20 20 20 20 there...
1e7f0 23 0d 0a 20 20 20 20 20 20 20 20 75 70 76 61 72 #.. upvar
1e800 20 31 20 24 76 61 72 4e 61 6d 65 20 63 6f 6e 6e 1 $varName conn
1e810 65 63 74 69 6f 6e 0d 0a 0d 0a 20 20 20 20 20 20 ection....
1e820 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
1e830 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
1e840 20 69 6e 76 6f 6b 65 20 24 63 6f 6e 6e 65 63 74 invoke $connect
1e850 69 6f 6e 20 52 65 6c 65 61 73 65 4d 65 6d 6f 72 ion ReleaseMemor
1e860 79 0d 0a 20 20 20 20 20 20 20 20 7d 20 72 65 73 y.. } res
1e870 75 6c 74 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ult]} then {..
1e880 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
1e890 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
1e8a0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
1e8b0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
1e8c0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
1e8d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d "=
1e8e0 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 === WARNING: fai
1e8f0 6c 65 64 20 74 6f 20 72 65 6c 65 61 73 65 20 64 led to release d
1e900 61 74 61 62 61 73 65 20 6d 65 6d 6f 72 79 2c 20 atabase memory,
1e910 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 error: " \..
1e920 20 20 20 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 \n\t
1e930 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 $result \n]..
1e940 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
1e950 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
1e960 0a 20 20 20 20 20 20 69 66 20 7b 5b 6c 6c 65 6e . if {[llen
1e970 67 74 68 20 5b 69 6e 66 6f 20 63 6f 6d 6d 61 6e gth [info comman
1e980 64 73 20 64 65 62 75 67 5d 5d 20 3e 20 30 7d 20 ds debug]] > 0}
1e990 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1e9a0 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 if {[catch {..
1e9b0 20 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c 20 uplevel
1e9c0 31 20 5b 6c 69 73 74 20 64 65 62 75 67 20 70 75 1 [list debug pu
1e9d0 72 67 65 5d 0d 0a 20 20 20 20 20 20 20 20 7d 20 rge].. }
1e9e0 72 65 73 75 6c 74 5d 7d 20 74 68 65 6e 20 7b 0d result]} then {.
1e9f0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 . if {!
1ea00 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1ea10 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1ea20 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
1ea30 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
1ea40 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1ea50 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 "==== WARNING:
1ea60 66 61 69 6c 65 64 20 74 6f 20 70 75 72 67 65 20 failed to purge
1ea70 63 61 6c 6c 20 66 72 61 6d 65 2c 20 65 72 72 6f call frame, erro
1ea80 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 r: " \..
1ea90 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 72 65 \n\t $re
1eaa0 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 sult \n]..
1eab0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
1eac0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b .... if {
1ead0 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 [catch {..
1eae0 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 5b 6c uplevel 1 [l
1eaf0 69 73 74 20 64 65 62 75 67 20 63 6c 65 61 6e 75 ist debug cleanu
1eb00 70 5d 0d 0a 20 20 20 20 20 20 20 20 7d 20 72 65 p].. } re
1eb10 73 75 6c 74 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 sult]} then {..
1eb20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
1eb30 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
1eb40 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
1eb50 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
1eb60 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
1eb70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1eb80 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 ==== WARNING: fa
1eb90 69 6c 65 64 20 74 6f 20 63 6c 65 61 6e 75 70 20 iled to cleanup
1eba0 69 6e 74 65 72 70 72 65 74 65 72 2c 20 65 72 72 interpreter, err
1ebb0 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 or: " \..
1ebc0 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 24 72 \n\t $r
1ebd0 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 esult \n]..
1ebe0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
1ebf0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 }.... if
1ec00 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 {[catch {..
1ec10 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 5b uplevel 1 [
1ec20 6c 69 73 74 20 64 65 62 75 67 20 63 6f 6c 6c 65 list debug colle
1ec30 63 74 5d 0d 0a 20 20 20 20 20 20 20 20 7d 20 72 ct].. } r
1ec40 65 73 75 6c 74 5d 7d 20 74 68 65 6e 20 7b 0d 0a esult]} then {..
1ec50 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
1ec60 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
1ec70 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
1ec80 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
1ec90 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1eca0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ecb0 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 "==== WARNING: f
1ecc0 61 69 6c 65 64 20 74 6f 20 63 6f 6c 6c 65 63 74 ailed to collect
1ecd0 20 67 61 72 62 61 67 65 2c 20 65 72 72 6f 72 3a garbage, error:
1ece0 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 " \..
1ecf0 20 20 20 20 20 20 5c 6e 5c 74 20 24 72 65 73 75 \n\t $resu
1ed00 6c 74 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 lt \n]..
1ed10 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
1ed20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a }.. }..
1ed30 0c 0d 0a 20 20 20 20 70 72 6f 63 20 73 65 74 75 ... proc setu
1ed40 70 4d 65 6d 6f 72 79 43 6f 75 6e 74 65 72 73 20 pMemoryCounters
1ed50 7b 20 76 61 72 4e 61 6d 65 20 7d 20 7b 0d 0a 20 { varName } {..
1ed60 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 if {[haveSQ
1ed70 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e LiteObjectComman
1ed80 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 d]} then {..
1ed90 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 72 upvar 1 $var
1eda0 4e 61 6d 65 20 63 6f 75 6e 74 65 72 0d 0a 0d 0a Name counter....
1edb0 20 20 20 20 20 20 20 20 73 65 74 20 63 6f 75 6e set coun
1edc0 74 65 72 28 31 29 20 5b 6f 62 6a 65 63 74 20 63 ter(1) [object c
1edd0 72 65 61 74 65 20 2d 61 6c 69 61 73 20 5c 0d 0a reate -alias \..
1ede0 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
1edf0 65 6d 2e 44 69 61 67 6e 6f 73 74 69 63 73 2e 50 em.Diagnostics.P
1ee00 65 72 66 6f 72 6d 61 6e 63 65 43 6f 75 6e 74 65 erformanceCounte
1ee10 72 20 50 72 6f 63 65 73 73 20 5c 0d 0a 20 20 20 r Process \..
1ee20 20 20 20 20 20 20 20 20 20 22 57 6f 72 6b 69 6e "Workin
1ee30 67 20 53 65 74 22 20 5b 66 69 6c 65 20 72 6f 6f g Set" [file roo
1ee40 74 6e 61 6d 65 20 5b 66 69 6c 65 20 74 61 69 6c tname [file tail
1ee50 20 24 3a 3a 62 69 6e 5f 66 69 6c 65 5d 5d 5d 0d $::bin_file]]].
1ee60 0a 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 63 ... set c
1ee70 6f 75 6e 74 65 72 28 32 29 20 5b 6f 62 6a 65 63 ounter(2) [objec
1ee80 74 20 63 72 65 61 74 65 20 2d 61 6c 69 61 73 20 t create -alias
1ee90 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 \.. S
1eea0 79 73 74 65 6d 2e 44 69 61 67 6e 6f 73 74 69 63 ystem.Diagnostic
1eeb0 73 2e 50 65 72 66 6f 72 6d 61 6e 63 65 43 6f 75 s.PerformanceCou
1eec0 6e 74 65 72 20 50 72 6f 63 65 73 73 20 5c 0d 0a nter Process \..
1eed0 20 20 20 20 20 20 20 20 20 20 20 20 22 57 6f 72 "Wor
1eee0 6b 69 6e 67 20 53 65 74 20 50 65 61 6b 22 20 5b king Set Peak" [
1eef0 66 69 6c 65 20 72 6f 6f 74 6e 61 6d 65 20 5b 66 file rootname [f
1ef00 69 6c 65 20 74 61 69 6c 20 24 3a 3a 62 69 6e 5f ile tail $::bin_
1ef10 66 69 6c 65 5d 5d 5d 0d 0a 0d 0a 20 20 20 20 20 file]]]....
1ef20 20 20 20 73 65 74 20 63 6f 75 6e 74 65 72 28 33 set counter(3
1ef30 29 20 5b 6f 62 6a 65 63 74 20 63 72 65 61 74 65 ) [object create
1ef40 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 20 20 20 20 -alias \..
1ef50 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 69 System.Di
1ef60 61 67 6e 6f 73 74 69 63 73 2e 50 65 72 66 6f 72 agnostics.Perfor
1ef70 6d 61 6e 63 65 43 6f 75 6e 74 65 72 20 50 72 6f manceCounter Pro
1ef80 63 65 73 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 cess \..
1ef90 20 20 20 20 22 50 72 69 76 61 74 65 20 42 79 74 "Private Byt
1efa0 65 73 22 20 5b 66 69 6c 65 20 72 6f 6f 74 6e 61 es" [file rootna
1efb0 6d 65 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 3a me [file tail $:
1efc0 3a 62 69 6e 5f 66 69 6c 65 5d 5d 5d 0d 0a 20 20 :bin_file]]]..
1efd0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 }.... r
1efe0 65 74 75 72 6e 20 22 22 0d 0a 20 20 20 20 7d 0d eturn "".. }.
1eff0 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 65 70 .... proc rep
1f000 6f 72 74 4d 65 6d 6f 72 79 43 6f 75 6e 74 65 72 ortMemoryCounter
1f010 73 20 7b 20 63 68 61 6e 6e 65 6c 20 76 61 72 4e s { channel varN
1f020 61 6d 65 20 70 72 65 66 69 78 20 7d 20 7b 0d 0a ame prefix } {..
1f030 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 if {[haveS
1f040 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 QLiteObjectComma
1f050 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 nd]} then {..
1f060 20 20 20 20 20 75 70 76 61 72 20 31 20 24 76 61 upvar 1 $va
1f070 72 4e 61 6d 65 20 63 6f 75 6e 74 65 72 0d 0a 0d rName counter...
1f080 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
1f090 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
1f0a0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
1f0b0 20 20 20 22 2d 2d 2d 2d 20 22 20 24 70 72 65 66 "---- " $pref
1f0c0 69 78 20 22 20 63 6f 75 6e 74 65 72 20 5c 22 22 ix " counter \""
1f0d0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1f0e0 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 24 [object invoke $
1f0f0 63 6f 75 6e 74 65 72 28 31 29 20 43 6f 75 6e 74 counter(1) Count
1f100 65 72 4e 61 6d 65 5d 20 22 5c 22 20 76 61 6c 75 erName] "\" valu
1f110 65 20 69 73 20 22 20 5c 0d 0a 20 20 20 20 20 20 e is " \..
1f120 20 20 20 20 20 20 5b 6f 62 6a 65 63 74 20 69 6e [object in
1f130 76 6f 6b 65 20 24 63 6f 75 6e 74 65 72 28 31 29 voke $counter(1)
1f140 20 52 61 77 56 61 6c 75 65 5d 20 5c 6e 5d 0d 0a RawValue] \n]..
1f150 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
1f160 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
1f170 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
1f180 20 20 20 20 22 2d 2d 2d 2d 20 22 20 24 70 72 65 "---- " $pre
1f190 66 69 78 20 22 20 63 6f 75 6e 74 65 72 20 5c 22 fix " counter \"
1f1a0 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
1f1b0 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 [object invoke
1f1c0 24 63 6f 75 6e 74 65 72 28 32 29 20 43 6f 75 6e $counter(2) Coun
1f1d0 74 65 72 4e 61 6d 65 5d 20 22 5c 22 20 76 61 6c terName] "\" val
1f1e0 75 65 20 69 73 20 22 20 5c 0d 0a 20 20 20 20 20 ue is " \..
1f1f0 20 20 20 20 20 20 20 5b 6f 62 6a 65 63 74 20 69 [object i
1f200 6e 76 6f 6b 65 20 24 63 6f 75 6e 74 65 72 28 32 nvoke $counter(2
1f210 29 20 52 61 77 56 61 6c 75 65 5d 20 5c 6e 5d 0d ) RawValue] \n].
1f220 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 ... tputs
1f230 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
1f240 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
1f250 20 20 20 20 20 22 2d 2d 2d 2d 20 22 20 24 70 72 "---- " $pr
1f260 65 66 69 78 20 22 20 63 6f 75 6e 74 65 72 20 5c efix " counter \
1f270 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 "" \..
1f280 20 20 5b 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 [object invoke
1f290 20 24 63 6f 75 6e 74 65 72 28 33 29 20 43 6f 75 $counter(3) Cou
1f2a0 6e 74 65 72 4e 61 6d 65 5d 20 22 5c 22 20 76 61 nterName] "\" va
1f2b0 6c 75 65 20 69 73 20 22 20 5c 0d 0a 20 20 20 20 lue is " \..
1f2c0 20 20 20 20 20 20 20 20 5b 6f 62 6a 65 63 74 20 [object
1f2d0 69 6e 76 6f 6b 65 20 24 63 6f 75 6e 74 65 72 28 invoke $counter(
1f2e0 33 29 20 52 61 77 56 61 6c 75 65 5d 20 5c 6e 5d 3) RawValue] \n]
1f2f0 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
1f300 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 6f ..... proc co
1f310 6c 6c 65 63 74 47 61 72 62 61 67 65 20 7b 20 63 llectGarbage { c
1f320 68 61 6e 6e 65 6c 20 7b 6d 69 6c 6c 69 73 65 63 hannel {millisec
1f330 6f 6e 64 73 20 31 30 30 30 7d 20 7b 71 75 69 65 onds 1000} {quie
1f340 74 20 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 t true} } {..
1f350 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 if {[haveSQLi
1f360 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d teObjectCommand]
1f370 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1f380 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
1f390 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
1f3a0 20 69 6e 76 6f 6b 65 20 47 43 20 47 65 74 54 6f invoke GC GetTo
1f3b0 74 61 6c 4d 65 6d 6f 72 79 20 66 61 6c 73 65 0d talMemory false.
1f3c0 0a 20 20 20 20 20 20 20 20 7d 20 72 65 73 75 6c . } resul
1f3d0 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d t] == 0} then {.
1f3e0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 . if {!
1f3f0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
1f400 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
1f410 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
1f420 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
1f430 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
1f440 6d 65 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 79 memory in use by
1f450 20 74 68 65 20 43 4c 52 20 62 65 66 6f 72 65 20 the CLR before
1f460 63 6f 6c 6c 65 63 74 69 6f 6e 2e 2e 2e 20 22 20 collection... "
1f470 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1f480 20 20 20 24 72 65 73 75 6c 74 20 22 20 62 79 74 $result " byt
1f490 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 es\n"]..
1f4a0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 }.. } e
1f4b0 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 lse {..
1f4c0 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
1f4d0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1f4e0 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
1f4f0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
1f500 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1f510 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 "==== WARNING: f
1f520 61 69 6c 65 64 20 74 6f 20 67 65 74 20 43 4c 52 ailed to get CLR
1f530 20 6d 65 6d 6f 72 79 20 75 73 61 67 65 2c 20 65 memory usage, e
1f540 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 20 20 20 rror: " \..
1f550 20 20 20 20 20 20 20 20 20 20 20 5c 6e 5c 74 20 \n\t
1f560 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 $result \n]..
1f570 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
1f580 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
1f590 20 20 20 20 20 20 23 23 23 23 23 23 23 23 23 23 ##########
1f5a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f5b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f5c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f5d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0d ###############.
1f5e0 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
1f5f0 20 20 23 20 4e 4f 54 45 3a 20 52 65 70 65 61 74 # NOTE: Repeat
1f600 65 64 6c 79 20 61 74 74 65 6d 70 74 20 74 6f 20 edly attempt to
1f610 63 6f 6c 6c 65 63 74 20 67 61 72 62 61 67 65 20 collect garbage
1f620 75 6e 74 69 6c 20 74 68 65 20 61 6c 6c 6f 74 74 until the allott
1f630 65 64 20 6e 75 6d 62 65 72 0d 0a 20 20 20 20 20 ed number..
1f640 20 23 20 20 20 20 20 20 20 6f 66 20 6d 69 6c 6c # of mill
1f650 69 73 65 63 6f 6e 64 73 20 68 61 73 20 65 6c 61 iseconds has ela
1f660 70 73 65 64 2e 20 20 41 6c 77 61 79 73 20 61 74 psed. Always at
1f670 74 65 6d 70 74 20 74 6f 20 63 6f 6c 6c 65 63 74 tempt to collect
1f680 20 67 61 72 62 61 67 65 0d 0a 20 20 20 20 20 20 garbage..
1f690 23 20 20 20 20 20 20 20 61 74 20 6c 65 61 73 74 # at least
1f6a0 20 6f 6e 63 65 2e 0d 0a 20 20 20 20 20 20 23 0d once... #.
1f6b0 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 . if {[have
1f6c0 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d SQLiteObjectComm
1f6d0 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 and]} then {..
1f6e0 20 20 20 20 20 20 73 65 74 20 73 74 61 72 74 20 set start
1f6f0 5b 63 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d 0d [clock seconds].
1f700 0a 20 20 20 20 20 20 20 20 73 65 74 20 73 74 6f . set sto
1f710 70 20 5b 65 78 70 72 20 7b 24 73 74 61 72 74 20 p [expr {$start
1f720 2b 20 28 24 6d 69 6c 6c 69 73 65 63 6f 6e 64 73 + ($milliseconds
1f730 20 2f 20 31 30 30 30 29 7d 5d 0d 0a 0d 0a 20 20 / 1000)}]....
1f740 20 20 20 20 20 20 64 6f 20 7b 0d 0a 20 20 20 20 do {..
1f750 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
1f760 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d # NOTE: Attem
1f770 70 74 20 74 6f 20 66 6f 72 63 65 20 61 20 66 75 pt to force a fu
1f780 6c 6c 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 ll garbage colle
1f790 63 74 69 6f 6e 20 6e 6f 77 2e 20 20 52 65 70 6f ction now. Repo
1f7a0 72 74 20 61 6e 79 0d 0a 20 20 20 20 20 20 20 20 rt any..
1f7b0 20 20 23 20 20 20 20 20 20 20 65 72 72 6f 72 20 # error
1f7c0 74 68 61 74 20 69 73 20 65 6e 63 6f 75 6e 74 65 that is encounte
1f7d0 72 65 64 20 69 66 20 77 65 20 66 61 69 6c 2e 0d red if we fail..
1f7e0 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
1f7f0 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 if {[cat
1f800 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
1f810 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
1f820 47 43 20 47 65 74 54 6f 74 61 6c 4d 65 6d 6f 72 GC GetTotalMemor
1f830 79 20 74 72 75 65 0d 0a 20 20 20 20 20 20 20 20 y true..
1f840 20 20 7d 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e } error]} then
1f850 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1f860 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
1f870 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1f880 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
1f890 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
1f8a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1f8b0 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 "==== WARNING
1f8c0 3a 20 66 61 69 6c 65 64 20 66 75 6c 6c 20 67 61 : failed full ga
1f8d0 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e rbage collection
1f8e0 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 , error: " \..
1f8f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1f900 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d \n\t $error \n].
1f910 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
1f920 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
1f930 20 20 20 20 20 20 20 20 20 73 65 74 20 6e 6f 77 set now
1f940 20 5b 63 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d [clock seconds]
1f950 0d 0a 20 20 20 20 20 20 20 20 7d 20 77 68 69 6c .. } whil
1f960 65 20 7b 24 73 74 61 72 74 20 3c 3d 20 24 6e 6f e {$start <= $no
1f970 77 20 26 26 20 24 6e 6f 77 20 3c 20 24 73 74 6f w && $now < $sto
1f980 70 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 p}.. }....
1f990 20 20 20 20 20 23 23 23 23 23 23 23 23 23 23 23 ###########
1f9a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f9b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f9c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
1f9d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0d 0a ##############..
1f9e0 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 .. if {[hav
1f9f0 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d eSQLiteObjectCom
1fa00 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 mand]} then {..
1fa10 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
1fa20 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f h {.. o
1fa30 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 47 43 20 bject invoke GC
1fa40 47 65 74 54 6f 74 61 6c 4d 65 6d 6f 72 79 20 66 GetTotalMemory f
1fa50 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 7d 20 alse.. }
1fa60 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 result] == 0} th
1fa70 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
1fa80 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
1fa90 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1faa0 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
1fab0 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
1fac0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
1fad0 2d 2d 2d 2d 20 6d 65 6d 6f 72 79 20 69 6e 20 75 ---- memory in u
1fae0 73 65 20 62 79 20 74 68 65 20 43 4c 52 20 61 66 se by the CLR af
1faf0 74 65 72 20 63 6f 6c 6c 65 63 74 69 6f 6e 2e 2e ter collection..
1fb00 2e 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 . " \..
1fb10 20 20 20 20 20 20 20 24 72 65 73 75 6c 74 20 22 $result "
1fb20 20 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 bytes\n"]..
1fb30 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
1fb40 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
1fb50 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 if {!$quiet
1fb60 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
1fb70 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
1fb80 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
1fb90 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
1fba0 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e "==== WARNIN
1fbb0 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 67 65 74 G: failed to get
1fbc0 20 43 4c 52 20 6d 65 6d 6f 72 79 20 75 73 61 67 CLR memory usag
1fbd0 65 2c 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 e, error: " \..
1fbe0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c \
1fbf0 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d n\t $result \n].
1fc00 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
1fc10 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
1fc20 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
1fc30 70 72 6f 63 20 67 65 74 53 51 4c 69 74 65 48 61 proc getSQLiteHa
1fc40 6e 64 6c 65 43 6f 75 6e 74 73 20 7b 20 63 68 61 ndleCounts { cha
1fc50 6e 6e 65 6c 20 7b 71 75 69 65 74 20 66 61 6c 73 nnel {quiet fals
1fc60 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 73 65 e} } {.. se
1fc70 74 20 72 65 73 75 6c 74 20 5b 6c 69 73 74 5d 0d t result [list].
1fc80 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 ... if {[ha
1fc90 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 43 6f veSQLiteObjectCo
1fca0 6d 6d 61 6e 64 5d 20 26 26 20 5c 0d 0a 20 20 20 mmand] && \..
1fcb0 20 20 20 20 20 20 20 5b 68 61 76 65 53 51 4c 69 [haveSQLi
1fcc0 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 61 6e 74 teDefineConstant
1fcd0 20 43 4f 55 4e 54 5f 48 41 4e 44 4c 45 5d 7d 20 COUNT_HANDLE]}
1fce0 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
1fcf0 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
1fd00 45 3a 20 41 64 64 20 65 61 63 68 20 63 72 69 74 E: Add each crit
1fd10 69 63 61 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e ical handle coun
1fd20 74 20 74 6f 20 74 68 65 20 72 65 73 75 6c 74 69 t to the resulti
1fd30 6e 67 20 6c 69 73 74 2e 0d 0a 20 20 20 20 20 20 ng list...
1fd40 20 20 23 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 #.. for
1fd50 65 61 63 68 20 6e 61 6d 65 20 5b 6c 69 73 74 20 each name [list
1fd60 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 \.. c
1fd70 6f 6e 6e 65 63 74 69 6f 6e 43 6f 75 6e 74 20 73 onnectionCount s
1fd80 74 61 74 65 6d 65 6e 74 43 6f 75 6e 74 20 62 61 tatementCount ba
1fd90 63 6b 75 70 43 6f 75 6e 74 20 62 6c 6f 62 43 6f ckupCount blobCo
1fda0 75 6e 74 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 unt] {..
1fdb0 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
1fdc0 20 20 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 obje
1fdd0 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
1fde0 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 +NonPublic \..
1fdf0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 S
1fe00 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
1fe10 65 2e 44 65 62 75 67 44 61 74 61 20 24 6e 61 6d e.DebugData $nam
1fe20 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 76 e.. } v
1fe30 61 6c 75 65 5d 20 3d 3d 20 30 7d 20 74 68 65 6e alue] == 0} then
1fe40 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
1fe50 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
1fe60 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
1fe70 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
1fe80 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
1fe90 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1fea0 20 20 20 22 2d 2d 2d 2d 20 63 72 69 74 69 63 61 "---- critica
1feb0 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 20 5c l handle count \
1fec0 22 22 20 24 6e 61 6d 65 20 22 5c 22 20 69 73 20 "" $name "\" is
1fed0 22 20 24 76 61 6c 75 65 20 5c 6e 5d 0d 0a 20 20 " $value \n]..
1fee0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
1fef0 20 20 20 20 20 20 20 20 20 20 20 6c 61 70 70 65 lappe
1ff00 6e 64 20 72 65 73 75 6c 74 20 24 76 61 6c 75 65 nd result $value
1ff10 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c .. } el
1ff20 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
1ff30 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
1ff40 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
1ff50 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
1ff60 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
1ff70 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
1ff80 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 "==== WARNI
1ff90 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 67 65 NG: failed to ge
1ffa0 74 20 63 72 69 74 69 63 61 6c 20 68 61 6e 64 6c t critical handl
1ffb0 65 20 63 6f 75 6e 74 20 5c 22 22 20 5c 0d 0a 20 e count \"" \..
1ffc0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1ffd0 20 24 6e 61 6d 65 20 22 5c 22 2c 20 65 72 72 6f $name "\", erro
1ffe0 72 3a 20 22 20 5c 6e 5c 74 20 24 76 61 6c 75 65 r: " \n\t $value
1fff0 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
20000 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
20010 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
20020 20 20 20 7d 20 65 6c 73 65 69 66 20 7b 21 24 71 } elseif {!$q
20030 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
20040 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
20050 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 61 63 74 # NOTE: The act
20060 75 61 6c 20 68 61 6e 64 6c 65 20 63 6f 75 6e 74 ual handle count
20070 73 20 61 72 65 20 6e 6f 74 20 61 76 61 69 6c 61 s are not availa
20080 62 6c 65 3b 20 74 68 65 72 65 66 6f 72 65 2c 20 ble; therefore,
20090 6a 75 73 74 0d 0a 20 20 20 20 20 20 20 20 23 20 just.. #
200a0 20 20 20 20 20 20 72 65 74 75 72 6e 20 61 6e 20 return an
200b0 65 6d 70 74 79 20 6c 69 73 74 2e 0d 0a 20 20 20 empty list...
200c0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
200d0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 tputs $channel "
200e0 2d 2d 2d 2d 20 63 72 69 74 69 63 61 6c 20 68 61 ---- critical ha
200f0 6e 64 6c 65 20 63 6f 75 6e 74 73 20 75 6e 61 76 ndle counts unav
20100 61 69 6c 61 62 6c 65 5c 6e 22 0d 0a 20 20 20 20 ailable\n"..
20110 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 72 65 74 }.... ret
20120 75 72 6e 20 24 72 65 73 75 6c 74 0d 0a 20 20 20 urn $result..
20130 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
20140 73 68 75 74 64 6f 77 6e 53 51 4c 69 74 65 20 7b shutdownSQLite {
20150 20 63 68 61 6e 6e 65 6c 20 7b 66 6f 72 63 65 20 channel {force
20160 66 61 6c 73 65 7d 20 7b 71 75 69 65 74 20 66 61 false} {quiet fa
20170 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 lse} } {..
20180 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
20190 20 4d 61 6b 65 20 73 75 72 65 20 74 68 61 74 20 Make sure that
201a0 53 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 SQLite core libr
201b0 61 72 79 20 69 73 20 63 6f 6d 70 6c 65 74 65 6c ary is completel
201c0 79 20 73 68 75 74 64 6f 77 6e 2e 20 20 54 68 69 y shutdown. Thi
201d0 73 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 s.. #
201e0 20 69 73 20 75 73 65 64 20 62 79 20 74 65 73 74 is used by test
201f0 73 20 74 68 61 74 20 63 68 61 6e 67 65 20 63 6f s that change co
20200 6e 66 69 67 75 72 61 74 69 6f 6e 20 6f 70 74 69 nfiguration opti
20210 6f 6e 73 20 61 6e 64 2f 6f 72 20 74 68 6f 73 65 ons and/or those
20220 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
20230 74 68 61 74 20 6e 65 65 64 20 74 6f 20 6d 61 6b that need to mak
20240 65 20 73 75 72 65 20 6c 6f 67 67 69 6e 67 20 69 e sure logging i
20250 73 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 28 69 s initialized (i
20260 2e 65 2e 20 6a 75 73 74 20 69 6e 20 63 61 73 65 .e. just in case
20270 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 .. #
20280 74 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 20 the SQLite core
20290 6c 69 62 72 61 72 79 20 77 61 73 20 69 6e 69 74 library was init
202a0 69 61 6c 69 7a 65 64 20 69 6e 20 74 68 65 20 70 ialized in the p
202b0 72 6f 63 65 73 73 20 70 72 69 6f 72 20 74 6f 0d rocess prior to.
202c0 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 . # t
202d0 68 65 20 53 51 4c 69 74 65 4c 6f 67 20 63 6c 61 he SQLiteLog cla
202e0 73 73 20 62 65 69 6e 67 20 61 62 6c 65 20 74 6f ss being able to
202f0 20 73 65 74 75 70 20 69 74 73 20 6c 6f 67 67 69 setup its loggi
20300 6e 67 20 63 61 6c 6c 62 61 63 6b 29 2e 0d 0a 20 ng callback)...
20310 20 20 20 20 20 23 20 20 20 20 20 20 20 4e 6f 72 # Nor
20320 6d 61 6c 6c 79 2c 20 74 68 69 73 20 73 68 6f 75 mally, this shou
20330 6c 64 20 6f 6e 6c 79 20 62 65 20 70 65 72 66 6f ld only be perfo
20340 72 6d 65 64 20 69 66 20 53 51 4c 69 74 65 20 69 rmed if SQLite i
20350 73 20 6c 6f 61 64 65 64 20 61 6e 64 0d 0a 20 20 s loaded and..
20360 20 20 20 20 23 20 20 20 20 20 20 20 72 65 61 64 # read
20370 79 20 66 6f 72 20 75 73 65 20 62 79 20 74 68 65 y for use by the
20380 20 74 65 73 74 20 73 75 69 74 65 2e 0d 0a 20 20 test suite...
20390 20 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 #.. if
203a0 7b 24 66 6f 72 63 65 20 7c 7c 20 5b 69 73 53 51 {$force || [isSQ
203b0 4c 69 74 65 52 65 61 64 79 5d 7d 20 74 68 65 6e LiteReady]} then
203c0 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
203d0 20 20 20 20 20 20 20 23 20 42 55 47 46 49 58 3a # BUGFIX:
203e0 20 4d 61 6b 65 20 73 75 72 65 20 74 68 61 74 20 Make sure that
203f0 61 6e 79 20 22 6c 65 61 6b 65 64 22 20 74 72 61 any "leaked" tra
20400 6e 73 61 63 74 69 6f 6e 73 20 61 6e 64 2f 6f 72 nsactions and/or
20410 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 0d 0a 20 20 connections..
20420 20 20 20 20 20 20 23 20 20 20 20 20 20 20 20 20 #
20430 61 72 65 20 63 6c 65 61 6e 65 64 20 75 70 20 62 are cleaned up b
20440 65 66 6f 72 65 20 63 61 6c 6c 69 6e 67 20 74 68 efore calling th
20450 65 20 6e 61 74 69 76 65 20 73 68 75 74 64 6f 77 e native shutdow
20460 6e 20 66 75 6e 63 74 69 6f 6e 2e 0d 0a 20 20 20 n function...
20470 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
20480 66 6f 72 65 61 63 68 20 74 72 61 6e 73 61 63 74 foreach transact
20490 69 6f 6e 20 5b 69 6e 66 6f 20 74 72 61 6e 73 61 ion [info transa
204a0 63 74 69 6f 6e 73 5d 20 7b 0d 0a 20 20 20 20 20 ctions] {..
204b0 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 if {[string
204c0 20 6d 61 74 63 68 20 5c 0d 0a 20 20 20 20 20 20 match \..
204d0 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 23 44 System#D
204e0 61 74 61 23 53 51 4c 69 74 65 23 53 51 4c 69 74 ata#SQLite#SQLit
204f0 65 54 72 61 6e 73 61 63 74 69 6f 6e 23 2a 20 24 eTransaction#* $
20500 74 72 61 6e 73 61 63 74 69 6f 6e 5d 7d 20 74 68 transaction]} th
20510 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
20520 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
20530 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 71 sq
20540 6c 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 72 6f l transaction ro
20550 6c 6c 62 61 63 6b 20 24 74 72 61 6e 73 61 63 74 llback $transact
20560 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ion..
20570 20 7d 20 65 72 72 6f 72 5d 20 3d 3d 20 30 7d 20 } error] == 0}
20580 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
20590 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
205a0 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
205b0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
205c0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
205d0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
205e0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
205f0 2d 2d 20 72 6f 6c 6c 65 64 20 62 61 63 6b 20 6c -- rolled back l
20600 65 61 6b 65 64 20 74 72 61 6e 73 61 63 74 69 6f eaked transactio
20610 6e 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 n \"" \..
20620 20 20 20 20 20 20 20 20 20 20 20 20 20 24 74 72 $tr
20630 61 6e 73 61 63 74 69 6f 6e 20 5c 22 5c 6e 5d 0d ansaction \"\n].
20640 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
20650 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 .. }
20660 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
20670 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
20680 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
20690 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
206a0 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
206b0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
206c0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d "==
206d0 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c == WARNING: fail
206e0 65 64 20 74 6f 20 72 6f 6c 6c 62 61 63 6b 20 6c ed to rollback l
206f0 65 61 6b 65 64 20 74 72 61 6e 73 61 63 74 69 6f eaked transactio
20700 6e 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 n \"" \..
20710 20 20 20 20 20 20 20 20 20 20 20 20 20 24 74 72 $tr
20720 61 6e 73 61 63 74 69 6f 6e 20 22 5c 22 2c 20 65 ansaction "\", e
20730 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 rror: " \n\t $er
20740 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ror \n]..
20750 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
20760 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
20770 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
20780 0a 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 ... forea
20790 63 68 20 64 62 20 5b 69 6e 66 6f 20 63 6f 6e 6e ch db [info conn
207a0 65 63 74 69 6f 6e 73 5d 20 7b 0d 0a 20 20 20 20 ections] {..
207b0 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
207c0 67 20 6d 61 74 63 68 20 5c 0d 0a 20 20 20 20 20 g match \..
207d0 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 23 System#
207e0 44 61 74 61 23 53 51 4c 69 74 65 23 53 51 4c 69 Data#SQLite#SQLi
207f0 74 65 43 6f 6e 6e 65 63 74 69 6f 6e 23 2a 20 24 teConnection#* $
20800 64 62 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 db]} then {..
20810 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 if {[ca
20820 74 63 68 20 7b 73 71 6c 20 63 6c 6f 73 65 20 24 tch {sql close $
20830 64 62 7d 20 65 72 72 6f 72 5d 20 3d 3d 20 30 7d db} error] == 0}
20840 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
20850 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
20860 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
20870 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
20880 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
20890 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
208a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
208b0 2d 2d 2d 20 63 6c 6f 73 65 64 20 6c 65 61 6b 65 --- closed leake
208c0 64 20 64 61 74 61 62 61 73 65 20 5c 22 22 20 24 d database \"" $
208d0 64 62 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 db \"\n]..
208e0 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
208f0 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
20900 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 . i
20910 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
20920 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
20930 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
20940 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
20950 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
20960 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 4e "==== WARN
20970 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 63 ING: failed to c
20980 6c 6f 73 65 20 6c 65 61 6b 65 64 20 64 61 74 61 lose leaked data
20990 62 61 73 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 base \"" \..
209a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
209b0 24 64 62 20 22 5c 22 2c 20 65 72 72 6f 72 3a 20 $db "\", error:
209c0 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e " \n\t $error \n
209d0 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ]..
209e0 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
209f0 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
20a00 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
20a10 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
20a20 23 20 42 55 47 46 49 58 3a 20 42 65 66 6f 72 65 # BUGFIX: Before
20a30 20 63 61 6c 6c 69 6e 67 20 74 68 65 20 6e 61 74 calling the nat
20a40 69 76 65 20 73 68 75 74 64 6f 77 6e 20 66 75 6e ive shutdown fun
20a50 63 74 69 6f 6e 2c 20 6d 61 6b 65 20 73 75 72 65 ction, make sure
20a60 20 62 6f 74 68 0d 0a 20 20 20 20 20 20 20 20 23 both.. #
20a70 20 20 20 20 20 20 20 20 20 6f 66 20 74 68 65 20 of the
20a80 50 52 41 47 4d 41 20 72 65 6c 61 74 65 64 20 64 PRAGMA related d
20a90 69 72 65 63 74 6f 72 79 20 6e 61 6d 65 73 20 61 irectory names a
20aa0 72 65 20 66 72 65 65 64 2e 0d 0a 20 20 20 20 20 re freed...
20ab0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 63 68 #.. ch
20ac0 65 63 6b 46 6f 72 53 51 4c 69 74 65 44 69 72 65 eckForSQLiteDire
20ad0 63 74 6f 72 69 65 73 20 24 63 68 61 6e 6e 65 6c ctories $channel
20ae0 20 74 72 75 65 0d 0a 0d 0a 20 20 20 20 20 20 20 true....
20af0 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
20b00 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
20b10 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
20b20 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
20b30 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
20b40 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 .Data.SQLite.Uns
20b50 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 afeNativeMethods
20b60 20 73 71 6c 69 74 65 33 5f 73 68 75 74 64 6f 77 sqlite3_shutdow
20b70 6e 0d 0a 20 20 20 20 20 20 20 20 7d 20 72 65 73 n.. } res
20b80 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ult] == 0} then
20b90 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 {.. if
20ba0 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b {!$quiet} then {
20bb0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
20bc0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 uts $channel [ap
20bd0 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
20be0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
20bf0 2d 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 5f 73 - call sqlite3_s
20c00 68 75 74 64 6f 77 6e 28 29 2e 2e 2e 20 6f 6b 3a hutdown()... ok:
20c10 20 22 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a " $result \n]..
20c20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
20c30 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
20c40 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 if {!$q
20c50 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
20c60 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
20c70 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
20c80 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
20c90 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 61 "---- ca
20ca0 6c 6c 20 73 71 6c 69 74 65 33 5f 73 68 75 74 64 ll sqlite3_shutd
20cb0 6f 77 6e 28 29 2e 2e 2e 20 65 72 72 6f 72 3a 20 own()... error:
20cc0 22 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c " \n\t $result \
20cd0 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d n].. }.
20ce0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
20cf0 20 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 }.. }.....
20d00 20 20 20 70 72 6f 63 20 67 65 74 53 65 74 74 69 proc getSetti
20d10 6e 67 52 65 61 64 43 6f 75 6e 74 20 7b 20 6e 61 ngReadCount { na
20d20 6d 65 20 7b 76 69 61 46 69 6c 65 20 66 61 6c 73 me {viaFile fals
20d30 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 20 69 66 e} } {.. if
20d40 20 7b 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e {[haveConstrain
20d50 74 20 62 75 69 6c 64 43 6f 6e 66 69 67 75 72 61 t buildConfigura
20d60 74 69 6f 6e 2e 44 65 62 75 67 5d 20 26 26 20 5b tion.Debug] && [
20d70 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
20d80 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d object invoke -
20d90 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 flags +NonPublic
20da0 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 20 20 20 20 -alias \..
20db0 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 System.Da
20dc0 74 61 2e 53 51 4c 69 74 65 2e 44 65 62 75 67 44 ta.SQLite.DebugD
20dd0 61 74 61 20 47 65 74 53 65 74 74 69 6e 67 52 65 ata GetSettingRe
20de0 61 64 43 6f 75 6e 74 73 20 24 76 69 61 46 69 6c adCounts $viaFil
20df0 65 0d 0a 20 20 20 20 20 20 7d 20 73 65 74 74 69 e.. } setti
20e00 6e 67 52 65 61 64 43 6f 75 6e 74 73 5d 20 3d 3d ngReadCounts] ==
20e10 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
20e20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 if {[string
20e30 6c 65 6e 67 74 68 20 24 6e 61 6d 65 5d 20 3e 20 length $name] >
20e40 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
20e50 20 20 20 20 20 69 66 20 7b 5b 24 73 65 74 74 69 if {[$setti
20e60 6e 67 52 65 61 64 43 6f 75 6e 74 73 20 54 72 79 ngReadCounts Try
20e70 47 65 74 56 61 6c 75 65 20 24 6e 61 6d 65 20 76 GetValue $name v
20e80 61 6c 75 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 alue]} then {..
20e90 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
20ea0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
20eb0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
20ec0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20ed0 22 2d 2d 2d 2d 20 73 65 74 74 69 6e 67 20 5c 22 "---- setting \"
20ee0 22 20 24 6e 61 6d 65 20 22 5c 22 20 77 61 73 20 " $name "\" was
20ef0 72 65 61 64 20 22 20 24 76 61 6c 75 65 20 22 20 read " $value "
20f00 74 69 6d 65 73 22 20 5c 0d 0a 20 20 20 20 20 20 times" \..
20f10 20 20 20 20 20 20 20 20 20 20 5b 65 78 70 72 20 [expr
20f20 7b 24 76 69 61 46 69 6c 65 20 3f 20 22 20 66 72 {$viaFile ? " fr
20f30 6f 6d 20 74 68 65 20 63 6f 6e 66 69 67 75 72 61 om the configura
20f40 74 69 6f 6e 20 66 69 6c 65 22 20 3a 20 22 22 7d tion file" : ""}
20f50 5d 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 ] \n]....
20f60 20 20 20 20 20 72 65 74 75 72 6e 20 24 76 61 6c return $val
20f70 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d ue.. }.
20f80 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 . } else
20f90 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 {.. set
20fa0 20 6e 61 6d 65 43 6f 75 6e 74 20 5b 24 73 65 74 nameCount [$set
20fb0 74 69 6e 67 52 65 61 64 43 6f 75 6e 74 73 20 43 tingReadCounts C
20fc0 6f 75 6e 74 5d 0d 0a 20 20 20 20 20 20 20 20 20 ount]..
20fd0 20 73 65 74 20 76 61 6c 75 65 43 6f 75 6e 74 20 set valueCount
20fe0 30 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 0.... o
20ff0 62 6a 65 63 74 20 66 6f 72 65 61 63 68 20 2d 61 bject foreach -a
21000 6c 69 61 73 20 70 61 69 72 20 24 73 65 74 74 69 lias pair $setti
21010 6e 67 52 65 61 64 43 6f 75 6e 74 73 20 7b 0d 0a ngReadCounts {..
21020 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 63 72 incr
21030 20 76 61 6c 75 65 43 6f 75 6e 74 20 5b 24 70 61 valueCount [$pa
21040 69 72 20 56 61 6c 75 65 5d 0d 0a 0d 0a 20 20 20 ir Value]....
21050 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
21060 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
21070 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
21080 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
21090 2d 2d 2d 20 73 65 74 74 69 6e 67 20 5c 22 22 20 --- setting \""
210a0 5b 24 70 61 69 72 20 4b 65 79 5d 20 22 5c 22 20 [$pair Key] "\"
210b0 77 61 73 20 72 65 61 64 20 22 20 5b 24 70 61 69 was read " [$pai
210c0 72 20 56 61 6c 75 65 5d 20 5c 0d 0a 20 20 20 20 r Value] \..
210d0 20 20 20 20 20 20 20 20 20 20 20 20 22 20 74 69 " ti
210e0 6d 65 73 22 20 5b 65 78 70 72 20 7b 24 76 69 61 mes" [expr {$via
210f0 46 69 6c 65 20 3f 20 22 20 66 72 6f 6d 20 74 68 File ? " from th
21100 65 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 e configuration
21110 66 69 6c 65 22 20 3a 20 5c 0d 0a 20 20 20 20 20 file" : \..
21120 20 20 20 20 20 20 20 20 20 20 20 22 22 7d 5d 20 ""}]
21130 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
21140 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 .... re
21150 74 75 72 6e 20 5b 6c 69 73 74 20 24 6e 61 6d 65 turn [list $name
21160 43 6f 75 6e 74 20 24 76 61 6c 75 65 43 6f 75 6e Count $valueCoun
21170 74 5d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 t].. }..
21180 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
21190 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 6e 67 if {[string leng
211a0 74 68 20 24 6e 61 6d 65 5d 20 3e 20 30 7d 20 74 th $name] > 0} t
211b0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 hen {.. t
211c0 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
211d0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
211e0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
211f0 22 2d 2d 2d 2d 20 73 65 74 74 69 6e 67 20 5c 22 "---- setting \"
21200 22 20 24 6e 61 6d 65 20 22 5c 22 20 77 61 73 20 " $name "\" was
21210 6e 6f 74 20 72 65 61 64 22 20 5b 65 78 70 72 20 not read" [expr
21220 7b 24 76 69 61 46 69 6c 65 20 3f 20 5c 0d 0a 20 {$viaFile ? \..
21230 20 20 20 20 20 20 20 20 20 20 20 22 20 66 72 6f " fro
21240 6d 20 74 68 65 20 63 6f 6e 66 69 67 75 72 61 74 m the configurat
21250 69 6f 6e 20 66 69 6c 65 22 20 3a 20 22 22 7d 5d ion file" : ""}]
21260 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 20 65 6c \n].. } el
21270 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 se {.. tp
21280 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
21290 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
212a0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
212b0 2d 2d 2d 2d 20 6e 6f 20 73 65 74 74 69 6e 67 73 ---- no settings
212c0 20 77 65 72 65 20 72 65 61 64 22 20 5b 65 78 70 were read" [exp
212d0 72 20 7b 24 76 69 61 46 69 6c 65 20 3f 20 5c 0d r {$viaFile ? \.
212e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 20 66 . " f
212f0 72 6f 6d 20 74 68 65 20 63 6f 6e 66 69 67 75 72 rom the configur
21300 61 74 69 6f 6e 20 66 69 6c 65 22 20 3a 20 22 22 ation file" : ""
21310 7d 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d }] \n].. }.
21320 0a 0d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 ... return
21330 2d 31 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 -1.. }.....
21340 20 20 70 72 6f 63 20 67 65 74 4f 74 68 65 72 43 proc getOtherC
21350 6f 75 6e 74 20 7b 20 6e 61 6d 65 20 7d 20 7b 0d ount { name } {.
21360 0a 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 . if {[have
21370 43 6f 6e 73 74 72 61 69 6e 74 20 62 75 69 6c 64 Constraint build
21380 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2e 44 65 Configuration.De
21390 62 75 67 5d 20 26 26 20 5b 63 61 74 63 68 20 7b bug] && [catch {
213a0 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 .. object
213b0 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
213c0 4e 6f 6e 50 75 62 6c 69 63 20 2d 61 6c 69 61 73 NonPublic -alias
213d0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
213e0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
213f0 74 65 2e 44 65 62 75 67 44 61 74 61 20 47 65 74 te.DebugData Get
21400 4f 74 68 65 72 43 6f 75 6e 74 73 0d 0a 20 20 20 OtherCounts..
21410 20 20 20 7d 20 6f 74 68 65 72 43 6f 75 6e 74 73 } otherCounts
21420 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
21430 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 if {[str
21440 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e 61 6d 65 ing length $name
21450 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
21460 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 24 6f if {[$o
21470 74 68 65 72 43 6f 75 6e 74 73 20 54 72 79 47 65 therCounts TryGe
21480 74 56 61 6c 75 65 20 24 6e 61 6d 65 20 76 61 6c tValue $name val
21490 75 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ue]} then {..
214a0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
214b0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
214c0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
214d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
214e0 2d 2d 2d 20 6f 74 68 65 72 20 63 6f 75 6e 74 65 --- other counte
214f0 72 20 5c 22 22 20 24 6e 61 6d 65 20 22 5c 22 20 r \"" $name "\"
21500 68 61 73 20 76 61 6c 75 65 20 22 20 24 76 61 6c has value " $val
21510 75 65 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 ue \n]....
21520 20 20 20 20 20 20 72 65 74 75 72 6e 20 24 76 61 return $va
21530 6c 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 7d lue.. }
21540 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
21550 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 {.. se
21560 74 20 6e 61 6d 65 43 6f 75 6e 74 20 5b 24 6f 74 t nameCount [$ot
21570 68 65 72 43 6f 75 6e 74 73 20 43 6f 75 6e 74 5d herCounts Count]
21580 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
21590 76 61 6c 75 65 43 6f 75 6e 74 20 30 0d 0a 0d 0a valueCount 0....
215a0 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
215b0 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 61 73 20 foreach -alias
215c0 70 61 69 72 20 24 6f 74 68 65 72 43 6f 75 6e 74 pair $otherCount
215d0 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
215e0 20 69 6e 63 72 20 76 61 6c 75 65 43 6f 75 6e 74 incr valueCount
215f0 20 5b 24 70 61 69 72 20 56 61 6c 75 65 5d 0d 0a [$pair Value]..
21600 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 .. tp
21610 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
21620 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
21630 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
21640 20 20 20 22 2d 2d 2d 2d 20 6f 74 68 65 72 20 63 "---- other c
21650 6f 75 6e 74 65 72 20 5c 22 22 20 5b 24 70 61 69 ounter \"" [$pai
21660 72 20 4b 65 79 5d 20 22 5c 22 20 68 61 73 20 76 r Key] "\" has v
21670 61 6c 75 65 20 22 20 5c 0d 0a 20 20 20 20 20 20 alue " \..
21680 20 20 20 20 20 20 20 20 20 20 5b 24 70 61 69 72 [$pair
21690 20 56 61 6c 75 65 5d 20 5c 6e 5d 0d 0a 20 20 20 Value] \n]..
216a0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
216b0 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6c 69 return [li
216c0 73 74 20 24 6e 61 6d 65 43 6f 75 6e 74 20 24 76 st $nameCount $v
216d0 61 6c 75 65 43 6f 75 6e 74 5d 0d 0a 20 20 20 20 alueCount]..
216e0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
216f0 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 .. if {[str
21700 69 6e 67 20 6c 65 6e 67 74 68 20 24 6e 61 6d 65 ing length $name
21710 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 ] > 0} then {..
21720 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
21730 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
21740 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
21750 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6f 74 "---- ot
21760 68 65 72 20 63 6f 75 6e 74 65 72 20 5c 22 22 20 her counter \""
21770 24 6e 61 6d 65 20 22 5c 22 20 68 61 73 20 6e 6f $name "\" has no
21780 20 76 61 6c 75 65 5c 6e 22 5d 0d 0a 20 20 20 20 value\n"]..
21790 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
217a0 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
217b0 74 5f 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 t_channel "----
217c0 74 68 65 72 65 20 61 72 65 20 6e 6f 20 6f 74 68 there are no oth
217d0 65 72 20 63 6f 75 6e 74 65 72 73 5c 6e 22 0d 0a er counters\n"..
217e0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
217f0 20 72 65 74 75 72 6e 20 2d 31 0d 0a 20 20 20 20 return -1..
21800 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 }..... proc r
21810 65 70 6f 72 74 53 51 4c 69 74 65 52 65 73 6f 75 eportSQLiteResou
21820 72 63 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 rces {..
21830 20 20 20 20 63 68 61 6e 6e 65 6c 20 7b 71 75 69 channel {qui
21840 65 74 20 66 61 6c 73 65 7d 20 7b 72 65 73 65 74 et false} {reset
21850 20 74 72 75 65 7d 20 7b 63 6f 6c 6c 65 63 74 20 true} {collect
21860 74 72 75 65 7d 20 7d 20 7b 0d 0a 20 20 20 20 20 true} } {..
21870 20 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 #.. # NOTE
21880 3a 20 49 66 20 70 6f 73 73 69 62 6c 65 2c 20 61 : If possible, a
21890 6c 77 61 79 73 20 72 65 73 65 74 20 74 68 65 20 lways reset the
218a0 63 61 63 68 65 64 20 61 73 73 65 6d 62 6c 79 20 cached assembly
218b0 64 69 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 directory..
218c0 20 23 20 20 20 20 20 20 20 61 6e 64 20 74 68 65 # and the
218d0 20 63 61 63 68 65 64 20 58 4d 4c 20 63 6f 6e 66 cached XML conf
218e0 69 67 75 72 61 74 69 6f 6e 20 66 69 6c 65 20 6e iguration file n
218f0 61 6d 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ame... #..
21900 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 if {[haveSQ
21910 4c 69 74 65 4f 62 6a 65 63 74 43 6f 6d 6d 61 6e LiteObjectComman
21920 64 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 d]} then {..
21930 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
21940 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 .. obje
21950 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
21960 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 +NonPublic \..
21970 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 Sys
21980 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
21990 55 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 UnsafeNativeMeth
219a0 6f 64 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ods \..
219b0 20 20 20 20 20 52 65 73 65 74 43 61 63 68 65 64 ResetCached
219c0 41 73 73 65 6d 62 6c 79 44 69 72 65 63 74 6f 72 AssemblyDirector
219d0 79 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 72 72 y.. } err
219e0 6f 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b or] == 0} then {
219f0 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b .. if {
21a00 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
21a10 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
21a20 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d ts $channel "---
21a30 2d 20 72 65 73 65 74 20 63 61 63 68 65 64 20 61 - reset cached a
21a40 73 73 65 6d 62 6c 79 20 64 69 72 65 63 74 6f 72 ssembly director
21a50 79 5c 6e 22 0d 0a 20 20 20 20 20 20 20 20 20 20 y\n"..
21a60 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 }.. } els
21a70 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 e {.. i
21a80 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
21a90 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
21aa0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
21ab0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
21ac0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d "=
21ad0 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 === WARNING: fai
21ae0 6c 65 64 20 74 6f 20 72 65 73 65 74 20 63 61 63 led to reset cac
21af0 68 65 64 20 61 73 73 65 6d 62 6c 79 20 64 69 72 hed assembly dir
21b00 65 63 74 6f 72 79 2c 20 22 20 5c 0d 0a 20 20 20 ectory, " \..
21b10 20 20 20 20 20 20 20 20 20 20 20 20 20 22 65 72 "er
21b20 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 ror: " \n\t $err
21b30 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 or \n]..
21b40 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
21b50 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 .. if {[c
21b60 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
21b70 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
21b80 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 -flags +NonPubli
21b90 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 c \..
21ba0 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 System.Data.S
21bb0 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e 61 74 69 QLite.UnsafeNati
21bc0 76 65 4d 65 74 68 6f 64 73 20 5c 0d 0a 20 20 20 veMethods \..
21bd0 20 20 20 20 20 20 20 20 20 20 20 52 65 73 65 74 Reset
21be0 43 61 63 68 65 64 58 6d 6c 43 6f 6e 66 69 67 46 CachedXmlConfigF
21bf0 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 ileName..
21c00 20 7d 20 65 72 72 6f 72 5d 20 3d 3d 20 30 7d 20 } error] == 0}
21c10 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
21c20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
21c30 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
21c40 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
21c50 6c 20 22 2d 2d 2d 2d 20 72 65 73 65 74 20 63 61 l "---- reset ca
21c60 63 68 65 64 20 58 4d 4c 20 63 6f 6e 66 69 67 75 ched XML configu
21c70 72 61 74 69 6f 6e 20 66 69 6c 65 20 6e 61 6d 65 ration file name
21c80 5c 6e 22 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n".. }
21c90 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
21ca0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 {.. if
21cb0 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
21cc0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
21cd0 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
21ce0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
21cf0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d "==
21d00 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c == WARNING: fail
21d10 65 64 20 74 6f 20 72 65 73 65 74 20 63 61 63 68 ed to reset cach
21d20 65 64 20 58 4d 4c 20 63 6f 6e 66 69 67 75 72 61 ed XML configura
21d30 74 69 6f 6e 20 22 20 5c 0d 0a 20 20 20 20 20 20 tion " \..
21d40 20 20 20 20 20 20 20 20 20 20 22 66 69 6c 65 20 "file
21d50 6e 61 6d 65 2c 20 65 72 72 6f 72 3a 20 22 20 5c name, error: " \
21d60 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a n\t $error \n]..
21d70 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
21d80 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d }.. }.
21d90 0a 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 ... #..
21da0 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 61 76 61 # NOTE: If ava
21db0 69 6c 61 62 6c 65 2c 20 72 65 70 6f 72 74 20 6f ilable, report o
21dc0 6e 20 28 61 6e 64 20 70 6f 73 73 69 62 6c 79 20 n (and possibly
21dd0 72 65 73 65 74 29 20 74 68 65 20 72 75 6e 74 69 reset) the runti
21de0 6d 65 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 me.. #
21df0 20 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 configuration
21e00 73 74 61 74 69 73 74 69 63 73 2e 0d 0a 20 20 20 statistics...
21e10 20 20 20 23 0d 0a 20 20 20 20 20 20 69 66 20 7b #.. if {
21e20 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 [haveSQLiteObjec
21e30 74 43 6f 6d 6d 61 6e 64 5d 20 26 26 20 5c 0d 0a tCommand] && \..
21e40 20 20 20 20 20 20 20 20 20 20 5b 68 61 76 65 43 [haveC
21e50 6f 6e 73 74 72 61 69 6e 74 20 62 75 69 6c 64 43 onstraint buildC
21e60 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2e 44 65 62 onfiguration.Deb
21e70 75 67 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ug]} then {..
21e80 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
21e90 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a {.. obj
21ea0 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 ect invoke -flag
21eb0 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 2d 61 6c s +NonPublic -al
21ec0 69 61 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ias \..
21ed0 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
21ee0 2e 53 51 4c 69 74 65 2e 44 65 62 75 67 44 61 74 .SQLite.DebugDat
21ef0 61 20 47 65 74 53 65 74 74 69 6e 67 52 65 61 64 a GetSettingRead
21f00 43 6f 75 6e 74 73 20 66 61 6c 73 65 0d 0a 20 20 Counts false..
21f10 20 20 20 20 20 20 7d 20 73 65 74 74 69 6e 67 52 } settingR
21f20 65 61 64 43 6f 75 6e 74 73 5d 20 3d 3d 20 30 7d eadCounts] == 0}
21f30 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
21f40 20 20 20 73 65 74 20 6e 61 6d 65 43 6f 75 6e 74 set nameCount
21f50 20 5b 24 73 65 74 74 69 6e 67 52 65 61 64 43 6f [$settingReadCo
21f60 75 6e 74 73 20 43 6f 75 6e 74 5d 0d 0a 20 20 20 unts Count]..
21f70 20 20 20 20 20 20 20 73 65 74 20 76 61 6c 75 65 set value
21f80 43 6f 75 6e 74 20 30 0d 0a 0d 0a 20 20 20 20 20 Count 0....
21f90 20 20 20 20 20 6f 62 6a 65 63 74 20 66 6f 72 65 object fore
21fa0 61 63 68 20 2d 61 6c 69 61 73 20 70 61 69 72 20 ach -alias pair
21fb0 24 73 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e $settingReadCoun
21fc0 74 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ts {..
21fd0 20 20 69 6e 63 72 20 76 61 6c 75 65 43 6f 75 6e incr valueCoun
21fe0 74 20 5b 24 70 61 69 72 20 56 61 6c 75 65 5d 0d t [$pair Value].
21ff0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 ... i
22000 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
22010 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
22020 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c tputs $channel
22030 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
22040 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
22050 20 20 22 2d 2d 2d 2d 20 73 65 74 74 69 6e 67 20 "---- setting
22060 5c 22 22 20 5b 24 70 61 69 72 20 4b 65 79 5d 20 \"" [$pair Key]
22070 22 5c 22 20 77 61 73 20 72 65 61 64 20 22 20 5c "\" was read " \
22080 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
22090 20 20 20 20 5b 24 70 61 69 72 20 56 61 6c 75 65 [$pair Value
220a0 5d 20 22 20 74 69 6d 65 73 5c 6e 22 5d 0d 0a 20 ] " times\n"]..
220b0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
220c0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
220d0 20 20 20 20 20 20 20 69 66 20 7b 24 72 65 73 65 if {$rese
220e0 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
220f0 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
22100 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 h {..
22110 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
22120 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c -flags +NonPubl
22130 69 63 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 20 20 ic -alias \..
22140 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 S
22150 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
22160 65 2e 44 65 62 75 67 44 61 74 61 20 43 6c 65 61 e.DebugData Clea
22170 72 53 65 74 74 69 6e 67 52 65 61 64 43 6f 75 6e rSettingReadCoun
22180 74 73 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 ts false..
22190 20 20 20 20 20 20 7d 20 65 72 72 6f 72 5d 20 3d } error] =
221a0 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
221b0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
221c0 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
221d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
221e0 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
221f0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
22200 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
22210 20 20 22 2d 2d 2d 2d 20 72 65 73 65 74 20 73 65 "---- reset se
22220 74 74 69 6e 67 20 73 74 61 74 69 73 74 69 63 73 tting statistics
22230 20 66 6f 72 20 74 68 65 20 70 72 65 76 69 6f 75 for the previou
22240 73 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 s " \..
22250 20 20 20 20 20 20 20 20 20 20 20 24 6e 61 6d 65 $name
22260 43 6f 75 6e 74 20 22 20 6e 61 6d 65 73 20 61 6e Count " names an
22270 64 20 22 20 24 76 61 6c 75 65 43 6f 75 6e 74 20 d " $valueCount
22280 22 20 76 61 6c 75 65 73 20 72 65 61 64 5c 6e 22 " values read\n"
22290 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ]..
222a0 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
222b0 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
222c0 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
222d0 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
222e0 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 tpu
222f0 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
22300 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
22310 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
22320 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 66 61 ==== WARNING: fa
22330 69 6c 65 64 20 74 6f 20 72 65 73 65 74 20 73 65 iled to reset se
22340 74 74 69 6e 67 20 73 74 61 74 69 73 74 69 63 73 tting statistics
22350 20 66 6f 72 20 22 20 5c 0d 0a 20 20 20 20 20 20 for " \..
22360 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 74 "t
22370 68 65 20 70 72 65 76 69 6f 75 73 20 22 20 24 6e he previous " $n
22380 61 6d 65 43 6f 75 6e 74 20 22 20 6e 61 6d 65 73 ameCount " names
22390 20 61 6e 64 20 22 20 24 76 61 6c 75 65 43 6f 75 and " $valueCou
223a0 6e 74 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 nt \..
223b0 20 20 20 20 20 20 20 20 20 20 22 20 76 61 6c 75 " valu
223c0 65 73 20 72 65 61 64 2c 20 65 72 72 6f 72 3a 20 es read, error:
223d0 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 5c 6e " \n\t $error \n
223e0 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ]..
223f0 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
22400 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
22410 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
22420 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
22430 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a {.. obj
22440 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 ect invoke -flag
22450 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 2d 61 6c s +NonPublic -al
22460 69 61 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ias \..
22470 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
22480 2e 53 51 4c 69 74 65 2e 44 65 62 75 67 44 61 74 .SQLite.DebugDat
22490 61 20 47 65 74 53 65 74 74 69 6e 67 52 65 61 64 a GetSettingRead
224a0 43 6f 75 6e 74 73 20 74 72 75 65 0d 0a 20 20 20 Counts true..
224b0 20 20 20 20 20 7d 20 73 65 74 74 69 6e 67 46 69 } settingFi
224c0 6c 65 52 65 61 64 43 6f 75 6e 74 73 5d 20 3d 3d leReadCounts] ==
224d0 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
224e0 20 20 20 20 20 20 73 65 74 20 6e 61 6d 65 43 6f set nameCo
224f0 75 6e 74 20 5b 24 73 65 74 74 69 6e 67 46 69 6c unt [$settingFil
22500 65 52 65 61 64 43 6f 75 6e 74 73 20 43 6f 75 6e eReadCounts Coun
22510 74 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 t].. se
22520 74 20 76 61 6c 75 65 43 6f 75 6e 74 20 30 0d 0a t valueCount 0..
22530 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 .. obje
22540 63 74 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 61 ct foreach -alia
22550 73 20 70 61 69 72 20 24 73 65 74 74 69 6e 67 46 s pair $settingF
22560 69 6c 65 52 65 61 64 43 6f 75 6e 74 73 20 7b 0d ileReadCounts {.
22570 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 63 . inc
22580 72 20 76 61 6c 75 65 43 6f 75 6e 74 20 5b 24 70 r valueCount [$p
22590 61 69 72 20 56 61 6c 75 65 5d 0d 0a 0d 0a 20 20 air Value]....
225a0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
225b0 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
225c0 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 tpu
225d0 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
225e0 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
225f0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
22600 2d 2d 20 73 65 74 74 69 6e 67 20 5c 22 22 20 5b -- setting \"" [
22610 24 70 61 69 72 20 4b 65 79 5d 20 22 5c 22 20 77 $pair Key] "\" w
22620 61 73 20 72 65 61 64 20 22 20 5c 0d 0a 20 20 20 as read " \..
22630 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b [
22640 24 70 61 69 72 20 56 61 6c 75 65 5d 20 22 20 74 $pair Value] " t
22650 69 6d 65 73 20 66 72 6f 6d 20 74 68 65 20 63 6f imes from the co
22660 6e 66 69 67 75 72 61 74 69 6f 6e 20 66 69 6c 65 nfiguration file
22670 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
22680 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
22690 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 .... if
226a0 20 7b 24 72 65 73 65 74 7d 20 74 68 65 6e 20 7b {$reset} then {
226b0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
226c0 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
226d0 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
226e0 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b invoke -flags +
226f0 4e 6f 6e 50 75 62 6c 69 63 20 2d 61 6c 69 61 73 NonPublic -alias
22700 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
22710 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 System.Dat
22720 61 2e 53 51 4c 69 74 65 2e 44 65 62 75 67 44 61 a.SQLite.DebugDa
22730 74 61 20 43 6c 65 61 72 53 65 74 74 69 6e 67 52 ta ClearSettingR
22740 65 61 64 43 6f 75 6e 74 73 20 74 72 75 65 0d 0a eadCounts true..
22750 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 72 } er
22760 72 6f 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 ror] == 0} then
22770 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
22780 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
22790 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
227a0 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 tputs $cha
227b0 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
227c0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
227d0 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 72 65 "---- re
227e0 73 65 74 20 73 65 74 74 69 6e 67 20 73 74 61 74 set setting stat
227f0 69 73 74 69 63 73 20 66 6f 72 20 74 68 65 20 70 istics for the p
22800 72 65 76 69 6f 75 73 20 22 20 5c 0d 0a 20 20 20 revious " \..
22810 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
22820 20 24 6e 61 6d 65 43 6f 75 6e 74 20 22 20 6e 61 $nameCount " na
22830 6d 65 73 20 61 6e 64 20 22 20 24 76 61 6c 75 65 mes and " $value
22840 43 6f 75 6e 74 20 22 20 76 61 6c 75 65 73 20 72 Count " values r
22850 65 61 64 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 ead " \..
22860 20 20 20 20 20 20 20 20 20 20 20 20 20 22 66 72 "fr
22870 6f 6d 20 74 68 65 20 63 6f 6e 66 69 67 75 72 61 om the configura
22880 74 69 6f 6e 20 66 69 6c 65 5c 6e 22 5d 0d 0a 20 tion file\n"]..
22890 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a }..
228a0 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c } el
228b0 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
228c0 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
228d0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
228e0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
228f0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
22900 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
22910 20 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d "====
22920 20 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 WARNING: failed
22930 20 74 6f 20 72 65 73 65 74 20 73 65 74 74 69 6e to reset settin
22940 67 20 73 74 61 74 69 73 74 69 63 73 20 66 6f 72 g statistics for
22950 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 " \..
22960 20 20 20 20 20 20 20 20 20 20 22 74 68 65 20 70 "the p
22970 72 65 76 69 6f 75 73 20 22 20 24 6e 61 6d 65 43 revious " $nameC
22980 6f 75 6e 74 20 22 20 6e 61 6d 65 73 20 61 6e 64 ount " names and
22990 20 22 20 24 76 61 6c 75 65 43 6f 75 6e 74 20 5c " $valueCount \
229a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
229b0 20 20 20 20 20 20 22 20 76 61 6c 75 65 73 20 72 " values r
229c0 65 61 64 20 66 72 6f 6d 20 74 68 65 20 63 6f 6e ead from the con
229d0 66 69 67 75 72 61 74 69 6f 6e 20 66 69 6c 65 2c figuration file,
229e0 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 5c error: " \n\t \
229f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
22a00 20 20 20 20 20 20 24 65 72 72 6f 72 20 5c 6e 5d $error \n]
22a10 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
22a20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d }.. }
22a30 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
22a40 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
22a50 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b if {[catch {
22a60 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 .. obje
22a70 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
22a80 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 2d 61 6c 69 +NonPublic -ali
22a90 61 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 as \..
22aa0 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e System.Data.
22ab0 53 51 4c 69 74 65 2e 44 65 62 75 67 44 61 74 61 SQLite.DebugData
22ac0 20 47 65 74 4f 74 68 65 72 43 6f 75 6e 74 73 0d GetOtherCounts.
22ad0 0a 20 20 20 20 20 20 20 20 7d 20 6f 74 68 65 72 . } other
22ae0 43 6f 75 6e 74 73 5d 20 3d 3d 20 30 7d 20 74 68 Counts] == 0} th
22af0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
22b00 73 65 74 20 6e 61 6d 65 43 6f 75 6e 74 20 5b 24 set nameCount [$
22b10 6f 74 68 65 72 43 6f 75 6e 74 73 20 43 6f 75 6e otherCounts Coun
22b20 74 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 t].. se
22b30 74 20 76 61 6c 75 65 43 6f 75 6e 74 20 30 0d 0a t valueCount 0..
22b40 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 .. obje
22b50 63 74 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 61 ct foreach -alia
22b60 73 20 70 61 69 72 20 24 6f 74 68 65 72 43 6f 75 s pair $otherCou
22b70 6e 74 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 nts {..
22b80 20 20 20 69 6e 63 72 20 76 61 6c 75 65 43 6f 75 incr valueCou
22b90 6e 74 20 5b 24 70 61 69 72 20 56 61 6c 75 65 5d nt [$pair Value]
22ba0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
22bb0 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
22bc0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
22bd0 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
22be0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
22bf0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
22c00 20 20 20 22 2d 2d 2d 2d 20 6f 74 68 65 72 20 63 "---- other c
22c10 6f 75 6e 74 65 72 20 5c 22 22 20 5b 24 70 61 69 ounter \"" [$pai
22c20 72 20 4b 65 79 5d 20 22 5c 22 20 68 61 73 20 76 r Key] "\" has v
22c30 61 6c 75 65 20 22 20 5c 0d 0a 20 20 20 20 20 20 alue " \..
22c40 20 20 20 20 20 20 20 20 20 20 20 20 5b 24 70 61 [$pa
22c50 69 72 20 56 61 6c 75 65 5d 20 5c 6e 5d 0d 0a 20 ir Value] \n]..
22c60 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
22c70 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
22c80 20 20 20 20 20 20 20 69 66 20 7b 24 72 65 73 65 if {$rese
22c90 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
22ca0 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 if {[catc
22cb0 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 h {..
22cc0 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
22cd0 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 6c -flags +NonPubl
22ce0 69 63 20 2d 61 6c 69 61 73 20 5c 0d 0a 20 20 20 ic -alias \..
22cf0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 S
22d00 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
22d10 65 2e 44 65 62 75 67 44 61 74 61 20 43 6c 65 61 e.DebugData Clea
22d20 72 4f 74 68 65 72 43 6f 75 6e 74 73 0d 0a 20 20 rOtherCounts..
22d30 20 20 20 20 20 20 20 20 20 20 7d 20 65 72 72 6f } erro
22d40 72 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d r] == 0} then {.
22d50 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 . i
22d60 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e f {!$quiet} then
22d70 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
22d80 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
22d90 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c el [appendArgs \
22da0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
22db0 20 20 20 20 20 20 22 2d 2d 2d 2d 20 72 65 73 65 "---- rese
22dc0 74 20 6f 74 68 65 72 20 63 6f 75 6e 74 65 72 73 t other counters
22dd0 20 66 6f 72 20 74 68 65 20 70 72 65 76 69 6f 75 for the previou
22de0 73 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 s " \..
22df0 20 20 20 20 20 20 20 20 20 20 20 24 6e 61 6d 65 $name
22e00 43 6f 75 6e 74 20 22 20 6e 61 6d 65 73 20 61 6e Count " names an
22e10 64 20 22 20 24 76 61 6c 75 65 43 6f 75 6e 74 20 d " $valueCount
22e20 22 20 76 61 6c 75 65 73 5c 6e 22 5d 0d 0a 20 20 " values\n"]..
22e30 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
22e40 20 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 } els
22e50 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
22e60 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 if {!$quiet}
22e70 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
22e80 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
22e90 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
22ea0 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
22eb0 20 20 20 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 "====
22ec0 57 41 52 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 WARNING: failed
22ed0 74 6f 20 72 65 73 65 74 20 6f 74 68 65 72 20 63 to reset other c
22ee0 6f 75 6e 74 65 72 73 20 66 6f 72 20 22 20 5c 0d ounters for " \.
22ef0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
22f00 20 20 20 20 20 22 74 68 65 20 70 72 65 76 69 6f "the previo
22f10 75 73 20 22 20 24 6e 61 6d 65 43 6f 75 6e 74 20 us " $nameCount
22f20 22 20 6e 61 6d 65 73 20 61 6e 64 20 22 20 24 76 " names and " $v
22f30 61 6c 75 65 43 6f 75 6e 74 20 5c 0d 0a 20 20 20 alueCount \..
22f40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
22f50 20 22 20 76 61 6c 75 65 73 2c 20 65 72 72 6f 72 " values, error
22f60 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 20 : " \n\t $error
22f70 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 \n]..
22f80 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
22f90 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
22fa0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
22fb0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 }.... if
22fc0 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a {[haveSQLiteObj
22fd0 65 63 74 43 6f 6d 6d 61 6e 64 5d 20 26 26 20 5c ectCommand] && \
22fe0 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 68 61 76 .. [hav
22ff0 65 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f 6e eSQLiteDefineCon
23000 73 74 61 6e 74 20 49 4e 54 45 52 4f 50 5f 56 49 stant INTEROP_VI
23010 52 54 55 41 4c 5f 54 41 42 4c 45 5d 20 26 26 20 RTUAL_TABLE] &&
23020 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 68 61 \.. [ha
23030 76 65 53 51 4c 69 74 65 44 65 66 69 6e 65 43 6f veSQLiteDefineCo
23040 6e 73 74 61 6e 74 20 54 52 41 43 4b 5f 4d 45 4d nstant TRACK_MEM
23050 4f 52 59 5f 42 59 54 45 53 5d 7d 20 74 68 65 6e ORY_BYTES]} then
23060 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
23070 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
23080 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
23090 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 $channel "----
230a0 63 75 72 72 65 6e 74 20 6d 65 6d 6f 72 79 20 69 current memory i
230b0 6e 20 75 73 65 20 62 79 20 53 51 4c 69 74 65 4d n use by SQLiteM
230c0 65 6d 6f 72 79 2e 2e 2e 20 22 0d 0a 20 20 20 20 emory... "..
230d0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
230e0 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 if {[catch {..
230f0 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
23100 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
23110 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
23120 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
23130 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c .Data.SQLite.SQL
23140 69 74 65 4d 65 6d 6f 72 79 20 62 79 74 65 73 41 iteMemory bytesA
23150 6c 6c 6f 63 61 74 65 64 0d 0a 20 20 20 20 20 20 llocated..
23160 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 30 } memory] == 0
23170 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
23180 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
23190 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
231a0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
231b0 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
231c0 24 6d 65 6d 6f 72 79 20 22 20 62 79 74 65 73 5c $memory " bytes\
231d0 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d n"].. }
231e0 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 .. } else
231f0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 {.. se
23200 74 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e t memory unknown
23210 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 .... if
23220 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 {!$quiet} then
23230 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
23240 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
23250 70 70 65 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 ppendArgs $memor
23260 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 y \n]..
23270 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
23280 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 . if {!$q
23290 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 uiet} then {..
232a0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
232b0 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 6d 61 78 hannel "---- max
232c0 69 6d 75 6d 20 6d 65 6d 6f 72 79 20 69 6e 20 75 imum memory in u
232d0 73 65 20 62 79 20 53 51 4c 69 74 65 4d 65 6d 6f se by SQLiteMemo
232e0 72 79 2e 2e 2e 20 22 0d 0a 20 20 20 20 20 20 20 ry... "..
232f0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 }.... if
23300 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
23310 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 object inv
23320 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 oke -flags +NonP
23330 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 ublic \..
23340 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 System.Da
23350 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 65 ta.SQLite.SQLite
23360 4d 65 6d 6f 72 79 20 6d 61 78 69 6d 75 6d 42 79 Memory maximumBy
23370 74 65 73 41 6c 6c 6f 63 61 74 65 64 0d 0a 20 20 tesAllocated..
23380 20 20 20 20 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 } memory]
23390 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
233a0 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 if {!$qu
233b0 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 iet} then {..
233c0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
233d0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
233e0 72 67 73 20 24 6d 65 6d 6f 72 79 20 22 20 62 79 rgs $memory " by
233f0 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 tes\n"]..
23400 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 }.. }
23410 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
23420 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e 6b set memory unk
23430 6e 6f 77 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 nown....
23440 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
23450 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
23460 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
23470 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d l [appendArgs $m
23480 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 emory \n]..
23490 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
234a0 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }.. }....
234b0 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
234c0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
234d0 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
234e0 22 2d 2d 2d 2d 20 63 75 72 72 65 6e 74 20 6d 65 "---- current me
234f0 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 79 20 53 mory in use by S
23500 51 4c 69 74 65 2e 2e 2e 20 22 0d 0a 20 20 20 20 QLite... "..
23510 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 }.... if
23520 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 {[haveSQLiteObje
23530 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e ctCommand]} then
23540 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b {.. if {
23550 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 [catch {..
23560 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b object invok
23570 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 62 e -flags +NonPub
23580 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 lic \..
23590 20 20 20 20 20 53 79 73 74 65 6d 2e 44 61 74 61 System.Data
235a0 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 65 4e 61 .SQLite.UnsafeNa
235b0 74 69 76 65 4d 65 74 68 6f 64 73 20 73 71 6c 69 tiveMethods sqli
235c0 74 65 33 5f 6d 65 6d 6f 72 79 5f 75 73 65 64 0d te3_memory_used.
235d0 0a 20 20 20 20 20 20 20 20 7d 20 6d 65 6d 6f 72 . } memor
235e0 79 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d y] == 0} then {.
235f0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 . if {!
23600 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
23610 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
23620 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
23630 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 22 ndArgs $memory "
23640 20 62 79 74 65 73 5c 6e 22 5d 0d 0a 20 20 20 20 bytes\n"]..
23650 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
23660 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 } else {..
23670 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
23680 20 20 23 20 4e 4f 54 45 3a 20 4d 61 79 62 65 20 # NOTE: Maybe
23690 74 68 65 20 53 51 4c 69 74 65 20 63 6f 72 65 20 the SQLite core
236a0 6c 69 62 72 61 72 79 20 69 73 20 75 6e 61 76 61 library is unava
236b0 69 6c 61 62 6c 65 3f 0d 0a 20 20 20 20 20 20 20 ilable?..
236c0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 #..
236d0 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e 6b 6e 6f set memory unkno
236e0 77 6e 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 wn....
236f0 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
23700 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
23710 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
23720 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 6d [appendArgs $mem
23730 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ory \n]..
23740 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d }.. }.
23750 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d . } else {.
23760 0a 20 20 20 20 20 20 20 20 73 65 74 20 6d 65 6d . set mem
23770 6f 72 79 20 75 6e 61 76 61 69 6c 61 62 6c 65 0d ory unavailable.
23780 0a 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 ... if {!
23790 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
237a0 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
237b0 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
237c0 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d Args $memory \n]
237d0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
237e0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 73 65 }.... se
237f0 74 20 72 65 73 75 6c 74 20 24 6d 65 6d 6f 72 79 t result $memory
23800 3b 20 23 20 4e 4f 54 45 3a 20 52 65 74 75 72 6e ; # NOTE: Return
23810 20 6d 65 6d 6f 72 79 20 69 6e 2d 75 73 65 20 74 memory in-use t
23820 6f 20 6f 75 72 20 63 61 6c 6c 65 72 2e 0d 0a 0d o our caller....
23830 0a 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 . if {!$qui
23840 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
23850 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e tputs $chann
23860 65 6c 20 22 2d 2d 2d 2d 20 6d 61 78 69 6d 75 6d el "---- maximum
23870 20 6d 65 6d 6f 72 79 20 69 6e 20 75 73 65 20 62 memory in use b
23880 79 20 53 51 4c 69 74 65 2e 2e 2e 20 22 0d 0a 20 y SQLite... "..
23890 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
238a0 69 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f if {[haveSQLiteO
238b0 62 6a 65 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 bjectCommand]} t
238c0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 69 hen {.. i
238d0 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
238e0 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e object in
238f0 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e voke -flags +Non
23900 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 Public \..
23910 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
23920 61 74 61 2e 53 51 4c 69 74 65 2e 55 6e 73 61 66 ata.SQLite.Unsaf
23930 65 4e 61 74 69 76 65 4d 65 74 68 6f 64 73 20 5c eNativeMethods \
23940 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
23950 73 71 6c 69 74 65 33 5f 6d 65 6d 6f 72 79 5f 68 sqlite3_memory_h
23960 69 67 68 77 61 74 65 72 20 30 0d 0a 20 20 20 20 ighwater 0..
23970 20 20 20 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d } memory] ==
23980 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
23990 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
239a0 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
239b0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
239c0 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
239d0 73 20 24 6d 65 6d 6f 72 79 20 22 20 62 79 74 65 s $memory " byte
239e0 73 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 s\n"]..
239f0 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c }.. } el
23a00 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
23a10 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
23a20 4f 54 45 3a 20 4d 61 79 62 65 20 74 68 65 20 53 OTE: Maybe the S
23a30 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 QLite core libra
23a40 72 79 20 69 73 20 75 6e 61 76 61 69 6c 61 62 6c ry is unavailabl
23a50 65 3f 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d e?.. #.
23a60 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 6d . set m
23a70 65 6d 6f 72 79 20 75 6e 6b 6e 6f 77 6e 0d 0a 0d emory unknown...
23a80 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 . if {!
23a90 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a $quiet} then {..
23aa0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
23ab0 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 s $channel [appe
23ac0 6e 64 41 72 67 73 20 24 6d 65 6d 6f 72 79 20 5c ndArgs $memory \
23ad0 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d n].. }.
23ae0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 . }..
23af0 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
23b00 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 75 set memory u
23b10 6e 61 76 61 69 6c 61 62 6c 65 0d 0a 0d 0a 20 20 navailable....
23b20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
23b30 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
23b40 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
23b50 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
23b60 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 $memory \n]..
23b70 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d }.. }.
23b80 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 24 63 6f ... if {$co
23b90 6c 6c 65 63 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 llect} then {..
23ba0 20 20 20 20 20 20 20 63 6f 6c 6c 65 63 74 47 61 collectGa
23bb0 72 62 61 67 65 20 24 63 68 61 6e 6e 65 6c 0d 0a rbage $channel..
23bc0 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
23bd0 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 if {!$quiet} th
23be0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 74 70 en {.. tp
23bf0 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 22 2d 2d uts $channel "--
23c00 2d 2d 20 63 75 72 72 65 6e 74 20 6d 65 6d 6f 72 -- current memor
23c10 79 20 69 6e 20 75 73 65 20 62 79 20 74 68 65 20 y in use by the
23c20 43 4c 52 2e 2e 2e 20 22 0d 0a 20 20 20 20 20 20 CLR... "..
23c30 7d 0d 0a 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b }.... if {[
23c40 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 63 74 haveSQLiteObject
23c50 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e 20 7b Command]} then {
23c60 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 .. if {[c
23c70 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 atch {..
23c80 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 object invoke
23c90 47 43 20 47 65 74 54 6f 74 61 6c 4d 65 6d 6f 72 GC GetTotalMemor
23ca0 79 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 y false..
23cb0 20 7d 20 6d 65 6d 6f 72 79 5d 20 3d 3d 20 30 7d } memory] == 0}
23cc0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
23cd0 20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 69 if {[string i
23ce0 73 20 69 6e 74 65 67 65 72 20 2d 73 74 72 69 63 s integer -stric
23cf0 74 20 24 6d 65 6d 6f 72 79 5d 7d 20 74 68 65 6e t $memory]} then
23d00 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
23d10 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
23d20 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
23d30 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
23d40 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d l [appendArgs $m
23d50 65 6d 6f 72 79 20 22 20 62 79 74 65 73 5c 6e 22 emory " bytes\n"
23d60 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
23d70 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c .. } el
23d80 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
23d90 20 20 73 65 74 20 6d 65 6d 6f 72 79 20 69 6e 76 set memory inv
23da0 61 6c 69 64 0d 0a 0d 0a 20 20 20 20 20 20 20 20 alid....
23db0 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d if {!$quiet}
23dc0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
23dd0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
23de0 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
23df0 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a 20 s $memory \n]..
23e00 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
23e10 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
23e20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
23e30 20 20 20 20 20 20 20 73 65 74 20 6d 65 6d 6f 72 set memor
23e40 79 20 75 6e 6b 6e 6f 77 6e 0d 0a 0d 0a 20 20 20 y unknown....
23e50 20 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 if {!$qui
23e60 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 et} then {..
23e70 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 tputs $c
23e80 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
23e90 67 73 20 24 6d 65 6d 6f 72 79 20 5c 6e 5d 0d 0a gs $memory \n]..
23ea0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
23eb0 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 20 }.. }
23ec0 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 else {..
23ed0 73 65 74 20 6d 65 6d 6f 72 79 20 75 6e 61 76 61 set memory unava
23ee0 69 6c 61 62 6c 65 0d 0a 0d 0a 20 20 20 20 20 20 ilable....
23ef0 20 20 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 if {!$quiet} t
23f00 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
23f10 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
23f20 5b 61 70 70 65 6e 64 41 72 67 73 20 24 6d 65 6d [appendArgs $mem
23f30 6f 72 79 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 ory \n]..
23f40 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }.. }....
23f50 20 20 20 20 20 72 65 74 75 72 6e 20 24 72 65 73 return $res
23f60 75 6c 74 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 ult.. }.....
23f70 20 20 20 70 72 6f 63 20 72 65 73 65 74 53 51 4c proc resetSQL
23f80 69 74 65 44 69 72 65 63 74 6f 72 69 65 73 20 7b iteDirectories {
23f90 20 63 68 61 6e 6e 65 6c 20 6e 61 74 69 76 65 20 channel native
23fa0 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
23fb0 20 20 20 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 # NOTE: Atte
23fc0 6d 70 74 20 74 6f 20 75 73 65 20 74 68 65 20 6e mpt to use the n
23fd0 61 74 69 76 65 20 41 50 49 20 28 76 69 61 20 74 ative API (via t
23fe0 68 65 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d he managed assem
23ff0 62 6c 79 29 3f 0d 0a 20 20 20 20 20 20 23 0d 0a bly)?.. #..
24000 20 20 20 20 20 20 69 66 20 7b 24 6e 61 74 69 76 if {$nativ
24010 65 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 e} then {..
24020 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
24030 4e 4f 54 45 3a 20 4e 6f 77 20 6d 61 6b 65 20 73 NOTE: Now make s
24040 75 72 65 20 74 68 65 20 64 61 74 61 62 61 73 65 ure the database
24050 20 61 6e 64 20 74 65 6d 70 6f 72 61 72 79 20 64 and temporary d
24060 69 72 65 63 74 6f 72 69 65 73 20 61 72 65 0d 0a irectories are..
24070 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
24080 72 65 73 65 74 20 74 68 65 69 72 20 64 65 66 61 reset their defa
24090 75 6c 74 20 76 61 6c 75 65 73 2c 20 77 68 69 63 ult values, whic
240a0 68 20 73 68 6f 75 6c 64 20 62 65 20 6e 75 6c 6c h should be null
240b0 20 66 6f 72 20 62 6f 74 68 2e 0d 0a 20 20 20 20 for both...
240c0 20 20 20 20 23 20 20 20 20 20 20 20 53 69 6e 63 # Sinc
240d0 65 20 74 68 65 20 73 71 6c 69 74 65 33 5f 77 69 e the sqlite3_wi
240e0 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 n32_set_director
240f0 79 20 66 75 6e 63 74 69 6f 6e 20 69 73 20 61 76 y function is av
24100 61 69 6c 61 62 6c 65 2c 0d 0a 20 20 20 20 20 20 ailable,..
24110 20 20 23 20 20 20 20 20 20 20 75 73 65 20 69 74 # use it
24120 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
24130 20 20 20 20 20 20 66 6f 72 20 7b 73 65 74 20 69 for {set i
24140 6e 64 65 78 20 31 7d 20 7b 24 69 6e 64 65 78 20 ndex 1} {$index
24150 3c 20 33 7d 20 7b 69 6e 63 72 20 69 6e 64 65 78 < 3} {incr index
24160 7d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 } {.. i
24170 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 f {[catch {..
24180 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 object
24190 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e invoke -flags +N
241a0 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 onPublic \..
241b0 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
241c0 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 em.Data.SQLite.U
241d0 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f nsafeNativeMetho
241e0 64 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ds \..
241f0 20 20 20 20 20 20 73 71 6c 69 74 65 33 5f 77 69 sqlite3_wi
24200 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 n32_set_director
24210 79 20 24 69 6e 64 65 78 20 6e 75 6c 6c 0d 0a 20 y $index null..
24220 20 20 20 20 20 20 20 20 20 7d 20 72 65 73 75 6c } resul
24230 74 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d t] == 0} then {.
24240 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
24250 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
24260 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
24270 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
24280 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 5f 77 69 call sqlite3_wi
24290 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 n32_set_director
242a0 79 28 22 20 24 69 6e 64 65 78 20 5c 0d 0a 20 20 y(" $index \..
242b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2c ",
242c0 20 6e 75 6c 6c 29 2e 2e 2e 20 6f 6b 3a 20 22 20 null)... ok: "
242d0 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a 20 20 20 $result \n]..
242e0 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d } else {.
242f0 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 . tpu
24300 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 ts $channel [app
24310 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
24320 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
24330 20 63 61 6c 6c 20 73 71 6c 69 74 65 33 5f 77 69 call sqlite3_wi
24340 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 n32_set_director
24350 79 28 22 20 24 69 6e 64 65 78 20 5c 0d 0a 20 20 y(" $index \..
24360 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2c ",
24370 20 6e 75 6c 6c 29 2e 2e 2e 20 65 72 72 6f 72 3a null)... error:
24380 20 22 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 " \n\t $result
24390 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d \n].. }
243a0 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 .. }..
243b0 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
243c0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
243d0 23 20 4e 4f 54 45 3a 20 4e 6f 77 20 6d 61 6b 65 # NOTE: Now make
243e0 20 73 75 72 65 20 74 68 65 20 64 61 74 61 62 61 sure the databa
243f0 73 65 20 61 6e 64 20 74 65 6d 70 6f 72 61 72 79 se and temporary
24400 20 64 69 72 65 63 74 6f 72 69 65 73 20 61 72 65 directories are
24410 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
24420 20 20 72 65 73 65 74 20 74 68 65 69 72 20 64 65 reset their de
24430 66 61 75 6c 74 20 76 61 6c 75 65 73 2c 20 77 68 fault values, wh
24440 69 63 68 20 73 68 6f 75 6c 64 20 62 65 20 6e 75 ich should be nu
24450 6c 6c 20 66 6f 72 20 62 6f 74 68 2e 0d 0a 20 20 ll for both...
24460 20 20 20 20 20 20 23 20 20 20 20 20 20 20 53 69 # Si
24470 6e 63 65 20 74 68 65 20 73 71 6c 69 74 65 33 5f nce the sqlite3_
24480 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 74 win32_set_direct
24490 6f 72 79 20 66 75 6e 63 74 69 6f 6e 20 64 6f 65 ory function doe
244a0 73 20 6e 6f 74 0d 0a 20 20 20 20 20 20 20 20 23 s not.. #
244b0 20 20 20 20 20 20 20 61 70 70 65 61 72 20 74 6f appear to
244c0 20 62 65 20 61 76 61 69 6c 61 62 6c 65 2c 20 75 be available, u
244d0 73 65 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 se the associate
244e0 64 20 50 52 41 47 4d 41 20 63 6f 6d 6d 61 6e 64 d PRAGMA command
244f0 73 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 s.. #
24500 20 20 20 69 6e 73 74 65 61 64 2e 0d 0a 20 20 20 instead...
24510 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
24520 66 6f 72 65 61 63 68 20 64 69 72 65 63 74 6f 72 foreach director
24530 79 20 5b 6c 69 73 74 20 64 61 74 61 5f 73 74 6f y [list data_sto
24540 72 65 5f 64 69 72 65 63 74 6f 72 79 20 74 65 6d re_directory tem
24550 70 5f 73 74 6f 72 65 5f 64 69 72 65 63 74 6f 72 p_store_director
24560 79 5d 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 y] {..
24570 73 65 74 20 73 71 6c 20 5b 61 70 70 65 6e 64 41 set sql [appendA
24580 72 67 73 20 22 50 52 41 47 4d 41 20 22 20 24 64 rgs "PRAGMA " $d
24590 69 72 65 63 74 6f 72 79 20 22 20 3d 20 5c 22 5c irectory " = \"\
245a0 22 3b 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ";"]....
245b0 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 65 78 if {[catch {ex
245c0 65 63 75 74 65 53 71 6c 20 24 73 71 6c 7d 20 72 ecuteSql $sql} r
245d0 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 65 esult] == 0} the
245e0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
245f0 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 tputs $channel
24600 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
24610 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
24620 2d 2d 2d 2d 20 65 78 65 63 75 74 65 20 50 52 41 ---- execute PRA
24630 47 4d 41 20 22 20 24 64 69 72 65 63 74 6f 72 79 GMA " $directory
24640 20 22 2e 2e 2e 20 6f 6b 3a 20 5c 22 22 20 5c 0d "... ok: \"" \.
24650 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
24660 20 24 72 65 73 75 6c 74 20 5c 22 5c 6e 5d 0d 0a $result \"\n]..
24670 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 } else
24680 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
24690 74 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b tputs $channel [
246a0 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
246b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
246c0 2d 2d 2d 20 65 78 65 63 75 74 65 20 50 52 41 47 --- execute PRAG
246d0 4d 41 20 22 20 24 64 69 72 65 63 74 6f 72 79 20 MA " $directory
246e0 22 2e 2e 2e 20 65 72 72 6f 72 3a 20 22 20 5c 0d "... error: " \.
246f0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
24700 20 5c 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e \n\t $result \n
24710 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
24720 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
24730 20 7d 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 }.. }.....
24740 20 20 70 72 6f 63 20 63 68 65 63 6b 46 6f 72 53 proc checkForS
24750 51 4c 69 74 65 44 69 72 65 63 74 6f 72 69 65 73 QLiteDirectories
24760 20 7b 20 63 68 61 6e 6e 65 6c 20 7b 72 65 73 65 { channel {rese
24770 74 20 66 61 6c 73 65 7d 20 7d 20 7b 0d 0a 20 20 t false} } {..
24780 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 4e #.. # N
24790 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 OTE: Check if th
247a0 65 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f e sqlite3_win32_
247b0 73 65 74 5f 64 69 72 65 63 74 6f 72 79 20 66 75 set_directory fu
247c0 6e 63 74 69 6f 6e 20 69 73 20 61 76 61 69 6c 61 nction is availa
247d0 62 6c 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 ble... #..
247e0 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
247f0 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 nel \..
24800 20 22 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 "---- checking
24810 66 6f 72 20 66 75 6e 63 74 69 6f 6e 20 73 71 6c for function sql
24820 69 74 65 33 5f 77 69 6e 33 32 5f 73 65 74 5f 64 ite3_win32_set_d
24830 69 72 65 63 74 6f 72 79 2e 2e 2e 20 22 0d 0a 0d irectory... "...
24840 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
24850 23 20 4e 4f 54 45 3a 20 54 68 69 73 20 63 61 6c # NOTE: This cal
24860 6c 20 74 6f 20 74 68 65 20 73 71 6c 69 74 65 33 l to the sqlite3
24870 5f 77 69 6e 33 32 5f 73 65 74 5f 64 69 72 65 63 _win32_set_direc
24880 74 6f 72 79 20 66 75 6e 63 74 69 6f 6e 20 75 73 tory function us
24890 65 73 20 74 68 65 0d 0a 20 20 20 20 20 20 23 20 es the.. #
248a0 20 20 20 20 20 20 69 6e 76 61 6c 69 64 20 76 61 invalid va
248b0 6c 75 65 20 30 20 66 6f 72 20 74 68 65 20 66 69 lue 0 for the fi
248c0 72 73 74 20 61 72 67 75 6d 65 6e 74 2e 20 20 54 rst argument. T
248d0 68 69 73 20 63 6f 64 65 20 69 73 20 64 65 73 69 his code is desi
248e0 67 6e 65 64 0d 0a 20 20 20 20 20 20 23 20 20 20 gned.. #
248f0 20 20 20 20 74 6f 20 63 68 65 63 6b 20 69 66 20 to check if
24900 63 61 6c 6c 69 6e 67 20 74 68 65 20 66 75 6e 63 calling the func
24910 74 69 6f 6e 20 77 69 6c 6c 20 72 61 69 73 65 20 tion will raise
24920 61 6e 20 65 78 63 65 70 74 69 6f 6e 20 28 69 2e an exception (i.
24930 65 2e 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 e... #
24940 20 20 74 68 65 20 61 63 74 75 61 6c 20 72 65 73 the actual res
24950 75 6c 74 20 6f 66 20 74 68 65 20 66 75 6e 63 74 ult of the funct
24960 69 6f 6e 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 ion does not mat
24970 74 65 72 20 61 73 20 6c 6f 6e 67 20 61 73 20 6e ter as long as n
24980 6f 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 o.. #
24990 20 64 69 72 65 63 74 6f 72 79 20 69 73 20 63 68 directory is ch
249a0 61 6e 67 65 64 29 2e 0d 0a 20 20 20 20 20 20 23 anged)... #
249b0 0d 0a 20 20 20 20 20 20 69 66 20 7b 5b 69 73 57 .. if {[isW
249c0 69 6e 64 6f 77 73 5d 20 26 26 20 5b 63 61 74 63 indows] && [catc
249d0 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 6f 62 6a h {.. obj
249e0 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 ect invoke -flag
249f0 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a s +NonPublic \..
24a00 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 Syst
24a10 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 55 em.Data.SQLite.U
24a20 6e 73 61 66 65 4e 61 74 69 76 65 4d 65 74 68 6f nsafeNativeMetho
24a30 64 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ds \..
24a40 20 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 5f sqlite3_win32_
24a50 73 65 74 5f 64 69 72 65 63 74 6f 72 79 20 30 20 set_directory 0
24a60 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 7d 5d 20 3d null.. }] =
24a70 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
24a80 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
24a90 23 20 4e 4f 54 45 3a 20 43 61 6c 6c 69 6e 67 20 # NOTE: Calling
24aa0 74 68 65 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 the sqlite3_win3
24ab0 32 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 20 2_set_directory
24ac0 66 75 6e 63 74 69 6f 6e 20 64 6f 65 73 20 6e 6f function does no
24ad0 74 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 t.. #
24ae0 20 20 20 63 61 75 73 65 20 61 6e 20 65 78 63 65 cause an exce
24af0 70 74 69 6f 6e 3b 20 74 68 65 72 65 66 6f 72 65 ption; therefore
24b00 2c 20 69 74 20 6d 75 73 74 20 62 65 20 61 76 61 , it must be ava
24b10 69 6c 61 62 6c 65 20 28 69 2e 65 2e 0d 0a 20 20 ilable (i.e...
24b20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 65 76 # ev
24b30 65 6e 20 74 68 6f 75 67 68 20 69 74 20 73 68 6f en though it sho
24b40 75 6c 64 20 72 65 74 75 72 6e 20 61 20 66 61 69 uld return a fai
24b50 6c 75 72 65 20 72 65 74 75 72 6e 20 63 6f 64 65 lure return code
24b60 20 69 6e 20 74 68 69 73 0d 0a 20 20 20 20 20 20 in this..
24b70 20 20 23 20 20 20 20 20 20 20 63 61 73 65 29 2e # case).
24b80 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
24b90 20 20 20 20 20 61 64 64 43 6f 6e 73 74 72 61 69 addConstrai
24ba0 6e 74 20 73 71 6c 69 74 65 33 5f 77 69 6e 33 32 nt sqlite3_win32
24bb0 5f 73 65 74 5f 64 69 72 65 63 74 6f 72 79 0d 0a _set_directory..
24bc0 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
24bd0 24 63 68 61 6e 6e 65 6c 20 79 65 73 5c 6e 0d 0a $channel yes\n..
24be0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
24bf0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 44 6f 65 # NOTE: Doe
24c00 73 20 6f 75 72 20 63 61 6c 6c 65 72 20 77 61 6e s our caller wan
24c10 74 20 74 6f 20 72 65 73 65 74 20 74 68 65 20 64 t to reset the d
24c20 69 72 65 63 74 6f 72 69 65 73 3f 0d 0a 20 20 20 irectories?..
24c30 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
24c40 69 66 20 7b 24 72 65 73 65 74 7d 20 74 68 65 6e if {$reset} then
24c50 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 72 65 {.. re
24c60 73 65 74 53 51 4c 69 74 65 44 69 72 65 63 74 6f setSQLiteDirecto
24c70 72 69 65 73 20 24 63 68 61 6e 6e 65 6c 20 74 72 ries $channel tr
24c80 75 65 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 20 ue.. }..
24c90 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 } else {..
24ca0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
24cb0 61 6e 6e 65 6c 20 6e 6f 5c 6e 0d 0a 0d 0a 20 20 annel no\n....
24cc0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
24cd0 20 23 20 4e 4f 54 45 3a 20 44 6f 65 73 20 6f 75 # NOTE: Does ou
24ce0 72 20 63 61 6c 6c 65 72 20 77 61 6e 74 20 74 6f r caller want to
24cf0 20 72 65 73 65 74 20 74 68 65 20 64 69 72 65 63 reset the direc
24d00 74 6f 72 69 65 73 3f 20 20 54 68 69 73 20 63 61 tories? This ca
24d10 6e 20 6f 6e 6c 79 0d 0a 20 20 20 20 20 20 20 20 n only..
24d20 23 20 20 20 20 20 20 20 62 65 20 70 65 72 66 6f # be perfo
24d30 72 6d 65 64 20 69 66 20 53 51 4c 69 74 65 20 69 rmed if SQLite i
24d40 73 20 6c 6f 61 64 65 64 20 61 6e 64 20 72 65 61 s loaded and rea
24d50 64 79 20 66 6f 72 20 75 73 65 20 62 79 20 74 68 dy for use by th
24d60 65 20 74 65 73 74 0d 0a 20 20 20 20 20 20 20 20 e test..
24d70 23 20 20 20 20 20 20 20 73 75 69 74 65 2e 0d 0a # suite...
24d80 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
24d90 20 20 20 69 66 20 7b 24 72 65 73 65 74 20 26 26 if {$reset &&
24da0 20 5b 69 73 53 51 4c 69 74 65 52 65 61 64 79 5d [isSQLiteReady]
24db0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
24dc0 20 20 20 20 72 65 73 65 74 53 51 4c 69 74 65 44 resetSQLiteD
24dd0 69 72 65 63 74 6f 72 69 65 73 20 24 63 68 61 6e irectories $chan
24de0 6e 65 6c 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 nel false..
24df0 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 0d }.. }...
24e00 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
24e10 23 20 4e 4f 54 45 3a 20 46 69 6e 61 6c 6c 79 2c # NOTE: Finally,
24e20 20 73 68 6f 77 20 74 68 65 20 63 75 72 72 65 6e show the curren
24e30 74 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 64 t value of the d
24e40 61 74 61 62 61 73 65 20 61 6e 64 20 74 65 6d 70 atabase and temp
24e50 6f 72 61 72 79 0d 0a 20 20 20 20 20 20 23 20 20 orary.. #
24e60 20 20 20 20 20 64 69 72 65 63 74 6f 72 69 65 73 directories
24e70 2e 20 20 54 68 69 73 20 63 61 6e 20 6f 6e 6c 79 . This can only
24e80 20 62 65 20 70 65 72 66 6f 72 6d 65 64 20 69 66 be performed if
24e90 20 53 51 4c 69 74 65 20 69 73 20 6c 6f 61 64 65 SQLite is loade
24ea0 64 0d 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 d.. #
24eb0 20 61 6e 64 20 72 65 61 64 79 20 66 6f 72 20 75 and ready for u
24ec0 73 65 20 62 79 20 74 68 65 20 74 65 73 74 20 73 se by the test s
24ed0 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 23 0d 0a uite... #..
24ee0 20 20 20 20 20 20 69 66 20 7b 5b 69 73 53 51 4c if {[isSQL
24ef0 69 74 65 52 65 61 64 79 5d 7d 20 74 68 65 6e 20 iteReady]} then
24f00 7b 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 {.. forea
24f10 63 68 20 64 69 72 65 63 74 6f 72 79 20 5b 6c 69 ch directory [li
24f20 73 74 20 64 61 74 61 5f 73 74 6f 72 65 5f 64 69 st data_store_di
24f30 72 65 63 74 6f 72 79 20 74 65 6d 70 5f 73 74 6f rectory temp_sto
24f40 72 65 5f 64 69 72 65 63 74 6f 72 79 5d 20 7b 0d re_directory] {.
24f50 0a 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 . tputs
24f60 20 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e $channel [appen
24f70 64 41 72 67 73 20 22 2d 2d 2d 2d 20 63 68 65 63 dArgs "---- chec
24f80 6b 69 6e 67 20 22 20 24 64 69 72 65 63 74 6f 72 king " $director
24f90 79 20 22 2e 2e 2e 20 22 5d 0d 0a 0d 0a 20 20 20 y "... "]....
24fa0 20 20 20 20 20 20 20 73 65 74 20 73 71 6c 20 5b set sql [
24fb0 61 70 70 65 6e 64 41 72 67 73 20 22 50 52 41 47 appendArgs "PRAG
24fc0 4d 41 20 22 20 24 64 69 72 65 63 74 6f 72 79 20 MA " $directory
24fd0 5c 3b 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 \;]....
24fe0 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 65 78 65 if {[catch {exe
24ff0 63 75 74 65 53 71 6c 20 24 73 71 6c 20 73 63 61 cuteSql $sql sca
25000 6c 61 72 7d 20 72 65 73 75 6c 74 5d 20 3d 3d 20 lar} result] ==
25010 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
25020 20 20 20 20 20 20 20 74 70 75 74 73 20 24 63 68 tputs $ch
25030 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
25040 73 20 22 6f 6b 3a 20 5c 22 22 20 24 72 65 73 75 s "ok: \"" $resu
25050 6c 74 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 lt \"\n]..
25060 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 } else {..
25070 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
25080 24 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 $channel [append
25090 41 72 67 73 20 22 65 72 72 6f 72 3a 20 22 20 5c Args "error: " \
250a0 6e 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d n\t $result \n].
250b0 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
250c0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d }.. }
250d0 0d 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 .. }.....
250e0 70 72 6f 63 20 6c 6f 61 64 53 51 4c 69 74 65 54 proc loadSQLiteT
250f0 65 73 74 53 65 74 74 69 6e 67 73 20 7b 20 63 68 estSettings { ch
25100 61 6e 6e 65 6c 20 7b 73 75 66 66 69 78 20 22 22 annel {suffix ""
25110 7d 20 7b 71 75 69 65 74 20 66 61 6c 73 65 7d 20 } {quiet false}
25120 7d 20 7b 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 } {.. #..
25130 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 # NOTE: Skip
25140 20 6c 6f 61 64 69 6e 67 20 74 68 65 20 73 65 74 loading the set
25150 74 69 6e 67 73 20 69 66 20 74 68 65 69 72 20 75 tings if their u
25160 73 61 67 65 20 68 61 73 20 62 65 65 6e 20 64 69 sage has been di
25170 73 61 62 6c 65 64 2e 0d 0a 20 20 20 20 20 20 23 sabled... #
25180 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e .. if {![in
25190 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 73 fo exists ::no(s
251a0 71 6c 69 74 65 54 65 73 74 53 65 74 74 69 6e 67 qliteTestSetting
251b0 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
251c0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
251d0 23 20 4e 4f 54 45 3a 20 4c 6f 61 64 20 63 75 73 # NOTE: Load cus
251e0 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 61 6e 64 tom per-user and
251f0 2f 6f 72 20 70 65 72 2d 68 6f 73 74 20 74 65 73 /or per-host tes
25200 74 20 73 65 74 74 69 6e 67 73 20 6e 6f 77 2e 0d t settings now..
25210 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
25220 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 if {[info ex
25230 69 73 74 73 20 3a 3a 74 63 6c 5f 70 6c 61 74 66 ists ::tcl_platf
25240 6f 72 6d 28 75 73 65 72 29 5d 7d 20 74 68 65 6e orm(user)]} then
25250 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 {.. se
25260 74 20 75 73 65 72 53 65 74 74 69 6e 67 73 46 69 t userSettingsFi
25270 6c 65 4e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 leName [file joi
25280 6e 20 5b 67 65 74 43 6f 6d 6d 6f 6e 44 69 72 65 n [getCommonDire
25290 63 74 6f 72 79 5d 20 5c 0d 0a 20 20 20 20 20 20 ctory] \..
252a0 20 20 20 20 20 20 20 20 5b 61 70 70 65 6e 64 41 [appendA
252b0 72 67 73 20 73 65 74 74 69 6e 67 73 20 24 73 75 rgs settings $su
252c0 66 66 69 78 20 2e 20 24 3a 3a 74 63 6c 5f 70 6c ffix . $::tcl_pl
252d0 61 74 66 6f 72 6d 28 75 73 65 72 29 20 2e 65 61 atform(user) .ea
252e0 67 6c 65 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 gle]]....
252f0 20 20 20 69 66 20 7b 5b 66 69 6c 65 20 65 78 69 if {[file exi
25300 73 74 73 20 24 75 73 65 72 53 65 74 74 69 6e 67 sts $userSetting
25310 73 46 69 6c 65 4e 61 6d 65 5d 7d 20 74 68 65 6e sFileName]} then
25320 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
25330 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
25340 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
25350 20 20 20 74 70 75 74 73 20 24 63 68 61 6e 6e 65 tputs $channe
25360 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
25370 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
25380 20 20 20 22 2d 2d 2d 2d 20 6c 6f 61 64 69 6e 67 "---- loading
25390 20 70 65 72 2d 75 73 65 72 20 74 65 73 74 20 73 per-user test s
253a0 65 74 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 22 ettings file \""
253b0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
253c0 20 20 20 20 20 20 24 75 73 65 72 53 65 74 74 69 $userSetti
253d0 6e 67 73 46 69 6c 65 4e 61 6d 65 20 5c 22 2e 2e ngsFileName \"..
253e0 2e 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 .\n]..
253f0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
25400 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d if {[catch {.
25410 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 75 . u
25420 70 6c 65 76 65 6c 20 31 20 5b 6c 69 73 74 20 73 plevel 1 [list s
25430 6f 75 72 63 65 20 24 75 73 65 72 53 65 74 74 69 ource $userSetti
25440 6e 67 73 46 69 6c 65 4e 61 6d 65 5d 0d 0a 20 20 ngsFileName]..
25450 20 20 20 20 20 20 20 20 20 20 7d 20 65 72 72 6f } erro
25460 72 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 r]} then {..
25470 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 24 if {!$
25480 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 quiet} then {..
25490 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
254a0 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
254b0 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
254c0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
254d0 20 22 3d 3d 3d 3d 20 57 41 52 4e 49 4e 47 3a 20 "==== WARNING:
254e0 66 61 69 6c 65 64 20 74 6f 20 6c 6f 61 64 20 70 failed to load p
254f0 65 72 2d 75 73 65 72 20 73 65 74 74 69 6e 67 73 er-user settings
25500 20 66 69 6c 65 20 5c 22 22 20 5c 0d 0a 20 20 20 file \"" \..
25510 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
25520 20 24 75 73 65 72 53 65 74 74 69 6e 67 73 46 69 $userSettingsFi
25530 6c 65 4e 61 6d 65 20 22 5c 22 2c 20 65 72 72 6f leName "\", erro
25540 72 3a 20 22 20 5c 6e 5c 74 20 24 65 72 72 6f 72 r: " \n\t $error
25550 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n]..
25560 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
25570 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
25580 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
25590 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
255a0 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
255b0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
255c0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
255d0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
255e0 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 "---- s
255f0 6b 69 70 70 65 64 20 6c 6f 61 64 69 6e 67 20 70 kipped loading p
25600 65 72 2d 75 73 65 72 20 74 65 73 74 20 73 65 74 er-user test set
25610 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 22 20 5c tings file \"" \
25620 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
25630 20 20 20 20 24 75 73 65 72 53 65 74 74 69 6e 67 $userSetting
25640 73 46 69 6c 65 4e 61 6d 65 20 22 5c 22 2c 20 69 sFileName "\", i
25650 74 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 t does not exist
25660 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
25670 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d }.. }
25680 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 .. }....
25690 20 20 20 20 20 20 20 23 23 23 23 23 23 23 23 23 #########
256a0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
256b0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
256c0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
256d0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 0d 0a ##############..
256e0 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 69 .. if {[i
256f0 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 63 6c nfo exists ::tcl
25700 5f 70 6c 61 74 66 6f 72 6d 28 68 6f 73 74 29 5d _platform(host)]
25710 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
25720 20 20 20 20 73 65 74 20 68 6f 73 74 53 65 74 74 set hostSett
25730 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 5b 66 69 ingsFileName [fi
25740 6c 65 20 6a 6f 69 6e 20 5b 67 65 74 43 6f 6d 6d le join [getComm
25750 6f 6e 44 69 72 65 63 74 6f 72 79 5d 20 5c 0d 0a onDirectory] \..
25760 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 61 [a
25770 70 70 65 6e 64 41 72 67 73 20 73 65 74 74 69 6e ppendArgs settin
25780 67 73 20 24 73 75 66 66 69 78 20 2e 20 24 3a 3a gs $suffix . $::
25790 74 63 6c 5f 70 6c 61 74 66 6f 72 6d 28 68 6f 73 tcl_platform(hos
257a0 74 29 20 2e 65 61 67 6c 65 5d 5d 0d 0a 0d 0a 20 t) .eagle]]....
257b0 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 66 69 if {[fi
257c0 6c 65 20 65 78 69 73 74 73 20 24 68 6f 73 74 53 le exists $hostS
257d0 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 5d ettingsFileName]
257e0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
257f0 20 20 20 20 20 20 69 66 20 7b 21 24 71 75 69 65 if {!$quie
25800 74 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 t} then {..
25810 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
25820 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
25830 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
25840 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6c "---- l
25850 6f 61 64 69 6e 67 20 70 65 72 2d 68 6f 73 74 20 oading per-host
25860 74 65 73 74 20 73 65 74 74 69 6e 67 73 20 66 69 test settings fi
25870 6c 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 le \"" \..
25880 20 20 20 20 20 20 20 20 20 20 20 20 24 68 6f 73 $hos
25890 74 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d tSettingsFileNam
258a0 65 20 5c 22 2e 2e 2e 5c 6e 5d 0d 0a 20 20 20 20 e \"...\n]..
258b0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
258c0 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b 63 61 if {[ca
258d0 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
258e0 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 5b uplevel 1 [
258f0 6c 69 73 74 20 73 6f 75 72 63 65 20 24 68 6f 73 list source $hos
25900 74 53 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d tSettingsFileNam
25910 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 e]..
25920 7d 20 65 72 72 6f 72 5d 7d 20 74 68 65 6e 20 7b } error]} then {
25930 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
25940 69 66 20 7b 21 24 71 75 69 65 74 7d 20 74 68 65 if {!$quiet} the
25950 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
25960 20 20 20 20 20 74 70 75 74 73 20 24 63 68 61 6e tputs $chan
25970 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
25980 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
25990 20 20 20 20 20 20 20 22 3d 3d 3d 3d 20 57 41 52 "==== WAR
259a0 4e 49 4e 47 3a 20 66 61 69 6c 65 64 20 74 6f 20 NING: failed to
259b0 6c 6f 61 64 20 70 65 72 2d 68 6f 73 74 20 73 65 load per-host se
259c0 74 74 69 6e 67 73 20 66 69 6c 65 20 5c 22 22 20 ttings file \""
259d0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
259e0 20 20 20 20 20 20 20 24 68 6f 73 74 53 65 74 74 $hostSett
259f0 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 22 5c 22 ingsFileName "\"
25a00 2c 20 65 72 72 6f 72 3a 20 22 20 5c 6e 5c 74 20 , error: " \n\t
25a10 24 65 72 72 6f 72 20 5c 6e 5d 0d 0a 20 20 20 20 $error \n]..
25a20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
25a30 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
25a40 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a } else {..
25a50 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
25a60 21 24 71 75 69 65 74 7d 20 74 68 65 6e 20 7b 0d !$quiet} then {.
25a70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 . t
25a80 70 75 74 73 20 24 63 68 61 6e 6e 65 6c 20 5b 61 puts $channel [a
25a90 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 ppendArgs \..
25aa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 "
25ab0 2d 2d 2d 2d 20 73 6b 69 70 70 65 64 20 6c 6f 61 ---- skipped loa
25ac0 64 69 6e 67 20 70 65 72 2d 68 6f 73 74 20 74 65 ding per-host te
25ad0 73 74 20 73 65 74 74 69 6e 67 73 20 66 69 6c 65 st settings file
25ae0 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 \"" \..
25af0 20 20 20 20 20 20 20 20 20 20 24 68 6f 73 74 53 $hostS
25b00 65 74 74 69 6e 67 73 46 69 6c 65 4e 61 6d 65 20 ettingsFileName
25b10 22 5c 22 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 "\", it does not
25b20 20 65 78 69 73 74 5c 6e 22 5d 0d 0a 20 20 20 20 exist\n"]..
25b30 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 }..
25b40 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
25b50 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }.. }..
25b60 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 63 }..... proc c
25b70 6f 70 79 53 61 6d 70 6c 65 44 61 74 61 62 61 73 opySampleDatabas
25b80 65 46 69 6c 65 73 20 7b 7d 20 7b 0d 0a 20 20 20 eFiles {} {..
25b90 20 20 20 75 70 6c 65 76 65 6c 20 31 20 7b 0d 0a uplevel 1 {..
25ba0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
25bb0 20 20 20 23 20 4e 4f 54 45 3a 20 43 6f 70 79 20 # NOTE: Copy
25bc0 28 6f 72 20 72 65 2d 63 6f 70 79 29 20 74 68 65 (or re-copy) the
25bd0 20 72 65 66 65 72 65 6e 63 65 20 64 61 74 61 62 reference datab
25be0 61 73 65 20 66 69 6c 65 20 75 73 65 64 20 66 6f ase file used fo
25bf0 72 20 74 68 69 73 0d 0a 20 20 20 20 20 20 20 20 r this..
25c00 23 20 20 20 20 20 20 20 75 6e 69 74 20 74 65 73 # unit tes
25c10 74 20 74 6f 20 74 68 65 20 62 75 69 6c 64 20 64 t to the build d
25c20 69 72 65 63 74 6f 72 79 20 69 6e 20 63 61 73 65 irectory in case
25c30 20 69 74 20 68 61 73 20 62 65 65 6e 20 63 68 61 it has been cha
25c40 6e 67 65 64 0d 0a 20 20 20 20 20 20 20 20 23 20 nged.. #
25c50 20 20 20 20 20 20 62 79 20 61 20 70 72 65 76 69 by a previ
25c60 6f 75 73 20 74 65 73 74 20 72 75 6e 2e 0d 0a 20 ous test run...
25c70 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
25c80 20 20 66 69 6c 65 20 63 6f 70 79 20 2d 66 6f 72 file copy -for
25c90 63 65 20 24 6e 6f 72 74 68 77 69 6e 64 45 66 44 ce $northwindEfD
25ca0 62 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 bFile \..
25cb0 20 20 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 67 [file join [g
25cc0 65 74 42 75 69 6c 64 44 69 72 65 63 74 6f 72 79 etBuildDirectory
25cd0 20 74 72 75 65 5d 20 5b 66 69 6c 65 20 74 61 69 true] [file tai
25ce0 6c 20 24 6e 6f 72 74 68 77 69 6e 64 45 66 44 62 l $northwindEfDb
25cf0 46 69 6c 65 5d 5d 0d 0a 20 20 20 20 20 20 7d 0d File]].. }.
25d00 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 . }..... p
25d10 72 6f 63 20 6d 6f 76 65 54 65 73 74 4c 6f 67 46 roc moveTestLogF
25d20 69 6c 65 20 7b 20 70 61 74 68 20 7d 20 7b 0d 0a ile { path } {..
25d30 20 20 20 20 20 20 69 66 20 7b 5b 69 6e 66 6f 20 if {[info
25d40 65 78 69 73 74 73 20 3a 3a 74 65 73 74 5f 6c 6f exists ::test_lo
25d50 67 5d 20 26 26 20 5b 66 69 6c 65 20 65 78 69 73 g] && [file exis
25d60 74 73 20 24 3a 3a 74 65 73 74 5f 6c 6f 67 5d 7d ts $::test_log]}
25d70 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
25d80 20 73 65 74 20 6f 6c 64 5f 74 65 73 74 5f 6c 6f set old_test_lo
25d90 67 20 24 3a 3a 74 65 73 74 5f 6c 6f 67 0d 0a 20 g $::test_log..
25da0 20 20 20 20 20 20 20 73 65 74 20 6e 65 77 5f 74 set new_t
25db0 65 73 74 5f 6c 6f 67 20 5b 66 69 6c 65 20 6a 6f est_log [file jo
25dc0 69 6e 20 24 70 61 74 68 20 5b 66 69 6c 65 20 74 in $path [file t
25dd0 61 69 6c 20 24 6f 6c 64 5f 74 65 73 74 5f 6c 6f ail $old_test_lo
25de0 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 66 g]].... f
25df0 69 6c 65 20 63 6f 70 79 20 24 6f 6c 64 5f 74 65 ile copy $old_te
25e00 73 74 5f 6c 6f 67 20 24 6e 65 77 5f 74 65 73 74 st_log $new_test
25e10 5f 6c 6f 67 3b 20 66 69 6c 65 20 64 65 6c 65 74 _log; file delet
25e20 65 20 24 6f 6c 64 5f 74 65 73 74 5f 6c 6f 67 0d e $old_test_log.
25e30 0a 20 20 20 20 20 20 20 20 73 65 74 20 3a 3a 74 . set ::t
25e40 65 73 74 5f 6c 6f 67 20 24 6e 65 77 5f 74 65 73 est_log $new_tes
25e50 74 5f 6c 6f 67 0d 0a 0d 0a 20 20 20 20 20 20 20 t_log....
25e60 20 69 66 20 7b 5b 69 6e 66 6f 20 65 78 69 73 74 if {[info exist
25e70 73 20 3a 3a 74 65 73 74 5f 6c 6f 67 5f 70 61 74 s ::test_log_pat
25e80 68 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 h]} then {..
25e90 20 20 20 20 20 20 73 65 74 20 3a 3a 74 65 73 74 set ::test
25ea0 5f 6c 6f 67 5f 70 61 74 68 20 24 70 61 74 68 0d _log_path $path.
25eb0 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
25ec0 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
25ed0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
25ee0 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
25ef0 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6d 6f 76 "---- mov
25f00 65 64 20 74 65 73 74 20 6c 6f 67 20 66 72 6f 6d ed test log from
25f10 20 5c 22 22 20 24 6f 6c 64 5f 74 65 73 74 5f 6c \"" $old_test_l
25f20 6f 67 20 22 5c 22 20 74 6f 20 5c 22 22 20 5c 0d og "\" to \"" \.
25f30 0a 20 20 20 20 20 20 20 20 20 20 20 20 24 6e 65 . $ne
25f40 77 5f 74 65 73 74 5f 6c 6f 67 20 5c 22 5c 6e 5d w_test_log \"\n]
25f50 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d .. }.. }
25f60 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 72 75 ..... proc ru
25f70 6e 53 51 4c 69 74 65 54 65 73 74 50 72 6f 6c 6f nSQLiteTestProlo
25f80 67 75 65 20 7b 7d 20 7b 0d 0a 20 20 20 20 20 20 gue {} {..
25f90 23 0d 0a 20 20 20 20 20 20 23 20 4e 4f 54 45 3a #.. # NOTE:
25fa0 20 53 6b 69 70 20 72 75 6e 6e 69 6e 67 20 6f 75 Skip running ou
25fb0 72 20 63 75 73 74 6f 6d 20 70 72 6f 6c 6f 67 75 r custom prologu
25fc0 65 20 69 66 20 74 68 65 20 6d 61 69 6e 20 6f 6e e if the main on
25fd0 65 20 68 61 73 20 62 65 65 6e 0d 0a 20 20 20 20 e has been..
25fe0 20 20 23 20 20 20 20 20 20 20 73 6b 69 70 70 65 # skippe
25ff0 64 2e 0d 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 d... #..
26000 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 if {![info ex
26010 69 73 74 73 20 3a 3a 6e 6f 28 70 72 6f 6c 6f 67 ists ::no(prolog
26020 75 65 2e 65 61 67 6c 65 29 5d 7d 20 74 68 65 6e ue.eagle)]} then
26030 20 7b 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 {.. #..
26040 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 # NOTE: S
26050 61 76 65 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d ave the environm
26060 65 6e 74 20 76 61 72 69 61 62 6c 65 73 20 74 68 ent variables th
26070 61 74 20 77 65 20 69 6e 74 65 6e 64 20 74 6f 20 at we intend to
26080 63 68 61 6e 67 65 20 66 6f 72 0d 0a 20 20 20 20 change for..
26090 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 20 # the
260a0 74 65 73 74 20 73 75 69 74 65 2e 0d 0a 20 20 20 test suite...
260b0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
260c0 73 61 76 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 saveEnvironmentV
260d0 61 72 69 61 62 6c 65 73 20 5c 0d 0a 20 20 20 20 ariables \..
260e0 20 20 20 20 20 20 20 20 5b 6c 69 73 74 20 49 6e [list In
260f0 69 74 69 61 6c 69 7a 65 5f 53 51 4c 69 74 65 4c itialize_SQLiteL
26100 6f 67 5d 20 3a 3a 74 65 73 74 53 75 69 74 65 53 og] ::testSuiteS
26110 61 76 65 64 45 6e 76 0d 0a 0d 0a 20 20 20 20 20 avedEnv....
26120 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
26130 4e 4f 54 45 3a 20 46 6f 72 63 65 20 74 68 65 20 NOTE: Force the
26140 6d 61 6e 61 67 65 64 20 6c 6f 67 67 69 6e 67 20 managed logging
26150 73 75 62 73 79 73 74 65 6d 20 74 6f 20 61 74 74 subsystem to att
26160 65 6d 70 74 20 74 6f 20 69 6e 69 74 69 61 6c 69 empt to initiali
26170 7a 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ze.. #
26180 20 20 20 20 69 74 73 65 6c 66 20 6d 6f 72 65 20 itself more
26190 74 68 61 6e 20 6f 6e 63 65 2e 0d 0a 20 20 20 20 than once...
261a0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 73 #.. s
261b0 65 74 20 3a 3a 65 6e 76 28 49 6e 69 74 69 61 6c et ::env(Initial
261c0 69 7a 65 5f 53 51 4c 69 74 65 4c 6f 67 29 20 31 ize_SQLiteLog) 1
261d0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
261e0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4c # NOTE: L
261f0 6f 61 64 20 74 68 65 20 22 62 65 66 6f 72 65 2d oad the "before-
26200 63 6f 6e 73 74 72 61 69 6e 74 73 22 20 63 75 73 constraints" cus
26210 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 61 6e 64 tom per-user and
26220 2f 6f 72 20 70 65 72 2d 68 6f 73 74 0d 0a 20 20 /or per-host..
26230 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 65 # te
26240 73 74 20 73 65 74 74 69 6e 67 73 20 6e 6f 77 2e st settings now.
26250 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
26260 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 5b uplevel 1 [
26270 6c 69 73 74 20 6c 6f 61 64 53 51 4c 69 74 65 54 list loadSQLiteT
26280 65 73 74 53 65 74 74 69 6e 67 73 20 24 3a 3a 74 estSettings $::t
26290 65 73 74 5f 63 68 61 6e 6e 65 6c 20 2e 62 65 66 est_channel .bef
262a0 6f 72 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ore]....
262b0 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
262c0 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 65 20 E: Check if the
262d0 5b 6f 62 6a 65 63 74 5d 20 63 6f 6d 6d 61 6e 64 [object] command
262e0 20 69 73 20 61 76 61 69 6c 61 62 6c 65 3b 20 69 is available; i
262f0 66 20 6e 6f 74 2c 20 61 64 64 20 73 6f 6d 65 0d f not, add some.
26300 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
26310 20 73 68 69 6d 73 20 74 6f 20 6d 61 6b 65 20 74 shims to make t
26320 68 65 20 74 65 73 74 20 73 75 69 74 65 20 72 75 he test suite ru
26330 6e 20 73 6d 6f 6f 74 68 65 72 2e 0d 0a 20 20 20 n smoother...
26340 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
26350 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 4f 62 checkForSQLiteOb
26360 6a 65 63 74 43 6f 6d 6d 61 6e 64 20 24 3a 3a 74 jectCommand $::t
26370 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 est_channel....
26380 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
26390 20 20 23 20 4e 4f 54 45 3a 20 44 65 74 65 72 6d # NOTE: Determ
263a0 69 6e 65 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 ine the names of
263b0 20 74 68 65 20 6e 61 74 69 76 65 20 70 6c 61 74 the native plat
263c0 66 6f 72 6d 20 61 6e 64 20 61 72 63 68 69 74 65 form and archite
263d0 63 74 75 72 65 2e 0d 0a 20 20 20 20 20 20 20 20 cture...
263e0 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 70 #.. set p
263f0 6c 61 74 66 6f 72 6d 20 5b 67 65 74 42 75 69 6c latform [getBuil
26400 64 50 6c 61 74 66 6f 72 6d 20 74 72 75 65 5d 0d dPlatform true].
26410 0a 20 20 20 20 20 20 20 20 73 65 74 20 61 72 63 . set arc
26420 68 69 74 65 63 74 75 72 65 20 5b 61 72 63 68 69 hitecture [archi
26430 74 65 63 74 75 72 65 46 6f 72 50 6c 61 74 66 6f tectureForPlatfo
26440 72 6d 20 24 70 6c 61 74 66 6f 72 6d 5d 0d 0a 0d rm $platform]...
26450 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
26460 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f 77 # NOTE: Show
26470 20 74 68 65 20 70 6c 61 74 66 6f 72 6d 20 61 6e the platform an
26480 64 20 61 72 63 68 69 74 65 63 74 75 72 65 20 75 d architecture u
26490 73 65 64 20 74 6f 20 68 65 6c 70 20 6c 6f 63 61 sed to help loca
264a0 74 65 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 te the..
264b0 23 20 20 20 20 20 20 20 6e 61 74 69 76 65 20 62 # native b
264c0 75 69 6c 64 20 66 69 6c 65 73 2e 0d 0a 20 20 20 uild files...
264d0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
264e0 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
264f0 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
26500 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s \..
26510 20 22 2d 2d 2d 2d 20 70 6c 61 74 66 6f 72 6d 20 "---- platform
26520 66 6f 72 20 6c 6f 63 61 74 69 6e 67 20 6e 61 74 for locating nat
26530 69 76 65 20 62 75 69 6c 64 20 66 69 6c 65 73 20 ive build files
26540 69 73 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 is \"" \..
26550 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 6d 20 $platform
26560 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 \"\n]....
26570 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
26580 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
26590 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
265a0 20 20 22 2d 2d 2d 2d 20 61 72 63 68 69 74 65 63 "---- architec
265b0 74 75 72 65 20 66 6f 72 20 6c 6f 63 61 74 69 6e ture for locatin
265c0 67 20 6e 61 74 69 76 65 20 62 75 69 6c 64 20 66 g native build f
265d0 69 6c 65 73 20 69 73 20 5c 22 22 20 5c 0d 0a 20 iles is \"" \..
265e0 20 20 20 20 20 20 20 20 20 20 20 24 61 72 63 68 $arch
265f0 69 74 65 63 74 75 72 65 20 5c 22 5c 6e 5d 0d 0a itecture \"\n]..
26600 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
26610 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 # NOTE: Bui
26620 6c 64 20 61 20 6c 69 73 74 20 6f 66 20 63 6f 6e ld a list of con
26630 66 69 67 75 72 61 74 69 6f 6e 20 66 69 6c 65 73 figuration files
26640 20 74 68 61 74 20 77 65 20 68 61 6e 64 6c 65 2e that we handle.
26650 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
26660 20 20 20 20 20 73 65 74 20 63 6f 6e 66 69 67 46 set configF
26670 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 20 5c ileNames [list \
26680 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 79 .. Sy
26690 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
266a0 2e 64 6c 6c 2e 63 6f 6e 66 69 67 5d 0d 0a 0d 0a .dll.config]....
266b0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
266c0 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 # NOTE: Build
266d0 20 61 20 6c 69 73 74 20 6f 66 20 61 75 78 69 6c a list of auxil
266e0 69 61 72 79 20 4d 61 6e 61 67 65 64 20 44 65 62 iary Managed Deb
266f0 75 67 67 69 6e 67 20 41 73 73 69 73 74 61 6e 74 ugging Assistant
26700 73 20 28 4d 44 41 29 0d 0a 20 20 20 20 20 20 20 s (MDA)..
26710 20 23 20 20 20 20 20 20 20 63 6f 6e 66 69 67 75 # configu
26720 72 61 74 69 6f 6e 20 66 69 6c 65 73 20 74 68 61 ration files tha
26730 74 20 77 65 20 68 61 6e 64 6c 65 2e 0d 0a 20 20 t we handle...
26740 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
26750 20 73 65 74 20 6d 64 61 43 6f 6e 66 69 67 46 69 set mdaConfigFi
26760 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 20 5c 0d leNames [list \.
26770 0a 20 20 20 20 20 20 20 20 20 20 20 20 45 61 67 . Eag
26780 6c 65 53 68 65 6c 6c 33 32 2e 65 78 65 2e 6d 64 leShell32.exe.md
26790 61 2e 63 6f 6e 66 69 67 20 49 6e 73 74 61 6c 6c a.config Install
267a0 65 72 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 69 er.exe.mda.confi
267b0 67 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 g \..
267c0 20 74 65 73 74 2e 65 78 65 2e 6d 64 61 2e 63 6f test.exe.mda.co
267d0 6e 66 69 67 20 74 65 73 74 6c 69 6e 71 2e 65 78 nfig testlinq.ex
267e0 65 2e 6d 64 61 2e 63 6f 6e 66 69 67 20 5c 0d 0a e.mda.config \..
267f0 20 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 test
26800 65 66 36 2e 65 78 65 2e 6d 64 61 2e 63 6f 6e 66 ef6.exe.mda.conf
26810 69 67 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 ig].... #
26820 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
26830 3a 20 42 75 69 6c 64 20 74 68 65 20 6c 69 73 74 : Build the list
26840 20 6f 66 20 65 78 74 65 72 6e 61 6c 20 66 69 6c of external fil
26850 65 73 20 74 68 61 74 20 77 65 20 68 61 6e 64 6c es that we handl
26860 65 2e 20 20 53 6f 6d 65 20 6f 66 0d 0a 20 20 20 e. Some of..
26870 20 20 20 20 20 23 20 20 20 20 20 20 20 74 68 65 # the
26880 73 65 20 66 69 6c 65 73 20 6d 61 79 20 62 65 20 se files may be
26890 6e 61 74 69 76 65 20 61 6e 64 2f 6f 72 20 6d 61 native and/or ma
268a0 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 69 65 73 naged assemblies
268b0 20 74 68 61 74 20 61 72 65 0d 0a 20 20 20 20 20 that are..
268c0 20 20 20 23 20 20 20 20 20 20 20 72 65 71 75 69 # requi
268d0 72 65 64 20 74 6f 20 70 65 72 66 6f 72 6d 20 76 red to perform v
268e0 61 72 69 6f 75 73 20 74 65 73 74 73 2e 0d 0a 20 arious tests...
268f0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
26900 20 20 73 65 74 20 65 78 74 65 72 6e 61 6c 46 69 set externalFi
26910 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 20 5c 0d leNames [list \.
26920 0a 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 . [fi
26930 6c 65 20 6a 6f 69 6e 20 45 6e 74 69 74 79 46 72 le join EntityFr
26940 61 6d 65 77 6f 72 6b 20 6c 69 62 20 5b 73 74 72 amework lib [str
26950 69 6e 67 20 6d 61 70 20 5b 6c 69 73 74 20 46 78 ing map [list Fx
26960 20 22 22 5d 20 5c 0d 0a 20 20 20 20 20 20 20 20 ""] \..
26970 20 20 20 20 5b 73 74 72 69 6e 67 20 6d 61 70 20 [string map
26980 5b 6c 69 73 74 20 6e 65 74 46 78 34 35 31 20 6e [list netFx451 n
26990 65 74 46 78 34 35 20 6e 65 74 46 78 34 35 32 20 etFx45 netFx452
269a0 6e 65 74 46 78 34 35 20 6e 65 74 46 78 34 36 20 netFx45 netFx46
269b0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6e \.. n
269c0 65 74 46 78 34 35 20 6e 65 74 46 78 34 36 31 20 etFx45 netFx461
269d0 6e 65 74 46 78 34 35 20 6e 65 74 46 78 34 36 32 netFx45 netFx462
269e0 20 6e 65 74 46 78 34 35 20 6e 65 74 46 78 34 37 netFx45 netFx47
269f0 20 6e 65 74 46 78 34 35 20 5c 0d 0a 20 20 20 20 netFx45 \..
26a00 20 20 20 20 20 20 20 20 6e 65 74 46 78 34 37 31 netFx471
26a10 20 6e 65 74 46 78 34 35 20 6e 65 74 46 78 34 37 netFx45 netFx47
26a20 32 20 6e 65 74 46 78 34 35 20 6e 65 74 53 74 61 2 netFx45 netSta
26a30 6e 64 61 72 64 32 30 20 6e 65 74 46 78 34 35 5d ndard20 netFx45]
26a40 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
26a50 5b 67 65 74 42 75 69 6c 64 4e 65 74 46 78 5d 5d [getBuildNetFx]]
26a60 5d 20 45 6e 74 69 74 79 46 72 61 6d 65 77 6f 72 ] EntityFramewor
26a70 6b 2e 64 6c 6c 5d 5d 0d 0a 0d 0a 20 20 20 20 20 k.dll]]....
26a80 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
26a90 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 65 20 NOTE: Build the
26aa0 6c 69 73 74 20 6f 66 20 6e 61 74 69 76 65 20 61 list of native a
26ab0 73 73 65 6d 62 6c 79 20 66 69 6c 65 73 20 74 68 ssembly files th
26ac0 61 74 20 77 65 20 68 61 6e 64 6c 65 2e 0d 0a 20 at we handle...
26ad0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
26ae0 20 20 73 65 74 20 6e 61 74 69 76 65 46 69 6c 65 set nativeFile
26af0 4e 61 6d 65 73 20 5b 6c 69 73 74 5d 0d 0a 0d 0a Names [list]....
26b00 20 20 20 20 20 20 20 20 65 76 61 6c 20 6c 61 70 eval lap
26b10 70 65 6e 64 20 6e 61 74 69 76 65 46 69 6c 65 4e pend nativeFileN
26b20 61 6d 65 73 20 5b 67 65 74 4e 61 74 69 76 65 4c ames [getNativeL
26b30 69 62 72 61 72 79 46 69 6c 65 4e 61 6d 65 73 4f ibraryFileNamesO
26b40 6e 6c 79 5d 0d 0a 20 20 20 20 20 20 20 20 65 76 nly].. ev
26b50 61 6c 20 6c 61 70 70 65 6e 64 20 6e 61 74 69 76 al lappend nativ
26b60 65 46 69 6c 65 4e 61 6d 65 73 20 5b 67 65 74 49 eFileNames [getI
26b70 6e 74 65 72 6f 70 41 73 73 65 6d 62 6c 79 46 69 nteropAssemblyFi
26b80 6c 65 4e 61 6d 65 73 4f 6e 6c 79 5d 0d 0a 0d 0a leNamesOnly]....
26b90 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
26ba0 20 20 20 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 # NOTE: Build
26bb0 20 74 68 65 20 6c 69 73 74 20 6f 66 20 6d 69 78 the list of mix
26bc0 65 64 2d 6d 6f 64 65 20 61 73 73 65 6d 62 6c 79 ed-mode assembly
26bd0 20 66 69 6c 65 73 20 74 68 61 74 20 77 65 20 68 files that we h
26be0 61 6e 64 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 andle...
26bf0 23 0d 0a 20 20 20 20 20 20 20 20 73 65 74 20 6d #.. set m
26c00 69 78 65 64 46 69 6c 65 4e 61 6d 65 73 20 5b 6c ixedFileNames [l
26c10 69 73 74 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 ist]....
26c20 69 66 20 7b 5b 68 61 73 52 75 6e 74 69 6d 65 4f if {[hasRuntimeO
26c30 70 74 69 6f 6e 20 6e 61 74 69 76 65 5d 7d 20 74 ption native]} t
26c40 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
26c50 20 6c 61 70 70 65 6e 64 20 6d 69 78 65 64 46 69 lappend mixedFi
26c60 6c 65 4e 61 6d 65 73 20 53 79 73 74 65 6d 2e 44 leNames System.D
26c70 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 0d 0a ata.SQLite.dll..
26c80 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
26c90 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
26ca0 23 20 4e 4f 54 45 3a 20 42 75 69 6c 64 20 74 68 # NOTE: Build th
26cb0 65 20 6c 69 73 74 20 6f 66 20 6d 61 6e 61 67 65 e list of manage
26cc0 64 20 61 73 73 65 6d 62 6c 79 20 66 69 6c 65 73 d assembly files
26cd0 20 74 68 61 74 20 77 65 20 68 61 6e 64 6c 65 2e that we handle.
26ce0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
26cf0 20 20 20 20 20 73 65 74 20 6d 61 6e 61 67 65 64 set managed
26d00 46 69 6c 65 4e 61 6d 65 73 20 5b 6c 69 73 74 20 FileNames [list
26d10 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 \.. S
26d20 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
26d30 65 2e 4c 69 6e 71 2e 64 6c 6c 20 53 79 73 74 65 e.Linq.dll Syste
26d40 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 45 46 m.Data.SQLite.EF
26d50 36 2e 64 6c 6c 5d 0d 0a 0d 0a 20 20 20 20 20 20 6.dll]....
26d60 20 20 69 66 20 7b 21 5b 68 61 73 52 75 6e 74 69 if {![hasRunti
26d70 6d 65 4f 70 74 69 6f 6e 20 6e 61 74 69 76 65 5d meOption native]
26d80 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
26d90 20 20 20 20 6c 61 70 70 65 6e 64 20 6d 61 6e 61 lappend mana
26da0 67 65 64 46 69 6c 65 4e 61 6d 65 73 20 53 79 73 gedFileNames Sys
26db0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
26dc0 64 6c 6c 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a dll.. }..
26dd0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
26de0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 68 6f # NOTE: Sho
26df0 77 20 74 68 65 20 76 61 72 69 6f 75 73 20 6c 69 w the various li
26e00 73 74 73 20 6f 66 20 66 69 6c 65 20 6e 61 6d 65 sts of file name
26e10 73 20 74 68 61 74 20 61 72 65 20 68 61 6e 64 6c s that are handl
26e20 65 64 20 62 79 20 74 68 69 73 0d 0a 20 20 20 20 ed by this..
26e30 20 20 20 20 23 20 20 20 20 20 20 20 70 72 6f 63 # proc
26e40 65 64 75 72 65 2e 0d 0a 20 20 20 20 20 20 20 20 edure...
26e50 23 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 #.. tputs
26e60 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
26e70 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
26e80 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
26e90 2d 20 6c 69 73 74 20 6f 66 20 5c 22 63 6f 6e 66 - list of \"conf
26ea0 69 67 75 72 61 74 69 6f 6e 5c 22 20 66 69 6c 65 iguration\" file
26eb0 20 6e 61 6d 65 73 20 69 73 3a 20 22 20 5c 0d 0a names is: " \..
26ec0 20 20 20 20 20 20 20 20 20 20 20 20 24 63 6f 6e $con
26ed0 66 69 67 46 69 6c 65 4e 61 6d 65 73 20 5c 6e 5d figFileNames \n]
26ee0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 .... tput
26ef0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
26f00 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
26f10 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d . "--
26f20 2d 2d 20 6c 69 73 74 20 6f 66 20 5c 22 4d 44 41 -- list of \"MDA
26f30 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5c 22 configuration\"
26f40 20 66 69 6c 65 20 6e 61 6d 65 73 20 69 73 3a 20 file names is:
26f50 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 " \..
26f60 20 24 6d 64 61 43 6f 6e 66 69 67 46 69 6c 65 4e $mdaConfigFileN
26f70 61 6d 65 73 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 ames \n]....
26f80 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 tputs $::tes
26f90 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e t_channel [appen
26fa0 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 dArgs \..
26fb0 20 20 20 20 20 22 2d 2d 2d 2d 20 6c 69 73 74 20 "---- list
26fc0 6f 66 20 5c 22 65 78 74 65 72 6e 61 6c 5c 22 20 of \"external\"
26fd0 66 69 6c 65 20 6e 61 6d 65 73 20 69 73 3a 20 22 file names is: "
26fe0 20 24 65 78 74 65 72 6e 61 6c 46 69 6c 65 4e 61 $externalFileNa
26ff0 6d 65 73 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 mes \n]....
27000 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
27010 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
27020 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
27030 20 20 20 20 22 2d 2d 2d 2d 20 6c 69 73 74 20 6f "---- list o
27040 66 20 5c 22 6e 61 74 69 76 65 5c 22 20 66 69 6c f \"native\" fil
27050 65 20 6e 61 6d 65 73 20 69 73 3a 20 22 20 24 6e e names is: " $n
27060 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 5c ativeFileNames \
27070 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 74 70 n].... tp
27080 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
27090 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
270a0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
270b0 2d 2d 2d 2d 20 6c 69 73 74 20 6f 66 20 5c 22 6d ---- list of \"m
270c0 69 78 65 64 5c 22 20 66 69 6c 65 20 6e 61 6d 65 ixed\" file name
270d0 73 20 69 73 3a 20 22 20 24 6d 69 78 65 64 46 69 s is: " $mixedFi
270e0 6c 65 4e 61 6d 65 73 20 5c 6e 5d 0d 0a 0d 0a 20 leNames \n]....
270f0 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
27100 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 test_channel [ap
27110 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 pendArgs \..
27120 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 6c 69 "---- li
27130 73 74 20 6f 66 20 5c 22 6d 61 6e 61 67 65 64 5c st of \"managed\
27140 22 20 66 69 6c 65 20 6e 61 6d 65 73 20 69 73 3a " file names is:
27150 20 22 20 24 6d 61 6e 61 67 65 64 46 69 6c 65 4e " $managedFileN
27160 61 6d 65 73 20 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 ames \n]....
27170 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
27180 20 4e 4f 54 45 3a 20 52 65 6d 6f 76 65 20 61 6e NOTE: Remove an
27190 79 20 74 65 73 74 20 63 6f 6e 73 74 72 61 69 6e y test constrain
271a0 74 73 20 74 68 61 74 20 72 65 66 65 72 20 74 6f ts that refer to
271b0 20 74 68 65 20 6e 61 74 69 76 65 20 61 6e 64 2f the native and/
271c0 6f 72 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 or.. #
271d0 20 20 20 20 6d 61 6e 61 67 65 64 20 61 73 73 65 managed asse
271e0 6d 62 6c 79 20 66 69 6c 65 73 20 74 68 61 74 20 mbly files that
271f0 77 65 20 68 61 6e 64 6c 65 20 75 6e 6c 65 73 73 we handle unless
27200 20 66 6f 72 62 69 64 64 65 6e 20 66 72 6f 6d 0d forbidden from.
27210 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 . #
27220 20 64 6f 69 6e 67 20 73 6f 2e 0d 0a 20 20 20 20 doing so...
27230 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 #.. i
27240 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
27250 20 3a 3a 6e 6f 28 73 71 6c 69 74 65 52 65 6d 6f ::no(sqliteRemo
27260 76 65 43 6f 6e 73 74 72 61 69 6e 74 73 29 5d 7d veConstraints)]}
27270 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
27280 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e foreach fileN
27290 61 6d 65 20 24 63 6f 6e 66 69 67 46 69 6c 65 4e ame $configFileN
272a0 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 ames {..
272b0 20 20 20 20 72 65 6d 6f 76 65 43 6f 6e 73 74 72 removeConstr
272c0 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 aint [appendArgs
272d0 20 66 69 6c 65 5f 20 24 66 69 6c 65 4e 61 6d 65 file_ $fileName
272e0 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
272f0 0d 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 .. fore
27300 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d 64 ach fileName $md
27310 61 43 6f 6e 66 69 67 46 69 6c 65 4e 61 6d 65 73 aConfigFileNames
27320 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
27330 72 65 6d 6f 76 65 43 6f 6e 73 74 72 61 69 6e 74 removeConstraint
27340 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
27350 65 5f 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 e_ $fileName]..
27360 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
27370 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
27380 66 69 6c 65 4e 61 6d 65 20 24 65 78 74 65 72 6e fileName $extern
27390 61 6c 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 alFileNames {..
273a0 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 6f 76 remov
273b0 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 eConstraint [app
273c0 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5b 66 endArgs file_ [f
273d0 69 6c 65 20 74 61 69 6c 20 24 66 69 6c 65 4e 61 ile tail $fileNa
273e0 6d 65 5d 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 me]]..
273f0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 66 }.... f
27400 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 oreach fileName
27410 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 $nativeFileNames
27420 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
27430 72 65 6d 6f 76 65 43 6f 6e 73 74 72 61 69 6e 74 removeConstraint
27440 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
27450 65 5f 20 24 66 69 6c 65 4e 61 6d 65 5d 0d 0a 20 e_ $fileName]..
27460 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
27470 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
27480 66 69 6c 65 4e 61 6d 65 20 24 6d 69 78 65 64 46 fileName $mixedF
27490 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 ileNames {..
274a0 20 20 20 20 20 20 20 20 72 65 6d 6f 76 65 43 6f removeCo
274b0 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
274c0 41 72 67 73 20 66 69 6c 65 5f 20 24 66 69 6c 65 Args file_ $file
274d0 4e 61 6d 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 Name]..
274e0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
274f0 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 foreach fileName
27500 20 24 6d 61 6e 61 67 65 64 46 69 6c 65 4e 61 6d $managedFileNam
27510 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
27520 20 20 72 65 6d 6f 76 65 43 6f 6e 73 74 72 61 69 removeConstrai
27530 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 nt [appendArgs f
27540 69 6c 65 5f 20 24 66 69 6c 65 4e 61 6d 65 5d 0d ile_ $fileName].
27550 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
27560 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
27570 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
27580 4e 4f 54 45 3a 20 53 6b 69 70 20 61 6c 6c 20 53 NOTE: Skip all S
27590 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
275a0 65 20 72 65 6c 61 74 65 64 20 66 69 6c 65 20 68 e related file h
275b0 61 6e 64 6c 69 6e 67 20 28 64 65 6c 65 74 69 6e andling (deletin
275c0 67 2c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 g,.. #
275d0 20 20 20 20 63 6f 70 79 69 6e 67 2c 20 61 6e 64 copying, and
275e0 20 6c 6f 61 64 69 6e 67 29 20 69 66 20 69 6e 73 loading) if ins
275f0 74 72 75 63 74 65 64 2e 0d 0a 20 20 20 20 20 20 tructed...
27600 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 #.. if
27610 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a {![info exists :
27620 3a 6e 6f 28 73 71 6c 69 74 65 46 69 6c 65 73 29 :no(sqliteFiles)
27630 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
27640 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
27650 20 20 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 74 # NOTE: Skip t
27660 72 79 69 6e 67 20 74 6f 20 64 65 6c 65 74 65 20 rying to delete
27670 61 6e 79 20 66 69 6c 65 73 20 69 66 20 69 6e 73 any files if ins
27680 74 72 75 63 74 65 64 2e 0d 0a 20 20 20 20 20 20 tructed...
27690 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
276a0 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
276b0 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 ts ::no(deleteSq
276c0 6c 69 74 65 46 69 6c 65 73 29 5d 7d 20 74 68 65 liteFiles)]} the
276d0 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
276e0 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
276f0 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 ts ::no(deleteSq
27700 6c 69 74 65 43 6f 6e 66 69 67 46 69 6c 65 73 29 liteConfigFiles)
27710 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
27720 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 foreach
27730 20 66 69 6c 65 4e 61 6d 65 20 24 63 6f 6e 66 69 fileName $confi
27740 67 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 gFileNames {..
27750 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 tr
27760 79 44 65 6c 65 74 65 42 69 6e 61 72 79 46 69 6c yDeleteBinaryFil
27770 65 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 e $fileName..
27780 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
27790 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
277a0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
277b0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
277c0 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 65 45 78 o(deleteSqliteEx
277d0 74 65 72 6e 61 6c 46 69 6c 65 73 29 5d 7d 20 74 ternalFiles)]} t
277e0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
277f0 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
27800 65 4e 61 6d 65 20 24 6d 64 61 43 6f 6e 66 69 67 eName $mdaConfig
27810 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 FileNames {..
27820 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 try
27830 44 65 6c 65 74 65 42 75 69 6c 64 46 69 6c 65 20 DeleteBuildFile
27840 24 66 69 6c 65 4e 61 6d 65 20 66 61 6c 73 65 0d $fileName false.
27850 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
27860 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
27870 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
27880 6d 65 20 24 65 78 74 65 72 6e 61 6c 46 69 6c 65 me $externalFile
27890 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 Names {..
278a0 20 20 20 20 20 20 20 20 20 74 72 79 44 65 6c 65 tryDele
278b0 74 65 42 69 6e 61 72 79 46 69 6c 65 20 24 66 69 teBinaryFile $fi
278c0 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 leName..
278d0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
278e0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
278f0 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
27900 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c exists ::no(del
27910 65 74 65 53 71 6c 69 74 65 4e 61 74 69 76 65 46 eteSqliteNativeF
27920 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
27930 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
27940 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
27950 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 ::no(deleteSqlit
27960 65 49 6d 70 6c 69 63 69 74 4e 61 74 69 76 65 46 eImplicitNativeF
27970 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a iles)]} then {..
27980 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
27990 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 foreach fileName
279a0 20 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 $nativeFileName
279b0 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
279c0 20 20 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 tryDelete
279d0 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 Assembly $fileNa
279e0 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 me..
279f0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
27a00 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
27a10 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
27a20 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 fo exists ::no(d
27a30 65 6c 65 74 65 53 71 6c 69 74 65 4e 6f 6e 49 6d eleteSqliteNonIm
27a40 70 6c 69 63 69 74 46 69 6c 65 73 29 5d 7d 20 74 plicitFiles)]} t
27a50 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
27a60 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
27a70 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 o exists ::no(de
27a80 6c 65 74 65 53 71 6c 69 74 65 50 6c 61 74 66 6f leteSqlitePlatfo
27a90 72 6d 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a rmFiles)] && \..
27aa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
27ab0 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 [string leng
27ac0 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 th $platform] >
27ad0 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 0} then {..
27ae0 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 for
27af0 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6e each fileName $n
27b00 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b ativeFileNames {
27b10 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
27b20 20 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 41 tryDeleteA
27b30 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d ssembly $fileNam
27b40 65 20 24 70 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 e $platform..
27b50 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
27b60 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
27b70 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
27b80 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
27b90 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 o exists ::no(de
27ba0 6c 65 74 65 53 71 6c 69 74 65 41 72 63 68 69 74 leteSqliteArchit
27bb0 65 63 74 75 72 65 46 69 6c 65 73 29 5d 20 26 26 ectureFiles)] &&
27bc0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
27bd0 20 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 [string
27be0 6c 65 6e 67 74 68 20 24 61 72 63 68 69 74 65 63 length $architec
27bf0 74 75 72 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 ture] > 0} then
27c00 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
27c10 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c foreach fil
27c20 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 46 69 6c eName $nativeFil
27c30 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
27c40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 tr
27c50 79 44 65 6c 65 74 65 41 73 73 65 6d 62 6c 79 20 yDeleteAssembly
27c60 24 66 69 6c 65 4e 61 6d 65 20 24 61 72 63 68 69 $fileName $archi
27c70 74 65 63 74 75 72 65 0d 0a 20 20 20 20 20 20 20 tecture..
27c80 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
27c90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
27ca0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d . }
27cb0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d .. }.
27cc0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 ... i
27cd0 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
27ce0 20 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 ::no(deleteSqli
27cf0 74 65 4d 69 78 65 64 46 69 6c 65 73 29 5d 7d 20 teMixedFiles)]}
27d00 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
27d10 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
27d20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 49 # NOTE: I
27d30 66 20 74 68 65 20 22 6e 61 74 69 76 65 22 20 72 f the "native" r
27d40 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e 20 69 73 untime option is
27d50 20 73 65 74 2c 20 64 65 6c 65 74 65 20 69 6d 70 set, delete imp
27d60 6c 69 63 69 74 0d 0a 20 20 20 20 20 20 20 20 20 licit..
27d70 20 20 20 20 20 23 20 20 20 20 20 20 20 6d 69 78 # mix
27d80 65 64 2d 6d 6f 64 65 20 61 73 73 65 6d 62 6c 79 ed-mode assembly
27d90 20 66 69 6c 65 73 20 61 73 20 77 65 6c 6c 2e 20 files as well.
27da0 20 54 68 69 73 20 72 75 6e 74 69 6d 65 20 6f 70 This runtime op
27db0 74 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 tion..
27dc0 20 20 20 20 23 20 20 20 20 20 20 20 63 68 65 63 # chec
27dd0 6b 20 69 73 20 68 61 6e 64 6c 65 64 20 77 68 65 k is handled whe
27de0 6e 20 62 75 69 6c 64 69 6e 67 20 74 68 65 20 6c n building the l
27df0 69 73 74 20 6f 66 20 6d 69 78 65 64 2d 6d 6f 64 ist of mixed-mod
27e00 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e..
27e10 20 23 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c # assembl
27e20 79 20 66 69 6c 65 20 6e 61 6d 65 73 2e 0d 0a 20 y file names...
27e30 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
27e40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
27e50 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
27e60 3a 3a 6e 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 ::no(deleteSqlit
27e70 65 49 6d 70 6c 69 63 69 74 4d 69 78 65 64 46 69 eImplicitMixedFi
27e80 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 les)]} then {..
27e90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 f
27ea0 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 oreach fileName
27eb0 24 6d 69 78 65 64 46 69 6c 65 4e 61 6d 65 73 20 $mixedFileNames
27ec0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
27ed0 20 20 20 20 20 74 72 79 44 65 6c 65 74 65 41 73 tryDeleteAs
27ee0 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 sembly $fileName
27ef0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
27f00 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
27f10 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
27f20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
27f30 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c exists ::no(del
27f40 65 74 65 53 71 6c 69 74 65 4e 6f 6e 49 6d 70 6c eteSqliteNonImpl
27f50 69 63 69 74 46 69 6c 65 73 29 5d 7d 20 74 68 65 icitFiles)]} the
27f60 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
27f70 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
27f80 65 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 exists ::no(dele
27f90 74 65 53 71 6c 69 74 65 50 6c 61 74 66 6f 72 6d teSqlitePlatform
27fa0 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 Files)] && \..
27fb0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
27fc0 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 [string length
27fd0 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 7d $platform] > 0}
27fe0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
27ff0 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 forea
28000 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d 69 78 ch fileName $mix
28010 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 edFileNames {..
28020 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
28030 20 20 20 74 72 79 44 65 6c 65 74 65 41 73 73 65 tryDeleteAsse
28040 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 24 mbly $fileName $
28050 70 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 20 20 20 platform..
28060 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
28070 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d }
28080 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
28090 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
280a0 78 69 73 74 73 20 3a 3a 6e 6f 28 64 65 6c 65 74 xists ::no(delet
280b0 65 53 71 6c 69 74 65 41 72 63 68 69 74 65 63 74 eSqliteArchitect
280c0 75 72 65 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d ureFiles)] && \.
280d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
280e0 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
280f0 67 74 68 20 24 61 72 63 68 69 74 65 63 74 75 72 gth $architectur
28100 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a e] > 0} then {..
28110 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
28120 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
28130 6d 65 20 24 6d 69 78 65 64 46 69 6c 65 4e 61 6d me $mixedFileNam
28140 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
28150 20 20 20 20 20 20 20 20 20 20 74 72 79 44 65 6c tryDel
28160 65 74 65 41 73 73 65 6d 62 6c 79 20 24 66 69 6c eteAssembly $fil
28170 65 4e 61 6d 65 20 24 61 72 63 68 69 74 65 63 74 eName $architect
28180 75 72 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ure..
28190 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
281a0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
281b0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
281c0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
281d0 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
281e0 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
281f0 6f 28 64 65 6c 65 74 65 53 71 6c 69 74 65 4d 61 o(deleteSqliteMa
28200 6e 61 67 65 64 46 69 6c 65 73 29 5d 7d 20 74 68 nagedFiles)]} th
28210 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
28220 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
28230 4e 61 6d 65 20 24 6d 61 6e 61 67 65 64 46 69 6c Name $managedFil
28240 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
28250 20 20 20 20 20 20 20 20 20 20 74 72 79 44 65 6c tryDel
28260 65 74 65 41 73 73 65 6d 62 6c 79 20 24 66 69 6c eteAssembly $fil
28270 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 20 20 eName..
28280 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
28290 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
282a0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
282b0 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
282c0 4f 54 45 3a 20 43 68 65 63 6b 20 66 6f 72 20 74 OTE: Check for t
282d0 68 65 20 22 61 75 74 6f 53 65 6c 65 63 74 22 20 he "autoSelect"
282e0 72 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e 2e 20 runtime option.
282f0 20 49 66 20 70 72 65 73 65 6e 74 2c 0d 0a 20 20 If present,..
28300 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
28310 61 74 74 65 6d 70 74 20 74 6f 20 61 75 74 6f 6d attempt to autom
28320 61 74 69 63 61 6c 6c 79 20 73 65 6c 65 63 74 20 atically select
28330 74 68 65 20 66 69 72 73 74 20 61 76 61 69 6c 61 the first availa
28340 62 6c 65 0d 0a 20 20 20 20 20 20 20 20 20 20 23 ble.. #
28350 20 20 20 20 20 20 20 62 75 69 6c 64 20 28 6f 72 build (or
28360 20 22 72 65 6c 65 61 73 65 22 29 20 6f 66 20 53 "release") of S
28370 51 4c 69 74 65 20 61 6e 64 20 53 79 73 74 65 6d QLite and System
28380 2e 44 61 74 61 2e 53 51 4c 69 74 65 0d 0a 20 20 .Data.SQLite..
28390 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
283a0 66 6f 72 20 75 73 65 20 77 69 74 68 20 74 68 65 for use with the
283b0 20 74 65 73 74 20 73 75 69 74 65 2e 0d 0a 20 20 test suite...
283c0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
283d0 20 20 20 20 20 69 66 20 7b 5b 68 61 73 52 75 6e if {[hasRun
283e0 74 69 6d 65 4f 70 74 69 6f 6e 20 61 75 74 6f 53 timeOption autoS
283f0 65 6c 65 63 74 5d 7d 20 74 68 65 6e 20 7b 0d 0a elect]} then {..
28400 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
28410 21 5b 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 ![checkForSQLite
28420 42 75 69 6c 64 73 20 24 3a 3a 74 65 73 74 5f 63 Builds $::test_c
28430 68 61 6e 6e 65 6c 20 74 72 75 65 5d 7d 20 74 68 hannel true]} th
28440 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
28450 20 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 checkForSQLi
28460 74 65 52 65 6c 65 61 73 65 73 20 24 3a 3a 74 65 teReleases $::te
28470 73 74 5f 63 68 61 6e 6e 65 6c 20 74 72 75 65 0d st_channel true.
28480 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
28490 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
284a0 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
284b0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 53 6b # NOTE: Sk
284c0 69 70 20 74 72 79 69 6e 67 20 74 6f 20 76 65 72 ip trying to ver
284d0 69 66 79 20 74 68 65 20 62 75 69 6c 64 20 64 69 ify the build di
284e0 72 65 63 74 6f 72 79 20 69 66 20 69 6e 73 74 72 rectory if instr
284f0 75 63 74 65 64 3b 0d 0a 20 20 20 20 20 20 20 20 ucted;..
28500 20 20 23 20 20 20 20 20 20 20 6f 74 68 65 72 77 # otherw
28510 69 73 65 2c 20 6d 61 6b 65 20 73 75 72 65 20 69 ise, make sure i
28520 74 20 61 63 74 75 61 6c 6c 79 20 65 78 69 73 74 t actually exist
28530 73 20 6f 72 20 68 61 6c 74 20 74 68 65 20 65 6e s or halt the en
28540 74 69 72 65 0d 0a 20 20 20 20 20 20 20 20 20 20 tire..
28550 23 20 20 20 20 20 20 20 74 65 73 74 69 6e 67 20 # testing
28560 70 72 6f 63 65 73 73 20 69 66 20 69 74 20 64 6f process if it do
28570 65 73 20 6e 6f 74 20 65 78 69 73 74 2e 0d 0a 20 es not exist...
28580 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
28590 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
285a0 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 76 65 72 exists ::no(ver
285b0 69 66 79 42 75 69 6c 64 44 69 72 65 63 74 6f 72 ifyBuildDirector
285c0 79 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 y)]} then {..
285d0 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
285e0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
285f0 41 74 20 74 68 69 73 20 70 6f 69 6e 74 2c 20 74 At this point, t
28600 68 65 20 62 75 69 6c 64 20 64 69 72 65 63 74 6f he build directo
28610 72 69 65 73 20 4d 55 53 54 20 65 78 69 73 74 20 ries MUST exist
28620 66 6f 72 0d 0a 20 20 20 20 20 20 20 20 20 20 20 for..
28630 20 23 20 20 20 20 20 20 20 74 68 65 20 74 65 73 # the tes
28640 74 69 6e 67 20 70 72 6f 63 65 73 73 20 74 6f 20 ting process to
28650 63 6f 6e 74 69 6e 75 65 2e 0d 0a 20 20 20 20 20 continue...
28660 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
28670 20 20 20 20 20 20 73 65 74 20 64 69 72 65 63 74 set direct
28680 6f 72 79 20 5b 67 65 74 42 75 69 6c 64 44 69 72 ory [getBuildDir
28690 65 63 74 6f 72 79 20 66 61 6c 73 65 5d 0d 0a 0d ectory false]...
286a0 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 . if
286b0 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {![file exists $
286c0 64 69 72 65 63 74 6f 72 79 5d 20 7c 7c 20 5c 0d directory] || \.
286d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
286e0 20 21 5b 66 69 6c 65 20 69 73 64 69 72 65 63 74 ![file isdirect
286f0 6f 72 79 20 24 64 69 72 65 63 74 6f 72 79 5d 7d ory $directory]}
28700 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
28710 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
28720 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
28730 4a 75 73 74 20 70 72 69 6f 72 20 74 6f 20 61 63 Just prior to ac
28740 74 75 61 6c 6c 79 20 68 61 6c 74 69 6e 67 20 74 tually halting t
28750 68 65 20 74 65 73 74 69 6e 67 20 70 72 6f 63 65 he testing proce
28760 73 73 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ss,..
28770 20 20 20 23 20 20 20 20 20 20 20 61 64 64 20 61 # add a
28780 6e 20 65 72 72 6f 72 20 74 6f 20 74 68 65 20 74 n error to the t
28790 65 73 74 20 6c 6f 67 20 66 69 6c 65 2e 0d 0a 20 est log file...
287a0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
287b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
287c0 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
287d0 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
287e0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
287f0 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 75 6c 64 "---- could
28800 20 6e 6f 74 20 76 65 72 69 66 79 20 6e 61 74 69 not verify nati
28810 76 65 20 62 75 69 6c 64 20 64 69 72 65 63 74 6f ve build directo
28820 72 79 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 ry \"" \..
28830 20 20 20 20 20 20 20 20 20 20 20 20 24 64 69 72 $dir
28840 65 63 74 6f 72 79 20 22 5c 22 2c 20 61 6c 6c 20 ectory "\", all
28850 74 65 73 74 69 6e 67 20 68 61 6c 74 65 64 5c 6e testing halted\n
28860 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 "]....
28870 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
28880 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 61 69 # NOTE: Rai
28890 73 69 6e 67 20 61 20 73 63 72 69 70 74 20 65 72 sing a script er
288a0 72 6f 72 20 66 72 6f 6d 20 74 68 69 73 20 70 6f ror from this po
288b0 69 6e 74 20 73 68 6f 75 6c 64 20 68 61 6c 74 0d int should halt.
288c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
288d0 20 20 20 20 20 20 20 74 68 65 20 74 65 73 74 69 the testi
288e0 6e 67 20 70 72 6f 63 65 73 73 2e 0d 0a 20 20 20 ng process...
288f0 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 #..
28900 20 20 20 20 20 20 20 20 20 20 20 20 65 72 72 6f erro
28910 72 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d r [appendArgs \.
28920 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
28930 20 20 20 22 63 6f 75 6c 64 20 6e 6f 74 20 76 65 "could not ve
28940 72 69 66 79 20 6e 61 74 69 76 65 20 62 75 69 6c rify native buil
28950 64 20 64 69 72 65 63 74 6f 72 79 20 5c 22 22 20 d directory \""
28960 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
28970 20 20 20 20 20 24 64 69 72 65 63 74 6f 72 79 20 $directory
28980 22 5c 22 2c 20 61 6c 6c 20 74 65 73 74 69 6e 67 "\", all testing
28990 20 68 61 6c 74 65 64 22 5d 0d 0a 20 20 20 20 20 halted"]..
289a0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
289b0 20 20 20 20 20 20 20 20 73 65 74 20 64 69 72 65 set dire
289c0 63 74 6f 72 79 20 5b 67 65 74 42 75 69 6c 64 44 ctory [getBuildD
289d0 69 72 65 63 74 6f 72 79 20 74 72 75 65 5d 0d 0a irectory true]..
289e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
289f0 20 7b 21 5b 66 69 6c 65 20 65 78 69 73 74 73 20 {![file exists
28a00 24 64 69 72 65 63 74 6f 72 79 5d 20 7c 7c 20 5c $directory] || \
28a10 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
28a20 20 20 21 5b 66 69 6c 65 20 69 73 64 69 72 65 63 ![file isdirec
28a30 74 6f 72 79 20 24 64 69 72 65 63 74 6f 72 79 5d tory $directory]
28a40 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
28a50 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
28a60 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
28a70 20 4a 75 73 74 20 70 72 69 6f 72 20 74 6f 20 61 Just prior to a
28a80 63 74 75 61 6c 6c 79 20 68 61 6c 74 69 6e 67 20 ctually halting
28a90 74 68 65 20 74 65 73 74 69 6e 67 20 70 72 6f 63 the testing proc
28aa0 65 73 73 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 ess,..
28ab0 20 20 20 20 23 20 20 20 20 20 20 20 61 64 64 20 # add
28ac0 61 6e 20 65 72 72 6f 72 20 74 6f 20 74 68 65 20 an error to the
28ad0 74 65 73 74 20 6c 6f 67 20 66 69 6c 65 2e 0d 0a test log file...
28ae0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d #.
28af0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 . t
28b00 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
28b10 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 nnel [appendArgs
28b20 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
28b30 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 75 6c "---- coul
28b40 64 20 6e 6f 74 20 76 65 72 69 66 79 20 6d 61 6e d not verify man
28b50 61 67 65 64 20 62 75 69 6c 64 20 64 69 72 65 63 aged build direc
28b60 74 6f 72 79 20 5c 22 22 20 5c 0d 0a 20 20 20 20 tory \"" \..
28b70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 64 $d
28b80 69 72 65 63 74 6f 72 79 20 22 5c 22 2c 20 61 6c irectory "\", al
28b90 6c 20 74 65 73 74 69 6e 67 20 68 61 6c 74 65 64 l testing halted
28ba0 5c 6e 22 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 \n"]....
28bb0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
28bc0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 # NOTE: R
28bd0 61 69 73 69 6e 67 20 61 20 73 63 72 69 70 74 20 aising a script
28be0 65 72 72 6f 72 20 66 72 6f 6d 20 74 68 69 73 20 error from this
28bf0 70 6f 69 6e 74 20 73 68 6f 75 6c 64 20 68 61 6c point should hal
28c00 74 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 t..
28c10 20 23 20 20 20 20 20 20 20 74 68 65 20 74 65 73 # the tes
28c20 74 69 6e 67 20 70 72 6f 63 65 73 73 2e 0d 0a 20 ting process...
28c30 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
28c40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 72 er
28c50 72 6f 72 20 5b 61 70 70 65 6e 64 41 72 67 73 20 ror [appendArgs
28c60 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
28c70 20 20 20 20 20 22 63 6f 75 6c 64 20 6e 6f 74 20 "could not
28c80 76 65 72 69 66 79 20 6d 61 6e 61 67 65 64 20 62 verify managed b
28c90 75 69 6c 64 20 64 69 72 65 63 74 6f 72 79 20 5c uild directory \
28ca0 22 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 "" \..
28cb0 20 20 20 20 20 20 20 20 24 64 69 72 65 63 74 6f $directo
28cc0 72 79 20 22 5c 22 2c 20 61 6c 6c 20 74 65 73 74 ry "\", all test
28cd0 69 6e 67 20 68 61 6c 74 65 64 22 5d 0d 0a 20 20 ing halted"]..
28ce0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 }....
28cf0 20 20 20 20 20 20 20 20 20 20 20 73 65 74 20 6c set l
28d00 6f 67 44 69 72 65 63 74 6f 72 79 20 24 64 69 72 ogDirectory $dir
28d10 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 20 20 ectory..
28d20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 } else {..
28d30 20 20 20 20 20 20 20 20 73 65 74 20 6c 6f 67 44 set logD
28d40 69 72 65 63 74 6f 72 79 20 5b 67 65 74 42 75 69 irectory [getBui
28d50 6c 64 44 69 72 65 63 74 6f 72 79 20 74 72 75 65 ldDirectory true
28d60 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a ].. }..
28d70 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 .. #..
28d80 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a # NOTE:
28d90 20 57 65 27 72 65 20 67 6f 69 6e 67 20 74 6f 20 We're going to
28da0 6d 6f 76 65 20 74 68 65 20 74 65 73 74 20 6c 6f move the test lo
28db0 67 20 66 69 6c 65 20 74 6f 20 74 68 65 20 64 69 g file to the di
28dc0 72 65 63 74 6f 72 79 0d 0a 20 20 20 20 20 20 20 rectory..
28dd0 20 20 20 23 20 20 20 20 20 20 20 63 6f 6e 74 61 # conta
28de0 69 6e 69 6e 67 20 74 68 65 20 6d 61 6e 61 67 65 ining the manage
28df0 64 20 61 73 73 65 6d 62 6c 69 65 73 20 62 65 69 d assemblies bei
28e00 6e 67 20 74 65 73 74 65 64 2e 0d 0a 20 20 20 20 ng tested...
28e10 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
28e20 20 20 20 6d 6f 76 65 54 65 73 74 4c 6f 67 46 69 moveTestLogFi
28e30 6c 65 20 24 6c 6f 67 44 69 72 65 63 74 6f 72 79 le $logDirectory
28e40 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d .... #.
28e50 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 . # NOT
28e60 45 3a 20 53 6b 69 70 20 74 72 79 69 6e 67 20 74 E: Skip trying t
28e70 6f 20 63 6f 70 79 20 61 6e 79 20 66 69 6c 65 73 o copy any files
28e80 20 69 66 20 69 6e 73 74 72 75 63 74 65 64 2e 0d if instructed..
28e90 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
28ea0 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
28eb0 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 fo exists ::no(c
28ec0 6f 70 79 53 71 6c 69 74 65 46 69 6c 65 73 29 5d opySqliteFiles)]
28ed0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
28ee0 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
28ef0 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 exists ::no(cop
28f00 79 53 71 6c 69 74 65 43 6f 6e 66 69 67 46 69 6c ySqliteConfigFil
28f10 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 es)]} then {..
28f20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
28f30 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
28f40 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 l \..
28f50 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 "---- cop
28f60 79 69 6e 67 20 5c 22 63 6f 6e 66 69 67 75 72 61 ying \"configura
28f70 74 69 6f 6e 5c 22 20 66 69 6c 65 73 2e 2e 2e 5c tion\" files...\
28f80 6e 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 n"....
28f90 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 foreach file
28fa0 4e 61 6d 65 20 24 63 6f 6e 66 69 67 46 69 6c 65 Name $configFile
28fb0 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 Names {..
28fc0 20 20 20 20 20 20 20 20 20 74 72 79 43 6f 70 79 tryCopy
28fd0 42 75 69 6c 64 46 69 6c 65 20 24 66 69 6c 65 4e BuildFile $fileN
28fe0 61 6d 65 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 ame false..
28ff0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
29000 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
29010 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 if {![i
29020 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
29030 63 6f 70 79 53 71 6c 69 74 65 45 78 74 65 72 6e copySqliteExtern
29040 61 6c 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 alFiles)]} then
29050 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
29060 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 #..
29070 20 20 23 20 4e 4f 54 45 3a 20 43 6f 70 79 20 74 # NOTE: Copy t
29080 68 65 20 4d 61 6e 61 67 65 64 20 44 65 62 75 67 he Managed Debug
29090 67 69 6e 67 20 41 73 73 69 73 74 61 6e 74 73 20 ging Assistants
290a0 28 4d 44 41 29 20 63 6f 6e 66 69 67 75 72 61 74 (MDA) configurat
290b0 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ion..
290c0 20 20 20 23 20 20 20 20 20 20 20 66 69 6c 65 20 # file
290d0 66 6f 72 20 74 68 65 20 45 61 67 6c 65 20 73 68 for the Eagle sh
290e0 65 6c 6c 20 74 6f 20 74 68 65 20 62 75 69 6c 64 ell to the build
290f0 20 6f 75 74 70 75 74 20 64 69 72 65 63 74 6f 72 output director
29100 79 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 y,..
29110 20 20 23 20 20 20 20 20 20 20 77 68 69 6c 65 20 # while
29120 75 73 69 6e 67 20 65 61 63 68 20 6f 66 20 74 68 using each of th
29130 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 20 76 e names of the v
29140 61 72 69 6f 75 73 20 6c 65 67 61 63 79 20 74 65 arious legacy te
29150 73 74 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 st..
29160 20 20 23 20 20 20 20 20 20 20 65 78 65 63 75 74 # execut
29170 61 62 6c 65 73 2e 20 20 54 68 69 73 20 77 69 6c ables. This wil
29180 6c 20 68 65 6c 70 20 74 6f 20 6d 61 6b 65 20 73 l help to make s
29190 75 72 65 20 74 68 61 74 20 61 6c 6c 20 74 68 65 ure that all the
291a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
291b0 23 20 20 20 20 20 20 20 6c 65 67 61 63 79 20 74 # legacy t
291c0 65 73 74 73 20 72 75 6e 20 77 69 74 68 20 65 78 ests run with ex
291d0 61 63 74 6c 79 20 74 68 65 20 73 61 6d 65 20 73 actly the same s
291e0 65 74 20 6f 66 20 4d 61 6e 61 67 65 64 0d 0a 20 et of Managed..
291f0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 #
29200 20 20 20 20 20 44 65 62 75 67 67 69 6e 67 20 41 Debugging A
29210 73 73 69 73 74 61 6e 74 73 20 63 6f 6e 66 69 67 ssistants config
29220 75 72 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 20 ured...
29230 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
29240 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
29250 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 est_channel \..
29260 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
29270 20 22 2d 2d 2d 2d 20 63 6f 70 79 69 6e 67 20 5c "---- copying \
29280 22 4d 44 41 20 63 6f 6e 66 69 67 75 72 61 74 69 "MDA configurati
29290 6f 6e 5c 22 20 66 69 6c 65 73 2e 2e 2e 5c 6e 22 on\" files...\n"
292a0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
292b0 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
292c0 6d 65 20 24 6d 64 61 43 6f 6e 66 69 67 46 69 6c me $mdaConfigFil
292d0 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
292e0 20 20 20 20 20 20 20 20 20 20 74 72 79 43 6f 70 tryCop
292f0 79 42 69 6e 61 72 79 46 69 6c 65 20 45 61 67 6c yBinaryFile Eagl
29300 65 53 68 65 6c 6c 2e 65 78 65 2e 6d 64 61 2e 63 eShell.exe.mda.c
29310 6f 6e 66 69 67 20 74 72 75 65 20 22 22 20 24 66 onfig true "" $f
29320 69 6c 65 4e 61 6d 65 0d 0a 20 20 20 20 20 20 20 ileName..
29330 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
29340 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
29350 20 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 # NOT
29360 45 3a 20 43 6f 70 79 20 74 68 65 20 65 78 74 65 E: Copy the exte
29370 72 6e 61 6c 20 62 69 6e 61 72 69 65 73 2c 20 69 rnal binaries, i
29380 66 20 61 6e 79 2c 20 74 6f 20 74 68 65 20 64 69 f any, to the di
29390 72 65 63 74 6f 72 79 20 74 68 61 74 0d 0a 20 20 rectory that..
293a0 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 #
293b0 20 20 20 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 contains the
293c0 20 45 61 67 6c 65 20 73 68 65 6c 6c 2e 20 20 54 Eagle shell. T
293d0 68 69 73 20 69 73 20 74 79 70 69 63 61 6c 6c 79 his is typically
293e0 20 75 73 65 64 20 74 6f 20 6d 61 6b 65 0d 0a 20 used to make..
293f0 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 #
29400 20 20 20 20 20 73 75 72 65 20 61 73 73 65 6d 62 sure assemb
29410 6c 69 65 73 20 72 65 66 65 72 65 6e 63 65 64 20 lies referenced
29420 62 79 20 74 68 65 20 6f 6e 65 73 20 62 65 69 6e by the ones bein
29430 67 20 74 65 73 74 65 64 20 61 72 65 0d 0a 20 20 g tested are..
29440 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 20 #
29450 20 20 20 20 61 76 61 69 6c 61 62 6c 65 20 64 75 available du
29460 72 69 6e 67 20 74 68 65 20 74 65 73 74 69 6e 67 ring the testing
29470 20 70 72 6f 63 65 73 73 2e 0d 0a 20 20 20 20 20 process...
29480 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
29490 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
294a0 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
294b0 22 2d 2d 2d 2d 20 63 6f 70 79 69 6e 67 20 5c 22 "---- copying \"
294c0 65 78 74 65 72 6e 61 6c 5c 22 20 66 69 6c 65 73 external\" files
294d0 2e 2e 2e 5c 6e 22 0d 0a 0d 0a 20 20 20 20 20 20 ...\n"....
294e0 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
294f0 66 69 6c 65 4e 61 6d 65 20 24 65 78 74 65 72 6e fileName $extern
29500 61 6c 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 alFileNames {..
29510 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
29520 72 79 43 6f 70 79 45 78 74 65 72 6e 61 6c 46 69 ryCopyExternalFi
29530 6c 65 20 24 66 69 6c 65 4e 61 6d 65 0d 0a 20 20 le $fileName..
29540 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 }..
29550 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
29560 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
29570 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
29580 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 4e 61 74 no(copySqliteNat
29590 69 76 65 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e iveFiles)]} then
295a0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
295b0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
295c0 20 20 20 23 20 4e 4f 54 45 3a 20 49 66 20 74 68 # NOTE: If th
295d0 65 20 74 65 73 74 20 70 6c 61 74 66 6f 72 6d 20 e test platform
295e0 69 73 20 6c 69 6b 65 6c 79 20 74 68 65 20 64 65 is likely the de
295f0 66 61 75 6c 74 20 66 6f 72 20 74 68 69 73 0d 0a fault for this..
29600 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 #
29610 20 20 20 20 20 20 6d 61 63 68 69 6e 65 2c 20 61 machine, a
29620 6c 73 6f 20 74 72 79 20 74 6f 20 63 6f 70 79 20 lso try to copy
29630 74 68 65 20 6e 61 74 69 76 65 20 66 69 6c 65 73 the native files
29640 20 74 6f 20 74 68 65 0d 0a 20 20 20 20 20 20 20 to the..
29650 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 # b
29660 69 6e 61 72 79 20 6c 6f 63 61 74 69 6f 6e 2e 0d inary location..
29670 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 . #
29680 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
29690 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
296a0 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 s ::no(copySqlit
296b0 65 49 6d 70 6c 69 63 69 74 4e 61 74 69 76 65 46 eImplicitNativeF
296c0 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 20 iles)] && \..
296d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b [
296e0 69 73 44 65 66 61 75 6c 74 42 75 69 6c 64 50 6c isDefaultBuildPl
296f0 61 74 66 6f 72 6d 5d 7d 20 74 68 65 6e 20 7b 0d atform]} then {.
29700 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
29710 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
29720 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 hannel \..
29730 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
29740 2d 2d 2d 20 63 6f 70 79 69 6e 67 20 69 6d 70 6c --- copying impl
29750 69 63 69 74 20 5c 22 6e 61 74 69 76 65 5c 22 20 icit \"native\"
29760 66 69 6c 65 73 2e 2e 2e 5c 6e 22 0d 0a 0d 0a 20 files...\n"....
29770 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 f
29780 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 oreach fileName
29790 24 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 $nativeFileNames
297a0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
297b0 20 20 20 20 20 20 74 72 79 43 6f 70 79 41 73 73 tryCopyAss
297c0 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 embly $fileName
297d0 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 20 false..
297e0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
297f0 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
29800 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 if {!
29810 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e [info exists ::n
29820 6f 28 63 6f 70 79 53 71 6c 69 74 65 4e 6f 6e 49 o(copySqliteNonI
29830 6d 70 6c 69 63 69 74 46 69 6c 65 73 29 5d 7d 20 mplicitFiles)]}
29840 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
29850 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e if {![in
29860 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 fo exists ::no(c
29870 6f 70 79 53 71 6c 69 74 65 50 6c 61 74 66 6f 72 opySqlitePlatfor
29880 6d 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 mFiles)] && \..
29890 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
298a0 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 [string lengt
298b0 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 h $platform] > 0
298c0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
298d0 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 tput
298e0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
298f0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d l [appendArgs \.
29900 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
29910 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 "---- cop
29920 79 69 6e 67 20 5c 22 6e 61 74 69 76 65 5c 22 20 ying \"native\"
29930 66 69 6c 65 73 20 66 6f 72 20 70 6c 61 74 66 6f files for platfo
29940 72 6d 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 20 rm \"" \..
29950 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
29960 24 70 6c 61 74 66 6f 72 6d 20 5c 22 2e 2e 2e 5c $platform \"...\
29970 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 n]....
29980 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
29990 66 69 6c 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 fileName $native
299a0 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 FileNames {..
299b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
299c0 20 74 72 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 tryCopyAssembly
299d0 20 24 66 69 6c 65 4e 61 6d 65 20 66 61 6c 73 65 $fileName false
299e0 20 24 70 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 20 $platform..
299f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d }.
29a00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
29a10 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
29a20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f if {![info
29a30 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 exists ::no(cop
29a40 79 53 71 6c 69 74 65 41 72 63 68 69 74 65 63 74 ySqliteArchitect
29a50 75 72 65 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d ureFiles)] && \.
29a60 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
29a70 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c 65 6e [string len
29a80 67 74 68 20 24 61 72 63 68 69 74 65 63 74 75 72 gth $architectur
29a90 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a e] > 0} then {..
29aa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
29ab0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
29ac0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
29ad0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
29ae0 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d "--
29af0 2d 2d 20 63 6f 70 79 69 6e 67 20 5c 22 6e 61 74 -- copying \"nat
29b00 69 76 65 5c 22 20 66 69 6c 65 73 20 66 6f 72 20 ive\" files for
29b10 61 72 63 68 69 74 65 63 74 75 72 65 20 5c 22 22 architecture \""
29b20 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
29b30 20 20 20 20 20 20 20 20 20 20 24 61 72 63 68 69 $archi
29b40 74 65 63 74 75 72 65 20 5c 22 2e 2e 2e 5c 6e 5d tecture \"...\n]
29b50 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
29b60 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 69 foreach fi
29b70 6c 65 4e 61 6d 65 20 24 6e 61 74 69 76 65 46 69 leName $nativeFi
29b80 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
29b90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
29ba0 72 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 20 24 ryCopyAssembly $
29bb0 66 69 6c 65 4e 61 6d 65 20 66 61 6c 73 65 20 24 fileName false $
29bc0 61 72 63 68 69 74 65 63 74 75 72 65 0d 0a 20 20 architecture..
29bd0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
29be0 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 }..
29bf0 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
29c00 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 }..
29c10 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
29c20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 if {![info e
29c30 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 xists ::no(copyS
29c40 71 6c 69 74 65 4d 69 78 65 64 46 69 6c 65 73 29 qliteMixedFiles)
29c50 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
29c60 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
29c70 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
29c80 3a 20 49 66 20 74 68 65 20 22 6e 61 74 69 76 65 : If the "native
29c90 22 20 72 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e " runtime option
29ca0 20 69 73 20 73 65 74 2c 20 63 6f 70 79 20 69 6d is set, copy im
29cb0 70 6c 69 63 69 74 0d 0a 20 20 20 20 20 20 20 20 plicit..
29cc0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 6d 69 # mi
29cd0 78 65 64 2d 6d 6f 64 65 20 61 73 73 65 6d 62 6c xed-mode assembl
29ce0 79 20 66 69 6c 65 73 20 61 73 20 77 65 6c 6c 2e y files as well.
29cf0 20 20 54 68 65 20 72 75 6e 74 69 6d 65 20 6f 70 The runtime op
29d00 74 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 tion..
29d10 20 20 20 20 23 20 20 20 20 20 20 20 63 68 65 63 # chec
29d20 6b 20 69 73 20 68 61 6e 64 6c 65 64 20 77 68 65 k is handled whe
29d30 6e 20 62 75 69 6c 64 69 6e 67 20 74 68 65 20 6c n building the l
29d40 69 73 74 20 6f 66 20 6d 69 78 65 64 2d 6d 6f 64 ist of mixed-mod
29d50 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 e..
29d60 20 23 20 20 20 20 20 20 20 61 73 73 65 6d 62 6c # assembl
29d70 79 20 66 69 6c 65 20 6e 61 6d 65 73 2e 0d 0a 20 y file names...
29d80 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
29d90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
29da0 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
29db0 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 49 ::no(copySqliteI
29dc0 6d 70 6c 69 63 69 74 4d 69 78 65 64 46 69 6c 65 mplicitMixedFile
29dd0 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 s)]} then {..
29de0 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 75 tpu
29df0 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e ts $::test_chann
29e00 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 el \..
29e10 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
29e20 63 6f 70 79 69 6e 67 20 69 6d 70 6c 69 63 69 74 copying implicit
29e30 20 5c 22 6d 69 78 65 64 5c 22 20 66 69 6c 65 73 \"mixed\" files
29e40 2e 2e 2e 5c 6e 22 0d 0a 0d 0a 20 20 20 20 20 20 ...\n"....
29e50 20 20 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 foreac
29e60 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d 69 78 65 h fileName $mixe
29e70 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 dFileNames {..
29e80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
29e90 74 72 79 43 6f 70 79 41 73 73 65 6d 62 6c 79 20 tryCopyAssembly
29ea0 24 66 69 6c 65 4e 61 6d 65 20 66 61 6c 73 65 0d $fileName false.
29eb0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
29ec0 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
29ed0 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 }....
29ee0 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
29ef0 65 78 69 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 exists ::no(copy
29f00 53 71 6c 69 74 65 4e 6f 6e 49 6d 70 6c 69 63 69 SqliteNonImplici
29f10 74 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b tFiles)]} then {
29f20 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
29f30 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
29f40 73 74 73 20 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c sts ::no(copySql
29f50 69 74 65 50 6c 61 74 66 6f 72 6d 46 69 6c 65 73 itePlatformFiles
29f60 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 )] && \..
29f70 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 [st
29f80 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 70 6c 61 ring length $pla
29f90 74 66 6f 72 6d 5d 20 3e 20 30 7d 20 74 68 65 6e tform] > 0} then
29fa0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
29fb0 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
29fc0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
29fd0 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
29fe0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
29ff0 20 22 2d 2d 2d 2d 20 63 6f 70 79 69 6e 67 20 5c "---- copying \
2a000 22 6d 69 78 65 64 5c 22 20 66 69 6c 65 73 20 66 "mixed\" files f
2a010 6f 72 20 70 6c 61 74 66 6f 72 6d 20 5c 22 22 20 or platform \""
2a020 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
2a030 20 20 20 20 20 20 20 20 20 24 70 6c 61 74 66 6f $platfo
2a040 72 6d 20 5c 22 2e 2e 2e 5c 6e 5d 0d 0a 0d 0a 20 rm \"...\n]....
2a050 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2a060 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d foreach fileNam
2a070 65 20 24 6d 69 78 65 64 46 69 6c 65 4e 61 6d 65 e $mixedFileName
2a080 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 s {..
2a090 20 20 20 20 20 20 20 20 20 74 72 79 43 6f 70 79 tryCopy
2a0a0 41 73 73 65 6d 62 6c 79 20 24 66 69 6c 65 4e 61 Assembly $fileNa
2a0b0 6d 65 20 66 61 6c 73 65 20 24 70 6c 61 74 66 6f me false $platfo
2a0c0 72 6d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 rm..
2a0d0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
2a0e0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
2a0f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 if
2a100 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 {![info exists
2a110 3a 3a 6e 6f 28 63 6f 70 79 53 71 6c 69 74 65 41 ::no(copySqliteA
2a120 72 63 68 69 74 65 63 74 75 72 65 46 69 6c 65 73 rchitectureFiles
2a130 29 5d 20 26 26 20 5c 0d 0a 20 20 20 20 20 20 20 )] && \..
2a140 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 73 74 [st
2a150 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 61 72 63 ring length $arc
2a160 68 69 74 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 hitecture] > 0}
2a170 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2a180 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
2a190 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
2a1a0 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 [appendArgs \..
2a1b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2a1c0 20 20 20 20 20 22 2d 2d 2d 2d 20 63 6f 70 79 69 "---- copyi
2a1d0 6e 67 20 5c 22 6d 69 78 65 64 5c 22 20 66 69 6c ng \"mixed\" fil
2a1e0 65 73 20 66 6f 72 20 61 72 63 68 69 74 65 63 74 es for architect
2a1f0 75 72 65 20 5c 22 22 20 5c 0d 0a 20 20 20 20 20 ure \"" \..
2a200 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2a210 20 24 61 72 63 68 69 74 65 63 74 75 72 65 20 5c $architecture \
2a220 22 2e 2e 2e 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 "...\n]....
2a230 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f 72 for
2a240 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 6d each fileName $m
2a250 69 78 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d ixedFileNames {.
2a260 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
2a270 20 20 20 20 20 74 72 79 43 6f 70 79 41 73 73 65 tryCopyAsse
2a280 6d 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 66 mbly $fileName f
2a290 61 6c 73 65 20 24 61 72 63 68 69 74 65 63 74 75 alse $architectu
2a2a0 72 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 re..
2a2b0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
2a2c0 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
2a2d0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
2a2e0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
2a2f0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
2a300 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
2a310 28 63 6f 70 79 53 71 6c 69 74 65 4d 61 6e 61 67 (copySqliteManag
2a320 65 64 46 69 6c 65 73 29 5d 7d 20 74 68 65 6e 20 edFiles)]} then
2a330 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
2a340 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
2a350 68 61 6e 6e 65 6c 20 22 2d 2d 2d 2d 20 63 6f 70 hannel "---- cop
2a360 79 69 6e 67 20 5c 22 6d 61 6e 61 67 65 64 5c 22 ying \"managed\"
2a370 20 66 69 6c 65 73 2e 2e 2e 5c 6e 22 0d 0a 0d 0a files...\n"....
2a380 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6f fo
2a390 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 20 24 reach fileName $
2a3a0 6d 61 6e 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 managedFileNames
2a3b0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
2a3c0 20 20 20 20 74 72 79 43 6f 70 79 41 73 73 65 6d tryCopyAssem
2a3d0 62 6c 79 20 24 66 69 6c 65 4e 61 6d 65 20 74 72 bly $fileName tr
2a3e0 75 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ue..
2a3f0 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }..
2a400 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d }.. }.
2a410 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
2a420 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
2a430 3a 20 53 6b 69 70 20 74 72 79 69 6e 67 20 74 6f : Skip trying to
2a440 20 6c 6f 61 64 20 61 6e 79 20 66 69 6c 65 73 20 load any files
2a450 69 66 20 69 6e 73 74 72 75 63 74 65 64 2e 0d 0a if instructed...
2a460 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
2a470 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
2a480 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f o exists ::no(lo
2a490 61 64 53 71 6c 69 74 65 46 69 6c 65 73 29 5d 7d adSqliteFiles)]}
2a4a0 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
2a4b0 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 if {![info
2a4c0 65 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 exists ::no(load
2a4d0 53 71 6c 69 74 65 49 6d 70 6c 69 63 69 74 46 69 SqliteImplicitFi
2a4e0 6c 65 73 29 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 les)]} then {..
2a4f0 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 79 try
2a500 4c 6f 61 64 41 73 73 65 6d 62 6c 79 20 53 79 73 LoadAssembly Sys
2a510 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e tem.Data.SQLite.
2a520 64 6c 6c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 dll..
2a530 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
2a540 20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 if {![info exi
2a550 73 74 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c sts ::no(loadSql
2a560 69 74 65 4c 69 6e 71 46 69 6c 65 73 29 5d 7d 20 iteLinqFiles)]}
2a570 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2a580 20 20 20 20 20 20 74 72 79 4c 6f 61 64 41 73 73 tryLoadAss
2a590 65 6d 62 6c 79 20 53 79 73 74 65 6d 2e 44 61 74 embly System.Dat
2a5a0 61 2e 53 51 4c 69 74 65 2e 4c 69 6e 71 2e 64 6c a.SQLite.Linq.dl
2a5b0 6c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d l.. }
2a5c0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ....
2a5d0 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
2a5e0 73 20 3a 3a 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 s ::no(loadSqlit
2a5f0 65 45 66 36 46 69 6c 65 73 29 5d 7d 20 74 68 65 eEf6Files)]} the
2a600 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
2a610 20 20 20 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 tryLoadAssemb
2a620 6c 79 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 ly System.Data.S
2a630 51 4c 69 74 65 2e 45 46 36 2e 64 6c 6c 0d 0a 20 QLite.EF6.dll..
2a640 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
2a650 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
2a660 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a ![info exists ::
2a670 6e 6f 28 6c 6f 61 64 53 71 6c 69 74 65 4e 6f 6e no(loadSqliteNon
2a680 49 6d 70 6c 69 63 69 74 46 69 6c 65 73 29 5d 7d ImplicitFiles)]}
2a690 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
2a6a0 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e 66 if {![inf
2a6b0 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 6c 6f o exists ::no(lo
2a6c0 61 64 53 71 6c 69 74 65 50 6c 61 74 66 6f 72 6d adSqlitePlatform
2a6d0 46 69 6c 65 73 29 5d 20 26 26 20 5c 0d 0a 20 20 Files)] && \..
2a6e0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2a6f0 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
2a700 70 6c 61 74 66 6f 72 6d 5d 20 3e 20 30 7d 20 74 platform] > 0} t
2a710 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
2a720 20 20 20 20 20 20 20 74 72 79 4c 6f 61 64 41 73 tryLoadAs
2a730 73 65 6d 62 6c 79 20 53 79 73 74 65 6d 2e 44 61 sembly System.Da
2a740 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c 20 24 70 ta.SQLite.dll $p
2a750 6c 61 74 66 6f 72 6d 0d 0a 20 20 20 20 20 20 20 latform..
2a760 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
2a770 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
2a780 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f info exists ::no
2a790 28 6c 6f 61 64 53 71 6c 69 74 65 41 72 63 68 69 (loadSqliteArchi
2a7a0 74 65 63 74 75 72 65 46 69 6c 65 73 29 5d 20 26 tectureFiles)] &
2a7b0 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 & \..
2a7c0 20 20 20 20 20 20 20 5b 73 74 72 69 6e 67 20 6c [string l
2a7d0 65 6e 67 74 68 20 24 61 72 63 68 69 74 65 63 74 ength $architect
2a7e0 75 72 65 5d 20 3e 20 30 7d 20 74 68 65 6e 20 7b ure] > 0} then {
2a7f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2a800 20 20 74 72 79 4c 6f 61 64 41 73 73 65 6d 62 6c tryLoadAssembl
2a810 79 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 y System.Data.SQ
2a820 4c 69 74 65 2e 64 6c 6c 20 24 61 72 63 68 69 74 Lite.dll $archit
2a830 65 63 74 75 72 65 0d 0a 20 20 20 20 20 20 20 20 ecture..
2a840 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
2a850 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 }..
2a860 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a }.. }..
2a870 0d 0a 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 .. foreac
2a880 68 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 h fileNameOnly $
2a890 6e 61 74 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 nativeFileNames
2a8a0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 63 61 74 {.. cat
2a8b0 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 ch {..
2a8c0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
2a8d0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
2a8e0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
2a8f0 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c "---- fil
2a900 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 e version of \""
2a910 20 6e 61 74 69 76 65 2f 20 24 66 69 6c 65 4e 61 native/ $fileNa
2a920 6d 65 4f 6e 6c 79 20 5c 0d 0a 20 20 20 20 20 20 meOnly \..
2a930 20 20 20 20 20 20 20 20 20 20 22 5c 22 2e 2e 2e "\"...
2a940 20 5c 22 22 20 5b 66 69 6c 65 20 76 65 72 73 69 \"" [file versi
2a950 6f 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c on [getBinaryFil
2a960 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 eName \..
2a970 20 20 20 20 20 20 20 20 20 24 66 69 6c 65 4e 61 $fileNa
2a980 6d 65 4f 6e 6c 79 5d 5d 20 5c 22 5c 6e 5d 0d 0a meOnly]] \"\n]..
2a990 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
2a9a0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
2a9b0 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 foreach fileNa
2a9c0 6d 65 4f 6e 6c 79 20 24 6d 69 78 65 64 46 69 6c meOnly $mixedFil
2a9d0 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 eNames {..
2a9e0 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 catch {..
2a9f0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
2aa00 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
2aa10 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 appendArgs \..
2aa20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
2aa30 2d 2d 2d 20 66 69 6c 65 20 76 65 72 73 69 6f 6e --- file version
2aa40 20 6f 66 20 5c 22 22 20 6d 69 78 65 64 2f 20 24 of \"" mixed/ $
2aa50 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 5c 0d 0a fileNameOnly \..
2aa60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2aa70 22 5c 22 2e 2e 2e 20 5c 22 22 20 5b 66 69 6c 65 "\"... \"" [file
2aa80 20 76 65 72 73 69 6f 6e 20 5b 67 65 74 42 69 6e version [getBin
2aa90 61 72 79 46 69 6c 65 4e 61 6d 65 20 5c 0d 0a 20 aryFileName \..
2aaa0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 $
2aab0 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 5d 5d 20 5c fileNameOnly]] \
2aac0 22 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 "\n]..
2aad0 7d 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }.. }....
2aae0 20 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 foreach
2aaf0 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 6d 61 fileNameOnly $ma
2ab00 6e 61 67 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b nagedFileNames {
2ab10 0d 0a 20 20 20 20 20 20 20 20 20 20 63 61 74 63 .. catc
2ab20 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 h {..
2ab30 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
2ab40 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
2ab50 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 gs \..
2ab60 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 "---- file
2ab70 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 20 version of \""
2ab80 6d 61 6e 61 67 65 64 2f 20 24 66 69 6c 65 4e 61 managed/ $fileNa
2ab90 6d 65 4f 6e 6c 79 20 5c 0d 0a 20 20 20 20 20 20 meOnly \..
2aba0 20 20 20 20 20 20 20 20 20 20 22 5c 22 2e 2e 2e "\"...
2abb0 20 5c 22 22 20 5b 66 69 6c 65 20 76 65 72 73 69 \"" [file versi
2abc0 6f 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c on [getBinaryFil
2abd0 65 4e 61 6d 65 20 5c 0d 0a 20 20 20 20 20 20 20 eName \..
2abe0 20 20 20 20 20 20 20 20 20 24 66 69 6c 65 4e 61 $fileNa
2abf0 6d 65 4f 6e 6c 79 5d 5d 20 5c 22 5c 6e 5d 0d 0a meOnly]] \"\n]..
2ac00 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
2ac10 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
2ac20 20 20 69 66 20 7b 5b 73 74 72 69 6e 67 20 6c 65 if {[string le
2ac30 6e 67 74 68 20 24 70 6c 61 74 66 6f 72 6d 5d 20 ngth $platform]
2ac40 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 > 0} then {..
2ac50 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
2ac60 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 6e 61 74 ileNameOnly $nat
2ac70 69 76 65 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a iveFileNames {..
2ac80 20 20 20 20 20 20 20 20 20 20 20 20 63 61 74 63 catc
2ac90 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 h {..
2aca0 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 tputs $::test
2acb0 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 _channel [append
2acc0 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 Args \..
2acd0 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 "----
2ace0 66 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 file version of
2acf0 5c 22 22 20 6e 61 74 69 76 65 2f 70 6c 61 74 66 \"" native/platf
2ad00 6f 72 6d 2f 20 5c 0d 0a 20 20 20 20 20 20 20 20 orm/ \..
2ad10 20 20 20 20 20 20 20 20 20 20 24 70 6c 61 74 66 $platf
2ad20 6f 72 6d 20 2f 20 24 66 69 6c 65 4e 61 6d 65 4f orm / $fileNameO
2ad30 6e 6c 79 20 22 5c 22 2e 2e 2e 20 5c 22 22 20 5b nly "\"... \"" [
2ad40 66 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 file \..
2ad50 20 20 20 20 20 20 20 20 20 20 76 65 72 73 69 6f versio
2ad60 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 n [getBinaryFile
2ad70 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 4f 6e Name $fileNameOn
2ad80 6c 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ly \..
2ad90 20 20 20 20 20 20 20 20 24 70 6c 61 74 66 6f 72 $platfor
2ada0 6d 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 20 20 20 20 m]] \"\n]..
2adb0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
2adc0 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 }....
2add0 20 20 20 66 6f 72 65 61 63 68 20 66 69 6c 65 4e foreach fileN
2ade0 61 6d 65 4f 6e 6c 79 20 24 6d 69 78 65 64 46 69 ameOnly $mixedFi
2adf0 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 leNames {..
2ae00 20 20 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a catch {..
2ae10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 70 tp
2ae20 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
2ae30 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
2ae40 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
2ae50 20 20 20 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 "---- file
2ae60 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 22 20 6d version of \"" m
2ae70 69 78 65 64 2f 70 6c 61 74 66 6f 72 6d 2f 20 5c ixed/platform/ \
2ae80 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2ae90 20 20 20 20 24 70 6c 61 74 66 6f 72 6d 20 2f 20 $platform /
2aea0 24 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 22 5c $fileNameOnly "\
2aeb0 22 2e 2e 2e 20 5c 22 22 20 5b 66 69 6c 65 20 5c "... \"" [file \
2aec0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2aed0 20 20 20 20 76 65 72 73 69 6f 6e 20 5b 67 65 74 version [get
2aee0 42 69 6e 61 72 79 46 69 6c 65 4e 61 6d 65 20 24 BinaryFileName $
2aef0 66 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 5c 0d 0a fileNameOnly \..
2af00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2af10 20 20 24 70 6c 61 74 66 6f 72 6d 5d 5d 20 5c 22 $platform]] \"
2af20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 \n]..
2af30 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d }.. }.
2af40 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
2af50 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
2af60 67 20 6c 65 6e 67 74 68 20 24 61 72 63 68 69 74 g length $archit
2af70 65 63 74 75 72 65 5d 20 3e 20 30 7d 20 74 68 65 ecture] > 0} the
2af80 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 66 n {.. f
2af90 6f 72 65 61 63 68 20 66 69 6c 65 4e 61 6d 65 4f oreach fileNameO
2afa0 6e 6c 79 20 24 6e 61 74 69 76 65 46 69 6c 65 4e nly $nativeFileN
2afb0 61 6d 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 ames {..
2afc0 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 catch {..
2afd0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
2afe0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
2aff0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
2b000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2b010 20 20 22 2d 2d 2d 2d 20 66 69 6c 65 20 76 65 72 "---- file ver
2b020 73 69 6f 6e 20 6f 66 20 5c 22 22 20 6e 61 74 69 sion of \"" nati
2b030 76 65 2f 61 72 63 68 69 74 65 63 74 75 72 65 2f ve/architecture/
2b040 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
2b050 20 20 20 20 20 20 24 61 72 63 68 69 74 65 63 74 $architect
2b060 75 72 65 20 2f 20 24 66 69 6c 65 4e 61 6d 65 4f ure / $fileNameO
2b070 6e 6c 79 20 22 5c 22 2e 2e 2e 20 5c 22 22 20 5b nly "\"... \"" [
2b080 66 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 file \..
2b090 20 20 20 20 20 20 20 20 20 20 76 65 72 73 69 6f versio
2b0a0 6e 20 5b 67 65 74 42 69 6e 61 72 79 46 69 6c 65 n [getBinaryFile
2b0b0 4e 61 6d 65 20 24 66 69 6c 65 4e 61 6d 65 4f 6e Name $fileNameOn
2b0c0 6c 79 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 ly \..
2b0d0 20 20 20 20 20 20 20 20 24 61 72 63 68 69 74 65 $archite
2b0e0 63 74 75 72 65 5d 5d 20 5c 22 5c 6e 5d 0d 0a 20 cture]] \"\n]..
2b0f0 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 }..
2b100 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
2b110 20 20 20 20 20 20 20 66 6f 72 65 61 63 68 20 66 foreach f
2b120 69 6c 65 4e 61 6d 65 4f 6e 6c 79 20 24 6d 69 78 ileNameOnly $mix
2b130 65 64 46 69 6c 65 4e 61 6d 65 73 20 7b 0d 0a 20 edFileNames {..
2b140 20 20 20 20 20 20 20 20 20 20 20 63 61 74 63 68 catch
2b150 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
2b160 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
2b170 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
2b180 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
2b190 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 66 "---- f
2b1a0 69 6c 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c ile version of \
2b1b0 22 22 20 6d 69 78 65 64 2f 61 72 63 68 69 74 65 "" mixed/archite
2b1c0 63 74 75 72 65 2f 20 5c 0d 0a 20 20 20 20 20 20 cture/ \..
2b1d0 20 20 20 20 20 20 20 20 20 20 20 20 24 61 72 63 $arc
2b1e0 68 69 74 65 63 74 75 72 65 20 2f 20 24 66 69 6c hitecture / $fil
2b1f0 65 4e 61 6d 65 4f 6e 6c 79 20 22 5c 22 2e 2e 2e eNameOnly "\"...
2b200 20 5c 22 22 20 5b 66 69 6c 65 20 5c 0d 0a 20 20 \"" [file \..
2b210 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2b220 76 65 72 73 69 6f 6e 20 5b 67 65 74 42 69 6e 61 version [getBina
2b230 72 79 46 69 6c 65 4e 61 6d 65 20 24 66 69 6c 65 ryFileName $file
2b240 4e 61 6d 65 4f 6e 6c 79 20 5c 0d 0a 20 20 20 20 NameOnly \..
2b250 20 20 20 20 20 20 20 20 20 20 20 20 20 20 24 61 $a
2b260 72 63 68 69 74 65 63 74 75 72 65 5d 5d 20 5c 22 rchitecture]] \"
2b270 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 \n]..
2b280 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d }.. }.
2b290 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
2b2a0 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
2b2b0 20 23 20 4e 4f 54 45 3a 20 47 72 61 62 20 74 68 # NOTE: Grab th
2b2c0 65 20 6c 69 73 74 20 6f 66 20 6d 61 6e 61 67 65 e list of manage
2b2d0 64 20 61 73 73 65 6d 62 6c 69 65 73 20 66 6f 72 d assemblies for
2b2e0 20 74 68 65 20 63 75 72 72 65 6e 74 20 70 72 6f the current pro
2b2f0 63 65 73 73 0d 0a 20 20 20 20 20 20 20 20 23 20 cess.. #
2b300 20 20 20 20 20 20 61 6e 64 20 72 65 70 6f 72 74 and report
2b310 20 6f 6e 20 74 68 65 20 53 79 73 74 65 6d 2e 44 on the System.D
2b320 61 74 61 2e 53 51 4c 69 74 65 20 72 65 6c 61 74 ata.SQLite relat
2b330 65 64 20 6f 6e 65 73 2e 0d 0a 20 20 20 20 20 20 ed ones...
2b340 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 #.. if
2b350 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 {[haveSQLiteObje
2b360 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e ctCommand]} then
2b370 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 {.. if
2b380 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
2b390 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 object i
2b3a0 6e 76 6f 6b 65 20 55 74 69 6c 69 74 79 20 47 65 nvoke Utility Ge
2b3b0 74 41 73 73 65 6d 62 6c 69 65 73 0d 0a 20 20 20 tAssemblies..
2b3c0 20 20 20 20 20 20 20 7d 20 61 73 73 65 6d 62 6c } assembl
2b3d0 69 65 73 5d 20 3d 3d 20 30 20 7c 7c 20 5b 63 61 ies] == 0 || [ca
2b3e0 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 tch {..
2b3f0 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f 6b 65 object invoke
2b400 20 41 70 70 44 6f 6d 61 69 6e 2e 43 75 72 72 65 AppDomain.Curre
2b410 6e 74 44 6f 6d 61 69 6e 20 47 65 74 41 73 73 65 ntDomain GetAsse
2b420 6d 62 6c 69 65 73 0d 0a 20 20 20 20 20 20 20 20 mblies..
2b430 20 20 7d 20 61 73 73 65 6d 62 6c 69 65 73 5d 20 } assemblies]
2b440 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
2b450 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 object
2b460 20 66 6f 72 65 61 63 68 20 61 73 73 65 6d 62 6c foreach assembl
2b470 79 20 24 61 73 73 65 6d 62 6c 69 65 73 20 7b 0d y $assemblies {.
2b480 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 . i
2b490 66 20 7b 5b 73 74 72 69 6e 67 20 6d 61 74 63 68 f {[string match
2b4a0 20 5c 7b 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 \{System.Data.S
2b4b0 51 4c 69 74 65 2a 20 24 61 73 73 65 6d 62 6c 79 QLite* $assembly
2b4c0 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
2b4d0 20 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 tputs
2b4e0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
2b4f0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 5c 0d 0a [appendArgs \..
2b500 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2b510 20 20 20 20 22 2d 2d 2d 2d 20 66 6f 75 6e 64 20 "---- found
2b520 6c 6f 61 64 65 64 20 61 73 73 65 6d 62 6c 79 3a loaded assembly:
2b530 20 22 20 24 61 73 73 65 6d 62 6c 79 20 5c 6e 5d " $assembly \n]
2b540 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2b550 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d }.. }
2b560 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
2b570 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
2b580 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 catch {..
2b590 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a tputs $::
2b5a0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a test_channel \..
2b5b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d "-
2b5c0 2d 2d 2d 20 64 65 66 69 6e 65 20 63 6f 6e 73 74 --- define const
2b5d0 61 6e 74 73 20 66 6f 72 20 5c 22 53 79 73 74 65 ants for \"Syste
2b5e0 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 5c 22 2e m.Data.SQLite\".
2b5f0 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 .. "....
2b600 20 20 69 66 20 7b 5b 63 61 74 63 68 20 7b 0d 0a if {[catch {..
2b610 20 20 20 20 20 20 20 20 20 20 20 20 6f 62 6a 65 obje
2b620 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 ct invoke -flags
2b630 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 +NonPublic \..
2b640 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 S
2b650 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
2b660 65 2e 53 51 4c 69 74 65 33 20 44 65 66 69 6e 65 e.SQLite3 Define
2b670 43 6f 6e 73 74 61 6e 74 73 0d 0a 20 20 20 20 20 Constants..
2b680 20 20 20 20 20 7d 20 64 65 66 69 6e 65 43 6f 6e } defineCon
2b690 73 74 61 6e 74 73 5d 20 3d 3d 20 30 7d 20 74 68 stants] == 0} th
2b6a0 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
2b6b0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
2b6c0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
2b6d0 72 67 73 20 5b 66 6f 72 6d 61 74 4c 69 73 74 20 rgs [formatList
2b6e0 5b 6c 73 6f 72 74 20 5c 0d 0a 20 20 20 20 20 20 [lsort \..
2b6f0 20 20 20 20 20 20 20 20 20 20 24 64 65 66 69 6e $defin
2b700 65 43 6f 6e 73 74 61 6e 74 73 5d 20 3c 6e 6f 6e eConstants] <non
2b710 65 3e 5d 20 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 e>] \n]..
2b720 20 20 20 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 } else {..
2b730 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
2b740 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 75 ::test_channel u
2b750 6e 6b 6e 6f 77 6e 5c 6e 0d 0a 20 20 20 20 20 20 nknown\n..
2b760 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
2b770 0d 0a 0d 0a 20 20 20 20 20 20 20 20 63 61 74 63 .... catc
2b780 68 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 74 h {.. t
2b790 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
2b7a0 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 20 20 20 nnel \..
2b7b0 20 20 20 20 20 20 22 2d 2d 2d 2d 20 73 6f 75 72 "---- sour
2b7c0 63 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 5c 22 ce version of \"
2b7d0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
2b7e0 74 65 2e 64 6c 6c 5c 22 2e 2e 2e 20 22 0d 0a 0d te.dll\"... "...
2b7f0 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 5b . if {[
2b800 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 20 20 catch {..
2b810 20 20 20 20 20 6f 62 6a 65 63 74 20 69 6e 76 6f object invo
2b820 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f 6e 50 75 ke -flags +NonPu
2b830 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 20 20 20 blic \..
2b840 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 2e 44 System.D
2b850 61 74 61 2e 53 51 4c 69 74 65 2e 53 51 4c 69 74 ata.SQLite.SQLit
2b860 65 43 6f 6e 6e 65 63 74 69 6f 6e 20 50 72 6f 76 eConnection Prov
2b870 69 64 65 72 56 65 72 73 69 6f 6e 0d 0a 20 20 20 iderVersion..
2b880 20 20 20 20 20 20 20 7d 20 76 65 72 73 69 6f 6e } version
2b890 5d 20 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a ] == 0} then {..
2b8a0 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
2b8b0 5b 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 [string length $
2b8c0 76 65 72 73 69 6f 6e 5d 20 3d 3d 20 30 7d 20 74 version] == 0} t
2b8d0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
2b8e0 20 20 20 20 20 73 65 74 20 76 65 72 73 69 6f 6e set version
2b8f0 20 6e 75 6c 6c 0d 0a 20 20 20 20 20 20 20 20 20 null..
2b900 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 }..
2b910 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
2b920 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
2b930 72 67 73 20 24 76 65 72 73 69 6f 6e 20 5c 6e 5d rgs $version \n]
2b940 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c .. } el
2b950 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
2b960 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
2b970 63 68 61 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c channel unknown\
2b980 6e 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a n.. }..
2b990 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
2b9a0 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 catch {..
2b9b0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
2b9c0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d :test_channel \.
2b9d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 . "
2b9e0 2d 2d 2d 2d 20 73 6f 75 72 63 65 20 63 68 65 63 ---- source chec
2b9f0 6b 6f 75 74 20 6f 66 20 5c 22 53 79 73 74 65 6d kout of \"System
2ba00 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 64 6c 6c .Data.SQLite.dll
2ba10 5c 22 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 \"... "....
2ba20 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
2ba30 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6f {.. o
2ba40 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c bject invoke -fl
2ba50 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c ags +NonPublic \
2ba60 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2ba70 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
2ba80 4c 69 74 65 2e 53 51 4c 69 74 65 43 6f 6e 6e 65 Lite.SQLiteConne
2ba90 63 74 69 6f 6e 20 50 72 6f 76 69 64 65 72 53 6f ction ProviderSo
2baa0 75 72 63 65 49 64 0d 0a 20 20 20 20 20 20 20 20 urceId..
2bab0 20 20 7d 20 73 6f 75 72 63 65 49 64 5d 20 3d 3d } sourceId] ==
2bac0 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 0} then {..
2bad0 20 20 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 if {[str
2bae0 69 6e 67 20 6c 65 6e 67 74 68 20 24 73 6f 75 72 ing length $sour
2baf0 63 65 49 64 5d 20 3d 3d 20 30 7d 20 74 68 65 6e ceId] == 0} then
2bb00 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
2bb10 20 20 73 65 74 20 73 6f 75 72 63 65 49 64 20 6e set sourceId n
2bb20 75 6c 6c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ull..
2bb30 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 }..
2bb40 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
2bb50 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 annel [appendArg
2bb60 73 20 24 73 6f 75 72 63 65 49 64 20 5c 6e 5d 0d s $sourceId \n].
2bb70 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 . } els
2bb80 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e {..
2bb90 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
2bba0 68 61 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e hannel unknown\n
2bbb0 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 .. }..
2bbc0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
2bbd0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
2bbe0 20 4e 4f 54 45 3a 20 52 65 73 65 74 20 63 61 63 NOTE: Reset cac
2bbf0 68 65 64 20 22 62 72 65 61 6b 20 69 6e 74 6f 20 hed "break into
2bc00 64 65 62 75 67 67 65 72 22 20 73 65 74 74 69 6e debugger" settin
2bc10 67 20 73 6f 20 74 68 61 74 20 69 74 20 63 61 6e g so that it can
2bc20 20 62 65 0d 0a 20 20 20 20 20 20 20 20 23 20 20 be.. #
2bc30 20 20 20 20 20 75 73 65 64 20 64 75 72 69 6e 67 used during
2bc40 20 74 68 65 20 74 65 73 74 20 66 69 6c 65 2c 20 the test file,
2bc50 69 66 20 6e 65 65 64 65 64 2e 0d 0a 20 20 20 20 if needed...
2bc60 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 #.. i
2bc70 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 f {![info exists
2bc80 20 3a 3a 6e 6f 28 72 65 73 65 74 42 72 65 61 6b ::no(resetBreak
2bc90 49 6e 74 6f 44 65 62 75 67 67 65 72 29 5d 20 26 IntoDebugger)] &
2bca0 26 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 & \..
2bcb0 20 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 [haveSQLiteObje
2bcc0 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e ctCommand]} then
2bcd0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 69 66 {.. if
2bce0 20 7b 5b 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 {[catch {..
2bcf0 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 20 69 object i
2bd00 6e 76 6f 6b 65 20 2d 66 6c 61 67 73 20 2b 4e 6f nvoke -flags +No
2bd10 6e 50 75 62 6c 69 63 20 5c 0d 0a 20 20 20 20 20 nPublic \..
2bd20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 Syste
2bd30 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 48 65 m.Data.SQLite.He
2bd40 6c 70 65 72 4d 65 74 68 6f 64 73 20 52 65 73 65 lperMethods Rese
2bd50 74 42 72 65 61 6b 49 6e 74 6f 44 65 62 75 67 67 tBreakIntoDebugg
2bd60 65 72 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 er.. }
2bd70 72 65 73 75 6c 74 5d 20 3d 3d 20 30 7d 20 74 68 result] == 0} th
2bd80 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
2bd90 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
2bda0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
2bdb0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
2bdc0 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 61 6c "---- cal
2bdd0 6c 20 52 65 73 65 74 42 72 65 61 6b 49 6e 74 6f l ResetBreakInto
2bde0 44 65 62 75 67 67 65 72 28 29 2e 2e 2e 20 6f 6b Debugger()... ok
2bdf0 5c 6e 22 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 \n"]..
2be00 7d 20 65 6c 73 65 20 7b 0d 0a 20 20 20 20 20 20 } else {..
2be10 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
2be20 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
2be30 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
2be40 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
2be50 20 63 61 6c 6c 20 52 65 73 65 74 42 72 65 61 6b call ResetBreak
2be60 49 6e 74 6f 44 65 62 75 67 67 65 72 28 29 2e 2e IntoDebugger()..
2be70 2e 20 65 72 72 6f 72 3a 20 22 20 5c 0d 0a 20 20 . error: " \..
2be80 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 6e \n
2be90 5c 74 20 24 72 65 73 75 6c 74 20 5c 6e 5d 0d 0a \t $result \n]..
2bea0 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
2beb0 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
2bec0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
2bed0 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 65 20 61 OTE: Check the a
2bee0 76 61 69 6c 61 62 6c 65 20 62 75 69 6c 64 73 20 vailable builds
2bef0 28 61 6e 64 20 22 72 65 6c 65 61 73 65 73 22 29 (and "releases")
2bf00 20 6f 66 20 53 51 4c 69 74 65 20 61 6e 64 0d 0a of SQLite and..
2bf10 20 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 #
2bf20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
2bf30 74 65 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a te... #..
2bf40 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
2bf50 53 51 4c 69 74 65 42 75 69 6c 64 73 20 24 3a 3a SQLiteBuilds $::
2bf60 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 20 20 test_channel..
2bf70 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 53 51 checkForSQ
2bf80 4c 69 74 65 52 65 6c 65 61 73 65 73 20 24 3a 3a LiteReleases $::
2bf90 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a test_channel....
2bfa0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
2bfb0 20 20 20 23 20 4e 4f 54 45 3a 20 4e 6f 77 2c 20 # NOTE: Now,
2bfc0 77 65 20 6e 65 65 64 20 74 6f 20 6b 6e 6f 77 20 we need to know
2bfd0 69 66 20 74 68 65 20 53 51 4c 69 74 65 20 63 6f if the SQLite co
2bfe0 72 65 20 6c 69 62 72 61 72 79 20 69 73 20 61 76 re library is av
2bff0 61 69 6c 61 62 6c 65 0d 0a 20 20 20 20 20 20 20 ailable..
2c000 20 23 20 20 20 20 20 20 20 28 69 2e 65 2e 20 62 # (i.e. b
2c010 65 63 61 75 73 65 20 74 68 65 20 6d 61 6e 61 67 ecause the manag
2c020 65 64 2d 6f 6e 6c 79 20 53 79 73 74 65 6d 2e 44 ed-only System.D
2c030 61 74 61 2e 53 51 4c 69 74 65 20 61 73 73 65 6d ata.SQLite assem
2c040 62 6c 79 20 63 61 6e 0d 0a 20 20 20 20 20 20 20 bly can..
2c050 20 23 20 20 20 20 20 20 20 6c 6f 61 64 20 77 69 # load wi
2c060 74 68 6f 75 74 20 69 74 3b 20 68 6f 77 65 76 65 thout it; howeve
2c070 72 2c 20 69 74 20 63 61 6e 6e 6f 74 20 64 6f 20 r, it cannot do
2c080 61 6e 79 74 68 69 6e 67 20 75 73 65 66 75 6c 20 anything useful
2c090 77 69 74 68 6f 75 74 0d 0a 20 20 20 20 20 20 20 without..
2c0a0 20 23 20 20 20 20 20 20 20 69 74 29 2e 20 20 49 # it). I
2c0b0 66 20 77 65 20 61 72 65 20 75 73 69 6e 67 20 74 f we are using t
2c0c0 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 he mixed-mode as
2c0d0 73 65 6d 62 6c 79 20 61 6e 64 20 77 65 20 61 6c sembly and we al
2c0e0 72 65 61 64 79 0d 0a 20 20 20 20 20 20 20 20 23 ready.. #
2c0f0 20 20 20 20 20 20 20 66 6f 75 6e 64 20 69 74 20 found it
2c100 28 61 62 6f 76 65 29 2c 20 74 68 69 73 20 73 68 (above), this sh
2c110 6f 75 6c 64 20 61 6c 77 61 79 73 20 73 75 63 63 ould always succ
2c120 65 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d eed... #.
2c130 0a 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f . checkFo
2c140 72 53 51 4c 69 74 65 4c 69 62 72 61 72 79 20 24 rSQLiteLibrary $
2c150 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a ::test_channel..
2c160 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
2c170 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 # NOTE: Che
2c180 63 6b 20 69 66 20 74 68 65 20 53 51 4c 69 74 65 ck if the SQLite
2c190 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c interop assembl
2c1a0 79 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2e 0d y is available..
2c1b0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
2c1c0 20 20 20 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 checkForSQLi
2c1d0 74 65 49 6e 74 65 72 6f 70 20 24 3a 3a 74 65 73 teInterop $::tes
2c1e0 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 t_channel....
2c1f0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
2c200 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 # NOTE: Check th
2c210 65 20 53 51 4c 69 74 65 20 64 61 74 61 62 61 73 e SQLite databas
2c220 65 20 61 6e 64 20 74 65 6d 70 6f 72 61 72 79 20 e and temporary
2c230 64 69 72 65 63 74 6f 72 69 65 73 2e 0d 0a 20 20 directories...
2c240 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
2c250 20 63 68 65 63 6b 46 6f 72 53 51 4c 69 74 65 44 checkForSQLiteD
2c260 69 72 65 63 74 6f 72 69 65 73 20 24 3a 3a 74 65 irectories $::te
2c270 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 st_channel....
2c280 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
2c290 20 23 20 4e 4f 54 45 3a 20 41 74 74 65 6d 70 74 # NOTE: Attempt
2c2a0 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 69 66 to determine if
2c2b0 20 76 61 72 69 6f 75 73 20 63 6f 6d 70 69 6c 65 various compile
2c2c0 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 73 20 6e 65 -time options ne
2c2d0 65 64 65 64 20 66 6f 72 0d 0a 20 20 20 20 20 20 eded for..
2c2e0 20 20 23 20 20 20 20 20 20 20 74 65 73 74 20 63 # test c
2c2f0 6f 6e 73 74 72 61 69 6e 74 73 20 77 65 72 65 20 onstraints were
2c300 65 6e 61 62 6c 65 64 20 66 6f 72 20 74 68 65 20 enabled for the
2c310 6d 61 6e 61 67 65 64 20 61 73 73 65 6d 62 6c 79 managed assembly
2c320 2e 20 20 54 68 65 72 65 0d 0a 20 20 20 20 20 20 . There..
2c330 20 20 23 20 20 20 20 20 20 20 61 72 65 20 73 6f # are so
2c340 6d 65 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 me compile-time
2c350 6f 70 74 69 6f 6e 73 20 74 68 61 74 20 6d 75 73 options that mus
2c360 74 20 61 6c 73 6f 20 68 61 76 65 20 62 65 65 6e t also have been
2c370 20 65 6e 61 62 6c 65 64 0d 0a 20 20 20 20 20 20 enabled..
2c380 20 20 23 20 20 20 20 20 20 20 66 6f 72 20 74 68 # for th
2c390 65 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 e interop assemb
2c3a0 6c 79 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 62 ly in order to b
2c3b0 65 20 65 66 66 65 63 74 69 76 65 2e 20 20 46 6f e effective. Fo
2c3c0 72 20 74 68 6f 73 65 0d 0a 20 20 20 20 20 20 20 r those..
2c3d0 20 23 20 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 # options
2c3e0 2c 20 69 74 20 77 69 6c 6c 20 62 65 20 61 73 73 , it will be ass
2c3f0 75 6d 65 64 20 74 68 61 74 20 69 74 20 77 61 73 umed that it was
2c400 20 65 6e 61 62 6c 65 64 20 66 6f 72 20 74 68 65 enabled for the
2c410 20 69 6e 74 65 72 6f 70 0d 0a 20 20 20 20 20 20 interop..
2c420 20 20 23 20 20 20 20 20 20 20 61 73 73 65 6d 62 # assemb
2c430 6c 79 20 69 66 20 69 74 20 77 61 73 20 65 6e 61 ly if it was ena
2c440 62 6c 65 64 20 66 6f 72 20 74 68 65 20 6d 61 6e bled for the man
2c450 61 67 65 64 20 61 73 73 65 6d 62 6c 79 2e 0d 0a aged assembly...
2c460 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
2c470 20 20 20 66 6f 72 65 61 63 68 20 64 65 66 69 6e foreach defin
2c480 65 43 6f 6e 73 74 61 6e 74 20 5b 6c 69 73 74 20 eConstant [list
2c490 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 43 \.. C
2c4a0 48 45 43 4b 5f 53 54 41 54 45 20 43 4f 55 4e 54 HECK_STATE COUNT
2c4b0 5f 48 41 4e 44 4c 45 20 44 45 42 55 47 20 49 4e _HANDLE DEBUG IN
2c4c0 54 45 52 4f 50 5f 43 4f 44 45 43 20 49 4e 54 45 TEROP_CODEC INTE
2c4d0 52 4f 50 5f 44 45 42 55 47 20 5c 0d 0a 20 20 20 ROP_DEBUG \..
2c4e0 20 20 20 20 20 20 20 20 20 49 4e 54 45 52 4f 50 INTEROP
2c4f0 5f 45 58 54 45 4e 53 49 4f 4e 5f 46 55 4e 43 54 _EXTENSION_FUNCT
2c500 49 4f 4e 53 20 49 4e 54 45 52 4f 50 5f 46 54 53 IONS INTEROP_FTS
2c510 35 5f 45 58 54 45 4e 53 49 4f 4e 20 5c 0d 0a 20 5_EXTENSION \..
2c520 20 20 20 20 20 20 20 20 20 20 20 49 4e 54 45 52 INTER
2c530 4f 50 5f 49 4e 43 4c 55 44 45 5f 43 45 52 4f 44 OP_INCLUDE_CEROD
2c540 20 49 4e 54 45 52 4f 50 5f 49 4e 43 4c 55 44 45 INTEROP_INCLUDE
2c550 5f 45 58 54 52 41 20 49 4e 54 45 52 4f 50 5f 49 _EXTRA INTEROP_I
2c560 4e 43 4c 55 44 45 5f 53 45 45 20 5c 0d 0a 20 20 NCLUDE_SEE \..
2c570 20 20 20 20 20 20 20 20 20 20 49 4e 54 45 52 4f INTERO
2c580 50 5f 49 4e 43 4c 55 44 45 5f 5a 49 50 56 46 53 P_INCLUDE_ZIPVFS
2c590 20 49 4e 54 45 52 4f 50 5f 4a 53 4f 4e 31 5f 45 INTEROP_JSON1_E
2c5a0 58 54 45 4e 53 49 4f 4e 20 5c 0d 0a 20 20 20 20 XTENSION \..
2c5b0 20 20 20 20 20 20 20 20 49 4e 54 45 52 4f 50 5f INTEROP_
2c5c0 4c 45 47 41 43 59 5f 43 4c 4f 53 45 20 49 4e 54 LEGACY_CLOSE INT
2c5d0 45 52 4f 50 5f 4c 4f 47 20 49 4e 54 45 52 4f 50 EROP_LOG INTEROP
2c5e0 5f 50 45 52 43 45 4e 54 49 4c 45 5f 45 58 54 45 _PERCENTILE_EXTE
2c5f0 4e 53 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 20 NSION \..
2c600 20 20 20 20 20 49 4e 54 45 52 4f 50 5f 52 45 47 INTEROP_REG
2c610 45 58 50 5f 45 58 54 45 4e 53 49 4f 4e 20 49 4e EXP_EXTENSION IN
2c620 54 45 52 4f 50 5f 53 45 53 53 49 4f 4e 5f 45 58 TEROP_SESSION_EX
2c630 54 45 4e 53 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 TENSION \..
2c640 20 20 20 20 20 20 20 49 4e 54 45 52 4f 50 5f 53 INTEROP_S
2c650 48 41 31 5f 45 58 54 45 4e 53 49 4f 4e 20 49 4e HA1_EXTENSION IN
2c660 54 45 52 4f 50 5f 54 45 53 54 5f 45 58 54 45 4e TEROP_TEST_EXTEN
2c670 53 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 20 20 SION \..
2c680 20 20 20 20 49 4e 54 45 52 4f 50 5f 54 4f 54 59 INTEROP_TOTY
2c690 50 45 5f 45 58 54 45 4e 53 49 4f 4e 20 49 4e 54 PE_EXTENSION INT
2c6a0 45 52 4f 50 5f 56 49 52 54 55 41 4c 5f 54 41 42 EROP_VIRTUAL_TAB
2c6b0 4c 45 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 LE \..
2c6c0 20 20 4e 45 54 5f 32 30 20 4e 45 54 5f 33 35 20 NET_20 NET_35
2c6d0 4e 45 54 5f 34 30 20 4e 45 54 5f 34 35 20 4e 45 NET_40 NET_45 NE
2c6e0 54 5f 34 35 31 20 4e 45 54 5f 34 35 32 20 4e 45 T_451 NET_452 NE
2c6f0 54 5f 34 36 20 4e 45 54 5f 34 36 31 20 5c 0d 0a T_46 NET_461 \..
2c700 20 20 20 20 20 20 20 20 20 20 20 20 4e 45 54 5f NET_
2c710 34 36 32 20 4e 45 54 5f 34 37 20 4e 45 54 5f 34 462 NET_47 NET_4
2c720 37 31 20 4e 45 54 5f 43 4f 4d 50 41 43 54 5f 32 71 NET_COMPACT_2
2c730 30 20 50 4c 41 54 46 4f 52 4d 5f 43 4f 4d 50 41 0 PLATFORM_COMPA
2c740 43 54 46 52 41 4d 45 57 4f 52 4b 20 5c 0d 0a 20 CTFRAMEWORK \..
2c750 20 20 20 20 20 20 20 20 20 20 20 50 52 45 4c 4f PRELO
2c760 41 44 5f 4e 41 54 49 56 45 5f 4c 49 42 52 41 52 AD_NATIVE_LIBRAR
2c770 59 20 52 45 54 41 52 47 45 54 41 42 4c 45 20 53 Y RETARGETABLE S
2c780 51 4c 49 54 45 5f 53 54 41 4e 44 41 52 44 20 5c QLITE_STANDARD \
2c790 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 54 48 .. TH
2c7a0 52 4f 57 5f 4f 4e 5f 44 49 53 50 4f 53 45 44 20 ROW_ON_DISPOSED
2c7b0 54 52 41 43 45 20 54 52 41 43 45 5f 43 4f 4e 4e TRACE TRACE_CONN
2c7c0 45 43 54 49 4f 4e 20 54 52 41 43 45 5f 44 45 54 ECTION TRACE_DET
2c7d0 45 43 54 49 4f 4e 20 5c 0d 0a 20 20 20 20 20 20 ECTION \..
2c7e0 20 20 20 20 20 20 54 52 41 43 45 5f 48 41 4e 44 TRACE_HAND
2c7f0 4c 45 20 54 52 41 43 45 5f 50 52 45 4c 4f 41 44 LE TRACE_PRELOAD
2c800 20 54 52 41 43 45 5f 53 48 41 52 45 44 20 54 52 TRACE_SHARED TR
2c810 41 43 45 5f 53 54 41 54 45 4d 45 4e 54 20 5c 0d ACE_STATEMENT \.
2c820 0a 20 20 20 20 20 20 20 20 20 20 20 20 54 52 41 . TRA
2c830 43 45 5f 57 41 52 4e 49 4e 47 20 54 52 41 43 4b CE_WARNING TRACK
2c840 5f 4d 45 4d 4f 52 59 5f 42 59 54 45 53 20 55 53 _MEMORY_BYTES US
2c850 45 5f 45 4e 54 49 54 59 5f 46 52 41 4d 45 57 4f E_ENTITY_FRAMEWO
2c860 52 4b 5f 36 20 5c 0d 0a 20 20 20 20 20 20 20 20 RK_6 \..
2c870 20 20 20 20 55 53 45 5f 49 4e 54 45 52 4f 50 5f USE_INTEROP_
2c880 44 4c 4c 20 55 53 45 5f 50 52 45 50 41 52 45 5f DLL USE_PREPARE_
2c890 56 32 20 57 49 4e 44 4f 57 53 5d 20 7b 0d 0a 20 V2 WINDOWS] {..
2c8a0 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 #..
2c8b0 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 # NOTE: Ch
2c8c0 65 63 6b 20 69 66 20 74 68 65 20 63 6f 6d 70 69 eck if the compi
2c8d0 6c 65 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 20 69 le-time option i
2c8e0 73 20 6c 69 73 74 65 64 20 69 6e 20 74 68 65 20 s listed in the
2c8f0 6c 69 73 74 20 6f 66 0d 0a 20 20 20 20 20 20 20 list of..
2c900 20 20 20 23 20 20 20 20 20 20 20 22 64 65 66 69 # "defi
2c910 6e 65 20 63 6f 6e 73 74 61 6e 74 73 22 20 6b 65 ne constants" ke
2c920 70 74 20 74 72 61 63 6b 20 6f 66 20 62 79 20 74 pt track of by t
2c930 68 65 20 6d 61 6e 61 67 65 64 20 61 73 73 65 6d he managed assem
2c940 62 6c 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 bly...
2c950 23 0d 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 #.. che
2c960 63 6b 46 6f 72 53 51 4c 69 74 65 44 65 66 69 6e ckForSQLiteDefin
2c970 65 43 6f 6e 73 74 61 6e 74 20 24 3a 3a 74 65 73 eConstant $::tes
2c980 74 5f 63 68 61 6e 6e 65 6c 20 24 64 65 66 69 6e t_channel $defin
2c990 65 43 6f 6e 73 74 61 6e 74 0d 0a 20 20 20 20 20 eConstant..
2c9a0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
2c9b0 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 #.. # NOT
2c9c0 45 3a 20 41 74 74 65 6d 70 74 20 74 6f 20 64 65 E: Attempt to de
2c9d0 74 65 72 6d 69 6e 65 20 69 66 20 76 61 72 69 6f termine if vario
2c9e0 75 73 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 us compile-time
2c9f0 6f 70 74 69 6f 6e 73 20 6e 65 65 64 65 64 20 66 options needed f
2ca00 6f 72 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 or.. #
2ca10 20 20 20 20 74 65 73 74 20 63 6f 6e 73 74 72 61 test constra
2ca20 69 6e 74 73 20 77 65 72 65 20 65 6e 61 62 6c 65 ints were enable
2ca30 64 20 66 6f 72 20 74 68 65 20 69 6e 74 65 72 6f d for the intero
2ca40 70 20 61 73 73 65 6d 62 6c 79 20 61 6e 64 2f 6f p assembly and/o
2ca50 72 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 r.. #
2ca60 20 20 20 66 6f 72 20 74 68 65 20 53 51 4c 69 74 for the SQLit
2ca70 65 20 63 6f 72 65 20 6c 69 62 72 61 72 79 2e 0d e core library..
2ca80 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
2ca90 20 20 20 20 66 6f 72 65 61 63 68 20 63 6f 6d 70 foreach comp
2caa0 69 6c 65 4f 70 74 69 6f 6e 20 5b 6c 69 73 74 20 ileOption [list
2cab0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 43 \.. C
2cac0 4f 44 45 43 20 45 58 54 45 4e 53 49 4f 4e 5f 46 ODEC EXTENSION_F
2cad0 55 4e 43 54 49 4f 4e 53 20 48 41 53 5f 43 4f 44 UNCTIONS HAS_COD
2cae0 45 43 20 49 4e 43 4c 55 44 45 5f 43 45 52 4f 44 EC INCLUDE_CEROD
2caf0 20 49 4e 43 4c 55 44 45 5f 45 58 54 52 41 20 5c INCLUDE_EXTRA \
2cb00 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 49 4e .. IN
2cb10 43 4c 55 44 45 5f 53 45 45 20 49 4e 43 4c 55 44 CLUDE_SEE INCLUD
2cb20 45 5f 5a 49 50 56 46 53 20 4a 53 4f 4e 31 5f 45 E_ZIPVFS JSON1_E
2cb30 58 54 45 4e 53 49 4f 4e 20 4c 45 47 41 43 59 5f XTENSION LEGACY_
2cb40 43 4c 4f 53 45 20 4c 4f 47 20 5c 0d 0a 20 20 20 CLOSE LOG \..
2cb50 20 20 20 20 20 20 20 20 20 50 45 52 43 45 4e 54 PERCENT
2cb60 49 4c 45 5f 45 58 54 45 4e 53 49 4f 4e 20 52 45 ILE_EXTENSION RE
2cb70 47 45 58 50 5f 45 58 54 45 4e 53 49 4f 4e 20 53 GEXP_EXTENSION S
2cb80 45 53 53 49 4f 4e 5f 45 58 54 45 4e 53 49 4f 4e ESSION_EXTENSION
2cb90 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
2cba0 53 48 41 31 5f 45 58 54 45 4e 53 49 4f 4e 20 54 SHA1_EXTENSION T
2cbb0 45 53 54 5f 45 58 54 45 4e 53 49 4f 4e 20 54 4f EST_EXTENSION TO
2cbc0 54 59 50 45 5f 45 58 54 45 4e 53 49 4f 4e 20 56 TYPE_EXTENSION V
2cbd0 49 52 54 55 41 4c 5f 54 41 42 4c 45 5d 20 7b 0d IRTUAL_TABLE] {.
2cbe0 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 . #..
2cbf0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
2cc00 43 68 65 63 6b 20 69 66 20 74 68 65 20 63 6f 6d Check if the com
2cc10 70 69 6c 65 2d 74 69 6d 65 20 6f 70 74 69 6f 6e pile-time option
2cc20 20 69 73 20 6c 69 73 74 65 64 20 69 6e 20 74 68 is listed in th
2cc30 65 20 6c 69 73 74 0d 0a 20 20 20 20 20 20 20 20 e list..
2cc40 20 20 23 20 20 20 20 20 20 20 6b 65 70 74 20 74 # kept t
2cc50 72 61 63 6b 20 6f 66 20 62 79 20 74 68 65 20 69 rack of by the i
2cc60 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 6c 79 20 nterop assembly
2cc70 61 6e 64 2f 6f 72 20 74 68 65 20 53 51 4c 69 74 and/or the SQLit
2cc80 65 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 e.. #
2cc90 20 20 20 20 20 63 6f 72 65 20 6c 69 62 72 61 72 core librar
2cca0 79 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d y... #.
2ccb0 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b . check
2ccc0 46 6f 72 53 51 4c 69 74 65 43 6f 6d 70 69 6c 65 ForSQLiteCompile
2ccd0 4f 70 74 69 6f 6e 20 24 3a 3a 74 65 73 74 5f 63 Option $::test_c
2cce0 68 61 6e 6e 65 6c 20 24 63 6f 6d 70 69 6c 65 4f hannel $compileO
2ccf0 70 74 69 6f 6e 0d 0a 20 20 20 20 20 20 20 20 7d ption.. }
2cd00 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
2cd10 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 # NOTE: C
2cd20 68 65 63 6b 20 69 66 20 74 68 65 20 53 79 73 74 heck if the Syst
2cd30 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 70 em.Data.SQLite p
2cd40 72 6f 76 69 64 65 72 20 77 61 73 20 63 6f 6d 70 rovider was comp
2cd50 69 6c 65 64 20 77 69 74 68 0d 0a 20 20 20 20 20 iled with..
2cd60 20 20 20 23 20 20 20 20 20 20 20 73 75 70 70 6f # suppo
2cd70 72 74 20 66 6f 72 20 61 6e 79 20 65 6e 63 72 79 rt for any encry
2cd80 70 74 65 64 20 64 61 74 61 62 61 73 65 73 2e 0d pted databases..
2cd90 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
2cda0 20 20 20 20 69 66 20 7b 5b 68 61 76 65 53 51 4c if {[haveSQL
2cdb0 69 74 65 44 65 66 69 6e 65 43 6f 6e 73 74 61 6e iteDefineConstan
2cdc0 74 20 49 4e 54 45 52 4f 50 5f 43 4f 44 45 43 5d t INTEROP_CODEC]
2cdd0 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 || \..
2cde0 20 20 20 5b 68 61 76 65 53 51 4c 69 74 65 44 65 [haveSQLiteDe
2cdf0 66 69 6e 65 43 6f 6e 73 74 61 6e 74 20 49 4e 54 fineConstant INT
2ce00 45 52 4f 50 5f 49 4e 43 4c 55 44 45 5f 53 45 45 EROP_INCLUDE_SEE
2ce10 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
2ce20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
2ce30 20 20 23 20 4e 4f 54 45 3a 20 4e 6f 77 20 63 68 # NOTE: Now ch
2ce40 65 63 6b 20 69 66 20 74 68 65 20 69 6e 74 65 72 eck if the inter
2ce50 6f 70 20 61 73 73 65 6d 62 6c 79 20 77 61 73 20 op assembly was
2ce60 61 6c 73 6f 20 63 6f 6d 70 69 6c 65 64 20 77 69 also compiled wi
2ce70 74 68 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 th.. #
2ce80 20 20 20 20 20 20 73 75 70 70 6f 72 74 20 66 6f support fo
2ce90 72 20 65 6e 63 72 79 70 74 65 64 20 64 61 74 61 r encrypted data
2cea0 62 61 73 65 73 2e 0d 0a 20 20 20 20 20 20 20 20 bases...
2ceb0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 69 #.. i
2cec0 66 20 7b 5b 68 61 76 65 53 51 4c 69 74 65 43 6f f {[haveSQLiteCo
2ced0 6d 70 69 6c 65 4f 70 74 69 6f 6e 20 43 4f 44 45 mpileOption CODE
2cee0 43 5d 20 7c 7c 20 5c 0d 0a 20 20 20 20 20 20 20 C] || \..
2cef0 20 20 20 20 20 20 20 5b 68 61 76 65 53 51 4c 69 [haveSQLi
2cf00 74 65 43 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 20 teCompileOption
2cf10 49 4e 43 4c 55 44 45 5f 53 45 45 5d 7d 20 74 68 INCLUDE_SEE]} th
2cf20 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
2cf30 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
2cf40 20 23 20 4e 4f 54 45 3a 20 46 69 6e 61 6c 6c 79 # NOTE: Finally
2cf50 2c 20 63 68 65 63 6b 20 69 66 20 74 68 65 20 53 , check if the S
2cf60 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 QLite core libra
2cf70 72 79 20 77 61 73 20 63 6f 6d 70 69 6c 65 64 0d ry was compiled.
2cf80 0a 20 20 20 20 20 20 20 20 20 20 20 20 23 20 20 . #
2cf90 20 20 20 20 20 77 69 74 68 20 73 75 70 70 6f 72 with suppor
2cfa0 74 20 66 6f 72 20 65 6e 63 72 79 70 74 65 64 20 t for encrypted
2cfb0 64 61 74 61 62 61 73 65 73 2e 0d 0a 20 20 20 20 databases...
2cfc0 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
2cfd0 20 20 20 20 20 20 20 69 66 20 7b 5b 68 61 76 65 if {[have
2cfe0 53 51 4c 69 74 65 43 6f 6d 70 69 6c 65 4f 70 74 SQLiteCompileOpt
2cff0 69 6f 6e 20 48 41 53 5f 43 4f 44 45 43 5d 7d 20 ion HAS_CODEC]}
2d000 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 then {..
2d010 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
2d020 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 59 # NOTE: Y
2d030 65 73 2c 20 61 64 64 20 63 6f 6e 73 74 72 61 69 es, add constrai
2d040 6e 74 20 66 6f 72 20 75 73 65 20 62 79 20 74 68 nt for use by th
2d050 65 20 74 65 73 74 20 73 75 69 74 65 2e 0d 0a 20 e test suite...
2d060 20 20 20 20 20 20 20 20 20 20 20 20 20 23 0d 0a #..
2d070 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 64 ad
2d080 64 43 6f 6e 73 74 72 61 69 6e 74 20 53 79 73 74 dConstraint Syst
2d090 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 2e 45 em.Data.SQLite.E
2d0a0 6e 63 72 79 70 74 69 6f 6e 0d 0a 20 20 20 20 20 ncryption..
2d0b0 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 }..
2d0c0 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 20 7d }.. }
2d0d0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
2d0e0 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 43 # NOTE: C
2d0f0 68 65 63 6b 20 74 68 65 20 63 75 72 72 65 6e 74 heck the current
2d100 20 62 75 69 6c 64 20 79 65 61 72 2e 20 20 42 61 build year. Ba
2d110 73 69 63 61 6c 6c 79 2c 20 74 68 69 73 20 69 6e sically, this in
2d120 64 69 63 61 74 65 73 0d 0a 20 20 20 20 20 20 20 dicates..
2d130 20 23 20 20 20 20 20 20 20 77 68 69 63 68 20 76 # which v
2d140 65 72 73 69 6f 6e 20 6f 66 20 4d 53 42 75 69 6c ersion of MSBuil
2d150 64 20 61 6e 64 2f 6f 72 20 56 69 73 75 61 6c 20 d and/or Visual
2d160 53 74 75 64 69 6f 20 77 61 73 20 75 73 65 64 20 Studio was used
2d170 74 6f 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 to.. #
2d180 20 20 20 20 63 6f 6d 70 69 6c 65 20 74 68 65 20 compile the
2d190 61 73 73 65 6d 62 6c 79 20 62 69 6e 61 72 69 65 assembly binarie
2d1a0 73 20 75 6e 64 65 72 20 74 65 73 74 2e 0d 0a 20 s under test...
2d1b0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
2d1c0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
2d1d0 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 20 20 20 channel \..
2d1e0 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 63 68 65 "---- che
2d1f0 63 6b 69 6e 67 20 66 6f 72 20 53 79 73 74 65 6d cking for System
2d200 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 62 75 69 .Data.SQLite bui
2d210 6c 64 20 79 65 61 72 2e 2e 2e 20 22 0d 0a 0d 0a ld year... "....
2d220 20 20 20 20 20 20 20 20 73 65 74 20 79 65 61 72 set year
2d230 20 5b 67 65 74 42 75 69 6c 64 59 65 61 72 5d 0d [getBuildYear].
2d240 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 . addCons
2d250 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
2d260 67 73 20 62 75 69 6c 64 59 65 61 72 2e 20 24 79 gs buildYear. $y
2d270 65 61 72 5d 0d 0a 20 20 20 20 20 20 20 20 74 70 ear].. tp
2d280 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e uts $::test_chan
2d290 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 nel [appendArgs
2d2a0 5c 22 20 24 79 65 61 72 20 5c 22 5c 6e 5d 0d 0a \" $year \"\n]..
2d2b0 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 .. tputs
2d2c0 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
2d2d0 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 \.. "
2d2e0 2d 2d 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f ---- checking fo
2d2f0 72 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 r System.Data.SQ
2d300 4c 69 74 65 20 62 75 69 6c 64 20 6e 61 74 69 76 Lite build nativ
2d310 65 20 79 65 61 72 2e 2e 2e 20 22 0d 0a 0d 0a 20 e year... "....
2d320 20 20 20 20 20 20 20 73 65 74 20 79 65 61 72 20 set year
2d330 5b 67 65 74 42 75 69 6c 64 4e 61 74 69 76 65 59 [getBuildNativeY
2d340 65 61 72 5d 0d 0a 20 20 20 20 20 20 20 20 61 64 ear].. ad
2d350 64 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 dConstraint [app
2d360 65 6e 64 41 72 67 73 20 62 75 69 6c 64 4e 61 74 endArgs buildNat
2d370 69 76 65 59 65 61 72 2e 20 24 79 65 61 72 5d 0d iveYear. $year].
2d380 0a 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 . tputs $
2d390 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
2d3a0 61 70 70 65 6e 64 41 72 67 73 20 5c 22 20 24 79 appendArgs \" $y
2d3b0 65 61 72 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 ear \"\n]....
2d3c0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
2d3d0 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 # NOTE: Check th
2d3e0 65 20 63 75 72 72 65 6e 74 20 62 75 69 6c 64 20 e current build
2d3f0 2e 4e 45 54 20 46 72 61 6d 65 77 6f 72 6b 2e 20 .NET Framework.
2d400 20 42 61 73 69 63 61 6c 6c 79 2c 20 74 68 69 73 Basically, this
2d410 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
2d420 20 20 69 6e 64 69 63 61 74 65 73 20 77 68 69 63 indicates whic
2d430 68 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 h version of the
2d440 20 2e 4e 45 54 20 46 72 61 6d 65 77 6f 72 6b 20 .NET Framework
2d450 69 73 20 62 65 69 6e 67 0d 0a 20 20 20 20 20 20 is being..
2d460 20 20 23 20 20 20 20 20 20 20 75 73 65 64 20 62 # used b
2d470 79 20 74 68 65 20 61 73 73 65 6d 62 6c 79 20 62 y the assembly b
2d480 69 6e 61 72 69 65 73 20 75 6e 64 65 72 20 74 65 inaries under te
2d490 73 74 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a st... #..
2d4a0 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
2d4b0 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d :test_channel \.
2d4c0 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d . "--
2d4d0 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 -- checking for
2d4e0 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
2d4f0 74 65 20 62 75 69 6c 64 20 2e 4e 45 54 20 46 72 te build .NET Fr
2d500 61 6d 65 77 6f 72 6b 2e 2e 2e 20 22 0d 0a 0d 0a amework... "....
2d510 20 20 20 20 20 20 20 20 73 65 74 20 6e 65 74 46 set netF
2d520 78 20 5b 67 65 74 42 75 69 6c 64 4e 65 74 46 78 x [getBuildNetFx
2d530 5d 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f ].. addCo
2d540 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
2d550 41 72 67 73 20 62 75 69 6c 64 46 72 61 6d 65 77 Args buildFramew
2d560 6f 72 6b 2e 20 24 6e 65 74 46 78 5d 0d 0a 20 20 ork. $netFx]..
2d570 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
2d580 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
2d590 65 6e 64 41 72 67 73 20 5c 22 20 24 6e 65 74 46 endArgs \" $netF
2d5a0 78 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 20 20 20 x \"\n]....
2d5b0 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
2d5c0 4e 4f 54 45 3a 20 43 68 65 63 6b 20 74 68 65 20 NOTE: Check the
2d5d0 63 75 72 72 65 6e 74 20 62 75 69 6c 64 20 63 6f current build co
2d5e0 6e 66 69 67 75 72 61 74 69 6f 6e 2e 20 20 54 68 nfiguration. Th
2d5f0 69 73 20 73 68 6f 75 6c 64 20 6e 6f 72 6d 61 6c is should normal
2d600 6c 79 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 ly.. #
2d610 20 20 20 20 62 65 20 65 69 74 68 65 72 20 22 44 be either "D
2d620 65 62 75 67 22 20 6f 72 20 22 52 65 6c 65 61 73 ebug" or "Releas
2d630 65 22 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a e"... #..
2d640 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 3a tputs $:
2d650 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d :test_channel \.
2d660 0a 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d . "--
2d670 2d 2d 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 -- checking for
2d680 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
2d690 74 65 20 62 75 69 6c 64 20 63 6f 6e 66 69 67 75 te build configu
2d6a0 72 61 74 69 6f 6e 2e 2e 2e 20 22 0d 0a 0d 0a 20 ration... "....
2d6b0 20 20 20 20 20 20 20 73 65 74 20 63 6f 6e 66 69 set confi
2d6c0 67 75 72 61 74 69 6f 6e 20 5b 67 65 74 42 75 69 guration [getBui
2d6d0 6c 64 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 5d ldConfiguration]
2d6e0 0d 0a 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e .. addCon
2d6f0 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 straint [appendA
2d700 72 67 73 20 62 75 69 6c 64 43 6f 6e 66 69 67 75 rgs buildConfigu
2d710 72 61 74 69 6f 6e 2e 20 24 63 6f 6e 66 69 67 75 ration. $configu
2d720 72 61 74 69 6f 6e 5d 0d 0a 20 20 20 20 20 20 20 ration]..
2d730 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
2d740 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
2d750 67 73 20 5c 22 20 24 63 6f 6e 66 69 67 75 72 61 gs \" $configura
2d760 74 69 6f 6e 20 5c 22 5c 6e 5d 0d 0a 0d 0a 20 20 tion \"\n]....
2d770 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
2d780 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 est_channel \..
2d790 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d 2d "----
2d7a0 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 53 79 checking for Sy
2d7b0 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 stem.Data.SQLite
2d7c0 20 62 75 69 6c 64 20 65 78 74 72 61 2e 2e 2e 20 build extra...
2d7d0 22 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ".... #..
2d7e0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
2d7f0 43 68 65 63 6b 20 74 68 65 20 63 75 72 72 65 6e Check the curren
2d800 74 20 62 75 69 6c 64 20 65 78 74 72 61 20 64 69 t build extra di
2d810 72 65 63 74 6f 72 79 2e 20 20 54 68 69 73 20 77 rectory. This w
2d820 69 6c 6c 20 6e 6f 72 6d 61 6c 6c 79 0d 0a 20 20 ill normally..
2d830 20 20 20 20 20 20 23 20 20 20 20 20 20 20 62 65 # be
2d840 20 65 69 74 68 65 72 20 22 6e 65 74 73 74 61 6e either "netstan
2d850 64 61 72 64 32 2e 30 22 20 6f 72 20 61 6e 20 65 dard2.0" or an e
2d860 6d 70 74 79 20 73 74 72 69 6e 67 2e 0d 0a 20 20 mpty string...
2d870 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
2d880 20 73 65 74 20 65 78 74 72 61 20 5b 67 65 74 42 set extra [getB
2d890 75 69 6c 64 45 78 74 72 61 5d 0d 0a 0d 0a 20 20 uildExtra]....
2d8a0 20 20 20 20 20 20 69 66 20 7b 5b 73 74 72 69 6e if {[strin
2d8b0 67 20 6c 65 6e 67 74 68 20 24 65 78 74 72 61 5d g length $extra]
2d8c0 20 3e 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 > 0} then {..
2d8d0 20 20 20 20 20 20 20 20 61 64 64 43 6f 6e 73 74 addConst
2d8e0 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
2d8f0 73 20 62 75 69 6c 64 45 78 74 72 61 2e 20 24 65 s buildExtra. $e
2d900 78 74 72 61 5d 0d 0a 20 20 20 20 20 20 20 20 20 xtra]..
2d910 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 tputs $::test_c
2d920 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 72 hannel [appendAr
2d930 67 73 20 5c 22 20 24 65 78 74 72 61 20 5c 22 5c gs \" $extra \"\
2d940 6e 5d 0d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c n].. } el
2d950 73 65 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 se {..
2d960 61 64 64 43 6f 6e 73 74 72 61 69 6e 74 20 62 75 addConstraint bu
2d970 69 6c 64 45 78 74 72 61 2e 6e 6f 6e 65 0d 0a 20 ildExtra.none..
2d980 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
2d990 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 3c ::test_channel <
2d9a0 6e 6f 6e 65 3e 5c 6e 0d 0a 20 20 20 20 20 20 20 none>\n..
2d9b0 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d }.... #.
2d9c0 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
2d9d0 20 54 72 79 20 74 6f 20 73 65 74 75 70 20 61 6e Try to setup an
2d9e0 20 69 6e 74 65 72 72 75 70 74 20 63 61 6c 6c 62 interrupt callb
2d9f0 61 63 6b 20 75 73 69 6e 67 20 74 68 65 20 73 63 ack using the sc
2da00 72 69 70 74 20 64 65 62 75 67 67 65 72 0d 0a 20 ript debugger..
2da10 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 # t
2da20 68 61 74 20 77 69 6c 6c 20 63 61 6e 63 65 6c 20 hat will cancel
2da30 61 6c 6c 20 53 51 4c 20 71 75 65 72 69 65 73 20 all SQL queries
2da40 69 6e 20 70 72 6f 67 72 65 73 73 20 66 6f 72 20 in progress for
2da50 61 6c 6c 20 64 61 74 61 62 61 73 65 0d 0a 20 20 all database..
2da60 20 20 20 20 20 20 23 20 20 20 20 20 20 20 63 6f # co
2da70 6e 6e 65 63 74 69 6f 6e 73 20 6b 6e 6f 77 6e 20 nnections known
2da80 74 6f 20 74 68 69 73 20 69 6e 74 65 72 70 72 65 to this interpre
2da90 74 65 72 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d ter... #.
2daa0 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 69 . if {![i
2dab0 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 nfo exists ::no(
2dac0 73 71 6c 69 74 65 49 6e 74 65 72 72 75 70 74 43 sqliteInterruptC
2dad0 61 6c 6c 62 61 63 6b 29 5d 7d 20 74 68 65 6e 20 allback)]} then
2dae0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 {.. set
2daf0 75 70 44 62 49 6e 74 65 72 72 75 70 74 43 61 6c upDbInterruptCal
2db00 6c 62 61 63 6b 20 24 3a 3a 74 65 73 74 5f 63 68 lback $::test_ch
2db10 61 6e 6e 65 6c 20 24 3a 3a 74 65 73 74 5f 6c 6f annel $::test_lo
2db20 67 0d 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a g.. }....
2db30 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 #..
2db40 20 20 20 23 20 4e 4f 54 45 3a 20 43 68 65 63 6b # NOTE: Check
2db50 20 66 6f 72 20 74 68 65 20 6e 61 74 69 76 65 20 for the native
2db60 72 75 6e 74 69 6d 65 20 6f 70 74 69 6f 6e 2c 20 runtime option,
2db70 77 68 69 63 68 20 77 6f 75 6c 64 20 6d 65 61 6e which would mean
2db80 20 77 65 20 61 72 65 0d 0a 20 20 20 20 20 20 20 we are..
2db90 20 23 20 20 20 20 20 20 20 75 73 69 6e 67 20 74 # using t
2dba0 68 65 20 6d 69 78 65 64 2d 6d 6f 64 65 20 61 73 he mixed-mode as
2dbb0 73 65 6d 62 6c 79 2e 0d 0a 20 20 20 20 20 20 20 sembly...
2dbc0 20 23 0d 0a 20 20 20 20 20 20 20 20 63 68 65 63 #.. chec
2dbd0 6b 46 6f 72 52 75 6e 74 69 6d 65 4f 70 74 69 6f kForRuntimeOptio
2dbe0 6e 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 n $::test_channe
2dbf0 6c 20 6e 61 74 69 76 65 0d 0a 0d 0a 20 20 20 20 l native....
2dc00 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 #.. #
2dc10 20 4e 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 NOTE: Check if
2dc20 74 68 65 20 74 65 73 74 20 73 75 69 74 65 20 73 the test suite s
2dc30 68 6f 75 6c 64 20 63 6f 75 6e 74 20 74 68 65 20 hould count the
2dc40 6e 75 6d 62 65 72 20 6f 66 20 63 6f 6e 6e 65 63 number of connec
2dc50 74 69 6f 6e 73 0d 0a 20 20 20 20 20 20 20 20 23 tions.. #
2dc60 20 20 20 20 20 20 20 22 6f 70 65 6e 65 64 22 20 "opened"
2dc70 61 6e 64 20 22 63 6c 6f 73 65 64 22 20 66 72 6f and "closed" fro
2dc80 6d 20 74 68 65 20 70 6f 6f 6c 20 77 68 65 6e 20 m the pool when
2dc90 64 65 74 65 72 6d 69 6e 69 6e 67 20 69 66 20 61 determining if a
2dca0 20 74 65 73 74 0d 0a 20 20 20 20 20 20 20 20 23 test.. #
2dcb0 20 20 20 20 20 20 20 70 61 73 73 65 64 2e 20 20 passed.
2dcc0 44 69 73 61 62 6c 69 6e 67 20 74 68 69 73 20 62 Disabling this b
2dcd0 65 68 61 76 69 6f 72 20 69 73 20 73 6f 6d 65 74 ehavior is somet
2dce0 69 6d 65 73 20 6e 65 63 65 73 73 61 72 79 20 28 imes necessary (
2dcf0 65 2e 67 2e 0d 0a 20 20 20 20 20 20 20 20 23 20 e.g... #
2dd00 20 20 20 20 20 20 64 75 72 69 6e 67 20 74 68 65 during the
2dd10 20 72 65 6c 65 61 73 65 20 74 65 73 74 69 6e 67 release testing
2dd20 20 70 72 6f 63 65 73 73 29 20 62 65 63 61 75 73 process) becaus
2dd30 65 20 74 68 65 72 65 20 61 72 65 20 73 65 76 65 e there are seve
2dd40 72 61 6c 0d 0a 20 20 20 20 20 20 20 20 23 20 20 ral.. #
2dd50 20 20 20 20 20 74 65 73 74 73 20 74 68 61 74 20 tests that
2dd60 72 65 6c 79 20 6f 6e 20 74 68 65 20 22 6f 70 65 rely on the "ope
2dd70 6e 65 64 20 66 72 6f 6d 20 70 6f 6f 6c 22 20 63 ned from pool" c
2dd80 6f 75 6e 74 20 62 65 69 6e 67 20 67 72 65 61 74 ount being great
2dd90 65 72 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 er.. #
2dda0 20 20 20 20 74 68 61 6e 20 7a 65 72 6f 2e 20 20 than zero.
2ddb0 54 68 65 73 65 20 74 65 73 74 73 20 6d 61 79 20 These tests may
2ddc0 66 61 69 6c 20 64 75 65 20 74 6f 20 74 68 65 20 fail due to the
2ddd0 6e 6f 6e 2d 64 65 74 65 72 6d 69 6e 69 73 74 69 non-deterministi
2dde0 63 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 c.. #
2ddf0 20 20 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 behavior of t
2de00 68 65 20 43 4c 52 20 47 43 2c 20 65 76 65 6e 20 he CLR GC, even
2de10 77 68 65 6e 20 74 68 65 72 65 20 69 73 20 6e 6f when there is no
2de20 20 62 75 67 20 69 6e 20 74 68 65 20 63 6f 64 65 bug in the code
2de30 0d 0a 20 20 20 20 20 20 20 20 23 20 20 20 20 20 .. #
2de40 20 20 62 65 69 6e 67 20 74 65 73 74 65 64 2e 0d being tested..
2de50 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
2de60 20 20 20 20 63 68 65 63 6b 46 6f 72 52 75 6e 74 checkForRunt
2de70 69 6d 65 4f 70 74 69 6f 6e 20 24 3a 3a 74 65 73 imeOption $::tes
2de80 74 5f 63 68 61 6e 6e 65 6c 20 6e 6f 50 6f 6f 6c t_channel noPool
2de90 43 6f 75 6e 74 73 0d 0a 0d 0a 20 20 20 20 20 20 Counts....
2dea0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
2deb0 4f 54 45 3a 20 43 68 65 63 6b 20 69 66 20 74 68 OTE: Check if th
2dec0 65 20 74 65 73 74 20 73 75 69 74 65 20 73 68 6f e test suite sho
2ded0 75 6c 64 20 75 73 65 20 73 68 61 72 65 64 2d 63 uld use shared-c
2dee0 61 63 68 65 20 6d 6f 64 65 2e 0d 0a 20 20 20 20 ache mode...
2def0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 63 #.. c
2df00 68 65 63 6b 46 6f 72 52 75 6e 74 69 6d 65 4f 70 heckForRuntimeOp
2df10 74 69 6f 6e 20 24 3a 3a 74 65 73 74 5f 63 68 61 tion $::test_cha
2df20 6e 6e 65 6c 20 73 68 61 72 65 64 43 61 63 68 65 nnel sharedCache
2df30 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 .... #..
2df40 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 52 # NOTE: R
2df50 65 70 6f 72 74 20 74 68 65 20 72 65 73 6f 75 72 eport the resour
2df60 63 65 20 75 73 61 67 65 20 70 72 69 6f 72 20 74 ce usage prior t
2df70 6f 20 72 75 6e 6e 69 6e 67 20 61 6e 79 20 74 65 o running any te
2df80 73 74 73 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d sts... #.
2df90 0a 20 20 20 20 20 20 20 20 72 65 70 6f 72 74 53 . reportS
2dfa0 51 4c 69 74 65 52 65 73 6f 75 72 63 65 73 20 24 QLiteResources $
2dfb0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 0d 0a ::test_channel..
2dfc0 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
2dfd0 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 47 72 61 # NOTE: Gra
2dfe0 62 20 74 68 65 20 6c 69 73 74 20 6f 66 20 6e 61 b the list of na
2dff0 74 69 76 65 20 6d 6f 64 75 6c 65 73 20 66 6f 72 tive modules for
2e000 20 74 68 65 20 63 75 72 72 65 6e 74 20 70 72 6f the current pro
2e010 63 65 73 73 20 61 6e 64 0d 0a 20 20 20 20 20 20 cess and..
2e020 20 20 23 20 20 20 20 20 20 20 72 65 70 6f 72 74 # report
2e030 20 6f 6e 20 74 68 65 20 53 79 73 74 65 6d 2e 44 on the System.D
2e040 61 74 61 2e 53 51 4c 69 74 65 20 72 65 6c 61 74 ata.SQLite relat
2e050 65 64 20 6f 6e 65 73 2e 0d 0a 20 20 20 20 20 20 ed ones...
2e060 20 20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 #.. if
2e070 7b 5b 68 61 76 65 53 51 4c 69 74 65 4f 62 6a 65 {[haveSQLiteObje
2e080 63 74 43 6f 6d 6d 61 6e 64 5d 7d 20 74 68 65 6e ctCommand]} then
2e090 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 {.. se
2e0a0 74 20 6d 6f 64 75 6c 65 73 20 5b 6f 62 6a 65 63 t modules [objec
2e0b0 74 20 69 6e 76 6f 6b 65 20 5c 0d 0a 20 20 20 20 t invoke \..
2e0c0 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d System
2e0d0 2e 44 69 61 67 6e 6f 73 74 69 63 73 2e 50 72 6f .Diagnostics.Pro
2e0e0 63 65 73 73 2e 47 65 74 43 75 72 72 65 6e 74 50 cess.GetCurrentP
2e0f0 72 6f 63 65 73 73 20 4d 6f 64 75 6c 65 73 5d 0d rocess Modules].
2e100 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 6f 62 6a ... obj
2e110 65 63 74 20 66 6f 72 65 61 63 68 20 2d 61 6c 69 ect foreach -ali
2e120 61 73 20 6d 6f 64 75 6c 65 20 24 6d 6f 64 75 6c as module $modul
2e130 65 73 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 es {..
2e140 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 20 #..
2e150 20 23 20 4e 4f 54 45 3a 20 54 68 65 20 6d 6f 64 # NOTE: The mod
2e160 75 6c 65 20 66 69 6c 65 20 6e 61 6d 65 20 68 65 ule file name he
2e170 72 65 20 6d 75 73 74 20 62 65 20 6e 6f 72 6d 61 re must be norma
2e180 6c 69 7a 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 lized...
2e190 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
2e1a0 20 20 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 20 set fileName
2e1b0 5b 66 69 6c 65 20 6e 6f 72 6d 61 6c 69 7a 65 20 [file normalize
2e1c0 5b 24 6d 6f 64 75 6c 65 20 46 69 6c 65 4e 61 6d [$module FileNam
2e1d0 65 5d 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e]]..
2e1e0 20 73 65 74 20 66 69 6c 65 4e 61 6d 65 4f 6e 6c set fileNameOnl
2e1f0 79 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 66 69 y [file tail $fi
2e200 6c 65 4e 61 6d 65 5d 0d 0a 0d 0a 20 20 20 20 20 leName]....
2e210 20 20 20 20 20 20 20 69 66 20 7b 5b 6c 73 65 61 if {[lsea
2e220 72 63 68 20 2d 65 78 61 63 74 20 2d 6e 6f 63 61 rch -exact -noca
2e230 73 65 20 2d 2d 20 5c 0d 0a 20 20 20 20 20 20 20 se -- \..
2e240 20 20 20 20 20 20 20 20 20 5b 67 65 74 4e 61 74 [getNat
2e250 69 76 65 4c 69 62 72 61 72 79 46 69 6c 65 4e 61 iveLibraryFileNa
2e260 6d 65 73 4f 6e 6c 79 5d 20 24 66 69 6c 65 4e 61 mesOnly] $fileNa
2e270 6d 65 4f 6e 6c 79 5d 20 21 3d 20 2d 31 7d 20 74 meOnly] != -1} t
2e280 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
2e290 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
2e2a0 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
2e2b0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
2e2c0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
2e2d0 2d 20 66 6f 75 6e 64 20 6c 6f 61 64 65 64 20 53 - found loaded S
2e2e0 51 4c 69 74 65 20 6e 61 74 69 76 65 20 6c 69 62 QLite native lib
2e2f0 72 61 72 79 20 6d 6f 64 75 6c 65 3a 20 22 20 5c rary module: " \
2e300 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2e310 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 20 5c 6e $fileName \n
2e320 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d ].. }
2e330 20 65 6c 73 65 69 66 20 7b 5b 6c 73 65 61 72 63 elseif {[lsearc
2e340 68 20 2d 65 78 61 63 74 20 2d 6e 6f 63 61 73 65 h -exact -nocase
2e350 20 2d 2d 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 -- \..
2e360 20 20 20 20 20 20 20 5b 67 65 74 49 6e 74 65 72 [getInter
2e370 6f 70 41 73 73 65 6d 62 6c 79 46 69 6c 65 4e 61 opAssemblyFileNa
2e380 6d 65 73 4f 6e 6c 79 5d 20 24 66 69 6c 65 4e 61 mesOnly] $fileNa
2e390 6d 65 4f 6e 6c 79 5d 20 21 3d 20 2d 31 7d 20 74 meOnly] != -1} t
2e3a0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
2e3b0 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
2e3c0 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 st_channel [appe
2e3d0 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 ndArgs \..
2e3e0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
2e3f0 2d 20 66 6f 75 6e 64 20 6c 6f 61 64 65 64 20 53 - found loaded S
2e400 51 4c 69 74 65 20 69 6e 74 65 72 6f 70 20 61 73 QLite interop as
2e410 73 65 6d 62 6c 79 20 6d 6f 64 75 6c 65 3a 20 22 sembly module: "
2e420 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
2e430 20 20 20 20 20 20 24 66 69 6c 65 4e 61 6d 65 20 $fileName
2e440 5c 6e 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 \n]..
2e450 20 7d 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 0d }.. }.
2e460 0a 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 . }....
2e470 20 20 20 20 20 20 63 61 74 63 68 20 7b 0d 0a 20 catch {..
2e480 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
2e490 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5c ::test_channel \
2e4a0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2e4b0 22 2d 2d 2d 2d 20 63 6f 6d 70 69 6c 65 2d 74 69 "---- compile-ti
2e4c0 6d 65 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 53 me options for S
2e4d0 51 4c 69 74 65 20 63 6f 72 65 20 6c 69 62 72 61 QLite core libra
2e4e0 72 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 ry... "....
2e4f0 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
2e500 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6f {.. o
2e510 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c bject invoke -fl
2e520 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c ags +NonPublic \
2e530 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2e540 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
2e550 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 53 51 4c Lite.SQLite3 SQL
2e560 69 74 65 43 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e iteCompileOption
2e570 73 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 63 s.. } c
2e580 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 5d 20 3d ompileOptions] =
2e590 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 = 0} then {..
2e5a0 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 24 tputs $
2e5b0 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b ::test_channel [
2e5c0 61 70 70 65 6e 64 41 72 67 73 20 5b 66 6f 72 6d appendArgs [form
2e5d0 61 74 4c 69 73 74 20 5b 6c 73 6f 72 74 20 5c 0d atList [lsort \.
2e5e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
2e5f0 20 24 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 $compileOptions
2e600 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d 0d 0a 20 ] <none>] \n]..
2e610 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 } else
2e620 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 {.. t
2e630 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 puts $::test_cha
2e640 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d 0a nnel unknown\n..
2e650 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 }..
2e660 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
2e670 20 20 63 61 74 63 68 20 7b 0d 0a 20 20 20 20 20 catch {..
2e680 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 65 tputs $::te
2e690 73 74 5f 63 68 61 6e 6e 65 6c 20 5c 0d 0a 20 20 st_channel \..
2e6a0 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 2d 2d "---
2e6b0 2d 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 6f - compile-time o
2e6c0 70 74 69 6f 6e 73 20 66 6f 72 20 53 51 4c 69 74 ptions for SQLit
2e6d0 65 20 69 6e 74 65 72 6f 70 20 61 73 73 65 6d 62 e interop assemb
2e6e0 6c 79 2e 2e 2e 20 22 0d 0a 0d 0a 20 20 20 20 20 ly... "....
2e6f0 20 20 20 20 20 69 66 20 7b 5b 63 61 74 63 68 20 if {[catch
2e700 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6f {.. o
2e710 62 6a 65 63 74 20 69 6e 76 6f 6b 65 20 2d 66 6c bject invoke -fl
2e720 61 67 73 20 2b 4e 6f 6e 50 75 62 6c 69 63 20 5c ags +NonPublic \
2e730 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2e740 20 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 System.Data.SQ
2e750 4c 69 74 65 2e 53 51 4c 69 74 65 33 20 49 6e 74 Lite.SQLite3 Int
2e760 65 72 6f 70 43 6f 6d 70 69 6c 65 4f 70 74 69 6f eropCompileOptio
2e770 6e 73 0d 0a 20 20 20 20 20 20 20 20 20 20 7d 20 ns.. }
2e780 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e 73 5d 20 compileOptions]
2e790 3d 3d 20 30 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 == 0} then {..
2e7a0 20 20 20 20 20 20 20 20 20 20 74 70 75 74 73 20 tputs
2e7b0 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
2e7c0 5b 61 70 70 65 6e 64 41 72 67 73 20 5b 66 6f 72 [appendArgs [for
2e7d0 6d 61 74 4c 69 73 74 20 5b 6c 73 6f 72 74 20 5c matList [lsort \
2e7e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2e7f0 20 20 24 63 6f 6d 70 69 6c 65 4f 70 74 69 6f 6e $compileOption
2e800 73 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c 6e 5d 0d 0a s] <none>] \n]..
2e810 20 20 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 } else
2e820 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
2e830 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f 63 68 tputs $::test_ch
2e840 61 6e 6e 65 6c 20 75 6e 6b 6e 6f 77 6e 5c 6e 0d annel unknown\n.
2e850 0a 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 . }..
2e860 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 }....
2e870 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 #.. #
2e880 4e 4f 54 45 3a 20 53 68 6f 77 20 74 68 65 20 61 NOTE: Show the a
2e890 63 74 69 76 65 20 74 65 73 74 20 63 6f 6e 73 74 ctive test const
2e8a0 72 61 69 6e 74 73 2e 0d 0a 20 20 20 20 20 20 20 raints...
2e8b0 20 23 0d 0a 20 20 20 20 20 20 20 20 74 70 75 74 #.. tput
2e8c0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
2e8d0 6c 20 5b 61 70 70 65 6e 64 41 72 67 73 20 22 2d l [appendArgs "-
2e8e0 2d 2d 2d 20 63 6f 6e 73 74 72 61 69 6e 74 73 3a --- constraints:
2e8f0 20 22 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 " \..
2e900 20 20 5b 66 6f 72 6d 61 74 4c 69 73 74 20 5b 6c [formatList [l
2e910 73 6f 72 74 20 5b 67 65 74 43 6f 6e 73 74 72 61 sort [getConstra
2e920 69 6e 74 73 5d 5d 20 3c 6e 6f 6e 65 3e 5d 20 5c ints]] <none>] \
2e930 6e 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d n].... #.
2e940 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a . # NOTE:
2e950 20 53 61 76 65 20 74 68 65 20 74 65 73 74 20 63 Save the test c
2e960 6f 6e 73 74 72 61 69 6e 74 73 20 66 6f 72 20 75 onstraints for u
2e970 73 65 20 62 79 20 74 68 72 65 61 64 73 20 63 72 se by threads cr
2e980 65 61 74 65 64 20 69 6e 20 74 68 69 73 0d 0a 20 eated in this..
2e990 20 20 20 20 20 20 20 23 20 20 20 20 20 20 20 61 # a
2e9a0 70 70 6c 69 63 61 74 69 6f 6e 20 64 6f 6d 61 69 pplication domai
2e9b0 6e 2e 20 20 54 68 69 73 20 69 73 20 6e 65 63 65 n. This is nece
2e9c0 73 73 61 72 79 20 62 65 63 61 75 73 65 20 61 6c ssary because al
2e9d0 6c 20 74 68 65 20 45 61 67 6c 65 0d 0a 20 20 20 l the Eagle..
2e9e0 20 20 20 20 20 23 20 20 20 20 20 20 20 22 74 65 # "te
2e9f0 73 74 20 63 6f 6e 74 65 78 74 22 20 69 6e 66 6f st context" info
2ea00 72 6d 61 74 69 6f 6e 20 69 73 20 70 65 72 2d 74 rmation is per-t
2ea10 68 72 65 61 64 2e 0d 0a 20 20 20 20 20 20 20 20 hread...
2ea20 23 0d 0a 20 20 20 20 20 20 20 20 69 66 20 7b 21 #.. if {!
2ea30 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 3a 3a 74 [info exists ::t
2ea40 65 73 74 5f 63 6f 6e 73 74 72 61 69 6e 74 73 5d est_constraints]
2ea50 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
2ea60 20 20 20 20 73 65 74 20 3a 3a 74 65 73 74 5f 63 set ::test_c
2ea70 6f 6e 73 74 72 61 69 6e 74 73 20 24 3a 3a 65 61 onstraints $::ea
2ea80 67 6c 65 5f 74 65 73 74 73 28 43 6f 6e 73 74 72 gle_tests(Constr
2ea90 61 69 6e 74 73 29 0d 0a 20 20 20 20 20 20 20 20 aints)..
2eaa0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a }.... #..
2eab0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
2eac0 4c 6f 61 64 20 74 68 65 20 22 61 66 74 65 72 2d Load the "after-
2ead0 63 6f 6e 73 74 72 61 69 6e 74 73 22 20 63 75 73 constraints" cus
2eae0 74 6f 6d 20 70 65 72 2d 75 73 65 72 20 61 6e 64 tom per-user and
2eaf0 2f 6f 72 20 70 65 72 2d 68 6f 73 74 0d 0a 20 20 /or per-host..
2eb00 20 20 20 20 20 20 23 20 20 20 20 20 20 20 74 65 # te
2eb10 73 74 20 73 65 74 74 69 6e 67 73 20 6e 6f 77 2e st settings now.
2eb20 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
2eb30 20 20 20 20 20 75 70 6c 65 76 65 6c 20 31 20 5b uplevel 1 [
2eb40 6c 69 73 74 20 6c 6f 61 64 53 51 4c 69 74 65 54 list loadSQLiteT
2eb50 65 73 74 53 65 74 74 69 6e 67 73 20 24 3a 3a 74 estSettings $::t
2eb60 65 73 74 5f 63 68 61 6e 6e 65 6c 20 2e 61 66 74 est_channel .aft
2eb70 65 72 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 er].... #
2eb80 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 .. # NOTE
2eb90 3a 20 49 66 20 6e 65 63 65 73 73 61 72 79 2c 20 : If necessary,
2eba0 65 6e 61 62 6c 65 20 73 68 61 72 65 64 2d 63 61 enable shared-ca
2ebb0 63 68 65 20 6d 6f 64 65 20 6e 6f 77 2e 0d 0a 20 che mode now...
2ebc0 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
2ebd0 20 20 69 66 20 7b 5b 68 61 73 52 75 6e 74 69 6d if {[hasRuntim
2ebe0 65 4f 70 74 69 6f 6e 20 73 68 61 72 65 64 43 61 eOption sharedCa
2ebf0 63 68 65 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 che]} then {..
2ec00 20 20 20 20 20 20 20 20 65 6e 61 62 6c 65 53 68 enableSh
2ec10 61 72 65 64 43 61 63 68 65 20 24 3a 3a 74 65 73 aredCache $::tes
2ec20 74 5f 63 68 61 6e 6e 65 6c 20 74 72 75 65 0d 0a t_channel true..
2ec30 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 }....
2ec40 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
2ec50 23 20 4e 4f 54 45 3a 20 53 68 6f 77 20 77 68 65 # NOTE: Show whe
2ec60 6e 20 6f 75 72 20 74 65 73 74 73 20 61 63 74 75 n our tests actu
2ec70 61 6c 6c 79 20 62 65 67 61 6e 20 28 6e 6f 77 29 ally began (now)
2ec80 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 ... #..
2ec90 20 20 20 20 20 20 74 70 75 74 73 20 24 3a 3a 74 tputs $::t
2eca0 65 73 74 5f 63 68 61 6e 6e 65 6c 20 5b 61 70 70 est_channel [app
2ecb0 65 6e 64 41 72 67 73 20 5c 0d 0a 20 20 20 20 20 endArgs \..
2ecc0 20 20 20 20 20 20 20 22 2d 2d 2d 2d 20 53 79 73 "---- Sys
2ecd0 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 65 20 tem.Data.SQLite
2ece0 74 65 73 74 73 20 62 65 67 61 6e 20 61 74 20 22 tests began at "
2ecf0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
2ed00 5b 63 6c 6f 63 6b 20 66 6f 72 6d 61 74 20 5b 63 [clock format [c
2ed10 6c 6f 63 6b 20 73 65 63 6f 6e 64 73 5d 5d 20 5c lock seconds]] \
2ed20 6e 5d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 n].. }..
2ed30 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
2ed40 72 75 6e 53 51 4c 69 74 65 54 65 73 74 46 69 6c runSQLiteTestFil
2ed50 65 73 50 72 6f 6c 6f 67 75 65 20 7b 7d 20 7b 0d esPrologue {} {.
2ed60 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
2ed70 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 72 75 6e # NOTE: Skip run
2ed80 6e 69 6e 67 20 6f 75 72 20 63 75 73 74 6f 6d 20 ning our custom
2ed90 66 69 6c 65 73 20 70 72 6f 6c 6f 67 75 65 20 69 files prologue i
2eda0 66 20 74 68 65 20 6d 61 69 6e 20 6f 6e 65 20 68 f the main one h
2edb0 61 73 20 62 65 65 6e 0d 0a 20 20 20 20 20 20 23 as been.. #
2edc0 20 20 20 20 20 20 20 73 6b 69 70 70 65 64 2e 0d skipped..
2edd0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
2ede0 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
2edf0 73 20 3a 3a 6e 6f 28 70 72 6f 6c 6f 67 75 65 2e s ::no(prologue.
2ee00 65 61 67 6c 65 29 5d 7d 20 74 68 65 6e 20 7b 0d eagle)]} then {.
2ee10 0a 20 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c . uplevel
2ee20 20 31 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 1 {..
2ee30 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 4e #.. # N
2ee40 4f 54 45 3a 20 53 65 74 75 70 20 74 68 65 20 76 OTE: Setup the v
2ee50 61 72 69 61 62 6c 65 73 20 74 68 61 74 20 72 65 ariables that re
2ee60 66 65 72 20 74 6f 20 74 68 65 20 76 61 72 69 6f fer to the vario
2ee70 75 73 20 6e 6f 6e 2d 64 61 74 61 20 66 69 6c 65 us non-data file
2ee80 73 0d 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 s.. #
2ee90 20 20 20 20 20 72 65 71 75 69 72 65 64 20 62 79 required by
2eea0 20 74 68 65 20 74 65 73 74 73 20 69 6e 20 74 68 the tests in th
2eeb0 69 73 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 is file...
2eec0 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 #..
2eed0 20 73 65 74 20 65 6e 74 69 74 79 46 72 61 6d 65 set entityFrame
2eee0 77 6f 72 6b 44 6c 6c 46 69 6c 65 20 5c 0d 0a 20 workDllFile \..
2eef0 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 [ge
2ef00 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 45 tBuildFileName E
2ef10 6e 74 69 74 79 46 72 61 6d 65 77 6f 72 6b 2e 64 ntityFramework.d
2ef20 6c 6c 20 74 72 75 65 5d 0d 0a 0d 0a 20 20 20 20 ll true]....
2ef30 20 20 20 20 20 20 73 65 74 20 69 6e 73 74 61 6c set instal
2ef40 6c 65 72 45 78 65 46 69 6c 65 20 5c 0d 0a 20 20 lerExeFile \..
2ef50 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
2ef60 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 49 6e BuildFileName In
2ef70 73 74 61 6c 6c 65 72 2e 65 78 65 20 74 72 75 65 staller.exe true
2ef80 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 73 ].... s
2ef90 65 74 20 73 71 6c 69 74 65 44 65 73 69 67 6e 65 et sqliteDesigne
2efa0 72 44 6c 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 20 rDllFile \..
2efb0 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 42 75 [getBu
2efc0 69 6c 64 46 69 6c 65 4e 61 6d 65 20 53 51 4c 69 ildFileName SQLi
2efd0 74 65 2e 44 65 73 69 67 6e 65 72 2e 64 6c 6c 20 te.Designer.dll
2efe0 74 72 75 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 true]....
2eff0 20 20 20 73 65 74 20 73 79 73 74 65 6d 44 61 74 set systemDat
2f000 61 53 51 4c 69 74 65 44 6c 6c 46 69 6c 65 20 5c aSQLiteDllFile \
2f010 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2f020 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d [getBuildFileNam
2f030 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 e System.Data.SQ
2f040 4c 69 74 65 2e 64 6c 6c 20 74 72 75 65 5d 0d 0a Lite.dll true]..
2f050 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 20 .. set
2f060 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 systemDataSQLite
2f070 4c 69 6e 71 44 6c 6c 46 69 6c 65 20 5c 0d 0a 20 LinqDllFile \..
2f080 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 [ge
2f090 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 53 tBuildFileName S
2f0a0 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 74 ystem.Data.SQLit
2f0b0 65 2e 4c 69 6e 71 2e 64 6c 6c 20 74 72 75 65 5d e.Linq.dll true]
2f0c0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 .... se
2f0d0 74 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 t systemDataSQLi
2f0e0 74 65 45 66 36 44 6c 6c 46 69 6c 65 20 5c 0d 0a teEf6DllFile \..
2f0f0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 [g
2f100 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 etBuildFileName
2f110 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 51 4c 69 System.Data.SQLi
2f120 74 65 2e 45 46 36 2e 64 6c 6c 20 74 72 75 65 5d te.EF6.dll true]
2f130 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 .... se
2f140 74 20 74 65 73 74 45 78 65 46 69 6c 65 20 5b 67 t testExeFile [g
2f150 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 etBuildFileName
2f160 74 65 73 74 2e 65 78 65 20 74 72 75 65 5d 0d 0a test.exe true]..
2f170 20 20 20 20 20 20 20 20 20 20 73 65 74 20 74 65 set te
2f180 73 74 4c 69 6e 71 45 78 65 46 69 6c 65 20 5b 67 stLinqExeFile [g
2f190 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 6d 65 20 etBuildFileName
2f1a0 74 65 73 74 6c 69 6e 71 2e 65 78 65 20 74 72 75 testlinq.exe tru
2f1b0 65 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 e].. se
2f1c0 74 20 74 65 73 74 45 66 36 45 78 65 46 69 6c 65 t testEf6ExeFile
2f1d0 20 5b 67 65 74 42 75 69 6c 64 46 69 6c 65 4e 61 [getBuildFileNa
2f1e0 6d 65 20 74 65 73 74 65 66 36 2e 65 78 65 20 74 me testef6.exe t
2f1f0 72 75 65 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 rue]....
2f200 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 23 #.. #
2f210 20 4e 4f 54 45 3a 20 53 65 74 75 70 20 74 68 65 NOTE: Setup the
2f220 20 76 61 72 69 61 62 6c 65 73 20 74 68 61 74 20 variables that
2f230 72 65 66 65 72 20 74 6f 20 74 68 65 20 76 61 72 refer to the var
2f240 69 6f 75 73 20 64 61 74 61 20 66 69 6c 65 73 0d ious data files.
2f250 0a 20 20 20 20 20 20 20 20 20 20 23 20 20 20 20 . #
2f260 20 20 20 72 65 71 75 69 72 65 64 20 62 79 20 74 required by t
2f270 68 65 20 74 65 73 74 73 20 69 6e 20 74 68 69 73 he tests in this
2f280 20 66 69 6c 65 2e 0d 0a 20 20 20 20 20 20 20 20 file...
2f290 20 20 23 0d 0a 20 20 20 20 20 20 20 20 20 20 73 #.. s
2f2a0 65 74 20 74 65 73 74 4c 69 6e 71 4f 75 74 46 69 et testLinqOutFi
2f2b0 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e le [file nativen
2f2c0 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c ame [file join \
2f2d0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2f2e0 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 [getSQLiteTestDa
2f2f0 74 61 50 61 74 68 5d 20 74 65 73 74 6c 69 6e 71 taPath] testlinq
2f300 2e 6f 75 74 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 .out]]....
2f310 20 20 20 20 73 65 74 20 6e 6f 72 74 68 77 69 6e set northwin
2f320 64 45 66 44 62 46 69 6c 65 20 5b 66 69 6c 65 20 dEfDbFile [file
2f330 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 nativename [file
2f340 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 join \..
2f350 20 20 20 20 20 20 20 5b 66 69 6c 65 20 64 69 72 [file dir
2f360 6e 61 6d 65 20 5b 66 69 6c 65 20 64 69 72 6e 61 name [file dirna
2f370 6d 65 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 me [getSQLiteTes
2f380 74 44 61 74 61 50 61 74 68 5d 5d 5d 20 5c 0d 0a tDataPath]]] \..
2f390 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 65 te
2f3a0 73 74 6c 69 6e 71 20 6e 6f 72 74 68 77 69 6e 64 stlinq northwind
2f3b0 45 46 2e 64 62 5d 5d 0d 0a 0d 0a 20 20 20 20 20 EF.db]]....
2f3c0 20 20 20 20 20 73 65 74 20 6e 6f 6e 57 61 6c 44 set nonWalD
2f3d0 62 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 bFile [file nati
2f3e0 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 vename [file joi
2f3f0 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n \..
2f400 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 [getSQLiteTes
2f410 74 44 61 74 61 50 61 74 68 5d 20 6e 6f 6e 57 61 tDataPath] nonWa
2f420 6c 2e 64 62 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 l.db]]....
2f430 20 20 20 20 73 65 74 20 77 61 6c 44 62 46 69 6c set walDbFil
2f440 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 e [file nativena
2f450 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d me [file join \.
2f460 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b . [
2f470 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 getSQLiteTestDat
2f480 61 50 61 74 68 5d 20 77 61 6c 2e 64 62 5d 5d 0d aPath] wal.db]].
2f490 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 23 0d 0a ... #..
2f4a0 20 20 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 # NOTE
2f4b0 3a 20 54 68 65 20 76 61 72 69 6f 75 73 20 69 6e : The various in
2f4c0 73 74 61 6c 6c 2f 75 6e 69 6e 73 74 61 6c 6c 20 stall/uninstall
2f4d0 6c 6f 67 20 66 69 6c 65 73 20 75 73 65 64 20 74 log files used t
2f4e0 6f 20 74 65 73 74 20 74 68 65 0d 0a 20 20 20 20 o test the..
2f4f0 20 20 20 20 20 20 23 20 20 20 20 20 20 20 64 65 # de
2f500 73 69 67 6e 2d 74 69 6d 65 20 63 6f 6d 70 6f 6e sign-time compon
2f510 65 6e 74 20 69 6e 73 74 61 6c 6c 65 72 2e 0d 0a ent installer...
2f520 20 20 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 #..
2f530 20 20 20 20 20 20 20 73 65 74 20 74 65 73 74 49 set testI
2f540 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 nstallVs2005LogF
2f550 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 ile [file native
2f560 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 name [file join
2f570 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
2f580 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 [getSQLiteTestD
2f590 61 74 61 50 61 74 68 5d 20 49 6e 73 74 61 6c 6c ataPath] Install
2f5a0 65 72 5f 54 65 73 74 5f 56 73 32 30 30 35 2e 6c er_Test_Vs2005.l
2f5b0 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 og]]....
2f5c0 20 20 73 65 74 20 74 65 73 74 49 6e 73 74 61 6c set testInstal
2f5d0 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c 65 20 5b lVs2008LogFile [
2f5e0 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 file nativename
2f5f0 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 [file join \..
2f600 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
2f610 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 SQLiteTestDataPa
2f620 74 68 5d 20 49 6e 73 74 61 6c 6c 65 72 5f 54 65 th] Installer_Te
2f630 73 74 5f 56 73 32 30 30 38 2e 6c 6f 67 5d 5d 0d st_Vs2008.log]].
2f640 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 74 ... set
2f650 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 testInstallVs20
2f660 31 30 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 20 10LogFile [file
2f670 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c 65 nativename [file
2f680 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 join \..
2f690 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 74 [getSQLit
2f6a0 65 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 49 eTestDataPath] I
2f6b0 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 73 nstaller_Test_Vs
2f6c0 32 30 31 30 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 2010.log]]....
2f6d0 20 20 20 20 20 20 20 20 73 65 74 20 74 65 73 74 set test
2f6e0 49 6e 73 74 61 6c 6c 56 73 32 30 31 32 4c 6f 67 InstallVs2012Log
2f6f0 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 File [file nativ
2f700 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e ename [file join
2f710 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
2f720 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 [getSQLiteTest
2f730 44 61 74 61 50 61 74 68 5d 20 49 6e 73 74 61 6c DataPath] Instal
2f740 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 31 32 2e ler_Test_Vs2012.
2f750 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 log]]....
2f760 20 20 20 73 65 74 20 74 65 73 74 49 6e 73 74 61 set testInsta
2f770 6c 6c 56 73 32 30 31 33 4c 6f 67 46 69 6c 65 20 llVs2013LogFile
2f780 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
2f790 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 [file join \..
2f7a0 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 [ge
2f7b0 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 tSQLiteTestDataP
2f7c0 61 74 68 5d 20 49 6e 73 74 61 6c 6c 65 72 5f 54 ath] Installer_T
2f7d0 65 73 74 5f 56 73 32 30 31 33 2e 6c 6f 67 5d 5d est_Vs2013.log]]
2f7e0 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 .... se
2f7f0 74 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 t testInstallVs2
2f800 30 31 35 4c 6f 67 46 69 6c 65 20 5b 66 69 6c 65 015LogFile [file
2f810 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 69 6c nativename [fil
2f820 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 20 20 e join \..
2f830 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 4c 69 [getSQLi
2f840 74 65 54 65 73 74 44 61 74 61 50 61 74 68 5d 20 teTestDataPath]
2f850 49 6e 73 74 61 6c 6c 65 72 5f 54 65 73 74 5f 56 Installer_Test_V
2f860 73 32 30 31 35 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 s2015.log]]....
2f870 20 20 20 20 20 20 20 20 20 73 65 74 20 74 65 73 set tes
2f880 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 37 4c 6f tInstallVs2017Lo
2f890 67 46 69 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 gFile [file nati
2f8a0 76 65 6e 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 vename [file joi
2f8b0 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n \..
2f8c0 20 20 20 5b 67 65 74 53 51 4c 69 74 65 54 65 73 [getSQLiteTes
2f8d0 74 44 61 74 61 50 61 74 68 5d 20 49 6e 73 74 61 tDataPath] Insta
2f8e0 6c 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 31 37 ller_Test_Vs2017
2f8f0 2e 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 .log]]....
2f900 20 20 20 20 73 65 74 20 74 65 73 74 55 6e 69 6e set testUnin
2f910 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 69 stallVs2005LogFi
2f920 6c 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e le [file nativen
2f930 61 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c ame [file join \
2f940 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
2f950 5b 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 [getSQLiteTestDa
2f960 74 61 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c taPath] Uninstal
2f970 6c 65 72 5f 54 65 73 74 5f 56 73 32 30 30 35 2e ler_Test_Vs2005.
2f980 6c 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 log]]....
2f990 20 20 20 73 65 74 20 74 65 73 74 55 6e 69 6e 73 set testUnins
2f9a0 74 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c tallVs2008LogFil
2f9b0 65 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 e [file nativena
2f9c0 6d 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d me [file join \.
2f9d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b . [
2f9e0 67 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 getSQLiteTestDat
2f9f0 61 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c aPath] Uninstall
2fa00 65 72 5f 54 65 73 74 5f 56 73 32 30 30 38 2e 6c er_Test_Vs2008.l
2fa10 6f 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 og]]....
2fa20 20 20 73 65 74 20 74 65 73 74 55 6e 69 6e 73 74 set testUninst
2fa30 61 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 6c 65 allVs2010LogFile
2fa40 20 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d [file nativenam
2fa50 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a e [file join \..
2fa60 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 [g
2fa70 65 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 etSQLiteTestData
2fa80 50 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 Path] Uninstalle
2fa90 72 5f 54 65 73 74 5f 56 73 32 30 31 30 2e 6c 6f r_Test_Vs2010.lo
2faa0 67 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 g]]....
2fab0 20 73 65 74 20 74 65 73 74 55 6e 69 6e 73 74 61 set testUninsta
2fac0 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 20 llVs2012LogFile
2fad0 5b 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 [file nativename
2fae0 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 [file join \..
2faf0 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 [ge
2fb00 74 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 tSQLiteTestDataP
2fb10 61 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 72 ath] Uninstaller
2fb20 5f 54 65 73 74 5f 56 73 32 30 31 32 2e 6c 6f 67 _Test_Vs2012.log
2fb30 5d 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 ]]....
2fb40 73 65 74 20 74 65 73 74 55 6e 69 6e 73 74 61 6c set testUninstal
2fb50 6c 56 73 32 30 31 33 4c 6f 67 46 69 6c 65 20 5b lVs2013LogFile [
2fb60 66 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 file nativename
2fb70 5b 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 [file join \..
2fb80 20 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 [get
2fb90 53 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 SQLiteTestDataPa
2fba0 74 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 72 5f th] Uninstaller_
2fbb0 54 65 73 74 5f 56 73 32 30 31 33 2e 6c 6f 67 5d Test_Vs2013.log]
2fbc0 5d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 73 ].... s
2fbd0 65 74 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c et testUninstall
2fbe0 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 20 5b 66 Vs2015LogFile [f
2fbf0 69 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b ile nativename [
2fc00 66 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 file join \..
2fc10 20 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 [getS
2fc20 51 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 74 QLiteTestDataPat
2fc30 68 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 72 5f 54 h] Uninstaller_T
2fc40 65 73 74 5f 56 73 32 30 31 35 2e 6c 6f 67 5d 5d est_Vs2015.log]]
2fc50 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 73 65 .... se
2fc60 74 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 t testUninstallV
2fc70 73 32 30 31 37 4c 6f 67 46 69 6c 65 20 5b 66 69 s2017LogFile [fi
2fc80 6c 65 20 6e 61 74 69 76 65 6e 61 6d 65 20 5b 66 le nativename [f
2fc90 69 6c 65 20 6a 6f 69 6e 20 5c 0d 0a 20 20 20 20 ile join \..
2fca0 20 20 20 20 20 20 20 20 20 20 5b 67 65 74 53 51 [getSQ
2fcb0 4c 69 74 65 54 65 73 74 44 61 74 61 50 61 74 68 LiteTestDataPath
2fcc0 5d 20 55 6e 69 6e 73 74 61 6c 6c 65 72 5f 54 65 ] Uninstaller_Te
2fcd0 73 74 5f 56 73 32 30 31 37 2e 6c 6f 67 5d 5d 0d st_Vs2017.log]].
2fce0 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 23 23 23 ... ###
2fcf0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2fd00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2fd10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2fd20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
2fd30 23 23 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 ##....
2fd40 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
2fd50 73 20 3a 3a 6e 6f 28 63 68 65 63 6b 46 6f 72 53 s ::no(checkForS
2fd60 71 6c 69 74 65 46 69 6c 65 73 29 5d 7d 20 74 68 qliteFiles)]} th
2fd70 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 en {..
2fd80 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
2fd90 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
2fda0 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
2fdb0 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c [fil
2fdc0 65 20 74 61 69 6c 20 24 65 6e 74 69 74 79 46 72 e tail $entityFr
2fdd0 61 6d 65 77 6f 72 6b 44 6c 6c 46 69 6c 65 5d 5d ameworkDllFile]]
2fde0 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 ]} then {..
2fdf0 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f checkFo
2fe00 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e rFile $test_chan
2fe10 6e 65 6c 20 24 65 6e 74 69 74 79 46 72 61 6d 65 nel $entityFrame
2fe20 77 6f 72 6b 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 workDllFile..
2fe30 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
2fe40 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
2fe50 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
2fe60 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
2fe70 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
2fe80 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
2fe90 69 6e 73 74 61 6c 6c 65 72 45 78 65 46 69 6c 65 installerExeFile
2fea0 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ]]]} then {..
2feb0 20 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b check
2fec0 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 ForFile $test_ch
2fed0 61 6e 6e 65 6c 20 24 69 6e 73 74 61 6c 6c 65 72 annel $installer
2fee0 45 78 65 46 69 6c 65 20 49 6e 73 74 61 6c 6c 65 ExeFile Installe
2fef0 72 2e 65 78 65 0d 0a 20 20 20 20 20 20 20 20 20 r.exe..
2ff00 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
2ff10 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f if {![haveCo
2ff20 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
2ff30 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 Args file_ \..
2ff40 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 [f
2ff50 69 6c 65 20 74 61 69 6c 20 24 73 71 6c 69 74 65 ile tail $sqlite
2ff60 44 65 73 69 67 6e 65 72 44 6c 6c 46 69 6c 65 5d DesignerDllFile]
2ff70 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 ]]} then {..
2ff80 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 checkF
2ff90 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 orFile $test_cha
2ffa0 6e 6e 65 6c 20 24 73 71 6c 69 74 65 44 65 73 69 nnel $sqliteDesi
2ffb0 67 6e 65 72 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 gnerDllFile..
2ffc0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
2ffd0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
2ffe0 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
2fff0 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
30000 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
30010 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
30020 73 79 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 systemDataSQLite
30030 44 6c 6c 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e DllFile]]]} then
30040 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
30050 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
30060 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 73 79 test_channel $sy
30070 73 74 65 6d 44 61 74 61 53 51 4c 69 74 65 44 6c stemDataSQLiteDl
30080 6c 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 20 lFile..
30090 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
300a0 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f if {![haveCo
300b0 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
300c0 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 Args file_ \..
300d0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 [f
300e0 69 6c 65 20 74 61 69 6c 20 24 73 79 73 74 65 6d ile tail $system
300f0 44 61 74 61 53 51 4c 69 74 65 4c 69 6e 71 44 6c DataSQLiteLinqDl
30100 6c 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b lFile]]]} then {
30110 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
30120 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 checkForFile $te
30130 73 74 5f 63 68 61 6e 6e 65 6c 20 24 73 79 73 74 st_channel $syst
30140 65 6d 44 61 74 61 53 51 4c 69 74 65 4c 69 6e 71 emDataSQLiteLinq
30150 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 DllFile..
30160 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
30170 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 if {![have
30180 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
30190 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a ndArgs file_ \..
301a0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
301b0 5b 66 69 6c 65 20 74 61 69 6c 20 24 73 79 73 74 [file tail $syst
301c0 65 6d 44 61 74 61 53 51 4c 69 74 65 45 66 36 44 emDataSQLiteEf6D
301d0 6c 6c 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 llFile]]]} then
301e0 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
301f0 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
30200 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 73 79 73 est_channel $sys
30210 74 65 6d 44 61 74 61 53 51 4c 69 74 65 45 66 36 temDataSQLiteEf6
30220 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 DllFile..
30230 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
30240 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 if {![have
30250 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
30260 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a ndArgs file_ \..
30270 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
30280 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 [file tail $test
30290 45 78 65 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e ExeFile]]]} then
302a0 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
302b0 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
302c0 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 test_channel $te
302d0 73 74 45 78 65 46 69 6c 65 20 74 65 73 74 2e 65 stExeFile test.e
302e0 78 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 xe..
302f0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 20 }....
30300 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 if {![haveConst
30310 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 raint [appendArg
30320 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 s file_ \..
30330 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c 65 [file
30340 20 74 61 69 6c 20 24 74 65 73 74 4c 69 6e 71 45 tail $testLinqE
30350 78 65 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 xeFile]]]} then
30360 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
30370 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
30380 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 est_channel $tes
30390 74 4c 69 6e 71 45 78 65 46 69 6c 65 20 74 65 73 tLinqExeFile tes
303a0 74 6c 69 6e 71 2e 65 78 65 0d 0a 20 20 20 20 20 tlinq.exe..
303b0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
303c0 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 if {![ha
303d0 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 veConstraint [ap
303e0 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c pendArgs file_ \
303f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
30400 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 [file tail $te
30410 73 74 45 66 36 45 78 65 46 69 6c 65 5d 5d 5d 7d stEf6ExeFile]]]}
30420 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
30430 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 checkForF
30440 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 ile $test_channe
30450 6c 20 24 74 65 73 74 45 66 36 45 78 65 46 69 6c l $testEf6ExeFil
30460 65 20 74 65 73 74 65 66 36 2e 65 78 65 0d 0a 20 e testef6.exe..
30470 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a }....
30480 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 7b if {
30490 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 ![haveConstraint
304a0 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c [appendArgs fil
304b0 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 e_ \..
304c0 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c [file tail
304d0 20 24 74 65 73 74 4c 69 6e 71 4f 75 74 46 69 6c $testLinqOutFil
304e0 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 e]]]} then {..
304f0 20 20 20 20 20 20 20 20 20 20 20 20 63 68 65 63 chec
30500 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 kForFile $test_c
30510 68 61 6e 6e 65 6c 20 24 74 65 73 74 4c 69 6e 71 hannel $testLinq
30520 4f 75 74 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 OutFile..
30530 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
30540 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 if {![have
30550 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
30560 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a ndArgs file_ \..
30570 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
30580 5b 66 69 6c 65 20 74 61 69 6c 20 24 6e 6f 72 74 [file tail $nort
30590 68 77 69 6e 64 45 66 44 62 46 69 6c 65 5d 5d 5d hwindEfDbFile]]]
305a0 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 } then {..
305b0 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
305c0 46 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e File $test_chann
305d0 65 6c 20 24 6e 6f 72 74 68 77 69 6e 64 45 66 44 el $northwindEfD
305e0 62 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 20 bFile..
305f0 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 }....
30600 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f if {![haveCo
30610 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 nstraint [append
30620 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 Args file_ \..
30630 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 [f
30640 69 6c 65 20 74 61 69 6c 20 24 6e 6f 6e 57 61 6c ile tail $nonWal
30650 44 62 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 DbFile]]]} then
30660 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 {..
30670 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 checkForFile $t
30680 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 6e 6f 6e est_channel $non
30690 57 61 6c 44 62 46 69 6c 65 0d 0a 20 20 20 20 20 WalDbFile..
306a0 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 }....
306b0 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 if {![ha
306c0 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 veConstraint [ap
306d0 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c pendArgs file_ \
306e0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
306f0 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 77 61 [file tail $wa
30700 6c 44 62 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e lDbFile]]]} then
30710 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 {..
30720 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 checkForFile $
30730 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 77 61 test_channel $wa
30740 6c 44 62 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 lDbFile..
30750 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
30760 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 if {![have
30770 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
30780 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a ndArgs file_ \..
30790 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
307a0 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 [file tail $test
307b0 49 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 InstallVs2005Log
307c0 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d File]]]} then {.
307d0 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 . c
307e0 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
307f0 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 49 t_channel $testI
30800 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 nstallVs2005LogF
30810 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ile..
30820 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
30830 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
30840 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
30850 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
30860 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c [fil
30870 65 20 74 61 69 6c 20 24 74 65 73 74 49 6e 73 74 e tail $testInst
30880 61 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c 65 allVs2008LogFile
30890 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ]]]} then {..
308a0 20 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b check
308b0 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 ForFile $test_ch
308c0 61 6e 6e 65 6c 20 24 74 65 73 74 49 6e 73 74 61 annel $testInsta
308d0 6c 6c 56 73 32 30 30 38 4c 6f 67 46 69 6c 65 0d llVs2008LogFile.
308e0 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
308f0 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
30900 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 {![haveConstrai
30910 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 nt [appendArgs f
30920 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 ile_ \..
30930 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 [file ta
30940 69 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 il $testInstallV
30950 73 32 30 31 30 4c 6f 67 46 69 6c 65 5d 5d 5d 7d s2010LogFile]]]}
30960 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
30970 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 checkForF
30980 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 ile $test_channe
30990 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 l $testInstallVs
309a0 32 30 31 30 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 2010LogFile..
309b0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
309c0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
309d0 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
309e0 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
309f0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
30a00 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
30a10 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 testInstallVs201
30a20 32 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 2LogFile]]]} the
30a30 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n {..
30a40 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c 65 20 checkForFile
30a50 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 24 74 $test_channel $t
30a60 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 32 estInstallVs2012
30a70 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 20 20 20 20 LogFile..
30a80 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 }....
30a90 20 20 20 20 20 20 69 66 20 7b 21 5b 68 61 76 65 if {![have
30aa0 43 6f 6e 73 74 72 61 69 6e 74 20 5b 61 70 70 65 Constraint [appe
30ab0 6e 64 41 72 67 73 20 66 69 6c 65 5f 20 5c 0d 0a ndArgs file_ \..
30ac0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
30ad0 5b 66 69 6c 65 20 74 61 69 6c 20 24 74 65 73 74 [file tail $test
30ae0 49 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f 67 InstallVs2013Log
30af0 46 69 6c 65 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d File]]]} then {.
30b00 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 . c
30b10 68 65 63 6b 46 6f 72 46 69 6c 65 20 24 74 65 73 heckForFile $tes
30b20 74 5f 63 68 61 6e 6e 65 6c 20 24 74 65 73 74 49 t_channel $testI
30b30 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f 67 46 nstallVs2013LogF
30b40 69 6c 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ile..
30b50 20 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 20 20 }....
30b60 20 20 69 66 20 7b 21 5b 68 61 76 65 43 6f 6e 73 if {![haveCons
30b70 74 72 61 69 6e 74 20 5b 61 70 70 65 6e 64 41 72 traint [appendAr
30b80 67 73 20 66 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 gs file_ \..
30b90 20 20 20 20 20 20 20 20 20 20 20 20 5b 66 69 6c [fil
30ba0 65 20 74 61 69 6c 20 24 74 65 73 74 49 6e 73 74 e tail $testInst
30bb0 61 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 allVs2015LogFile
30bc0 5d 5d 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 20 ]]]} then {..
30bd0 20 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b check
30be0 46 6f 72 46 69 6c 65 20 24 74 65 73 74 5f 63 68 ForFile $test_ch
30bf0 61 6e 6e 65 6c 20 24 74 65 73 74 49 6e 73 74 61 annel $testInsta
30c00 6c 6c 56 73 32 30 31 35 4c 6f 67 46 69 6c 65 0d llVs2015LogFile.
30c10 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0d 0a . }..
30c20 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 .. if
30c30 20 7b 21 5b 68 61 76 65 43 6f 6e 73 74 72 61 69 {![haveConstrai
30c40 6e 74 20 5b 61 70 70 65 6e 64 41 72 67 73 20 66 nt [appendArgs f
30c50 69 6c 65 5f 20 5c 0d 0a 20 20 20 20 20 20 20 20 ile_ \..
30c60 20 20 20 20 20 20 20 20 5b 66 69 6c 65 20 74 61 [file ta
30c70 69 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 il $testInstallV
30c80 73 32 30 31 37 4c 6f 67 46 69 6c 65 5d 5d 5d 7d s2017LogFile]]]}
30c90 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
30ca0 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 checkForF
30cb0 69 6c 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 ile $test_channe
30cc0 6c 20 24 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 l $testInstallVs
30cd0 32 30 31 37 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 2017LogFile..
30ce0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
30cf0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
30d00 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
30d10 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
30d20 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
30d30 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
30d40 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
30d50 30 30 35 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 005LogFile]]]} t
30d60 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
30d70 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
30d80 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
30d90 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
30da0 32 30 30 35 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 2005LogFile..
30db0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
30dc0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
30dd0 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
30de0 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
30df0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
30e00 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
30e10 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
30e20 30 30 38 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 008LogFile]]]} t
30e30 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
30e40 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
30e50 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
30e60 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
30e70 32 30 30 38 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 2008LogFile..
30e80 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
30e90 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
30ea0 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
30eb0 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
30ec0 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
30ed0 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
30ee0 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
30ef0 30 31 30 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 010LogFile]]]} t
30f00 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
30f10 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
30f20 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
30f30 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
30f40 32 30 31 30 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 2010LogFile..
30f50 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
30f60 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
30f70 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
30f80 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
30f90 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
30fa0 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
30fb0 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
30fc0 30 31 32 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 012LogFile]]]} t
30fd0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
30fe0 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
30ff0 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
31000 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
31010 32 30 31 32 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 2012LogFile..
31020 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
31030 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
31040 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
31050 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
31060 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
31070 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
31080 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
31090 30 31 33 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 013LogFile]]]} t
310a0 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
310b0 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
310c0 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
310d0 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
310e0 32 30 31 33 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 2013LogFile..
310f0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
31100 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
31110 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
31120 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
31130 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
31140 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
31150 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
31160 30 31 35 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 015LogFile]]]} t
31170 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
31180 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
31190 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
311a0 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
311b0 32 30 31 35 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 2015LogFile..
311c0 20 20 20 20 20 20 20 20 20 7d 0d 0a 0d 0a 20 20 }....
311d0 20 20 20 20 20 20 20 20 20 20 69 66 20 7b 21 5b if {![
311e0 68 61 76 65 43 6f 6e 73 74 72 61 69 6e 74 20 5b haveConstraint [
311f0 61 70 70 65 6e 64 41 72 67 73 20 66 69 6c 65 5f appendArgs file_
31200 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 \..
31210 20 20 20 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 [file tail $
31220 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 testUninstallVs2
31230 30 31 37 4c 6f 67 46 69 6c 65 5d 5d 5d 7d 20 74 017LogFile]]]} t
31240 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 hen {..
31250 20 20 20 20 20 63 68 65 63 6b 46 6f 72 46 69 6c checkForFil
31260 65 20 24 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 e $test_channel
31270 24 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 $testUninstallVs
31280 32 30 31 37 4c 6f 67 46 69 6c 65 0d 0a 20 20 20 2017LogFile..
31290 20 20 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 }..
312a0 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 20 }..
312b0 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a 20 20 20 }.. }..
312c0 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 6f 63 20 }..... proc
312d0 72 75 6e 53 51 4c 69 74 65 54 65 73 74 46 69 6c runSQLiteTestFil
312e0 65 73 45 70 69 6c 6f 67 75 65 20 7b 7d 20 7b 0d esEpilogue {} {.
312f0 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
31300 23 20 4e 4f 54 45 3a 20 53 6b 69 70 20 72 75 6e # NOTE: Skip run
31310 6e 69 6e 67 20 6f 75 72 20 63 75 73 74 6f 6d 20 ning our custom
31320 66 69 6c 65 73 20 65 70 69 6c 6f 67 75 65 20 69 files epilogue i
31330 66 20 74 68 65 20 6d 61 69 6e 20 6f 6e 65 20 68 f the main one h
31340 61 73 20 62 65 65 6e 0d 0a 20 20 20 20 20 20 23 as been.. #
31350 20 20 20 20 20 20 20 73 6b 69 70 70 65 64 2e 0d skipped..
31360 0a 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 . #..
31370 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
31380 73 20 3a 3a 6e 6f 28 65 70 69 6c 6f 67 75 65 2e s ::no(epilogue.
31390 65 61 67 6c 65 29 5d 7d 20 74 68 65 6e 20 7b 0d eagle)]} then {.
313a0 0a 20 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c . uplevel
313b0 20 31 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 1 {..
313c0 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 unset -nocomplai
313d0 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 n \..
313e0 20 20 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c testUninstall
313f0 56 73 32 30 31 37 4c 6f 67 46 69 6c 65 20 74 65 Vs2017LogFile te
31400 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 31 stUninstallVs201
31410 35 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 20 20 20 5LogFile \..
31420 20 20 20 20 20 20 20 20 20 20 74 65 73 74 55 6e testUn
31430 69 6e 73 74 61 6c 6c 56 73 32 30 31 33 4c 6f 67 installVs2013Log
31440 46 69 6c 65 20 74 65 73 74 55 6e 69 6e 73 74 61 File testUninsta
31450 6c 6c 56 73 32 30 31 32 4c 6f 67 46 69 6c 65 20 llVs2012LogFile
31460 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 \..
31470 20 74 65 73 74 55 6e 69 6e 73 74 61 6c 6c 56 73 testUninstallVs
31480 32 30 31 30 4c 6f 67 46 69 6c 65 20 74 65 73 74 2010LogFile test
31490 55 6e 69 6e 73 74 61 6c 6c 56 73 32 30 30 38 4c UninstallVs2008L
314a0 6f 67 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 ogFile \..
314b0 20 20 20 20 20 20 20 20 74 65 73 74 55 6e 69 6e testUnin
314c0 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 46 69 stallVs2005LogFi
314d0 6c 65 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 le testInstallVs
314e0 32 30 31 37 4c 6f 67 46 69 6c 65 20 5c 0d 0a 20 2017LogFile \..
314f0 20 20 20 20 20 20 20 20 20 20 20 20 20 74 65 73 tes
31500 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 35 4c 6f tInstallVs2015Lo
31510 67 46 69 6c 65 20 74 65 73 74 49 6e 73 74 61 6c gFile testInstal
31520 6c 56 73 32 30 31 33 4c 6f 67 46 69 6c 65 20 5c lVs2013LogFile \
31530 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ..
31540 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 32 30 31 testInstallVs201
31550 32 4c 6f 67 46 69 6c 65 20 74 65 73 74 49 6e 73 2LogFile testIns
31560 74 61 6c 6c 56 73 32 30 31 30 4c 6f 67 46 69 6c tallVs2010LogFil
31570 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 e \..
31580 20 20 20 74 65 73 74 49 6e 73 74 61 6c 6c 56 73 testInstallVs
31590 32 30 30 38 4c 6f 67 46 69 6c 65 20 74 65 73 74 2008LogFile test
315a0 49 6e 73 74 61 6c 6c 56 73 32 30 30 35 4c 6f 67 InstallVs2005Log
315b0 46 69 6c 65 0d 0a 0d 0a 20 20 20 20 20 20 20 20 File....
315c0 20 20 75 6e 73 65 74 20 2d 6e 6f 63 6f 6d 70 6c unset -nocompl
315d0 61 69 6e 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 ain \..
315e0 20 20 20 20 20 6e 6f 72 74 68 77 69 6e 64 45 66 northwindEf
315f0 44 62 46 69 6c 65 20 74 65 73 74 4c 69 6e 71 4f DbFile testLinqO
31600 75 74 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 utFile \..
31610 20 20 20 20 20 20 20 20 77 61 6c 44 62 46 69 6c walDbFil
31620 65 20 6e 6f 6e 57 61 6c 44 62 46 69 6c 65 0d 0a e nonWalDbFile..
31630 0d 0a 20 20 20 20 20 20 20 20 20 20 75 6e 73 65 .. unse
31640 74 20 2d 6e 6f 63 6f 6d 70 6c 61 69 6e 20 5c 0d t -nocomplain \.
31650 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 . t
31660 65 73 74 45 66 36 45 78 65 46 69 6c 65 20 74 65 estEf6ExeFile te
31670 73 74 4c 69 6e 71 45 78 65 46 69 6c 65 20 5c 0d stLinqExeFile \.
31680 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 . t
31690 65 73 74 45 78 65 46 69 6c 65 20 73 79 73 74 65 estExeFile syste
316a0 6d 44 61 74 61 53 51 4c 69 74 65 45 66 36 44 6c mDataSQLiteEf6Dl
316b0 6c 46 69 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 lFile \..
316c0 20 20 20 20 20 20 20 73 79 73 74 65 6d 44 61 74 systemDat
316d0 61 53 51 4c 69 74 65 4c 69 6e 71 44 6c 6c 46 69 aSQLiteLinqDllFi
316e0 6c 65 20 73 79 73 74 65 6d 44 61 74 61 53 51 4c le systemDataSQL
316f0 69 74 65 44 6c 6c 46 69 6c 65 20 5c 0d 0a 20 20 iteDllFile \..
31700 20 20 20 20 20 20 20 20 20 20 20 20 73 71 6c 69 sqli
31710 74 65 44 65 73 69 67 6e 65 72 44 6c 6c 46 69 6c teDesignerDllFil
31720 65 20 69 6e 73 74 61 6c 6c 65 72 45 78 65 46 69 e installerExeFi
31730 6c 65 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 20 le \..
31740 20 20 20 20 65 6e 74 69 74 79 46 72 61 6d 65 77 entityFramew
31750 6f 72 6b 44 6c 6c 46 69 6c 65 0d 0a 20 20 20 20 orkDllFile..
31760 20 20 20 20 7d 0d 0a 20 20 20 20 20 20 7d 0d 0a }.. }..
31770 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 70 72 }..... pr
31780 6f 63 20 72 75 6e 53 51 4c 69 74 65 54 65 73 74 oc runSQLiteTest
31790 45 70 69 6c 6f 67 75 65 20 7b 7d 20 7b 0d 0a 20 Epilogue {} {..
317a0 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 23 20 #.. #
317b0 4e 4f 54 45 3a 20 53 6b 69 70 20 72 75 6e 6e 69 NOTE: Skip runni
317c0 6e 67 20 6f 75 72 20 63 75 73 74 6f 6d 20 65 70 ng our custom ep
317d0 69 6c 6f 67 75 65 20 69 66 20 74 68 65 20 6d 61 ilogue if the ma
317e0 69 6e 20 6f 6e 65 20 68 61 73 20 62 65 65 6e 0d in one has been.
317f0 0a 20 20 20 20 20 20 23 20 20 20 20 20 20 20 73 . # s
31800 6b 69 70 70 65 64 2e 0d 0a 20 20 20 20 20 20 23 kipped... #
31810 0d 0a 20 20 20 20 20 20 69 66 20 7b 21 5b 69 6e .. if {![in
31820 66 6f 20 65 78 69 73 74 73 20 3a 3a 6e 6f 28 65 fo exists ::no(e
31830 70 69 6c 6f 67 75 65 2e 65 61 67 6c 65 29 5d 7d pilogue.eagle)]}
31840 20 74 68 65 6e 20 7b 0d 0a 20 20 20 20 20 20 20 then {..
31850 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e 4f #.. # NO
31860 54 45 3a 20 53 68 6f 77 20 77 68 65 6e 20 6f 75 TE: Show when ou
31870 72 20 74 65 73 74 73 20 61 63 74 75 61 6c 6c 79 r tests actually
31880 20 65 6e 64 65 64 20 28 6e 6f 77 29 2e 0d 0a 20 ended (now)...
31890 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 #..
318a0 20 20 74 70 75 74 73 20 24 3a 3a 74 65 73 74 5f tputs $::test_
318b0 63 68 61 6e 6e 65 6c 20 5b 61 70 70 65 6e 64 41 channel [appendA
318c0 72 67 73 20 5c 0d 0a 20 20 20 20 20 20 20 20 20 rgs \..
318d0 20 20 20 22 2d 2d 2d 2d 20 53 79 73 74 65 6d 2e "---- System.
318e0 44 61 74 61 2e 53 51 4c 69 74 65 20 74 65 73 74 Data.SQLite test
318f0 73 20 65 6e 64 65 64 20 61 74 20 22 20 5c 0d 0a s ended at " \..
31900 20 20 20 20 20 20 20 20 20 20 20 20 5b 63 6c 6f [clo
31910 63 6b 20 66 6f 72 6d 61 74 20 5b 63 6c 6f 63 6b ck format [clock
31920 20 73 65 63 6f 6e 64 73 5d 5d 20 5c 6e 5d 0d 0a seconds]] \n]..
31930 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 .. #..
31940 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 4c 6f 61 # NOTE: Loa
31950 64 20 74 68 65 20 22 65 70 69 6c 6f 67 75 65 22 d the "epilogue"
31960 20 63 75 73 74 6f 6d 20 70 65 72 2d 75 73 65 72 custom per-user
31970 20 61 6e 64 2f 6f 72 20 70 65 72 2d 68 6f 73 74 and/or per-host
31980 20 74 65 73 74 0d 0a 20 20 20 20 20 20 20 20 23 test.. #
31990 20 20 20 20 20 20 20 73 65 74 74 69 6e 67 73 20 settings
319a0 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d now... #.
319b0 0a 20 20 20 20 20 20 20 20 75 70 6c 65 76 65 6c . uplevel
319c0 20 31 20 5b 6c 69 73 74 20 6c 6f 61 64 53 51 4c 1 [list loadSQL
319d0 69 74 65 54 65 73 74 53 65 74 74 69 6e 67 73 20 iteTestSettings
319e0 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c 20 $::test_channel
319f0 2e 65 70 69 6c 6f 67 75 65 5d 0d 0a 0d 0a 20 20 .epilogue]....
31a00 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
31a10 20 23 20 42 55 47 46 49 58 3a 20 42 65 66 6f 72 # BUGFIX: Befor
31a20 65 20 63 68 65 63 6b 69 6e 67 20 74 68 65 20 66 e checking the f
31a30 69 6e 61 6c 20 72 65 73 6f 75 72 63 65 73 20 69 inal resources i
31a40 6e 20 75 73 65 20 62 79 20 53 51 4c 69 74 65 2c n use by SQLite,
31a50 20 6d 61 6b 65 0d 0a 20 20 20 20 20 20 20 20 23 make.. #
31a60 20 20 20 20 20 20 20 20 20 73 75 72 65 20 62 6f sure bo
31a70 74 68 20 6f 66 20 74 68 65 20 50 52 41 47 4d 41 th of the PRAGMA
31a80 20 72 65 6c 61 74 65 64 20 64 69 72 65 63 74 6f related directo
31a90 72 79 20 6e 61 6d 65 73 20 61 72 65 20 66 72 65 ry names are fre
31aa0 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a ed... #..
31ab0 20 20 20 20 20 20 20 20 63 68 65 63 6b 46 6f 72 checkFor
31ac0 53 51 4c 69 74 65 44 69 72 65 63 74 6f 72 69 65 SQLiteDirectorie
31ad0 73 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 s $::test_channe
31ae0 6c 20 74 72 75 65 0d 0a 0d 0a 20 20 20 20 20 20 l true....
31af0 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
31b00 4f 54 45 3a 20 41 6c 73 6f 20 72 65 70 6f 72 74 OTE: Also report
31b10 20 74 68 65 20 72 65 73 6f 75 72 63 65 20 75 73 the resource us
31b20 61 67 65 20 61 66 74 65 72 20 72 75 6e 6e 69 6e age after runnin
31b30 67 20 74 68 65 20 74 65 73 74 73 2e 0d 0a 20 20 g the tests...
31b40 20 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 #..
31b50 20 72 65 70 6f 72 74 53 51 4c 69 74 65 52 65 73 reportSQLiteRes
31b60 6f 75 72 63 65 73 20 24 3a 3a 74 65 73 74 5f 63 ources $::test_c
31b70 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 20 20 20 hannel....
31b80 20 20 23 0d 0a 20 20 20 20 20 20 20 20 23 20 4e #.. # N
31b90 4f 54 45 3a 20 52 65 70 6f 72 74 20 74 68 65 20 OTE: Report the
31ba0 63 72 69 74 69 63 61 6c 20 68 61 6e 64 6c 65 20 critical handle
31bb0 63 6f 75 6e 74 73 20 61 66 74 65 72 20 72 75 6e counts after run
31bc0 6e 69 6e 67 20 74 68 65 20 74 65 73 74 73 2e 0d ning the tests..
31bd0 0a 20 20 20 20 20 20 20 20 23 0d 0a 20 20 20 20 . #..
31be0 20 20 20 20 67 65 74 53 51 4c 69 74 65 48 61 6e getSQLiteHan
31bf0 64 6c 65 43 6f 75 6e 74 73 20 24 3a 3a 74 65 73 dleCounts $::tes
31c00 74 5f 63 68 61 6e 6e 65 6c 0d 0a 0d 0a 20 20 20 t_channel....
31c10 20 20 20 20 20 23 0d 0a 20 20 20 20 20 20 20 20 #..
31c20 23 20 4e 4f 54 45 3a 20 49 66 20 6e 65 63 65 73 # NOTE: If neces
31c30 73 61 72 79 2c 20 64 69 73 61 62 6c 65 20 73 68 sary, disable sh
31c40 61 72 65 64 2d 63 61 63 68 65 20 6d 6f 64 65 20 ared-cache mode
31c50 6e 6f 77 2e 0d 0a 20 20 20 20 20 20 20 20 23 0d now... #.
31c60 0a 20 20 20 20 20 20 20 20 69 66 20 7b 5b 68 61 . if {[ha
31c70 73 52 75 6e 74 69 6d 65 4f 70 74 69 6f 6e 20 73 sRuntimeOption s
31c80 68 61 72 65 64 43 61 63 68 65 5d 7d 20 74 68 65 haredCache]} the
31c90 6e 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 65 n {.. e
31ca0 6e 61 62 6c 65 53 68 61 72 65 64 43 61 63 68 65 nableSharedCache
31cb0 20 24 3a 3a 74 65 73 74 5f 63 68 61 6e 6e 65 6c $::test_channel
31cc0 20 66 61 6c 73 65 0d 0a 20 20 20 20 20 20 20 20 false..
31cd0 7d 0d 0a 0d 0a 20 20 20 20 20 20 20 20 23 0d 0a }.... #..
31ce0 20 20 20 20 20 20 20 20 23 20 4e 4f 54 45 3a 20 # NOTE:
31cf0 52 65 73 74 6f 72 65 20 74 68 65 20 70 72 65 76 Restore the prev
31d00 69 6f 75 73 6c 79 20 73 61 76 65 64 20 65 6e 76 iously saved env
31d10 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c ironment variabl
31d20 65 73 20 74 68 61 74 20 77 65 0d 0a 20 20 20 20 es that we..
31d30 20 20 20 20 23 20 20 20 20 20 20 20 63 68 61 6e # chan
31d40 67 65 64 20 66 6f 72 20 74 68 65 20 74 65 73 74 ged for the test
31d50 20 73 75 69 74 65 2e 0d 0a 20 20 20 20 20 20 20 suite...
31d60 20 23 0d 0a 20 20 20 20 20 20 20 20 72 65 73 74 #.. rest
31d70 6f 72 65 45 6e 76 69 72 6f 6e 6d 65 6e 74 56 61 oreEnvironmentVa
31d80 72 69 61 62 6c 65 73 20 5c 0d 0a 20 20 20 20 20 riables \..
31d90 20 20 20 20 20 20 20 5b 6c 69 73 74 20 49 6e 69 [list Ini
31da0 74 69 61 6c 69 7a 65 5f 53 51 4c 69 74 65 4c 6f tialize_SQLiteLo
31db0 67 5d 20 3a 3a 74 65 73 74 53 75 69 74 65 53 61 g] ::testSuiteSa
31dc0 76 65 64 45 6e 76 0d 0a 20 20 20 20 20 20 7d 0d vedEnv.. }.
31dd0 0a 20 20 20 20 7d 0d 0a 0c 0d 0a 20 20 20 20 23 . }..... #
31de0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31df0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31e00 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31e10 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31e20 23 23 23 23 23 23 23 23 23 23 0d 0a 20 20 20 20 ##########..
31e30 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31e40 23 23 23 23 23 23 23 23 23 23 23 23 23 20 45 4e ############# EN
31e50 44 20 45 61 67 6c 65 20 4f 4e 4c 59 20 23 23 23 D Eagle ONLY ###
31e60 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31e70 23 23 23 23 23 23 23 23 23 23 23 0d 0a 20 20 20 ###########..
31e80 20 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ###############
31e90 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31ea0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31eb0 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 ################
31ec0 23 23 23 23 23 23 23 23 23 23 23 23 0d 0a 20 20 ############..
31ed0 7d 0d 0a 0d 0a 20 20 23 0d 0a 20 20 23 20 4e 4f }.... #.. # NO
31ee0 54 45 3a 20 53 61 76 65 20 74 68 65 20 6e 61 6d TE: Save the nam
31ef0 65 20 6f 66 20 74 68 65 20 64 69 72 65 63 74 6f e of the directo
31f00 72 79 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 ry containing th
31f10 69 73 20 66 69 6c 65 2e 0d 0a 20 20 23 0d 0a 20 is file... #..
31f20 20 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 if {![info exis
31f30 74 73 20 63 6f 6d 6d 6f 6e 5f 64 69 72 65 63 74 ts common_direct
31f40 6f 72 79 5d 7d 20 74 68 65 6e 20 7b 0d 0a 20 20 ory]} then {..
31f50 20 20 73 65 74 20 63 6f 6d 6d 6f 6e 5f 64 69 72 set common_dir
31f60 65 63 74 6f 72 79 20 5b 66 69 6c 65 20 64 69 72 ectory [file dir
31f70 6e 61 6d 65 20 5b 69 6e 66 6f 20 73 63 72 69 70 name [info scrip
31f80 74 5d 5d 0d 0a 20 20 7d 0d 0a 0d 0a 20 20 23 0d t]].. }.... #.
31f90 0a 20 20 23 20 4e 4f 54 45 3a 20 50 72 6f 76 69 . # NOTE: Provi
31fa0 64 65 20 74 68 65 20 53 79 73 74 65 6d 2e 44 61 de the System.Da
31fb0 74 61 2e 53 51 4c 69 74 65 20 74 65 73 74 20 70 ta.SQLite test p
31fc0 61 63 6b 61 67 65 20 74 6f 20 74 68 65 20 69 6e ackage to the in
31fd0 74 65 72 70 72 65 74 65 72 2e 0d 0a 20 20 23 0d terpreter... #.
31fe0 0a 20 20 70 61 63 6b 61 67 65 20 70 72 6f 76 69 . package provi
31ff0 64 65 20 53 79 73 74 65 6d 2e 44 61 74 61 2e 53 de System.Data.S
32000 51 4c 69 74 65 2e 54 65 73 74 20 31 2e 30 0d 0a QLite.Test 1.0..
32010 7d 0d 0a }..