Compare commits
386 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b7b060401e | |||
| 7bd72d4abf | |||
| 8c0e922721 | |||
| f792cda1a1 | |||
| d389fd3699 | |||
| 0a4f10e6e2 | |||
| bd0e3ed522 | |||
| 17abe9e251 | |||
| 502b7a236e | |||
| 126541f8ac | |||
| dbd455a0fd | |||
| 01ef1dfc1f | |||
| b6e8f65ffe | |||
| cebf06c798 | |||
| dae87df198 | |||
| 1560045c32 | |||
| 99e8490705 | |||
| 62d9d70edd | |||
| a7829ecbdd | |||
| 642479d1cd | |||
| 09eba154b2 | |||
| eed4e1d2df | |||
| d75acb8312 | |||
| 47991d973a | |||
| ba6510a399 | |||
| 894cda4db7 | |||
| 2d960e943b | |||
| fc9b5d2a95 | |||
| bee4fb401e | |||
| c27c61586f | |||
| 427e0076a9 | |||
| 9f19ea83e7 | |||
| bf09cbe2ca | |||
| 4b60c1b49c | |||
| e34ad2b0b3 | |||
| 0ca5b1e39d | |||
| f5965e9d51 | |||
| 3ce81095f9 | |||
| 5b27bfac44 | |||
| 272344d206 | |||
| 31b72ff521 | |||
| c171cf1ef7 | |||
| c9cc6a5474 | |||
| 8346ceef5a | |||
| 557974e126 | |||
| cf794e17cc | |||
| da5f813878 | |||
| 3398441bfc | |||
| 1d54203394 | |||
| 157d9276a0 | |||
| 29820d39d8 | |||
| fd3938fbca | |||
| 129203bce3 | |||
| e1e822ca23 | |||
| 94c42564f3 | |||
| 666bbd4641 | |||
| 68d88cfec5 | |||
| a37aec123a | |||
| d804893762 | |||
| b5f74ee637 | |||
| 5d60f47001 | |||
| b8ec04ee02 | |||
| 846643ebad | |||
| 1c03a34400 | |||
| 82769e7d04 | |||
| 90454d8924 | |||
| c3d2ec2289 | |||
| 87ad172c50 | |||
| 228e51d8cd | |||
| 58bc525e32 | |||
| 18d9b12e90 | |||
| d4c686ed8f | |||
| 17b620eb60 | |||
| fb8c46510e | |||
| a357a90f12 | |||
| a4cf066d64 | |||
| c46fbec350 | |||
| f037440bfe | |||
| 51770439ff | |||
| 81d44c7e3e | |||
| 31d54ad041 | |||
| b16c76408a | |||
| e4f7af1908 | |||
| b6205d4bc3 | |||
| 7db5e50b8d | |||
| 21b431e685 | |||
| d2060072f3 | |||
| ffe65da569 | |||
| b081a391ce | |||
| ed36fb77e9 | |||
| 3111c4687f | |||
| 644b99641f | |||
| a63dee09a6 | |||
| 09591b78ae | |||
| 6a9c3b407e | |||
| 96a65cc474 | |||
| 9ba963f035 | |||
| 8d15d7ed68 | |||
| 8f2e95fa6c | |||
| 7b90beebd5 | |||
| 43aeed3fec | |||
| a3283ec135 | |||
| 07ce1820a0 | |||
| 4d70dbad57 | |||
| fdb2bdc2a3 | |||
| cbdbf534a3 | |||
| c071c47b51 | |||
| 524b8a6df2 | |||
| 1ad8df3c6b | |||
| df5d5faebe | |||
| 8b0240ea72 | |||
| 447f1c2312 | |||
| c3d72a5587 | |||
| 449c552b7c | |||
| a8d6fcf40d | |||
| f8c2382d70 | |||
| 2a9812ce49 | |||
| c580663329 | |||
| 4d58d3938a | |||
| cc803b209f | |||
| 72b119d5e4 | |||
| d9959bf48b | |||
| ce25007db8 | |||
| 220260b896 | |||
| a80089c516 | |||
| 2a300a2853 | |||
| 9e632f5512 | |||
| b42310a6b9 | |||
| a32ea731a0 | |||
| f8a9f45595 | |||
| eb0d2e7bc6 | |||
| 2e132a4c04 | |||
| eb3a069fc8 | |||
| 9ef8399055 | |||
| 21212923f2 | |||
| c274e6dda4 | |||
| 7bfa4452a3 | |||
| ef86b942b9 | |||
| ad5dcff53b | |||
| f6757b305a | |||
| 56d2fd008b | |||
| 59c64e086a | |||
| 3cc3898e13 | |||
| c2d56ea4ea | |||
| 4b1c8362e7 | |||
| 18780193d5 | |||
| f4fc2ee203 | |||
| ac729894be | |||
| 4a1c44eea7 | |||
| 984f699ccb | |||
| 4e87ddc105 | |||
| 6b5599726b | |||
| d04782206b | |||
| b0c987967f | |||
| a09fd7b913 | |||
| e3157582bf | |||
| f338ab20ef | |||
| e89f31f19a | |||
| 5087eacb18 | |||
| 25367c1eb0 | |||
| 8bbce21ed7 | |||
| 1be96b44c1 | |||
| f3e24d0875 | |||
| 56ff8df023 | |||
| 41f29806a1 | |||
| cd56ad4ccb | |||
| 374c6a451e | |||
| e5769f6525 | |||
| 833dd3daff | |||
| db253d0862 | |||
| 138951dc2e | |||
| ba8e3ca139 | |||
| 62e1d44846 | |||
| df9b89932f | |||
| 2d87894700 | |||
| 0a4af54a7e | |||
| 6cc36dfb16 | |||
| b2972b8c6f | |||
| 8f79342f6a | |||
| dadd0b4085 | |||
| 9dfc2c61ec | |||
| 3ea05b5b4f | |||
| a0d35d44e4 | |||
| 93df8109fc | |||
| 3efac4aa78 | |||
| 3bdebaeabb | |||
| b85b7f257d | |||
| 79d0aa6f56 | |||
| 63f4926524 | |||
| e108f97256 | |||
| 00bc96c05c | |||
| f858182689 | |||
| 3e06f2d79b | |||
| 5b0b8653b6 | |||
| 66172ceb89 | |||
| 9d90a3af2f | |||
| 03c65171b8 | |||
| 297a95bad5 | |||
| f62d053b49 | |||
| 7df570421c | |||
| 84b0f221f4 | |||
| 7fd936e5ed | |||
| 189a4a0bbb | |||
| ede1690cce | |||
| 7a7002143c | |||
| d8452a9517 | |||
| 4192a95d23 | |||
| 6b3010a134 | |||
| 038424727b | |||
| 65552a7ae1 | |||
| 01bfe2a531 | |||
| 3c013479c3 | |||
| 659bafd05d | |||
| 31c3599ed0 | |||
| 6c074e5dc4 | |||
| 97af1346f0 | |||
| b6859b6f2c | |||
| 802b042f6e | |||
| e85b2cac0f | |||
| 51dd67080a | |||
| 31615637f3 | |||
| 0d9f2a15f2 | |||
| 1c68deead7 | |||
| 589796cd89 | |||
| dbe48d3c8d | |||
| c2b446f16a | |||
| 6e5802fc74 | |||
| 3cd34ab981 | |||
| d98689f4d3 | |||
| cf9f841c5e | |||
| 77586831ed | |||
| d256b56880 | |||
| 3cf467a3ec | |||
| 4170780a82 | |||
| f306ca5286 | |||
| c229f11817 | |||
| 14613b1b1d | |||
| c49bfdbbee | |||
| 4b99ec0b8c | |||
| 454a426e31 | |||
| 5c72a39cfb | |||
| de50617bcb | |||
| fdc17e0bc8 | |||
| 276d213b2a | |||
| 45b2669ad3 | |||
| 82f3052e61 | |||
| 8fbf400bb0 | |||
| cee7609074 | |||
| a75321d735 | |||
| cb0da053ed | |||
| f6ca35d88c | |||
| a033790303 | |||
| 654c94d683 | |||
| 32933278fd | |||
| d4bfa3465e | |||
| efbf481541 | |||
| 824a5bfcf0 | |||
| 80cf9fa00b | |||
| e16b345243 | |||
| 0911f86abf | |||
| 49906e8e4b | |||
| df54ecb1bf | |||
| 8bffd498ea | |||
| 000e39e9a8 | |||
| 462888819e | |||
| 8dacf71043 | |||
| 73dcf45a3d | |||
| 1392ff5533 | |||
| 00d6b7abfc | |||
| 4f8f1965f7 | |||
| cb46f1bb95 | |||
| 8883deb30e | |||
| 36279c256b | |||
| 9dcf3d08c9 | |||
| 0424f255ef | |||
| 8b62a82ae3 | |||
| b0c8b08874 | |||
| 50637ca5c5 | |||
| d8c37bbc54 | |||
| 44980e8169 | |||
| 5dcf5890ae | |||
| 7c727bb61b | |||
| 43aad25b1b | |||
| e097db7210 | |||
| 2228567ad3 | |||
| fe54b7a1f4 | |||
| fb9e8e48fd | |||
| 0186ee1cd7 | |||
| dea434ea65 | |||
| bc7e41c03c | |||
| 77731d5ec0 | |||
| 079f840e47 | |||
| d37412b80c | |||
| f1c5830311 | |||
| 2539fb2bc5 | |||
| 7ae051df2a | |||
| 299fe02393 | |||
| 7a16413a84 | |||
| 8bfb186728 | |||
| 4331e6bd1d | |||
| dfb5f32758 | |||
| c70631623c | |||
| 07a2e5d1ed | |||
| 1519675a1a | |||
| 02e81f72a0 | |||
| 726a047a47 | |||
| efafde5eb4 | |||
| 72543206e5 | |||
| c9bf7ed9ad | |||
| 83baa239e7 | |||
| f52ed5fd61 | |||
| c850c2be75 | |||
| 9489aefb83 | |||
| 255548562b | |||
| 8e7a16895c | |||
| a6b62a26d4 | |||
| 2e899ccaff | |||
| 631900291d | |||
| b80d01a182 | |||
| d0db5edf61 | |||
| 985b4bc157 | |||
| ae24e13bc7 | |||
| c69d537b93 | |||
| 467e20ad1d | |||
| e9763e4ed7 | |||
| 87cdd5926d | |||
| 17dca772e0 | |||
| 3640785453 | |||
| 2534bf4011 | |||
| c6a39debf9 | |||
| 815709dd00 | |||
| 6cd83aecb9 | |||
| 8291cd78f2 | |||
| 0f4de9bf9d | |||
| 50c4420030 | |||
| 1a1fe1d1da | |||
| e52cdadea7 | |||
| e432f2a316 | |||
| f462046cd1 | |||
| 0887b70286 | |||
| ada3470075 | |||
| e024421624 | |||
| d0c6c6586e | |||
| 1425bae1ab | |||
| 7edb0c3920 | |||
| c957673bf7 | |||
| bfa7218982 | |||
| 4a25b740f2 | |||
| ec50c5a2a4 | |||
| b6953280e7 | |||
| 3202b11f66 | |||
| c5dd908c89 | |||
| 65d0312c96 | |||
| 3ba9adc5c1 | |||
| c738052394 | |||
| d1047faad6 | |||
| 874b5e9fbb | |||
| 73d9eb1bb3 | |||
| 4ea86ac0e3 | |||
| ff6bff4059 | |||
| 0609cf85fd | |||
| 290caec8e3 | |||
| 362d51a159 | |||
| 4e3b6a14fd | |||
| ce50282c3b | |||
| c978e390e6 | |||
| 800bf8fd93 | |||
| d26bb375be | |||
| b1ad83a342 | |||
| 7d32ec0a5c | |||
| d50eb9c999 | |||
| e5418e9dd3 | |||
| 50ebf16dd6 | |||
| 9c750fe3a3 | |||
| 4ab343cb7c | |||
| b9be2f6396 | |||
| 093c21342c | |||
| 23498de7be | |||
| c99caf5de5 | |||
| 2d5ce92aae | |||
| d4545bca73 | |||
| 9d592359fe | |||
| a180131454 | |||
| f6d267491c | |||
| 1743c5f836 | |||
| 6bd3faa092 |
+20
-14
@@ -79,7 +79,7 @@ libdir = @libdir@
|
||||
|
||||
INSTALL = @BIN_INSTALL@
|
||||
AR = @AR@
|
||||
AR.flags = cr # TODO? Add a configure test to determine this?
|
||||
AR.flags = cr
|
||||
CC = @CC@
|
||||
B.cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@
|
||||
T.cc = $(CC)
|
||||
@@ -118,12 +118,25 @@ LDFLAGS.dlopen = @LDFLAGS_DLOPEN@
|
||||
LDFLAGS.readline = @LDFLAGS_READLINE@
|
||||
CFLAGS.readline = @CFLAGS_READLINE@
|
||||
LDFLAGS.icu = @LDFLAGS_ICU@
|
||||
LDFLAGS.rt = @LDFLAGS_RT@
|
||||
CFLAGS.icu = @CFLAGS_ICU@
|
||||
LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@
|
||||
# soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded
|
||||
ENABLE_SHARED = @ENABLE_SHARED@
|
||||
ENABLE_STATIC = @ENABLE_STATIC@
|
||||
LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ @LDFLAGS_OUT_IMPLIB@
|
||||
# os-specific: see
|
||||
# - https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7
|
||||
# - https://sqlite.org/forum/forumpost/0c7fc097b2
|
||||
libsqlite3.DLL.basename = @SQLITE_DLL_BASENAME@
|
||||
# DLL.basename: see https://sqlite.org/forum/forumpost/828fdfe904
|
||||
libsqlite3.out.implib = @SQLITE_OUT_IMPLIB@
|
||||
# libsqlite3.out.implib => the output filename part of LDFLAGS_OUT_IMPLIB.
|
||||
ENABLE_LIB_SHARED = @ENABLE_LIB_SHARED@
|
||||
ENABLE_LIB_STATIC = @ENABLE_LIB_STATIC@
|
||||
HAVE_WASI_SDK = @HAVE_WASI_SDK@
|
||||
libsqlite3.DLL.install-rules = @SQLITE_DLL_INSTALL_RULES@
|
||||
|
||||
# -fsanitize flags for the fuzzcheck-asap app
|
||||
CFLAGS.fuzzcheck.fsanitize = @CFLAGS_FUZZCHECK_FSANITIZE@
|
||||
|
||||
T.cc.sqlite = $(T.cc) @TARGET_DEBUG@
|
||||
|
||||
@@ -142,7 +155,7 @@ T.cc.sqlite += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
|
||||
# shell command.
|
||||
#
|
||||
CFLAGS.jimsh = @CFLAGS_JIMSH@
|
||||
JIMSH = ./jimsh$(TEXE)
|
||||
JIMSH = ./jimsh$(T.exe)
|
||||
|
||||
#
|
||||
# $(B.tclsh) is documented in main.mk.
|
||||
@@ -251,6 +264,7 @@ AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@
|
||||
USE_AMALGAMATION ?= @USE_AMALGAMATION@
|
||||
LINK_TOOLS_DYNAMICALLY ?= @LINK_TOOLS_DYNAMICALLY@
|
||||
AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@
|
||||
EXTRA_SRC ?= @AMALGAMATION_EXTRA_SRC@
|
||||
|
||||
#
|
||||
# CFLAGS for sqlite3$(T.exe)
|
||||
@@ -312,20 +326,11 @@ misspell: ./custom.rws has_tclsh84
|
||||
# perform cleanup known to be relevant to (only) the autosetup-driven
|
||||
# build.
|
||||
#
|
||||
#clean-autosetup:
|
||||
# -if [ -f ext/wasm/GNUmakefile ]; then \
|
||||
# gmake --no-print-directory --ignore-errors -C ext/wasm clean; \
|
||||
# fi >/dev/null 2>&1; true
|
||||
#clean: clean-autosetup
|
||||
|
||||
distclean-autosetup: clean
|
||||
distclean-autosetup:
|
||||
rm -f sqlite_cfg.h config.log config.status config.defines.* Makefile sqlite3.pc
|
||||
rm -f $(TOP)/tool/emcc.sh
|
||||
rm -f libsqlite3*$(T.dll)
|
||||
rm -f jimsh0*
|
||||
# -if [ -f ext/wasm/GNUmakefile ]; then \
|
||||
# gmake --no-print-directory --ignore-errors -C ext/wasm distclean; \
|
||||
# fi >/dev/null 2>&1; true
|
||||
distclean: distclean-autosetup
|
||||
|
||||
#
|
||||
@@ -335,4 +340,5 @@ distclean: distclean-autosetup
|
||||
version-info$(T.exe): $(TOP)/tool/version-info.c Makefile sqlite3.h
|
||||
$(T.link) $(ST_OPT) -o $@ $(TOP)/tool/version-info.c
|
||||
|
||||
IS_CROSS_COMPILING = @IS_CROSS_COMPILING@
|
||||
include $(TOP)/main.mk
|
||||
|
||||
+26
-8
@@ -294,6 +294,12 @@ SESSION = 0
|
||||
RBU = 0
|
||||
!ENDIF
|
||||
|
||||
# Set this to non-0 to enable support for blocking locks.
|
||||
#
|
||||
!IFNDEF SETLK_TIMEOUT
|
||||
SETLK_TIMEOUT = 0
|
||||
!ENDIF
|
||||
|
||||
# Set the source code file to be used by executables and libraries when
|
||||
# they need the amalgamation.
|
||||
#
|
||||
@@ -450,6 +456,10 @@ EXT_FEATURE_FLAGS =
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
!IF $(SETLK_TIMEOUT)!=0
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SETLK_TIMEOUT
|
||||
!ENDIF
|
||||
|
||||
###############################################################################
|
||||
############################### END OF OPTIONS ################################
|
||||
###############################################################################
|
||||
@@ -1396,7 +1406,7 @@ SRC00 = \
|
||||
$(TOP)\src\build.c \
|
||||
$(TOP)\src\callback.c \
|
||||
$(TOP)\src\complete.c \
|
||||
$(TOP)\src\ctime.c \
|
||||
ctime.c \
|
||||
$(TOP)\src\date.c \
|
||||
$(TOP)\src\dbpage.c \
|
||||
$(TOP)\src\dbstat.c \
|
||||
@@ -1495,7 +1505,7 @@ SRC04 = \
|
||||
SRC05 = \
|
||||
$(TOP)\src\pager.h \
|
||||
$(TOP)\src\pcache.h \
|
||||
$(TOP)\src\pragma.h \
|
||||
pragma.h \
|
||||
$(TOP)\src\sqlite.h.in \
|
||||
$(TOP)\src\sqlite3ext.h \
|
||||
$(TOP)\src\sqliteInt.h \
|
||||
@@ -1698,7 +1708,7 @@ HDR = \
|
||||
$(TOP)\src\pager.h \
|
||||
$(TOP)\src\pcache.h \
|
||||
parse.h \
|
||||
$(TOP)\src\pragma.h \
|
||||
pragma.h \
|
||||
$(SQLITE3H) \
|
||||
sqlite3ext.h \
|
||||
$(TOP)\src\sqliteInt.h \
|
||||
@@ -2099,8 +2109,11 @@ callback.lo: $(TOP)\src\callback.c $(HDR)
|
||||
complete.lo: $(TOP)\src\complete.c $(HDR)
|
||||
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\complete.c
|
||||
|
||||
ctime.lo: $(TOP)\src\ctime.c $(HDR)
|
||||
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\ctime.c
|
||||
ctime.c: $(TOP)\tool\mkctimec.tcl $(JIM_TCLSH)
|
||||
$(JIM_TCLSH) $(TOP)\tool\mkctimec.tcl
|
||||
|
||||
ctime.lo: ctime.c $(HDR)
|
||||
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c ctime.c
|
||||
|
||||
date.lo: $(TOP)\src\date.c $(HDR)
|
||||
$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\date.c
|
||||
@@ -2333,8 +2346,11 @@ parse.c: $(TOP)\src\parse.y lemon.exe
|
||||
copy /B parse.y +,,
|
||||
.\lemon.exe $(REQ_FEATURE_FLAGS) $(OPT_FEATURE_FLAGS) $(EXT_FEATURE_FLAGS) $(OPTS) -S parse.y
|
||||
|
||||
pragma.h: $(TOP)\tool\mkpragmatab.tcl $(JIM_TCLSH)
|
||||
$(JIM_TCLSH) $(TOP)\tool\mkpragmatab.tcl
|
||||
|
||||
$(SQLITE3H): $(TOP)\src\sqlite.h.in $(TOP)\manifest mksourceid.exe $(TOP)\VERSION $(JIM_TCLSH)
|
||||
$(JIM_TCLSH) $(TOP)\tool\mksqlite3h.tcl "$(TOP:\=/)" > $(SQLITE3H) $(MKSQLITE3H_ARGS)
|
||||
$(JIM_TCLSH) $(TOP)\tool\mksqlite3h.tcl "$(TOP:\=/)" -o $(SQLITE3H) $(MKSQLITE3H_ARGS)
|
||||
|
||||
sqlite3ext.h: .target_source
|
||||
!IF $(USE_STDCALL)!=0 || $(FOR_WIN10)!=0
|
||||
@@ -2398,7 +2414,7 @@ SHELL_DEP = $(SHELL_DEP) $(TOP)\ext\misc\zipfile.c
|
||||
!ENDIF
|
||||
|
||||
shell.c: $(SHELL_DEP) $(TOP)\tool\mkshellc.tcl $(JIM_TCLSH)
|
||||
$(JIM_TCLSH) $(TOP)\tool\mkshellc.tcl > shell.c
|
||||
$(JIM_TCLSH) $(TOP)\tool\mkshellc.tcl shell.c
|
||||
|
||||
zlib:
|
||||
pushd $(ZLIBDIR) && $(MAKE) /f win32\Makefile.msc clean $(ZLIBLIB) && popd
|
||||
@@ -2811,7 +2827,8 @@ moreclean: clean
|
||||
|
||||
clean:
|
||||
del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
|
||||
del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
|
||||
del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
|
||||
del /Q sqlite3.def tclsqlite3.def ctime.c pragma.h 2>NUL
|
||||
del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL
|
||||
# <<mark>>
|
||||
del /Q $(SQLITE3TCLDLL) pkgIndex.tcl 2>NUL
|
||||
@@ -2845,4 +2862,5 @@ clean:
|
||||
del /Q fts5.* fts5parse.* 2>NUL
|
||||
del /Q lsm.h lsm1.c 2>NUL
|
||||
del /q src-verify.exe 2>NUL
|
||||
del /q jimsh.exe jimsh0.exe 2>NUL
|
||||
# <</mark>>
|
||||
|
||||
@@ -134,7 +134,7 @@ later. The "tclextension-install" target and the test targets that follow
|
||||
all require TCL development libraries too. ("apt install tcl-dev"). It is
|
||||
helpful, but is not required, to install the SQLite TCL extension (the
|
||||
"tclextension-install" target) prior to running tests. The "releasetest"
|
||||
target has additional requiremenst, such as "valgrind".
|
||||
target has additional requirements, such as "valgrind".
|
||||
|
||||
On "make" command-lines, one can add "OPTIONS=..." to specify additional
|
||||
compile-time options over and above those set by ./configure. For example,
|
||||
|
||||
@@ -1,370 +0,0 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell commands `./configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the `README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
`INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') is used to create
|
||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
||||
you want to change it or regenerate `configure' using a newer version
|
||||
of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system.
|
||||
|
||||
Running `configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the `make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type `make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior `make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type `make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide `make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like `make install' and `make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. Run `./configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'. This
|
||||
is known as a "VPATH" build.
|
||||
|
||||
With a non-GNU `make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use `make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple `-arch' options to the
|
||||
compiler but only a single `-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the `lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the
|
||||
default for these options is expressed in terms of `${prefix}', so that
|
||||
specifying just `--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to `configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
`make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, `make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
`${prefix}'. Any directories that were specified during `configure',
|
||||
but not in terms of `${prefix}', must each be overridden at install
|
||||
time for the entire installation to be relocated. The approach of
|
||||
makefile variable overrides for each directory variable is required by
|
||||
the GNU Coding Standards, and ideally causes no recompilation.
|
||||
However, some platforms have known limitations with the semantics of
|
||||
shared libraries that end up requiring recompilation when using this
|
||||
method, particularly noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the `DESTDIR' variable. For
|
||||
example, `make install DESTDIR=/alternate/directory' will prepend
|
||||
`/alternate/directory' before all installation names. The approach of
|
||||
`DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of `${prefix}'
|
||||
at `configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of `make' will be. For these packages, running `./configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with `make V=1'; while running `./configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with `make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
|
||||
CC is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX `make' updates targets which have the same time stamps as
|
||||
their prerequisites, which makes it generally unusable when shipped
|
||||
generated files such as `configure' are involved. Use GNU `make'
|
||||
instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
|
||||
a workaround. If GNU CC is not installed, it is therefore recommended
|
||||
to try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
|
||||
in your `PATH', put it _after_ `/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in `/boot/common',
|
||||
not `/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, `configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
||||
an Autoconf bug. Until the bug is fixed you can use this workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of all of the options to `configure', and exit.
|
||||
|
||||
`--help=short'
|
||||
`--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
`configure', and exit. The `short' variant lists options used
|
||||
only in the top level, while the `recursive' variant lists options
|
||||
also present in any nested packages.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names::
|
||||
for more details, including other options available for fine-tuning
|
||||
the installation locations.
|
||||
|
||||
`--no-create'
|
||||
`-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
AM_CFLAGS = @BUILD_CFLAGS@
|
||||
lib_LTLIBRARIES = libsqlite3.la
|
||||
libsqlite3_la_SOURCES = sqlite3.c
|
||||
libsqlite3_la_LDFLAGS = -no-undefined -version-info 8:6:8
|
||||
|
||||
bin_PROGRAMS = sqlite3
|
||||
sqlite3_SOURCES = shell.c sqlite3.h
|
||||
EXTRA_sqlite3_SOURCES = sqlite3.c
|
||||
sqlite3_LDADD = @EXTRA_SHELL_OBJ@ @READLINE_LIBS@
|
||||
sqlite3_DEPENDENCIES = @EXTRA_SHELL_OBJ@
|
||||
sqlite3_CFLAGS = $(AM_CFLAGS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_DQS=0 -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBSTAT_VTAB $(SHELL_CFLAGS)
|
||||
|
||||
include_HEADERS = sqlite3.h sqlite3ext.h
|
||||
|
||||
EXTRA_DIST = sqlite3.1 tea Makefile.msc sqlite3.rc sqlite3rc.h README.txt Replace.cs Makefile.fallback
|
||||
pkgconfigdir = ${libdir}/pkgconfig
|
||||
pkgconfig_DATA = sqlite3.pc
|
||||
|
||||
man_MANS = sqlite3.1
|
||||
@@ -0,0 +1,285 @@
|
||||
########################################################################
|
||||
# This is a main makefile for the "autoconf" bundle of SQLite. This is
|
||||
# a trimmed-down version of the canonical makefile, devoid of most
|
||||
# documentation. For the full docs, see /main.mk in the canonical
|
||||
# source tree.
|
||||
#
|
||||
# Maintenance reminders:
|
||||
#
|
||||
# - To keep this working with an out-of-tree build, be sure to prefix
|
||||
# input file names with $(TOP)/ where appropriate (which is most
|
||||
# places).
|
||||
#
|
||||
# - The original/canonical recipes can be found in /main.mk in the
|
||||
# canonical source tree.
|
||||
all:
|
||||
|
||||
TOP = @abs_top_srcdir@
|
||||
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
|
||||
#
|
||||
# Filename extensions for binaries and libraries
|
||||
#
|
||||
B.exe = @BUILD_EXEEXT@
|
||||
T.exe = @TARGET_EXEEXT@
|
||||
B.dll = @BUILD_DLLEXT@
|
||||
T.dll = @TARGET_DLLEXT@
|
||||
B.lib = @BUILD_LIBEXT@
|
||||
T.lib = @TARGET_LIBEXT@
|
||||
|
||||
#
|
||||
# Autotools-compatibility dirs
|
||||
#
|
||||
prefix = @prefix@
|
||||
datadir = @datadir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
libdir = @libdir@
|
||||
|
||||
#
|
||||
# Required binaries
|
||||
#
|
||||
INSTALL = @BIN_INSTALL@
|
||||
AR = @AR@
|
||||
AR.flags = cr
|
||||
CC = @CC@
|
||||
|
||||
|
||||
ENABLE_LIB_SHARED = @ENABLE_LIB_SHARED@
|
||||
ENABLE_LIB_STATIC = @ENABLE_LIB_STATIC@
|
||||
|
||||
CFLAGS = @CFLAGS@ @CPPFLAGS@
|
||||
#
|
||||
# $(LDFLAGS.configure) represents any LDFLAGS=... the client passes to
|
||||
# configure. See main.mk.
|
||||
#
|
||||
LDFLAGS.configure = @LDFLAGS@
|
||||
|
||||
CFLAGS.core = @SH_CFLAGS@
|
||||
LDFLAGS.shlib = @SH_LDFLAGS@
|
||||
LDFLAGS.zlib = @LDFLAGS_ZLIB@
|
||||
LDFLAGS.math = @LDFLAGS_MATH@
|
||||
LDFLAGS.rpath = @LDFLAGS_RPATH@
|
||||
LDFLAGS.pthread = @LDFLAGS_PTHREAD@
|
||||
LDFLAGS.dlopen = @LDFLAGS_DLOPEN@
|
||||
LDFLAGS.readline = @LDFLAGS_READLINE@
|
||||
CFLAGS.readline = @CFLAGS_READLINE@
|
||||
LDFLAGS.rt = @LDFLAGS_RT@
|
||||
LDFLAGS.icu = @LDFLAGS_ICU@
|
||||
CFLAGS.icu = @CFLAGS_ICU@
|
||||
|
||||
# When cross-compiling, we need to avoid the -s flag because it only
|
||||
# works on the build host's platform.
|
||||
INSTALL.strip.1 = $(INSTALL)
|
||||
INSTALL.strip.0 = $(INSTALL) -s
|
||||
INSTALL.strip = $(INSTALL.strip.@IS_CROSS_COMPILING@)
|
||||
INSTALL.noexec = $(INSTALL) -m 0644
|
||||
|
||||
install-dir.bin = $(DESTDIR)$(bindir)
|
||||
install-dir.lib = $(DESTDIR)$(libdir)
|
||||
install-dir.include = $(DESTDIR)$(includedir)
|
||||
install-dir.pkgconfig = $(DESTDIR)$(libdir)/pkgconfig
|
||||
install-dir.man1 = $(DESTDIR)$(mandir)/man1
|
||||
install-dir.all = $(install-dir.bin) $(install-dir.include) \
|
||||
$(install-dir.lib) $(install-dir.man1) \
|
||||
$(install-dir.pkgconfig)
|
||||
$(install-dir.all):
|
||||
@if [ ! -d "$@" ]; then set -x; $(INSTALL) -d "$@"; fi
|
||||
# ^^^^ on some platforms, install -d fails if the target already exists.
|
||||
|
||||
|
||||
#
|
||||
# Vars with the AS_ prefix are specifically related to AutoSetup.
|
||||
#
|
||||
# AS_AUTO_DEF is the main configure script.
|
||||
#
|
||||
AS_AUTO_DEF = $(TOP)/auto.def
|
||||
|
||||
#
|
||||
# Shell commands to re-run $(TOP)/configure with the same args it was
|
||||
# invoked with to produce this makefile.
|
||||
#
|
||||
AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@
|
||||
Makefile: $(TOP)/Makefile.in $(AS_AUTO_DEF)
|
||||
$(AS_AUTORECONFIG)
|
||||
@touch $@
|
||||
|
||||
sqlite3.pc: $(TOP)/sqlite3.pc.in $(AS_AUTO_DEF)
|
||||
$(AS_AUTORECONFIG)
|
||||
@touch $@
|
||||
|
||||
sqlite_cfg.h: $(AS_AUTO_DEF)
|
||||
$(AS_AUTORECONFIG)
|
||||
@touch $@
|
||||
|
||||
#
|
||||
# CFLAGS for sqlite3$(T.exe)
|
||||
#
|
||||
SHELL_OPT ?= @OPT_SHELL@
|
||||
|
||||
#
|
||||
# Library-level feature flags
|
||||
#
|
||||
OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@
|
||||
|
||||
LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@
|
||||
# soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded
|
||||
LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ @LDFLAGS_OUT_IMPLIB@
|
||||
# os-specific: see
|
||||
# - https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7
|
||||
# - https://sqlite.org/forum/forumpost/0c7fc097b2
|
||||
|
||||
LDFLAGS.libsqlite3 = \
|
||||
$(LDFLAGS.rpath) $(LDFLAGS.pthread) \
|
||||
$(LDFLAGS.math) $(LDFLAGS.dlopen) \
|
||||
$(LDFLAGS.zlib) $(LDFLAGS.icu) \
|
||||
$(LDFLAGS.rt) $(LDFLAGS.configure)
|
||||
CFLAGS.libsqlite3 = -I. $(CFLAGS.core) $(CFLAGS.icu) $(OPT_FEATURE_FLAGS)
|
||||
|
||||
sqlite3.o: $(TOP)/sqlite3.h $(TOP)/sqlite3.c
|
||||
$(CC) -c $(TOP)/sqlite3.c -o $@ $(CFLAGS) $(CFLAGS.libsqlite3)
|
||||
|
||||
libsqlite3.LIB = libsqlite3$(T.lib)
|
||||
libsqlite3.DLL.basename = @SQLITE_DLL_BASENAME@
|
||||
libsqlite3.out.implib = @SQLITE_OUT_IMPLIB@
|
||||
libsqlite3.DLL = $(libsqlite3.DLL.basename)$(T.dll)
|
||||
libsqlite3.DLL.install-rules = @SQLITE_DLL_INSTALL_RULES@
|
||||
|
||||
$(libsqlite3.DLL): sqlite3.o
|
||||
$(CC) -o $@ sqlite3.o $(LDFLAGS.shlib) \
|
||||
$(LDFLAGS) $(LDFLAGS.libsqlite3) \
|
||||
$(LDFLAGS.libsqlite3.os-specific) $(LDFLAGS.libsqlite3.soname)
|
||||
$(libsqlite3.DLL)-1: $(libsqlite3.DLL)
|
||||
$(libsqlite3.DLL)-0:
|
||||
all: $(libsqlite3.DLL)-$(ENABLE_LIB_SHARED)
|
||||
|
||||
$(libsqlite3.LIB): sqlite3.o
|
||||
$(AR) $(AR.flags) $@ sqlite3.o
|
||||
$(libsqlite3.LIB)-1: $(libsqlite3.LIB)
|
||||
$(libsqlite3.LIB)-0:
|
||||
all: $(libsqlite3.LIB)-$(ENABLE_LIB_STATIC)
|
||||
|
||||
#
|
||||
# Maintenance reminder: the install-dll-... rules must be kept in sync
|
||||
# with the main copies rom /main.mk.
|
||||
#
|
||||
install-dll-out-implib: $(install-dir.lib) $(libsqlite3.DLL)
|
||||
if [ x != "x$(libsqlite3.out.implib)" ] && [ -f "$(libsqlite3.out.implib)" ]; then \
|
||||
$(INSTALL) $(libsqlite3.out.implib) "$(install-dir.lib)"; \
|
||||
fi
|
||||
|
||||
install-dll-unix-generic: install-dll-out-implib
|
||||
$(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)"
|
||||
@echo "Setting up $(libsqlite3.DLL) version symlinks..."; \
|
||||
cd "$(install-dir.lib)" || exit $$?; \
|
||||
rm -f $(libsqlite3.DLL).0 $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \
|
||||
mv $(libsqlite3.DLL) $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \
|
||||
ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL) || exit $$?; \
|
||||
ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0 || exit $$?; \
|
||||
ls -la $(libsqlite3.DLL) $(libsqlite3.DLL).[a03]*; \
|
||||
if [ -e $(libsqlite3.DLL).0.8.6 ]; then \
|
||||
echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \
|
||||
rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \
|
||||
ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \
|
||||
ls -la $(libsqlite3.DLL).0.8.6; \
|
||||
elif [ x1 = "x$(INSTALL_SO_086_LINK)" ]; then \
|
||||
echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINK=1"; \
|
||||
rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \
|
||||
ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \
|
||||
ls -la $(libsqlite3.DLL).0.8.6; \
|
||||
fi
|
||||
|
||||
install-dll-msys: install-dll-out-implib $(install-dir.bin)
|
||||
$(INSTALL) $(libsqlite3.DLL) "$(install-dir.bin)"
|
||||
# ----------------------------------------------^^^ yes, bin
|
||||
install-dll-mingw: install-dll-msys
|
||||
install-dll-cygwin: install-dll-msys
|
||||
|
||||
install-dll-darwin: $(install-dir.lib) $(libsqlite3.DLL)
|
||||
$(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)"
|
||||
@echo "Setting up $(libsqlite3.DLL) version symlinks..."; \
|
||||
cd "$(install-dir.lib)" || exit $$?; \
|
||||
rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \
|
||||
dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \
|
||||
mv $(libsqlite3.DLL) $$dllname || exit $$?; \
|
||||
ln -s $$dllname $(libsqlite3.DLL) || exit $$?; \
|
||||
ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \
|
||||
ls -la $$dllname $(libsqlite3.DLL) libsqlite3.0$(T.dll)
|
||||
|
||||
install-dll-1: install-dll-$(libsqlite3.DLL.install-rules)
|
||||
install-dll-0 install-dll-:
|
||||
install-dll: install-dll-$(ENABLE_LIB_SHARED)
|
||||
install: install-dll
|
||||
|
||||
install-lib-1: $(install-dir.lib) $(libsqlite3.LIB)
|
||||
$(INSTALL.noexec) $(libsqlite3.LIB) "$(install-dir.lib)"
|
||||
install-lib-0 install-lib-:
|
||||
install-lib: install-lib-$(ENABLE_LIB_STATIC)
|
||||
install: install-lib
|
||||
|
||||
#
|
||||
# Flags to link the shell app either directly against sqlite3.c
|
||||
# (ENABLE_STATIC_SHELL==1) or libsqlite3.so (ENABLE_STATIC_SHELL==0).
|
||||
#
|
||||
ENABLE_STATIC_SHELL = @ENABLE_STATIC_SHELL@
|
||||
sqlite3-shell-link-flags.1 = $(TOP)/sqlite3.c $(LDFLAGS.libsqlite3)
|
||||
sqlite3-shell-link-flags.0 = -L. -lsqlite3 $(LDFLAGS.zlib)
|
||||
sqlite3-shell-deps.1 = $(TOP)/sqlite3.c
|
||||
sqlite3-shell-deps.0 = $(libsqlite3.DLL)
|
||||
sqlite3$(T.exe): $(TOP)/shell.c $(sqlite3-shell-deps.$(ENABLE_STATIC_SHELL))
|
||||
$(CC) -o $@ \
|
||||
$(TOP)/shell.c $(sqlite3-shell-link-flags.$(ENABLE_STATIC_SHELL)) \
|
||||
-I. $(OPT_FEATURE_FLAGS) $(SHELL_OPT) \
|
||||
$(CFLAGS) $(CFLAGS.readline) $(CFLAGS.icu) \
|
||||
$(LDFLAGS) $(LDFLAGS.readline)
|
||||
|
||||
all: sqlite3$(T.exe)
|
||||
|
||||
install-shell: sqlite3$(T.exe) $(install-dir.bin)
|
||||
$(INSTALL.strip) sqlite3$(T.exe) "$(install-dir.bin)"
|
||||
install: install-shell
|
||||
|
||||
install-headers: $(TOP)/sqlite3.h $(install-dir.include)
|
||||
$(INSTALL.noexec) $(TOP)/sqlite3.h $(TOP)/sqlite3ext.h "$(install-dir.include)"
|
||||
install: install-headers
|
||||
|
||||
install-pc: sqlite3.pc $(install-dir.pkgconfig)
|
||||
$(INSTALL.noexec) sqlite3.pc "$(install-dir.pkgconfig)"
|
||||
install: install-pc
|
||||
|
||||
install-man1: $(TOP)/sqlite3.1 $(install-dir.man1)
|
||||
$(INSTALL.noexec) $(TOP)/sqlite3.1 "$(install-dir.man1)"
|
||||
install: install-man1
|
||||
|
||||
clean:
|
||||
rm -f *.o sqlite3$(T.exe)
|
||||
rm -f $(libsqlite3.LIB) $(libsqlite3.DLL) libsqlite3$(T.dll).a
|
||||
|
||||
distclean: clean
|
||||
rm -f jimsh0$(T.exe) config.* sqlite3.pc sqlite_cfg.h Makefile
|
||||
|
||||
DIST_FILES := \
|
||||
README.txt VERSION \
|
||||
auto.def autosetup configure tea \
|
||||
sqlite3.h sqlite3.c shell.c sqlite3ext.h \
|
||||
Makefile.in Makefile.msc Makefile.fallback \
|
||||
sqlite3.rc sqlite3rc.h Replace.cs \
|
||||
sqlite3.pc.in sqlite3.1
|
||||
|
||||
#
|
||||
# Maintenance note: dist_name must be sqlite-$(PACKAGE_VERSION) so
|
||||
# that tool/mkautoconfamal.sh knows how to find it.
|
||||
#
|
||||
dist_name = sqlite-$(PACKAGE_VERSION)
|
||||
dist_tarball = $(dist_name).tar.gz
|
||||
dist:
|
||||
rm -fr $(dist_name)
|
||||
mkdir -p $(dist_name)
|
||||
cp -rp $(DIST_FILES) $(dist_name)/.
|
||||
rm -f $(dist_name)/tea/configure.ac.in
|
||||
tar czf $(dist_tarball) $(dist_name)
|
||||
rm -fr $(dist_name)
|
||||
ls -l $(dist_tarball)
|
||||
+12
-1
@@ -247,6 +247,12 @@ SESSION = 0
|
||||
RBU = 0
|
||||
!ENDIF
|
||||
|
||||
# Set this to non-0 to enable support for blocking locks.
|
||||
#
|
||||
!IFNDEF SETLK_TIMEOUT
|
||||
SETLK_TIMEOUT = 0
|
||||
!ENDIF
|
||||
|
||||
# Set the source code file to be used by executables and libraries when
|
||||
# they need the amalgamation.
|
||||
#
|
||||
@@ -372,6 +378,10 @@ EXT_FEATURE_FLAGS =
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
!IF $(SETLK_TIMEOUT)!=0
|
||||
OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_SETLK_TIMEOUT
|
||||
!ENDIF
|
||||
|
||||
###############################################################################
|
||||
############################### END OF OPTIONS ################################
|
||||
###############################################################################
|
||||
@@ -1087,5 +1097,6 @@ $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
|
||||
|
||||
clean:
|
||||
del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
|
||||
del /Q *.bsc *.def *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
|
||||
del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
|
||||
del /Q sqlite3.def tclsqlite3.def ctime.c pragma.h 2>NUL
|
||||
del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
This directory contains components use to build an autoconf-ready package
|
||||
of the SQLite amalgamation: sqlite-autoconf-30XXXXXX.tar.gz
|
||||
This directory contains components used to build an autoconf-like
|
||||
package of the SQLite amalgamation: sqlite-autoconf-30XXXXXX.tar.gz
|
||||
|
||||
To build the autoconf amalgamation, run from the top-level:
|
||||
To build the autoconf amalgamation, run from the top of the canonical
|
||||
source tree:
|
||||
|
||||
./configure
|
||||
make amalgamation-tarball
|
||||
|
||||
The amalgamation-tarball target (also available in "main.mk") runs the
|
||||
script tool/mkautoconfamal.sh which does the work. Refer to that script
|
||||
for details.
|
||||
The amalgamation-tarball target (available in "main.mk") runs the
|
||||
script tool/mkautoconfamal.sh which does the work. Refer to that
|
||||
script for details.
|
||||
|
||||
+14
-13
@@ -4,7 +4,7 @@ This package contains:
|
||||
* the sqlite3.h and sqlite3ext.h header files that define the C-language
|
||||
interface to the sqlite3.c library file
|
||||
* the shell.c file used to build the sqlite3 command-line shell program
|
||||
* autoconf/automake installation infrastucture for building on POSIX
|
||||
* autoconf-like installation infrastucture for building on POSIX
|
||||
compliant systems
|
||||
* a Makefile.msc, sqlite3.rc, and Replace.cs for building with Microsoft
|
||||
Visual C++ on Windows
|
||||
@@ -19,13 +19,15 @@ using only generic tools and without having to install TCL. The purpose
|
||||
of this package is to provide that capability.
|
||||
|
||||
This package contains a pre-build SQLite amalgamation file "sqlite3.c"
|
||||
(and its associated header file "sqlite3.h"). Because the amalgamation
|
||||
has been pre-built, no TCL is required.
|
||||
(and its associated header file "sqlite3.h"). Because the
|
||||
amalgamation has been pre-built, no TCL is required for the code
|
||||
generate (the configure script itself is written in TCL but it can use
|
||||
the embedded copy of JimTCL).
|
||||
|
||||
REASONS TO USE THE CANONICAL BUILD SYSTEM RATHER THAN THIS PACKAGE
|
||||
==================================================================
|
||||
|
||||
* the cononical build system allows you to run tests to verify that
|
||||
* the canonical build system allows you to run tests to verify that
|
||||
the build worked
|
||||
* the canonical build system supports more compile-time options
|
||||
* the canonical build system works for any arbitrary check-in to
|
||||
@@ -47,14 +49,12 @@ SUMMARY OF HOW TO BUILD USING THIS PACKAGE
|
||||
BUILDING ON POSIX
|
||||
=================
|
||||
|
||||
The generic installation instructions for autoconf/automake are found
|
||||
in the INSTALL file.
|
||||
The configure script follows common conventions, making it easy
|
||||
to use for anyone who has configured a software tree before.
|
||||
It supports a number of build-time flags, the full list of which
|
||||
can be seen by running:
|
||||
|
||||
The following SQLite specific boolean options are supported:
|
||||
|
||||
--enable-readline use readline in shell tool [default=yes]
|
||||
--enable-threadsafe build a thread-safe library [default=yes]
|
||||
--enable-dynamic-extensions support loadable extensions [default=yes]
|
||||
./configure --help
|
||||
|
||||
The default value for the CFLAGS variable (options passed to the C
|
||||
compiler) includes debugging symbols in the build, resulting in larger
|
||||
@@ -65,10 +65,11 @@ line like this:
|
||||
|
||||
to produce a smaller installation footprint.
|
||||
|
||||
Other SQLite compilation parameters can also be set using CFLAGS. For
|
||||
Many SQLite compilation parameters can be defined by passing flags
|
||||
to the configure script. Others may be passed on in the CFLAGS. For
|
||||
example:
|
||||
|
||||
$ CFLAGS="-Os -DSQLITE_THREADSAFE=0" ./configure
|
||||
$ CFLAGS="-Os -DSQLITE_OMIT_DEPRECATED" ./configure
|
||||
|
||||
|
||||
BUILDING WITH MICROSOFT VISUAL C++
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/do/not/tclsh
|
||||
# ^^^ help out editors which guess this file's content type.
|
||||
#
|
||||
# This is the main autosetup-compatible configure script for the
|
||||
# "autoconf" bundle of the SQLite project.
|
||||
use sqlite-config
|
||||
sqlite-configure autoconf {
|
||||
sqlite-check-common-bins
|
||||
sqlite-check-common-system-deps
|
||||
}
|
||||
@@ -1,270 +0,0 @@
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Supports the following non-standard switches.
|
||||
#
|
||||
# --enable-threadsafe
|
||||
# --enable-readline
|
||||
# --enable-editline
|
||||
# --enable-static-shell
|
||||
# --enable-dynamic-extensions
|
||||
#
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
AC_INIT(sqlite, --SQLITE-VERSION--, http://www.sqlite.org)
|
||||
AC_CONFIG_SRCDIR([sqlite3.c])
|
||||
AC_CONFIG_AUX_DIR([.])
|
||||
|
||||
# Use automake.
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
# Check for required programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_LIBTOOL
|
||||
AC_PROG_MKDIR_P
|
||||
|
||||
# Check for library functions that SQLite can optionally use.
|
||||
AC_CHECK_FUNCS([fdatasync usleep fullfsync localtime_r gmtime_r])
|
||||
AC_FUNC_STRERROR_R
|
||||
|
||||
AC_CONFIG_FILES([Makefile sqlite3.pc])
|
||||
BUILD_CFLAGS=
|
||||
AC_SUBST(BUILD_CFLAGS)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Two options to enable readline compatible libraries:
|
||||
#
|
||||
# --enable-editline
|
||||
# --enable-readline
|
||||
#
|
||||
# Both are enabled by default. If, after command line processing both are
|
||||
# still enabled, the script searches for editline first and automatically
|
||||
# disables readline if it is found. So, to use readline explicitly, the
|
||||
# user must pass "--disable-editline". To disable command line editing
|
||||
# support altogether, "--disable-editline --disable-readline".
|
||||
#
|
||||
# When searching for either library, check for headers before libraries
|
||||
# as some distros supply packages that contain libraries but not header
|
||||
# files, which come as a separate development package.
|
||||
#
|
||||
AC_ARG_ENABLE(editline, [AS_HELP_STRING([--enable-editline],[use BSD libedit])])
|
||||
AC_ARG_ENABLE(readline, [AS_HELP_STRING([--enable-readline],[use readline])])
|
||||
|
||||
AS_IF([ test x"$enable_editline" != xno ],[
|
||||
AC_CHECK_HEADERS([editline/readline.h],[
|
||||
sLIBS=$LIBS
|
||||
LIBS=""
|
||||
AC_SEARCH_LIBS([readline],[edit],[
|
||||
AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline)
|
||||
READLINE_LIBS="$LIBS -ltinfo"
|
||||
enable_readline=no
|
||||
],[],[-ltinfo])
|
||||
AS_UNSET(ac_cv_search_readline)
|
||||
LIBS=$sLIBS
|
||||
])
|
||||
])
|
||||
|
||||
AS_IF([ test x"$enable_readline" != xno ],[
|
||||
AC_CHECK_HEADERS([readline/readline.h],[
|
||||
sLIBS=$LIBS
|
||||
LIBS=""
|
||||
AC_SEARCH_LIBS(tgetent, termcap curses ncurses ncursesw, [], [])
|
||||
AC_SEARCH_LIBS(readline,[readline edit], [
|
||||
AC_DEFINE([HAVE_READLINE],1,Define to use readline or wrapper)
|
||||
READLINE_LIBS=$LIBS
|
||||
])
|
||||
LIBS=$sLIBS
|
||||
])
|
||||
])
|
||||
|
||||
AC_SUBST(READLINE_LIBS)
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --enable-threadsafe
|
||||
#
|
||||
AC_ARG_ENABLE(threadsafe, [AS_HELP_STRING(
|
||||
[--enable-threadsafe], [build a thread-safe library [default=yes]])],
|
||||
[], [enable_threadsafe=yes])
|
||||
if test x"$enable_threadsafe" == "xno"; then
|
||||
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_THREADSAFE=0"
|
||||
else
|
||||
BUILD_CFLAGS="$BUILD_CFLAGS -D_REENTRANT=1 -DSQLITE_THREADSAFE=1"
|
||||
AC_SEARCH_LIBS(pthread_create, pthread)
|
||||
AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
|
||||
fi
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --enable-dynamic-extensions
|
||||
#
|
||||
AC_ARG_ENABLE(dynamic-extensions, [AS_HELP_STRING(
|
||||
[--enable-dynamic-extensions], [support loadable extensions [default=yes]])],
|
||||
[], [enable_dynamic_extensions=yes])
|
||||
if test x"$enable_dynamic_extensions" != "xno"; then
|
||||
AC_SEARCH_LIBS(dlopen, dl)
|
||||
else
|
||||
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_OMIT_LOAD_EXTENSION=1"
|
||||
fi
|
||||
AC_MSG_CHECKING([for whether to support dynamic extensions])
|
||||
AC_MSG_RESULT($enable_dynamic_extensions)
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --enable-math
|
||||
#
|
||||
AC_ARG_ENABLE(math, [AS_HELP_STRING(
|
||||
[--enable-math], [SQL math functions [default=yes]])],
|
||||
[], [enable_math=yes])
|
||||
AC_MSG_CHECKING([SQL math functions])
|
||||
if test x"$enable_math" = "xyes"; then
|
||||
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_MATH_FUNCTIONS"
|
||||
AC_MSG_RESULT([enabled])
|
||||
AC_SEARCH_LIBS(ceil, m)
|
||||
else
|
||||
AC_MSG_RESULT([disabled])
|
||||
fi
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --enable-fts4
|
||||
#
|
||||
AC_ARG_ENABLE(fts4, [AS_HELP_STRING(
|
||||
[--enable-fts4], [include fts4 support [default=yes]])],
|
||||
[], [enable_fts4=yes])
|
||||
AC_MSG_CHECKING([FTS4 extension])
|
||||
if test x"$enable_fts4" = "xyes"; then
|
||||
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS4"
|
||||
AC_MSG_RESULT([enabled])
|
||||
else
|
||||
AC_MSG_RESULT([disabled])
|
||||
fi
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --enable-fts3
|
||||
#
|
||||
AC_ARG_ENABLE(fts3, [AS_HELP_STRING(
|
||||
[--enable-fts3], [include fts3 support [default=no]])],
|
||||
[], [])
|
||||
AC_MSG_CHECKING([FTS3 extension])
|
||||
if test x"$enable_fts3" = "xyes" -a x"$enable_fts4" = "xno"; then
|
||||
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS3"
|
||||
AC_MSG_RESULT([enabled])
|
||||
else
|
||||
AC_MSG_RESULT([disabled])
|
||||
fi
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --enable-fts5
|
||||
#
|
||||
AC_ARG_ENABLE(fts5, [AS_HELP_STRING(
|
||||
[--enable-fts5], [include fts5 support [default=yes]])],
|
||||
[], [enable_fts5=yes])
|
||||
AC_MSG_CHECKING([FTS5 extension])
|
||||
if test x"$enable_fts5" = "xyes"; then
|
||||
AC_MSG_RESULT([enabled])
|
||||
AC_SEARCH_LIBS(log, m)
|
||||
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS5"
|
||||
else
|
||||
AC_MSG_RESULT([disabled])
|
||||
fi
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --enable-rtree
|
||||
#
|
||||
AC_ARG_ENABLE(rtree, [AS_HELP_STRING(
|
||||
[--enable-rtree], [include rtree support [default=yes]])],
|
||||
[], [enable_rtree=yes])
|
||||
AC_MSG_CHECKING([RTREE extension])
|
||||
if test x"$enable_rtree" = "xyes"; then
|
||||
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY"
|
||||
AC_MSG_RESULT([enabled])
|
||||
else
|
||||
AC_MSG_RESULT([disabled])
|
||||
fi
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --enable-session
|
||||
#
|
||||
AC_ARG_ENABLE(session, [AS_HELP_STRING(
|
||||
[--enable-session], [enable the session extension [default=no]])],
|
||||
[], [])
|
||||
AC_MSG_CHECKING([Session extension])
|
||||
if test x"$enable_session" = "xyes"; then
|
||||
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
|
||||
AC_MSG_RESULT([enabled])
|
||||
else
|
||||
AC_MSG_RESULT([disabled])
|
||||
fi
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --enable-debug
|
||||
#
|
||||
AC_ARG_ENABLE(debug, [AS_HELP_STRING(
|
||||
[--enable-debug], [build with debugging features enabled [default=no]])],
|
||||
[], [])
|
||||
AC_MSG_CHECKING([Build type])
|
||||
if test x"$enable_debug" = "xyes"; then
|
||||
BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE"
|
||||
CFLAGS="-g -O0"
|
||||
AC_MSG_RESULT([debug])
|
||||
else
|
||||
AC_MSG_RESULT([release])
|
||||
fi
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --enable-static-shell
|
||||
#
|
||||
AC_ARG_ENABLE(static-shell, [AS_HELP_STRING(
|
||||
[--enable-static-shell],
|
||||
[statically link libsqlite3 into shell tool [default=yes]])],
|
||||
[], [enable_static_shell=yes])
|
||||
if test x"$enable_static_shell" = "xyes"; then
|
||||
EXTRA_SHELL_OBJ=sqlite3-sqlite3.$OBJEXT
|
||||
else
|
||||
EXTRA_SHELL_OBJ=libsqlite3.la
|
||||
fi
|
||||
AC_SUBST(EXTRA_SHELL_OBJ)
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
AC_CHECK_FUNCS(posix_fallocate)
|
||||
AC_CHECK_HEADERS(zlib.h,[
|
||||
AC_SEARCH_LIBS(deflate,z,[BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_HAVE_ZLIB"])
|
||||
])
|
||||
|
||||
AC_SEARCH_LIBS(system,,,[SHELL_CFLAGS="-DSQLITE_NOHAVE_SYSTEM"])
|
||||
AC_SUBST(SHELL_CFLAGS)
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# UPDATE: Maybe it's better if users just set CFLAGS before invoking
|
||||
# configure. This option doesn't really add much...
|
||||
#
|
||||
# --enable-tempstore
|
||||
#
|
||||
# AC_ARG_ENABLE(tempstore, [AS_HELP_STRING(
|
||||
# [--enable-tempstore],
|
||||
# [in-memory temporary tables (never, no, yes, always) [default=no]])],
|
||||
# [], [enable_tempstore=no])
|
||||
# AC_MSG_CHECKING([for whether or not to store temp tables in-memory])
|
||||
# case "$enable_tempstore" in
|
||||
# never ) TEMP_STORE=0 ;;
|
||||
# no ) TEMP_STORE=1 ;;
|
||||
# always ) TEMP_STORE=3 ;;
|
||||
# yes ) TEMP_STORE=3 ;;
|
||||
# * )
|
||||
# TEMP_STORE=1
|
||||
# enable_tempstore=yes
|
||||
# ;;
|
||||
# esac
|
||||
# AC_MSG_RESULT($enable_tempstore)
|
||||
# AC_SUBST(TEMP_STORE)
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
AC_OUTPUT
|
||||
@@ -26,7 +26,7 @@ SQLite that does not require first installing TCL and/or "tclsh".
|
||||
The canonical Makefile in the SQLite source tree provides more
|
||||
capabilities (such as the the ability to run test cases to ensure
|
||||
that the build worked) and is better maintained. The only
|
||||
downside of the canonical Makfile is that it requires a TCL
|
||||
downside of the canonical Makefile is that it requires a TCL
|
||||
installation. But if you are wanting to build the TCL extension for
|
||||
SQLite, then presumably you already have a TCL installation. So why
|
||||
not just use the more-capable and better-maintained canoncal Makefile?
|
||||
|
||||
@@ -19,7 +19,7 @@ dnl to configure the system for the local environment.
|
||||
# so that we create the export library with the dll.
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
AC_INIT([sqlite],[3.48.0])
|
||||
AC_INIT([sqlite],[@VERSION@])
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
|
||||
@@ -93,7 +93,7 @@ TEA_ADD_TCL_SOURCES([])
|
||||
# The --with-system-sqlite causes the TCL bindings to SQLite to use
|
||||
# the system shared library for SQLite rather than statically linking
|
||||
# against its own private copy. This is dangerous and leads to
|
||||
# undersirable dependences and is not recommended.
|
||||
# undesirable dependences and is not recommended.
|
||||
# Patchs from rmax.
|
||||
#--------------------------------------------------------------------
|
||||
AC_ARG_WITH([system-sqlite],
|
||||
+51
-9
@@ -33,12 +33,26 @@ $ ./configure --reference | less
|
||||
That will include any docs from any TCL files in the `./autosetup` dir
|
||||
which contain certain (simple) markup defined by autosetup.
|
||||
|
||||
This project's own autosetup-related APIs are in [proj.tcl][] or
|
||||
[auto.def][]. The former contains helper APIs which are, more or
|
||||
less, portable across projects (that file is re-used as-is in other
|
||||
projects) and all have a `proj-` name prefix. The latter is the main
|
||||
configure script driver and contains related functions which are
|
||||
specific to this tree.
|
||||
This project's own configuration-related TCL code is spread across the
|
||||
following files:
|
||||
|
||||
- [proj.tcl][]: project-agnostic utility code for autosetup-driven
|
||||
projects. This file is designed to be shared between this project,
|
||||
other projects managed under the SQLite/Hwaci umbrella
|
||||
(e.g. Fossil), and personal projects of SQLite's developers. It is
|
||||
essentially an amalgamation of a decade's worth of autosetup-related
|
||||
utility code.
|
||||
- [auto.def][]: the primary driver for the `./configure` process.
|
||||
When we talk about "the configure script," we're referring to
|
||||
this file.
|
||||
- [sqlite-config.tcl][]: utility code which is too project-specific
|
||||
for `proj.tcl`. We split this out of `auto.def` so that it can be
|
||||
used by both `auto.def` and...
|
||||
- [autoconf/auto.def][]: the main driver script for the "autoconf"
|
||||
bundle's configure script. It is essentially a slightly trimmed-down
|
||||
version of the main `auto.def` file. The `autoconf` dir was ported
|
||||
from the Autotools to Autosetup in the 3.49.0 dev cycle but retains
|
||||
the "autoconf" name to minimize downstream disruption.
|
||||
|
||||
|
||||
<a name="apitips"></a>
|
||||
@@ -47,9 +61,11 @@ Autosetup API Tips
|
||||
|
||||
This section briefly covers only APIs which are frequently useful in
|
||||
day-to-day maintenance and might not be immediately recognized as such
|
||||
obvious from a casual perusal of [auto.def][]. The complete docs of
|
||||
those with `proj-` prefix can be found in [proj.tcl][]. The others are
|
||||
scattered around [the TCL files in ./autosetup](/dir/autosetup).
|
||||
obvious from a casual perusal of the relevant TCL files. The complete
|
||||
docs of those with `proj-` prefix can be found in [proj.tcl][] and
|
||||
those with an `sqlite-` prefix are in [sqlite-config.tcl][]. The
|
||||
others are scattered around [the TCL files in
|
||||
./autosetup](/dir/autosetup).
|
||||
|
||||
In (mostly) alphabetical order:
|
||||
|
||||
@@ -180,6 +196,30 @@ APIs must not use `[file normalize]`, but autosetup provides a
|
||||
TCL-only implementation of `[file-normalize]` (note the dash) for
|
||||
portable use in the configure script.
|
||||
|
||||
Known TCL Incompatibilities
|
||||
------------------------------------------------------------------------
|
||||
|
||||
A summary of known incompatibilities in JimTCL
|
||||
|
||||
- **CRNL line endings**: prior to 2025-02-05 `fconfigure -translation ...`
|
||||
was a no-op in JimTCL, and it emits CRNL line endings by default on
|
||||
Windows. Since then, it supports `-translation binary`, which is
|
||||
close enough to `-translation lf` for our purposes. When working
|
||||
with files using the `open` command, it is important to use mode
|
||||
`"rb"` or `"wb"`, as appropriate, so that the output does not get
|
||||
CRNL-mangled on Windows.
|
||||
|
||||
- **`file copy`** does not support multiple source files. See
|
||||
[](/info/61f18c96183867fe) for a workaround.
|
||||
|
||||
- **Regular expressions**:
|
||||
|
||||
- Patterns treat `\nnn` octal values as back-references (which it
|
||||
does not support). Those can be reformulated as demonstrated in
|
||||
[](/info/aeac23359bb681c0).
|
||||
|
||||
- `regsub` does not support the `\y` flag. A workaround is demonstrated
|
||||
in [](/info/c2e5dd791cce3ec4).
|
||||
|
||||
<a name="conventions"></a>
|
||||
Design Conventions
|
||||
@@ -331,8 +371,10 @@ If autosetup is upgraded and this patch is _not_ applied the invoking
|
||||
|
||||
[Autosetup]: https://msteveb.github.io/autosetup/
|
||||
[auto.def]: /file/auto.def
|
||||
[autoconf/auto.def]: /file/autoconf/auto.def
|
||||
[autosetup-git]: https://github.com/msteveb/autosetup
|
||||
[proj.tcl]: /file/autosetup/proj.tcl
|
||||
[sqlite-config.tcl]: /file/autosetup/sqlite-config.tcl
|
||||
[Makefile.in]: /file/Makefile.in
|
||||
[main.mk]: /file/main.mk
|
||||
[JimTCL]: https://jim.tcl.tk
|
||||
|
||||
+8
-4
@@ -1634,8 +1634,8 @@ proc automf_command_reference {} {
|
||||
|
||||
if {[regexp {^#.*@section (.*)$} $line -> section]} {
|
||||
lappend doc($current) [list section $section]
|
||||
continue
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
# Find embedded module names
|
||||
if {[regexp {^#.*@module ([^ ]*)} $line -> modulename]} {
|
||||
@@ -1651,7 +1651,7 @@ proc automf_command_reference {} {
|
||||
if {$cmd eq "synopsis:"} {
|
||||
set current $modulename
|
||||
lappend doc($current) [list section "Module: $modulename"]
|
||||
} else {
|
||||
} else {
|
||||
lappend doc($current) [list subsection $cmd]
|
||||
}
|
||||
|
||||
@@ -2088,8 +2088,12 @@ if {$autosetup(iswin)} {
|
||||
proc split-path {} {
|
||||
split [getenv PATH .] :
|
||||
}
|
||||
# Check for an executable file
|
||||
proc file-isexec {exec} {
|
||||
file executable $exec
|
||||
if {[file executable $exec] && [file isfile $exec]} {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ for tclsh in ./jimsh0 $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6 tclsh8.7; d
|
||||
done
|
||||
echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
|
||||
for cc in ${CC_FOR_BUILD:-cc} gcc; do
|
||||
{ $cc -o jimsh0 "$d/jimsh0.c"; } >/dev/null 2>&1 || continue
|
||||
{ $cc -o jimsh0 "$d/jimsh0.c"; } 2>/dev/null >/dev/null || continue
|
||||
./jimsh0 "$d/${1-autosetup-test-tclsh}" && exit 0
|
||||
done
|
||||
echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
|
||||
|
||||
+48
-13
@@ -1198,6 +1198,11 @@ int Jim_OpenForRead(const char *filename);
|
||||
#define Jim_FileStat _fstat64
|
||||
#define Jim_Lseek _lseeki64
|
||||
#define O_TEXT _O_TEXT
|
||||
#define O_BINARY _O_BINARY
|
||||
#define Jim_SetMode _setmode
|
||||
#ifndef STDIN_FILENO
|
||||
#define STDIN_FILENO 0
|
||||
#endif
|
||||
|
||||
#else
|
||||
#if defined(HAVE_STAT64)
|
||||
@@ -1247,6 +1252,14 @@ int Jim_OpenForRead(const char *filename);
|
||||
|
||||
#endif
|
||||
|
||||
# ifndef MAXPATHLEN
|
||||
# ifdef PATH_MAX
|
||||
# define MAXPATHLEN PATH_MAX
|
||||
# else
|
||||
# define MAXPATHLEN JIM_PATH_LEN
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
||||
int Jim_FileStoreStatData(Jim_Interp *interp, Jim_Obj *varName, const jim_stat_t *sb);
|
||||
|
||||
@@ -1864,7 +1877,7 @@ int Jim_tclcompatInit(Jim_Interp *interp)
|
||||
" $f buffering $v\n"
|
||||
" }\n"
|
||||
" -tr* {\n"
|
||||
"\n"
|
||||
" $f translation $v\n"
|
||||
" }\n"
|
||||
" default {\n"
|
||||
" return -code error \"fconfigure: unknown option $n\"\n"
|
||||
@@ -2083,10 +2096,6 @@ enum wbuftype {
|
||||
#define UNIX_SOCKETS 0
|
||||
#endif
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN JIM_PATH_LEN
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2936,6 +2945,28 @@ static int aio_cmd_buffering(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
return JIM_OK;
|
||||
}
|
||||
|
||||
static int aio_cmd_translation(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
{
|
||||
enum {OPT_BINARY, OPT_TEXT};
|
||||
static const char * const options[] = {
|
||||
"binary",
|
||||
"text",
|
||||
NULL
|
||||
};
|
||||
int opt;
|
||||
|
||||
if (Jim_GetEnum(interp, argv[0], options, &opt, NULL, JIM_ERRMSG) != JIM_OK) {
|
||||
return JIM_ERR;
|
||||
}
|
||||
#if defined(Jim_SetMode)
|
||||
else {
|
||||
AioFile *af = Jim_CmdPrivData(interp);
|
||||
Jim_SetMode(af->fd, opt == OPT_BINARY ? O_BINARY : O_TEXT);
|
||||
}
|
||||
#endif
|
||||
return JIM_OK;
|
||||
}
|
||||
|
||||
static int aio_cmd_readsize(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
{
|
||||
AioFile *af = Jim_CmdPrivData(interp);
|
||||
@@ -3145,6 +3176,13 @@ static const jim_subcmd_type aio_command_table[] = {
|
||||
0,
|
||||
2,
|
||||
|
||||
},
|
||||
{ "translation",
|
||||
"binary|text",
|
||||
aio_cmd_translation,
|
||||
1,
|
||||
1,
|
||||
|
||||
},
|
||||
{ "readsize",
|
||||
"?size?",
|
||||
@@ -4139,14 +4177,6 @@ int Jim_regexpInit(Jim_Interp *interp)
|
||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
# ifndef MAXPATHLEN
|
||||
# ifdef PATH_MAX
|
||||
# define MAXPATHLEN PATH_MAX
|
||||
# else
|
||||
# define MAXPATHLEN JIM_PATH_LEN
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#if defined(__MINGW32__) || defined(__MSYS__) || defined(_MSC_VER)
|
||||
#define ISWINDOWS 1
|
||||
|
||||
@@ -24425,6 +24455,10 @@ int main(int argc, char *const argv[])
|
||||
}
|
||||
if (retcode != JIM_EXIT) {
|
||||
JimSetArgv(interp, 0, NULL);
|
||||
if (!isatty(STDIN_FILENO)) {
|
||||
|
||||
goto eval_stdin;
|
||||
}
|
||||
retcode = Jim_InteractivePrompt(interp);
|
||||
}
|
||||
}
|
||||
@@ -24447,6 +24481,7 @@ int main(int argc, char *const argv[])
|
||||
Jim_SetVariableStr(interp, "argv0", Jim_NewStringObj(interp, argv[1], -1));
|
||||
JimSetArgv(interp, argc - 2, argv + 2);
|
||||
if (strcmp(argv[1], "-") == 0) {
|
||||
eval_stdin:
|
||||
retcode = Jim_Eval(interp, "eval [info source [stdin read] stdin 1]");
|
||||
} else {
|
||||
retcode = Jim_EvalFile(interp, argv[1]);
|
||||
|
||||
+136
-53
@@ -114,11 +114,13 @@ proc proj-bold {str} {
|
||||
#
|
||||
# If the -notice flag it used then it emits using [user-notice], which
|
||||
# means its rendering will (A) go to stderr and (B) be delayed until
|
||||
# the next time autosetup goes to output a message. If -notice
|
||||
# is not used, it will send the message to stdout without delay.
|
||||
# the next time autosetup goes to output a message.
|
||||
#
|
||||
# If the -error flag is provided then it renders the message
|
||||
# immediately to stderr and then exits.
|
||||
#
|
||||
# If neither -notice nor -error are used, the message will be sent to
|
||||
# stdout without delay.
|
||||
proc proj-indented-notice {args} {
|
||||
set fErr ""
|
||||
set outFunc "puts"
|
||||
@@ -126,6 +128,7 @@ proc proj-indented-notice {args} {
|
||||
switch -exact -- [lindex $args 0] {
|
||||
-error {
|
||||
set args [lassign $args fErr]
|
||||
set outFunc "user-notice"
|
||||
}
|
||||
-notice {
|
||||
set args [lassign $args -]
|
||||
@@ -181,10 +184,10 @@ proc proj-lshift_ {listVar {count 1}} {
|
||||
|
||||
########################################################################
|
||||
# Expects to receive string input, which it splits on newlines, strips
|
||||
# out any lines which begin with an number of whitespace followed by a
|
||||
# '#', and returns a value containing the [append]ed results of each
|
||||
# out any lines which begin with any number of whitespace followed by
|
||||
# a '#', and returns a value containing the [append]ed results of each
|
||||
# remaining line with a \n between each.
|
||||
proc proj-strip-hash-comments_ {val} {
|
||||
proc proj-strip-hash-comments {val} {
|
||||
set x {}
|
||||
foreach line [split $val \n] {
|
||||
if {![string match "#*" [string trimleft $line]]} {
|
||||
@@ -194,16 +197,42 @@ proc proj-strip-hash-comments_ {val} {
|
||||
return $x
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# @proj-cflags-without-werror
|
||||
#
|
||||
# Fetches [define $var], strips out any -Werror entries, and returns
|
||||
# the new value. This is intended for temporarily stripping -Werror
|
||||
# from CFLAGS or CPPFLAGS within the scope of a [define-push] block.
|
||||
proc proj-cflags-without-werror {{var CFLAGS}} {
|
||||
set rv {}
|
||||
foreach f [get-define $var ""] {
|
||||
switch -exact -- $f {
|
||||
-Werror {}
|
||||
default { lappend rv $f }
|
||||
}
|
||||
}
|
||||
return [join $rv " "]
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# @proj-check-function-in-lib
|
||||
#
|
||||
# A proxy for cc-check-function-in-lib which does not make any global
|
||||
# changes to the LIBS define. Returns the result of
|
||||
# cc-check-function-in-lib (i.e. true or false). The resulting linker
|
||||
# flags are stored in ${lib_${function}}.
|
||||
# A proxy for cc-check-function-in-lib with the following differences:
|
||||
#
|
||||
# - Does not make any global changes to the LIBS define.
|
||||
#
|
||||
# - Strips out -W... warning flags from CFLAGS before running the
|
||||
# test, as these feature tests will often fail if -Werror is used.
|
||||
#
|
||||
# Returns the result of cc-check-function-in-lib (i.e. true or false).
|
||||
# The resulting linker flags are stored in the [define] named
|
||||
# lib_${function}.
|
||||
proc proj-check-function-in-lib {function libs {otherlibs {}}} {
|
||||
set found 0
|
||||
define-push {LIBS} {
|
||||
define-push {LIBS CFLAGS} {
|
||||
#puts "CFLAGS before=[get-define CFLAGS]"
|
||||
define CFLAGS [proj-cflags-without-werror]
|
||||
#puts "CFLAGS after =[get-define CFLAGS]"
|
||||
set found [cc-check-function-in-lib $function $libs $otherlibs]
|
||||
}
|
||||
return $found
|
||||
@@ -276,9 +305,9 @@ proc proj-find-executable-path {args} {
|
||||
# a binary, sets a define (see below) to the result, and returns the
|
||||
# result (an empty string if not found).
|
||||
#
|
||||
# The define'd name is: if defName is empty then "BIN_X" is used,
|
||||
# where X is the upper-case form of $binName with any '-' characters
|
||||
# replaced with '_'.
|
||||
# The define'd name is: If $defName is not empty, it is used as-is. If
|
||||
# $defName is empty then "BIN_X" is used, where X is the upper-case
|
||||
# form of $binName with any '-' characters replaced with '_'.
|
||||
proc proj-bin-define {binName {defName {}}} {
|
||||
set check [proj-find-executable-path -v $binName]
|
||||
if {"" eq $defName} {
|
||||
@@ -350,7 +379,6 @@ proc proj-opt-was-provided {key} {
|
||||
#
|
||||
# Returns $val.
|
||||
proc proj-opt-set {flag {val 1}} {
|
||||
global autosetup
|
||||
if {$flag ni $::autosetup(options)} {
|
||||
# We have to add this to autosetup(options) or else future calls
|
||||
# to [opt-bool $flag] will fail validation of $flag.
|
||||
@@ -360,6 +388,15 @@ proc proj-opt-set {flag {val 1}} {
|
||||
return $val
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# @proj-opt-exists flag
|
||||
#
|
||||
# Returns 1 if the given flag has been defined as a legal configure
|
||||
# option, else returns 0.
|
||||
proc proj-opt-exists {flag} {
|
||||
expr {$flag in $::autosetup(options)};
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# @proj-val-truthy val
|
||||
#
|
||||
@@ -760,7 +797,7 @@ proc proj-exe-extension {} {
|
||||
# Trivia: for .dylib files, the linker needs the -dynamiclib flag
|
||||
# instead of -shared.
|
||||
proc proj-dll-extension {} {
|
||||
proc inner {key} {
|
||||
set inner {{key} {
|
||||
switch -glob -- [get-define $key] {
|
||||
*apple* {
|
||||
return ".dylib"
|
||||
@@ -772,9 +809,9 @@ proc proj-dll-extension {} {
|
||||
return ".so"
|
||||
}
|
||||
}
|
||||
}
|
||||
define BUILD_DLLEXT [inner build]
|
||||
define TARGET_DLLEXT [inner host]
|
||||
}}
|
||||
define BUILD_DLLEXT [apply $inner build]
|
||||
define TARGET_DLLEXT [apply $inner host]
|
||||
}
|
||||
|
||||
########################################################################
|
||||
@@ -784,18 +821,20 @@ proc proj-dll-extension {} {
|
||||
# BUILD_LIBEXT and TARGET_LIBEXT to the conventional static library
|
||||
# extension for the being-built-on resp. the target platform.
|
||||
proc proj-lib-extension {} {
|
||||
proc inner {key} {
|
||||
set inner {{key} {
|
||||
switch -glob -- [get-define $key] {
|
||||
*-*-ming* - *-*-cygwin - *-*-msys {
|
||||
return ".lib"
|
||||
return ".a"
|
||||
# ^^^ this was ".lib" until 2025-02-07. See
|
||||
# https://sqlite.org/forum/forumpost/02db2d4240
|
||||
}
|
||||
default {
|
||||
return ".a"
|
||||
}
|
||||
}
|
||||
}
|
||||
define BUILD_LIBEXT [inner build]
|
||||
define TARGET_LIBEXT [inner host]
|
||||
}}
|
||||
define BUILD_LIBEXT [apply $inner build]
|
||||
define TARGET_LIBEXT [apply $inner host]
|
||||
}
|
||||
|
||||
########################################################################
|
||||
@@ -850,16 +889,16 @@ proc proj-affirm-files-exist {args} {
|
||||
# If the given directory is found, it expects to find emsdk_env.sh in
|
||||
# that directory, as well as the emcc compiler somewhere under there.
|
||||
#
|
||||
# If the --with-emsdk flag is explicitly provided and the SDK is not
|
||||
# found then a fatal error is generated, otherwise failure to find the
|
||||
# SDK is not fatal.
|
||||
# If the --with-emsdk[=DIR] flag is explicitly provided and the SDK is
|
||||
# not found then a fatal error is generated, otherwise failure to find
|
||||
# the SDK is not fatal.
|
||||
#
|
||||
# Defines the following:
|
||||
#
|
||||
# - EMSDK_HOME = top dir of the emsdk or "".
|
||||
# - EMSDK_ENV_SH = path to EMSDK_HOME/emsdk_env.sh or ""
|
||||
# - BIN_EMCC = $EMSDK_HOME/upstream/emscripten/emcc or ""
|
||||
# - HAVE_EMSDK = 0 or 1 (this function's return value)
|
||||
# - EMSDK_HOME = "" or top dir of the emsdk
|
||||
# - EMSDK_ENV_SH = "" or $EMSDK_HOME/emsdk_env.sh
|
||||
# - BIN_EMCC = "" or $EMSDK_HOME/upstream/emscripten/emcc
|
||||
#
|
||||
# Returns 1 if EMSDK_ENV_SH is found, else 0. If EMSDK_HOME is not empty
|
||||
# but BIN_EMCC is then emcc was not found in the EMSDK_HOME, in which
|
||||
@@ -902,6 +941,35 @@ proc proj-check-emsdk {} {
|
||||
return $rc
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# @proj-cc-check-Wl-flag ?flag ?args??
|
||||
#
|
||||
# Checks whether the given linker flag (and optional arguments) can be
|
||||
# passed from the compiler to the linker using one of these formats:
|
||||
#
|
||||
# - -Wl,flag[,arg1[,...argN]]
|
||||
# - -Wl,flag -Wl,arg1 ...-Wl,argN
|
||||
#
|
||||
# If so, that flag string is returned, else an empty string is
|
||||
# returned.
|
||||
proc proj-cc-check-Wl-flag {args} {
|
||||
cc-with {-link 1} {
|
||||
# Try -Wl,flag,...args
|
||||
set fli "-Wl"
|
||||
foreach f $args { append fli ",$f" }
|
||||
if {[cc-check-flags $fli]} {
|
||||
return $fli
|
||||
}
|
||||
# Try -Wl,flag -Wl,arg1 ...-Wl,argN
|
||||
set fli ""
|
||||
foreach f $args { append fli "-Wl,$f " }
|
||||
if {[cc-check-flags $fli]} {
|
||||
return [string trim $fli]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# @proj-check-rpath
|
||||
#
|
||||
@@ -913,12 +981,7 @@ proc proj-check-emsdk {} {
|
||||
# --exec-prefix=... or --libdir=... are explicitly passed to
|
||||
# configure then [get-define libdir] is used (noting that it derives
|
||||
# from exec-prefix by default).
|
||||
#
|
||||
# Achtung: we have seen platforms which report that a given option
|
||||
# checked here will work but then fails at build-time, and the current
|
||||
# order of checks reflects that.
|
||||
proc proj-check-rpath {} {
|
||||
set rc 1
|
||||
if {[proj-opt-was-provided libdir]
|
||||
|| [proj-opt-was-provided exec-prefix]} {
|
||||
set lp "[get-define libdir]"
|
||||
@@ -929,21 +992,18 @@ proc proj-check-rpath {} {
|
||||
# CFLAGS or LIBS or whatever it is that cc-check-flags updates) then
|
||||
# downstream tests may fail because the resulting rpath gets
|
||||
# implicitly injected into them.
|
||||
cc-with {} {
|
||||
cc-with {-link 1} {
|
||||
if {[cc-check-flags "-rpath $lp"]} {
|
||||
define LDFLAGS_RPATH "-rpath $lp"
|
||||
} elseif {[cc-check-flags "-Wl,-rpath,$lp"]} {
|
||||
define LDFLAGS_RPATH "-Wl,-rpath,$lp"
|
||||
} elseif {[cc-check-flags "-Wl,-rpath -Wl,$lp"]} {
|
||||
define LDFLAGS_RPATH "-Wl,-rpath -Wl,$lp"
|
||||
} elseif {[cc-check-flags -Wl,-R$lp]} {
|
||||
define LDFLAGS_RPATH "-Wl,-R$lp"
|
||||
} else {
|
||||
define LDFLAGS_RPATH ""
|
||||
set rc 0
|
||||
set wl [proj-cc-check-Wl-flag -rpath $lp]
|
||||
if {"" eq $wl} {
|
||||
set wl [proj-cc-check-Wl-flag -R$lp]
|
||||
}
|
||||
define LDFLAGS_RPATH $wl
|
||||
}
|
||||
}
|
||||
return $rc
|
||||
expr {"" ne [get-define LDFLAGS_RPATH]}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
@@ -960,7 +1020,7 @@ proc proj-check-rpath {} {
|
||||
# potentially avoid some end-user confusion by using their own lib's
|
||||
# name here (which shows up in the "checking..." output).
|
||||
proc proj-check-soname {{libname "libfoo.so.0"}} {
|
||||
cc-with {} {
|
||||
cc-with {-link 1} {
|
||||
if {[cc-check-flags "-Wl,-soname,${libname}"]} {
|
||||
define LDFLAGS_SONAME_PREFIX "-Wl,-soname,"
|
||||
return 1
|
||||
@@ -971,6 +1031,29 @@ proc proj-check-soname {{libname "libfoo.so.0"}} {
|
||||
}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# @proj-check-fsanitize ?list-of-opts?
|
||||
#
|
||||
# Checks whether CC supports -fsanitize=X, where X is each entry of
|
||||
# the given list of flags. If any of those flags are supported, it
|
||||
# returns the string "-fsanitize=X..." where X... is a comma-separated
|
||||
# list of all supported flags. If none of the given options are
|
||||
# supported then it returns an empty string.
|
||||
proc proj-check-fsanitize {{opts {address bounds-strict}}} {
|
||||
set sup {}
|
||||
foreach opt $opts {
|
||||
cc-with {} {
|
||||
if {[cc-check-flags "-fsanitize=$opt"]} {
|
||||
lappend sup $opt
|
||||
}
|
||||
}
|
||||
}
|
||||
if {[llength $sup] > 0} {
|
||||
return "-fsanitize=[join $sup ,]"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
########################################################################
|
||||
# Internal helper for proj-dump-defs-json. Expects to be passed a
|
||||
# [define] name and the variadic $args which are passed to
|
||||
@@ -1119,7 +1202,7 @@ proc proj-dump-defs-json {file args} {
|
||||
# that [opt-value canonical] will return X if --alias=X is passed to
|
||||
# configure.
|
||||
proc proj-xfer-options-aliases {mapping} {
|
||||
foreach {hidden - canonical} [proj-strip-hash-comments_ $mapping] {
|
||||
foreach {hidden - canonical} [proj-strip-hash-comments $mapping] {
|
||||
if {[proj-opt-was-provided $hidden]} {
|
||||
if {[proj-opt-was-provided $canonical]} {
|
||||
proj-fatal "both --$canonical and its alias --$hidden were used. Use only one or the other."
|
||||
@@ -1133,7 +1216,7 @@ proc proj-xfer-options-aliases {mapping} {
|
||||
########################################################################
|
||||
# Arguable/debatable...
|
||||
#
|
||||
# When _not_ cross-compiling and CC_FOR_BUILD is _not_ explcitely
|
||||
# When _not_ cross-compiling and CC_FOR_BUILD is _not_ explicitly
|
||||
# specified, force CC_FOR_BUILD to be the same as CC, so that:
|
||||
#
|
||||
# ./configure CC=clang
|
||||
@@ -1141,7 +1224,7 @@ proc proj-xfer-options-aliases {mapping} {
|
||||
# will use CC_FOR_BUILD=clang, instead of cc, for building in-tree
|
||||
# tools. This is based off of an email discussion and is thought to
|
||||
# be likely to cause less confusion than seeing 'cc' invocations
|
||||
# will when the user passes CC=clang.
|
||||
# when when the user passes CC=clang.
|
||||
#
|
||||
# Sidebar: if we do this before the cc package is installed, it gets
|
||||
# reverted by that package. Ergo, the cc package init will tell the
|
||||
@@ -1186,11 +1269,11 @@ proc proj-which-linenoise {dotH} {
|
||||
#
|
||||
# In that make invocation, $(libdir) would, at make-time, normally be
|
||||
# hard-coded to /foo/lib, rather than /blah/lib. That happens because
|
||||
# the autosetup exports conventional $prefix-based values for the
|
||||
# numerous autoconfig-compatible XYZdir vars at configure-time. What
|
||||
# we would normally want, however, is that --libdir derives from the
|
||||
# make-time $(prefix). The distinction between configure-time and
|
||||
# make-time is the significant factor there.
|
||||
# autosetup exports conventional $prefix-based values for the numerous
|
||||
# autoconfig-compatible XYZdir vars at configure-time. What we would
|
||||
# normally want, however, is that --libdir derives from the make-time
|
||||
# $(prefix). The distinction between configure-time and make-time is
|
||||
# the significant factor there.
|
||||
#
|
||||
# This function attempts to reconcile those vars in such a way that
|
||||
# they will derive, at make-time, from $(prefix) in a conventional
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -567,7 +567,7 @@ proc sqlitecon::Cut w {
|
||||
}
|
||||
}
|
||||
|
||||
# Do a paste opeation.
|
||||
# Do a paste operation.
|
||||
#
|
||||
proc sqlitecon::Paste w {
|
||||
if {[sqlitecon::canCut $w]==1} {
|
||||
|
||||
@@ -43,8 +43,13 @@ systems, including MacOS.
|
||||
or <https://sqlite.org/tmp/tcl9.0.0.tar.gz>.
|
||||
<li>Untar or unzip the source archive. CD into the "win/" subfolder
|
||||
of the source tree.
|
||||
<li>Run: `nmake /f makefile.vc release`
|
||||
<li>Run: `nmake /f makefile.vc INSTALLDIR=c:\Tcl install`
|
||||
<li>Run: `nmake /f makefile.vc INSTALLDIR=c:\Tcl release`
|
||||
<li>Run: `nmake /f makefile.vc INSTALLDIR=c:\Tcl install` <br>
|
||||
Notes:
|
||||
<ol type="i">
|
||||
<li> The previous two `nmake` commands must be run separately.
|
||||
<li> Also, the INSTALLDIR=... argument is required on both.
|
||||
</ol>
|
||||
<li><i>Optional:</i> CD to `c:\Tcl\bin` and make a copy of
|
||||
`tclsh90.exe` over into just `tclsh.exe`.
|
||||
<li><i>Optional:</i>
|
||||
|
||||
+1
-1
@@ -281,7 +281,7 @@ happen if and when they are actually needed.
|
||||
A valid JSONB BLOB consists of a single JSON element. The element must
|
||||
exactly fill the BLOB. This one element is often a JSON object or array
|
||||
and those usually contain additional elements as its payload, but the
|
||||
element can be a primite value such a string, number, boolean, or null.
|
||||
element can be a primitive value such a string, number, boolean, or null.
|
||||
|
||||
When the built-in JSON functions are attempting to determine if a BLOB
|
||||
argument is a JSONB or just a random BLOB, they look at the header of
|
||||
|
||||
+1
-1
@@ -881,7 +881,7 @@ is allowed between the "%" and the directive name.</p>
|
||||
<p>Grammar text in between "<tt>%ifdef MACRO</tt>" and the next nested
|
||||
"<tt>%endif</tt>" is
|
||||
ignored unless the "-DMACRO" command-line option is used. Grammar text
|
||||
betwen "<tt>%ifndef MACRO</tt>" and the next nested "<tt>%endif</tt>" is
|
||||
between "<tt>%ifndef MACRO</tt>" and the next nested "<tt>%endif</tt>" is
|
||||
included except when the "-DMACRO" command-line option is used.<p>
|
||||
|
||||
<p>The text in between "<tt>%if</tt> <i>CONDITIONAL</i>" and its
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
*** Definition: Two databases (or the same database at two points it time)
|
||||
are said to be "logically equivalent" if they give the same answer to
|
||||
all queries. Note in particular the content of freelist leaf
|
||||
pages can be changed arbitarily without effecting the logical equivalence
|
||||
pages can be changed arbitrarily without effecting the logical equivalence
|
||||
of the database.
|
||||
|
||||
(7) At any time, if any subset, including the empty set and the total set,
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
The 5 states of an historical rollback lock as implemented by the
|
||||
xLock, xUnlock, and xCheckReservedLock methods of the sqlite3_io_methods
|
||||
objec are:
|
||||
object are:
|
||||
|
||||
UNLOCKED
|
||||
SHARED
|
||||
@@ -58,7 +58,7 @@ The meanings of the various wal-index locking states is as follows:
|
||||
|
||||
A particular lock manager implementation may coalesce one or more of
|
||||
the wal-index locking states, though with a reduction in concurrency.
|
||||
For example, an implemention might implement only exclusive locking,
|
||||
For example, an implementation might implement only exclusive locking,
|
||||
in which case all states would be equivalent to CHECKPOINT, meaning that
|
||||
only one reader or one writer or one checkpointer could be active at a
|
||||
time. Or, an implementation might combine READ and READ_FULL into
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ facilitates transfer of OS priority between processes when a high priority
|
||||
process is blocked by a lower priority one.
|
||||
|
||||
Only read/write clients use blocking locks. Clients that have read-only access
|
||||
to the \*-shm file nevery use blocking locks.
|
||||
to the \*-shm file never use blocking locks.
|
||||
|
||||
Threads or processes that access a single database at a time never deadlock as
|
||||
a result of blocking database locks. But it is of course possible for threads
|
||||
|
||||
@@ -2052,7 +2052,7 @@ sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){
|
||||
sqlite3_set_authorizer(pNew->dbv, idxAuthCallback, (void*)pNew);
|
||||
}
|
||||
|
||||
/* If an error has occurred, free the new object and reutrn NULL. Otherwise,
|
||||
/* If an error has occurred, free the new object and return NULL. Otherwise,
|
||||
** return the new sqlite3expert handle. */
|
||||
if( rc!=SQLITE_OK ){
|
||||
sqlite3_expert_destroy(pNew);
|
||||
|
||||
@@ -62,20 +62,20 @@
|
||||
matches rows that contain both the "engineering" and "consultancy" tokens
|
||||
in the same column with not more than 10 other words between them. It does
|
||||
not matter which of the two terms occurs first in the document, only that
|
||||
they be seperated by only 10 tokens or less. The user may also specify
|
||||
they be separated by only 10 tokens or less. The user may also specify
|
||||
a different required proximity by adding "/N" immediately after the NEAR
|
||||
operator, where N is an integer. For example:
|
||||
|
||||
<col> MATCH 'engineering NEAR/5 consultancy'
|
||||
|
||||
searches for a row containing an instance of each specified token seperated
|
||||
searches for a row containing an instance of each specified token separated
|
||||
by not more than 5 other tokens. More than one NEAR operator can be used
|
||||
in as sequence. For example this query:
|
||||
|
||||
<col> MATCH 'reliable NEAR/2 engineering NEAR/5 consultancy'
|
||||
|
||||
searches for a row that contains an instance of the token "reliable"
|
||||
seperated by not more than two tokens from an instance of "engineering",
|
||||
separated by not more than two tokens from an instance of "engineering",
|
||||
which is in turn separated by not more than 5 other tokens from an
|
||||
instance of the term "consultancy". Phrases enclosed in quotes may
|
||||
also be used as arguments to the NEAR operator.
|
||||
@@ -146,7 +146,7 @@
|
||||
<col> MATCH '(hello world) OR (simple example)'
|
||||
|
||||
matches documents that contain both "hello" and "world", and documents
|
||||
that contain both "simple" and "example". It is not possible to forumlate
|
||||
that contain both "simple" and "example". It is not possible to formulate
|
||||
such a query using the standard syntax.
|
||||
|
||||
2) Instead of separating tokens and phrases by whitespace, an AND operator
|
||||
@@ -174,7 +174,7 @@
|
||||
|
||||
4) Unlike in the standard syntax, where the OR operator has a higher
|
||||
precedence than the implicit AND operator, when using the enhanced
|
||||
syntax implicit and explict AND operators have a higher precedence
|
||||
syntax implicit and explicit AND operators have a higher precedence
|
||||
than OR operators. Using the enhanced syntax, the following two
|
||||
queries are equivalent:
|
||||
|
||||
|
||||
+23
-5
@@ -87,7 +87,7 @@
|
||||
** Here, array { X } means zero or more occurrences of X, adjacent in
|
||||
** memory. A "position" is an index of a token in the token stream
|
||||
** generated by the tokenizer. Note that POS_END and POS_COLUMN occur
|
||||
** in the same logical place as the position element, and act as sentinals
|
||||
** in the same logical place as the position element, and act as sentinels
|
||||
** ending a position list array. POS_END is 0. POS_COLUMN is 1.
|
||||
** The positions numbers are not stored literally but rather as two more
|
||||
** than the difference from the prior position, or the just the position plus
|
||||
@@ -2639,7 +2639,7 @@ static int fts3DoclistOrMerge(
|
||||
** sizes of the two inputs, plus enough space for exactly one of the input
|
||||
** docids to grow.
|
||||
**
|
||||
** A symetric argument may be made if the doclists are in descending
|
||||
** A symmetric argument may be made if the doclists are in descending
|
||||
** order.
|
||||
*/
|
||||
aOut = sqlite3_malloc64((i64)n1+n2+FTS3_VARINT_MAX-1+FTS3_BUFFER_PADDING);
|
||||
@@ -4438,7 +4438,7 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){
|
||||
nDistance = iPrev - nMaxUndeferred;
|
||||
}
|
||||
|
||||
aOut = (char *)sqlite3Fts3MallocZero(nPoslist+FTS3_BUFFER_PADDING);
|
||||
aOut = (char *)sqlite3Fts3MallocZero(((i64)nPoslist)+FTS3_BUFFER_PADDING);
|
||||
if( !aOut ){
|
||||
sqlite3_free(aPoslist);
|
||||
return SQLITE_NOMEM;
|
||||
@@ -4737,7 +4737,7 @@ static int incrPhraseTokenNext(
|
||||
**
|
||||
** * does not contain any deferred tokens.
|
||||
**
|
||||
** Advance it to the next matching documnent in the database and populate
|
||||
** Advance it to the next matching document in the database and populate
|
||||
** the Fts3Doclist.pList and nList fields.
|
||||
**
|
||||
** If there is no "next" entry and no error occurs, then *pbEof is set to
|
||||
@@ -5744,7 +5744,7 @@ static int fts3EvalNext(Fts3Cursor *pCsr){
|
||||
}
|
||||
|
||||
/*
|
||||
** Restart interation for expression pExpr so that the next call to
|
||||
** Restart iteration for expression pExpr so that the next call to
|
||||
** fts3EvalNext() visits the first row. Do not allow incremental
|
||||
** loading or merging of phrase doclists for this iteration.
|
||||
**
|
||||
@@ -5787,6 +5787,24 @@ static void fts3EvalRestart(
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Expression node pExpr is an MSR phrase. This function restarts pExpr
|
||||
** so that it is a regular phrase query, not an MSR. SQLITE_OK is returned
|
||||
** if successful, or an SQLite error code otherwise.
|
||||
*/
|
||||
int sqlite3Fts3MsrCancel(Fts3Cursor *pCsr, Fts3Expr *pExpr){
|
||||
int rc = SQLITE_OK;
|
||||
if( pExpr->bEof==0 ){
|
||||
i64 iDocid = pExpr->iDocid;
|
||||
fts3EvalRestart(pCsr, pExpr, &rc);
|
||||
while( rc==SQLITE_OK && pExpr->iDocid!=iDocid ){
|
||||
fts3EvalNextRow(pCsr, pExpr, &rc);
|
||||
if( pExpr->bEof ) rc = FTS_CORRUPT_VTAB;
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** After allocating the Fts3Expr.aMI[] array for each phrase in the
|
||||
** expression rooted at pExpr, the cursor iterates through all rows matched
|
||||
|
||||
+21
-3
@@ -202,6 +202,19 @@ typedef sqlite3_int64 i64; /* 8-byte signed integer */
|
||||
|
||||
#define deliberate_fall_through
|
||||
|
||||
/*
|
||||
** Macros needed to provide flexible arrays in a portable way
|
||||
*/
|
||||
#ifndef offsetof
|
||||
# define offsetof(STRUCTURE,FIELD) ((size_t)((char*)&((STRUCTURE*)0)->FIELD))
|
||||
#endif
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
# define FLEXARRAY
|
||||
#else
|
||||
# define FLEXARRAY 1
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* SQLITE_AMALGAMATION */
|
||||
|
||||
#ifdef SQLITE_DEBUG
|
||||
@@ -306,7 +319,7 @@ struct Fts3Table {
|
||||
#endif
|
||||
|
||||
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
|
||||
/* True to disable the incremental doclist optimization. This is controled
|
||||
/* True to disable the incremental doclist optimization. This is controlled
|
||||
** by special insert command 'test-no-incr-doclist'. */
|
||||
int bNoIncrDoclist;
|
||||
|
||||
@@ -358,7 +371,7 @@ struct Fts3Cursor {
|
||||
|
||||
/*
|
||||
** The Fts3Cursor.eSearch member is always set to one of the following.
|
||||
** Actualy, Fts3Cursor.eSearch can be greater than or equal to
|
||||
** Actually, Fts3Cursor.eSearch can be greater than or equal to
|
||||
** FTS3_FULLTEXT_SEARCH. If so, then Fts3Cursor.eSearch - 2 is the index
|
||||
** of the column to be searched. For example, in
|
||||
**
|
||||
@@ -431,9 +444,13 @@ struct Fts3Phrase {
|
||||
*/
|
||||
int nToken; /* Number of tokens in the phrase */
|
||||
int iColumn; /* Index of column this phrase must match */
|
||||
Fts3PhraseToken aToken[1]; /* One entry for each token in the phrase */
|
||||
Fts3PhraseToken aToken[FLEXARRAY]; /* One for each token in the phrase */
|
||||
};
|
||||
|
||||
/* Size (in bytes) of an Fts3Phrase object large enough to hold N tokens */
|
||||
#define SZ_FTS3PHRASE(N) \
|
||||
(offsetof(Fts3Phrase,aToken)+(N)*sizeof(Fts3PhraseToken))
|
||||
|
||||
/*
|
||||
** A tree of these objects forms the RHS of a MATCH operator.
|
||||
**
|
||||
@@ -640,6 +657,7 @@ int sqlite3Fts3MsrIncrNext(
|
||||
int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **);
|
||||
int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);
|
||||
int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);
|
||||
int sqlite3Fts3MsrCancel(Fts3Cursor*, Fts3Expr*);
|
||||
|
||||
/* fts3_tokenize_vtab.c */
|
||||
int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *, void(*xDestroy)(void*));
|
||||
|
||||
@@ -202,7 +202,7 @@ static int getNextToken(
|
||||
|
||||
rc = pModule->xNext(pCursor, &zToken, &nToken, &iStart, &iEnd, &iPosition);
|
||||
if( rc==SQLITE_OK ){
|
||||
nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase) + nToken;
|
||||
nByte = sizeof(Fts3Expr) + SZ_FTS3PHRASE(1) + nToken;
|
||||
pRet = (Fts3Expr *)sqlite3Fts3MallocZero(nByte);
|
||||
if( !pRet ){
|
||||
rc = SQLITE_NOMEM;
|
||||
@@ -212,7 +212,7 @@ static int getNextToken(
|
||||
pRet->pPhrase->nToken = 1;
|
||||
pRet->pPhrase->iColumn = iCol;
|
||||
pRet->pPhrase->aToken[0].n = nToken;
|
||||
pRet->pPhrase->aToken[0].z = (char *)&pRet->pPhrase[1];
|
||||
pRet->pPhrase->aToken[0].z = (char*)&pRet->pPhrase->aToken[1];
|
||||
memcpy(pRet->pPhrase->aToken[0].z, zToken, nToken);
|
||||
|
||||
if( iEnd<n && z[iEnd]=='*' ){
|
||||
@@ -283,9 +283,9 @@ static int getNextString(
|
||||
Fts3Expr *p = 0;
|
||||
sqlite3_tokenizer_cursor *pCursor = 0;
|
||||
char *zTemp = 0;
|
||||
int nTemp = 0;
|
||||
i64 nTemp = 0;
|
||||
|
||||
const int nSpace = sizeof(Fts3Expr) + sizeof(Fts3Phrase);
|
||||
const int nSpace = sizeof(Fts3Expr) + SZ_FTS3PHRASE(1);
|
||||
int nToken = 0;
|
||||
|
||||
/* The final Fts3Expr data structure, including the Fts3Phrase,
|
||||
@@ -657,7 +657,7 @@ static int fts3ExprParse(
|
||||
|
||||
/* The isRequirePhrase variable is set to true if a phrase or
|
||||
** an expression contained in parenthesis is required. If a
|
||||
** binary operator (AND, OR, NOT or NEAR) is encounted when
|
||||
** binary operator (AND, OR, NOT or NEAR) is encountered when
|
||||
** isRequirePhrase is set, this is a syntax error.
|
||||
*/
|
||||
if( !isPhrase && isRequirePhrase ){
|
||||
|
||||
@@ -187,7 +187,7 @@ static void fts3HashInsertElement(
|
||||
}
|
||||
|
||||
|
||||
/* Resize the hash table so that it cantains "new_size" buckets.
|
||||
/* Resize the hash table so that it contains "new_size" buckets.
|
||||
** "new_size" must be a power of 2. The hash table might fail
|
||||
** to resize if sqliteMalloc() fails.
|
||||
**
|
||||
|
||||
@@ -256,7 +256,7 @@ static int star_oh(const char *z){
|
||||
|
||||
/*
|
||||
** If the word ends with zFrom and xCond() is true for the stem
|
||||
** of the word that preceeds the zFrom ending, then change the
|
||||
** of the word that precedes the zFrom ending, then change the
|
||||
** ending to zTo.
|
||||
**
|
||||
** The input word *pz and zFrom are both in reverse order. zTo
|
||||
|
||||
+38
-12
@@ -108,9 +108,13 @@ struct MatchinfoBuffer {
|
||||
int nElem;
|
||||
int bGlobal; /* Set if global data is loaded */
|
||||
char *zMatchinfo;
|
||||
u32 aMatchinfo[1];
|
||||
u32 aMI[FLEXARRAY];
|
||||
};
|
||||
|
||||
/* Size (in bytes) of a MatchinfoBuffer sufficient for N elements */
|
||||
#define SZ_MATCHINFOBUFFER(N) \
|
||||
(offsetof(MatchinfoBuffer,aMI)+(((N)+1)/2)*sizeof(u64))
|
||||
|
||||
|
||||
/*
|
||||
** The snippet() and offsets() functions both return text values. An instance
|
||||
@@ -135,13 +139,13 @@ struct StrBuffer {
|
||||
static MatchinfoBuffer *fts3MIBufferNew(size_t nElem, const char *zMatchinfo){
|
||||
MatchinfoBuffer *pRet;
|
||||
sqlite3_int64 nByte = sizeof(u32) * (2*(sqlite3_int64)nElem + 1)
|
||||
+ sizeof(MatchinfoBuffer);
|
||||
+ SZ_MATCHINFOBUFFER(1);
|
||||
sqlite3_int64 nStr = strlen(zMatchinfo);
|
||||
|
||||
pRet = sqlite3Fts3MallocZero(nByte + nStr+1);
|
||||
if( pRet ){
|
||||
pRet->aMatchinfo[0] = (u8*)(&pRet->aMatchinfo[1]) - (u8*)pRet;
|
||||
pRet->aMatchinfo[1+nElem] = pRet->aMatchinfo[0]
|
||||
pRet->aMI[0] = (u8*)(&pRet->aMI[1]) - (u8*)pRet;
|
||||
pRet->aMI[1+nElem] = pRet->aMI[0]
|
||||
+ sizeof(u32)*((int)nElem+1);
|
||||
pRet->nElem = (int)nElem;
|
||||
pRet->zMatchinfo = ((char*)pRet) + nByte;
|
||||
@@ -155,10 +159,10 @@ static MatchinfoBuffer *fts3MIBufferNew(size_t nElem, const char *zMatchinfo){
|
||||
static void fts3MIBufferFree(void *p){
|
||||
MatchinfoBuffer *pBuf = (MatchinfoBuffer*)((u8*)p - ((u32*)p)[-1]);
|
||||
|
||||
assert( (u32*)p==&pBuf->aMatchinfo[1]
|
||||
|| (u32*)p==&pBuf->aMatchinfo[pBuf->nElem+2]
|
||||
assert( (u32*)p==&pBuf->aMI[1]
|
||||
|| (u32*)p==&pBuf->aMI[pBuf->nElem+2]
|
||||
);
|
||||
if( (u32*)p==&pBuf->aMatchinfo[1] ){
|
||||
if( (u32*)p==&pBuf->aMI[1] ){
|
||||
pBuf->aRef[1] = 0;
|
||||
}else{
|
||||
pBuf->aRef[2] = 0;
|
||||
@@ -175,18 +179,18 @@ static void (*fts3MIBufferAlloc(MatchinfoBuffer *p, u32 **paOut))(void*){
|
||||
|
||||
if( p->aRef[1]==0 ){
|
||||
p->aRef[1] = 1;
|
||||
aOut = &p->aMatchinfo[1];
|
||||
aOut = &p->aMI[1];
|
||||
xRet = fts3MIBufferFree;
|
||||
}
|
||||
else if( p->aRef[2]==0 ){
|
||||
p->aRef[2] = 1;
|
||||
aOut = &p->aMatchinfo[p->nElem+2];
|
||||
aOut = &p->aMI[p->nElem+2];
|
||||
xRet = fts3MIBufferFree;
|
||||
}else{
|
||||
aOut = (u32*)sqlite3_malloc64(p->nElem * sizeof(u32));
|
||||
if( aOut ){
|
||||
xRet = sqlite3_free;
|
||||
if( p->bGlobal ) memcpy(aOut, &p->aMatchinfo[1], p->nElem*sizeof(u32));
|
||||
if( p->bGlobal ) memcpy(aOut, &p->aMI[1], p->nElem*sizeof(u32));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +200,7 @@ static void (*fts3MIBufferAlloc(MatchinfoBuffer *p, u32 **paOut))(void*){
|
||||
|
||||
static void fts3MIBufferSetGlobal(MatchinfoBuffer *p){
|
||||
p->bGlobal = 1;
|
||||
memcpy(&p->aMatchinfo[2+p->nElem], &p->aMatchinfo[1], p->nElem*sizeof(u32));
|
||||
memcpy(&p->aMI[2+p->nElem], &p->aMI[1], p->nElem*sizeof(u32));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -611,7 +615,7 @@ static int fts3StringAppend(
|
||||
}
|
||||
|
||||
/* If there is insufficient space allocated at StrBuffer.z, use realloc()
|
||||
** to grow the buffer until so that it is big enough to accomadate the
|
||||
** to grow the buffer until so that it is big enough to accommodate the
|
||||
** appended data.
|
||||
*/
|
||||
if( pStr->n+nAppend+1>=pStr->nAlloc ){
|
||||
@@ -1586,6 +1590,22 @@ static int fts3ExprTermOffsetInit(Fts3Expr *pExpr, int iPhrase, void *ctx){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** If expression pExpr is a phrase expression that uses an MSR query,
|
||||
** restart it as a regular, non-incremental query. Return SQLITE_OK
|
||||
** if successful, or an SQLite error code otherwise.
|
||||
*/
|
||||
static int fts3ExprRestartIfCb(Fts3Expr *pExpr, int iPhrase, void *ctx){
|
||||
TermOffsetCtx *p = (TermOffsetCtx*)ctx;
|
||||
int rc = SQLITE_OK;
|
||||
UNUSED_PARAMETER(iPhrase);
|
||||
if( pExpr->pPhrase && pExpr->pPhrase->bIncr ){
|
||||
rc = sqlite3Fts3MsrCancel(p->pCsr, pExpr);
|
||||
pExpr->pPhrase->bIncr = 0;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Implementation of offsets() function.
|
||||
*/
|
||||
@@ -1622,6 +1642,12 @@ void sqlite3Fts3Offsets(
|
||||
sCtx.iDocid = pCsr->iPrevId;
|
||||
sCtx.pCsr = pCsr;
|
||||
|
||||
/* If a query restart will be required, do it here, rather than later of
|
||||
** after pointers to poslist buffers that may be invalidated by a restart
|
||||
** have been saved. */
|
||||
rc = sqlite3Fts3ExprIterate(pCsr->pExpr, fts3ExprRestartIfCb, (void*)&sCtx);
|
||||
if( rc!=SQLITE_OK ) goto offsets_out;
|
||||
|
||||
/* Loop through the table columns, appending offset information to
|
||||
** string-buffer res for each column.
|
||||
*/
|
||||
|
||||
@@ -3956,7 +3956,7 @@ static int fts3IncrmergePush(
|
||||
**
|
||||
** It is assumed that the buffer associated with pNode is already large
|
||||
** enough to accommodate the new entry. The buffer associated with pPrev
|
||||
** is extended by this function if requrired.
|
||||
** is extended by this function if required.
|
||||
**
|
||||
** If an error (i.e. OOM condition) occurs, an SQLite error code is
|
||||
** returned. Otherwise, SQLITE_OK.
|
||||
@@ -5619,7 +5619,7 @@ int sqlite3Fts3DeferToken(
|
||||
/*
|
||||
** SQLite value pRowid contains the rowid of a row that may or may not be
|
||||
** present in the FTS3 table. If it is, delete it and adjust the contents
|
||||
** of subsiduary data structures accordingly.
|
||||
** of subsidiary data structures accordingly.
|
||||
*/
|
||||
static int fts3DeleteByRowid(
|
||||
Fts3Table *p,
|
||||
|
||||
@@ -893,7 +893,7 @@ proc print_test_main {} {
|
||||
puts "\}"
|
||||
}
|
||||
|
||||
# Proces the command line arguments. Exit early if they are not to
|
||||
# Process the command line arguments. Exit early if they are not to
|
||||
# our liking.
|
||||
#
|
||||
proc usage {} {
|
||||
|
||||
+15
-2
@@ -75,6 +75,18 @@ typedef sqlite3_uint64 u64;
|
||||
# define EIGHT_BYTE_ALIGNMENT(X) ((((uptr)(X) - (uptr)0)&7)==0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Macros needed to provide flexible arrays in a portable way
|
||||
*/
|
||||
#ifndef offsetof
|
||||
# define offsetof(STRUCTURE,FIELD) ((size_t)((char*)&((STRUCTURE*)0)->FIELD))
|
||||
#endif
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
# define FLEXARRAY
|
||||
#else
|
||||
# define FLEXARRAY 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Truncate very long tokens to this many bytes. Hard limit is
|
||||
@@ -147,10 +159,11 @@ typedef struct Fts5Colset Fts5Colset;
|
||||
*/
|
||||
struct Fts5Colset {
|
||||
int nCol;
|
||||
int aiCol[1];
|
||||
int aiCol[FLEXARRAY];
|
||||
};
|
||||
|
||||
|
||||
/* Size (int bytes) of a complete Fts5Colset object with N columns. */
|
||||
#define SZ_FTS5COLSET(N) (sizeof(i64)*((N+2)/2))
|
||||
|
||||
/**************************************************************************
|
||||
** Interface to code in fts5_config.c. fts5_config.c contains contains code
|
||||
|
||||
+1
-1
@@ -667,7 +667,7 @@ static int fts5Bm25GetData(
|
||||
** under consideration.
|
||||
**
|
||||
** The problem with this is that if (N < 2*nHit), the IDF is
|
||||
** negative. Which is undesirable. So the mimimum allowable IDF is
|
||||
** negative. Which is undesirable. So the minimum allowable IDF is
|
||||
** (1e-6) - roughly the same as a term that appears in just over
|
||||
** half of set of 5,000,000 documents. */
|
||||
double idf = log( (nRow - nHit + 0.5) / (nHit + 0.5) );
|
||||
|
||||
@@ -308,7 +308,7 @@ char *sqlite3Fts5Strndup(int *pRc, const char *pIn, int nIn){
|
||||
** * The 52 upper and lower case ASCII characters, and
|
||||
** * The 10 integer ASCII characters.
|
||||
** * The underscore character "_" (0x5F).
|
||||
** * The unicode "subsitute" character (0x1A).
|
||||
** * The unicode "substitute" character (0x1A).
|
||||
*/
|
||||
int sqlite3Fts5IsBareword(char t){
|
||||
u8 aBareword[128] = {
|
||||
|
||||
+32
-22
@@ -86,9 +86,13 @@ struct Fts5ExprNode {
|
||||
/* Child nodes. For a NOT node, this array always contains 2 entries. For
|
||||
** AND or OR nodes, it contains 2 or more entries. */
|
||||
int nChild; /* Number of child nodes */
|
||||
Fts5ExprNode *apChild[1]; /* Array of child nodes */
|
||||
Fts5ExprNode *apChild[FLEXARRAY]; /* Array of child nodes */
|
||||
};
|
||||
|
||||
/* Size (in bytes) of an Fts5ExprNode object that holds up to N children */
|
||||
#define SZ_FTS5EXPRNODE(N) \
|
||||
(offsetof(Fts5ExprNode,apChild) + (N)*sizeof(Fts5ExprNode*))
|
||||
|
||||
#define Fts5NodeIsString(p) ((p)->eType==FTS5_TERM || (p)->eType==FTS5_STRING)
|
||||
|
||||
/*
|
||||
@@ -119,9 +123,13 @@ struct Fts5ExprPhrase {
|
||||
Fts5ExprNode *pNode; /* FTS5_STRING node this phrase is part of */
|
||||
Fts5Buffer poslist; /* Current position list */
|
||||
int nTerm; /* Number of entries in aTerm[] */
|
||||
Fts5ExprTerm aTerm[1]; /* Terms that make up this phrase */
|
||||
Fts5ExprTerm aTerm[FLEXARRAY]; /* Terms that make up this phrase */
|
||||
};
|
||||
|
||||
/* Size (in bytes) of an Fts5ExprPhrase object that holds up to N terms */
|
||||
#define SZ_FTS5EXPRPHRASE(N) \
|
||||
(offsetof(Fts5ExprPhrase,aTerm) + (N)*sizeof(Fts5ExprTerm))
|
||||
|
||||
/*
|
||||
** One or more phrases that must appear within a certain token distance of
|
||||
** each other within each matching document.
|
||||
@@ -130,9 +138,12 @@ struct Fts5ExprNearset {
|
||||
int nNear; /* NEAR parameter */
|
||||
Fts5Colset *pColset; /* Columns to search (NULL -> all columns) */
|
||||
int nPhrase; /* Number of entries in aPhrase[] array */
|
||||
Fts5ExprPhrase *apPhrase[1]; /* Array of phrase pointers */
|
||||
Fts5ExprPhrase *apPhrase[FLEXARRAY]; /* Array of phrase pointers */
|
||||
};
|
||||
|
||||
/* Size (in bytes) of an Fts5ExprNearset object covering up to N phrases */
|
||||
#define SZ_FTS5EXPRNEARSET(N) \
|
||||
(offsetof(Fts5ExprNearset,apPhrase)+(N)*sizeof(Fts5ExprPhrase*))
|
||||
|
||||
/*
|
||||
** Parse context.
|
||||
@@ -292,7 +303,7 @@ int sqlite3Fts5ExprNew(
|
||||
/* If the LHS of the MATCH expression was a user column, apply the
|
||||
** implicit column-filter. */
|
||||
if( sParse.rc==SQLITE_OK && iCol<pConfig->nCol ){
|
||||
int n = sizeof(Fts5Colset);
|
||||
int n = SZ_FTS5COLSET(1);
|
||||
Fts5Colset *pColset = (Fts5Colset*)sqlite3Fts5MallocZero(&sParse.rc, n);
|
||||
if( pColset ){
|
||||
pColset->nCol = 1;
|
||||
@@ -1650,7 +1661,7 @@ Fts5ExprNearset *sqlite3Fts5ParseNearset(
|
||||
if( pParse->rc==SQLITE_OK ){
|
||||
if( pNear==0 ){
|
||||
sqlite3_int64 nByte;
|
||||
nByte = sizeof(Fts5ExprNearset) + SZALLOC * sizeof(Fts5ExprPhrase*);
|
||||
nByte = SZ_FTS5EXPRNEARSET(SZALLOC+1);
|
||||
pRet = sqlite3_malloc64(nByte);
|
||||
if( pRet==0 ){
|
||||
pParse->rc = SQLITE_NOMEM;
|
||||
@@ -1661,7 +1672,7 @@ Fts5ExprNearset *sqlite3Fts5ParseNearset(
|
||||
int nNew = pNear->nPhrase + SZALLOC;
|
||||
sqlite3_int64 nByte;
|
||||
|
||||
nByte = sizeof(Fts5ExprNearset) + nNew * sizeof(Fts5ExprPhrase*);
|
||||
nByte = SZ_FTS5EXPRNEARSET(nNew+1);
|
||||
pRet = (Fts5ExprNearset*)sqlite3_realloc64(pNear, nByte);
|
||||
if( pRet==0 ){
|
||||
pParse->rc = SQLITE_NOMEM;
|
||||
@@ -1752,12 +1763,12 @@ static int fts5ParseTokenize(
|
||||
int nNew = SZALLOC + (pPhrase ? pPhrase->nTerm : 0);
|
||||
|
||||
pNew = (Fts5ExprPhrase*)sqlite3_realloc64(pPhrase,
|
||||
sizeof(Fts5ExprPhrase) + sizeof(Fts5ExprTerm) * nNew
|
||||
SZ_FTS5EXPRPHRASE(nNew+1)
|
||||
);
|
||||
if( pNew==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
if( pPhrase==0 ) memset(pNew, 0, sizeof(Fts5ExprPhrase));
|
||||
if( pPhrase==0 ) memset(pNew, 0, SZ_FTS5EXPRPHRASE(1));
|
||||
pCtx->pPhrase = pPhrase = pNew;
|
||||
pNew->nTerm = nNew - SZALLOC;
|
||||
}
|
||||
@@ -1865,7 +1876,7 @@ Fts5ExprPhrase *sqlite3Fts5ParseTerm(
|
||||
if( sCtx.pPhrase==0 ){
|
||||
/* This happens when parsing a token or quoted phrase that contains
|
||||
** no token characters at all. (e.g ... MATCH '""'). */
|
||||
sCtx.pPhrase = sqlite3Fts5MallocZero(&pParse->rc, sizeof(Fts5ExprPhrase));
|
||||
sCtx.pPhrase = sqlite3Fts5MallocZero(&pParse->rc, SZ_FTS5EXPRPHRASE(1));
|
||||
}else if( sCtx.pPhrase->nTerm ){
|
||||
sCtx.pPhrase->aTerm[sCtx.pPhrase->nTerm-1].bPrefix = (u8)bPrefix;
|
||||
}
|
||||
@@ -1900,19 +1911,18 @@ int sqlite3Fts5ExprClonePhrase(
|
||||
sizeof(Fts5ExprPhrase*));
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
pNew->pRoot = (Fts5ExprNode*)sqlite3Fts5MallocZero(&rc,
|
||||
sizeof(Fts5ExprNode));
|
||||
pNew->pRoot = (Fts5ExprNode*)sqlite3Fts5MallocZero(&rc, SZ_FTS5EXPRNODE(1));
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc,
|
||||
sizeof(Fts5ExprNearset) + sizeof(Fts5ExprPhrase*));
|
||||
pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc,
|
||||
SZ_FTS5EXPRNEARSET(2));
|
||||
}
|
||||
if( rc==SQLITE_OK && ALWAYS(pOrig!=0) ){
|
||||
Fts5Colset *pColsetOrig = pOrig->pNode->pNear->pColset;
|
||||
if( pColsetOrig ){
|
||||
sqlite3_int64 nByte;
|
||||
Fts5Colset *pColset;
|
||||
nByte = sizeof(Fts5Colset) + (pColsetOrig->nCol-1) * sizeof(int);
|
||||
nByte = SZ_FTS5COLSET(pColsetOrig->nCol);
|
||||
pColset = (Fts5Colset*)sqlite3Fts5MallocZero(&rc, nByte);
|
||||
if( pColset ){
|
||||
memcpy(pColset, pColsetOrig, (size_t)nByte);
|
||||
@@ -1940,7 +1950,7 @@ int sqlite3Fts5ExprClonePhrase(
|
||||
}else{
|
||||
/* This happens when parsing a token or quoted phrase that contains
|
||||
** no token characters at all. (e.g ... MATCH '""'). */
|
||||
sCtx.pPhrase = sqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprPhrase));
|
||||
sCtx.pPhrase = sqlite3Fts5MallocZero(&rc, SZ_FTS5EXPRPHRASE(1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2034,7 +2044,7 @@ static Fts5Colset *fts5ParseColset(
|
||||
assert( pParse->rc==SQLITE_OK );
|
||||
assert( iCol>=0 && iCol<pParse->pConfig->nCol );
|
||||
|
||||
pNew = sqlite3_realloc64(p, sizeof(Fts5Colset) + sizeof(int)*nCol);
|
||||
pNew = sqlite3_realloc64(p, SZ_FTS5COLSET(nCol+1));
|
||||
if( pNew==0 ){
|
||||
pParse->rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
@@ -2069,7 +2079,7 @@ Fts5Colset *sqlite3Fts5ParseColsetInvert(Fts5Parse *pParse, Fts5Colset *p){
|
||||
int nCol = pParse->pConfig->nCol;
|
||||
|
||||
pRet = (Fts5Colset*)sqlite3Fts5MallocZero(&pParse->rc,
|
||||
sizeof(Fts5Colset) + sizeof(int)*nCol
|
||||
SZ_FTS5COLSET(nCol+1)
|
||||
);
|
||||
if( pRet ){
|
||||
int i;
|
||||
@@ -2130,7 +2140,7 @@ Fts5Colset *sqlite3Fts5ParseColset(
|
||||
static Fts5Colset *fts5CloneColset(int *pRc, Fts5Colset *pOrig){
|
||||
Fts5Colset *pRet;
|
||||
if( pOrig ){
|
||||
sqlite3_int64 nByte = sizeof(Fts5Colset) + (pOrig->nCol-1) * sizeof(int);
|
||||
sqlite3_int64 nByte = SZ_FTS5COLSET(pOrig->nCol);
|
||||
pRet = (Fts5Colset*)sqlite3Fts5MallocZero(pRc, nByte);
|
||||
if( pRet ){
|
||||
memcpy(pRet, pOrig, (size_t)nByte);
|
||||
@@ -2298,7 +2308,7 @@ static Fts5ExprNode *fts5ParsePhraseToAnd(
|
||||
assert( pNear->nPhrase==1 );
|
||||
assert( pParse->bPhraseToAnd );
|
||||
|
||||
nByte = sizeof(Fts5ExprNode) + nTerm*sizeof(Fts5ExprNode*);
|
||||
nByte = SZ_FTS5EXPRNODE(nTerm+1);
|
||||
pRet = (Fts5ExprNode*)sqlite3Fts5MallocZero(&pParse->rc, nByte);
|
||||
if( pRet ){
|
||||
pRet->eType = FTS5_AND;
|
||||
@@ -2308,7 +2318,7 @@ static Fts5ExprNode *fts5ParsePhraseToAnd(
|
||||
pParse->nPhrase--;
|
||||
for(ii=0; ii<nTerm; ii++){
|
||||
Fts5ExprPhrase *pPhrase = (Fts5ExprPhrase*)sqlite3Fts5MallocZero(
|
||||
&pParse->rc, sizeof(Fts5ExprPhrase)
|
||||
&pParse->rc, SZ_FTS5EXPRPHRASE(1)
|
||||
);
|
||||
if( pPhrase ){
|
||||
if( parseGrowPhraseArray(pParse) ){
|
||||
@@ -2377,7 +2387,7 @@ Fts5ExprNode *sqlite3Fts5ParseNode(
|
||||
if( pRight->eType==eType ) nChild += pRight->nChild-1;
|
||||
}
|
||||
|
||||
nByte = sizeof(Fts5ExprNode) + sizeof(Fts5ExprNode*)*(nChild-1);
|
||||
nByte = SZ_FTS5EXPRNODE(nChild);
|
||||
pRet = (Fts5ExprNode*)sqlite3Fts5MallocZero(&pParse->rc, nByte);
|
||||
|
||||
if( pRet ){
|
||||
@@ -3252,7 +3262,7 @@ int sqlite3Fts5ExprInstToken(
|
||||
}
|
||||
|
||||
/*
|
||||
** Clear the token mappings for all Fts5IndexIter objects mannaged by
|
||||
** Clear the token mappings for all Fts5IndexIter objects managed by
|
||||
** the expression passed as the only argument.
|
||||
*/
|
||||
void sqlite3Fts5ExprClearTokens(Fts5Expr *pExpr){
|
||||
|
||||
@@ -20,7 +20,7 @@ typedef struct Fts5HashEntry Fts5HashEntry;
|
||||
|
||||
/*
|
||||
** This file contains the implementation of an in-memory hash table used
|
||||
** to accumuluate "term -> doclist" content before it is flused to a level-0
|
||||
** to accumulate "term -> doclist" content before it is flushed to a level-0
|
||||
** segment.
|
||||
*/
|
||||
|
||||
@@ -77,7 +77,7 @@ struct Fts5HashEntry {
|
||||
};
|
||||
|
||||
/*
|
||||
** Eqivalent to:
|
||||
** Equivalent to:
|
||||
**
|
||||
** char *fts5EntryKey(Fts5HashEntry *pEntry){ return zKey; }
|
||||
*/
|
||||
|
||||
+87
-52
@@ -422,9 +422,13 @@ struct Fts5Structure {
|
||||
u64 nOriginCntr; /* Origin value for next top-level segment */
|
||||
int nSegment; /* Total segments in this structure */
|
||||
int nLevel; /* Number of levels in this index */
|
||||
Fts5StructureLevel aLevel[1]; /* Array of nLevel level objects */
|
||||
Fts5StructureLevel aLevel[FLEXARRAY]; /* Array of nLevel level objects */
|
||||
};
|
||||
|
||||
/* Size (in bytes) of an Fts5Structure object holding up to N levels */
|
||||
#define SZ_FTS5STRUCTURE(N) \
|
||||
(offsetof(Fts5Structure,aLevel) + (N)*sizeof(Fts5StructureLevel))
|
||||
|
||||
/*
|
||||
** An object of type Fts5SegWriter is used to write to segments.
|
||||
*/
|
||||
@@ -554,11 +558,15 @@ struct Fts5SegIter {
|
||||
** Array of tombstone pages. Reference counted.
|
||||
*/
|
||||
struct Fts5TombstoneArray {
|
||||
int nRef; /* Number of pointers to this object */
|
||||
int nRef; /* Number of pointers to this object */
|
||||
int nTombstone;
|
||||
Fts5Data *apTombstone[1]; /* Array of tombstone pages */
|
||||
Fts5Data *apTombstone[FLEXARRAY]; /* Array of tombstone pages */
|
||||
};
|
||||
|
||||
/* Size (in bytes) of an Fts5TombstoneArray holding up to N tombstones */
|
||||
#define SZ_FTS5TOMBSTONEARRAY(N) \
|
||||
(offsetof(Fts5TombstoneArray,apTombstone)+(N)*sizeof(Fts5Data*))
|
||||
|
||||
/*
|
||||
** Argument is a pointer to an Fts5Data structure that contains a
|
||||
** leaf page.
|
||||
@@ -627,9 +635,12 @@ struct Fts5Iter {
|
||||
|
||||
i64 iSwitchRowid; /* Firstest rowid of other than aFirst[1] */
|
||||
Fts5CResult *aFirst; /* Current merge state (see above) */
|
||||
Fts5SegIter aSeg[1]; /* Array of segment iterators */
|
||||
Fts5SegIter aSeg[FLEXARRAY]; /* Array of segment iterators */
|
||||
};
|
||||
|
||||
/* Size (in bytes) of an Fts5Iter object holding up to N segment iterators */
|
||||
#define SZ_FTS5ITER(N) (offsetof(Fts5Iter,aSeg)+(N)*sizeof(Fts5SegIter))
|
||||
|
||||
/*
|
||||
** An instance of the following type is used to iterate through the contents
|
||||
** of a doclist-index record.
|
||||
@@ -656,9 +667,13 @@ struct Fts5DlidxLvl {
|
||||
struct Fts5DlidxIter {
|
||||
int nLvl;
|
||||
int iSegid;
|
||||
Fts5DlidxLvl aLvl[1];
|
||||
Fts5DlidxLvl aLvl[FLEXARRAY];
|
||||
};
|
||||
|
||||
/* Size (in bytes) of an Fts5DlidxIter object with up to N levels */
|
||||
#define SZ_FTS5DLIDXITER(N) \
|
||||
(offsetof(Fts5DlidxIter,aLvl)+(N)*sizeof(Fts5DlidxLvl))
|
||||
|
||||
static void fts5PutU16(u8 *aOut, u16 iVal){
|
||||
aOut[0] = (iVal>>8);
|
||||
aOut[1] = (iVal&0xFF);
|
||||
@@ -778,11 +793,13 @@ static int fts5LeafFirstTermOff(Fts5Data *pLeaf){
|
||||
/*
|
||||
** Close the read-only blob handle, if it is open.
|
||||
*/
|
||||
void sqlite3Fts5IndexCloseReader(Fts5Index *p){
|
||||
static void fts5IndexCloseReader(Fts5Index *p){
|
||||
if( p->pReader ){
|
||||
int rc;
|
||||
sqlite3_blob *pReader = p->pReader;
|
||||
p->pReader = 0;
|
||||
sqlite3_blob_close(pReader);
|
||||
rc = sqlite3_blob_close(pReader);
|
||||
if( p->rc==SQLITE_OK ) p->rc = rc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -807,7 +824,7 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){
|
||||
assert( p->pReader==0 );
|
||||
p->pReader = pBlob;
|
||||
if( rc!=SQLITE_OK ){
|
||||
sqlite3Fts5IndexCloseReader(p);
|
||||
fts5IndexCloseReader(p);
|
||||
}
|
||||
if( rc==SQLITE_ABORT ) rc = SQLITE_OK;
|
||||
}
|
||||
@@ -1024,7 +1041,7 @@ int sqlite3Fts5StructureTest(Fts5Index *p, void *pStruct){
|
||||
static void fts5StructureMakeWritable(int *pRc, Fts5Structure **pp){
|
||||
Fts5Structure *p = *pp;
|
||||
if( *pRc==SQLITE_OK && p->nRef>1 ){
|
||||
i64 nByte = sizeof(Fts5Structure)+(p->nLevel-1)*sizeof(Fts5StructureLevel);
|
||||
i64 nByte = SZ_FTS5STRUCTURE(p->nLevel);
|
||||
Fts5Structure *pNew;
|
||||
pNew = (Fts5Structure*)sqlite3Fts5MallocZero(pRc, nByte);
|
||||
if( pNew ){
|
||||
@@ -1098,10 +1115,7 @@ static int fts5StructureDecode(
|
||||
){
|
||||
return FTS5_CORRUPT;
|
||||
}
|
||||
nByte = (
|
||||
sizeof(Fts5Structure) + /* Main structure */
|
||||
sizeof(Fts5StructureLevel) * (nLevel-1) /* aLevel[] array */
|
||||
);
|
||||
nByte = SZ_FTS5STRUCTURE(nLevel);
|
||||
pRet = (Fts5Structure*)sqlite3Fts5MallocZero(&rc, nByte);
|
||||
|
||||
if( pRet ){
|
||||
@@ -1181,10 +1195,7 @@ static void fts5StructureAddLevel(int *pRc, Fts5Structure **ppStruct){
|
||||
if( *pRc==SQLITE_OK ){
|
||||
Fts5Structure *pStruct = *ppStruct;
|
||||
int nLevel = pStruct->nLevel;
|
||||
sqlite3_int64 nByte = (
|
||||
sizeof(Fts5Structure) + /* Main structure */
|
||||
sizeof(Fts5StructureLevel) * (nLevel+1) /* aLevel[] array */
|
||||
);
|
||||
sqlite3_int64 nByte = SZ_FTS5STRUCTURE(nLevel+2);
|
||||
|
||||
pStruct = sqlite3_realloc64(pStruct, nByte);
|
||||
if( pStruct ){
|
||||
@@ -1723,7 +1734,7 @@ static Fts5DlidxIter *fts5DlidxIterInit(
|
||||
int bDone = 0;
|
||||
|
||||
for(i=0; p->rc==SQLITE_OK && bDone==0; i++){
|
||||
sqlite3_int64 nByte = sizeof(Fts5DlidxIter) + i * sizeof(Fts5DlidxLvl);
|
||||
sqlite3_int64 nByte = SZ_FTS5DLIDXITER(i+1);
|
||||
Fts5DlidxIter *pNew;
|
||||
|
||||
pNew = (Fts5DlidxIter*)sqlite3_realloc64(pIter, nByte);
|
||||
@@ -1941,7 +1952,7 @@ static void fts5SegIterSetNext(Fts5Index *p, Fts5SegIter *pIter){
|
||||
static void fts5SegIterAllocTombstone(Fts5Index *p, Fts5SegIter *pIter){
|
||||
const int nTomb = pIter->pSeg->nPgTombstone;
|
||||
if( nTomb>0 ){
|
||||
int nByte = nTomb * sizeof(Fts5Data*) + sizeof(Fts5TombstoneArray);
|
||||
int nByte = SZ_FTS5TOMBSTONEARRAY(nTomb+1);
|
||||
Fts5TombstoneArray *pNew;
|
||||
pNew = (Fts5TombstoneArray*)sqlite3Fts5MallocZero(&p->rc, nByte);
|
||||
if( pNew ){
|
||||
@@ -3402,8 +3413,7 @@ static Fts5Iter *fts5MultiIterAlloc(
|
||||
|
||||
for(nSlot=2; nSlot<nSeg; nSlot=nSlot*2);
|
||||
pNew = fts5IdxMalloc(p,
|
||||
sizeof(Fts5Iter) + /* pNew */
|
||||
sizeof(Fts5SegIter) * (nSlot-1) + /* pNew->aSeg[] */
|
||||
SZ_FTS5ITER(nSlot) + /* pNew + pNew->aSeg[] */
|
||||
sizeof(Fts5CResult) * nSlot /* pNew->aFirst[] */
|
||||
);
|
||||
if( pNew ){
|
||||
@@ -5009,6 +5019,14 @@ static int fts5IndexReturn(Fts5Index *p){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Close the read-only blob handle, if it is open.
|
||||
*/
|
||||
void sqlite3Fts5IndexCloseReader(Fts5Index *p){
|
||||
fts5IndexCloseReader(p);
|
||||
fts5IndexReturn(p);
|
||||
}
|
||||
|
||||
typedef struct Fts5FlushCtx Fts5FlushCtx;
|
||||
struct Fts5FlushCtx {
|
||||
Fts5Index *pIdx;
|
||||
@@ -5196,7 +5214,7 @@ static void fts5DoSecureDelete(
|
||||
int iDelKeyOff = 0; /* Offset of deleted key, if any */
|
||||
|
||||
nIdx = nPg-iPgIdx;
|
||||
aIdx = sqlite3Fts5MallocZero(&p->rc, nIdx+16);
|
||||
aIdx = sqlite3Fts5MallocZero(&p->rc, ((i64)nIdx)+16);
|
||||
if( p->rc ) return;
|
||||
memcpy(aIdx, &aPg[iPgIdx], nIdx);
|
||||
|
||||
@@ -5761,7 +5779,7 @@ static Fts5Structure *fts5IndexOptimizeStruct(
|
||||
Fts5Structure *pStruct
|
||||
){
|
||||
Fts5Structure *pNew = 0;
|
||||
sqlite3_int64 nByte = sizeof(Fts5Structure);
|
||||
sqlite3_int64 nByte = SZ_FTS5STRUCTURE(1);
|
||||
int nSeg = pStruct->nSegment;
|
||||
int i;
|
||||
|
||||
@@ -5790,7 +5808,8 @@ static Fts5Structure *fts5IndexOptimizeStruct(
|
||||
assert( pStruct->aLevel[i].nMerge<=nThis );
|
||||
}
|
||||
|
||||
nByte += (pStruct->nLevel+1) * sizeof(Fts5StructureLevel);
|
||||
nByte += (((i64)pStruct->nLevel)+1) * sizeof(Fts5StructureLevel);
|
||||
assert( nByte==SZ_FTS5STRUCTURE(pStruct->nLevel+2) );
|
||||
pNew = (Fts5Structure*)sqlite3Fts5MallocZero(&p->rc, nByte);
|
||||
|
||||
if( pNew ){
|
||||
@@ -6367,9 +6386,13 @@ struct Fts5TokenDataIter {
|
||||
int nIterAlloc;
|
||||
Fts5PoslistReader *aPoslistReader;
|
||||
int *aPoslistToIter;
|
||||
Fts5Iter *apIter[1];
|
||||
Fts5Iter *apIter[FLEXARRAY];
|
||||
};
|
||||
|
||||
/* Size in bytes of an Fts5TokenDataIter object holding up to N iterators */
|
||||
#define SZ_FTS5TOKENDATAITER(N) \
|
||||
(offsetof(Fts5TokenDataIter,apIter) + (N)*sizeof(Fts5Iter))
|
||||
|
||||
/*
|
||||
** The two input arrays - a1[] and a2[] - are in sorted order. This function
|
||||
** merges the two arrays together and writes the result to output array
|
||||
@@ -6441,7 +6464,7 @@ static void fts5TokendataIterAppendMap(
|
||||
/*
|
||||
** Sort the contents of the pT->aMap[] array.
|
||||
**
|
||||
** The sorting algorithm requries a malloc(). If this fails, an error code
|
||||
** The sorting algorithm requires a malloc(). If this fails, an error code
|
||||
** is left in Fts5Index.rc before returning.
|
||||
*/
|
||||
static void fts5TokendataIterSortMap(Fts5Index *p, Fts5TokenDataIter *pT){
|
||||
@@ -6632,7 +6655,7 @@ static void fts5SetupPrefixIter(
|
||||
&& p->pConfig->bPrefixInsttoken
|
||||
){
|
||||
s.pTokendata = &s2;
|
||||
s2.pT = (Fts5TokenDataIter*)fts5IdxMalloc(p, sizeof(*s2.pT));
|
||||
s2.pT = (Fts5TokenDataIter*)fts5IdxMalloc(p, SZ_FTS5TOKENDATAITER(1));
|
||||
}
|
||||
|
||||
if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){
|
||||
@@ -6678,7 +6701,8 @@ static void fts5SetupPrefixIter(
|
||||
}
|
||||
}
|
||||
|
||||
pData = fts5IdxMalloc(p, sizeof(*pData)+s.doclist.n+FTS5_DATA_ZERO_PADDING);
|
||||
pData = fts5IdxMalloc(p, sizeof(*pData)
|
||||
+ ((i64)s.doclist.n)+FTS5_DATA_ZERO_PADDING);
|
||||
assert( pData!=0 || p->rc!=SQLITE_OK );
|
||||
if( pData ){
|
||||
pData->p = (u8*)&pData[1];
|
||||
@@ -6736,7 +6760,7 @@ int sqlite3Fts5IndexBeginWrite(Fts5Index *p, int bDelete, i64 iRowid){
|
||||
int sqlite3Fts5IndexSync(Fts5Index *p){
|
||||
assert( p->rc==SQLITE_OK );
|
||||
fts5IndexFlush(p);
|
||||
sqlite3Fts5IndexCloseReader(p);
|
||||
fts5IndexCloseReader(p);
|
||||
return fts5IndexReturn(p);
|
||||
}
|
||||
|
||||
@@ -6747,11 +6771,10 @@ int sqlite3Fts5IndexSync(Fts5Index *p){
|
||||
** records must be invalidated.
|
||||
*/
|
||||
int sqlite3Fts5IndexRollback(Fts5Index *p){
|
||||
sqlite3Fts5IndexCloseReader(p);
|
||||
fts5IndexCloseReader(p);
|
||||
fts5IndexDiscardData(p);
|
||||
fts5StructureInvalidate(p);
|
||||
/* assert( p->rc==SQLITE_OK ); */
|
||||
return SQLITE_OK;
|
||||
return fts5IndexReturn(p);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -6760,15 +6783,17 @@ int sqlite3Fts5IndexRollback(Fts5Index *p){
|
||||
** and the initial version of the "averages" record (a zero-byte blob).
|
||||
*/
|
||||
int sqlite3Fts5IndexReinit(Fts5Index *p){
|
||||
Fts5Structure s;
|
||||
Fts5Structure *pTmp;
|
||||
u8 tmpSpace[SZ_FTS5STRUCTURE(1)];
|
||||
fts5StructureInvalidate(p);
|
||||
fts5IndexDiscardData(p);
|
||||
memset(&s, 0, sizeof(Fts5Structure));
|
||||
pTmp = (Fts5Structure*)tmpSpace;
|
||||
memset(pTmp, 0, SZ_FTS5STRUCTURE(1));
|
||||
if( p->pConfig->bContentlessDelete ){
|
||||
s.nOriginCntr = 1;
|
||||
pTmp->nOriginCntr = 1;
|
||||
}
|
||||
fts5DataWrite(p, FTS5_AVERAGES_ROWID, (const u8*)"", 0);
|
||||
fts5StructureWrite(p, &s);
|
||||
fts5StructureWrite(p, pTmp);
|
||||
return fts5IndexReturn(p);
|
||||
}
|
||||
|
||||
@@ -6952,6 +6977,16 @@ static void fts5SegIterSetEOF(Fts5SegIter *pSeg){
|
||||
pSeg->pLeaf = 0;
|
||||
}
|
||||
|
||||
static void fts5IterClose(Fts5IndexIter *pIndexIter){
|
||||
if( pIndexIter ){
|
||||
Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
|
||||
Fts5Index *pIndex = pIter->pIndex;
|
||||
fts5TokendataIterDelete(pIter->pTokenDataIter);
|
||||
fts5MultiIterFree(pIter);
|
||||
fts5IndexCloseReader(pIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** This function appends iterator pAppend to Fts5TokenDataIter pIn and
|
||||
** returns the result.
|
||||
@@ -6966,7 +7001,7 @@ static Fts5TokenDataIter *fts5AppendTokendataIter(
|
||||
if( p->rc==SQLITE_OK ){
|
||||
if( pIn==0 || pIn->nIter==pIn->nIterAlloc ){
|
||||
int nAlloc = pIn ? pIn->nIterAlloc*2 : 16;
|
||||
int nByte = nAlloc * sizeof(Fts5Iter*) + sizeof(Fts5TokenDataIter);
|
||||
int nByte = SZ_FTS5TOKENDATAITER(nAlloc+1);
|
||||
Fts5TokenDataIter *pNew = (Fts5TokenDataIter*)sqlite3_realloc(pIn, nByte);
|
||||
|
||||
if( pNew==0 ){
|
||||
@@ -6979,7 +7014,7 @@ static Fts5TokenDataIter *fts5AppendTokendataIter(
|
||||
}
|
||||
}
|
||||
if( p->rc ){
|
||||
sqlite3Fts5IterClose((Fts5IndexIter*)pAppend);
|
||||
fts5IterClose((Fts5IndexIter*)pAppend);
|
||||
}else{
|
||||
pRet->apIter[pRet->nIter++] = pAppend;
|
||||
}
|
||||
@@ -7192,7 +7227,7 @@ static Fts5Iter *fts5SetupTokendataIter(
|
||||
fts5BufferSet(&p->rc, &bSeek, nToken, pToken);
|
||||
}
|
||||
if( p->rc ){
|
||||
sqlite3Fts5IterClose((Fts5IndexIter*)pNew);
|
||||
fts5IterClose((Fts5IndexIter*)pNew);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7257,7 +7292,7 @@ static Fts5Iter *fts5SetupTokendataIter(
|
||||
** not point to any terms that match the query. So delete it and break
|
||||
** out of the loop - all required iterators have been collected. */
|
||||
if( pSmall==0 ){
|
||||
sqlite3Fts5IterClose((Fts5IndexIter*)pNew);
|
||||
fts5IterClose((Fts5IndexIter*)pNew);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7386,9 +7421,9 @@ int sqlite3Fts5IndexQuery(
|
||||
}
|
||||
|
||||
if( p->rc ){
|
||||
sqlite3Fts5IterClose((Fts5IndexIter*)pRet);
|
||||
fts5IterClose((Fts5IndexIter*)pRet);
|
||||
pRet = 0;
|
||||
sqlite3Fts5IndexCloseReader(p);
|
||||
fts5IndexCloseReader(p);
|
||||
}
|
||||
|
||||
*ppIter = (Fts5IndexIter*)pRet;
|
||||
@@ -7482,7 +7517,8 @@ static int fts5SetupPrefixIterTokendata(
|
||||
|
||||
fts5BufferGrow(&p->rc, &token, nToken+1);
|
||||
assert( token.p!=0 || p->rc!=SQLITE_OK );
|
||||
ctx.pT = (Fts5TokenDataIter*)sqlite3Fts5MallocZero(&p->rc, sizeof(*ctx.pT));
|
||||
ctx.pT = (Fts5TokenDataIter*)sqlite3Fts5MallocZero(&p->rc,
|
||||
SZ_FTS5TOKENDATAITER(1));
|
||||
|
||||
if( p->rc==SQLITE_OK ){
|
||||
|
||||
@@ -7613,7 +7649,8 @@ int sqlite3Fts5IndexIterWriteTokendata(
|
||||
if( pIter->nSeg>0 ){
|
||||
/* This is a prefix term iterator. */
|
||||
if( pT==0 ){
|
||||
pT = (Fts5TokenDataIter*)sqlite3Fts5MallocZero(&p->rc, sizeof(*pT));
|
||||
pT = (Fts5TokenDataIter*)sqlite3Fts5MallocZero(&p->rc,
|
||||
SZ_FTS5TOKENDATAITER(1));
|
||||
pIter->pTokenDataIter = pT;
|
||||
}
|
||||
if( pT ){
|
||||
@@ -7638,11 +7675,9 @@ int sqlite3Fts5IndexIterWriteTokendata(
|
||||
*/
|
||||
void sqlite3Fts5IterClose(Fts5IndexIter *pIndexIter){
|
||||
if( pIndexIter ){
|
||||
Fts5Iter *pIter = (Fts5Iter*)pIndexIter;
|
||||
Fts5Index *pIndex = pIter->pIndex;
|
||||
fts5TokendataIterDelete(pIter->pTokenDataIter);
|
||||
fts5MultiIterFree(pIter);
|
||||
sqlite3Fts5IndexCloseReader(pIndex);
|
||||
Fts5Index *pIndex = ((Fts5Iter*)pIndexIter)->pIndex;
|
||||
fts5IterClose(pIndexIter);
|
||||
fts5IndexReturn(pIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8172,7 +8207,7 @@ static int fts5QueryCksum(
|
||||
rc = sqlite3Fts5IterNext(pIter);
|
||||
}
|
||||
}
|
||||
sqlite3Fts5IterClose(pIter);
|
||||
fts5IterClose(pIter);
|
||||
|
||||
*pCksum = cksum;
|
||||
return rc;
|
||||
@@ -8649,7 +8684,7 @@ static void fts5DecodeRowid(
|
||||
|
||||
#if defined(SQLITE_TEST) || defined(SQLITE_FTS5_DEBUG)
|
||||
static void fts5DebugRowid(int *pRc, Fts5Buffer *pBuf, i64 iKey){
|
||||
int iSegid, iHeight, iPgno, bDlidx, bTomb; /* Rowid compenents */
|
||||
int iSegid, iHeight, iPgno, bDlidx, bTomb; /* Rowid components */
|
||||
fts5DecodeRowid(iKey, &bTomb, &iSegid, &bDlidx, &iHeight, &iPgno);
|
||||
|
||||
if( iSegid==0 ){
|
||||
@@ -8895,7 +8930,7 @@ static void fts5DecodeFunction(
|
||||
** buffer overreads even if the record is corrupt. */
|
||||
n = sqlite3_value_bytes(apVal[1]);
|
||||
aBlob = sqlite3_value_blob(apVal[1]);
|
||||
nSpace = n + FTS5_DATA_ZERO_PADDING;
|
||||
nSpace = ((i64)n) + FTS5_DATA_ZERO_PADDING;
|
||||
a = (u8*)sqlite3Fts5MallocZero(&rc, nSpace);
|
||||
if( a==0 ) goto decode_out;
|
||||
if( n>0 ) memcpy(a, aBlob, n);
|
||||
|
||||
@@ -170,9 +170,11 @@ struct Fts5Sorter {
|
||||
i64 iRowid; /* Current rowid */
|
||||
const u8 *aPoslist; /* Position lists for current row */
|
||||
int nIdx; /* Number of entries in aIdx[] */
|
||||
int aIdx[1]; /* Offsets into aPoslist for current row */
|
||||
int aIdx[FLEXARRAY]; /* Offsets into aPoslist for current row */
|
||||
};
|
||||
|
||||
/* Size (int bytes) of an Fts5Sorter object with N indexes */
|
||||
#define SZ_FTS5SORTER(N) (offsetof(Fts5Sorter,nIdx)+((N+2)/2)*sizeof(i64))
|
||||
|
||||
/*
|
||||
** Virtual-table cursor object.
|
||||
@@ -1050,7 +1052,7 @@ static int fts5CursorFirstSorted(
|
||||
const char *zRankArgs = pCsr->zRankArgs;
|
||||
|
||||
nPhrase = sqlite3Fts5ExprPhraseCount(pCsr->pExpr);
|
||||
nByte = sizeof(Fts5Sorter) + sizeof(int) * (nPhrase-1);
|
||||
nByte = SZ_FTS5SORTER(nPhrase);
|
||||
pSorter = (Fts5Sorter*)sqlite3_malloc64(nByte);
|
||||
if( pSorter==0 ) return SQLITE_NOMEM;
|
||||
memset(pSorter, 0, (size_t)nByte);
|
||||
@@ -3801,8 +3803,8 @@ static int fts5Init(sqlite3 *db){
|
||||
** its entry point to enable the matchinfo() demo. */
|
||||
#ifdef SQLITE_FTS5_ENABLE_TEST_MI
|
||||
if( rc==SQLITE_OK ){
|
||||
extern int sqlite3Fts5TestRegisterMatchinfo(sqlite3*);
|
||||
rc = sqlite3Fts5TestRegisterMatchinfo(db);
|
||||
extern int sqlite3Fts5TestRegisterMatchinfoAPI(fts5_api*);
|
||||
rc = sqlite3Fts5TestRegisterMatchinfoAPI(&pGlobal->api);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+22
-10
@@ -393,17 +393,13 @@ static void fts5MatchinfoFunc(
|
||||
}
|
||||
}
|
||||
|
||||
int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){
|
||||
int rc; /* Return code */
|
||||
fts5_api *pApi; /* FTS5 API functions */
|
||||
/*
|
||||
** Register "matchinfo" with global API object pApi.
|
||||
*/
|
||||
int sqlite3Fts5TestRegisterMatchinfoAPI(fts5_api *pApi){
|
||||
int rc;
|
||||
|
||||
/* Extract the FTS5 API pointer from the database handle. The
|
||||
** fts5_api_from_db() function above is copied verbatim from the
|
||||
** FTS5 documentation. Refer there for details. */
|
||||
rc = fts5_api_from_db(db, &pApi);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
|
||||
/* If fts5_api_from_db() returns NULL, then either FTS5 is not registered
|
||||
/* If fts5_api_from_db() returned NULL, then either FTS5 is not registered
|
||||
** with this database handle, or an error (OOM perhaps?) has occurred.
|
||||
**
|
||||
** Also check that the fts5_api object is version 2 or newer.
|
||||
@@ -418,4 +414,20 @@ int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Register "matchinfo" with database handle db.
|
||||
*/
|
||||
int sqlite3Fts5TestRegisterMatchinfo(sqlite3 *db){
|
||||
int rc; /* Return code */
|
||||
fts5_api *pApi; /* FTS5 API functions */
|
||||
|
||||
/* Extract the FTS5 API pointer from the database handle. The
|
||||
** fts5_api_from_db() function above is copied verbatim from the
|
||||
** FTS5 documentation. Refer there for details. */
|
||||
rc = fts5_api_from_db(db, &pApi);
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
|
||||
return sqlite3Fts5TestRegisterMatchinfoAPI(pApi);
|
||||
}
|
||||
|
||||
#endif /* SQLITE_ENABLE_FTS5 */
|
||||
|
||||
@@ -193,12 +193,12 @@ static int fts5VocabInitVtab(
|
||||
*pzErr = sqlite3_mprintf("wrong number of vtable arguments");
|
||||
rc = SQLITE_ERROR;
|
||||
}else{
|
||||
int nByte; /* Bytes of space to allocate */
|
||||
i64 nByte; /* Bytes of space to allocate */
|
||||
const char *zDb = bDb ? argv[3] : argv[1];
|
||||
const char *zTab = bDb ? argv[4] : argv[3];
|
||||
const char *zType = bDb ? argv[5] : argv[4];
|
||||
int nDb = (int)strlen(zDb)+1;
|
||||
int nTab = (int)strlen(zTab)+1;
|
||||
i64 nDb = strlen(zDb)+1;
|
||||
i64 nTab = strlen(zTab)+1;
|
||||
int eType = 0;
|
||||
|
||||
rc = fts5VocabTableType(zType, pzErr, &eType);
|
||||
|
||||
@@ -290,5 +290,40 @@ do_faultsim_test 11 -faults oom* -prep {
|
||||
faultsim_test_result {0 {}}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
|
||||
ifcapable foreignkey {
|
||||
do_execsql_test 12.0 {
|
||||
CREATE VIRTUAL TABLE f1 USING fts5(content);
|
||||
CREATE TABLE p1(a INTEGER PRIMARY KEY);
|
||||
CREATE TABLE c1(b REFERENCES p1 DEFERRABLE INITIALLY DEFERRED);
|
||||
}
|
||||
|
||||
faultsim_save_and_close
|
||||
|
||||
do_faultsim_test 11 -faults oom* -prep {
|
||||
faultsim_restore_and_reopen
|
||||
execsql {
|
||||
PRAGMA foreign_keys = 1;
|
||||
BEGIN;
|
||||
INSERT INTO c1 VALUES(123);
|
||||
SAVEPOINT xyz;
|
||||
}
|
||||
} -body {
|
||||
execsql {
|
||||
INSERT INTO f1 VALUES('a b c');
|
||||
ROLLBACK TO xyz;
|
||||
COMMIT;
|
||||
}
|
||||
} -test {
|
||||
execsql { SELECT 123 }
|
||||
faultsim_test_result \
|
||||
{1 {FOREIGN KEY constraint failed}} \
|
||||
{1 {out of memory}} \
|
||||
{1 {constraint failed}}
|
||||
}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -520,4 +520,26 @@ do_execsql_test 15.3 {
|
||||
{columnsize {1 1} columntext {c d} columntotalsize {2 2} poslist {} tokenize {c d} rowcount 2}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 16.0 {
|
||||
CREATE TABLE t1(x);
|
||||
BEGIN EXCLUSIVE;
|
||||
}
|
||||
|
||||
sqlite3 db2 test.db
|
||||
do_test 16.1 {
|
||||
catchsql { SELECT * FROM t1 } db2
|
||||
} {1 {database is locked}}
|
||||
|
||||
do_execsql_test 16.2 {
|
||||
ROLLBACK;
|
||||
}
|
||||
|
||||
do_test 16.3 {
|
||||
catchsql { SELECT * FROM t1 } db2
|
||||
} {0 {}}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -591,7 +591,6 @@ do_execsql_test 21.2 {
|
||||
PRAGMA integrity_check
|
||||
} {ok}
|
||||
|
||||
breakpoint
|
||||
sqlite3_db_config db DEFENSIVE 1
|
||||
do_execsql_test 21.3 {
|
||||
CREATE TABLE xyz_notashadow(x, y);
|
||||
@@ -665,5 +664,26 @@ do_execsql_test 25.0 {
|
||||
SELECT fts5_test_poslist(t1) FROM t1('b') ORDER BY rank;
|
||||
} {{}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
|
||||
do_execsql_test 26.0 {
|
||||
PRAGMA foreign_keys = ON;
|
||||
CREATE TABLE t1(x INTEGER PRIMARY KEY);
|
||||
CREATE TABLE t2(y INTEGER PRIMARY KEY,
|
||||
z INTEGER REFERENCES t1(x) DEFERRABLE INITIALLY DEFERRED
|
||||
);
|
||||
CREATE VIRTUAL TABLE t3 USING fts5(a, b, content='', tokendata=1);
|
||||
}
|
||||
|
||||
do_execsql_test 26.1 {
|
||||
BEGIN;
|
||||
INSERT INTO t2 VALUES(1,111);
|
||||
INSERT INTO t3 VALUES(3,3);
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
DELETE FROM t2 WHERE y+1;
|
||||
COMMIT;
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ do_execsql_test 3.0 {
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test that a crash occuring when the second or subsequent tokens in a
|
||||
# Test that a crash occurring when the second or subsequent tokens in a
|
||||
# phrase matched zero rows has been fixed.
|
||||
#
|
||||
do_execsql_test 4.0 {
|
||||
|
||||
+2
-2
@@ -79,7 +79,7 @@ $(bin.version-info): $(dir.tool)/version-info.c $(sqlite3.h) $(dir.top)/Makefile
|
||||
$(MAKE) -C $(dir.top) version-info
|
||||
|
||||
# Be explicit about which Java files to compile so that we can work on
|
||||
# in-progress files without requiring them to be in a compilable statae.
|
||||
# in-progress files without requiring them to be in a compilable state.
|
||||
JAVA_FILES.main := $(patsubst %,$(dir.src.jni)/annotation/%,\
|
||||
Experimental.java \
|
||||
NotNull.java \
|
||||
@@ -451,7 +451,7 @@ distclean: clean
|
||||
-rm -fr $(dir.bld.c) $(dir.doc)
|
||||
|
||||
########################################################################
|
||||
# disttribution bundle rules...
|
||||
# distribution bundle rules...
|
||||
|
||||
ifeq (,$(filter snapshot,$(MAKECMDGOALS)))
|
||||
dist-name-prefix := sqlite-jni
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ deliberately return an error code, instead of segfaulting, when passed
|
||||
a `null`.
|
||||
|
||||
Client-defined callbacks _must never throw exceptions_ unless _very
|
||||
explitly documented_ as being throw-safe. Exceptions are generally
|
||||
explicitly documented_ as being throw-safe. Exceptions are generally
|
||||
reserved for higher-level bindings which are constructed to
|
||||
specifically deal with them and ensure that they do not leak C-level
|
||||
resources. In some cases, callback handlers are permitted to throw, in
|
||||
|
||||
@@ -948,7 +948,7 @@ static JNIEnv * s3jni_env(void){
|
||||
}
|
||||
|
||||
/*
|
||||
** Fetches the S3JniGlobal.envCache row for the given env, allocing a
|
||||
** Fetches the S3JniGlobal.envCache row for the given env, allocating a
|
||||
** row if needed. When a row is allocated, its state is initialized
|
||||
** insofar as possible. Calls (*env)->FatalError() if allocation of an
|
||||
** entry fails. That's hypothetically possible but "shouldn't happen."
|
||||
@@ -1603,7 +1603,7 @@ static void * NativePointerHolder__get(JNIEnv * env, jobject jNph,
|
||||
** 2023-11-09: testing has not revealed any measurable performance
|
||||
** difference between the approach of passing type T to C compared to
|
||||
** passing pointer-to-T to C, and adding support for the latter
|
||||
** everywhere requires sigificantly more code. As of this writing, the
|
||||
** everywhere requires significantly more code. As of this writing, the
|
||||
** older/simpler approach is being applied except for (A) where the
|
||||
** newer approach has already been applied and (B) hot-spot APIs where
|
||||
** a difference of microseconds (i.e. below our testing measurement
|
||||
@@ -3290,7 +3290,7 @@ static void s3jni_rollback_hook_impl(void *pP){
|
||||
static jobject s3jni_commit_rollback_hook(int isCommit, JNIEnv * const env,
|
||||
jlong jpDb, jobject jHook){
|
||||
S3JniDb * ps;
|
||||
jobject pOld = 0; /* previous hoook */
|
||||
jobject pOld = 0; /* previous hook */
|
||||
S3JniHook * pHook; /* ps->hooks.commit|rollback */
|
||||
|
||||
S3JniDb_mutex_enter;
|
||||
@@ -5696,7 +5696,7 @@ JniDeclFtsApi(jint,xCreateFunction)(JniArgsEnvObj, jstring jName,
|
||||
|
||||
typedef struct S3JniFts5AuxData S3JniFts5AuxData;
|
||||
/*
|
||||
** TODO: this middle-man struct is no longer necessary. Conider
|
||||
** TODO: this middle-man struct is no longer necessary. Consider
|
||||
** removing it and passing around jObj itself instead.
|
||||
*/
|
||||
struct S3JniFts5AuxData {
|
||||
|
||||
@@ -199,16 +199,16 @@ public final class CApi {
|
||||
}
|
||||
|
||||
private static native sqlite3_backup sqlite3_backup_init(
|
||||
@NotNull long ptrToDbDest, @NotNull String destTableName,
|
||||
@NotNull long ptrToDbSrc, @NotNull String srcTableName
|
||||
@NotNull long ptrToDbDest, @NotNull String destSchemaName,
|
||||
@NotNull long ptrToDbSrc, @NotNull String srcSchemaName
|
||||
);
|
||||
|
||||
public static sqlite3_backup sqlite3_backup_init(
|
||||
@NotNull sqlite3 dbDest, @NotNull String destTableName,
|
||||
@NotNull sqlite3 dbSrc, @NotNull String srcTableName
|
||||
@NotNull sqlite3 dbDest, @NotNull String destSchemaName,
|
||||
@NotNull sqlite3 dbSrc, @NotNull String srcSchemaName
|
||||
){
|
||||
return sqlite3_backup_init( dbDest.getNativePointer(), destTableName,
|
||||
dbSrc.getNativePointer(), srcTableName );
|
||||
return sqlite3_backup_init( dbDest.getNativePointer(), destSchemaName,
|
||||
dbSrc.getNativePointer(), srcSchemaName );
|
||||
}
|
||||
|
||||
private static native int sqlite3_backup_pagecount(@NotNull long ptrToBackup);
|
||||
@@ -264,7 +264,7 @@ public final class CApi {
|
||||
}
|
||||
|
||||
/**
|
||||
Convenience overload which is equivalant to passing its arguments
|
||||
Convenience overload which is equivalent to passing its arguments
|
||||
to sqlite3_bind_nio_buffer() with the values 0 and -1 for the
|
||||
final two arguments.
|
||||
*/
|
||||
@@ -312,7 +312,7 @@ public final class CApi {
|
||||
|
||||
The byte range of the buffer may be restricted by providing a
|
||||
start index and a number of bytes. beginPos may not be negative.
|
||||
Negative howMany is interpretated as the remainder of the buffer
|
||||
Negative howMany is interpreted as the remainder of the buffer
|
||||
past the given start position, up to the buffer's limit() (as
|
||||
opposed its capacity()).
|
||||
|
||||
@@ -1076,7 +1076,7 @@ public final class CApi {
|
||||
|
||||
/**
|
||||
<p>Works like in the C API with the exception that it only supports
|
||||
the following subset of configution flags:
|
||||
the following subset of configuration flags:
|
||||
|
||||
<p>SQLITE_CONFIG_SINGLETHREAD
|
||||
SQLITE_CONFIG_MULTITHREAD
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.sqlite.jni.capi;
|
||||
classes which have a call() method implementing some specific
|
||||
callback interface on behalf of the C library.
|
||||
|
||||
<p>Unless very explicitely documented otherwise, callbacks must
|
||||
<p>Unless very explicitly documented otherwise, callbacks must
|
||||
never throw. Any which do throw but should not might trigger debug
|
||||
output regarding the error, but the exception will not be
|
||||
propagated. For callback interfaces which support returning error
|
||||
|
||||
@@ -20,7 +20,7 @@ public interface PrepareMultiCallback extends CallbackProxy {
|
||||
|
||||
/**
|
||||
Gets passed a sqlite3_stmt which it may handle in arbitrary ways,
|
||||
transfering ownership of it to this function.
|
||||
transferring ownership of it to this function.
|
||||
|
||||
sqlite3_prepare_multi() will _not_ finalize st - it is up
|
||||
to the call() implementation how st is handled.
|
||||
|
||||
@@ -264,7 +264,7 @@ public class SQLTester {
|
||||
threw = true;
|
||||
outln("🔥EXCEPTION: ",e.getClass().getSimpleName(),": ",e.getMessage());
|
||||
++nAbortedScript;
|
||||
if( keepGoing ) outln("Continuing anyway becaure of the keep-going option.");
|
||||
if( keepGoing ) outln("Continuing anyway because of the keep-going option.");
|
||||
else if( e.isFatal() ) throw e;
|
||||
}finally{
|
||||
final long timeEnd = System.currentTimeMillis();
|
||||
|
||||
@@ -101,7 +101,7 @@ interpreter is in a "verbose" mode, the interpreter might choose to emit
|
||||
an informational message along the lines of "test script NAME abandoned
|
||||
due to unsupported command: --whatever".
|
||||
|
||||
The initial implemention will only recognize a few commands. Other
|
||||
The initial implementation will only recognize a few commands. Other
|
||||
commands may be added later. The following is the initial set of
|
||||
commands:
|
||||
|
||||
|
||||
@@ -661,7 +661,7 @@ public final class Sqlite implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
Equivallent to prepareMulti(X,prepFlags,visitor), where X is
|
||||
Equivalent to prepareMulti(X,prepFlags,visitor), where X is
|
||||
sql.getBytes(StandardCharsets.UTF_8).
|
||||
*/
|
||||
public void prepareMulti(String sql, int prepFlags, PrepareMulti visitor){
|
||||
|
||||
+1
-1
@@ -570,7 +570,7 @@ struct FreelistEntry {
|
||||
/*
|
||||
** A snapshot of a database. A snapshot contains all the information required
|
||||
** to read or write a database file on disk. See the description of struct
|
||||
** Database below for futher details.
|
||||
** Database below for further details.
|
||||
*/
|
||||
struct Snapshot {
|
||||
Database *pDatabase; /* Database this snapshot belongs to */
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@
|
||||
** The argument to this macro must be of type u32. On a little-endian
|
||||
** architecture, it returns the u32 value that results from interpreting
|
||||
** the 4 bytes as a big-endian value. On a big-endian architecture, it
|
||||
** returns the value that would be produced by intepreting the 4 bytes
|
||||
** returns the value that would be produced by interpreting the 4 bytes
|
||||
** of the input value as a little-endian integer.
|
||||
*/
|
||||
#define BYTESWAP32(x) ( \
|
||||
|
||||
+2
-2
@@ -793,7 +793,7 @@ void lsmFsClose(FileSystem *pFS){
|
||||
**
|
||||
** This function returns a pointer to an object that can be linked into
|
||||
** the list described above. The returned object now 'owns' the database
|
||||
** file descriptr, so that when the FileSystem object is destroyed, it
|
||||
** file descriptor, so that when the FileSystem object is destroyed, it
|
||||
** will not be closed.
|
||||
**
|
||||
** This function may be called at most once in the life-time of a
|
||||
@@ -2293,7 +2293,7 @@ int lsmFsMetaPageGet(
|
||||
);
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
/* pPg->aData causes an uninitialized access via a downstreadm write().
|
||||
/* pPg->aData causes an uninitialized access via a downstream write().
|
||||
After discussion on this list, this memory should not, for performance
|
||||
reasons, be memset. However, tracking down "real" misuse is more
|
||||
difficult with this "false" positive, so it is set when NDEBUG.
|
||||
|
||||
+1
-1
@@ -758,7 +758,7 @@ void lsmLogTell(
|
||||
}
|
||||
|
||||
/*
|
||||
** Seek (rewind) back to the log file offset stored by an ealier call to
|
||||
** Seek (rewind) back to the log file offset stored by an earlier call to
|
||||
** lsmLogTell() in *pMark.
|
||||
*/
|
||||
void lsmLogSeek(
|
||||
|
||||
@@ -2652,7 +2652,7 @@ int lsmSortedLoadFreelist(
|
||||
void **ppVal, /* OUT: Blob containing LSM free-list */
|
||||
int *pnVal /* OUT: Size of *ppVal blob in bytes */
|
||||
){
|
||||
MultiCursor *pCsr; /* Cursor used to retreive free-list */
|
||||
MultiCursor *pCsr; /* Cursor used to retrieve free-list */
|
||||
int rc = LSM_OK; /* Return Code */
|
||||
|
||||
assert( pDb->pWorker );
|
||||
@@ -2764,7 +2764,7 @@ static int mcursorLocationOk(MultiCursor *pCsr, int bDeleteOk){
|
||||
}
|
||||
|
||||
/* If the cursor points to a system key (free-list entry), and the
|
||||
** CURSOR_IGNORE_SYSTEM flag is set, skip thie entry. */
|
||||
** CURSOR_IGNORE_SYSTEM flag is set, skip this entry. */
|
||||
if( (pCsr->flags & CURSOR_IGNORE_SYSTEM) && rtTopic(eType)!=0 ){
|
||||
return 0;
|
||||
}
|
||||
@@ -3586,7 +3586,7 @@ static int mergeWorkerBtreeWrite(
|
||||
Hierarchy *p = &pMW->hier;
|
||||
lsm_db *pDb = pMW->pDb; /* Database handle */
|
||||
int rc = LSM_OK; /* Return Code */
|
||||
int iLevel; /* Level of b-tree hierachy to write to */
|
||||
int iLevel; /* Level of b-tree hierarchy to write to */
|
||||
int nData; /* Size of aData[] in bytes */
|
||||
u8 *aData; /* Page data for level iLevel */
|
||||
int iOff; /* Offset on b-tree page to write record to */
|
||||
|
||||
+2
-2
@@ -482,9 +482,9 @@ struct amatch_rule {
|
||||
amatch_rule *pNext; /* Next rule in order of increasing rCost */
|
||||
char *zFrom; /* Transform from (a string from user input) */
|
||||
amatch_cost rCost; /* Cost of this transformation */
|
||||
amatch_langid iLang; /* The langauge to which this rule belongs */
|
||||
amatch_langid iLang; /* The language to which this rule belongs */
|
||||
amatch_len nFrom, nTo; /* Length of the zFrom and zTo strings */
|
||||
char zTo[4]; /* Tranform to V.W value (extra space appended) */
|
||||
char zTo[4]; /* Transform to V.W value (extra space appended) */
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ static u8* fromBase64( char *pIn, int ncIn, u8 *pOut ){
|
||||
deliberate_fall_through; /* FALLTHRU */
|
||||
case 1:
|
||||
pOut[0] = (qv>>16) & 0xff;
|
||||
deliberate_fall_through; /* FALLTHRU */
|
||||
break;
|
||||
}
|
||||
pOut += nbo;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
** USAGE EXAMPLES:
|
||||
**
|
||||
** Show the table btrees in a schema order with the tables with the most
|
||||
** rows occuring first:
|
||||
** rows occurring first:
|
||||
**
|
||||
** SELECT name, nEntry
|
||||
** FROM sqlite_btreeinfo
|
||||
|
||||
@@ -41,6 +41,11 @@ SQLITE_EXTENSION_INIT1
|
||||
|
||||
#ifndef SQLITE_OMIT_VIRTUALTABLE
|
||||
|
||||
#ifndef IsAlnum
|
||||
#define IsAlnum(X) isalnum((unsigned char)X)
|
||||
#endif
|
||||
|
||||
|
||||
/* completion_vtab is a subclass of sqlite3_vtab which will
|
||||
** serve as the underlying representation of a completion virtual table
|
||||
*/
|
||||
@@ -377,7 +382,7 @@ static int completionFilter(
|
||||
}
|
||||
if( pCur->zLine!=0 && pCur->zPrefix==0 ){
|
||||
int i = pCur->nLine;
|
||||
while( i>0 && (isalnum(pCur->zLine[i-1]) || pCur->zLine[i-1]=='_') ){
|
||||
while( i>0 && (IsAlnum(pCur->zLine[i-1]) || pCur->zLine[i-1]=='_') ){
|
||||
i--;
|
||||
}
|
||||
pCur->nPrefix = pCur->nLine - i;
|
||||
|
||||
+1
-1
@@ -315,7 +315,7 @@ typedef struct CsvTable {
|
||||
} CsvTable;
|
||||
|
||||
/* Allowed values for tstFlags */
|
||||
#define CSVTEST_FIDX 0x0001 /* Pretend that constrained searchs cost less*/
|
||||
#define CSVTEST_FIDX 0x0001 /* Pretend that constrained search cost less*/
|
||||
|
||||
/* A cursor for the CSV virtual table */
|
||||
typedef struct CsvCursor {
|
||||
|
||||
+5
-2
@@ -27,6 +27,9 @@ SQLITE_EXTENSION_INIT1
|
||||
# define UNUSED_PARAMETER(X) (void)(X)
|
||||
#endif
|
||||
|
||||
#ifndef IsSpace
|
||||
#define IsSpace(X) isspace((unsigned char)X)
|
||||
#endif
|
||||
|
||||
/* A decimal object */
|
||||
typedef struct Decimal Decimal;
|
||||
@@ -76,7 +79,7 @@ static Decimal *decimalNewFromText(const char *zIn, int n){
|
||||
p->nFrac = 0;
|
||||
p->a = sqlite3_malloc64( n+1 );
|
||||
if( p->a==0 ) goto new_from_text_failed;
|
||||
for(i=0; isspace(zIn[i]); i++){}
|
||||
for(i=0; IsSpace(zIn[i]); i++){}
|
||||
if( zIn[i]=='-' ){
|
||||
p->sign = 1;
|
||||
i++;
|
||||
@@ -731,7 +734,7 @@ static void decimalSubFunc(
|
||||
decimal_free(pB);
|
||||
}
|
||||
|
||||
/* Aggregate funcion: decimal_sum(X)
|
||||
/* Aggregate function: decimal_sum(X)
|
||||
**
|
||||
** Works like sum() except that it uses decimal arithmetic for unlimited
|
||||
** precision.
|
||||
|
||||
+3
-3
@@ -68,7 +68,7 @@
|
||||
** AND distance<200;
|
||||
**
|
||||
** This first query outputs the string "abcdefg" and all strings that
|
||||
** can be derived from that string by appling the specified transformations.
|
||||
** can be derived from that string by applying the specified transformations.
|
||||
** The strings are output together with their total transformation cost
|
||||
** (called "distance") and appear in order of increasing cost. No string
|
||||
** is output more than once. If there are multiple ways to transform the
|
||||
@@ -97,7 +97,7 @@
|
||||
** LIMIT 20
|
||||
**
|
||||
** The query above gives the 20 closest words to the $word being tested.
|
||||
** (Note that for good performance, the vocubulary.w column should be
|
||||
** (Note that for good performance, the vocabulary.w column should be
|
||||
** indexed.)
|
||||
**
|
||||
** A similar query can be used to find all words in the dictionary that
|
||||
@@ -207,7 +207,7 @@ struct fuzzer_rule {
|
||||
** Every stem is added to a hash table as it is output. Generation of
|
||||
** duplicate stems is suppressed.
|
||||
**
|
||||
** Active stems (those that might generate new outputs) are kepts on a linked
|
||||
** Active stems (those that might generate new outputs) are kept on a linked
|
||||
** list sorted by increasing cost. The cost is the sum of rBaseCost and
|
||||
** pRule->rCost.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@
|
||||
** WITH c(name,bin) AS (VALUES
|
||||
** ('minimum positive value', x'0000000000000001'),
|
||||
** ('maximum subnormal value', x'000fffffffffffff'),
|
||||
** ('mininum positive nornal value', x'0010000000000000'),
|
||||
** ('minimum positive normal value', x'0010000000000000'),
|
||||
** ('maximum value', x'7fefffffffffffff'))
|
||||
** SELECT c.name, decimal_mul(ieee754_mantissa(c.bin),pow2.v)
|
||||
** FROM pow2, c WHERE pow2.x=ieee754_exponent(c.bin);
|
||||
|
||||
@@ -286,7 +286,7 @@ static const unsigned char sqlite3CtypeMap[256] = {
|
||||
#define TK_VARIABLE TK_LITERAL
|
||||
#define TK_BLOB TK_LITERAL
|
||||
|
||||
/* Disable nuisence warnings about case fall-through */
|
||||
/* Disable nuisance warnings about case fall-through */
|
||||
#if !defined(deliberate_fall_through) && defined(__GCC__) && __GCC__>=7
|
||||
# define deliberate_fall_through __attribute__((fallthrough));
|
||||
#else
|
||||
|
||||
@@ -205,7 +205,7 @@ static int percentBinarySearch(Percentile *p, double y, int bExact){
|
||||
/*
|
||||
** Generate an error for a percentile function.
|
||||
**
|
||||
** The error format string must have exactly one occurrance of "%%s()"
|
||||
** The error format string must have exactly one occurrence of "%%s()"
|
||||
** (with two '%' characters). That substring will be replaced by the name
|
||||
** of the function.
|
||||
*/
|
||||
|
||||
+3
-5
@@ -139,7 +139,7 @@ static sqlite3_int64 genSeqMember(
|
||||
smBase += (mxI64 - mxI64/2) * smStep;
|
||||
}
|
||||
/* Under UBSAN (or on 1's complement machines), must do this last term
|
||||
* in steps to avoid the dreaded (and harmless) signed multiply overlow. */
|
||||
* in steps to avoid the dreaded (and harmless) signed multiply overflow. */
|
||||
if( ix>=2 ){
|
||||
sqlite3_int64 ix2 = (sqlite3_int64)ix/2;
|
||||
smBase += ix2*smStep;
|
||||
@@ -519,8 +519,7 @@ static int seriesFilter(
|
||||
pCur->ss.iBase += ((d+szStep-1)/szStep)*szStep;
|
||||
}
|
||||
if( pCur->ss.iTerm>iMax ){
|
||||
sqlite3_uint64 d = pCur->ss.iTerm - iMax;
|
||||
pCur->ss.iTerm -= ((d+szStep-1)/szStep)*szStep;
|
||||
pCur->ss.iTerm = iMax;
|
||||
}
|
||||
}else{
|
||||
sqlite3_int64 szStep = -pCur->ss.iStep;
|
||||
@@ -530,8 +529,7 @@ static int seriesFilter(
|
||||
pCur->ss.iBase -= ((d+szStep-1)/szStep)*szStep;
|
||||
}
|
||||
if( pCur->ss.iTerm<iMin ){
|
||||
sqlite3_uint64 d = iMin - pCur->ss.iTerm;
|
||||
pCur->ss.iTerm += ((d+szStep-1)/szStep)*szStep;
|
||||
pCur->ss.iTerm = iMin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@
|
||||
**
|
||||
** typeof(Y)='blob' The hash is taken over prefix "Bnnn:" followed
|
||||
** by the binary content of the blob. The "nnn"
|
||||
** in the prefix is the mimimum-length decimal
|
||||
** in the prefix is the minimum-length decimal
|
||||
** representation of the byte-length of the blob.
|
||||
**
|
||||
** According to the rules above, all of the following SELECT statements
|
||||
|
||||
@@ -46,6 +46,11 @@
|
||||
** use O_U8TEXT when writing to the Windows console (or anything
|
||||
** else for which _isatty() returns true) and to use O_BINARY or O_TEXT
|
||||
** for all other output channels.
|
||||
**
|
||||
** The SQLITE_USE_W32_FOR_CONSOLE_IO macro is also available. If
|
||||
** defined, it forces the use of Win32 APIs for all console I/O, both
|
||||
** input and output. This is necessary for some non-Microsoft run-times
|
||||
** that implement stdio differently from Microsoft/Visual-Studio.
|
||||
*/
|
||||
#if defined(SQLITE_U8TEXT_ONLY)
|
||||
# define UseWtextForOutput(fd) 1
|
||||
@@ -148,10 +153,10 @@ char *sqlite3_fgets(char *buf, int sz, FILE *in){
|
||||
*/
|
||||
wchar_t *b1 = sqlite3_malloc( sz*sizeof(wchar_t) );
|
||||
if( b1==0 ) return 0;
|
||||
#ifndef SQLITE_USE_STDIO_FOR_CONSOLE
|
||||
#ifdef SQLITE_USE_W32_FOR_CONSOLE_IO
|
||||
DWORD nRead = 0;
|
||||
if( IsConsole(in)
|
||||
&& ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), b1, sz, &nRead, 0)
|
||||
&& ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), b1, sz-1, &nRead, 0)
|
||||
){
|
||||
b1[nRead] = 0;
|
||||
}else
|
||||
@@ -226,7 +231,7 @@ int sqlite3_fputs(const char *z, FILE *out){
|
||||
sz = MultiByteToWideChar(CP_UTF8, 0, z, sz, b1, sz);
|
||||
b1[sz] = 0;
|
||||
|
||||
#ifndef SQLITE_STDIO_FOR_CONSOLE
|
||||
#ifdef SQLITE_USE_W32_FOR_CONSOLE_IO
|
||||
DWORD nWr = 0;
|
||||
if( IsConsole(out)
|
||||
&& WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),b1,sz,&nWr,0)
|
||||
@@ -236,8 +241,9 @@ int sqlite3_fputs(const char *z, FILE *out){
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
/* For non-console I/O, or if SQLITE_USE_STDIO_FOR_CONSOLE is defined
|
||||
** then write using the standard library. */
|
||||
/* As long as SQLITE_USE_W32_FOR_CONSOLE_IO is not defined, or for
|
||||
** non-console I/O even if that macro is defined, write using the
|
||||
** standard library. */
|
||||
_setmode(_fileno(out), _O_U8TEXT);
|
||||
if( UseBinaryWText(out) ){
|
||||
piecemealOutput(b1, sz, out);
|
||||
|
||||
+1
-1
@@ -346,7 +346,7 @@ totype_atof_calc:
|
||||
/* store the result */
|
||||
*pResult = result;
|
||||
|
||||
/* return true if number and no extra non-whitespace chracters after */
|
||||
/* return true if number and no extra non-whitespace characters after */
|
||||
return z>=zEnd && nDigits>0 && eValid && nonNum==0;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
** of digits compare in numeric order.
|
||||
**
|
||||
** * Leading zeros are handled properly, in the sense that
|
||||
** they do not mess of the maginitude comparison of embedded
|
||||
** they do not mess of the magnitude comparison of embedded
|
||||
** strings of digits. "x00123y" is equal to "x123y".
|
||||
**
|
||||
** * Only unsigned integers are recognized. Plus and minus
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ SQLITE_EXTENSION_INIT1
|
||||
** To use this module, first compile it as a loadable extension. See
|
||||
** https://www.sqlite.org/loadext.html#build for compilations instructions.
|
||||
**
|
||||
** After compliing, load this extension, then open database connections to be
|
||||
** After compiling, load this extension, then open database connections to be
|
||||
** measured. Query usages status using the vfsstat virtual table:
|
||||
**
|
||||
** SELECT * FROM vfsstat;
|
||||
|
||||
+2
-2
@@ -120,7 +120,7 @@
|
||||
**
|
||||
** Individual APIs can be enabled or disabled by name, with or without
|
||||
** the initial "x" character. For example, to set up for tracing lock
|
||||
** primatives only:
|
||||
** primitives only:
|
||||
**
|
||||
** PRAGMA vfstrace('-all, +Lock,Unlock,ShmLock');
|
||||
**
|
||||
@@ -1033,7 +1033,7 @@ static void vfstraceDlClose(sqlite3_vfs *pVfs, void *pHandle){
|
||||
vfstrace_info *pInfo = (vfstrace_info*)pVfs->pAppData;
|
||||
sqlite3_vfs *pRoot = pInfo->pRootVfs;
|
||||
vfstraceOnOff(pInfo, VTR_DLCLOSE);
|
||||
vfstrace_printf(pInfo, "%s.xDlOpen()\n", pInfo->zVfsName);
|
||||
vfstrace_printf(pInfo, "%s.xDlClose()\n", pInfo->zVfsName);
|
||||
pRoot->xDlClose(pRoot, pHandle);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -425,7 +425,7 @@ static int vtshimRollbackTo(sqlite3_vtab *pBase, int n){
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* The destructor function for a disposible module */
|
||||
/* The destructor function for a disposable module */
|
||||
static void vtshimAuxDestructor(void *pXAux){
|
||||
vtshim_aux *pAux = (vtshim_aux*)pXAux;
|
||||
assert( pAux->pAllVtab==0 );
|
||||
|
||||
@@ -4822,7 +4822,7 @@ static int rbuVfsFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){
|
||||
|
||||
/* If this is an RBU vacuum operation and this is the target database,
|
||||
** pretend that it has at least one page. Otherwise, SQLite will not
|
||||
** check for the existance of a *-wal file. rbuVfsRead() contains
|
||||
** check for the existence of a *-wal file. rbuVfsRead() contains
|
||||
** similar logic. */
|
||||
if( rc==SQLITE_OK && *pSize==0
|
||||
&& p->pRbu && rbuIsVacuum(p->pRbu)
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
**
|
||||
** "RBU" stands for "Resumable Bulk Update". As in a large database update
|
||||
** transmitted via a wireless network to a mobile device. A transaction
|
||||
** applied using this extension is hence refered to as an "RBU update".
|
||||
** applied using this extension is hence referred to as an "RBU update".
|
||||
**
|
||||
**
|
||||
** LIMITATIONS
|
||||
@@ -346,7 +346,7 @@ SQLITE_API sqlite3rbu *sqlite3rbu_open(
|
||||
** the next call to sqlite3rbu_vacuum() opens a handle that starts a
|
||||
** new RBU vacuum operation.
|
||||
**
|
||||
** As with sqlite3rbu_open(), Zipvfs users should rever to the comment
|
||||
** As with sqlite3rbu_open(), Zipvfs users should refer to the comment
|
||||
** describing the sqlite3rbu_create_vfs() API function below for
|
||||
** a description of the complications associated with using RBU with
|
||||
** zipvfs databases.
|
||||
@@ -442,7 +442,7 @@ SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *pRbu);
|
||||
**
|
||||
** If the RBU update has been completely applied, mark the RBU database
|
||||
** as fully applied. Otherwise, assuming no error has occurred, save the
|
||||
** current state of the RBU update appliation to the RBU database.
|
||||
** current state of the RBU update application to the RBU database.
|
||||
**
|
||||
** If an error has already occurred as part of an sqlite3rbu_step()
|
||||
** or sqlite3rbu_open() call, or if one occurs within this function, an
|
||||
|
||||
@@ -39,6 +39,7 @@ do_test 1.2 {
|
||||
} [list {*}{
|
||||
{BEGIN}
|
||||
{PRAGMA writable_schema = on}
|
||||
{PRAGMA foreign_keys = off}
|
||||
{PRAGMA encoding = 'UTF-8'}
|
||||
{PRAGMA page_size = '1024'}
|
||||
{PRAGMA auto_vacuum = '0'}
|
||||
@@ -67,6 +68,7 @@ do_test 1.4 {
|
||||
} [list {*}{
|
||||
{BEGIN}
|
||||
{PRAGMA writable_schema = on}
|
||||
{PRAGMA foreign_keys = off}
|
||||
{PRAGMA encoding = 'UTF-8'}
|
||||
{PRAGMA page_size = '1024'}
|
||||
{PRAGMA auto_vacuum = '0'}
|
||||
|
||||
@@ -33,6 +33,16 @@ typedef unsigned int u32;
|
||||
typedef unsigned char u8;
|
||||
typedef sqlite3_int64 i64;
|
||||
|
||||
/*
|
||||
** Work around C99 "flex-array" syntax for pre-C99 compilers, so as
|
||||
** to avoid complaints from -fsanitize=strict-bounds.
|
||||
*/
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
# define FLEXARRAY
|
||||
#else
|
||||
# define FLEXARRAY 1
|
||||
#endif
|
||||
|
||||
typedef struct RecoverTable RecoverTable;
|
||||
typedef struct RecoverColumn RecoverColumn;
|
||||
|
||||
@@ -140,9 +150,12 @@ struct RecoverColumn {
|
||||
typedef struct RecoverBitmap RecoverBitmap;
|
||||
struct RecoverBitmap {
|
||||
i64 nPg; /* Size of bitmap */
|
||||
u32 aElem[1]; /* Array of 32-bit bitmasks */
|
||||
u32 aElem[FLEXARRAY]; /* Array of 32-bit bitmasks */
|
||||
};
|
||||
|
||||
/* Size in bytes of a RecoverBitmap object sufficient to cover 32 pages */
|
||||
#define SZ_RECOVERBITMAP_32 (16)
|
||||
|
||||
/*
|
||||
** State variables (part of the sqlite3_recover structure) used while
|
||||
** recovering data for tables identified in the recovered schema (state
|
||||
@@ -382,7 +395,7 @@ static int recoverError(
|
||||
*/
|
||||
static RecoverBitmap *recoverBitmapAlloc(sqlite3_recover *p, i64 nPg){
|
||||
int nElem = (nPg+1+31) / 32;
|
||||
int nByte = sizeof(RecoverBitmap) + nElem*sizeof(u32);
|
||||
int nByte = SZ_RECOVERBITMAP_32 + nElem*sizeof(u32);
|
||||
RecoverBitmap *pRet = (RecoverBitmap*)recoverMalloc(p, nByte);
|
||||
|
||||
if( pRet ){
|
||||
@@ -2574,37 +2587,53 @@ static void recoverUninstallWrapper(sqlite3_recover *p){
|
||||
static void recoverStep(sqlite3_recover *p){
|
||||
assert( p && p->errCode==SQLITE_OK );
|
||||
switch( p->eState ){
|
||||
case RECOVER_STATE_INIT:
|
||||
case RECOVER_STATE_INIT: {
|
||||
int bUseWrapper = 1;
|
||||
/* This is the very first call to sqlite3_recover_step() on this object.
|
||||
*/
|
||||
recoverSqlCallback(p, "BEGIN");
|
||||
recoverSqlCallback(p, "PRAGMA writable_schema = on");
|
||||
recoverSqlCallback(p, "PRAGMA foreign_keys = off");
|
||||
|
||||
recoverEnterMutex();
|
||||
recoverInstallWrapper(p);
|
||||
|
||||
/* Open the output database. And register required virtual tables and
|
||||
** user functions with the new handle. */
|
||||
recoverOpenOutput(p);
|
||||
|
||||
/* Open transactions on both the input and output databases. */
|
||||
sqlite3_file_control(p->dbIn, p->zDb, SQLITE_FCNTL_RESET_CACHE, 0);
|
||||
recoverExec(p, p->dbIn, "PRAGMA writable_schema = on");
|
||||
recoverExec(p, p->dbIn, "BEGIN");
|
||||
if( p->errCode==SQLITE_OK ) p->bCloseTransaction = 1;
|
||||
recoverExec(p, p->dbIn, "SELECT 1 FROM sqlite_schema");
|
||||
recoverTransferSettings(p);
|
||||
recoverOpenRecovery(p);
|
||||
recoverCacheSchema(p);
|
||||
/* Attempt to open a transaction and read page 1 of the input database.
|
||||
** Two attempts may be made - one with a wrapper installed to ensure
|
||||
** that the database header is sane, and then if that attempt returns
|
||||
** SQLITE_NOTADB, then again with no wrapper. The second attempt is
|
||||
** required for encrypted databases. */
|
||||
if( p->errCode==SQLITE_OK ){
|
||||
do{
|
||||
p->errCode = SQLITE_OK;
|
||||
if( bUseWrapper ) recoverInstallWrapper(p);
|
||||
|
||||
/* Open a transaction on the input database. */
|
||||
sqlite3_file_control(p->dbIn, p->zDb, SQLITE_FCNTL_RESET_CACHE, 0);
|
||||
recoverExec(p, p->dbIn, "PRAGMA writable_schema = on");
|
||||
recoverExec(p, p->dbIn, "BEGIN");
|
||||
if( p->errCode==SQLITE_OK ) p->bCloseTransaction = 1;
|
||||
recoverExec(p, p->dbIn, "SELECT 1 FROM sqlite_schema");
|
||||
recoverTransferSettings(p);
|
||||
recoverOpenRecovery(p);
|
||||
recoverCacheSchema(p);
|
||||
|
||||
if( bUseWrapper ) recoverUninstallWrapper(p);
|
||||
}while( p->errCode==SQLITE_NOTADB
|
||||
&& (bUseWrapper--)
|
||||
&& SQLITE_OK==sqlite3_exec(p->dbIn, "ROLLBACK", 0, 0, 0)
|
||||
);
|
||||
}
|
||||
|
||||
recoverUninstallWrapper(p);
|
||||
recoverLeaveMutex();
|
||||
|
||||
recoverExec(p, p->dbOut, "BEGIN");
|
||||
|
||||
recoverWriteSchema1(p);
|
||||
p->eState = RECOVER_STATE_WRITING;
|
||||
break;
|
||||
}
|
||||
|
||||
case RECOVER_STATE_WRITING: {
|
||||
if( p->w1.pTbls==0 ){
|
||||
|
||||
@@ -110,7 +110,7 @@ static int cidxConnect(
|
||||
" current_key TEXT," /* SQLite quote() text of key values */
|
||||
" index_name HIDDEN," /* IN: name of the index being scanned */
|
||||
" after_key HIDDEN," /* IN: Start scanning after this key */
|
||||
" scanner_sql HIDDEN" /* debuggingn info: SQL used for scanner */
|
||||
" scanner_sql HIDDEN" /* debugging info: SQL used for scanner */
|
||||
")"
|
||||
);
|
||||
pRet = cidxMalloc(&rc, sizeof(CidxTable));
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ and query r-tree structures using ordinary SQL statements.
|
||||
3 and 11. Unlike regular SQLite tables, r-tree tables are strongly
|
||||
typed.
|
||||
|
||||
The leftmost column is always the pimary key and contains 64-bit
|
||||
The leftmost column is always the primary key and contains 64-bit
|
||||
integer values. Each subsequent column contains a 32-bit real
|
||||
value. For each pair of real values, the first (leftmost) must be
|
||||
less than or equal to the second. R-tree tables may be
|
||||
|
||||
+2
-2
@@ -771,7 +771,7 @@ static void geopolyBBoxFinal(
|
||||
** Determine if point (x0,y0) is beneath line segment (x1,y1)->(x2,y2).
|
||||
** Returns:
|
||||
**
|
||||
** +2 x0,y0 is on the line segement
|
||||
** +2 x0,y0 is on the line segment
|
||||
**
|
||||
** +1 x0,y0 is beneath line segment
|
||||
**
|
||||
@@ -877,7 +877,7 @@ static void geopolyWithinFunc(
|
||||
sqlite3_free(p2);
|
||||
}
|
||||
|
||||
/* Objects used by the overlap algorihm. */
|
||||
/* Objects used by the overlap algorithm. */
|
||||
typedef struct GeoEvent GeoEvent;
|
||||
typedef struct GeoSegment GeoSegment;
|
||||
typedef struct GeoOverlap GeoOverlap;
|
||||
|
||||
+16
-5
@@ -94,6 +94,14 @@ typedef unsigned int u32;
|
||||
# define ALWAYS(X) (X)
|
||||
# define NEVER(X) (X)
|
||||
#endif
|
||||
#ifndef offsetof
|
||||
#define offsetof(STRUCTURE,FIELD) ((size_t)((char*)&((STRUCTURE*)0)->FIELD))
|
||||
#endif
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
# define FLEXARRAY
|
||||
#else
|
||||
# define FLEXARRAY 1
|
||||
#endif
|
||||
#endif /* !defined(SQLITE_AMALGAMATION) */
|
||||
|
||||
/* Macro to check for 4-byte alignment. Only used inside of assert() */
|
||||
@@ -414,9 +422,13 @@ struct RtreeMatchArg {
|
||||
RtreeGeomCallback cb; /* Info about the callback functions */
|
||||
int nParam; /* Number of parameters to the SQL function */
|
||||
sqlite3_value **apSqlParam; /* Original SQL parameter values */
|
||||
RtreeDValue aParam[1]; /* Values for parameters to the SQL function */
|
||||
RtreeDValue aParam[FLEXARRAY]; /* Values for parameters to the SQL function */
|
||||
};
|
||||
|
||||
/* Size of an RtreeMatchArg object with N parameters */
|
||||
#define SZ_RTREEMATCHARG(N) \
|
||||
(offsetof(RtreeMatchArg,aParam)+(N)*sizeof(RtreeDValue))
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(x,y) ((x) < (y) ? (y) : (x))
|
||||
#endif
|
||||
@@ -2105,7 +2117,7 @@ static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the N-dimensional volumn of the cell stored in *p.
|
||||
** Return the N-dimensional volume of the cell stored in *p.
|
||||
*/
|
||||
static RtreeDValue cellArea(Rtree *pRtree, RtreeCell *p){
|
||||
RtreeDValue area = (RtreeDValue)1;
|
||||
@@ -3871,7 +3883,7 @@ static sqlite3_stmt *rtreeCheckPrepare(
|
||||
/*
|
||||
** The second and subsequent arguments to this function are a printf()
|
||||
** style format string and arguments. This function formats the string and
|
||||
** appends it to the report being accumuated in pCheck.
|
||||
** appends it to the report being accumulated in pCheck.
|
||||
*/
|
||||
static void rtreeCheckAppendMsg(RtreeCheck *pCheck, const char *zFmt, ...){
|
||||
va_list ap;
|
||||
@@ -4369,8 +4381,7 @@ static void geomCallback(sqlite3_context *ctx, int nArg, sqlite3_value **aArg){
|
||||
sqlite3_int64 nBlob;
|
||||
int memErr = 0;
|
||||
|
||||
nBlob = sizeof(RtreeMatchArg) + (nArg-1)*sizeof(RtreeDValue)
|
||||
+ nArg*sizeof(sqlite3_value*);
|
||||
nBlob = SZ_RTREEMATCHARG(nArg) + nArg*sizeof(sqlite3_value*);
|
||||
pBlob = (RtreeMatchArg *)sqlite3_malloc64(nBlob);
|
||||
if( !pBlob ){
|
||||
sqlite3_result_error_nomem(ctx);
|
||||
|
||||
@@ -116,7 +116,7 @@ set testprefix rtreedoc2-2
|
||||
# 1-dimensional R*Tree, 4 for a 2-dimensional R*Tree, 6 for a
|
||||
# 3-dimensional R*Tree, and so forth.
|
||||
#
|
||||
# The second argument refered to above is the length of the list passed
|
||||
# The second argument referred to above is the length of the list passed
|
||||
# as the 3rd parameter to the Tcl script.
|
||||
#
|
||||
do_execsql_test 1.0 {
|
||||
|
||||
@@ -285,7 +285,7 @@ do_conflict_test $tn.3.2.3 -tables t2 -sql {
|
||||
{FOREIGN_KEY 1}
|
||||
}
|
||||
do_execsql_test $tn.3.2.4 "SELECT * FROM t2" {}
|
||||
do_db2_test $tn.3.2.5 "SELECT * FROM t2" {1 one 2 two 4 five}
|
||||
do_db2_test $tn.3.2.5 "SELECT * FROM t2" {4 five}
|
||||
|
||||
# Test UPDATE changesets.
|
||||
#
|
||||
|
||||
@@ -80,7 +80,7 @@ foreach {tn delrow trans conflictargs conflictret} {
|
||||
8 3 1 {FOREIGN_KEY 1} ABORT
|
||||
} {
|
||||
|
||||
set A(OMIT,0) {1 SQLITE_CONSTRAINT}
|
||||
set A(OMIT,0) {0 {}}
|
||||
set A(OMIT,1) {0 {}}
|
||||
set A(ABORT,0) {1 SQLITE_CONSTRAINT}
|
||||
set A(ABORT,1) {1 SQLITE_CONSTRAINT}
|
||||
@@ -95,7 +95,7 @@ foreach {tn delrow trans conflictargs conflictret} {
|
||||
|
||||
do_test 1.2.$tn.2 { set ::xConflict } $conflictargs
|
||||
|
||||
set A(OMIT,0) {0 0}
|
||||
set A(OMIT,0) {1 1}
|
||||
set A(OMIT,1) {1 1}
|
||||
set A(ABORT,0) {0 0}
|
||||
set A(ABORT,1) {0 0}
|
||||
|
||||
@@ -201,12 +201,16 @@ proc compare_db {db1 db2} {
|
||||
foreach tbl $lot1 {
|
||||
set col1 [list]
|
||||
set col2 [list]
|
||||
set quoted [list]
|
||||
|
||||
$db1 eval "PRAGMA table_info = $tbl" { lappend col1 $name }
|
||||
$db2 eval "PRAGMA table_info = $tbl" { lappend col2 $name }
|
||||
$db2 eval "PRAGMA table_info = $tbl" {
|
||||
lappend col2 $name
|
||||
lappend quoted "\"[string map {\" \"\"} $name]\""
|
||||
}
|
||||
if {$col1 != $col2} { error "table $tbl schema mismatch" }
|
||||
|
||||
set sql "SELECT * FROM $tbl ORDER BY [join $col1 ,]"
|
||||
set sql "SELECT * FROM $tbl ORDER BY [join $quoted ,]"
|
||||
set data1 [$db1 eval $sql]
|
||||
set data2 [$db2 eval $sql]
|
||||
if {$data1 != $data2} {
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
# 2025 Jan 28
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
if {![info exists testdir]} {
|
||||
set testdir [file join [file dirname [info script]] .. .. test]
|
||||
}
|
||||
source [file join [file dirname [info script]] session_common.tcl]
|
||||
source $testdir/tester.tcl
|
||||
ifcapable !session {finish_test; return}
|
||||
|
||||
set testprefix session_gen
|
||||
|
||||
|
||||
foreach {otn sct} {
|
||||
1 VIRTUAL
|
||||
2 STORED
|
||||
} {
|
||||
eval [string map [list %TYPE% $sct] {
|
||||
reset_db
|
||||
set testprefix $testprefix-$otn
|
||||
|
||||
do_execsql_test 1.0 {
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
|
||||
|
||||
CREATE TABLE t2(a INTEGER PRIMARY KEY, b AS (c+1) %TYPE%, c);
|
||||
|
||||
CREATE TABLE t3(
|
||||
a,
|
||||
b AS (a+10) %TYPE%,
|
||||
c,
|
||||
d AS (c+1) %TYPE%,
|
||||
e,
|
||||
PRIMARY KEY(c, e)
|
||||
) WITHOUT ROWID;
|
||||
|
||||
CREATE TABLE t4(a AS (c*100) %TYPE%, b INTEGER PRIMARY KEY, c);
|
||||
|
||||
CREATE TABLE t5(x, y);
|
||||
}
|
||||
|
||||
foreach {tn sql changeset} {
|
||||
|
||||
0.1 {
|
||||
INSERT INTO t5 VALUES('abc', 'def');
|
||||
} {
|
||||
{INSERT t5 0 X.. {} {i 1 t abc t def}}
|
||||
}
|
||||
0.2 {
|
||||
UPDATE t5 SET y='xyz' WHERE rowid=1;
|
||||
} {
|
||||
{UPDATE t5 0 X.. {i 1 {} {} t def} {{} {} {} {} t xyz}}
|
||||
}
|
||||
0.3 {
|
||||
DELETE FROM t5;
|
||||
} {
|
||||
{DELETE t5 0 X.. {i 1 t abc t xyz} {}}
|
||||
}
|
||||
|
||||
1.1 {
|
||||
INSERT INTO t2 VALUES(1, 2);
|
||||
INSERT INTO t2 VALUES(2, 123);
|
||||
} {
|
||||
{INSERT t2 0 X. {} {i 1 i 2}}
|
||||
{INSERT t2 0 X. {} {i 2 i 123}}
|
||||
}
|
||||
1.2 {
|
||||
UPDATE t2 SET c=456 WHERE a=1
|
||||
} {
|
||||
{UPDATE t2 0 X. {i 1 i 2} {{} {} i 456}}
|
||||
}
|
||||
|
||||
1.3 {
|
||||
DELETE FROM t2 WHERE a=2
|
||||
} {
|
||||
{DELETE t2 0 X. {i 2 i 123} {}}
|
||||
}
|
||||
|
||||
1.4 {
|
||||
UPDATE t2 SET a=15
|
||||
} {
|
||||
{INSERT t2 0 X. {} {i 15 i 456}}
|
||||
{DELETE t2 0 X. {i 1 i 456} {}}
|
||||
}
|
||||
|
||||
2.1 {
|
||||
INSERT INTO t3 VALUES(5, 6, 7);
|
||||
INSERT INTO t3 VALUES(8, 9, 10);
|
||||
} {
|
||||
{INSERT t3 0 .XX {} {i 8 i 9 i 10}}
|
||||
{INSERT t3 0 .XX {} {i 5 i 6 i 7}}
|
||||
}
|
||||
|
||||
2.2 {
|
||||
UPDATE t3 SET a = 505 WHERE (c, e) = (6, 7);
|
||||
} {
|
||||
{UPDATE t3 0 .XX {i 5 i 6 i 7} {i 505 {} {} {} {}}}
|
||||
}
|
||||
|
||||
2.3 {
|
||||
DELETE FROM t3 WHERE (c, e) = (9, 10);
|
||||
} {
|
||||
{DELETE t3 0 .XX {i 8 i 9 i 10} {}}
|
||||
}
|
||||
|
||||
2.4 {
|
||||
UPDATE t3 SET c=1000
|
||||
} {
|
||||
{DELETE t3 0 .XX {i 505 i 6 i 7} {}}
|
||||
{INSERT t3 0 .XX {} {i 505 i 1000 i 7}}
|
||||
}
|
||||
|
||||
3.1 {
|
||||
INSERT INTO t4 VALUES(100, 100);
|
||||
} {
|
||||
{INSERT t4 0 X. {} {i 100 i 100}}
|
||||
}
|
||||
|
||||
} {
|
||||
do_test 1.$tn.1 {
|
||||
sqlite3session S db main
|
||||
S object_config rowid 1
|
||||
S attach *
|
||||
execsql $sql
|
||||
} {}
|
||||
|
||||
do_changeset_test 1.$tn.2 S $changeset
|
||||
|
||||
S delete
|
||||
}
|
||||
#-------------------------------------------------------------------------
|
||||
reset_db
|
||||
|
||||
forcedelete test.db2
|
||||
sqlite3 db2 test.db2
|
||||
|
||||
do_common_sql {
|
||||
CREATE TABLE t0(x INTEGER PRIMARY KEY, y);
|
||||
INSERT INTO t0 VALUES(1, 'one');
|
||||
INSERT INTO t0 VALUES(2, 'two');
|
||||
|
||||
CREATE TABLE t1(a AS (c*10) %TYPE%, b INTEGER PRIMARY KEY, c);
|
||||
INSERT INTO t1 VALUES(1, 5);
|
||||
INSERT INTO t1 VALUES(2, 10);
|
||||
INSERT INTO t1 VALUES(3, 5);
|
||||
|
||||
CREATE TABLE t2(
|
||||
a, b, c AS (a*b) %TYPE%,
|
||||
'k 1', 'k 2', PRIMARY KEY('k 1', 'k 2')
|
||||
) WITHOUT ROWID;
|
||||
INSERT INTO t2 VALUES('a', 'b', 1, 11);
|
||||
INSERT INTO t2 VALUES('A', 'B', 2, 22);
|
||||
INSERT INTO t2 VALUES('Aa', 'Bb', 3, 33);
|
||||
}
|
||||
|
||||
foreach {tn sql} {
|
||||
1.1 { INSERT INTO t0 VALUES(4, 15) }
|
||||
1.2 { INSERT INTO t1 VALUES(4, 15) }
|
||||
1.3 { INSERT INTO t2 VALUES(1, 2, 3, 4) }
|
||||
|
||||
2.1 { UPDATE t1 SET c=100 WHERE b=2 }
|
||||
2.2 { UPDATE t2 SET a=11 }
|
||||
|
||||
3.1 { DELETE FROM t2 WHERE (t2.'k 1') = 2 }
|
||||
3.2 { DELETE FROM t1 }
|
||||
} {
|
||||
do_test 2.$tn.1 {
|
||||
# execsql { PRAGMA vdbe_listing = 1 } db2
|
||||
do_then_apply_sql $sql
|
||||
} {}
|
||||
do_test 2.$tn.2 {
|
||||
compare_db db db2
|
||||
} {}
|
||||
}
|
||||
db2 close
|
||||
|
||||
}]}
|
||||
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
@@ -59,7 +59,7 @@ do_execsql_test 1.2 {
|
||||
set ::nConflict 0
|
||||
proc conflict {args} {
|
||||
incr ::nConflict
|
||||
return "OMIT"
|
||||
return "ABORT"
|
||||
}
|
||||
|
||||
sqlite3changeset_apply_v2 db $C conflict
|
||||
@@ -111,6 +111,9 @@ do_execsql_test 1.8 {
|
||||
# Check that a changeset that causes an FK violation may not be applied,
|
||||
# even if SQLITE_CHANGESETAPPLY_FKNOACTION is specified.
|
||||
#
|
||||
# UPDATE: Unless the conflict-handler returns OMIT. In that case it can
|
||||
# be committed. See test cases 3.* in this file.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 2.0 {
|
||||
CREATE TABLE p1(a INTEGER PRIMARY KEY, b, c UNIQUE);
|
||||
@@ -164,5 +167,66 @@ do_execsql_test 2.8 {
|
||||
SELECT * FROM c1;
|
||||
} {two}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 3.0 {
|
||||
CREATE TABLE p1(a INTEGER PRIMARY KEY, b, c UNIQUE);
|
||||
INSERT INTO p1 VALUES(1, 1, 'one');
|
||||
INSERT INTO p1 VALUES(2, 2, 'two');
|
||||
|
||||
CREATE TABLE c1(x REFERENCES p1(c) ON DELETE CASCADE);
|
||||
INSERT INTO c1 VALUES('two');
|
||||
}
|
||||
|
||||
set ::nConflict 0
|
||||
proc conflict {args} {
|
||||
incr ::nConflict
|
||||
return "OMIT"
|
||||
}
|
||||
|
||||
db_save
|
||||
|
||||
set C [changeset_from_sql {
|
||||
DELETE FROM p1 WHERE a=2;
|
||||
}]
|
||||
|
||||
db_restore_and_reopen
|
||||
|
||||
do_test 3.1 {
|
||||
sqlite3changeset_apply_v2 -noaction db $C conflict
|
||||
} {}
|
||||
do_execsql_test 3.2 {
|
||||
SELECT * FROM p1
|
||||
} {1 1 one}
|
||||
|
||||
db_restore_and_reopen
|
||||
db eval { PRAGMA foreign_keys = 1 }
|
||||
|
||||
do_test 3.3 {
|
||||
list [catch { sqlite3changeset_apply_v2 -noaction db $C conflict } msg] $msg
|
||||
} {0 {}}
|
||||
do_execsql_test 3.4 {
|
||||
SELECT * FROM p1;
|
||||
} {1 1 one}
|
||||
do_execsql_test 3.5 {
|
||||
SELECT * FROM c1;
|
||||
} {two}
|
||||
|
||||
db_restore_and_reopen
|
||||
db eval { PRAGMA foreign_keys = 1 }
|
||||
|
||||
do_test 3.6 {
|
||||
list [catch {
|
||||
sqlite3changeset_apply_v2 -ignorenoop -noaction db $C conflict
|
||||
} msg] $msg
|
||||
} {0 {}}
|
||||
do_execsql_test 3.7 {
|
||||
SELECT * FROM p1;
|
||||
} {1 1 one}
|
||||
do_execsql_test 3.8 {
|
||||
SELECT * FROM c1;
|
||||
} {two}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
@@ -139,11 +139,13 @@ struct sqlite3_changeset_iter {
|
||||
struct SessionTable {
|
||||
SessionTable *pNext;
|
||||
char *zName; /* Local name of table */
|
||||
int nCol; /* Number of columns in table zName */
|
||||
int nCol; /* Number of non-hidden columns */
|
||||
int nTotalCol; /* Number of columns including hidden */
|
||||
int bStat1; /* True if this is sqlite_stat1 */
|
||||
int bRowid; /* True if this table uses rowid for PK */
|
||||
const char **azCol; /* Column names */
|
||||
const char **azDflt; /* Default value expressions */
|
||||
int *aiIdx; /* Index to pass to xNew/xOld */
|
||||
u8 *abPK; /* Array of primary key flags */
|
||||
int nEntry; /* Total number of entries in hash table */
|
||||
int nChange; /* Size of apChange[] array */
|
||||
@@ -546,22 +548,22 @@ static int sessionPreupdateHash(
|
||||
unsigned int h = 0; /* Hash value to return */
|
||||
int i; /* Used to iterate through columns */
|
||||
|
||||
assert( pTab->nTotalCol==pSession->hook.xCount(pSession->hook.pCtx) );
|
||||
if( pTab->bRowid ){
|
||||
assert( pTab->nCol-1==pSession->hook.xCount(pSession->hook.pCtx) );
|
||||
h = sessionHashAppendI64(h, iRowid);
|
||||
}else{
|
||||
assert( *pbNullPK==0 );
|
||||
assert( pTab->nCol==pSession->hook.xCount(pSession->hook.pCtx) );
|
||||
for(i=0; i<pTab->nCol; i++){
|
||||
if( pTab->abPK[i] ){
|
||||
int rc;
|
||||
int eType;
|
||||
sqlite3_value *pVal;
|
||||
int iIdx = pTab->aiIdx[i];
|
||||
|
||||
if( bNew ){
|
||||
rc = pSession->hook.xNew(pSession->hook.pCtx, i, &pVal);
|
||||
rc = pSession->hook.xNew(pSession->hook.pCtx, iIdx, &pVal);
|
||||
}else{
|
||||
rc = pSession->hook.xOld(pSession->hook.pCtx, i, &pVal);
|
||||
rc = pSession->hook.xOld(pSession->hook.pCtx, iIdx, &pVal);
|
||||
}
|
||||
if( rc!=SQLITE_OK ) return rc;
|
||||
|
||||
@@ -898,6 +900,7 @@ static int sessionPreupdateEqual(
|
||||
sqlite3_value *pVal; /* Value returned by preupdate_new/old */
|
||||
int rc; /* Error code from preupdate_new/old */
|
||||
int eType = *a++; /* Type of value from change record */
|
||||
int iIdx = pTab->aiIdx[iCol];
|
||||
|
||||
/* The following calls to preupdate_new() and preupdate_old() can not
|
||||
** fail. This is because they cache their return values, and by the
|
||||
@@ -906,10 +909,10 @@ static int sessionPreupdateEqual(
|
||||
** this (that the method has already been called). */
|
||||
if( op==SQLITE_INSERT ){
|
||||
/* assert( db->pPreUpdate->pNewUnpacked || db->pPreUpdate->aNew ); */
|
||||
rc = pSession->hook.xNew(pSession->hook.pCtx, iCol, &pVal);
|
||||
rc = pSession->hook.xNew(pSession->hook.pCtx, iIdx, &pVal);
|
||||
}else{
|
||||
/* assert( db->pPreUpdate->pUnpacked ); */
|
||||
rc = pSession->hook.xOld(pSession->hook.pCtx, iCol, &pVal);
|
||||
rc = pSession->hook.xOld(pSession->hook.pCtx, iIdx, &pVal);
|
||||
}
|
||||
assert( rc==SQLITE_OK );
|
||||
(void)rc; /* Suppress warning about unused variable */
|
||||
@@ -1034,9 +1037,11 @@ static int sessionTableInfo(
|
||||
const char *zDb, /* Name of attached database (e.g. "main") */
|
||||
const char *zThis, /* Table name */
|
||||
int *pnCol, /* OUT: number of columns */
|
||||
int *pnTotalCol, /* OUT: number of hidden columns */
|
||||
const char **pzTab, /* OUT: Copy of zThis */
|
||||
const char ***pazCol, /* OUT: Array of column names for table */
|
||||
const char ***pazDflt, /* OUT: Array of default value expressions */
|
||||
int **paiIdx, /* OUT: Array of xNew/xOld indexes */
|
||||
u8 **pabPK, /* OUT: Array of booleans - true for PK col */
|
||||
int *pbRowid /* OUT: True if only PK is a rowid */
|
||||
){
|
||||
@@ -1051,6 +1056,7 @@ static int sessionTableInfo(
|
||||
char **azCol = 0;
|
||||
char **azDflt = 0;
|
||||
u8 *abPK = 0;
|
||||
int *aiIdx = 0;
|
||||
int bRowid = 0; /* Set to true to use rowid as PK */
|
||||
|
||||
assert( pazCol && pabPK );
|
||||
@@ -1058,6 +1064,8 @@ static int sessionTableInfo(
|
||||
*pazCol = 0;
|
||||
*pabPK = 0;
|
||||
*pnCol = 0;
|
||||
if( pnTotalCol ) *pnTotalCol = 0;
|
||||
if( paiIdx ) *paiIdx = 0;
|
||||
if( pzTab ) *pzTab = 0;
|
||||
if( pazDflt ) *pazDflt = 0;
|
||||
|
||||
@@ -1067,9 +1075,9 @@ static int sessionTableInfo(
|
||||
if( rc==SQLITE_OK ){
|
||||
/* For sqlite_stat1, pretend that (tbl,idx) is the PRIMARY KEY. */
|
||||
zPragma = sqlite3_mprintf(
|
||||
"SELECT 0, 'tbl', '', 0, '', 1 UNION ALL "
|
||||
"SELECT 1, 'idx', '', 0, '', 2 UNION ALL "
|
||||
"SELECT 2, 'stat', '', 0, '', 0"
|
||||
"SELECT 0, 'tbl', '', 0, '', 1, 0 UNION ALL "
|
||||
"SELECT 1, 'idx', '', 0, '', 2, 0 UNION ALL "
|
||||
"SELECT 2, 'stat', '', 0, '', 0, 0"
|
||||
);
|
||||
}else if( rc==SQLITE_ERROR ){
|
||||
zPragma = sqlite3_mprintf("");
|
||||
@@ -1077,7 +1085,7 @@ static int sessionTableInfo(
|
||||
return rc;
|
||||
}
|
||||
}else{
|
||||
zPragma = sqlite3_mprintf("PRAGMA '%q'.table_info('%q')", zDb, zThis);
|
||||
zPragma = sqlite3_mprintf("PRAGMA '%q'.table_xinfo('%q')", zDb, zThis);
|
||||
}
|
||||
if( !zPragma ){
|
||||
return SQLITE_NOMEM;
|
||||
@@ -1094,7 +1102,9 @@ static int sessionTableInfo(
|
||||
while( SQLITE_ROW==sqlite3_step(pStmt) ){
|
||||
nByte += sqlite3_column_bytes(pStmt, 1); /* name */
|
||||
nByte += sqlite3_column_bytes(pStmt, 4); /* dflt_value */
|
||||
nDbCol++;
|
||||
if( sqlite3_column_int(pStmt, 6)==0 ){ /* !hidden */
|
||||
nDbCol++;
|
||||
}
|
||||
if( sqlite3_column_int(pStmt, 5) ) bRowid = 0; /* pk */
|
||||
}
|
||||
if( nDbCol==0 ) bRowid = 0;
|
||||
@@ -1103,7 +1113,7 @@ static int sessionTableInfo(
|
||||
rc = sqlite3_reset(pStmt);
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
nByte += nDbCol * (sizeof(const char *)*2 + sizeof(u8) + 1 + 1);
|
||||
nByte += nDbCol * (sizeof(const char *)*2 +sizeof(int)+sizeof(u8) + 1 + 1);
|
||||
pAlloc = sessionMalloc64(pSession, nByte);
|
||||
if( pAlloc==0 ){
|
||||
rc = SQLITE_NOMEM;
|
||||
@@ -1114,8 +1124,8 @@ static int sessionTableInfo(
|
||||
if( rc==SQLITE_OK ){
|
||||
azCol = (char **)pAlloc;
|
||||
azDflt = (char**)&azCol[nDbCol];
|
||||
pAlloc = (u8 *)&azDflt[nDbCol];
|
||||
abPK = (u8 *)pAlloc;
|
||||
aiIdx = (int*)&azDflt[nDbCol];
|
||||
abPK = (u8 *)&aiIdx[nDbCol];
|
||||
pAlloc = &abPK[nDbCol];
|
||||
if( pzTab ){
|
||||
memcpy(pAlloc, zThis, nThis+1);
|
||||
@@ -1130,27 +1140,32 @@ static int sessionTableInfo(
|
||||
azCol[i] = (char*)pAlloc;
|
||||
pAlloc += nName+1;
|
||||
abPK[i] = 1;
|
||||
aiIdx[i] = -1;
|
||||
i++;
|
||||
}
|
||||
while( SQLITE_ROW==sqlite3_step(pStmt) ){
|
||||
int nName = sqlite3_column_bytes(pStmt, 1);
|
||||
int nDflt = sqlite3_column_bytes(pStmt, 4);
|
||||
const unsigned char *zName = sqlite3_column_text(pStmt, 1);
|
||||
const unsigned char *zDflt = sqlite3_column_text(pStmt, 4);
|
||||
if( sqlite3_column_int(pStmt, 6)==0 ){ /* !hidden */
|
||||
int nName = sqlite3_column_bytes(pStmt, 1);
|
||||
int nDflt = sqlite3_column_bytes(pStmt, 4);
|
||||
const unsigned char *zName = sqlite3_column_text(pStmt, 1);
|
||||
const unsigned char *zDflt = sqlite3_column_text(pStmt, 4);
|
||||
|
||||
if( zName==0 ) break;
|
||||
memcpy(pAlloc, zName, nName+1);
|
||||
azCol[i] = (char *)pAlloc;
|
||||
pAlloc += nName+1;
|
||||
if( zDflt ){
|
||||
memcpy(pAlloc, zDflt, nDflt+1);
|
||||
azDflt[i] = (char *)pAlloc;
|
||||
pAlloc += nDflt+1;
|
||||
}else{
|
||||
azDflt[i] = 0;
|
||||
if( zName==0 ) break;
|
||||
memcpy(pAlloc, zName, nName+1);
|
||||
azCol[i] = (char *)pAlloc;
|
||||
pAlloc += nName+1;
|
||||
if( zDflt ){
|
||||
memcpy(pAlloc, zDflt, nDflt+1);
|
||||
azDflt[i] = (char *)pAlloc;
|
||||
pAlloc += nDflt+1;
|
||||
}else{
|
||||
azDflt[i] = 0;
|
||||
}
|
||||
abPK[i] = sqlite3_column_int(pStmt, 5);
|
||||
aiIdx[i] = sqlite3_column_int(pStmt, 0);
|
||||
i++;
|
||||
}
|
||||
abPK[i] = sqlite3_column_int(pStmt, 5);
|
||||
i++;
|
||||
if( pnTotalCol ) (*pnTotalCol)++;
|
||||
}
|
||||
rc = sqlite3_reset(pStmt);
|
||||
}
|
||||
@@ -1163,6 +1178,7 @@ static int sessionTableInfo(
|
||||
if( pazDflt ) *pazDflt = (const char**)azDflt;
|
||||
*pabPK = abPK;
|
||||
*pnCol = nDbCol;
|
||||
if( paiIdx ) *paiIdx = aiIdx;
|
||||
}else{
|
||||
sessionFree(pSession, azCol);
|
||||
}
|
||||
@@ -1174,7 +1190,7 @@ static int sessionTableInfo(
|
||||
/*
|
||||
** This function is called to initialize the SessionTable.nCol, azCol[]
|
||||
** abPK[] and azDflt[] members of SessionTable object pTab. If these
|
||||
** fields are already initilialized, this function is a no-op.
|
||||
** fields are already initialized, this function is a no-op.
|
||||
**
|
||||
** If an error occurs, an error code is stored in sqlite3_session.rc and
|
||||
** non-zero returned. Or, if no error occurs but the table has no primary
|
||||
@@ -1194,7 +1210,8 @@ static int sessionInitTable(
|
||||
u8 *abPK;
|
||||
assert( pTab->azCol==0 || pTab->abPK==0 );
|
||||
rc = sessionTableInfo(pSession, db, zDb,
|
||||
pTab->zName, &pTab->nCol, 0, &pTab->azCol, &pTab->azDflt, &abPK,
|
||||
pTab->zName, &pTab->nCol, &pTab->nTotalCol, 0, &pTab->azCol,
|
||||
&pTab->azDflt, &pTab->aiIdx, &abPK,
|
||||
((pSession==0 || pSession->bImplicitPK) ? &pTab->bRowid : 0)
|
||||
);
|
||||
if( rc==SQLITE_OK ){
|
||||
@@ -1229,15 +1246,17 @@ static int sessionInitTable(
|
||||
*/
|
||||
static int sessionReinitTable(sqlite3_session *pSession, SessionTable *pTab){
|
||||
int nCol = 0;
|
||||
int nTotalCol = 0;
|
||||
const char **azCol = 0;
|
||||
const char **azDflt = 0;
|
||||
int *aiIdx = 0;
|
||||
u8 *abPK = 0;
|
||||
int bRowid = 0;
|
||||
|
||||
assert( pSession->rc==SQLITE_OK );
|
||||
|
||||
pSession->rc = sessionTableInfo(pSession, pSession->db, pSession->zDb,
|
||||
pTab->zName, &nCol, 0, &azCol, &azDflt, &abPK,
|
||||
pTab->zName, &nCol, &nTotalCol, 0, &azCol, &azDflt, &aiIdx, &abPK,
|
||||
(pSession->bImplicitPK ? &bRowid : 0)
|
||||
);
|
||||
if( pSession->rc==SQLITE_OK ){
|
||||
@@ -1260,8 +1279,10 @@ static int sessionReinitTable(sqlite3_session *pSession, SessionTable *pTab){
|
||||
const char **a = pTab->azCol;
|
||||
pTab->azCol = azCol;
|
||||
pTab->nCol = nCol;
|
||||
pTab->nTotalCol = nTotalCol;
|
||||
pTab->azDflt = azDflt;
|
||||
pTab->abPK = abPK;
|
||||
pTab->aiIdx = aiIdx;
|
||||
azCol = a;
|
||||
}
|
||||
if( pSession->bEnableSize ){
|
||||
@@ -1579,7 +1600,7 @@ static int sessionUpdateMaxSize(
|
||||
int ii;
|
||||
for(ii=0; ii<pTab->nCol; ii++){
|
||||
sqlite3_value *p = 0;
|
||||
pSession->hook.xNew(pSession->hook.pCtx, ii, &p);
|
||||
pSession->hook.xNew(pSession->hook.pCtx, pTab->aiIdx[ii], &p);
|
||||
sessionSerializeValue(0, p, &nNew);
|
||||
}
|
||||
}
|
||||
@@ -1599,8 +1620,9 @@ static int sessionUpdateMaxSize(
|
||||
int bChanged = 1;
|
||||
int nOld = 0;
|
||||
int eType;
|
||||
int iIdx = pTab->aiIdx[ii];
|
||||
sqlite3_value *p = 0;
|
||||
pSession->hook.xNew(pSession->hook.pCtx, ii-pTab->bRowid, &p);
|
||||
pSession->hook.xNew(pSession->hook.pCtx, iIdx, &p);
|
||||
if( p==0 ){
|
||||
return SQLITE_NOMEM;
|
||||
}
|
||||
@@ -1697,11 +1719,11 @@ static void sessionPreupdateOneChange(
|
||||
/* Check the number of columns in this xPreUpdate call matches the
|
||||
** number of columns in the table. */
|
||||
nExpect = pSession->hook.xCount(pSession->hook.pCtx);
|
||||
if( (pTab->nCol-pTab->bRowid)<nExpect ){
|
||||
if( pTab->nTotalCol<nExpect ){
|
||||
if( sessionReinitTable(pSession, pTab) ) return;
|
||||
if( sessionUpdateChanges(pSession, pTab) ) return;
|
||||
}
|
||||
if( (pTab->nCol-pTab->bRowid)!=nExpect ){
|
||||
if( pTab->nTotalCol!=nExpect ){
|
||||
pSession->rc = SQLITE_SCHEMA;
|
||||
return;
|
||||
}
|
||||
@@ -1758,14 +1780,15 @@ static void sessionPreupdateOneChange(
|
||||
|
||||
/* Figure out how large an allocation is required */
|
||||
nByte = sizeof(SessionChange);
|
||||
for(i=0; i<(pTab->nCol-pTab->bRowid); i++){
|
||||
for(i=pTab->bRowid; i<pTab->nCol; i++){
|
||||
int iIdx = pTab->aiIdx[i];
|
||||
sqlite3_value *p = 0;
|
||||
if( op!=SQLITE_INSERT ){
|
||||
/* This may fail if the column has a non-NULL default and was added
|
||||
** using ALTER TABLE ADD COLUMN after this record was created. */
|
||||
rc = pSession->hook.xOld(pSession->hook.pCtx, i, &p);
|
||||
rc = pSession->hook.xOld(pSession->hook.pCtx, iIdx, &p);
|
||||
}else if( pTab->abPK[i] ){
|
||||
TESTONLY(int trc = ) pSession->hook.xNew(pSession->hook.pCtx, i, &p);
|
||||
TESTONLY(int trc = ) pSession->hook.xNew(pSession->hook.pCtx,iIdx,&p);
|
||||
assert( trc==SQLITE_OK );
|
||||
}
|
||||
|
||||
@@ -1800,12 +1823,13 @@ static void sessionPreupdateOneChange(
|
||||
sessionPutI64(&pC->aRecord[1], iRowid);
|
||||
nByte = 9;
|
||||
}
|
||||
for(i=0; i<(pTab->nCol-pTab->bRowid); i++){
|
||||
for(i=pTab->bRowid; i<pTab->nCol; i++){
|
||||
sqlite3_value *p = 0;
|
||||
int iIdx = pTab->aiIdx[i];
|
||||
if( op!=SQLITE_INSERT ){
|
||||
pSession->hook.xOld(pSession->hook.pCtx, i, &p);
|
||||
pSession->hook.xOld(pSession->hook.pCtx, iIdx, &p);
|
||||
}else if( pTab->abPK[i] ){
|
||||
pSession->hook.xNew(pSession->hook.pCtx, i, &p);
|
||||
pSession->hook.xNew(pSession->hook.pCtx, iIdx, &p);
|
||||
}
|
||||
sessionSerializeValue(&pC->aRecord[nByte], p, &nByte);
|
||||
}
|
||||
@@ -2207,7 +2231,8 @@ int sqlite3session_diff(
|
||||
int bRowid = 0;
|
||||
u8 *abPK;
|
||||
const char **azCol = 0;
|
||||
rc = sessionTableInfo(0, db, zFrom, zTbl, &nCol, 0, &azCol, 0, &abPK,
|
||||
rc = sessionTableInfo(0, db, zFrom, zTbl,
|
||||
&nCol, 0, 0, &azCol, 0, 0, &abPK,
|
||||
pSession->bImplicitPK ? &bRowid : 0
|
||||
);
|
||||
if( rc==SQLITE_OK ){
|
||||
@@ -2531,9 +2556,11 @@ static void sessionAppendIdent(
|
||||
char *zOut = (char *)&p->aBuf[p->nBuf];
|
||||
const char *zIn = zStr;
|
||||
*zOut++ = '"';
|
||||
while( *zIn ){
|
||||
if( *zIn=='"' ) *zOut++ = '"';
|
||||
*zOut++ = *(zIn++);
|
||||
if( zIn!=0 ){
|
||||
while( *zIn ){
|
||||
if( *zIn=='"' ) *zOut++ = '"';
|
||||
*zOut++ = *(zIn++);
|
||||
}
|
||||
}
|
||||
*zOut++ = '"';
|
||||
p->nBuf = (int)((u8 *)zOut - p->aBuf);
|
||||
@@ -2784,10 +2811,10 @@ static int sessionSelectStmt(
|
||||
int rc = SQLITE_OK;
|
||||
char *zSql = 0;
|
||||
const char *zSep = "";
|
||||
const char *zCols = bRowid ? SESSIONS_ROWID ", *" : "*";
|
||||
int nSql = -1;
|
||||
int i;
|
||||
|
||||
SessionBuffer cols = {0, 0, 0};
|
||||
SessionBuffer nooptest = {0, 0, 0};
|
||||
SessionBuffer pkfield = {0, 0, 0};
|
||||
SessionBuffer pkvar = {0, 0, 0};
|
||||
@@ -2800,9 +2827,16 @@ static int sessionSelectStmt(
|
||||
sessionAppendStr(&pkvar,
|
||||
"?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", &rc
|
||||
);
|
||||
zCols = "tbl, ?2, stat";
|
||||
sessionAppendStr(&cols, "tbl, ?2, stat", &rc);
|
||||
}else{
|
||||
#if 0
|
||||
if( bRowid ){
|
||||
sessionAppendStr(&cols, SESSIONS_ROWID, &rc);
|
||||
}
|
||||
#endif
|
||||
for(i=0; i<nCol; i++){
|
||||
if( cols.nBuf ) sessionAppendStr(&cols, ", ", &rc);
|
||||
sessionAppendIdent(&cols, azCol[i], &rc);
|
||||
if( abPK[i] ){
|
||||
sessionAppendStr(&pkfield, zSep, &rc);
|
||||
sessionAppendStr(&pkvar, zSep, &rc);
|
||||
@@ -2820,7 +2854,7 @@ static int sessionSelectStmt(
|
||||
if( rc==SQLITE_OK ){
|
||||
zSql = sqlite3_mprintf(
|
||||
"SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)",
|
||||
zCols, (bIgnoreNoop ? (char*)nooptest.aBuf : ""),
|
||||
(char*)cols.aBuf, (bIgnoreNoop ? (char*)nooptest.aBuf : ""),
|
||||
zDb, zTab, (char*)pkfield.aBuf, (char*)pkvar.aBuf
|
||||
);
|
||||
if( zSql==0 ) rc = SQLITE_NOMEM;
|
||||
@@ -2863,6 +2897,7 @@ static int sessionSelectStmt(
|
||||
sqlite3_free(nooptest.aBuf);
|
||||
sqlite3_free(pkfield.aBuf);
|
||||
sqlite3_free(pkvar.aBuf);
|
||||
sqlite3_free(cols.aBuf);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2978,7 +3013,7 @@ static int sessionGenerateChangeset(
|
||||
){
|
||||
sqlite3 *db = pSession->db; /* Source database handle */
|
||||
SessionTable *pTab; /* Used to iterate through attached tables */
|
||||
SessionBuffer buf = {0,0,0}; /* Buffer in which to accumlate changeset */
|
||||
SessionBuffer buf = {0,0,0}; /* Buffer in which to accumulate changeset */
|
||||
int rc; /* Return code */
|
||||
|
||||
assert( xOutput==0 || (pnChangeset==0 && ppChangeset==0) );
|
||||
@@ -5203,7 +5238,8 @@ static int sessionChangesetApply(
|
||||
|
||||
sqlite3changeset_pk(pIter, &abPK, 0);
|
||||
rc = sessionTableInfo(0, db, "main", zNew,
|
||||
&sApply.nCol, &zTab, &sApply.azCol, 0, &sApply.abPK, &sApply.bRowid
|
||||
&sApply.nCol, 0, &zTab, &sApply.azCol, 0, 0,
|
||||
&sApply.abPK, &sApply.bRowid
|
||||
);
|
||||
if( rc!=SQLITE_OK ) break;
|
||||
for(i=0; i<sApply.nCol; i++){
|
||||
@@ -5284,6 +5320,11 @@ static int sessionChangesetApply(
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int rc2 = sqlite3_exec(db, "PRAGMA defer_foreign_keys = 0", 0, 0, 0);
|
||||
if( rc==SQLITE_OK ) rc = rc2;
|
||||
}
|
||||
|
||||
if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = sqlite3_exec(db, "RELEASE changeset_apply", 0, 0, 0);
|
||||
|
||||
@@ -883,19 +883,6 @@ int sqlite3changeset_concat(
|
||||
void **ppOut /* OUT: Buffer containing output changeset */
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
** CAPI3REF: Upgrade the Schema of a Changeset/Patchset
|
||||
*/
|
||||
int sqlite3changeset_upgrade(
|
||||
sqlite3 *db,
|
||||
const char *zDb,
|
||||
int nIn, const void *pIn, /* Input changeset */
|
||||
int *pnOut, void **ppOut /* OUT: Inverse of input */
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** CAPI3REF: Changegroup Handle
|
||||
**
|
||||
|
||||
+142
-128
@@ -32,19 +32,16 @@
|
||||
#
|
||||
# - Emscripten SDK: https://emscripten.org/docs/getting_started/downloads.html
|
||||
# - The bash shell
|
||||
# - GNU make, GNU sed, GNU awk, GNU grep (all in the $PATH)
|
||||
# - GNU make, GNU sed, GNU awk, GNU grep (all in the $PATH and without
|
||||
# a "g" prefix like they have on some non-GNU systems)
|
||||
# - wasm-strip for release builds: https://github.com/WebAssembly/wabt
|
||||
# - InfoZip for 'dist' zip file
|
||||
########################################################################
|
||||
default: all
|
||||
#default: quick
|
||||
SHELL := $(firstword $(shell which bash) $(wildcard /usr/local/bin/bash /usr/bin/bash /bin/bash))
|
||||
ifeq (,$(SHELL))
|
||||
$(error Cannot find the bash shell)
|
||||
endif
|
||||
MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||
CLEAN_FILES :=
|
||||
DISTCLEAN_FILES :=
|
||||
DISTCLEAN_FILES := config.make
|
||||
MAKING_CLEAN := $(if $(filter %clean,$(MAKECMDGOALS)),1,0)
|
||||
.PHONY: clean distclean
|
||||
clean:
|
||||
@@ -52,6 +49,67 @@ clean:
|
||||
distclean: clean
|
||||
-rm -f $(DISTCLEAN_FILES)
|
||||
|
||||
|
||||
########################################################################
|
||||
# Special-case builds for which we require certain pre-conditions
|
||||
# which, if not met, may cause warnings or fatal errors in the build.
|
||||
# This also affects the default optimization level flags. Note that
|
||||
# the fiddle targets are in this list because they are used for
|
||||
# generating sqlite.org/fiddle.
|
||||
OPTIMIZED_TARGETS := dist snapshot fiddle fiddle.debug
|
||||
|
||||
ifeq (1,$(MAKING_CLEAN))
|
||||
bin.wasm-strip := echo "not stripping"
|
||||
bin.wasm-opt := irrelevant
|
||||
bin.emcc := irrelevant
|
||||
bin.bash := irrelevant
|
||||
emcc.version := unknown
|
||||
else
|
||||
# Include config.make and perform some bootstrapping...
|
||||
ifeq (,$(wildcard ./config.make))
|
||||
$(error Missing config.make (gets generated by the configure script if the EMSDK is found))
|
||||
endif
|
||||
include ./config.make
|
||||
ifeq (,$(bin.bash))
|
||||
$(error Configure script did not find the bash shell)
|
||||
endif
|
||||
ifeq (,$(bin.emcc))
|
||||
$(error Configure script did not find emcc)
|
||||
endif
|
||||
emcc.version := $(shell $(bin.emcc) --version | sed -n 1p | sed -e 's/^.* \([3-9][^ ]*\) .*$$/\1/;')
|
||||
$(info using emcc version [$(emcc.version)])
|
||||
ifeq (,$(bin.wasm-strip))
|
||||
####################################################################
|
||||
# We need wasm-strip for release builds (see below for why) but
|
||||
# not strictly for non-release builds.
|
||||
$(info WARNING: *******************************************************************)
|
||||
$(info WARNING: Builds using -Oz will minify WASM-exported names, breaking)
|
||||
$(info WARNING: _All The Things_. The workaround for that is to build)
|
||||
$(info WARNING: with -g3 (which explodes the file size) and then strip the debug)
|
||||
$(info WARNING: info after compilation, using wasm-strip, to shrink the wasm file.)
|
||||
$(info WARNING: wasm-strip was not found in the PATH so we cannot strip those.)
|
||||
$(info WARNING: If this build uses any optimization level higher than -O1 then)
|
||||
$(info WARNING: the ***resulting JS code WILL NOT BE USABLE***.)
|
||||
$(info WARNING: wasm-strip is part of the wabt package:)
|
||||
$(info WARNING: https://github.com/WebAssembly/wabt)
|
||||
$(info WARNING: on Ubuntu-like systems it can be installed with:)
|
||||
$(info WARNING: sudo apt install wabt)
|
||||
$(info WARNING: *******************************************************************)
|
||||
ifneq (,$(filter $(OPTIMIZED_TARGETS),$(MAKECMDGOALS)))
|
||||
$(error Cannot make release-quality binary because wasm-strip is not available.)
|
||||
endif
|
||||
bin.wasm-strip := echo "not wasm-stripping"
|
||||
endif
|
||||
ifeq (,$(filter $(OPTIMIZED_TARGETS),$(MAKECMDGOALS)))
|
||||
$(info ==============================================================)
|
||||
$(info == Development build. Make one of (dist, snapshot) for a)
|
||||
$(info == smaller and faster release build.)
|
||||
$(info ==============================================================)
|
||||
endif
|
||||
endif
|
||||
# ^^^ end of are-we-MAKING_CLEAN
|
||||
maybe-wasm-strip := $(bin.wasm-strip)
|
||||
|
||||
########################################################################
|
||||
# JS_BUILD_NAMES exists for documentation purposes only. It enumerates
|
||||
# the core build styles:
|
||||
@@ -78,8 +136,9 @@ JS_BUILD_NAMES := sqlite3 sqlite3-wasmfs
|
||||
# target of browsers.
|
||||
#
|
||||
# - node = for use by node.js for node.js, as opposed to by node.js on
|
||||
# behalf o browser-side code (use bundler-friendly for that). Note
|
||||
# behalf of browser-side code (use bundler-friendly for that). Note
|
||||
# that persistent storage (OPFS) is not available in these builds.
|
||||
# These builds are UNTESTED and UNSUPPORTED!
|
||||
#
|
||||
JS_BUILD_MODES := vanilla esm bunder-friendly node
|
||||
|
||||
@@ -107,7 +166,7 @@ dir.wasmfs := $(dir.dout)
|
||||
|
||||
MKDIR.bld := $(dir.tmp)
|
||||
$(MKDIR.bld):
|
||||
-mkdir -p $@ $(dir.dout)
|
||||
@mkdir -p $@ $(dir.dout)
|
||||
|
||||
CLEAN_FILES += *~ $(dir.jacc)/*~ $(dir.api)/*~ $(dir.common)/*~ $(dir.fiddle)/*~ \
|
||||
$(dir.fiddle-debug)/* $(dir.dout)/* $(dir.tmp)/*
|
||||
@@ -133,13 +192,15 @@ sqlite3.canonical.c := $(dir.top)/sqlite3.c
|
||||
sqlite3.c ?= $(firstword $(wildcard $(dir.top)/sqlite3-see.c) $(sqlite3.canonical.c))
|
||||
sqlite3.h := $(dir.top)/sqlite3.h
|
||||
|
||||
ifneq (1,$(MAKING_CLEAN))
|
||||
ifeq (,$(shell grep sqlite3_activate_see $(sqlite3.c)))
|
||||
ifeq (1,$(MAKING_CLEAN))
|
||||
SQLITE_C_IS_SEE := 0
|
||||
else
|
||||
SQLITE_C_IS_SEE := 1
|
||||
$(info This is an SEE build)
|
||||
endif
|
||||
ifeq (,$(shell grep sqlite3_activate_see $(sqlite3.c)))
|
||||
SQLITE_C_IS_SEE := 0
|
||||
else
|
||||
SQLITE_C_IS_SEE := 1
|
||||
$(info This is an SEE build)
|
||||
endif
|
||||
endif
|
||||
|
||||
########################################################################@
|
||||
@@ -151,65 +212,6 @@ $(sqlite3.h):
|
||||
$(MAKE) -C $(dir.top) sqlite3.c
|
||||
$(sqlite3.c): $(sqlite3.h)
|
||||
|
||||
########################################################################
|
||||
# Special-case builds for which we require certain pre-conditions
|
||||
# which, if not met, may cause warnings or fatal errors in the build.
|
||||
# This also affects the default optimization level flags. Note that
|
||||
# the fiddle targets are in this list because they are used for
|
||||
# generating sqlite.org/fiddle.
|
||||
OPTIMIZED_TARGETS := dist snapshot fiddle fiddle.debug
|
||||
|
||||
ifneq (1,$(MAKING_CLEAN))
|
||||
ifeq (,$(filter $(OPTIMIZED_TARGETS),$(MAKECMDGOALS)))
|
||||
$(info ==============================================================)
|
||||
$(info == Development build. Make one of (dist, snapshot) for a)
|
||||
$(info == smaller release build.)
|
||||
$(info ==============================================================)
|
||||
endif
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# Find emcc (Emscripten compiler)...
|
||||
ifeq (1,$(MAKING_CLEAN))
|
||||
emcc.bin := echo
|
||||
emcc.version := unknown
|
||||
else
|
||||
emcc.bin := $(dir.tool)/emcc.sh
|
||||
ifeq (,$(wildcard $(emcc.bin)))
|
||||
$(error Configure script did not find emcc.)
|
||||
endif
|
||||
emcc.version := $(shell $(emcc.bin) --version | sed -n 1p | sed -e 's/^.* \([3-9][^ ]*\) .*$$/\1/;')
|
||||
$(info using emcc version [$(emcc.version)])
|
||||
endif
|
||||
#########################################################################
|
||||
# Find wasm-strip, which we need for release builds (see below for
|
||||
# why) but not strictly for non-release builds.
|
||||
ifeq (1,$(MAKING_CLEAN))
|
||||
wasm-strip-bin := irrelevant
|
||||
else
|
||||
wasm-strip.bin ?= $(shell which wasm-strip 2>/dev/null)
|
||||
ifeq (,$(wasm-strip.bin))
|
||||
$(info WARNING: *******************************************************************)
|
||||
$(info WARNING: Builds using -O2/-O3/-Os/-Oz will minify WASM-exported names,)
|
||||
$(info WARNING: breaking _All The Things_. The workaround for that is to build)
|
||||
$(info WARNING: with -g3 (which explodes the file size) and then strip the debug)
|
||||
$(info WARNING: info after compilation, using wasm-strip, to shrink the wasm file.)
|
||||
$(info WARNING: wasm-strip was not found in the PATH so we cannot strip those.)
|
||||
$(info WARNING: If this build uses any optimization level higher than -O1 then)
|
||||
$(info WARNING: the ***resulting JS code WILL NOT BE USABLE***.)
|
||||
$(info WARNING: wasm-strip is part of the wabt package:)
|
||||
$(info WARNING: https://github.com/WebAssembly/wabt)
|
||||
$(info WARNING: on Ubuntu-like systems it can be installed with:)
|
||||
$(info WARNING: sudo apt install wabt)
|
||||
$(info WARNING: *******************************************************************)
|
||||
ifneq (,$(filter $(OPTIMIZED_TARGETS),$(MAKECMDGOALS)))
|
||||
$(error Cannot make release-quality binary because wasm-strip is not available.)
|
||||
endif
|
||||
wasm-strip.bin := echo "not wasm-stripping"
|
||||
endif
|
||||
endif
|
||||
maybe-wasm-strip := $(wasm-strip.bin)
|
||||
|
||||
########################################################################
|
||||
# barebones=1 disables all "extraneous" stuff from sqlite3-wasm.c, the
|
||||
# goal being to create a WASM file with only the core APIs.
|
||||
@@ -325,7 +327,7 @@ endif
|
||||
# If the canonical build process finds the file
|
||||
# sqlite3_wasm_extra_init.c in the main wasm build directory, it
|
||||
# arranges to include that file in the build of sqlite3.wasm and
|
||||
# defines SQLITE_EXTRA_INIT=sqlite3_wasm_extra_init.
|
||||
# defines SQLITE_EXTRA_INIT_MUTEXED=sqlite3_wasm_extra_init.
|
||||
#
|
||||
# sqlite3_wasm_extra_init() must be a function with this signature:
|
||||
#
|
||||
@@ -357,7 +359,7 @@ endif
|
||||
# Slight caveat: this uses the version info from the in-tree
|
||||
# sqlite3.c/h, which may diff from a user-provided $(sqlite3.c). The
|
||||
# end result is that the generated JS files may have static version
|
||||
# info from $(bin.version-info) which differ from their runtime-emited
|
||||
# info from $(bin.version-info) which differ from their runtime-emitted
|
||||
# version info (e.g. from sqlite3_libversion()).
|
||||
bin.version-info := $(dir.top)/version-info
|
||||
.NOTPARALLEL: $(bin.version-info)
|
||||
@@ -376,20 +378,7 @@ $(bin.stripccomments): $(bin.stripccomments).c $(MAKEFILE)
|
||||
DISTCLEAN_FILES += $(bin.stripccomments)
|
||||
|
||||
########################################################################
|
||||
# bin.mkwb is used for generating some of the makefile code for the
|
||||
# various wasm builds. It used to be generated in this makefile via a
|
||||
# difficult-to-read/maintain block of $(eval)'d code. Attempts were
|
||||
# made to generate it from tcl and bash (shell) but having to escape
|
||||
# the $ references in those languages made it just as illegible as the
|
||||
# native makefile code. Somewhat surprisingly, moving that code generation
|
||||
# to C makes it slightly less illegible than the previous 3 options.
|
||||
bin.mkwb := ./mkwasmbuilds
|
||||
$(bin.mkwb): $(bin.mkwb).c $(MAKEFILE)
|
||||
$(CC) -o $@ $<
|
||||
DISTCLEAN_FILES += $(bin.mkwb)
|
||||
|
||||
########################################################################
|
||||
# C-PP.FILTER: a $(call)able to transform $(1) to $(2) via:
|
||||
# SQLITE.CALL.C-PP.FILTER: a $(call)able to transform $(1) to $(2) via:
|
||||
#
|
||||
# ./c-pp -f $(1) -o $(2) $(3)
|
||||
#
|
||||
@@ -419,7 +408,7 @@ DISTCLEAN_FILES += $(bin.mkwb)
|
||||
# JS/WASM build. They are solely for use with $(bin.c-pp) itself.
|
||||
#
|
||||
# -D... flags which should be included in all invocations should be
|
||||
# appended to $(C-PP.FILTER.global).
|
||||
# appended to $(SQLITE.CALL.C-PP.FILTER.global).
|
||||
bin.c-pp := ./c-pp
|
||||
$(bin.c-pp): c-pp.c $(sqlite3.c) $(MAKEFILE)
|
||||
$(CC) -O0 -o $@ c-pp.c $(sqlite3.c) '-DCMPP_DEFAULT_DELIM="//#"' -I$(dir.top) \
|
||||
@@ -427,20 +416,21 @@ $(bin.c-pp): c-pp.c $(sqlite3.c) $(MAKEFILE)
|
||||
-DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_WAL -DSQLITE_THREADSAFE=0 \
|
||||
-DSQLITE_TEMP_STORE=3
|
||||
DISTCLEAN_FILES += $(bin.c-pp)
|
||||
C-PP.FILTER.global ?=
|
||||
SQLITE.CALL.C-PP.FILTER.global ?=
|
||||
ifeq (1,$(SQLITE_C_IS_SEE))
|
||||
C-PP.FILTER.global += -Denable-see
|
||||
SQLITE.CALL.C-PP.FILTER.global += -Denable-see
|
||||
endif
|
||||
define C-PP.FILTER
|
||||
define SQLITE.CALL.C-PP.FILTER
|
||||
# Create $2 from $1 using $(bin.c-pp)
|
||||
# $1 = Input file: c-pp -f $(1).js
|
||||
# $2 = Output file: c-pp -o $(2).js
|
||||
# $3 = optional c-pp -D... flags
|
||||
$(2): $(1) $$(MAKEFILE) $$(bin.c-pp)
|
||||
$$(bin.c-pp) -f $(1) -o $$@ $(3) $(C-PP.FILTER.global)
|
||||
$(2): $(1) $$(MAKEFILE_LIST) $$(bin.c-pp)
|
||||
@mkdir -p $$(dir $$@)
|
||||
$$(bin.c-pp) -f $(1) -o $$@ $(3) $(SQLITE.CALL.C-PP.FILTER.global)
|
||||
#CLEAN_FILES += $(2)
|
||||
endef
|
||||
# /end C-PP.FILTER
|
||||
# /end SQLITE.CALL.C-PP.FILTER
|
||||
########################################################################
|
||||
|
||||
# cflags.common = C compiler flags for all builds
|
||||
@@ -523,7 +513,7 @@ sqlite3-api-build-version.js := $(dir.tmp)/sqlite3-api-build-version.js
|
||||
# sqlite3-api.jses = the list of JS files which make up
|
||||
# $(sqlite3-api.js.in), in the order they need to be assembled.
|
||||
sqlite3-api.jses := $(sqlite3-license-version.js)
|
||||
# sqlite3-api-prologue.js: initial boostrapping bits:
|
||||
# sqlite3-api-prologue.js: initial bootstrapping bits:
|
||||
sqlite3-api.jses += $(dir.api)/sqlite3-api-prologue.js
|
||||
# whwhasm.js and jaccwabyt.js: Low-level utils, mostly replacing
|
||||
# Emscripten glue:
|
||||
@@ -618,7 +608,6 @@ emcc.cflags += -I. -I$(dir.top)
|
||||
########################################################################
|
||||
# emcc flags specific to building .js/.wasm files...
|
||||
emcc.jsflags := -fPIC
|
||||
emcc.jsflags += --minify 0
|
||||
emcc.jsflags += --no-entry
|
||||
emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT)
|
||||
emcc.jsflags += -sMODULARIZE
|
||||
@@ -631,6 +620,12 @@ emcc.exportedRuntimeMethods := \
|
||||
emcc.jsflags += $(emcc.exportedRuntimeMethods)
|
||||
emcc.jsflags += -sUSE_CLOSURE_COMPILER=0
|
||||
emcc.jsflags += -sIMPORTED_MEMORY
|
||||
ifeq (,$(filter -O0,$(emcc_opt)))
|
||||
emcc.assert ?= 0
|
||||
else
|
||||
emcc.assert ?= 2
|
||||
endif
|
||||
emcc.jsflags += -sASSERTIONS=$(emcc.assert)
|
||||
emcc.jsflags += -sSTRICT_JS=0
|
||||
# STRICT_JS disabled due to:
|
||||
# https://github.com/emscripten-core/emscripten/issues/18610
|
||||
@@ -826,7 +821,7 @@ sqlite3-wasmfs.cfiles := $(sqlite3-wasm.cfiles)
|
||||
########################################################################
|
||||
|
||||
########################################################################
|
||||
# SQLITE3.xJS.ESM-EXPORT-DEFAULT is used by mkwasmbuilds.c and the
|
||||
# SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT is used by mkwasmbuilds.c and the
|
||||
# wasmfs build. $1 is 1 if the build mode needs this workaround
|
||||
# (modes: esm, bundler-friendly, node) and 0 if not (vanilla). $2 must
|
||||
# be 0 for all builds except sqlite3-wasmfs.mjs, in which case it must
|
||||
@@ -847,9 +842,9 @@ sqlite3-wasmfs.cfiles := $(sqlite3-wasm.cfiles)
|
||||
#
|
||||
# Maintenance reminder: Mac sed works differently than GNU sed, so we
|
||||
# use awk instead of sed for this.
|
||||
define SQLITE3.xJS.ESM-EXPORT-DEFAULT
|
||||
define SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT
|
||||
if [ x1 = x$(1) ]; then \
|
||||
echo "Fragile workaround for emscripten/issues/18237. See SQLITE3.xJS.ESM-EXPORT-DEFAULT."; \
|
||||
echo "Fragile workaround for emscripten/issues/18237. See SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT."; \
|
||||
{\
|
||||
awk '/^export default/ && !f{f=1; next} 1' $@ > $@.tmp && mv $@.tmp $@; \
|
||||
} || exit $$?; \
|
||||
@@ -873,14 +868,6 @@ sqlite3-node.mjs := $(dir.dout)/sqlite3-node.mjs
|
||||
sqlite3-api-wasmfs.mjs := $(dir.tmp)/sqlite3-api-wasmfs.mjs
|
||||
sqlite3-wasmfs.mjs := $(dir.wasmfs)/sqlite3-wasmfs.mjs
|
||||
EXPORTED_FUNCTIONS.fiddle := $(dir.tmp)/EXPORTED_FUNCTIONS.fiddle
|
||||
ifneq (1,$(MAKING_CLEAN))
|
||||
.wasmbuilds.make: $(bin.mkwb)
|
||||
@rm -f $@
|
||||
$(bin.mkwb) > $@
|
||||
@chmod -w $@
|
||||
-include .wasmbuilds.make
|
||||
endif
|
||||
DISTCLEAN_FILES += .wasmbuilds.make
|
||||
|
||||
# The various -D... values used by *.c-pp.js include:
|
||||
#
|
||||
@@ -905,12 +892,13 @@ DISTCLEAN_FILES += .wasmbuilds.make
|
||||
########################################################################
|
||||
########################################################################
|
||||
# We have to ensure that we do not build $(sqlite3*.*js) in parallel
|
||||
# because they all result in the creation of $(sqlite3.wasm). We have
|
||||
# no way to build just a .[m]js file without also building the .wasm
|
||||
# file because the generated .[m]js file has to include info about the
|
||||
# imports needed by the wasm file, so they have to be built
|
||||
# for any builds which result in the creation of $(sqlite3.wasm). We
|
||||
# have no way to build just a .[m]js file without also building the
|
||||
# .wasm file because the generated .[m]js file has to include info
|
||||
# about the imports needed by the wasm file, so they have to be built
|
||||
# together. i.e. we're building $(sqlite3.wasm) multiple times, but
|
||||
# that's unavoidable (and harmless, just a waste of build time).
|
||||
# that's unavoidable (and harmless, but is a significant waste of
|
||||
# build time).
|
||||
$(sqlite3.wasm): $(sqlite3.js)
|
||||
$(sqlite3.mjs): $(sqlite3.js)
|
||||
$(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs)
|
||||
@@ -921,7 +909,7 @@ $(sqlite3-node.mjs): $(sqlite3.mjs)
|
||||
# We need separate copies of certain supplementary JS files for the
|
||||
# bundler-friendly build. Concretely, any supplemental JS files which
|
||||
# themselves use importScripts() or Workers or URL() constructors
|
||||
# which refer to other in-tree (m)JS files quire a bundler-friendly
|
||||
# which refer to other in-tree (m)JS files require a bundler-friendly
|
||||
# copy.
|
||||
sqlite3-worker1.js.in := $(dir.api)/sqlite3-worker1.c-pp.js
|
||||
sqlite3-worker1-promiser.js.in := $(dir.api)/sqlite3-worker1-promiser.c-pp.js
|
||||
@@ -930,22 +918,47 @@ sqlite3-worker1-promiser.js := $(dir.dout)/sqlite3-worker1-promiser.js
|
||||
sqlite3-worker1-promiser.mjs := $(dir.dout)/sqlite3-worker1-promiser.mjs
|
||||
sqlite3-worker1-bundler-friendly.mjs := $(dir.dout)/sqlite3-worker1-bundler-friendly.mjs
|
||||
sqlite3-worker1-promiser-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-promiser-bundler-friendly.js
|
||||
$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1.js)))
|
||||
$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1-bundler-friendly.mjs),\
|
||||
|
||||
ifneq (1,$(MAKING_CLEAN))
|
||||
# This block MUST come between the above definitions of
|
||||
# sqlite3-...js/mjs and the $(eval) calls below this block which use
|
||||
# SQLITE.CALL.C-PP.FILTER.
|
||||
########################################################################
|
||||
# bin.mkwb is used for generating some of the makefile code for the
|
||||
# various wasm builds. It used to be generated in this makefile via a
|
||||
# difficult-to-read/maintain block of $(eval)'d code. Attempts were
|
||||
# made to generate it from tcl and bash (shell) but having to escape
|
||||
# the $ references in those languages made it just as illegible as the
|
||||
# native makefile code. Somewhat surprisingly, moving that code generation
|
||||
# to C makes it slightly less illegible than the previous 3 options.
|
||||
bin.mkwb := ./mkwasmbuilds
|
||||
$(bin.mkwb): $(bin.mkwb).c $(MAKEFILE)
|
||||
$(CC) -o $@ $<
|
||||
DISTCLEAN_FILES += $(bin.mkwb)
|
||||
.wasmbuilds.make: $(bin.mkwb)
|
||||
@rm -f $@
|
||||
$(bin.mkwb) > $@
|
||||
@chmod -w $@
|
||||
-include .wasmbuilds.make
|
||||
endif
|
||||
DISTCLEAN_FILES += .wasmbuilds.make
|
||||
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1.js)))
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1-bundler-friendly.mjs),\
|
||||
$(c-pp.D.sqlite3-bundler-friendly)))
|
||||
$(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),$(sqlite3-worker1-promiser.js)))
|
||||
$(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),\
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),$(sqlite3-worker1-promiser.js)))
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),\
|
||||
$(sqlite3-worker1-promiser-bundler-friendly.js),\
|
||||
$(c-pp.D.sqlite3-bundler-friendly)))
|
||||
$(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),$(sqlite3-worker1-promiser.mjs),\
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),$(sqlite3-worker1-promiser.mjs),\
|
||||
-Dtarget=es6-module -Dtarget=es6-bundler-friendly))
|
||||
$(sqlite3-bundler-friendly.mjs): $(sqlite3-worker1-bundler-friendly.mjs) \
|
||||
$(sqlite3-worker1-promiser-bundler-friendly.js)
|
||||
$(eval $(call C-PP.FILTER,demo-worker1-promiser.c-pp.js,demo-worker1-promiser.js))
|
||||
$(eval $(call C-PP.FILTER,demo-worker1-promiser.c-pp.js,demo-worker1-promiser.mjs,\
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,demo-worker1-promiser.c-pp.js,demo-worker1-promiser.js))
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,demo-worker1-promiser.c-pp.js,demo-worker1-promiser.mjs,\
|
||||
-Dtarget=es6-module))
|
||||
$(eval $(call C-PP.FILTER,demo-worker1-promiser.c-pp.html,demo-worker1-promiser.html))
|
||||
$(eval $(call C-PP.FILTER,demo-worker1-promiser.c-pp.html,demo-worker1-promiser-esm.html,\
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,demo-worker1-promiser.c-pp.html,demo-worker1-promiser.html))
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,demo-worker1-promiser.c-pp.html,demo-worker1-promiser-esm.html,\
|
||||
-Dtarget=es6-module))
|
||||
all: $(sqlite3-worker1.js) \
|
||||
$(sqlite3-worker1-promiser.js) $(sqlite3-worker1-promiser.mjs)
|
||||
@@ -1042,7 +1055,7 @@ $(speedtest1.js): $(MAKEFILE) $(speedtest1.cfiles) \
|
||||
$(pre-post-speedtest1-vanilla.deps) \
|
||||
$(EXPORTED_FUNCTIONS.speedtest1)
|
||||
@echo "Building $@ ..."
|
||||
$(emcc.bin) \
|
||||
$(bin.emcc) \
|
||||
$(emcc.speedtest1) \
|
||||
$(emcc.speedtest1.common) \
|
||||
$(emcc.flags.speedtest1-vanilla) $(pre-post-speedtest1-vanilla.flags) \
|
||||
@@ -1052,6 +1065,7 @@ $(speedtest1.js): $(MAKEFILE) $(speedtest1.cfiles) \
|
||||
$(speedtest1.exit-runtime0) \
|
||||
-o $@ $(speedtest1.cfiles) -lm
|
||||
$(maybe-wasm-strip) $(speedtest1.wasm)
|
||||
sed -i -e '/^var _sqlite3.*createExportWrapper/d' $@
|
||||
chmod -x $(speedtest1.wasm)
|
||||
ls -la $@ $(speedtest1.wasm)
|
||||
|
||||
@@ -1077,10 +1091,10 @@ all: speedtest1
|
||||
# tester1.mjs: cases 3 and 4
|
||||
#
|
||||
# To create those, we filter tester1.c-pp.js with $(bin.c-pp)...
|
||||
$(eval $(call C-PP.FILTER,tester1.c-pp.js,tester1.js))
|
||||
$(eval $(call C-PP.FILTER,tester1.c-pp.js,tester1.mjs,$(c-pp.D.sqlite3-esm)))
|
||||
$(eval $(call C-PP.FILTER,tester1.c-pp.html,tester1.html))
|
||||
$(eval $(call C-PP.FILTER,tester1.c-pp.html,tester1-esm.html,$(c-pp.D.sqlite3-esm)))
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,tester1.c-pp.js,tester1.js))
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,tester1.c-pp.js,tester1.mjs,$(c-pp.D.sqlite3-esm)))
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,tester1.c-pp.html,tester1.html))
|
||||
$(eval $(call SQLITE.CALL.C-PP.FILTER,tester1.c-pp.html,tester1-esm.html,$(c-pp.D.sqlite3-esm)))
|
||||
tester1: tester1.js tester1.mjs tester1.html tester1-esm.html
|
||||
# Note that we do not include $(sqlite3-bundler-friendly.mjs) in this
|
||||
# because bundlers are client-specific.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user