Compare commits

...

12 Commits

Author SHA1 Message Date
dan 3cef7c3651 Fix a segfault that could occur if an 'optimize' command was issued on an FTS table that contained at least one row but zero terms.
FossilOrigin-Name: b21746ac11ecbe1baab6dd715460cc14a2b89eaa
2014-10-02 09:27:08 +00:00
dan 92d9f1b6b3 Avoid an assertion fault and/or freeing memory while it is still in use when
an error occurs during virtual table construction. Cherrypick of [a02599ad85d].

FossilOrigin-Name: 760072ceea294fd7d168de28de9e775e545ef30e
2013-03-07 11:03:51 +00:00
mistachkin f7c7532629 Backport VSIX tooling and packaging fixes and enhancements.
FossilOrigin-Name: e890bcde34370079f4da011da39e4ba8224ffab4
2012-12-07 04:46:53 +00:00
drh d948846699 Backport the [/timeline?r=shared-cache-fix | shared-cache-fix] branch.
FossilOrigin-Name: 325364a984e9a5c0825810bf50f57e026ff3b8dd
2012-10-26 13:34:05 +00:00
drh cc5bc4d5fd Add QNX-specific performance tweaks to the unix VFS. (Cherry-pick merge of
[b02849e7bde458].)
Put auxiliary libraries after libsqlite3.a in the testfixture target of
the "main.mk" makefile.  (Cherry-pick merge of [8fc8548f52ab8fcfb5].)

FossilOrigin-Name: cbfd1b120ada30ee98403af8d95cfbd590353365
2012-10-26 13:25:32 +00:00
mistachkin 6027cd2a9f Correct the design-time library file path in the VSIX package now that it is per-configuration.
FossilOrigin-Name: 521024d4a799f36618e8adb1d032d76806db28bc
2012-10-19 19:22:52 +00:00
mistachkin 67bfbb4712 Backport of tooling support for including the debug build in the VSIX package.
FossilOrigin-Name: c188896719cb6b942936e27fab4ead52e2c63c54
2012-10-12 18:22:51 +00:00
drh c2a9c57a33 Version 3.7.14.1
FossilOrigin-Name: 091570e46d04e84b67228e0bdbcd6e1fb60c6bdb
2012-10-04 19:37:12 +00:00
drh 4d4f3e5d85 Candidate fix for ticket [d02e1406a58ea02].
FossilOrigin-Name: 81fd941da62956e32d1c4ffcdb39abecba7a6f3b
2012-10-04 16:00:24 +00:00
drh 05c093e1b3 Increase the version number to 3.7.14.1. The version of autoconf used is
different from the previous release so there are huge differences in the
generated "configure" script.

FossilOrigin-Name: 972dbd5fccaa0dbde0a7ad904da74e31888e5062
2012-10-04 15:36:03 +00:00
drh 6c1d7897e2 Fix the TCL interface so that SQL functions implemented in TCL honor the
"nullvalue" setting.  Also remove from the TCL interface some unused 
legacy UTF8 translation code left over from SQLite2.

