Compare commits
211 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 | |||
| cee7609074 | |||
| a75321d735 | |||
| cb0da053ed | |||
| 654c94d683 | |||
| d4bfa3465e | |||
| df54ecb1bf | |||
| 462888819e | |||
| cb46f1bb95 | |||
| 8883deb30e | |||
| 43aad25b1b | |||
| 2539fb2bc5 | |||
| ff6bff4059 | |||
| 362d51a159 | |||
| 4e3b6a14fd | |||
| ce50282c3b | |||
| c978e390e6 | |||
| 800bf8fd93 | |||
| d26bb375be | |||
| b1ad83a342 | |||
| 7d32ec0a5c | |||
| d50eb9c999 | |||
| e5418e9dd3 | |||
| 50ebf16dd6 | |||
| 9c750fe3a3 | |||
| 4ab343cb7c | |||
| b9be2f6396 | |||
| 093c21342c | |||
| 23498de7be | |||
| c99caf5de5 | |||
| 2d5ce92aae | |||
| d4545bca73 | |||
| 9d592359fe | |||
| a180131454 | |||
| f6d267491c | |||
| 1743c5f836 | |||
| 6bd3faa092 |
+15
-11
@@ -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,6 +118,7 @@ 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
|
||||
@@ -125,9 +126,17 @@ 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
|
||||
ENABLE_SHARED = @ENABLE_SHARED@
|
||||
ENABLE_STATIC = @ENABLE_STATIC@
|
||||
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@
|
||||
|
||||
@@ -146,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.
|
||||
@@ -255,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)
|
||||
@@ -316,13 +326,7 @@ 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)
|
||||
|
||||
+22
-6
@@ -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,6 +2346,9 @@ 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:\=/)" -o $(SQLITE3H) $(MKSQLITE3H_ARGS)
|
||||
|
||||
@@ -2812,7 +2828,7 @@ moreclean: clean
|
||||
clean:
|
||||
del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
|
||||
del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
|
||||
del /Q sqlite3.def tclsqlite3.def 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
|
||||
|
||||
@@ -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,279 +1,54 @@
|
||||
#/do/not/tclsh
|
||||
#!/do/not/tclsh
|
||||
# ^^^ help out editors which guess this file's content type.
|
||||
#
|
||||
# This is the main autosetup-compatible configure script for the
|
||||
# SQLite project.
|
||||
#
|
||||
# This script should be kept compatible with JimTCL, a copy of which
|
||||
# is included in this source tree as ./autosetup/jimsh0.c. The number
|
||||
# of incompatibilities between canonical TCL and JimTCL is very low
|
||||
# and alternative formulations of incompatible constructs have, so
|
||||
# far, been easy to find.
|
||||
# This script and all of its dependencies must be kept compatible with
|
||||
# JimTCL, a copy of which is included in this source tree as
|
||||
# ./autosetup/jimsh0.c. The number of incompatibilities between
|
||||
# canonical TCL and JimTCL is very low and alternative formulations of
|
||||
# incompatible constructs have, so far, been easy to find.
|
||||
#
|
||||
# JimTCL: https://jim.tcl.tk
|
||||
#
|
||||
|
||||
use sqlite-config
|
||||
sqlite-configure canonical {
|
||||
proj-if-opt-truthy dev {
|
||||
# --enable-dev needs to come early so that the downstream tests
|
||||
# which check for the following flags use their updated state.
|
||||
proj-opt-set all 1
|
||||
proj-opt-set debug 1
|
||||
proj-opt-set amalgamation 0
|
||||
define CFLAGS [get-env CFLAGS {-O0 -g}]
|
||||
# -------------^^^^^^^ intentionally using [get-env] instead of
|
||||
# [proj-get-env] here because [sqlite-setup-default-cflags] uses
|
||||
# [proj-get-env] and we want this to supercede that.
|
||||
sqlite-munge-cflags
|
||||
}
|
||||
sqlite-check-common-bins ;# must come before [sqlite-handle-wasi-sdk]
|
||||
sqlite-handle-wasi-sdk ;# must run relatively early, as it changes the environment
|
||||
sqlite-check-common-system-deps
|
||||
|
||||
proj-define-for-opt amalgamation USE_AMALGAMATION "Use amalgamation for builds?"
|
||||
|
||||
proj-define-for-opt gcov USE_GCOV "Use gcov?"
|
||||
|
||||
proj-define-for-opt test-status TSTRNNR_OPTS \
|
||||
"test-runner flags:" {--status} {}
|
||||
|
||||
proj-define-for-opt linemacros AMALGAMATION_LINE_MACROS \
|
||||
"Use #line macros in the amalgamation:"
|
||||
|
||||
define AMALGAMATION_EXTRA_SRC \
|
||||
[join [opt-val amalgamation-extra-src ""] " "]
|
||||
|
||||
define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools]
|
||||
|
||||
define CFLAGS_FUZZCHECK_FSANITIZE [proj-check-fsanitize {address bounds-strict}]
|
||||
|
||||
sqlite-handle-tcl
|
||||
sqlite-handle-emsdk
|
||||
|
||||
if {[string first " " $autosetup(srcdir)] != -1} {
|
||||
user-error "The pathname of the source tree\
|
||||
may not contain space characters"
|
||||
}
|
||||
if {[string first " " $autosetup(builddir)] != -1} {
|
||||
user-error "The pathname of the build directory\
|
||||
may not contain space characters"
|
||||
}
|
||||
|
||||
|
||||
########################################################################
|
||||
# Regarding flag compatibility with the historical autotool configure
|
||||
# script:
|
||||
#
|
||||
# A very long story made short, autosetup's --flag handling has
|
||||
# some behaviors which make it impossible to implement 100% identical
|
||||
# flags compared to the historical autotools build. The differences
|
||||
# are documented here:
|
||||
#
|
||||
# 1) --debug is used by autosetup itself, but we patch it because
|
||||
# decades of muscle memory expect --debug to apply to this code,
|
||||
# not the configure script (details are in autosetup/README.md).
|
||||
#
|
||||
# 2) In autosetup, all flags starting with (--enable, --disable) are
|
||||
# forced to be booleans and receive special handling in how they're
|
||||
# resolved. Because of that we have to rename:
|
||||
#
|
||||
# 2.1) --enable-tempstore[=no] to --with-tempstore[=no], noting that
|
||||
# it has four legal values, not two.
|
||||
#
|
||||
########################################################################
|
||||
# A gentle introduction to flags handling in autosetup
|
||||
#
|
||||
# Reference: https://msteveb.github.io/autosetup/developer/
|
||||
#
|
||||
# All configure flags must be described in an 'options' call, which
|
||||
# must appear very early on in this script. The general syntax is:
|
||||
#
|
||||
# FLAG => {Help text}
|
||||
#
|
||||
# Where FLAG can have any of the following formats:
|
||||
#
|
||||
# boolopt => "a boolean option which defaults to disabled"
|
||||
# boolopt2=1 => "a boolean option which defaults to enabled"
|
||||
# stringopt: => "an option which takes an argument, e.g. --stringopt=value"
|
||||
# stringopt2:=value => "an option where the argument is optional and defaults to 'value'"
|
||||
# optalias booltopt3 => "a boolean with a hidden alias. --optalias is not shown in --help"
|
||||
#
|
||||
# Autosetup does no small amount of specialized handling for flags,
|
||||
# especially booleans. Each bool-type --FLAG implicitly gets
|
||||
# --enable-FLAG and --disable-FLAG forms. e.g. we define a flag
|
||||
# "readline", which will be interpreted in one of two ways, depending
|
||||
# on how it's invoked and how its default is defined:
|
||||
#
|
||||
# --enable-readline ==> boolean true
|
||||
# --disable-readline ==> boolean false
|
||||
#
|
||||
# Passing --readline or --readline=1 is equivalent to passing
|
||||
# --enable-readline, and --readline=0 is equivalent to
|
||||
# --disable-readline.
|
||||
#
|
||||
# The behavior described above can lead lead to some confusion when
|
||||
# writing help text. For example:
|
||||
#
|
||||
# options { json=1 {Disable JSON functions} }
|
||||
#
|
||||
# The reason the help text says "disable" is because a boolean option
|
||||
# which defaults to true is, in the --help text, rendered as:
|
||||
#
|
||||
# --disable-json Disable JSON functions
|
||||
#
|
||||
# Whereas a bool flag which defaults to false will instead render as:
|
||||
#
|
||||
# --enable-FLAG
|
||||
#
|
||||
# Non-boolean flags, in contrast, use the names specifically given to
|
||||
# them in the [options] invocation. e.g. "with-tcl" is the --with-tcl
|
||||
# flag.
|
||||
#
|
||||
# Fetching values for flags:
|
||||
#
|
||||
# booleans: use one of:
|
||||
# - [opt-bool FLAG] is autosetup's built-in command for this, but we
|
||||
# have some convenience variants:
|
||||
# - [proj-opt-truthy FLAG]
|
||||
# - [proj-opt-if-truthy FLAG {THEN} {ELSE}]
|
||||
#
|
||||
# Non-boolean (i.e. string) flags:
|
||||
# - [opt-val FLAG ?default?]
|
||||
# - [opt-str ...] - see the docs in ./autosetup/autosetup
|
||||
#
|
||||
########################################################################
|
||||
set flags {
|
||||
# When writing {help text blocks}, be aware that autosetup formats
|
||||
# them differently (left-aligned, directly under the --flag) if the
|
||||
# block starts with a newline. It does NOT expand vars and commands,
|
||||
# but we use a [subst] call below which will replace (only) var
|
||||
# refs.
|
||||
|
||||
# <build-modes>
|
||||
shared=1 => {Disable build of shared libary}
|
||||
static=1 => {Disable build of static library (mostly)}
|
||||
amalgamation=1 => {Disable the amalgamation and instead build all files separately.}
|
||||
# </build-modes>
|
||||
# <lib-feature>
|
||||
threadsafe=1 => {Disable mutexing}
|
||||
with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always}
|
||||
largefile=1 => {Disable large file support}
|
||||
load-extension=1 => {Disable loading of external extensions}
|
||||
math=1 => {Disable math functions}
|
||||
json=1 => {Disable JSON functions}
|
||||
memsys5 => {Enable MEMSYS5}
|
||||
memsys3 => {Enable MEMSYS3}
|
||||
fts3 => {Enable the FTS3 extension}
|
||||
fts4 => {Enable the FTS4 extension}
|
||||
fts5 => {Enable the FTS5 extension}
|
||||
update-limit => {Enable the UPDATE/DELETE LIMIT clause}
|
||||
geopoly => {Enable the GEOPOLY extension}
|
||||
rtree => {Enable the RTREE extension}
|
||||
session => {Enable the SESSION extension}
|
||||
all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
|
||||
# </lib-feature>
|
||||
# <tcl>
|
||||
with-tcl:DIR =>
|
||||
{Directory containing tclConfig.sh or a directory one level up from
|
||||
that, from which we can derive a directory containing tclConfig.sh.
|
||||
A dir name of "prefix" is equivalent to the directory specified by
|
||||
the --prefix flag.}
|
||||
with-tclsh:PATH =>
|
||||
{Full pathname of tclsh to use. It is used for (A) trying to find
|
||||
tclConfig.sh and (B) all TCL-based code generation. Warning: if
|
||||
its containing dir has multiple tclsh versions, it may select the
|
||||
wrong tclConfig.sh!}
|
||||
tcl=1 =>
|
||||
{Disable components which require TCL, including all tests.
|
||||
This tree requires TCL for code generation but can use the in-tree
|
||||
copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the
|
||||
test code require a canonical tclsh.}
|
||||
# <tcl>
|
||||
# <line-editing>
|
||||
readline=1 => {Disable readline support}
|
||||
# --with-readline-lib is a backwards-compatible alias for
|
||||
# --with-readline-ldflags
|
||||
with-readline-lib:
|
||||
with-readline-ldflags:=auto
|
||||
=> {Readline LDFLAGS, e.g. -lreadline -lncurses}
|
||||
# --with-readline-inc is a backwards-compatible alias for
|
||||
# --with-readline-cflags.
|
||||
with-readline-inc:
|
||||
with-readline-cflags:=auto
|
||||
=> {Readline CFLAGS, e.g. -I/path/to/includes}
|
||||
with-readline-header:PATH
|
||||
=> {Full path to readline.h, from which --with-readline-cflags will be derived}
|
||||
with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h}
|
||||
editline=0 => {Enable BSD editline support}
|
||||
# </line-editing>
|
||||
# <icu>
|
||||
with-icu-ldflags:LDFLAGS
|
||||
=> {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries}
|
||||
with-icu-cflags:CFLAGS
|
||||
=> {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include}
|
||||
with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config}
|
||||
icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config}
|
||||
# </icu>
|
||||
# <alternative-builds>
|
||||
with-wasi-sdk:=/opt/wasi-sdk
|
||||
=> {Top-most dir of the wasi-sdk for a WASI build}
|
||||
with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.}
|
||||
# </alternative-builds>
|
||||
# <developer>
|
||||
# Note that using the --debug/--enable-debug flag here requires patching
|
||||
# autosetup/autosetup to rename the --debug to --autosetup-debug.
|
||||
with-debug=0
|
||||
debug=0 =>
|
||||
{Enable debug build flags. This option will impact performance by
|
||||
as much as 4x, as it includes large numbers of assert()s in
|
||||
performance-critical loops. Never use --debug for production
|
||||
builds.}
|
||||
scanstatus => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag}
|
||||
dev => {Enable dev-mode build: automatically enables certain other flags}
|
||||
test-status => {Enable status of tests}
|
||||
gcov=0 => {Enable coverage testing using gcov}
|
||||
linemacros => {Enable #line macros in the amalgamation}
|
||||
dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it.}
|
||||
soname:=legacy =>
|
||||
# --soname has a long story behind it: https://sqlite.org/src/forumpost/5a3b44f510df8ded
|
||||
{SONAME for libsqlite3.so. "none", or not using this flag, sets no
|
||||
soname. "legacy" sets it to its historical value of
|
||||
libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets
|
||||
it to that literal value. Any other value is assumed to be a
|
||||
suffix which gets applied to "libsqlite3.so.",
|
||||
e.g. --soname=9.10 equates to "libsqlite3.so.9.10".
|
||||
}
|
||||
dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)}
|
||||
# </developer>
|
||||
}
|
||||
if {"" ne $::sqliteConfig(dump-defines-json)} {
|
||||
lappend flags \
|
||||
defines-json-include-lowercase=0 \
|
||||
=> {Include lower-case defines (primarily system paths) in $::sqliteConfig(dump-defines-json)}
|
||||
}
|
||||
|
||||
options [subst -nobackslashes -nocommands $flags]
|
||||
unset flags
|
||||
sqlite-post-options-init
|
||||
|
||||
sqlite-setup-default-cflags
|
||||
proj-if-opt-truthy dev {
|
||||
# --enable-dev needs to come early so that the downstream tests
|
||||
# which check for the following flags use their updated state.
|
||||
proj-opt-set all 1
|
||||
proj-opt-set debug 1
|
||||
proj-opt-set amalgamation 0
|
||||
define CFLAGS [get-env CFLAGS {-O0 -g}]
|
||||
# -------------^^^^^^^ intentionally using [get-env] instead of
|
||||
# [proj-get-env] here because [sqlite-setup-default-cflags] uses
|
||||
# [proj-get-env] and we want this to supercede that.
|
||||
}
|
||||
|
||||
sqlite-check-common-bins ;# must come before [sqlite-handle-wasi-sdk]
|
||||
sqlite-handle-wasi-sdk ;# must run relatively early, as it changes the environment
|
||||
sqlite-check-common-system-deps
|
||||
|
||||
#
|
||||
# Enable large file support (if special flags are necessary)
|
||||
#
|
||||
define HAVE_LFS 0
|
||||
if {[opt-bool largefile]} {
|
||||
cc-check-lfs
|
||||
}
|
||||
|
||||
proj-define-for-opt shared ENABLE_SHARED "Build shared library?"
|
||||
|
||||
if {![proj-define-for-opt static ENABLE_STATIC \
|
||||
"Build static library?"]} {
|
||||
proj-warn "Static lib build may be implicitly re-activated by other components, e.g. some test apps."
|
||||
}
|
||||
|
||||
proj-define-for-opt amalgamation USE_AMALGAMATION "Use amalgamation for builds?"
|
||||
|
||||
proj-define-for-opt gcov USE_GCOV "Use gcov?"
|
||||
|
||||
proj-define-for-opt test-status TSTRNNR_OPTS \
|
||||
"test-runner flags:" {--status} {}
|
||||
|
||||
proj-define-for-opt linemacros AMALGAMATION_LINE_MACROS \
|
||||
"Use #line macros in the amalgamation:"
|
||||
|
||||
define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools]
|
||||
|
||||
proj-check-rpath
|
||||
sqlite-handle-soname
|
||||
sqlite-handle-debug
|
||||
sqlite-handle-tcl
|
||||
sqlite-handle-threadsafe
|
||||
sqlite-handle-tempstore
|
||||
sqlite-handle-line-editing
|
||||
sqlite-handle-load-extension
|
||||
sqlite-handle-math
|
||||
sqlite-handle-icu
|
||||
sqlite-handle-emsdk
|
||||
sqlite-common-late-stage-config
|
||||
sqlite-dump-defines
|
||||
|
||||
+81
-43
@@ -67,6 +67,7 @@ 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@
|
||||
|
||||
@@ -86,7 +87,7 @@ install-dir.all = $(install-dir.bin) $(install-dir.include) \
|
||||
$(install-dir.lib) $(install-dir.man1) \
|
||||
$(install-dir.pkgconfig)
|
||||
$(install-dir.all):
|
||||
if [ ! -d "$@" ]; then $(INSTALL) -d "$@"; fi
|
||||
@if [ ! -d "$@" ]; then set -x; $(INSTALL) -d "$@"; fi
|
||||
# ^^^^ on some platforms, install -d fails if the target already exists.
|
||||
|
||||
|
||||
@@ -135,58 +136,83 @@ LDFLAGS.libsqlite3 = \
|
||||
$(LDFLAGS.rpath) $(LDFLAGS.pthread) \
|
||||
$(LDFLAGS.math) $(LDFLAGS.dlopen) \
|
||||
$(LDFLAGS.zlib) $(LDFLAGS.icu) \
|
||||
$(LDFLAGS.configure)
|
||||
$(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.SO = libsqlite3$(T.dll)
|
||||
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.SO): sqlite3.o
|
||||
$(libsqlite3.DLL): sqlite3.o
|
||||
$(CC) -o $@ sqlite3.o $(LDFLAGS.shlib) \
|
||||
$(LDFLAGS) $(LDFLAGS.libsqlite3) \
|
||||
$(LDFLAGS.libsqlite3.os-specific) $(LDFLAGS.libsqlite3.soname)
|
||||
all: $(libsqlite3.SO)
|
||||
$(libsqlite3.DLL)-1: $(libsqlite3.DLL)
|
||||
$(libsqlite3.DLL)-0:
|
||||
all: $(libsqlite3.DLL)-$(ENABLE_LIB_SHARED)
|
||||
|
||||
$(libsqlite3.LIB): sqlite3.o
|
||||
$(AR) $(AR.flags) $@ sqlite3.o
|
||||
all: $(libsqlite3.LIB)
|
||||
$(libsqlite3.LIB)-1: $(libsqlite3.LIB)
|
||||
$(libsqlite3.LIB)-0:
|
||||
all: $(libsqlite3.LIB)-$(ENABLE_LIB_STATIC)
|
||||
|
||||
install-so-1: $(install-dir.lib) $(libsqlite3.SO)
|
||||
$(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)"
|
||||
@echo "Setting up $(libsqlite3.SO) version symlinks..."; \
|
||||
cd "$(install-dir.lib)" || exit $$?; \
|
||||
if [ x.dylib = x$(T.dll) ]; then \
|
||||
rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \
|
||||
dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \
|
||||
mv $(libsqlite3.SO) $$dllname || exit $$?; \
|
||||
ln -s $$dllname $(libsqlite3.SO) || exit $$?; \
|
||||
ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \
|
||||
ls -la $$dllname $(libsqlite3.SO) libsqlite3.0$(T.dll); \
|
||||
else \
|
||||
rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \
|
||||
mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \
|
||||
ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \
|
||||
ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \
|
||||
ls -la $(libsqlite3.SO) $(libsqlite3.SO).[03]*; \
|
||||
if [ -e $(libsqlite3.SO).0.8.6 ]; then \
|
||||
echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \
|
||||
rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \
|
||||
ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \
|
||||
ls -la $(libsqlite3.SO).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.SO).0.8.6 || exit $$?; \
|
||||
ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \
|
||||
ls -la $(libsqlite3.SO).0.8.6; \
|
||||
fi; \
|
||||
#
|
||||
# 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-so-0 install-so-:
|
||||
install-so: install-so-$(ENABLE_LIB_SHARED)
|
||||
install: install-so
|
||||
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)"
|
||||
@@ -194,13 +220,22 @@ install-lib-0 install-lib-:
|
||||
install-lib: install-lib-$(ENABLE_LIB_STATIC)
|
||||
install: install-lib
|
||||
|
||||
|
||||
sqlite3$(T.exe): $(TOP)/shell.c $(TOP)/sqlite3.c
|
||||
#
|
||||
# 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 $(TOP)/sqlite3.c \
|
||||
$(TOP)/shell.c $(sqlite3-shell-link-flags.$(ENABLE_STATIC_SHELL)) \
|
||||
-I. $(OPT_FEATURE_FLAGS) $(SHELL_OPT) \
|
||||
$(CFLAGS) $(CFLAGS.readline) $(CFLAGS.icu) \
|
||||
$(LDFLAGS) $(LDFLAGS.libsqlite3) $(LDFLAGS.readline)
|
||||
$(LDFLAGS) $(LDFLAGS.readline)
|
||||
|
||||
all: sqlite3$(T.exe)
|
||||
|
||||
install-shell: sqlite3$(T.exe) $(install-dir.bin)
|
||||
@@ -221,10 +256,10 @@ install: install-man1
|
||||
|
||||
clean:
|
||||
rm -f *.o sqlite3$(T.exe)
|
||||
rm -f $(libsqlite3.LIB) $(libsqlite3.SO) $(libsqlite3.SO).a
|
||||
rm -f $(libsqlite3.LIB) $(libsqlite3.DLL) libsqlite3$(T.dll).a
|
||||
|
||||
distclean: clean
|
||||
rm -f jimsh0$(T.exe) config.* sqlite3.pc
|
||||
rm -f jimsh0$(T.exe) config.* sqlite3.pc sqlite_cfg.h Makefile
|
||||
|
||||
DIST_FILES := \
|
||||
README.txt VERSION \
|
||||
@@ -234,14 +269,17 @@ DIST_FILES := \
|
||||
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)
|
||||
|
||||
+11
-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 ################################
|
||||
###############################################################################
|
||||
@@ -1088,5 +1098,5 @@ $(LIBRESOBJS): $(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
|
||||
clean:
|
||||
del /Q *.exp *.lo *.ilk *.lib *.obj *.ncb *.pdb *.sdf *.suo 2>NUL
|
||||
del /Q *.bsc *.cod *.da *.bb *.bbg *.vc gmon.out 2>NUL
|
||||
del /Q sqlite3.def tclsqlite3.def 2>NUL
|
||||
del /Q sqlite3.def tclsqlite3.def ctime.c pragma.h 2>NUL
|
||||
del /Q $(SQLITE3EXE) $(SQLITE3DLL) Replace.exe 2>NUL
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ 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
|
||||
|
||||
+4
-91
@@ -1,97 +1,10 @@
|
||||
#/do/not/tclsh
|
||||
#!/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.
|
||||
#
|
||||
# This script must be kept compatible with JimTCL, a copy of which is
|
||||
# included in this source tree as ./autosetup/jimsh0.c.
|
||||
#
|
||||
use sqlite-config
|
||||
|
||||
options {
|
||||
# <build-modes>
|
||||
static=1 => {Disable build of static library}
|
||||
shared=1 => {Disable build of shared library}
|
||||
# </build-modes>
|
||||
# <lib-feature>
|
||||
threadsafe=1 => {Disable mutexing}
|
||||
with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always}
|
||||
load-extension=1 => {Disable loading of external extensions}
|
||||
math=1 => {Disable math functions}
|
||||
json=1 => {Disable JSON functions}
|
||||
memsys5 => {Enable MEMSYS5}
|
||||
memsys3 => {Enable MEMSYS3}
|
||||
fts3 => {Enable the FTS3 extension}
|
||||
fts4 => {Enable the FTS4 extension}
|
||||
fts5 => {Enable the FTS5 extension}
|
||||
update-limit => {Enable the UPDATE/DELETE LIMIT clause}
|
||||
geopoly => {Enable the GEOPOLY extension}
|
||||
rtree => {Enable the RTREE extension}
|
||||
session => {Enable the SESSION extension}
|
||||
all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
|
||||
# </lib-feature>
|
||||
# <line-editing>
|
||||
readline=1 => {Disable readline support}
|
||||
# --with-readline-lib is a backwards-compatible alias for
|
||||
# --with-readline-ldflags
|
||||
with-readline-lib:
|
||||
with-readline-ldflags:=auto
|
||||
=> {Readline LDFLAGS, e.g. -lreadline -lncurses}
|
||||
# --with-readline-inc is a backwards-compatible alias for
|
||||
# --with-readline-cflags.
|
||||
with-readline-inc:
|
||||
with-readline-cflags:=auto
|
||||
=> {Readline CFLAGS, e.g. -I/path/to/includes}
|
||||
with-readline-header:PATH
|
||||
=> {Full path to readline.h, from which --with-readline-cflags will be derived}
|
||||
with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h}
|
||||
editline=0 => {Enable BSD editline support}
|
||||
# </line-editing>
|
||||
# <icu>
|
||||
with-icu-ldflags:LDFLAGS
|
||||
=> {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries}
|
||||
with-icu-cflags:CFLAGS
|
||||
=> {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include}
|
||||
with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config}
|
||||
icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config}
|
||||
# </icu>
|
||||
# <developer>
|
||||
# Note that using the --debug/--enable-debug flag here requires patching
|
||||
# autosetup/autosetup to rename the --debug to --autosetup-debug.
|
||||
with-debug=0
|
||||
debug=0 =>
|
||||
{Enable debug build flags. This option will impact performance by
|
||||
as much as 4x, as it includes large numbers of assert()s in
|
||||
performance-critical loops. Never use --debug for production
|
||||
builds.}
|
||||
# </developer>
|
||||
soname:=legacy =>
|
||||
# --soname has a long story behind it: https://sqlite.org/src/forumpost/5a3b44f510df8ded
|
||||
{SONAME for libsqlite3.so. "none", or not using this flag, sets no
|
||||
soname. "legacy" sets it to its historical value of
|
||||
libsqlite3.so.0. A value matching the glob "libsqlite3.*" sets
|
||||
it to that literal value. Any other value is assumed to be a
|
||||
suffix which gets applied to "libsqlite3.so.",
|
||||
e.g. --soname=9.10 equates to "libsqlite3.so.9.10".
|
||||
}
|
||||
sqlite-configure autoconf {
|
||||
sqlite-check-common-bins
|
||||
sqlite-check-common-system-deps
|
||||
}
|
||||
|
||||
sqlite-post-options-init
|
||||
sqlite-check-common-bins
|
||||
sqlite-check-common-system-deps
|
||||
proj-check-rpath
|
||||
sqlite-handle-soname
|
||||
sqlite-setup-default-cflags
|
||||
sqlite-handle-debug
|
||||
sqlite-handle-threadsafe
|
||||
sqlite-handle-tempstore
|
||||
sqlite-handle-line-editing
|
||||
sqlite-handle-load-extension
|
||||
sqlite-handle-math
|
||||
sqlite-handle-icu
|
||||
|
||||
define ENABLE_LIB_SHARED [opt-bool shared]
|
||||
define ENABLE_LIB_STATIC [opt-bool static]
|
||||
|
||||
sqlite-common-late-stage-config
|
||||
|
||||
@@ -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.50.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],
|
||||
+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."
|
||||
|
||||
+8
-12
@@ -1252,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);
|
||||
|
||||
@@ -2088,10 +2096,6 @@ enum wbuftype {
|
||||
#define UNIX_SOCKETS 0
|
||||
#endif
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN JIM_PATH_LEN
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4173,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
|
||||
|
||||
|
||||
+107
-29
@@ -197,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 the [define] named 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
|
||||
@@ -353,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.
|
||||
@@ -363,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
|
||||
#
|
||||
@@ -907,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
|
||||
#
|
||||
@@ -918,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]"
|
||||
@@ -934,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]}
|
||||
}
|
||||
|
||||
########################################################################
|
||||
@@ -965,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
|
||||
@@ -976,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
|
||||
@@ -1138,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
|
||||
@@ -1146,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
|
||||
@@ -1191,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
|
||||
|
||||
+710
-114
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} {
|
||||
|
||||
+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:
|
||||
|
||||
|
||||
+5
-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.
|
||||
**
|
||||
|
||||
+20
-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.
|
||||
**
|
||||
|
||||
@@ -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
|
||||
|
||||
+16
-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 ){
|
||||
|
||||
@@ -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; }
|
||||
*/
|
||||
|
||||
+52
-34
@@ -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);
|
||||
@@ -1026,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 ){
|
||||
@@ -1100,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 ){
|
||||
@@ -1183,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 ){
|
||||
@@ -1725,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);
|
||||
@@ -1943,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 ){
|
||||
@@ -3404,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 ){
|
||||
@@ -5206,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);
|
||||
|
||||
@@ -5771,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;
|
||||
|
||||
@@ -5800,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 ){
|
||||
@@ -6377,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
|
||||
@@ -6451,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){
|
||||
@@ -6642,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 ){
|
||||
@@ -6688,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];
|
||||
@@ -6769,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);
|
||||
}
|
||||
|
||||
@@ -6985,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 ){
|
||||
@@ -7501,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 ){
|
||||
|
||||
@@ -7632,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 ){
|
||||
@@ -8666,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 ){
|
||||
@@ -8912,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);
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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) */
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -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
|
||||
|
||||
+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;
|
||||
|
||||
+1
-1
@@ -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');
|
||||
**
|
||||
|
||||
+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 {
|
||||
|
||||
@@ -1190,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
|
||||
@@ -3013,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) );
|
||||
|
||||
@@ -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
|
||||
**
|
||||
|
||||
+13
-11
@@ -103,7 +103,7 @@ else
|
||||
ifeq (,$(filter $(OPTIMIZED_TARGETS),$(MAKECMDGOALS)))
|
||||
$(info ==============================================================)
|
||||
$(info == Development build. Make one of (dist, snapshot) for a)
|
||||
$(info == smaller release build.)
|
||||
$(info == smaller and faster release build.)
|
||||
$(info ==============================================================)
|
||||
endif
|
||||
endif
|
||||
@@ -136,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
|
||||
|
||||
@@ -326,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:
|
||||
#
|
||||
@@ -358,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)
|
||||
@@ -512,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:
|
||||
@@ -891,12 +892,13 @@ EXPORTED_FUNCTIONS.fiddle := $(dir.tmp)/EXPORTED_FUNCTIONS.fiddle
|
||||
########################################################################
|
||||
########################################################################
|
||||
# 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)
|
||||
@@ -907,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
|
||||
|
||||
@@ -1835,7 +1835,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
if(!(tgt instanceof StructBinder.StructType)){
|
||||
toss("Usage error: target object is-not-a StructType.");
|
||||
}else if(!(func instanceof Function) && !wasm.isPtr(func)){
|
||||
toss("Usage errror: expecting a Function or WASM pointer to one.");
|
||||
toss("Usage error: expecting a Function or WASM pointer to one.");
|
||||
}
|
||||
if(1===arguments.length){
|
||||
return (n,f)=>callee(tgt, n, f, applyArgcCheck);
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
apiConfig = (globalThis.sqlite3ApiConfig || sqlite3ApiBootstrap.defaultConfig)
|
||||
){
|
||||
if(sqlite3ApiBootstrap.sqlite3){ /* already initalized */
|
||||
if(sqlite3ApiBootstrap.sqlite3){ /* already initialized */
|
||||
(sqlite3ApiBootstrap.sqlite3.config || console).warn(
|
||||
"sqlite3ApiBootstrap() called multiple times.",
|
||||
"Config and external initializers are ignored on calls after the first."
|
||||
@@ -869,7 +869,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
Emscripten -sWASM_BIGINT flag, else false. When
|
||||
enabled, certain 64-bit sqlite3 APIs are enabled which
|
||||
are not otherwise enabled due to JS/WASM int64
|
||||
impedence mismatches.
|
||||
impedance mismatches.
|
||||
*/
|
||||
bigIntEnabled: !!config.bigIntEnabled,
|
||||
/**
|
||||
@@ -880,7 +880,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
|
||||
/**
|
||||
When Emscripten compiles with `-sIMPORTED_MEMORY`, it
|
||||
initalizes the heap and imports it into wasm, as opposed to
|
||||
initializes the heap and imports it into wasm, as opposed to
|
||||
the other way around. In this case, the memory is not
|
||||
available via this.exports.memory.
|
||||
*/
|
||||
@@ -1453,7 +1453,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
creates (or overwrites) the given file using those APIs. This is
|
||||
primarily intended for use in Emscripten-based builds where the POSIX
|
||||
APIs are transparently proxied by an in-memory virtual filesystem.
|
||||
It may behave diffrently in other environments.
|
||||
It may behave differently in other environments.
|
||||
|
||||
The first argument must be either a JS string or WASM C-string
|
||||
holding the filename. Note that this routine does _not_ create
|
||||
@@ -1555,7 +1555,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||
- "memdb": results are undefined.
|
||||
|
||||
- "kvvfs": will fail with an I/O error due to strict internal
|
||||
requirments of that VFS's xTruncate().
|
||||
requirements of that VFS's xTruncate().
|
||||
|
||||
- "unix" and related: will use the WASM build's equivalent of the
|
||||
POSIX I/O APIs. This will work so long as neither a specific
|
||||
|
||||
@@ -61,7 +61,7 @@ const installAsyncProxy = function(){
|
||||
}
|
||||
|
||||
/**
|
||||
Will hold state copied to this object from the syncronous side of
|
||||
Will hold state copied to this object from the synchronous side of
|
||||
this API.
|
||||
*/
|
||||
const state = Object.create(null);
|
||||
@@ -722,7 +722,7 @@ const installAsyncProxy = function(){
|
||||
|
||||
https://github.com/tomayac/sqlite-wasm/issues/12
|
||||
|
||||
is reporting that this occassionally, under high loads,
|
||||
is reporting that this occasionally, under high loads,
|
||||
returns 'ok', which leads to the whichOp being 0 (which
|
||||
isn't a valid operation ID and leads to an exception,
|
||||
along with a corresponding ugly console log
|
||||
|
||||
@@ -501,22 +501,10 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
currently-opened client-specified filenames. */
|
||||
getFileNames(){
|
||||
const rc = [];
|
||||
const iter = this.#mapFilenameToSAH.keys();
|
||||
for(const n of iter) rc.push(n);
|
||||
for(const n of this.#mapFilenameToSAH.keys()) rc.push(n);
|
||||
return rc;
|
||||
}
|
||||
|
||||
// #createFileObject(sah,clientName,opaqueName){
|
||||
// const f = Object.assign(Object.create(null),{
|
||||
// clientName, opaqueName
|
||||
// });
|
||||
// this.#mapSAHToMeta.set(sah, f);
|
||||
// return f;
|
||||
// }
|
||||
// #unmapFileObject(sah){
|
||||
// this.#mapSAHToMeta.delete(sah);
|
||||
// }
|
||||
|
||||
/**
|
||||
Adds n files to the pool's capacity. This change is
|
||||
persistent across settings. Returns a Promise which resolves
|
||||
@@ -557,8 +545,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
}
|
||||
|
||||
/**
|
||||
Releases all currently-opened SAHs. The only legal
|
||||
operation after this is acquireAccessHandles().
|
||||
Releases all currently-opened SAHs. The only legal operation
|
||||
after this is acquireAccessHandles() or (if this is called from
|
||||
pauseVfs()) either of isPaused() or unpauseVfs().
|
||||
*/
|
||||
releaseAccessHandles(){
|
||||
for(const ah of this.#mapSAHToName.keys()) ah.close();
|
||||
@@ -568,17 +557,21 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
}
|
||||
|
||||
/**
|
||||
Opens all files under this.vfsDir/this.#dhOpaque and acquires
|
||||
a SAH for each. returns a Promise which resolves to no value
|
||||
but completes once all SAHs are acquired. If acquiring an SAH
|
||||
throws, SAHPool.$error will contain the corresponding
|
||||
exception.
|
||||
Opens all files under this.vfsDir/this.#dhOpaque and acquires a
|
||||
SAH for each. Returns a Promise which resolves to no value but
|
||||
completes once all SAHs are acquired. If acquiring an SAH
|
||||
throws, this.$error will contain the corresponding Error
|
||||
object.
|
||||
|
||||
If it throws, it releases any SAHs which it may have
|
||||
acquired before the exception was thrown, leaving the VFS in a
|
||||
well-defined but unusable state.
|
||||
|
||||
If clearFiles is true, the client-stored state of each file is
|
||||
cleared when its handle is acquired, including its name, flags,
|
||||
and any data stored after the metadata block.
|
||||
*/
|
||||
async acquireAccessHandles(clearFiles){
|
||||
async acquireAccessHandles(clearFiles=false){
|
||||
const files = [];
|
||||
for await (const [name,h] of this.#dhOpaque){
|
||||
if('file'===h.kind){
|
||||
@@ -832,12 +825,18 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
Removes this object's sqlite3_vfs registration and shuts down
|
||||
this object, releasing all handles, mappings, and whatnot,
|
||||
including deleting its data directory. There is currently no
|
||||
way to "revive" the object and reaquire its resources.
|
||||
way to "revive" the object and reaquire its
|
||||
resources. Similarly, there is no recovery strategy if removal
|
||||
of any given SAH fails, so such errors are ignored by this
|
||||
function.
|
||||
|
||||
This function is intended primarily for testing.
|
||||
|
||||
Resolves to true if it did its job, false if the
|
||||
VFS has already been shut down.
|
||||
|
||||
@see pauseVfs()
|
||||
@see unpauseVfs()
|
||||
*/
|
||||
async removeVfs(){
|
||||
if(!this.#cVfs.pointer || !this.#dhOpaque) return false;
|
||||
@@ -853,13 +852,77 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
);
|
||||
this.#dhVfsRoot = this.#dhVfsParent = undefined;
|
||||
}catch(e){
|
||||
sqlite3.config.error(this.vfsName,"removeVfs() failed:",e);
|
||||
sqlite3.config.error(this.vfsName,"removeVfs() failed with no recovery strategy:",e);
|
||||
/*otherwise ignored - there is no recovery strategy*/
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
"Pauses" this VFS by unregistering it from SQLite and
|
||||
relinquishing all open SAHs, leaving the associated files
|
||||
intact. If this object is already paused, this is a
|
||||
no-op. Returns this object.
|
||||
|
||||
This function throws if SQLite has any opened file handles
|
||||
hosted by this VFS, as the alternative would be to invoke
|
||||
Undefined Behavior by closing file handles out from under the
|
||||
library. Similarly, automatically closing any database handles
|
||||
opened by this VFS would invoke Undefined Behavior in
|
||||
downstream code which is holding those pointers.
|
||||
|
||||
If this function throws due to open file handles then it has
|
||||
no side effects. If the OPFS API throws while closing handles
|
||||
then the VFS is left in an undefined state.
|
||||
|
||||
@see isPaused()
|
||||
@see unpauseVfs()
|
||||
*/
|
||||
pauseVfs(){
|
||||
if(this.#mapS3FileToOFile_.size>0){
|
||||
sqlite3.SQLite3Error.toss(
|
||||
capi.SQLITE_MISUSE, "Cannot pause VFS",
|
||||
this.vfsName,"because it has opened files."
|
||||
);
|
||||
}
|
||||
if(this.#mapSAHToName.size>0){
|
||||
capi.sqlite3_vfs_unregister(this.vfsName);
|
||||
this.releaseAccessHandles();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns true if this pool is currently paused else false.
|
||||
|
||||
@see pauseVfs()
|
||||
@see unpauseVfs()
|
||||
*/
|
||||
isPaused(){
|
||||
return 0===this.#mapSAHToName.size;
|
||||
}
|
||||
|
||||
/**
|
||||
"Unpauses" this VFS, reacquiring all SAH's and (if successful)
|
||||
re-registering it with SQLite. This is a no-op if the VFS is
|
||||
not currently paused.
|
||||
|
||||
The returned Promise resolves to this object. See
|
||||
acquireAccessHandles() for how it behaves if it throws due to
|
||||
SAH acquisition failure.
|
||||
|
||||
@see isPaused()
|
||||
@see pauseVfs()
|
||||
*/
|
||||
async unpauseVfs(){
|
||||
if(0===this.#mapSAHToName.size){
|
||||
return this.acquireAccessHandles(false).
|
||||
then(()=>capi.sqlite3_vfs_register(this.#cVfs, 0),this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
//! Documented elsewhere in this file.
|
||||
exportFile(name){
|
||||
const sah = this.#mapFilenameToSAH.get(name) || toss("File not found:",name);
|
||||
@@ -984,6 +1047,10 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
|
||||
async removeVfs(){ return this.#p.removeVfs() }
|
||||
|
||||
pauseVfs(){ this.#p.pauseVfs(); return this; }
|
||||
async unpauseVfs(){ return this.#p.unpauseVfs().then(()=>this); }
|
||||
isPaused(){ return this.#p.isPaused() }
|
||||
|
||||
}/* class OpfsSAHPoolUtil */;
|
||||
|
||||
/**
|
||||
@@ -1038,7 +1105,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
|
||||
- `clearOnInit`: (default=false) if truthy, contents and filename
|
||||
mapping are removed from each SAH it is acquired during
|
||||
initalization of the VFS, leaving the VFS's storage in a pristine
|
||||
initialization of the VFS, leaving the VFS's storage in a pristine
|
||||
state. Use this only for databases which need not survive a page
|
||||
reload.
|
||||
|
||||
@@ -1165,7 +1232,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
VFS-hosted database file. The result of the resolved Promise when
|
||||
called this way is the size of the resulting database.
|
||||
|
||||
On succes this routine rewrites the database header bytes in the
|
||||
On success this routine rewrites the database header bytes in the
|
||||
output file (not the input array) to force disabling of WAL mode.
|
||||
|
||||
On a write error, the handle is removed from the pool and made
|
||||
@@ -1217,6 +1284,41 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
Clears all client-defined state of all SAHs and makes all of them
|
||||
available for re-use by the pool. Results are undefined if any such
|
||||
handles are currently in use, e.g. by an sqlite3 db.
|
||||
|
||||
APIs specific to the "pause" capability (added in version 3.49):
|
||||
|
||||
Summary: "pausing" the VFS disassociates it from SQLite and
|
||||
relinquishes its SAHs so that they may be opened by another
|
||||
instance of this VFS (running in a separate tab/page or Worker).
|
||||
"Unpausing" it takes back control, if able.
|
||||
|
||||
- pauseVfs()
|
||||
|
||||
"Pauses" this VFS by unregistering it from SQLite and
|
||||
relinquishing all open SAHs, leaving the associated files intact.
|
||||
This enables pages/tabs to coordinate semi-concurrent usage of
|
||||
this VFS. If this object is already paused, this is a
|
||||
no-op. Returns this object. Throws if SQLite has any opened file
|
||||
handles hosted by this VFS. If this function throws due to open
|
||||
file handles then it has no side effects. If the OPFS API throws
|
||||
while closing handles then the VFS is left in an undefined state.
|
||||
|
||||
- isPaused()
|
||||
|
||||
Returns true if this VFS is paused, else false.
|
||||
|
||||
- [async] unpauseVfs()
|
||||
|
||||
Restores the VFS to an active state after having called
|
||||
pauseVfs() on it. This is a no-op if the VFS is not paused. The
|
||||
returned Promise resolves to this object on success. A rejected
|
||||
Promise means there was a problem reacquiring the SAH handles
|
||||
(possibly because they're in use by another instance or have
|
||||
since been removed). Generically speaking, there is no recovery
|
||||
strategy for that type of error, but if the problem is simply
|
||||
that the OPFS files are locked, then a later attempt to unpause
|
||||
it, made after the concurrent instance releases the SAHs, may
|
||||
recover from the situation.
|
||||
*/
|
||||
sqlite3.installOpfsSAHPoolVfs = async function(options=Object.create(null)){
|
||||
options = Object.assign(Object.create(null), optionDefaults, (options||{}));
|
||||
|
||||
@@ -459,7 +459,7 @@ const installOpfsVfs = function callee(options){
|
||||
Runs the given operation (by name) in the async worker
|
||||
counterpart, waits for its response, and returns the result
|
||||
which the async worker writes to SAB[state.opIds.rc]. The
|
||||
2nd and subsequent arguments must be the aruguments for the
|
||||
2nd and subsequent arguments must be the arguments for the
|
||||
async op.
|
||||
*/
|
||||
const opRun = (op,...args)=>{
|
||||
|
||||
@@ -128,7 +128,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef SQLITE_WASM_EXTRA_INIT
|
||||
# define SQLITE_EXTRA_INIT sqlite3_wasm_extra_init
|
||||
/* SQLITE_EXTRA_INIT vs SQLITE_EXTRA_INIT_MUTEXED:
|
||||
** see https://sqlite.org/forum/forumpost/14183b98fc0b1dea */
|
||||
# define SQLITE_EXTRA_INIT_MUTEXED sqlite3_wasm_extra_init
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -284,7 +286,7 @@ SQLITE_WASM_EXPORT void * sqlite3__wasm_stack_alloc(int n){
|
||||
/*
|
||||
** State for the "pseudo-stack" allocator implemented in
|
||||
** sqlite3__wasm_pstack_xyz(). In order to avoid colliding with
|
||||
** Emscripten-controled stack space, it carves out a bit of stack
|
||||
** Emscripten-controlled stack space, it carves out a bit of stack
|
||||
** memory to use for that purpose. This memory ends up in the
|
||||
** WASM-managed memory, such that routines which manipulate the wasm
|
||||
** heap can also be used to manipulate this memory.
|
||||
@@ -311,7 +313,7 @@ SQLITE_WASM_EXPORT void * sqlite3__wasm_pstack_ptr(void){
|
||||
return PStack.pPos;
|
||||
}
|
||||
/*
|
||||
** Sets the pstack position poitner to p. Results are undefined if the
|
||||
** Sets the pstack position pointer to p. Results are undefined if the
|
||||
** given value did not come from sqlite3__wasm_pstack_ptr().
|
||||
*/
|
||||
SQLITE_WASM_EXPORT void sqlite3__wasm_pstack_restore(unsigned char * p){
|
||||
@@ -980,7 +982,7 @@ const char * sqlite3__wasm_enum_json(void){
|
||||
#undef _DefGroup
|
||||
|
||||
/*
|
||||
** Emit an array of "StructBinder" struct descripions, which look
|
||||
** Emit an array of "StructBinder" struct descriptions, which look
|
||||
** like:
|
||||
**
|
||||
** {
|
||||
@@ -1417,7 +1419,7 @@ int sqlite3__wasm_db_serialize( sqlite3 *pDb, const char *zSchema,
|
||||
** NULL), or nData is negative, SQLITE_MISUSE are returned.
|
||||
**
|
||||
** On success, it creates a new file with the given name, populated
|
||||
** with the fist nData bytes of pData. If pData is NULL, the file is
|
||||
** with the first nData bytes of pData. If pData is NULL, the file is
|
||||
** created and/or truncated to nData bytes.
|
||||
**
|
||||
** Whether or not directory components of zFilename are created
|
||||
|
||||
@@ -335,8 +335,8 @@ sqlite3Worker1Promiser.v2 = function(config){
|
||||
/**
|
||||
When built as a module, we export sqlite3Worker1Promiser.v2()
|
||||
instead of sqlite3Worker1Promise() because (A) its interface is more
|
||||
conventional for ESM usage and (B) the ESM option export option for
|
||||
this API did not exist until v2 was created, so there's no backwards
|
||||
conventional for ESM usage and (B) the ESM export option for this
|
||||
API did not exist until v2 was created, so there's no backwards
|
||||
incompatibility.
|
||||
*/
|
||||
export default sqlite3Worker1Promiser.v2;
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@
|
||||
** - `#pragma` is in place for adding "meta-commands", but it does not
|
||||
** yet have any concrete list of documented commands.
|
||||
**
|
||||
* - `#stderr` outputs its file name, line number, and the remaininder
|
||||
* - `#stderr` outputs its file name, line number, and the remainder
|
||||
** of that line to stderr.
|
||||
**
|
||||
** - `#//` acts as a single-line comment, noting that there must be as
|
||||
@@ -1215,7 +1215,7 @@ static void cmpp_kwd_if(CmppKeyword const * pKw, CmppTokenizer *t){
|
||||
CmppLevel_push(t);
|
||||
break;
|
||||
default:
|
||||
cmpp_kwd__misuse(pKw, t, "Unpexected keyword token type");
|
||||
cmpp_kwd__misuse(pKw, t, "Unexpected keyword token type");
|
||||
break;
|
||||
}
|
||||
buul = db_define_has((char const *)t->args.argv[1]);
|
||||
|
||||
@@ -798,7 +798,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
*/
|
||||
target.peek8 = (...ptr)=>target.peek( (1===ptr.length ? ptr[0] : ptr), 'i8' );
|
||||
/**
|
||||
Convience form of poke() intended for setting individual bytes.
|
||||
Convenience form of poke() intended for setting individual bytes.
|
||||
Its difference from poke() is that it always writes to the
|
||||
i8-sized heap view.
|
||||
*/
|
||||
@@ -1769,7 +1769,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
/** If true, the constructor emits a warning. The intent is that
|
||||
this be set to true after bootstrapping of the higher-level
|
||||
client library is complete, to warn downstream clients that
|
||||
they shouldn't be relying on this implemenation detail which
|
||||
they shouldn't be relying on this implementation detail which
|
||||
does not have a stable interface. */
|
||||
xArg.FuncPtrAdapter.warnOnUse = false;
|
||||
|
||||
@@ -1949,7 +1949,7 @@ globalThis.WhWasmUtilInstaller = function(target){
|
||||
|
||||
- `json:dealloc` (results): works exactly like `string:dealloc` but
|
||||
returns the same thing as the `json` adapter. Note the
|
||||
warning in `string:dealloc` regarding maching allocators and
|
||||
warning in `string:dealloc` regarding matching allocators and
|
||||
deallocators.
|
||||
|
||||
The type names for results and arguments are validated when
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
if(0===db.selectValue('select count(*) from sqlite_master')){
|
||||
log("DB is empty. Use the init button to populate it.");
|
||||
}else{
|
||||
log("DB contains data from a previous session. Use the Clear Ctorage button to delete it.");
|
||||
log("DB contains data from a previous session. Use the Clear Storage button to delete it.");
|
||||
btnSelect.click();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -91,7 +91,7 @@ all: fiddle
|
||||
fiddle_remote ?=
|
||||
ifeq (,$(fiddle_remote))
|
||||
ifneq (,$(wildcard /home/stephan))
|
||||
fiddle_remote = wh:www/wh/sqlite3/.
|
||||
fiddle_remote = wh:www/wasm-testing/fiddle/.
|
||||
else ifneq (,$(wildcard /home/drh))
|
||||
#fiddle_remote = if appropriate, add that user@host:/path here
|
||||
endif
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
|
||||
/**
|
||||
A proxy for localStorage or sessionStorage or a
|
||||
page-instance-local proxy, if neither one is availble.
|
||||
page-instance-local proxy, if neither one is available.
|
||||
|
||||
Which exact storage implementation is uses is unspecified, and
|
||||
apps must not rely on it.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>SQLite3 Fiddle</title>
|
||||
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
|
||||
<!-- to add a togglable terminal-style view, uncomment the following
|
||||
<!-- to add a toggleable terminal-style view, uncomment the following
|
||||
two lines and ensure that these files are on the web server. -->
|
||||
<!--script src="jqterm/jqterm-bundle.min.js"></script>
|
||||
<link rel="stylesheet" href="jqterm/jquery.terminal.min.css"/-->
|
||||
|
||||
@@ -119,6 +119,10 @@
|
||||
<li><a href='tests/opfs/concurrency/index.html'>OPFS concurrency</a>
|
||||
tests using multiple workers.
|
||||
</li>
|
||||
<li><a href='tests/opfs/sahpool/index.html'>OPFS SAHPool cooperative semi-concurrency</a>
|
||||
demonstrates usage of the OPFS SAHPool VFS's "pause" feature to coordinate
|
||||
access to a database.
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>WASMFS</strong>-specific tests which require that
|
||||
|
||||
@@ -561,7 +561,7 @@ globalThis.Jaccwabyt = function StructBinderFactory(config){
|
||||
const dbg = ctor.prototype.debugFlags.__flags;
|
||||
/*
|
||||
TODO?: set prototype of descr to an object which can set/fetch
|
||||
its prefered representation, e.g. conversion to string or mapped
|
||||
its preferred representation, e.g. conversion to string or mapped
|
||||
function. Advantage: we can avoid doing that via if/else if/else
|
||||
in the get/set methods.
|
||||
*/
|
||||
|
||||
@@ -176,7 +176,7 @@ essentially boils down to:
|
||||
3. [Feed (2) to the function generated by (1)](#step-3) to create JS
|
||||
constuctor functions for each struct. This is done at runtime, as
|
||||
opposed to during a build-process step, and can be set up in such a
|
||||
way that it does not require any maintenace after its initial
|
||||
way that it does not require any maintenance after its initial
|
||||
setup.
|
||||
4. [Create and use instances of those structs](#step-4).
|
||||
|
||||
@@ -950,7 +950,7 @@ const char * wasm__ctype_json(void){
|
||||
assert(LEVEL<5); memset(pos, '}', LEVEL); pos+=LEVEL; lenCheck
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Macros for emiting StructBinders...
|
||||
// Macros for emitting StructBinders...
|
||||
#define StructBinder__(TYPE) \
|
||||
n = 0; \
|
||||
outf("%s{", (structCount++ ? ", " : "")); \
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user