FossilOrigin-Name: 9bf64b6612c243ea66d04f502dc23f875ad45cd8
2012-10-03 11:11:01 +00:00
drh 659f76245f Work around an optimization issue with the MSVC compiler for ARM.
FossilOrigin-Name: 9fab9edd0dfa6c887cf89ec6cea58f3313dd2d1a
2012-10-02 23:26:39 +00:00
28 changed files with 3188 additions and 4683 deletions
+65 -20
View File
@@ -9,49 +9,75 @@ TOP = .
# Set this non-0 to create and use the SQLite amalgamation file.
#
!IFNDEF USE_AMALGAMATION
USE_AMALGAMATION = 1
!ENDIF
# Set this non-0 to use the International Components for Unicode (ICU).
#
!IFNDEF USE_ICU
USE_ICU = 0
!ENDIF
# Set this non-0 to dynamically link to the MSVC runtime library.
#
!IFNDEF USE_CRT_DLL
USE_CRT_DLL = 0
!ENDIF
# Set this non-0 to attempt setting the native compiler automatically
# for cross-compiling the command line tools needed during the compilation
# process.
#
!IFNDEF XCOMPILE
XCOMPILE = 0
!ENDIF
# Set this non-0 to use the native libraries paths for cross-compiling
# the command line tools needed during the compilation process.
#
!IFNDEF USE_NATIVE_LIBPATHS
USE_NATIVE_LIBPATHS = 0
!ENDIF
# Set this 0 to skip the compiling and embedding of version resources.
#
!IFNDEF USE_RC
USE_RC = 1
!ENDIF
# Set this non-0 to compile binaries suitable for the WinRT environment.
# This setting does not apply to any binaries that require Tcl to operate
# properly (i.e. the text fixture, etc).
#
!IFNDEF FOR_WINRT
FOR_WINRT = 0
!ENDIF
# Set this non-0 to skip attempting to look for and/or link with the Tcl
# runtime library.
#
!IFNDEF NO_TCL
NO_TCL = 0
!ENDIF
# Set this to non-0 to create and use PDBs.
#
!IFNDEF SYMBOLS
SYMBOLS = 1
!ENDIF
# Set this to non-0 to use the SQLite debugging heap subsystem.
#
!IFNDEF MEMDEBUG
MEMDEBUG = 0
!ENDIF
# Set this to non-0 to use the Win32 native heap subsystem.
#
!IFNDEF WIN32HEAP
WIN32HEAP = 0
!ENDIF
# Set this to one of the following values to enable various debugging
# features. Each level includes the debugging options from the previous
@@ -64,7 +90,9 @@ WIN32HEAP = 0
# 4 == SQLITE_DEBUG_OS_TRACE: Enables output from the OSTRACE() macros.
# 5 == SQLITE_ENABLE_IOTRACE: Enables output from the IOTRACE() macros.
#
!IFNDEF DEBUG
DEBUG = 0
!ENDIF
# Check for the predefined command macro CC. This should point to the compiler
# binary for the target platform. If it is not defined, simply define it to
@@ -157,8 +185,8 @@ NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
# will run on the target platform. (BCC and TCC are usually the
# same unless your are cross-compiling.)
#
TCC = $(CC) -W3 -DSQLITE_OS_WIN=1 -I. -I$(TOP)\src -fp:precise
RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP)\src
TCC = $(CC) -W3 -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src -fp:precise
RCC = $(RC) -DSQLITE_OS_WIN=1 -I$(TOP) -I$(TOP)\src
# When compiling the library for use in the WinRT environment,
# the following compile-time options must be used as well to
@@ -168,8 +196,8 @@ RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP)\src
!IF $(FOR_WINRT)!=0
TCC = $(TCC) -DSQLITE_OS_WINRT=1
RCC = $(RCC) -DSQLITE_OS_WINRT=1
TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_PARTITION_APP
RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_PARTITION_APP
TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
!ENDIF
# Also, we need to dynamically link to the correct MSVC runtime
@@ -180,14 +208,18 @@ RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_PARTITION_APP
!IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
!IF $(DEBUG)>0
TCC = $(TCC) -MDd
BCC = $(BCC) -MDd
!ELSE
TCC = $(TCC) -MD
BCC = $(BCC) -MD
!ENDIF
!ELSE
!IF $(DEBUG)>0
TCC = $(TCC) -MTd
BCC = $(BCC) -MTd
!ELSE
TCC = $(TCC) -MT
BCC = $(BCC) -MT
!ENDIF
!ENDIF
@@ -472,6 +504,14 @@ LIBOBJ = $(LIBOBJS0)
LIBOBJ = $(LIBOBJS1)
!ENDIF
# Determine if embedded resource compilation and usage are enabled.
#
!IF $(USE_RC)!=0
LIBRESOBJS = sqlite3res.lo
!ELSE
LIBRESOBJS =
!ENDIF
# All of the source code files.
#
SRC = \
@@ -766,10 +806,10 @@ libsqlite3.lib: $(LIBOBJ)
libtclsqlite3.lib: tclsqlite.lo libsqlite3.lib
$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS)
sqlite3.exe: $(TOP)\src\shell.c libsqlite3.lib sqlite3res.lo sqlite3.h
sqlite3.exe: $(TOP)\src\shell.c libsqlite3.lib $(LIBRESOBJS) sqlite3.h
$(LTLINK) $(READLINE_FLAGS) \
$(TOP)\src\shell.c \
/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib sqlite3res.lo $(LIBREADLINE) $(LTLIBS) $(TLIBS)
/link $(LTLINKOPTS) $(LTLIBPATHS) libsqlite3.lib $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
# This target creates a directory named "tsrc" and fills it with
# copies of all of the C source code and header files needed to
@@ -789,8 +829,8 @@ sqlite3.exe: $(TOP)\src\shell.c libsqlite3.lib sqlite3res.lo sqlite3.h
sqlite3.c: .target_source $(TOP)\tool\mksqlite3c.tcl
$(TCLSH_CMD) $(TOP)\tool\mksqlite3c.tcl
sqlite3-all.c: sqlite3.c $(TOP)/tool/split-sqlite3c.tcl
$(TCLSH_CMD) $(TOP)/tool/split-sqlite3c.tcl
sqlite3-all.c: sqlite3.c $(TOP)\tool\split-sqlite3c.tcl
$(TCLSH_CMD) $(TOP)\tool\split-sqlite3c.tcl
# Rule to build the amalgamation
#
@@ -819,14 +859,16 @@ opcodes.lo: opcodes.c
# Rule to build the Win32 resources object file.
#
sqlite3res.lo: $(TOP)\src\sqlite3.rc $(HDR)
!IF $(USE_RC)!=0
$(LIBRESOBJS): $(TOP)\src\sqlite3.rc $(HDR)
echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
for /F %%V in ('type VERSION') do ( \
for /F %%V in ('type "$(TOP)\VERSION"') do ( \
echo #define SQLITE_RESOURCE_VERSION %%V \
| $(NAWK) "/.*/ { gsub(/[.]/,\",\");print }" >> sqlite3rc.h \
)
echo #endif >> sqlite3rc.h
$(LTRCOMPILE) -fo sqlite3res.lo $(TOP)\src\sqlite3.rc
$(LTRCOMPILE) -fo $(LIBRESOBJS) $(TOP)\src\sqlite3.rc
!ENDIF
# Rules to build individual *.lo files from files in the src directory.
#
@@ -1043,8 +1085,8 @@ tclsqlite.lo: $(TOP)\src\tclsqlite.c $(HDR)
tclsqlite-shell.lo: $(TOP)\src\tclsqlite.c $(HDR)
$(LTCOMPILE) -DTCLSH=1 -DBUILD_sqlite -I$(TCLINCDIR) -c $(TOP)\src\tclsqlite.c
tclsqlite3.exe: tclsqlite-shell.lo libsqlite3.lib sqlite3res.lo
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /OUT:$@ libsqlite3.lib tclsqlite-shell.lo sqlite3res.lo $(LTLIBS) $(TLIBS)
tclsqlite3.exe: tclsqlite-shell.lo libsqlite3.lib $(LIBRESOBJS)
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /OUT:$@ libsqlite3.lib tclsqlite-shell.lo $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
# Rules to build opcodes.c and opcodes.h
#
@@ -1157,11 +1199,11 @@ TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC0)
TESTFIXTURE_SRC = $(TESTSRC) $(TOP)\src\tclsqlite.c $(TESTFIXTURE_SRC1)
!ENDIF
testfixture.exe: $(TESTFIXTURE_SRC) sqlite3res.lo $(HDR)
testfixture.exe: $(TESTFIXTURE_SRC) $(LIBRESOBJS) $(HDR)
$(LTLINK) -DSQLITE_NO_SYNC=1 $(TESTFIXTURE_FLAGS) \
-DBUILD_sqlite -I$(TCLINCDIR) \
$(TESTFIXTURE_SRC) \
/link $(LTLINKOPTS) $(LTLIBPATHS) sqlite3res.lo $(LTLIBS) $(TLIBS)
/link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
fulltest: testfixture.exe sqlite3.exe
.\testfixture.exe $(TOP)\test\all.test
@@ -1169,6 +1211,9 @@ fulltest: testfixture.exe sqlite3.exe
soaktest: testfixture.exe sqlite3.exe
.\testfixture.exe $(TOP)\test\all.test -soak=1
fulltestonly: testfixture.exe sqlite3.exe
.\testfixture.exe $(TOP)\test\full.test
test: testfixture.exe sqlite3.exe
.\testfixture.exe $(TOP)\test\veryquick.test
@@ -1179,9 +1224,9 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)\src\test_stat.c $(TOP)\src\tclsqlite.c $(TO
$(NAWK) -f $(TOP)\tool\tostr.awk $(TOP)\tool\spaceanal.tcl >> $@
echo ; return zMainloop; } >> $@
sqlite3_analyzer.exe: sqlite3_analyzer.c sqlite3res.lo
sqlite3_analyzer.exe: sqlite3_analyzer.c $(LIBRESOBJS)
$(LTLINK) -DBUILD_sqlite -DTCLSH=2 -I$(TCLINCDIR) sqlite3_analyzer.c \
/link $(LTLINKOPTS) $(LTLIBPATHS) sqlite3res.lo $(LTLIBS) $(TLIBS)
/link $(LTLINKOPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
clean:
del /Q *.lo *.ilk *.lib *.obj *.pdb sqlite3.exe libsqlite3.lib
@@ -1202,7 +1247,7 @@ clean:
del /Q sqlite3.c
del /Q sqlite3rc.h
del /Q sqlite3_analyzer.exe sqlite3_analyzer.exp sqlite3_analyzer.c
del /Q sqlite-output.vsix
del /Q sqlite-*-output.vsix
# Dynamic link library section.
#
@@ -1214,5 +1259,5 @@ sqlite3.def: libsqlite3.lib
| $(NAWK) "/ 1 _?sqlite3_/ { sub(/^.* _?/,\"\");print }" \
| sort >> sqlite3.def
sqlite3.dll: $(LIBOBJ) sqlite3res.lo sqlite3.def
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:sqlite3.def /OUT:$@ $(LIBOBJ) sqlite3res.lo $(LTLIBS) $(TLIBS)
sqlite3.dll: $(LIBOBJ) $(LIBRESOBJS) sqlite3.def
$(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:sqlite3.def /OUT:$@ $(LIBOBJ) $(LIBRESOBJS) $(LTLIBS) $(TLIBS)
+1 -1
View File
@@ -1 +1 @@
3.7.14
3.7.14.1
Vendored
+2154 -4360
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -3007,7 +3007,7 @@ static int fts3SegmentMerge(
csr.zTerm, csr.nTerm, csr.aDoclist, csr.nDoclist);
}
if( rc!=SQLITE_OK ) goto finished;
assert( pWriter );
assert( pWriter || bIgnoreEmpty );
if( iLevel!=FTS3_SEGCURSOR_PENDING ){
rc = fts3DeleteSegdir(
@@ -3015,7 +3015,9 @@ static int fts3SegmentMerge(
);
if( rc!=SQLITE_OK ) goto finished;
}
rc = fts3SegWriterFlush(p, pWriter, iNewLevel, iIdx);
if( pWriter ){
rc = fts3SegWriterFlush(p, pWriter, iNewLevel, iIdx);
}
finished:
fts3SegWriterFree(pWriter);
+1 -1
View File
@@ -546,7 +546,7 @@ TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE
testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
$(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
$(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c \
-o testfixture$(EXE) $(LIBTCL) $(THREADLIB) libsqlite3.a
-o testfixture$(EXE) $(LIBTCL) libsqlite3.a $(THREADLIB)
amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
$(TCCX) $(TCL_FLAGS) -DTCLSH=1 $(TESTFIXTURE_FLAGS) \
+32 -33
View File
@@ -1,12 +1,12 @@
C Version\s3.7.14
D 2012-09-03T15:42:36.217
C Fix\sa\ssegfault\sthat\scould\soccur\sif\san\s'optimize'\scommand\swas\sissued\son\san\sFTS\stable\sthat\scontained\sat\sleast\sone\srow\sbut\szero\sterms.
D 2014-10-02T09:27:08.018
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in abd5c10d21d1395f140d9e50ea999df8fa4d6376
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F Makefile.msc 2d696f01c228995e98b3b953a08b7bba1d48c130
F Makefile.msc 5a3b6f34d263b01f8b798c291fac1529fd650308
F Makefile.vxworks 879f034a64062a364b21000266bbd5bc6e0c19b9
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
F VERSION a71848df48082f1d6585d4b0819d530fc455485d
F VERSION 9694dff497fc7e53037a5890f30ab069c26e8ab7
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
F addopcodes.awk 17dc593f791f874d2c23a0f9360850ded0286531
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
@@ -15,7 +15,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
F config.h.in 0921066a13130082764ab4ab6456f7b5bebe56de
F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
F configure e2d0e3b67d2b1b1049d389fd671275d79bb80457 x
F configure e2c3b28dec7f5d1f72dd7465c87bb37f6af1931f x
F configure.ac 6e909664785b8184db2179013cd9d574f96ca3a3
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1
@@ -72,7 +72,7 @@ F ext/fts3/fts3_tokenizer.h 66dec98e365854b6cd2d54f1a96bb6d428fc5a68
F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004
F ext/fts3/fts3_unicode.c 49e36e6ba59f79e6bd6a8bfe434570fe48d20559
F ext/fts3/fts3_unicode2.c a863f05f758af36777dffc2facc898bc73fec896
F ext/fts3/fts3_write.c c30c49f3debb9497a07f15cc4c042815e35474ef
F ext/fts3/fts3_write.c d06519da31fe9cea7700c12644931596047b2e31
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100
F ext/fts3/tool/fts3view.c 6cfc5b67a5f0e09c0d698f9fd012c784bfaa9197
@@ -103,7 +103,7 @@ F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de
F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F main.mk 72026405046ed5b1f0368943b89c0aa29ad558b6
F main.mk 7bdf74b8299aaced4e066ac04467e8bf782e7552
F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a
F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac
@@ -116,23 +116,23 @@ F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad
F src/alter.c 149cc80d9257971b0bff34e58fb2263e01998289
F src/alter.c c3d9d0d6735064c4ba83a67dbf0d42f9bf5a1d6f
F src/analyze.c 7553068d21e32a57fc33ab6b2393fc8c1ba41410
F src/attach.c 577bf5675b0c50495fc28549f2fcbdb1bac71143
F src/attach.c 34c15ecd686e58f08e5bb1389e28a0b65c2c83db
F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c 5b31b24d6814b11de763debf342c8cd0a15a4910
F src/bitvec.c 26675fe8e431dc555e6f2d0e11e651d172234aa1
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
F src/btree.c 9cf6de113d23d47967df24b8d8ce6501c879d7e6
F src/btree.c 97edf88abd2b66f31886ba977d2b3b2a21d81d4c
F src/btree.h 4aee02e879211bfcfd3f551769578d2e940ab6c2
F src/btreeInt.h 4e5c2bd0f9b36b2a815a6d84f771a61a65830621
F src/build.c a3b700afd475e6387da59be6f2e86161e80d6d87
F src/build.c 0aef4fa83fbf334d0929f5e5ad1bb4beecfd00fb
F src/callback.c 0cb4228cdcd827dcc5def98fb099edcc9142dbcd
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
F src/ctime.c 500d019da966631ad957c37705642be87524463b
F src/date.c 067a81c9942c497aafd2c260e13add8a7d0c7dd4
F src/delete.c 335f36750dc6ac88d580aa36a6487459be9889de
F src/expr.c 217840a107dcc1e5dbb57cea311daad04bedbb9a
F src/delete.c c374ab8dd20ef475d9a4d26ef3799e71db7379a9
F src/expr.c 763fce595793e1f47fe9c80fceed2354eb089d13
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c 9c77d842dc9961d92a06a65abb80c64ef1750296
F src/func.c 18dfedfb857e100b05755a1b12e88b389f957879
@@ -140,7 +140,7 @@ F src/global.c 4cfdca5cb0edd33c4d021baec4ede958cb2c793b
F src/hash.c a4031441741932da9e7a65bee2b36b5d0e81c073
F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
F src/insert.c b090d0a9fb9ff2dbdeaf66aedccf98cd13b1af60
F src/insert.c ece0dfd2e1cee4cc35e343c79a52eab9f52cef48
F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416
@@ -162,7 +162,7 @@ F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
F src/os.c e1acdc09ff3ac2412945cca9766e2dcf4675f31c
F src/os.h 027491c77d2404c0a678bb3fb06286f331eb9b57
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_unix.c 69b2fe66316524eebf5f1ce85c1fdfe2952307e9
F src/os_unix.c 2383c59237fbf2a395a496baaffb683b9f469b06
F src/os_win.c 5dec8fe85ee547152075c020db72aec4382f0d0a
F src/pager.c 5665fa9ecec51f11dabdfd8eefefa89391856007
F src/pager.h 8b8c9bc065a3c66769df8724dfdf492ee1aab3c5
@@ -176,16 +176,16 @@ F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/resolve.c 9e28280ec98035f31900fdd1db01f86f68ca6c32
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
F src/select.c f843c872a97baa1594c2cc3d4c003409a7bd03af
F src/select.c b2c911d0bfad8a22732f9de08cbcc2148f7d8d6d
F src/shell.c 87953c5d9c73d9494db97d1607e2e2280418f261
F src/sqlite.h.in c447d35212736c4c77d86bc2d00f6cf4d4c12131
F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
F src/sqliteInt.h 053e03a532beb909ead2df0721db67cdb4c48ae8
F src/sqliteInt.h 462f9552011af3648628cfcdef1be7df823cdb52
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 35939e7e03abf1b7577ce311f48f682c40de3208
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F src/tclsqlite.c fe5406573e1527957e00dcaf51edd9d8bd31b918
F src/tclsqlite.c d20022c647aa7a871d7b4038c4ec971cafe39744
F src/test1.c 3d70f7c5987f186884cfebbfa7151a7d3d67d86e
F src/test2.c 4178056dd1e7d70f954ad8a1e3edb71a2a784daf
F src/test3.c 3c3c2407fa6ec7a19e24ae23f7cb439d0275a60d
@@ -247,11 +247,11 @@ F src/vdbeblob.c 32f2a4899d67f69634ea4dd93e3f651936d732cb
F src/vdbemem.c cb55e84b8e2c15704968ee05f0fae25883299b74
F src/vdbesort.c 0dc1b274dcb4d4c8e71b0b2b15261f286caba39b
F src/vdbetrace.c 8bd5da325fc90f28464335e4cc4ad1407fe30835
F src/vtab.c d2c54fd22aa83eb34fc6f7cd9b097f2fc2b1e9de
F src/vtab.c 940ea10c126f6e288725e80bb173f606670430f3
F src/wal.c 5acb3e7bbd31f10ba39acad9ce6b399055337a9d
F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6
F src/walker.c 3d75ba73de15e0f8cd0737643badbeb0e002f07b
F src/where.c 22783f4275f6fc09b663115a6091837cb5c510e0
F src/where.c e74f9ed463b0153e7f2a0e5f291c2be16ae76b35
F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/aggnested.test 0be144b453e0622a085fae8665c32f5676708e00
@@ -488,6 +488,7 @@ F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641
F test/fts3malloc.test b86ea33db9e8c58c0c2f8027a9fcadaf6a1568be
F test/fts3matchinfo.test 15edde2c4d373d60449658176af7164d622a62f0
F test/fts3near.test 2e318ee434d32babd27c167142e2b94ddbab4844
F test/fts3opt.test be9546b530003059adee419b68c433ddd0f5751b
F test/fts3prefix.test b36d4f00b128a51e7b386cc013a874246d9d7dc1
F test/fts3prefix2.test 477ca96e67f60745b7ac931cfa6e9b080c562da5
F test/fts3query.test ef79d31fdb355d094baec1c1b24b60439a1fb8a2
@@ -699,6 +700,7 @@ F test/shared4.test 72d90821e8d2fc918a08f16d32880868d8ee8e9d
F test/shared6.test 866bb4982c45ce216c61ded5e8fde4e7e2f3ffa9
F test/shared7.test 960760bc8d03e1419e70dea69cf41db62853616e
F test/shared8.test b27befbefbe7f4517f1d6b7ff8f64a41ec74165d
F test/shared9.test 3a5b09583e3ba3139a4bd66958061306b4331c7e
F test/shared_err.test 91e26ec4f3fbe07951967955585137e2f18993de
F test/sharedlock.test ffa0a3c4ac192145b310f1254f8afca4d553eabf
F test/shell1.test 9895ee3013742a02e5afd8d77793729967ffd195
@@ -734,7 +736,7 @@ F test/syscall.test bea9bf329bff733c791310244617c2a76974e64a
F test/sysfault.test c79441d88d23696fbec7b147dba98d42a04f523f
F test/table.test a59d985ca366e39b17b175f387f9d5db5a18d4e2
F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
F test/tclsqlite.test 1597d353308531527583481d14d9da52ea8ed0af
F test/tclsqlite.test 952b772830bd380c9b5f58c03fb374189be53828
F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c
F test/temptable.test 51edd31c65ed1560dd600b1796e8325df96318e2
F test/temptrigger.test 26670ed7a39cf2296a7f0a9e0a1d7bdb7abe936d
@@ -881,7 +883,7 @@ F test/trace2.test c1dc104a8d11a347c870cfea6235e3fc6f6cb06d
F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6
F test/trans2.test d5337e61de45e66b1fcbf9db833fa8c82e624b22
F test/trans3.test 373ac5183cc56be69f48ae44090e7f672939f732
F test/trigger1.test de42feb7cd442787d38185ae74f5a1d7afa400cb
F test/trigger1.test 70acedb76532117bbcc873f8601cdc6905f1f455
F test/trigger2.test 834187beafd1db383af0c659cfa49b0576832816
F test/trigger3.test d2c60d8be271c355d61727411e753181e877230a
F test/trigger4.test 74700b76ebf3947b2f7a92405141eb2cf2a5d359
@@ -966,12 +968,12 @@ F test/where9.test ae98dc22ef9b6f2bc81e9f164e41b38faa9bda06
F test/whereA.test 24c234263c8fe358f079d5e57d884fb569d2da0a
F test/whereB.test 0def95db3bdec220a731c7e4bec5930327c1d8c5
F test/whereC.test 13ff5ec0dba407c0e0c075980c75b3275a6774e5
F test/whereD.test 304ccbe3c77e0d0764f37c91d43b8c4792a5e02f
F test/whereD.test 11945e79899a97958d87d1e5ac6ae5abd827356b
F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31
F test/win32lock.test b2a539e85ae6b2d78475e016a9636b4451dc7fb9
F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
F test/zerodamage.test 0de750389990b1078bab203c712dc3fefd1d8b82
F tool/build-all-msvc.bat 1a18aa39983ae7354d834bc55a850a54fc007576 x
F tool/build-all-msvc.bat 74fb6e5cca66ebdb6c9bbafb2f8b802f08146d38 x
F tool/build-shell.sh b64a481901fc9ffe5ca8812a2a9255b6cfb77381
F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
@@ -989,7 +991,7 @@ F tool/mksqlite3c-noext.tcl 8bce31074e4cbe631bb7676526a048335f4c9f02
F tool/mksqlite3c.tcl 589c7f44e990be1b8443cfe4808dce392b0327fa
F tool/mksqlite3h.tcl 78013ad79a5e492e5f764f3c7a8ef834255061f8
F tool/mksqlite3internalh.tcl 3dca7bb5374cee003379b8cbac73714f610ef795
F tool/mkvsix.tcl 19b2ab9ea16445953a76568a5bbe4cb864f92dfe
F tool/mkvsix.tcl 0be7f7a591f1e83f9199cb82911b66668ca484c9
F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091
F tool/omittest.tcl 4665982e95a6e5c1bd806cf7bc3dea95be422d77
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
@@ -1013,11 +1015,8 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
P ebb08d0b4d1ed674e4a23c3754206ca2df9063ff
R 8bdf9ef517616ac5a5043f12bec4acdb
T +bgcolor * #d0c0ff
T +sym-release *
T +sym-version-3.7.14 *
U drh
Z 126ab1aaea0f3a8cb5c4792cf0a82989
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 760072ceea294fd7d168de28de9e775e545ef30e
R 56ecebebea5e1827d4efe39f36959536
U dan
Z bc2abfad5ad37726c5ea48368e0e72a2
+1 -1
View File
@@ -1 +1 @@
c0d89d4a9752922f9e367362366efde4f1b06f2a
b21746ac11ecbe1baab6dd715460cc14a2b89eaa
+2 -2
View File
@@ -414,7 +414,7 @@ void sqlite3AlterRenameTable(
assert( pSrc->nSrc==1 );
assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );
pTab = sqlite3LocateTable(pParse, 0, pSrc->a[0].zName, pSrc->a[0].zDatabase);
pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
if( !pTab ) goto exit_rename_table;
iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
zDb = db->aDb[iDb].zName;
@@ -757,7 +757,7 @@ void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){
assert( pParse->pNewTable==0 );
assert( sqlite3BtreeHoldsAllMutexes(db) );
if( db->mallocFailed ) goto exit_begin_add_column;
pTab = sqlite3LocateTable(pParse, 0, pSrc->a[0].zName, pSrc->a[0].zDatabase);
pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]);
if( !pTab ) goto exit_begin_add_column;
#ifndef SQLITE_OMIT_VIRTUALTABLE
+5 -3
View File
@@ -434,6 +434,7 @@ int sqlite3FixInit(
assert( db->nDb>iDb );
pFix->pParse = pParse;
pFix->zDb = db->aDb[iDb].zName;
pFix->pSchema = db->aDb[iDb].pSchema;
pFix->zType = zType;
pFix->pName = pName;
return 1;
@@ -464,14 +465,15 @@ int sqlite3FixSrcList(
if( NEVER(pList==0) ) return 0;
zDb = pFix->zDb;
for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){
if( pItem->zDatabase==0 ){
pItem->zDatabase = sqlite3DbStrDup(pFix->pParse->db, zDb);
}else if( sqlite3StrICmp(pItem->zDatabase,zDb)!=0 ){
if( pItem->zDatabase && sqlite3StrICmp(pItem->zDatabase, zDb) ){
sqlite3ErrorMsg(pFix->pParse,
"%s %T cannot reference objects in database %s",
pFix->zType, pFix->pName, pItem->zDatabase);
return 1;
}
sqlite3_free(pItem->zDatabase);
pItem->zDatabase = 0;
pItem->pSchema = pFix->pSchema;
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1;
if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1;
+6
View File
@@ -5922,6 +5922,9 @@ static void copyNodeContent(MemPage *pFrom, MemPage *pTo, int *pRC){
** If aOvflSpace is set to a null pointer, this function returns
** SQLITE_NOMEM.
*/
#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM)
#pragma optimize("", off)
#endif
static int balance_nonroot(
MemPage *pParent, /* Parent page of siblings being balanced */
int iParentIdx, /* Index of "the page" in pParent */
@@ -6552,6 +6555,9 @@ balance_cleanup:
return rc;
}
#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM)
#pragma optimize("", on)
#endif
/*
+27 -4
View File
@@ -319,6 +319,31 @@ Table *sqlite3LocateTable(
return p;
}
/*
** Locate the table identified by *p.
**
** This is a wrapper around sqlite3LocateTable(). The difference between
** sqlite3LocateTable() and this function is that this function restricts
** the search to schema (p->pSchema) if it is not NULL. p->pSchema may be
** non-NULL if it is part of a view or trigger program definition. See
** sqlite3FixSrcList() for details.
*/
Table *sqlite3LocateTableItem(
Parse *pParse,
int isView,
struct SrcList_item *p
){
const char *zDb;
assert( p->pSchema==0 || p->zDatabase==0 );
if( p->pSchema ){
int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema);
zDb = pParse->db->aDb[iDb].zName;
}else{
zDb = p->zDatabase;
}
return sqlite3LocateTable(pParse, isView, p->zName, zDb);
}
/*
** Locate the in-memory structure that describes
** a particular index given the name of that index
@@ -2114,8 +2139,7 @@ void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){
assert( pParse->nErr==0 );
assert( pName->nSrc==1 );
if( noErr ) db->suppressErr++;
pTab = sqlite3LocateTable(pParse, isView,
pName->a[0].zName, pName->a[0].zDatabase);
pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]);
if( noErr ) db->suppressErr--;
if( pTab==0 ){
@@ -2555,8 +2579,7 @@ Index *sqlite3CreateIndex(
** sqlite3FixSrcList can never fail. */
assert(0);
}
pTab = sqlite3LocateTable(pParse, 0, pTblName->a[0].zName,
pTblName->a[0].zDatabase);
pTab = sqlite3LocateTableItem(pParse, 0, &pTblName->a[0]);
if( !pTab || db->mallocFailed ) goto exit_create_index;
assert( db->aDb[iDb].pSchema==pTab->pSchema );
}else{
+1 -1
View File
@@ -32,7 +32,7 @@ Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
struct SrcList_item *pItem = pSrc->a;
Table *pTab;
assert( pItem && pSrc->nSrc==1 );
pTab = sqlite3LocateTable(pParse, 0, pItem->zName, pItem->zDatabase);
pTab = sqlite3LocateTableItem(pParse, 0, pItem);
sqlite3DeleteTable(pParse->db, pItem->pTab);
pItem->pTab = pTab;
if( pTab ){
+1
View File
@@ -930,6 +930,7 @@ SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){
struct SrcList_item *pNewItem = &pNew->a[i];
struct SrcList_item *pOldItem = &p->a[i];
Table *pTab;
pNewItem->pSchema = pOldItem->pSchema;
pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase);
pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
pNewItem->zAlias = sqlite3DbStrDup(db, pOldItem->zAlias);
+5 -2
View File
@@ -1222,7 +1222,9 @@ void sqlite3GenerateConstraintChecks(
onError = overrideError!=OE_Default ? overrideError : OE_Abort;
for(i=0; i<pCheck->nExpr; i++){
int allOk = sqlite3VdbeMakeLabel(v);
sqlite3ExprIfTrue(pParse, pCheck->a[i].pExpr, allOk, SQLITE_JUMPIFNULL);
Expr *pDup = sqlite3ExprDup(db, pCheck->a[i].pExpr, 0);
if( pDup==0 ) break;
sqlite3ExprIfTrue(pParse, pDup, allOk, SQLITE_JUMPIFNULL);
if( onError==OE_Ignore ){
sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
}else{
@@ -1236,6 +1238,7 @@ void sqlite3GenerateConstraintChecks(
sqlite3HaltConstraint(pParse, onError, zConsName, P4_DYNAMIC);
}
sqlite3VdbeResolveLabel(v, allOk);
sqlite3ExprDelete(db, pDup);
}
}
#endif /* !defined(SQLITE_OMIT_CHECK) */
@@ -1691,7 +1694,7 @@ static int xferOptimization(
** we have to check the semantics.
*/
pItem = pSelect->pSrc->a;
pSrc = sqlite3LocateTable(pParse, 0, pItem->zName, pItem->zDatabase);
pSrc = sqlite3LocateTableItem(pParse, 0, pItem);
if( pSrc==0 ){
return 0; /* FROM clause does not contain a real table */
}
+95 -5
View File
@@ -218,6 +218,10 @@ struct unixFile {
const char *zPath; /* Name of the file */
unixShm *pShm; /* Shared memory segment information */
int szChunk; /* Configured by FCNTL_CHUNK_SIZE */
#ifdef __QNXNTO__
int sectorSize; /* Device sector size */
int deviceCharacteristics; /* Precomputed device characteristics */
#endif
#if SQLITE_ENABLE_LOCKING_STYLE
int openFlags; /* The flags specified at open() */
#endif
@@ -3632,10 +3636,92 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
** a database and its journal file) that the sector size will be the
** same for both.
*/
static int unixSectorSize(sqlite3_file *pFile){
(void)pFile;
#ifndef __QNXNTO__
static int unixSectorSize(sqlite3_file *NotUsed){
UNUSED_PARAMETER(NotUsed);
return SQLITE_DEFAULT_SECTOR_SIZE;
}
#endif
/*
** The following version of unixSectorSize() is optimized for QNX.
*/
#ifdef __QNXNTO__
#include <sys/dcmd_blk.h>
#include <sys/statvfs.h>
static int unixSectorSize(sqlite3_file *id){
unixFile *pFile = (unixFile*)id;
if( pFile->sectorSize == 0 ){
struct statvfs fsInfo;
/* Set defaults for non-supported filesystems */
pFile->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE;
pFile->deviceCharacteristics = 0;
if( fstatvfs(pFile->h, &fsInfo) == -1 ) {
return pFile->sectorSize;
}
if( !strcmp(fsInfo.f_basetype, "tmp") ) {
pFile->sectorSize = fsInfo.f_bsize;
pFile->deviceCharacteristics =
SQLITE_IOCAP_ATOMIC4K | /* All ram filesystem writes are atomic */
SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until
** the write succeeds */
SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
** so it is ordered */
0;
}else if( strstr(fsInfo.f_basetype, "etfs") ){
pFile->sectorSize = fsInfo.f_bsize;
pFile->deviceCharacteristics =
/* etfs cluster size writes are atomic */
(pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) |
SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until
** the write succeeds */
SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
** so it is ordered */
0;
}else if( !strcmp(fsInfo.f_basetype, "qnx6") ){
pFile->sectorSize = fsInfo.f_bsize;
pFile->deviceCharacteristics =
SQLITE_IOCAP_ATOMIC | /* All filesystem writes are atomic */
SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until
** the write succeeds */
SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
** so it is ordered */
0;
}else if( !strcmp(fsInfo.f_basetype, "qnx4") ){
pFile->sectorSize = fsInfo.f_bsize;
pFile->deviceCharacteristics =
/* full bitset of atomics from max sector size and smaller */
((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2 |
SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
** so it is ordered */
0;
}else if( strstr(fsInfo.f_basetype, "dos") ){
pFile->sectorSize = fsInfo.f_bsize;
pFile->deviceCharacteristics =
/* full bitset of atomics from max sector size and smaller */
((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2 |
SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind
** so it is ordered */
0;
}else{
pFile->deviceCharacteristics =
SQLITE_IOCAP_ATOMIC512 | /* blocks are atomic */
SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until
** the write succeeds */
0;
}
}
/* Last chance verification. If the sector size isn't a multiple of 512
** then it isn't valid.*/
if( pFile->sectorSize % 512 != 0 ){
pFile->deviceCharacteristics = 0;
pFile->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE;
}
return pFile->sectorSize;
}
#endif /* __QNXNTO__ */
/*
** Return the device characteristics for the file.
@@ -3652,11 +3738,15 @@ static int unixSectorSize(sqlite3_file *pFile){
*/
static int unixDeviceCharacteristics(sqlite3_file *id){
unixFile *p = (unixFile*)id;
int rc = 0;
#ifdef __QNXNTO__
if( p->sectorSize==0 ) unixSectorSize(id);
rc = p->deviceCharacteristics;
#endif
if( p->ctrlFlags & UNIXFILE_PSOW ){
return SQLITE_IOCAP_POWERSAFE_OVERWRITE;
}else{
return 0;
rc |= SQLITE_IOCAP_POWERSAFE_OVERWRITE;
}
return rc;
}
#ifndef SQLITE_OMIT_WAL
+1 -2
View File
@@ -3268,8 +3268,7 @@ static int selectExpander(Walker *pWalker, Select *p){
}else{
/* An ordinary table or view name in the FROM clause */
assert( pFrom->pTab==0 );
pFrom->pTab = pTab =
sqlite3LocateTable(pParse,0,pFrom->zName,pFrom->zDatabase);
pFrom->pTab = pTab = sqlite3LocateTableItem(pParse, 0, pFrom);
if( pTab==0 ) return WRC_Abort;
pTab->nRef++;
#if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE)
+3
View File
@@ -1855,6 +1855,7 @@ struct SrcList {
i16 nSrc; /* Number of tables or subqueries in the FROM clause */
i16 nAlloc; /* Number of entries allocated in a[] below */
struct SrcList_item {
Schema *pSchema; /* Schema to which this item is fixed */
char *zDatabase; /* Name of database holding this table */
char *zName; /* Name of the table */
char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */
@@ -2420,6 +2421,7 @@ struct TriggerStep {
typedef struct DbFixer DbFixer;
struct DbFixer {
Parse *pParse; /* The parsing context. Error messages written here */
Schema *pSchema; /* Fix items to this schema */
const char *zDb; /* Make sure all objects are contained in this database */
const char *zType; /* Type of the container - used for error messages */
const Token *pName; /* Name of the container - used for error messages */
@@ -2830,6 +2832,7 @@ void sqlite3ExprIfTrue(Parse*, Expr*, int, int);
void sqlite3ExprIfFalse(Parse*, Expr*, int, int);
Table *sqlite3FindTable(sqlite3*,const char*, const char*);
Table *sqlite3LocateTable(Parse*,int isView,const char*, const char*);
Table *sqlite3LocateTableItem(Parse*,int isView,struct SrcList_item *);
Index *sqlite3FindIndex(sqlite3*,const char*, const char*);
void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);
void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
+14 -38
View File
@@ -53,15 +53,8 @@
#define NUM_PREPARED_STMTS 10
#define MAX_PREPARED_STMTS 100
/*
** If TCL uses UTF-8 and SQLite is configured to use iso8859, then we
** have to do a translation when going between the two. Set the
** UTF_TRANSLATION_NEEDED macro to indicate that we need to do
** this translation.
*/
#if defined(TCL_UTF_MAX) && !defined(SQLITE_UTF8)
# define UTF_TRANSLATION_NEEDED 1
#endif
/* Forward declaration */
typedef struct SqliteDb SqliteDb;
/*
** New SQL functions can be created as TCL scripts. Each such function
@@ -71,6 +64,7 @@ typedef struct SqlFunc SqlFunc;
struct SqlFunc {
Tcl_Interp *interp; /* The TCL interpret to execute the function */
Tcl_Obj *pScript; /* The Tcl_Obj representation of the script */
SqliteDb *pDb; /* Database connection that owns this function */
int useEvalObjv; /* True if it is safe to use Tcl_EvalObjv */
char *zName; /* Name of this function */
SqlFunc *pNext; /* Next function on the list of them all */
@@ -113,7 +107,6 @@ typedef struct IncrblobChannel IncrblobChannel;
** sqlite3_prepare_v2() or sqlite3_prepare() to prepare SQL statements.
** If SqliteDb.bLegacyPrepare is true, sqlite3_prepare() is used.
*/
typedef struct SqliteDb SqliteDb;
struct SqliteDb {
sqlite3 *db; /* The "real" database structure. MUST BE FIRST */
Tcl_Interp *interp; /* The interpreter used for this database */
@@ -431,6 +424,7 @@ static SqlFunc *findSqlFunc(SqliteDb *pDb, const char *zName){
}
}
pNew->interp = pDb->interp;
pNew->pDb = pDb;
pNew->pScript = 0;
pNew->pNext = pDb->pFunc;
pDb->pFunc = pNew;
@@ -478,6 +472,7 @@ static void DbDeleteCmd(void *db){
while( pDb->pFunc ){
SqlFunc *pFunc = pDb->pFunc;
pDb->pFunc = pFunc->pNext;
assert( pFunc->pDb==pDb );
Tcl_DecrRefCount(pFunc->pScript);
Tcl_Free((char*)pFunc);
}
@@ -794,7 +789,7 @@ static void tclSqlFunc(sqlite3_context *context, int argc, sqlite3_value**argv){
break;
}
case SQLITE_NULL: {
pVal = Tcl_NewStringObj("", 0);
pVal = Tcl_NewStringObj(p->pDb->zNull, -1);
break;
}
default: {
@@ -933,26 +928,6 @@ static int auth_callback(
}
#endif /* SQLITE_OMIT_AUTHORIZATION */
/*
** zText is a pointer to text obtained via an sqlite3_result_text()
** or similar interface. This routine returns a Tcl string object,
** reference count set to 0, containing the text. If a translation
** between iso8859 and UTF-8 is required, it is preformed.
*/
static Tcl_Obj *dbTextToObj(char const *zText){
Tcl_Obj *pVal;
#ifdef UTF_TRANSLATION_NEEDED
Tcl_DString dCol;
Tcl_DStringInit(&dCol);
Tcl_ExternalToUtfDString(NULL, zText, -1, &dCol);
pVal = Tcl_NewStringObj(Tcl_DStringValue(&dCol), -1);
Tcl_DStringFree(&dCol);
#else
pVal = Tcl_NewStringObj(zText, -1);
#endif
return pVal;
}
/*
** This routine reads a line of text from FILE in, stores
** the text in memory obtained from malloc() and returns a pointer
@@ -1140,13 +1115,13 @@ static int dbPrepareAndBind(
int nByte;
if( SQLITE_OK!=dbPrepare(pDb, zSql, &pStmt, pzOut) ){
Tcl_SetObjResult(interp, dbTextToObj(sqlite3_errmsg(pDb->db)));
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3_errmsg(pDb->db), -1));
return TCL_ERROR;
}
if( pStmt==0 ){
if( SQLITE_OK!=sqlite3_errcode(pDb->db) ){
/* A compile-time error in the statement. */
Tcl_SetObjResult(interp, dbTextToObj(sqlite3_errmsg(pDb->db)));
Tcl_SetObjResult(interp, Tcl_NewStringObj(sqlite3_errmsg(pDb->db), -1));
return TCL_ERROR;
}else{
/* The statement was a no-op. Continue to the next statement
@@ -1365,7 +1340,7 @@ static void dbEvalRowInfo(
if( nCol>0 && (papColName || p->pArray) ){
apColName = (Tcl_Obj**)Tcl_Alloc( sizeof(Tcl_Obj*)*nCol );
for(i=0; i<nCol; i++){
apColName[i] = dbTextToObj(sqlite3_column_name(pStmt,i));
apColName[i] = Tcl_NewStringObj(sqlite3_column_name(pStmt,i), -1);
Tcl_IncrRefCount(apColName[i]);
}
p->apColName = apColName;
@@ -1452,7 +1427,8 @@ static int dbEvalStep(DbEvalContext *p){
continue;
}
#endif
Tcl_SetObjResult(pDb->interp, dbTextToObj(sqlite3_errmsg(pDb->db)));
Tcl_SetObjResult(pDb->interp,
Tcl_NewStringObj(sqlite3_errmsg(pDb->db), -1));
return TCL_ERROR;
}else{
dbReleaseStmt(pDb, pPreStmt, 0);
@@ -1509,11 +1485,11 @@ static Tcl_Obj *dbEvalColumnValue(DbEvalContext *p, int iCol){
return Tcl_NewDoubleObj(sqlite3_column_double(pStmt, iCol));
}
case SQLITE_NULL: {
return dbTextToObj(p->pDb->zNull);
return Tcl_NewStringObj(p->pDb->zNull, -1);
}
}
return dbTextToObj((char *)sqlite3_column_text(pStmt, iCol));
return Tcl_NewStringObj(sqlite3_column_text(pStmt, iCol), -1);
}
/*
@@ -2433,7 +2409,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
pDb->zNull = 0;
}
}
Tcl_SetObjResult(interp, dbTextToObj(pDb->zNull));
Tcl_SetObjResult(interp, Tcl_NewStringObj(pDb->zNull, -1));
break;
}
+8 -2
View File
@@ -264,7 +264,7 @@ void sqlite3VtabClear(sqlite3 *db, Table *p){
if( p->azModuleArg ){
int i;
for(i=0; i<p->nModuleArg; i++){
sqlite3DbFree(db, p->azModuleArg[i]);
if( i!=1 ) sqlite3DbFree(db, p->azModuleArg[i]);
}
sqlite3DbFree(db, p->azModuleArg);
}
@@ -324,7 +324,7 @@ void sqlite3VtabBeginParse(
pTable->tabFlags |= TF_Virtual;
pTable->nModuleArg = 0;
addModuleArgument(db, pTable, sqlite3NameFromToken(db, pModuleName));
addModuleArgument(db, pTable, sqlite3DbStrDup(db, db->aDb[iDb].zName));
addModuleArgument(db, pTable, 0);
addModuleArgument(db, pTable, sqlite3DbStrDup(db, pTable->zName));
pParse->sNameToken.n = (int)(&pModuleName->z[pModuleName->n] - pName1->z);
@@ -481,6 +481,7 @@ static int vtabCallConstructor(
int nArg = pTab->nModuleArg;
char *zErr = 0;
char *zModuleName = sqlite3MPrintf(db, "%s", pTab->zName);
int iDb;
if( !zModuleName ){
return SQLITE_NOMEM;
@@ -494,6 +495,10 @@ static int vtabCallConstructor(
pVTable->db = db;
pVTable->pMod = pMod;
assert( pTab->azModuleArg[1]==0 );
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
pTab->azModuleArg[1] = db->aDb[iDb].zName;
/* Invoke the virtual table constructor */
assert( &db->pVtabCtx );
assert( xConstruct );
@@ -504,6 +509,7 @@ static int vtabCallConstructor(
rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr);
db->pVtabCtx = pPriorCtx;
if( rc==SQLITE_NOMEM ) db->mallocFailed = 1;
pTab->azModuleArg[1] = 0;
if( SQLITE_OK!=rc ){
if( zErr==0 ){
+1 -1
View File
@@ -4447,7 +4447,7 @@ static Bitmask codeOneLoopStart(
}
}
pLevel->u.pCovidx = pCov;
pLevel->iIdxCur = iCovCur;
if( pCov ) pLevel->iIdxCur = iCovCur;
if( pAndExpr ){
pAndExpr->pLeft = 0;
sqlite3ExprDelete(pParse->db, pAndExpr);
+48
View File
@@ -0,0 +1,48 @@
# 2014 October 2
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The
# focus of this script is testing the FTS3 module.
#
# $Id: fts3aa.test,v 1.1 2007/08/20 17:38:42 shess Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set ::testprefix fts3opt
# If SQLITE_ENABLE_FTS3 is defined, omit this file.
ifcapable !fts3 {
finish_test
return
}
# Test running an 'optimize' in the case where the index contains zero
# terms (so the result is an empty %_segdir table) but there exists at
# least one row in the FTS table (i.e. one with no tokens).
#
do_execsql_test 1.0 {
CREATE VIRTUAL TABLE ft USING fts3;
INSERT INTO ft(rowid, content) VALUES(1, 'a b c');
INSERT INTO ft(rowid, content) VALUES(2, 'd e f');
INSERT INTO ft(rowid, content) VALUES(3, 'g h i');
INSERT INTO ft(rowid, content) VALUES(4, '');
DELETE FROM ft WHERE rowid=2;
DELETE FROM ft WHERE rowid=1;
DELETE FROM ft WHERE rowid=3;
} {}
do_execsql_test 1.1 {
INSERT INTO ft(ft) VALUES('optimize');
SELECT * FROM ft_segdir;
} {}
finish_test
+140
View File
@@ -0,0 +1,140 @@
# 2012 October 5
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# The tests in this file are intended to show if two connections attach
# to the same shared cache using different database names, views and
# virtual tables may still be accessed.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix shared9
ifcapable !view||!trigger {
finish_test
return
}
db close
set enable_shared_cache [sqlite3_enable_shared_cache 1]
sqlite3 db1 test.db
sqlite3 db2 test.db
forcedelete test.db2
do_test 1.1 {
db1 eval {
ATTACH 'test.db2' AS 'fred';
CREATE TABLE fred.t1(a, b, c);
CREATE VIEW fred.v1 AS SELECT * FROM t1;
CREATE TABLE fred.t2(a, b);
CREATE TABLE fred.t3(a, b);
CREATE TRIGGER fred.trig AFTER INSERT ON t2 BEGIN
DELETE FROM t3;
INSERT INTO t3 SELECT * FROM t2;
END;
INSERT INTO t2 VALUES(1, 2);
SELECT * FROM t3;
}
} {1 2}
do_test 1.2 { db2 eval "ATTACH 'test.db2' AS 'jones'" } {}
do_test 1.3 { db2 eval "SELECT * FROM v1" } {}
do_test 1.4 { db2 eval "INSERT INTO t2 VALUES(3, 4)" } {}
ifcapable fts3 {
do_test 1.5 {
db1 eval {
CREATE VIRTUAL TABLE fred.t4 USING fts4;
INSERT INTO t4 VALUES('hello world');
}
} {}
do_test 1.6 {
db2 eval {
INSERT INTO t4 VALUES('shared cache');
SELECT * FROM t4 WHERE t4 MATCH 'hello';
}
} {{hello world}}
do_test 1.7 {
db1 eval {
SELECT * FROM t4 WHERE t4 MATCH 'c*';
}
} {{shared cache}}
}
db1 close
db2 close
#-------------------------------------------------------------------------
# The following tests attempt to find a similar problem with collation
# sequence names - pointers to database handle specific allocations leaking
# into schema objects and being used after the original handle has been
# closed.
#
forcedelete test.db test.db2
sqlite3 db1 test.db
sqlite3 db2 test.db
foreach x {collate1 collate2 collate3} {
proc $x {a b} { string compare $a $b }
db1 collate $x $x
db2 collate $x $x
}
do_test 2.1 {
db1 eval {
CREATE TABLE t1(a, b, c COLLATE collate1);
CREATE INDEX i1 ON t1(a COLLATE collate2, c, b);
}
} {}
do_test 2.2 {
db1 close
db2 eval "INSERT INTO t1 VALUES('abc', 'def', 'ghi')"
} {}
db2 close
#-------------------------------------------------------------------------
# At one point, the following would cause a collation sequence belonging
# to connection [db1] to be invoked by a call to [db2 eval]. Which is a
# problem if [db1] has already been closed.
#
forcedelete test.db test.db2
sqlite3 db1 test.db
sqlite3 db2 test.db
proc mycollate_db1 {a b} {set ::invoked_mycollate_db1 1 ; string compare $a $b}
proc mycollate_db2 {a b} {string compare $a $b}
db1 collate mycollate mycollate_db1
db2 collate mycollate mycollate_db2
do_test 2.3 {
set ::invoked_mycollate_db1 0
db1 eval {
CREATE TABLE t1(a COLLATE mycollate, CHECK (a IN ('one', 'two', 'three')));
INSERT INTO t1 VALUES('one');
}
db1 close
set ::invoked_mycollate_db1
} {1}
do_test 2.4 {
set ::invoked_mycollate_db1 0
db2 eval {
INSERT INTO t1 VALUES('two');
}
db2 close
set ::invoked_mycollate_db1
} {0}
sqlite3_enable_shared_cache $::enable_shared_cache
finish_test
+10 -1
View File
@@ -319,14 +319,23 @@ do_test tcl-8.1 {
execsql {INSERT INTO t1 VALUES(30,NULL)}
db eval {SELECT * FROM t1 WHERE b IS NULL}
} {30 NaN}
proc concatFunc args {return [join $args {}]}
do_test tcl-8.2 {
db function concat concatFunc
db eval {SELECT concat('a', b, 'z') FROM t1 WHERE b is NULL}
} {aNaNz}
do_test tcl-8.3 {
db nullvalue NULL
db nullvalue
} {NULL}
do_test tcl-8.3 {
do_test tcl-8.4 {
db nullvalue {}
db eval {SELECT * FROM t1 WHERE b IS NULL}
} {30 {}}
do_test tcl-8.5 {
db function concat concatFunc
db eval {SELECT concat('a', b, 'z') FROM t1 WHERE b is NULL}
} {az}
# Test the return type of user-defined functions
#
+3 -3
View File
@@ -210,7 +210,7 @@ do_test trigger1-1.12 {
delete from t1 WHERE a=old.a+2;
end;
}
} {1 {cannot create INSTEAD OF trigger on table: main.t1}}
} {1 {cannot create INSTEAD OF trigger on table: t1}}
ifcapable view {
# Ensure that we cannot create BEFORE triggers on views
@@ -221,7 +221,7 @@ do_test trigger1-1.13 {
delete from t1 WHERE a=old.a+2;
end;
}
} {1 {cannot create BEFORE trigger on view: main.v1}}
} {1 {cannot create BEFORE trigger on view: v1}}
# Ensure that we cannot create AFTER triggers on views
do_test trigger1-1.14 {
catchsql {
@@ -231,7 +231,7 @@ do_test trigger1-1.14 {
delete from t1 WHERE a=old.a+2;
end;
}
} {1 {cannot create AFTER trigger on view: main.v1}}
} {1 {cannot create AFTER trigger on view: v1}}
} ;# ifcapable view
# Check for memory leaks in the trigger parser
+25
View File
@@ -161,4 +161,29 @@ do_searchcount_test 3.5.2 {
SELECT a, c FROM t3 WHERE (a=1 AND b='one') OR rowid=4
} {1 i 2 ii search 2}
# Ticket [d02e1406a58ea02d] (2012-10-04)
# LEFT JOIN with an OR in the ON clause causes segfault
#
do_test 4.1 {
db eval {
CREATE TABLE t41(a,b,c);
INSERT INTO t41 VALUES(1,2,3), (4,5,6);
CREATE TABLE t42(d,e,f);
INSERT INTO t42 VALUES(3,6,9), (4,8,12);
SELECT * FROM t41 AS x LEFT JOIN t42 AS y ON (y.d=x.c) OR (y.e=x.b);
}
} {1 2 3 3 6 9 4 5 6 {} {} {}}
do_test 4.2 {
db eval {
CREATE INDEX t42d ON t42(d);
CREATE INDEX t42e ON t42(e);
SELECT * FROM t41 AS x LEFT JOIN t42 AS y ON (y.d=x.c) OR (y.e=x.b);
}
} {1 2 3 3 6 9 4 5 6 {} {} {}}
do_test 4.2 {
db eval {
SELECT * FROM t41 AS x LEFT JOIN t42 AS y ON (y.d=x.c) OR (y.d=x.b);
}
} {1 2 3 3 6 9 4 5 6 {} {} {}}
finish_test
+239 -117
View File
@@ -6,10 +6,54 @@
:: Multi-Platform Build Tool for MSVC
::
REM
REM This batch script is used to build the SQLite DLL for multiple platforms
REM and configurations using MSVC. The built SQLite DLLs, their associated
REM import libraries, and optionally their symbols files, are placed within
REM the directory specified on the command line, in sub-directories named for
REM their respective platforms and configurations. This batch script must be
REM run from inside a Visual Studio Command Prompt for the desired version of
REM Visual Studio ^(the initial platform configured for the command prompt does
REM not really matter^). Exactly one command line argument is required, the
REM name of an existing directory to be used as the final destination directory
REM for the generated output files, which will be placed in sub-directories
REM created therein. Ideally, the directory specified should be empty.
REM
REM Example:
REM
REM CD /D C:\dev\sqlite\core
REM tool\build-all-msvc.bat C:\Temp
REM
REM In the example above, "C:\dev\sqlite\core" represents the root of the
REM source tree for SQLite and "C:\Temp" represents the final destination
REM directory for the generated output files.
REM
REM There are several environment variables that may be set to modify the
REM behavior of this batch script and its associated Makefile. The list of
REM platforms to build may be overriden by using the PLATFORMS environment
REM variable, which should contain a list of platforms ^(e.g. x86 x86_amd64
REM x86_arm^). All platforms must be supported by the version of Visual Studio
REM being used. The list of configurations to build may be overridden by
REM setting the CONFIGURATIONS environment variable, which should contain a
REM list of configurations to build ^(e.g. Debug Retail^). Neither of these
REM variable values may contain any double quotes, surrounding or embedded.
REM Finally, the NCRTLIBPATH and NSDKLIBPATH environment variables may be set
REM to specify the location of the CRT and SDK, respectively, needed to compile
REM executables native to the architecture of the build machine during any
REM cross-compilation that may be necessary, depending on the platforms to be
REM built. These values in these two variables should be surrounded by double
REM quotes if they contain spaces.
REM
REM Please note that the SQLite build process performed by the Makefile
REM associated with this batch script requires both Gawk ^(gawk.exe^) and Tcl
REM 8.5 ^(tclsh85.exe^) to be present in a directory contained in the PATH
REM environment variable unless a pre-existing amalgamation file is used.
REM
SETLOCAL
REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)
@@ -92,18 +136,36 @@ IF NOT DEFINED PLATFORMS (
%_VECHO% Platforms = '%PLATFORMS%'
REM
REM NOTE: If the list of configurations is not already set, use the default
REM list.
REM
IF NOT DEFINED CONFIGURATIONS (
SET CONFIGURATIONS=Debug Retail
)
%_VECHO% Configurations = '%CONFIGURATIONS%'
REM
REM NOTE: Setup environment variables to translate between the MSVC platform
REM names and the names to be used for the platform-specific binary
REM directories.
REM
SET amd64_NAME=x64
SET arm_NAME=ARM
SET x64_NAME=x64
SET x86_NAME=x86
SET x86_amd64_NAME=x64
SET x86_arm_NAME=ARM
SET x86_x64_NAME=x64
%_VECHO% amd64_Name = '%amd64_NAME%'
%_VECHO% arm_Name = '%arm_NAME%'
%_VECHO% x64_Name = '%x64_NAME%'
%_VECHO% x86_Name = '%x86_NAME%'
%_VECHO% x86_amd64_Name = '%x86_amd64_NAME%'
%_VECHO% x86_arm_Name = '%x86_arm_NAME%'
%_VECHO% x86_x64_Name = '%x86_x64_NAME%'
REM
REM NOTE: Check for the external tools needed during the build process ^(i.e.
@@ -114,6 +176,24 @@ FOR %%T IN (gawk.exe tclsh85.exe) DO (
SET %%T_PATH=%%~dp$PATH:T
)
REM
REM NOTE: The Gawk executable "gawk.exe" is required during the SQLite build
REM process unless a pre-existing amalgamation file is used.
REM
IF NOT DEFINED gawk.exe_PATH (
ECHO The Gawk executable "gawk.exe" is required to be in the PATH.
GOTO errors
)
REM
REM NOTE: The Tcl 8.5 executable "tclsh85.exe" is required during the SQLite
REM build process unless a pre-existing amalgamation file is used.
REM
IF NOT DEFINED tclsh85.exe_PATH (
ECHO The Tcl 8.5 executable "tclsh85.exe" is required to be in the PATH.
GOTO errors
)
REM
REM NOTE: Set the TOOLPATH variable to contain all the directories where the
REM external tools were found in the search above.
@@ -127,11 +207,30 @@ REM NOTE: Check for MSVC 2012 because the Windows SDK directory handling is
REM slightly different for that version.
REM
IF "%VisualStudioVersion%" == "11.0" (
SET SET_NSDKLIBPATH=1
REM
REM NOTE: If the Windows SDK library path has already been set, do not set
REM it to something else later on.
REM
IF NOT DEFINED NSDKLIBPATH (
SET SET_NSDKLIBPATH=1
)
) ELSE (
CALL :fn_UnsetVariable SET_NSDKLIBPATH
)
REM
REM NOTE: Check if this is the Windows Phone SDK. If so, a different batch
REM file is necessary to setup the build environment. Since the variable
REM values involved here may contain parenthesis, using GOTO instead of
REM an IF block is required.
REM
IF DEFINED WindowsPhoneKitDir GOTO set_vcvarsall_phone
SET VCVARSALL=%VCINSTALLDIR%\vcvarsall.bat
GOTO set_vcvarsall_done
:set_vcvarsall_phone
SET VCVARSALL=%VCINSTALLDIR%\WPSDK\WP80\vcvarsphoneall.bat
:set_vcvarsall_done
REM
REM NOTE: This is the outer loop. There should be exactly one iteration per
REM platform.
@@ -142,7 +241,7 @@ FOR %%P IN (%PLATFORMS%) DO (
REM be used for the name of the platform-specific binary directory via
REM the environment variables setup earlier.
REM
CALL :fn_SetVariable %%P_NAME PLATFORMNAME
CALL :fn_CopyVariable %%P_NAME PLATFORMNAME
REM
REM NOTE: This is the inner loop. There should be exactly one iteration.
@@ -172,6 +271,7 @@ FOR %%P IN (%PLATFORMS%) DO (
CALL :fn_UnsetVariable Platform
REM CALL :fn_UnsetVariable VCINSTALLDIR
CALL :fn_UnsetVariable VSINSTALLDIR
CALL :fn_UnsetVariable WindowsPhoneKitDir
CALL :fn_UnsetVariable WindowsSdkDir
CALL :fn_UnsetVariable WindowsSdkDir_35
CALL :fn_UnsetVariable WindowsSdkDir_old
@@ -181,129 +281,151 @@ FOR %%P IN (%PLATFORMS%) DO (
REM
SET PATH=%TOOLPATH%;%SystemRoot%\System32;%SystemRoot%
REM
REM NOTE: Launch a nested command shell to perform the following steps:
REM
REM 1. Setup the MSVC environment for this platform using the
REM official batch file.
REM
REM 2. Make sure that no stale build output files are present.
REM
REM 3. Build the "sqlite3.dll" and "sqlite3.lib" binaries for this
REM platform.
REM
REM 4. Copy the "sqlite3.dll" and "sqlite3.lib" binaries for this
REM platform to the platform-specific directory beneath the
REM binary directory.
REM
"%ComSpec%" /C (
FOR %%B IN (%CONFIGURATIONS%) DO (
REM
REM NOTE: Attempt to setup the MSVC environment for this platform.
REM NOTE: When preparing the debug build, set the DEBUG and MEMDEBUG
REM environment variables to be picked up by the MSVC makefile
REM itself.
REM
%__ECHO% CALL "%VCINSTALLDIR%\vcvarsall.bat" %%P
IF ERRORLEVEL 1 (
ECHO Failed to call "%VCINSTALLDIR%\vcvarsall.bat" for platform %%P.
GOTO errors
)
REM
REM NOTE: If this batch file is not running in "what-if" mode, check to
REM be sure we were actually able to setup the MSVC environment as
REM current versions of their official batch file do not set the
REM exit code upon failure.
REM
IF NOT DEFINED __ECHO (
IF NOT DEFINED WindowsSdkDir (
ECHO Cannot build, Windows SDK not found for platform %%P.
GOTO errors
)
)
REM
REM NOTE: When using MSVC 2012, the native SDK path cannot simply use
REM the "lib" sub-directory beneath the location specified in the
REM WindowsSdkDir environment variable because that location does
REM not actually contain the necessary library files for x86.
REM This must be done for each iteration because it relies upon
REM the WindowsSdkDir environment variable being set by the batch
REM file used to setup the MSVC environment.
REM
IF DEFINED SET_NSDKLIBPATH (
CALL :fn_SetVariable WindowsSdkDir NSDKLIBPATH
CALL :fn_AppendVariable NSDKLIBPATH \lib\win8\um\x86
)
REM
REM NOTE: Unless prevented from doing so, invoke NMAKE with the MSVC
REM makefile to clean any stale build output from previous
REM iterations of this loop and/or previous runs of this batch
REM file, etc.
REM
IF NOT DEFINED NOCLEAN (
%__ECHO% nmake -f Makefile.msc clean
IF ERRORLEVEL 1 (
ECHO Failed to clean for platform %%P.
GOTO errors
)
IF /I "%%B" == "Debug" (
SET DEBUG=2
SET MEMDEBUG=1
) ELSE (
CALL :fn_UnsetVariable DEBUG
CALL :fn_UnsetVariable MEMDEBUG
)
REM
REM NOTE: Launch a nested command shell to perform the following steps:
REM
REM 1. Setup the MSVC environment for this platform using the
REM official batch file.
REM
REM 2. Make sure that no stale build output files are present.
REM
REM 3. Build the "sqlite3.dll" and "sqlite3.lib" binaries for this
REM platform.
REM
REM 4. Copy the "sqlite3.dll" and "sqlite3.lib" binaries for this
REM platform to the platform-specific directory beneath the
REM binary directory.
REM
"%ComSpec%" /C (
REM
REM NOTE: Even when the cleaning step has been disabled, we still need
REM to remove the build output for the files we are specifically
REM wanting to build for each platform.
REM NOTE: Attempt to setup the MSVC environment for this platform.
REM
%__ECHO% DEL /Q sqlite3.dll sqlite3.lib sqlite3.pdb
)
REM
REM NOTE: Invoke NMAKE with the MSVC makefile to build the "sqlite3.dll"
REM binary. The x86 compiler will be used to compile the native
REM command line tools needed during the build process itself.
REM Also, disable looking for and/or linking to the native Tcl
REM runtime library.
REM
%__ECHO% nmake -f Makefile.msc sqlite3.dll "NCC=""%VCINSTALLDIR%\bin\cl.exe""" USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS%
IF ERRORLEVEL 1 (
ECHO Failed to build "sqlite3.dll" for platform %%P.
GOTO errors
)
REM
REM NOTE: Copy the "sqlite3.dll" file to the platform-specific directory
REM beneath the binary directory.
REM
%__ECHO% XCOPY sqlite3.dll "%BINARYDIRECTORY%\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3.dll" to "%BINARYDIRECTORY%\%%D\".
GOTO errors
)
REM
REM NOTE: Copy the "sqlite3.lib" file to the platform-specific directory
REM beneath the binary directory.
REM
%__ECHO% XCOPY sqlite3.lib "%BINARYDIRECTORY%\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3.lib" to "%BINARYDIRECTORY%\%%D\".
GOTO errors
)
REM
REM NOTE: Copy the "sqlite3.pdb" file to the platform-specific directory
REM beneath the binary directory unless we are prevented from doing
REM so.
REM
IF NOT DEFINED NOSYMBOLS (
%__ECHO% XCOPY sqlite3.pdb "%BINARYDIRECTORY%\%%D\" %FFLAGS% %DFLAGS%
%__ECHO3% CALL "%VCVARSALL%" %%P
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3.pdb" to "%BINARYDIRECTORY%\%%D\".
ECHO Failed to call "%VCVARSALL%" for platform %%P.
GOTO errors
)
REM
REM NOTE: If this batch file is not running in "what-if" mode, check to
REM be sure we were actually able to setup the MSVC environment
REM as current versions of their official batch file do not set
REM the exit code upon failure.
REM
IF NOT DEFINED __ECHO3 (
IF NOT DEFINED WindowsPhoneKitDir (
IF NOT DEFINED WindowsSdkDir (
ECHO Cannot build, Windows SDK not found for platform %%P.
GOTO errors
)
)
)
REM
REM NOTE: When using MSVC 2012, the native SDK path cannot simply use
REM the "lib" sub-directory beneath the location specified in the
REM WindowsSdkDir environment variable because that location does
REM not actually contain the necessary library files for x86.
REM This must be done for each iteration because it relies upon
REM the WindowsSdkDir environment variable being set by the batch
REM file used to setup the MSVC environment.
REM
IF DEFINED SET_NSDKLIBPATH (
IF DEFINED WindowsPhoneKitDir (
CALL :fn_CopyVariable WindowsPhoneKitDir NSDKLIBPATH
CALL :fn_AppendVariable NSDKLIBPATH \lib\x86
) ELSE IF DEFINED WindowsSdkDir (
CALL :fn_CopyVariable WindowsSdkDir NSDKLIBPATH
CALL :fn_AppendVariable NSDKLIBPATH \lib\win8\um\x86
)
)
REM
REM NOTE: Unless prevented from doing so, invoke NMAKE with the MSVC
REM makefile to clean any stale build output from previous
REM iterations of this loop and/or previous runs of this batch
REM file, etc.
REM
IF NOT DEFINED NOCLEAN (
%__ECHO% nmake -f Makefile.msc clean
IF ERRORLEVEL 1 (
ECHO Failed to clean for platform %%P.
GOTO errors
)
) ELSE (
REM
REM NOTE: Even when the cleaning step has been disabled, we still
REM need to remove the build output for the files we are
REM specifically wanting to build for each platform.
REM
%__ECHO% DEL /Q sqlite3.dll sqlite3.lib sqlite3.pdb
)
REM
REM NOTE: Call NMAKE with the MSVC makefile to build the "sqlite3.dll"
REM binary. The x86 compiler will be used to compile the native
REM command line tools needed during the build process itself.
REM Also, disable looking for and/or linking to the native Tcl
REM runtime library.
REM
%__ECHO% nmake -f Makefile.msc sqlite3.dll XCOMPILE=1 USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS%
IF ERRORLEVEL 1 (
ECHO Failed to build %%B "sqlite3.dll" for platform %%P.
GOTO errors
)
REM
REM NOTE: Copy the "sqlite3.dll" file to the appropriate directory for
REM the build and platform beneath the binary directory.
REM
%__ECHO% XCOPY sqlite3.dll "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3.dll" to "%BINARYDIRECTORY%\%%B\%%D\".
GOTO errors
)
REM
REM NOTE: Copy the "sqlite3.lib" file to the appropriate directory for
REM the build and platform beneath the binary directory.
REM
%__ECHO% XCOPY sqlite3.lib "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3.lib" to "%BINARYDIRECTORY%\%%B\%%D\".
GOTO errors
)
REM
REM NOTE: Copy the "sqlite3.pdb" file to the appropriate directory for
REM the build and platform beneath the binary directory unless we
REM are prevented from doing so.
REM
IF NOT DEFINED NOSYMBOLS (
%__ECHO% XCOPY sqlite3.pdb "%BINARYDIRECTORY%\%%B\%%D\" %FFLAGS% %DFLAGS%
IF ERRORLEVEL 1 (
ECHO Failed to copy "sqlite3.pdb" to "%BINARYDIRECTORY%\%%B\%%D\".
GOTO errors
)
)
)
)
)
@@ -339,7 +461,7 @@ GOTO no_errors
VERIFY MAYBE 2> NUL
GOTO :EOF
:fn_SetVariable
:fn_CopyVariable
SETLOCAL
IF NOT DEFINED %1 GOTO :EOF
IF "%2" == "" GOTO :EOF
+296 -84
View File
@@ -2,7 +2,95 @@
#
# This script is used to generate a VSIX (Visual Studio Extension) file for
# SQLite usable by Visual Studio.
#
# PREREQUISITES
#
# 1. Tcl 8.4 and later are supported, earlier versions have not been tested.
#
# 2. The "sqlite3.h" file is assumed to exist in the parent directory of the
# directory containing this script. The [optional] second command line
# argument to this script may be used to specify an alternate location.
# This script also assumes that the "sqlite3.h" file corresponds with the
# version of the binaries to be packaged. This assumption is not verified
# by this script.
#
# 3. The temporary directory specified in the TEMP or TMP environment variables
# must refer to an existing directory writable by the current user.
#
# 4. The "zip" and "unzip" command line tools must be located either in a
# directory contained in the PATH environment variable or specified as the
# exact file names to execute in the "ZipTool" and "UnZipTool" environment
# variables, respectively.
#
# 5. The template VSIX file (which is basically a zip file) must be located in
# a "win" directory inside the directory containing this script. It should
# not contain any executable binaries. It should only contain dynamic
# textual content files to be processed using [subst] and/or static content
# files to be copied verbatim.
#
# 6. The executable and other compiled binary files to be packaged into the
# final VSIX file (e.g. DLLs, LIBs, and PDBs) must be located in a single
# directory tree. The top-level directory of the tree must be specified as
# the first command line argument to this script. The second level
# sub-directory names must match those of the build configuration (e.g.
# "Debug" or "Retail"). The third level sub-directory names must match
# those of the platform (e.g. "x86", "x64", and "ARM"). For example, the
# binary files to be packaged would need to be organized as follows when
# packaging the "Debug" and "Retail" build configurations for the "x86" and
# "x64" platforms (in this example, "C:\temp" is the top-level directory as
# specified in the first command line argument):
#
# C:\Temp\Debug\x86\sqlite3.lib
# C:\Temp\Debug\x86\sqlite3.dll
# C:\Temp\Debug\x86\sqlite3.pdb
# C:\Temp\Debug\x64\sqlite3.lib
# C:\Temp\Debug\x64\sqlite3.dll
# C:\Temp\Debug\x64\sqlite3.pdb
# C:\Temp\Retail\x86\sqlite3.lib
# C:\Temp\Retail\x86\sqlite3.dll
# C:\Temp\Retail\x86\sqlite3.pdb
# C:\Temp\Retail\x64\sqlite3.lib
# C:\Temp\Retail\x64\sqlite3.dll
# C:\Temp\Retail\x64\sqlite3.pdb
#
# The above directory tree organization is performed automatically if the
# "tool\build-all-msvc.bat" batch script is used to build the binary files
# to be packaged.
#
# USAGE
#
# The first argument to this script is required and must be the name of the
# top-level directory containing the directories and files organized into a
# tree as described in item 6 of the PREREQUISITES section, above. The second
# argument is optional and if present must contain the name of the directory
# containing the root of the source tree for SQLite. The third argument is
# optional and if present must contain the flavor the VSIX package to build.
# Currently, the only supported package flavors are "WinRT" and "WP80". The
# fourth argument is optional and if present must be a string containing a list
# of platforms to include in the VSIX package. The format of the platform list
# string is "platform1,platform2,platform3". Typically, when on Windows, this
# script is executed using commands similar to the following from a normal
# Windows command prompt:
#
# CD /D C:\dev\sqlite\core
# tclsh85 tool\mkvsix.tcl C:\Temp
#
# In the example above, "C:\dev\sqlite\core" represents the root of the source
# tree for SQLite and "C:\Temp" represents the top-level directory containing
# the executable and other compiled binary files, organized into a directory
# tree as described in item 6 of the PREREQUISITES section, above.
#
# This script should work on non-Windows platforms as well, provided that all
# the requirements listed in the PREREQUISITES section are met.
#
# NOTES
#
# The temporary directory is used as a staging area for the final VSIX file.
# The template VSIX file is extracted, its contents processed, and then the
# resulting files are packaged into the final VSIX file.
#
package require Tcl 8.4
proc fail { {error ""} {usage false} } {
if {[string length $error] > 0} then {
puts stdout $error
@@ -11,7 +99,8 @@ proc fail { {error ""} {usage false} } {
puts stdout "usage:\
[file tail [info nameofexecutable]]\
[file tail [info script]] <binaryDirectory> \[sourceDirectory\]"
[file tail [info script]] <binaryDirectory> \[sourceDirectory\]\
\[packageFlavor\] \[platformNames\]"
exit 1
}
@@ -84,20 +173,24 @@ proc writeFile { fileName data } {
proc substFile { fileName } {
#
# NOTE: Performs all Tcl command, variable, and backslash substitutions in
# the specified file and then re-writes the contents of that same file
# the specified file and then rewrites the contents of that same file
# with the substituted data.
#
return [writeFile $fileName [uplevel 1 [list subst [readFile $fileName]]]]
}
proc replacePlatform { fileName platformName } {
proc replaceFileNameTokens { fileName name buildName platformName } {
#
# NOTE: Returns the specified file name containing the platform name instead
# of platform placeholder tokens.
#
return [string map [list <platform> $platformName] $fileName]
return [string map [list <build> $buildName <platform> $platformName \
<name> $name] $fileName]
}
#
# NOTE: This is the entry point for this script.
#
set script [file normalize [info script]]
if {[string length $script] == 0} then {
@@ -113,7 +206,7 @@ set rootName [file rootname [file tail $script]]
# NOTE: Process and verify all the command line arguments.
#
set argc [llength $argv]
if {$argc != 1 && $argc != 2} then {fail}
if {$argc < 1 || $argc > 4} then {fail}
set binaryDirectory [lindex $argv 0]
@@ -126,7 +219,7 @@ if {![file exists $binaryDirectory] || \
fail "binary directory does not exist"
}
if {$argc == 2} then {
if {$argc >= 2} then {
set sourceDirectory [lindex $argv 1]
} else {
#
@@ -145,6 +238,47 @@ if {![file exists $sourceDirectory] || \
fail "source directory does not exist"
}
if {$argc >= 3} then {
set packageFlavor [lindex $argv 2]
} else {
#
# NOTE: Assume the package flavor is WinRT.
#
set packageFlavor WinRT
}
if {[string length $packageFlavor] == 0} then {
fail "invalid package flavor"
}
if {[string equal -nocase $packageFlavor WinRT]} then {
set shortName SQLite.WinRT
set displayName "SQLite for Windows Runtime"
set targetPlatformIdentifier Windows
set extraSdkPath ""
set extraFileListAttributes [appendArgs \
"\r\n " {AppliesTo="WindowsAppContainer"} \
"\r\n " {DependsOn="Microsoft.VCLibs, version=11.0"}]
} elseif {[string equal -nocase $packageFlavor WP80]} then {
set shortName SQLite.WP80
set displayName "SQLite for Windows Phone"
set targetPlatformIdentifier "Windows Phone"
set extraSdkPath "\\..\\$targetPlatformIdentifier"
set extraFileListAttributes ""
} else {
fail "unsupported package flavor, must be \"WinRT\" or \"WP80\""
}
if {$argc >= 4} then {
set platformNames [list]
foreach platformName [split [lindex $argv 3] ", "] {
if {[string length $platformName] > 0} then {
lappend platformNames $platformName
}
}
}
###############################################################################
#
@@ -168,7 +302,8 @@ if {![file exists $templateFile] || \
}
set currentDirectory [pwd]
set outputFile [file join $currentDirectory sqlite-output.vsix]
set outputFile [file join $currentDirectory [appendArgs sqlite- \
$packageFlavor -output.vsix]]
if {[file exists $outputFile]} then {
fail [appendArgs "output file \"" $outputFile "\" already exists"]
@@ -244,60 +379,92 @@ if {![regexp -line -- $pattern $data dummy version]} then {
###############################################################################
#
# NOTE: Setup the master file list data, including the necessary flags.
# NOTE: Setup all the master file list data. This includes the source file
# names, the destination file names, and the file processing flags. The
# possible file processing flags are:
#
# "buildNeutral" -- This flag indicates the file location and content do
# not depend on the build configuration.
#
# "platformNeutral" -- This flag indicates the file location and content
# do not depend on the build platform.
#
# "subst" -- This flag indicates that the file contains dynamic textual
# content that needs to be processed using [subst] prior to
# packaging the file into the final VSIX package. The primary
# use of this flag is to insert the name of the VSIX package,
# some package flavor-specific value, or the SQLite version
# into a file.
#
# "noDebug" -- This flag indicates that the file should be skipped when
# processing the debug build.
#
# "noRetail" -- This flag indicates that the file should be skipped when
# processing the retail build.
#
# "move" -- This flag indicates that the file should be moved from the
# source to the destination instead of being copied.
#
# This file metadata may be overridden, either in whole or in part, via
# the user-specific customizations file.
#
if {![info exists fileNames(source)]} then {
set fileNames(source) [list "" "" "" \
[file join $sourceDirectory sqlite3.h] \
[file join $binaryDirectory <platform> sqlite3.lib] \
[file join $binaryDirectory <platform> sqlite3.dll]]
set fileNames(source) [list "" "" \
[file join $stagingDirectory DesignTime <build> <platform> sqlite3.props] \
[file join $sourceDirectory sqlite3.h] \
[file join $binaryDirectory <build> <platform> sqlite3.lib] \
[file join $binaryDirectory <build> <platform> sqlite3.dll]]
if {![info exists no(symbols)]} then {
lappend fileNames(source) \
[file join $binaryDirectory <platform> sqlite3.pdb]
[file join $binaryDirectory <build> <platform> sqlite3.pdb]
}
}
if {![info exists fileNames(destination)]} then {
set fileNames(destination) [list \
[file join $stagingDirectory extension.vsixmanifest] \
[file join $stagingDirectory SDKManifest.xml] \
[file join $stagingDirectory DesignTime CommonConfiguration \
<platform> SQLite.WinRT.props] \
[file join $stagingDirectory DesignTime CommonConfiguration \
<platform> sqlite3.h] \
[file join $stagingDirectory DesignTime CommonConfiguration \
<platform> sqlite3.lib] \
[file join $stagingDirectory Redist CommonConfiguration \
<platform> sqlite3.dll]]
[file join $stagingDirectory extension.vsixmanifest] \
[file join $stagingDirectory SDKManifest.xml] \
[file join $stagingDirectory DesignTime <build> <platform> <name>.props] \
[file join $stagingDirectory DesignTime <build> <platform> sqlite3.h] \
[file join $stagingDirectory DesignTime <build> <platform> sqlite3.lib] \
[file join $stagingDirectory Redist <build> <platform> sqlite3.dll]]
if {![info exists no(symbols)]} then {
lappend fileNames(destination) \
[file join $stagingDirectory Redist Debug \
<platform> sqlite3.pdb]
[file join $stagingDirectory Redist <build> <platform> sqlite3.pdb]
}
}
if {![info exists fileNames(neutral)]} then {
set fileNames(neutral) [list 1 1 1 1 0 0]
if {![info exists fileNames(flags)]} then {
set fileNames(flags) [list \
[list buildNeutral platformNeutral subst] \
[list buildNeutral platformNeutral subst] \
[list buildNeutral platformNeutral subst move] \
[list buildNeutral platformNeutral] \
[list] [list] [list noRetail]]
if {![info exists no(symbols)]} then {
lappend fileNames(neutral) 0
}
}
if {![info exists fileNames(subst)]} then {
set fileNames(subst) [list 1 1 1 0 0 0]
if {![info exists no(symbols)]} then {
lappend fileNames(subst) 0
lappend fileNames(flags) [list noRetail]
}
}
###############################################################################
#
# NOTE: Setup the list of platforms supported by this script.
# NOTE: Setup the list of builds supported by this script. These may be
# overridden via the user-specific customizations file.
#
if {![info exists buildNames]} then {
set buildNames [list Debug Retail]
}
###############################################################################
#
# NOTE: Setup the list of platforms supported by this script. These may be
# overridden via the command line or the user-specific customizations
# file.
#
if {![info exists platformNames]} then {
set platformNames [list x86 x64 ARM]
@@ -311,72 +478,117 @@ if {![info exists platformNames]} then {
file mkdir $stagingDirectory
#
# NOTE: Build the Tcl command used to extract the template package to the
# staging directory.
# NOTE: Build the Tcl command used to extract the template VSIX package to
# the staging directory.
#
set extractCommand [list exec -- $unzip $templateFile -d $stagingDirectory]
#
# NOTE: Extract the template package to the staging directory.
# NOTE: Extract the template VSIX package to the staging directory.
#
eval $extractCommand
###############################################################################
#
# NOTE: Process each file in the master file list. There are actually four
# parallel lists that contain the source file names, destination file
# names, the platform-neutral flags, and the use-subst flags. When the
# platform-neutral flag is non-zero, the file is not platform-specific.
# When the use-subst flag is non-zero, the file is considered to be a
# text file that may contain Tcl variable and/or command replacements,
# to be dynamically replaced during processing. If the source file name
# is an empty string, then the destination file name will be assumed to
# already exist in the staging directory and will not be copied; however,
# dynamic replacements may still be performed on the destination file
# prior to the package being re-zipped.
# NOTE: Process each file in the master file list. There are actually three
# parallel lists that contain the source file names, the destination file
# names, and the file processing flags. If the "buildNeutral" flag is
# present, the file location and content do not depend on the build
# configuration and "CommonConfiguration" will be used in place of the
# build configuration name. If the "platformNeutral" flag is present,
# the file location and content do not depend on the build platform and
# "neutral" will be used in place of the build platform name. If the
# "subst" flag is present, the file is assumed to be a text file that may
# contain Tcl variable, command, and backslash replacements, to be
# dynamically replaced during processing using the Tcl [subst] command.
# If the "noDebug" flag is present, the file will be skipped when
# processing for the debug build. If the "noRetail" flag is present, the
# file will be skipped when processing for the retail build. If the
# "move" flag is present, the source file will be deleted after it is
# copied to the destination file. If the source file name is an empty
# string, the destination file name will be assumed to already exist in
# the staging directory and will not be copied; however, Tcl variable,
# command, and backslash replacements may still be performed on the
# destination file prior to the final VSIX package being built if the
# "subst" flag is present.
#
foreach sourceFileName $fileNames(source) \
destinationFileName $fileNames(destination) \
isNeutral $fileNames(neutral) useSubst $fileNames(subst) {
foreach sourceFileName $fileNames(source) \
destinationFileName $fileNames(destination) \
fileFlags $fileNames(flags) {
#
# NOTE: If the current file is platform-neutral, then only one platform will
# be processed for it, namely "neutral"; otherwise, each supported
# platform will be processed for it individually.
# NOTE: Process the file flags into separate boolean variables that may be
# used within the loop.
#
foreach platformName [expr {$isNeutral ? [list neutral] : $platformNames}] {
#
# NOTE: Use the actual platform name in the destination file name.
#
set newDestinationFileName [replacePlatform $destinationFileName \
$platformName]
set isBuildNeutral [expr {[lsearch $fileFlags buildNeutral] != -1}]
set isPlatformNeutral [expr {[lsearch $fileFlags platformNeutral] != -1}]
set isMove [expr {[lsearch $fileFlags move] != -1}]
set useSubst [expr {[lsearch $fileFlags subst] != -1}]
#
# NOTE: If the current file is build-neutral, then only one build will
# be processed for it, namely "CommonConfiguration"; otherwise, each
# supported build will be processed for it individually.
#
foreach buildName \
[expr {$isBuildNeutral ? [list CommonConfiguration] : $buildNames}] {
#
# NOTE: Does the source file need to be copied to the destination file?
# NOTE: Should the current file be skipped for this build?
#
if {[string length $sourceFileName] > 0} then {
#
# NOTE: First, make sure the destination directory exists.
#
file mkdir [file dirname $newDestinationFileName]
#
# NOTE: Then, copy the source file to the destination file verbatim.
#
file copy [replacePlatform $sourceFileName $platformName] \
$newDestinationFileName
if {[lsearch $fileFlags no${buildName}] != -1} then {
continue
}
#
# NOTE: Does the destination file contain dynamic replacements that must
# be processed now?
# NOTE: If the current file is platform-neutral, then only one platform
# will be processed for it, namely "neutral"; otherwise, each
# supported platform will be processed for it individually.
#
if {$useSubst} then {
foreach platformName \
[expr {$isPlatformNeutral ? [list neutral] : $platformNames}] {
#
# NOTE: Perform any dynamic replacements contained in the destination
# file and then re-write it in-place.
# NOTE: Use the actual platform name in the destination file name.
#
substFile $newDestinationFileName
set newDestinationFileName [replaceFileNameTokens $destinationFileName \
$shortName $buildName $platformName]
#
# NOTE: Does the source file need to be copied to the destination file?
#
if {[string length $sourceFileName] > 0} then {
#
# NOTE: First, make sure the destination directory exists.
#
file mkdir [file dirname $newDestinationFileName]
#
# NOTE: Then, copy the source file to the destination file verbatim.
#
set newSourceFileName [replaceFileNameTokens $sourceFileName \
$shortName $buildName $platformName]
file copy $newSourceFileName $newDestinationFileName
#
# NOTE: If this is a move instead of a copy, delete the source file
# now.
#
if {$isMove} then {
file delete $newSourceFileName
}
}
#
# NOTE: Does the destination file contain dynamic replacements that must
# be processed now?
#
if {$useSubst} then {
#
# NOTE: Perform any dynamic replacements contained in the destination
# file and then re-write it in-place.
#
substFile $newDestinationFileName
}
}
}
}
@@ -391,13 +603,13 @@ foreach sourceFileName $fileNames(source) \
cd $stagingDirectory
#
# NOTE: Build the Tcl command used to archive the final package in the
# NOTE: Build the Tcl command used to archive the final VSIX package in the
# output directory.
#
set archiveCommand [list exec -- $zip -r $outputFile *]
#
# NOTE: Build the final package archive in the output directory.
# NOTE: Build the final VSIX package archive in the output directory.
#
eval $archiveCommand
Binary file not shown.