Compare commits

..

41 Commits

Author SHA1 Message Date
drh 195956af94 Typo fixes. Make sqlite3_set_errmsg() accessible to run-time loadable
extensions.

FossilOrigin-Name: 93a41e31322eec70476f7d81f4af7fb8476cad21a56d6b1048a9e0c0c440bf72
2025-09-12 15:31:33 +00:00
drh 28a7f01f90 Add more details to comments in the previous check-in.
FossilOrigin-Name: ed36b3aa4b68c6bb347b6851ea61bcad9712c4a9ed39e3fb4f84cb9b9ee48dc2
2025-09-12 15:20:39 +00:00
dan d968525382 Add experimental API sqlite3_set_errmsg(). Use this in sqlite3changeset_apply() to return any error code and error message via the SQLite handle.
FossilOrigin-Name: 4d5b60a1e57448f03af2a657fe7cdabb04ebaf9688d5cc700dd8f9892a5cba15
2025-09-12 15:02:47 +00:00
drh eb8089ef46 Fix an off-by-one error in sqlite3_rsync.
[forum:/info/46753431d4|Forum post 46753431d4].

FossilOrigin-Name: ef3b7be6f2037871f6f1b1944fed3dda28216e7f179080d3be2e2620c031f48c
2025-09-11 10:58:49 +00:00
drh 9455a6e8b8 Improved support for VxWorks.
FossilOrigin-Name: 5bc6b9352236df3091ee69b947d0c397264156539d13e5968ec3b9a6e55dc800
2025-09-11 10:43:57 +00:00
drh 56d831e064 Fix a harmless compiler warning in the CLI. Gcc generates identical
machine code before and after this change.
[forum:/forumpost/8bda0d896f|Forum post 8bda0d896f].

FossilOrigin-Name: dbca4fe34467653d083de42d0c75746cf171e96ee3867abe67a47ab88437fa71
2025-09-11 10:37:01 +00:00
stephan 7754f53045 Latest upstream autosetup, with project-local s/--debug/--autodebug-debug/ patch, for HP-UX-specific config bootstrapping code and latest jimsh.
FossilOrigin-Name: 1d2352a16cc0990037710b4a666f2f3b039c1973e0af29990d67d70bcdba0600
2025-09-11 10:14:10 +00:00
stephan 4619855103 Configure script portability improvements for HP-UX builds, with the help of HP-UX sysadmin Michael Osipov.
FossilOrigin-Name: 93cf2afa8ca529784f859da2f015bce3a251b23dafa6ca3d1db644a91969e237
2025-09-11 10:09:43 +00:00
stephan be4cf645a8 In mkautoconfamal.sh use $MAKE if it's set so that it can be made to work on platforms where 'make' from the PATH is not usable, e.g. HP-UX's standard make. This means that 'make snapshot-tarball' will inherit that value from the outer makefile and set it appropriate when the in-use make is named gmake.
FossilOrigin-Name: a8635cae05d2bce28d0c0c39b599cf8ca6f3b89b114fbeef519a8024692180c5
2025-09-11 10:08:19 +00:00
drh 065daf24b4 Minor #ifdef changes to the carray.c extension so that the source file can
be more easily imported into a larger program (such as TH3).

FossilOrigin-Name: f16fd1afbb65f88d7b94c2488ddd59549d71894ab5fcee46b4c55bfe646bfc9d
2025-09-10 20:28:57 +00:00
drh 0b8e4294d5 Use a separate mutex (SQLITE_MUTEX_STATIC_VFS2) for the VxWorks file list
in os_unix.c.

FossilOrigin-Name: 8f45f1a9d9208fbf124c4087092718b83cd653126bc1ed5f388e3577561f615b
2025-09-10 18:34:09 +00:00
dan d61dbf7072 Change the order of some paragraphs within documentation comments in sqlite3session.h.
FossilOrigin-Name: f0102d7b25d854b5a937eb7de5e25f52c2ecf904234857c96bd1995f5dde0b66
2025-09-10 16:57:57 +00:00
drh 586361fa7c The GetSystemTimePreciseAsFileTime() API does not exist on 32-bit windows.
Adjust [c5dbe93114d318fe] so that it works with this limitation.

FossilOrigin-Name: 61d9e204c5801a94811fdb0afe2c04f9814e08f2e141afa6dbda0fa45f026f70
2025-09-10 14:28:07 +00:00
drh e7f190b8e1 If open files in VxWorks, do not unlink the file unless the file was marked
as delete-on-close.

FossilOrigin-Name: bb6114dbbf3bfbea57cd9be21666299663e94576b0175f6aeefd1d0f7107398e
2025-09-09 19:00:55 +00:00
drh 130a2f52b1 Do not allow attempts to open files in VxWorks unless the full pathname is
provided.

FossilOrigin-Name: 4720205249214c01f6e63738e4927c0f53c853346cc2dfa45522aaa469f4d702
2025-09-09 17:39:28 +00:00
drh 92f91ca37d Do not allow the local_getline() function in the CLI to allocate more
memory than can be counted using a 32-bit integer, thus limiting the
length of an input line to about one gigabyte.
[forum:/forumpost/c83b9affa2|Forum post c83b9affa2].

FossilOrigin-Name: 0f31711591c56f3896fb6f092752fb82c4ea646bf8e5838dfbe55302994ea091
2025-09-09 10:28:06 +00:00
drh 4edee00ee0 Fix a potential memory leak in the VxWorks VFS that can occur following
an OOM or I/O error during xOpen().

FossilOrigin-Name: cb880145d899832cca0612b89024a54d188ed706600fa812ea74587d69c261be
2025-09-08 19:56:14 +00:00
drh 91020438c0 In VxWorks, temporary filenames must be full absolute pathnames in order for
vxworksFindFileId() to work.

FossilOrigin-Name: 1fc94becc5971812c3a91fb1410cb54f6ecb9e50da2d30863dc840cbf4e6c1f5
2025-09-08 18:45:58 +00:00
drh b4af09c80e Add the ability to compile with -DOS_VXWORKS=1 on Linux systems, in an
effort to debug the VxWorks capabilities without actually having to
run VxWorks.

FossilOrigin-Name: c87e68d791215729fb513c651e77c6ef6bb260deff37ed2ab6e99b777271bdfe
2025-09-08 17:52:17 +00:00
dan 75ca99ab99 Add "PRAGMA wal_checkpoint = noop" and SQLITE_CHECKPOINT_NOOP. To request a checkpoint that checkpoints zero frames.
FossilOrigin-Name: 4384ad8918801780f2660817dead919020423eb94aa880fff9b04f2d5f5d932f
2025-09-08 15:15:24 +00:00
dan cf0ba94657 Merge trunk changes into this branch.
FossilOrigin-Name: 3bac76a86baae830d4fdc9e4055470d84549fde56b4cf217ebd96cb486554461
2025-09-08 14:40:17 +00:00
dan d7d632d581 Add documentation comment for SQLITE_CHECKPOINT_NOOP.
FossilOrigin-Name: 2b9c495d02724f19ab16612b0e671dfc612f04342222d9901cd0debd08da4cf0
2025-09-08 14:32:32 +00:00
dan 4cefe53a33 Improve documentation of SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER.
FossilOrigin-Name: d7b2fb5363203f475887f277aed4a91e5a83440c169a86b3bf1e4fdf130bbaed
2025-09-06 15:27:01 +00:00
stephan afd432f86e WAL API doc tweaks based on suggestions from [forum:16e94b4bdcfbdc57|forum post 16e94b4bdcf].
FossilOrigin-Name: 1bb7eaf784687cd877c5c0552bb511659767670259e64bc108e7972e356d3cfc
2025-09-05 13:26:24 +00:00
stephan 7aadad63e9 Build portability fixes for HP-UX, reported in [forum:d80ecdaddd885149 | forum post d80ecdaddd8]. The full fix also requires a patch to autosetup/cc-shared.tcl, but that's pending because it's upstream code.
FossilOrigin-Name: 5f38c8aa8fe9993cafde69a85e96e32c283a6bc142238a9d10f3637c93cd474b
2025-09-05 12:14:22 +00:00
dan b9bf2d9382 Add tests to check that SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER is working.
FossilOrigin-Name: beb092d8105e5a1ce95339527bf96799e2ce073591b055f71a5f1dc1d0a0c49c
2025-09-05 11:20:11 +00:00
dan d8d88d9390 Add "PRAGMA wal_checkpoint = noop" and SQLITE_CHECKPOINT_NOOP. To request a checkpoint that checkpoints zero frames.
FossilOrigin-Name: 48be3d020cf0c732557b3d956198a1abcab79424be03f447e2bb89f4d68dc8ff
2025-09-04 19:33:23 +00:00
stephan c0e3a8ca19 Generic doc updates in ext/wasm's makefiles. No functional changes.
FossilOrigin-Name: 02721457cea255a5117a46b77cc87d2e09acb64340ce94089c5b5e6edc5b5033
2025-09-04 18:00:53 +00:00
drh f28c0f37f2 Use Pgno instead of int for the pgno field in the DbpageCursor object.
The same machine code is generated, but using an unsigned value seems
safer in the long run.
[forum:/forumpost/ccec20a858|Forum post ccec20a858].

FossilOrigin-Name: 26ecdde06cce063143144a79c0b4979ed5ec27548da6f127176a420c1c3f17ce
2025-09-04 09:26:53 +00:00
dan 2af776ff59 Fix a typo in a comment in carray.h.
FossilOrigin-Name: a4e137de0e82fbba890c2a608578f02f3666d2c25fb76f95ddf2d6a096a30e6c
2025-09-03 21:19:11 +00:00
stephan 8fb8782e2a Random wasm internal doc cleanups. No code changes.
FossilOrigin-Name: 70923a00cfca2c64b7c7c824325ab75cdd05d452b79d2eaf43297898af891c47
2025-09-03 13:39:15 +00:00
dan 7fa9e45746 Add test case for pushing WHERE constraints into a UNION sub-query that uses virtual tables.
FossilOrigin-Name: 13c80e903ee7f178528918716b11fc0b57fc50b923dcd8aeabf9e6e04e93cdae
2025-09-02 14:59:16 +00:00
stephan 6f341f499a Latest side-stream autosetup/proj.tcl for improved compile-commands feature detection.
FossilOrigin-Name: 55744ca8b8f2f95ba8bd3e01ef89e21e26c8547912c9d5637afe772d17f34486
2025-09-01 13:01:20 +00:00
stephan f91151bfa1 Fix a line-wrap change made in [50234bc9e9fe58da] which broke the docsrc build by splitting a link reference across two lines, which the doc processor does not like. Problem reported in [forum:ea1fe5f421549899 | forum post ea1fe5f4215].
FossilOrigin-Name: 321938063e2d6c579b992bbbed5210c8a051a8b2fe858bb88f95dbd8fb0f35dc
2025-09-01 00:32:43 +00:00
dan 20bfeccb65 Update test script reservebytes.test so that it works with the "prepare" permutation.
FossilOrigin-Name: 4ac774364b693a4b992c997c64bf425e2765133a7a25963cbf2b02c180eeaba5
2025-08-29 16:51:16 +00:00
dan f942995fd2 Ensure POSIX builds work as expected (no extra usleep() calls) if SQLITE_ENABLE_SETLK_TIMEOUT is defined.
FossilOrigin-Name: f04a826bac1620b28c32252fa2ceaccc5dfbb21405a6a98942f95d3d1ca89acb
2025-08-29 15:56:38 +00:00
stephan 62ed0b79da Add 'from a check-out' to the mksqlite3h.tcl manifest instructions.
FossilOrigin-Name: 7728a74ca87934c333a66e46dc1f88ce572473e345d9ff20e5d566c0e26da82d
2025-08-29 11:21:08 +00:00
stephan a00b9b99ba Fix the mksqlite3h.tcl SQLITE_SCM_... changes to work from out-of-tree builds. Problem reported in [forum:812f8d6ff4|forum post 812f8d6ff4].
FossilOrigin-Name: 127f0ab16370fe02b4456669bf60e45ce8c96c4e24b2db3080eaf376d77e0df8
2025-08-29 11:09:20 +00:00
stephan 9976684d26 Remove some commented-out debugging lines and fix a doc typo. No code changes.
FossilOrigin-Name: af32cb3e30ee527a89768b98d8646e2b25d3fb642e61e805187bb3e4613b0960
2025-08-28 17:10:44 +00:00
stephan 8200750eb1 Add macros SQLITE_SCM_BRANCH/TAGS/DATETIME to sqlite3.h, pulled from the fossil-generated manifest.tags.
FossilOrigin-Name: db6b6240ad465f865dd2ca8fa0cdfba8b5315c45041b91b76efade6427c213e1
2025-08-28 17:05:37 +00:00
stephan dca1f04f07 Remove sqlite3expert.h from the compiler invocation for that tool, as it (A) doesn't need to be there and (B) it causes some compilers problems (as reported in [forum:a1085109e7db4cf3 | forum post a1085109e7]). This bug was faithfully carried over from the legacy build.
FossilOrigin-Name: 9f0a16f6e893d51f760a8c1e2cb4709fdd16ccb2c0258695767f8305f407f4ac
2025-08-28 15:04:52 +00:00
40 changed files with 951 additions and 309 deletions
+6 -3
View File
@@ -222,9 +222,12 @@ install: install-lib
# Flags to link the shell app either directly against sqlite3.c
# (ENABLE_STATIC_SHELL==1) or libsqlite3.so (ENABLE_STATIC_SHELL==0).
#
# Maintenance reminder: placement of $(LDFLAGS) is more relevant for
# some platforms than others:
# https://sqlite.org/forum/forumpost/d80ecdaddd
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) $(LDFLAGS.math)
sqlite3-shell-link-flags.1 = $(TOP)/sqlite3.c $(LDFLAGS) $(LDFLAGS.libsqlite3)
sqlite3-shell-link-flags.0 = $(LDFLAGS) -L. -lsqlite3 $(LDFLAGS.zlib) $(LDFLAGS.math)
sqlite3-shell-deps.1 = $(TOP)/sqlite3.c
sqlite3-shell-deps.0 = $(libsqlite3.DLL)
#
@@ -245,7 +248,7 @@ sqlite3$(T.exe): $(TOP)/shell.c $(sqlite3-shell-deps.$(ENABLE_STATIC_SHELL))
$(sqlite3-shell-static.flags.$(STATIC_CLI_SHELL)) \
-I. $(OPT_FEATURE_FLAGS) $(SHELL_OPT) \
$(CFLAGS) $(CFLAGS.readline) $(CFLAGS.icu) \
$(LDFLAGS) $(LDFLAGS.readline)
$(LDFLAGS.readline)
sqlite3$(T.exe)-1:
sqlite3$(T.exe)-0: sqlite3$(T.exe)
+11 -7
View File
@@ -406,8 +406,8 @@ proc options-add {opts} {
# Find the corresponding value in the user options
# and set the default if necessary
if {[string match "-*" $opt]} {
# This is a documentation-only option, like "-C <dir>"
set opthelp $opt
# We no longer support documentation-only options, like "-C <dir>"
autosetup-error "Option $opt is not supported"
} elseif {$colon eq ""} {
# Boolean option
lappend autosetup(options) $name
@@ -1611,7 +1611,7 @@ proc autosetup_output_block {type lines} {
# Generate a command reference from inline documentation
proc automf_command_reference {} {
lappend files $::autosetup(prog)
lappend files {*}[lsort [glob -nocomplain $::autosetup(libdir)/*.tcl]]
lappend files {*}[lsort [glob -nocomplain $::autosetup(libdir)/{*/*.tcl,*.tcl}]]
# We want to process all non-module files before module files
# and then modules in alphabetical order.
@@ -2124,7 +2124,7 @@ if {$autosetup(istcl)} {
set frame [info frame -$i]
if {[dict exists $frame file]} {
# We don't need proc, so use ""
lappend stacktrace "" [dict get $frame file] [dict get $frame line]
lappend stacktrace "" [dict get $frame file] [dict get $frame line] ""
}
}
return $stacktrace
@@ -2181,8 +2181,12 @@ proc error-location {msg} {
if {$::autosetup(debug)} {
return -code error $msg
}
# Search back through the stack trace for the first error in a .def file
foreach {p f l} [stacktrace] {
set vars {p f l cmd}
if {!$::autosetup(istcl) && ![dict exists $::tcl_platform stackFormat]} {
# Older versions of Jim had a 3 element stacktrace
set vars {p f l}
}
foreach $vars [stacktrace] {
if {[string match *.def $f]} {
return "[relative-path $f]:$l: Error: $msg"
}
@@ -2534,7 +2538,7 @@ if {[catch {main $argv} msg opts] == 1} {
show-notices
autosetup-full-error [error-dump $msg $opts $autosetup(debug)]
if {!$autosetup(debug)} {
puts stderr "Try: '[file tail $autosetup(exe)] --autosetup-debug' for a full stack trace"
puts stderr "Try: '[file tail $autosetup(exe)] --debug' for a full stack trace"
}
exit 1
}
+6 -4
View File
@@ -89,13 +89,15 @@ switch -glob -- [get-define host] {
define SH_SOPREFIX -Wl,-h,
}
}
*-*-hpux {
# XXX: These haven't been tested
define SHOBJ_CFLAGS "+O3 +z"
*-*-hpux* {
define SHOBJ_CFLAGS +z
define SHOBJ_LDFLAGS -b
define SH_CFLAGS +z
define SH_LDFLAGS -b
define SH_LINKFLAGS -Wl,+s
define LD_LIBRARY_PATH SHLIB_PATH
define SH_LINKRPATH "-Wl,+b -Wl,%s"
define SH_SOPREFIX -Wl,+h,
define STRIPLIBFLAGS -Wl,-s
}
*-*-haiku {
define SHOBJ_CFLAGS ""
+12 -25
View File
@@ -9132,7 +9132,7 @@ int Jim_StringEqObj(Jim_Obj *aObjPtr, Jim_Obj *bObjPtr)
const char *sA = Jim_GetString(aObjPtr, &Alen);
const char *sB = Jim_GetString(bObjPtr, &Blen);
return Alen == Blen && *sA == *sB && memcmp(sA, sB, Alen) == 0;
return Alen == Blen && memcmp(sA, sB, Alen) == 0;
}
}
@@ -10242,7 +10242,7 @@ static int JimCommandsHT_KeyCompare(void *privdata, const void *key1, const void
int len1, len2;
const char *str1 = Jim_GetStringNoQualifier((Jim_Obj *)key1, &len1);
const char *str2 = Jim_GetStringNoQualifier((Jim_Obj *)key2, &len2);
return len1 == len2 && *str1 == *str2 && memcmp(str1, str2, len1) == 0;
return len1 == len2 && memcmp(str1, str2, len1) == 0;
}
static void JimCommandsHT_ValDestructor(void *interp, void *val)
@@ -13864,13 +13864,6 @@ static int JimExprOpNumUnary(Jim_Interp *interp, struct JimExprNode *node)
case JIM_EXPROP_NOT:
wC = !bA;
break;
case JIM_EXPROP_UNARYPLUS:
case JIM_EXPROP_UNARYMINUS:
rc = JIM_ERR;
Jim_SetResultFormatted(interp,
"can't use non-numeric string as operand of \"%s\"",
node->type == JIM_EXPROP_UNARYPLUS ? "+" : "-");
break;
default:
abort();
}
@@ -19875,22 +19868,16 @@ wrongargs:
}
else if (errorCodeObj) {
int len = Jim_ListLength(interp, argv[idx + 1]);
int i;
if (len > Jim_ListLength(interp, errorCodeObj)) {
ret = JIM_OK;
ret = -1;
}
else {
int i;
ret = JIM_OK;
for (i = 0; i < len; i++) {
Jim_Obj *matchObj = Jim_ListGetIndex(interp, argv[idx + 1], i);
Jim_Obj *objPtr = Jim_ListGetIndex(interp, errorCodeObj, i);
if (Jim_StringCompareObj(interp, matchObj, objPtr, 0) != 0) {
ret = -1;
break;
}
for (i = 0; i < len; i++) {
Jim_Obj *matchObj = Jim_ListGetIndex(interp, argv[idx + 1], i);
Jim_Obj *objPtr = Jim_ListGetIndex(interp, errorCodeObj, i);
if (Jim_StringCompareObj(interp, matchObj, objPtr, 0) != 0) {
ret = -1;
break;
}
}
}
@@ -20266,7 +20253,7 @@ static int Jim_DictCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *arg
}
case OPT_SET:
return Jim_SetDictKeysVector(interp, argv[2], argv + 3, argc - 4, argv[argc - 1], JIM_ERRMSG | JIM_UNSHARED);
return Jim_SetDictKeysVector(interp, argv[2], argv + 3, argc - 4, argv[argc - 1], JIM_ERRMSG);
case OPT_EXISTS:{
int rc = Jim_DictKeysVector(interp, argv[2], argv + 3, argc - 3, &objPtr, JIM_NONE);
@@ -20278,7 +20265,7 @@ static int Jim_DictCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *arg
}
case OPT_UNSET:
if (Jim_SetDictKeysVector(interp, argv[2], argv + 3, argc - 3, NULL, JIM_UNSHARED) != JIM_OK) {
if (Jim_SetDictKeysVector(interp, argv[2], argv + 3, argc - 3, NULL, JIM_NONE) != JIM_OK) {
return JIM_ERR;
}
return JIM_OK;
+53 -10
View File
@@ -706,11 +706,20 @@ proc proj-file-write {args} {
}
#
# @proj-check-compile-commands ?configFlag?
# @proj-check-compile-commands ?-assume-for-clang? ?configFlag?
#
# Checks the compiler for compile_commands.json support. If passed an
# argument it is assumed to be the name of an autosetup boolean config
# which controls whether to run/skip this check.
# Checks the compiler for compile_commands.json support. If
# $configFlag is not empty then it is assumed to be the name of an
# autosetup boolean config which controls whether to run/skip this
# check.
#
# If -assume-for-clang is provided and $configFlag is not empty and CC
# matches *clang* and no --$configFlag was explicitly provided to the
# configure script then behave as if --$configFlag had been provided.
# To disable that assumption, either don't pass -assume-for-clang or
# pass --$configFlag=0 to the configure script. (The reason for this
# behavior is that clang supports compile-commands but some other
# compilers report false positives with these tests.)
#
# Returns 1 if supported, else 0, and defines HAVE_COMPILE_COMMANDS to
# that value. Defines MAKE_COMPILATION_DB to "yes" if supported, "no"
@@ -718,12 +727,38 @@ proc proj-file-write {args} {
# HAVE_COMPILE_COMMANDS is preferred.
#
# ACHTUNG: this test has a long history of false positive results
# because of compilers reacting differently to the -MJ flag.
# because of compilers reacting differently to the -MJ flag. Because
# of this, it is recommended that this support be an opt-in feature,
# rather than an on-by-default default one. That is: in the
# configure script define the option as
# {--the-flag-name=0 => {Enable ....}}
#
proc proj-check-compile-commands {{configFlag {}}} {
proc proj-check-compile-commands {args} {
set i 0
set configFlag {}
set fAssumeForClang 0
set doAssume 0
msg-checking "compile_commands.json support... "
if {"" ne $configFlag && ![proj-opt-truthy $configFlag]} {
msg-result "explicitly disabled"
if {"-assume-for-clang" eq [lindex $args 0]} {
lassign $args - configFlag
incr fAssumeForClang
} elseif {1 == [llength $args]} {
lassign $args configFlag
} else {
proj-error "Invalid arguments"
}
if {1 == $fAssumeForClang && "" ne $configFlag} {
if {[string match *clang* [get-define CC]]
&& ![proj-opt-was-provided $configFlag]
&& ![proj-opt-truthy $configFlag]} {
proj-indented-notice [subst -nocommands -nobackslashes {
CC appears to be clang, so assuming that --$configFlag is likely
to work. To disable this assumption use --$configFlag=0.}]
incr doAssume
}
}
if {!$doAssume && "" ne $configFlag && ![proj-opt-truthy $configFlag]} {
msg-result "check disabled. Use --${configFlag} to enable it."
define HAVE_COMPILE_COMMANDS 0
define MAKE_COMPILATION_DB no
return 0
@@ -732,7 +767,7 @@ proc proj-check-compile-commands {{configFlag {}}} {
# This test reportedly incorrectly succeeds on one of
# Martin G.'s older systems. drh also reports a false
# positive on an unspecified older Mac system.
msg-result "compiler supports compile_commands.json"
msg-result "compiler supports -MJ. Assuming it's useful for compile_commands.json"
define MAKE_COMPILATION_DB yes; # deprecated
define HAVE_COMPILE_COMMANDS 1
return 1
@@ -1135,6 +1170,10 @@ proc proj-check-rpath {} {
if {"" eq $wl} {
set wl [proj-cc-check-Wl-flag -R$lp]
}
if {"" eq $wl} {
# HP-UX: https://sqlite.org/forum/forumpost/d80ecdaddd
set wl [proj-cc-check-Wl-flag +b $lp]
}
define LDFLAGS_RPATH $wl
}
}
@@ -1144,7 +1183,7 @@ proc proj-check-rpath {} {
#
# @proj-check-soname ?libname?
#
# Checks whether CC supports the -Wl,soname,lib... flag. If so, it
# Checks whether CC supports the -Wl,-soname,lib... flag. If so, it
# returns 1 and defines LDFLAGS_SONAME_PREFIX to the flag's prefix, to
# which the client would need to append "libwhatever.N". If not, it
# returns 0 and defines LDFLAGS_SONAME_PREFIX to an empty string.
@@ -1160,6 +1199,10 @@ proc proj-check-soname {{libname "libfoo.so.0"}} {
if {[cc-check-flags "-Wl,-soname,${libname}"]} {
define LDFLAGS_SONAME_PREFIX "-Wl,-soname,"
return 1
} elseif {[cc-check-flags "-Wl,+h,${libname}"]} {
# HP-UX: https://sqlite.org/forum/forumpost/d80ecdaddd
define LDFLAGS_SONAME_PREFIX "-Wl,+h,"
return 1
} else {
define LDFLAGS_SONAME_PREFIX ""
return 0
+14
View File
@@ -501,6 +501,7 @@ proc sqlite-configure-phase1 {buildMode} {
if {[file exists $srcdir/sqlite3.pc.in]} {
proj-dot-ins-append $srcdir/sqlite3.pc.in
}
sqlite-handle-hpux; # must be relatively early so that other config tests can work
}; # sqlite-configure-phase1
########################################################################
@@ -1545,6 +1546,19 @@ proc sqlite-handle-mac-install-name {} {
return $rc
}
#
# Checks specific to HP-UX.
#
proc sqlite-handle-hpux {} {
switch -glob -- [get-define host] {
*hpux* {
if {[cc-check-flags "-Ae"]} {
define-append CFLAGS -Ae
}
}
}
}
########################################################################
# Handles the --dll-basename configure flag. [define]'s
# SQLITE_DLL_BASENAME to the DLL's preferred base name (minus
+8 -4
View File
@@ -52,10 +52,12 @@
** as the number of elements in the array. The virtual table steps through
** the array, element by element.
*/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#ifndef SQLITE3_H
# include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
# include <assert.h>
# include <string.h>
#endif
#ifdef _WIN32
struct iovec {
void *iov_base;
@@ -547,7 +549,9 @@ SQLITE_API int sqlite3_carray_init(
const sqlite3_api_routines *pApi
){
int rc = SQLITE_OK;
#ifdef SQLITE_EXTENSION_INIT2
SQLITE_EXTENSION_INIT2(pApi);
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
rc = sqlite3_create_module(db, "carray", &carrayModule, 0);
#ifdef SQLITE_TEST
+1 -1
View File
@@ -32,7 +32,7 @@ SQLITE_API int sqlite3_carray_bind(
void *aData, /* Pointer to array data */
int nData, /* Number of data elements */
int mFlags, /* CARRAY flags */
void (*xDel)(void*) /* Destructgor for aData*/
void (*xDel)(void*) /* Destructor for aData */
);
/* Allowed values for the mFlags parameter to sqlite3_carray_bind().
+35
View File
@@ -290,4 +290,39 @@ do_execsql_test 5.4 {
SELECT * FROM X1;
} {1 1}
#--------------------------------------------------------------------
reset_db
do_execsql_test 6.0 {
CREATE TABLE p1(a INTEGER PRIMARY KEY, b);
CREATE TABLE c1(x INTEGER PRIMARY KEY, y REFERENCES p1);
}
set ::cc [changeset_from_sql {
INSERT INTO c1 VALUES(10, 20);
}]
forcedelete test.db2
sqlite3 db2 test.db2
do_execsql_test -db db2 6.1 {
CREATE TABLE c1(x INTEGER PRIMARY KEY, y REFERENCES p1);
PRAGMA foreign_keys = ON;
PRAGMA foreign_keys;
} {1}
proc conflict_handler {args} {
puts $args
return "OMIT"
}
do_test 6.2 {
list [catch {sqlite3changeset_apply_v2 db2 $::cc conflict_handler} msg] $msg
} {1 SQLITE_ERROR}
do_test 6.3.1 { sqlite3_errmsg db2 } {no such table: main.p1}
do_test 6.3.2 { sqlite3_errcode db2 } {SQLITE_ERROR}
do_test 6.4 {
catchsql { INSERT INTO c1 VALUES(100, 200) } db2
} {1 {no such table: main.p1}}
finish_test
+28 -13
View File
@@ -2815,6 +2815,19 @@ static int sessionAppendDelete(
return rc;
}
static int sessionPrepare(
sqlite3 *db,
sqlite3_stmt **pp,
char **pzErrmsg,
const char *zSql
){
int rc = sqlite3_prepare_v2(db, zSql, -1, pp, 0);
if( pzErrmsg && rc!=SQLITE_OK ){
*pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(db));
}
return rc;
}
/*
** Formulate and prepare a SELECT statement to retrieve a row from table
** zTab in database zDb based on its primary key. i.e.
@@ -2836,12 +2849,12 @@ static int sessionSelectStmt(
int nCol, /* Number of columns in table */
const char **azCol, /* Names of table columns */
u8 *abPK, /* PRIMARY KEY array */
sqlite3_stmt **ppStmt /* OUT: Prepared SELECT statement */
sqlite3_stmt **ppStmt, /* OUT: Prepared SELECT statement */
char **pzErrmsg /* OUT: Error message */
){
int rc = SQLITE_OK;
char *zSql = 0;
const char *zSep = "";
int nSql = -1;
int i;
SessionBuffer cols = {0, 0, 0};
@@ -2921,7 +2934,7 @@ static int sessionSelectStmt(
#endif
if( rc==SQLITE_OK ){
rc = sqlite3_prepare_v2(db, zSql, nSql, ppStmt, 0);
rc = sessionPrepare(db, ppStmt, pzErrmsg, zSql);
}
sqlite3_free(zSql);
sqlite3_free(nooptest.aBuf);
@@ -3085,7 +3098,7 @@ static int sessionGenerateChangeset(
/* Build and compile a statement to execute: */
if( rc==SQLITE_OK ){
rc = sessionSelectStmt(db, 0, pSession->zDb,
zName, pTab->bRowid, pTab->nCol, pTab->azCol, pTab->abPK, &pSel
zName, pTab->bRowid, pTab->nCol, pTab->azCol, pTab->abPK, &pSel, 0
);
}
@@ -4294,6 +4307,7 @@ struct SessionApplyCtx {
u8 bRebase; /* True to collect rebase information */
u8 bIgnoreNoop; /* True to ignore no-op conflicts */
int bRowid;
char *zErr; /* Error message, if any */
};
/* Number of prepared UPDATE statements to cache. */
@@ -4519,7 +4533,7 @@ static int sessionDeleteRow(
}
if( rc==SQLITE_OK ){
rc = sqlite3_prepare_v2(db, (char *)buf.aBuf, buf.nBuf, &p->pDelete, 0);
rc = sessionPrepare(db, &p->pDelete, &p->zErr, (char*)buf.aBuf);
}
sqlite3_free(buf.aBuf);
@@ -4546,7 +4560,7 @@ static int sessionSelectRow(
){
/* TODO */
return sessionSelectStmt(db, p->bIgnoreNoop,
"main", zTab, p->bRowid, p->nCol, p->azCol, p->abPK, &p->pSelect
"main", zTab, p->bRowid, p->nCol, p->azCol, p->abPK, &p->pSelect, &p->zErr
);
}
@@ -4583,16 +4597,12 @@ static int sessionInsertRow(
sessionAppendStr(&buf, ")", &rc);
if( rc==SQLITE_OK ){
rc = sqlite3_prepare_v2(db, (char *)buf.aBuf, buf.nBuf, &p->pInsert, 0);
rc = sessionPrepare(db, &p->pInsert, &p->zErr, (char*)buf.aBuf);
}
sqlite3_free(buf.aBuf);
return rc;
}
static int sessionPrepare(sqlite3 *db, sqlite3_stmt **pp, const char *zSql){
return sqlite3_prepare_v2(db, zSql, -1, pp, 0);
}
/*
** Prepare statements for applying changes to the sqlite_stat1 table.
** These are similar to those created by sessionSelectRow(),
@@ -4602,14 +4612,14 @@ static int sessionPrepare(sqlite3 *db, sqlite3_stmt **pp, const char *zSql){
static int sessionStat1Sql(sqlite3 *db, SessionApplyCtx *p){
int rc = sessionSelectRow(db, "sqlite_stat1", p);
if( rc==SQLITE_OK ){
rc = sessionPrepare(db, &p->pInsert,
rc = sessionPrepare(db, &p->pInsert, 0,
"INSERT INTO main.sqlite_stat1 VALUES(?1, "
"CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END, "
"?3)"
);
}
if( rc==SQLITE_OK ){
rc = sessionPrepare(db, &p->pDelete,
rc = sessionPrepare(db, &p->pDelete, 0,
"DELETE FROM main.sqlite_stat1 WHERE tbl=?1 AND idx IS "
"CASE WHEN length(?2)=0 AND typeof(?2)='blob' THEN NULL ELSE ?2 END "
"AND (?4 OR stat IS ?3)"
@@ -5392,6 +5402,11 @@ static int sessionChangesetApply(
db->flags &= ~((u64)SQLITE_FkNoAction);
db->aDb[0].pSchema->schema_cookie -= 32;
}
assert( rc!=SQLITE_OK || sApply.zErr==0 );
sqlite3_set_errmsg(db, rc, sApply.zErr);
sqlite3_free(sApply.zErr);
sqlite3_mutex_leave(sqlite3_db_mutex(db));
return rc;
}
+6 -6
View File
@@ -1114,6 +1114,12 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
** update the "main" database attached to handle db with the changes found in
** the changeset passed via the second and third arguments.
**
** All changes made by these functions are enclosed in a savepoint transaction.
** If any other error (aside from a constraint failure when attempting to
** write to the target database) occurs, then the savepoint transaction is
** rolled back, restoring the target database to its original state, and an
** SQLite error code returned.
**
** The fourth argument (xFilter) passed to these functions is the "filter
** callback". This may be passed NULL, in which case all changes in the
** changeset are applied to the database. For sqlite3changeset_apply() and
@@ -1251,12 +1257,6 @@ void sqlite3changegroup_delete(sqlite3_changegroup*);
** This can be used to further customize the application's conflict
** resolution strategy.
**
** All changes made by these functions are enclosed in a savepoint transaction.
** If any other error (aside from a constraint failure when attempting to
** write to the target database) occurs, then the savepoint transaction is
** rolled back, restoring the target database to its original state, and an
** SQLite error code returned.
**
** If the output parameters (ppRebase) and (pnRebase) are non-NULL and
** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2()
** may set (*ppRebase) to point to a "rebase" that may be used with the
+41 -23
View File
@@ -1,11 +1,10 @@
#######################################################################
# This GNU makefile drives the build of the sqlite3 WASM
# components. It is not part of the canonical build process.
# This GNU makefile creates the canonical sqlite3 WASM builds.
#
# This build assumes a Linux platform and is not intended for
# general-purpose client-level use, except for creating builds with
# custom configurations. It is primarily intended for the sqlite
# project's own development of the JS/WASM components.
# custom configurations. It is primarily intended for the SQLite
# project's own development of its JS/WASM components.
#
# Primary targets:
#
@@ -134,7 +133,10 @@ JS_BUILD_NAMES = sqlite3 sqlite3-wasmfs
# - bundler-friendly = esm slightly tweaked for "bundler"
# tools. Bundlers are invariably based on node.js, so these builds
# are intended to be read at build-time by node.js but with a final
# target of browsers.
# target of browsers. All bundler-friendly builds are UNTESTED.
# They are provided primarily for use by the community-supported
# subproject which hosts npm builds of sqlite3, and they are
# actively supported only to the extent needed by that subproject.
#
# - node = for use by node.js for node.js, as opposed to by node.js on
# behalf of browser-side code (use bundler-friendly for that). Note
@@ -451,6 +453,8 @@ emcc.WASM_BIGINT ?= 1
# has shown -Oz to produce the smallest deliverables with only a
# roughly 10% performance hit in the resulting WASM file compared to
# -O2 (which consistently creates the fastest-running deliverables).
# Build time suffers greatly compared to -O0, which is why -O0 is the
# default.
ifeq (,$(filter $(OPTIMIZED_TARGETS),$(MAKECMDGOALS)))
emcc_opt ?= -O0
else
@@ -499,7 +503,7 @@ emcc_opt_full = $(emcc_opt) -g3
#
# Much practice has demonstrated that -O2 consistently gives the best
# runtime speeds, but not by a large enough factor to rule out use of
# -Oz when small deliverable size is a priority.
# -Oz when smaller deliverable size is a priority.
########################################################################
########################################################################
@@ -583,9 +587,20 @@ $(SOAP.js.bld): $(SOAP.js)
# them. Tools like wasm-objdump can be used to find the list of
# imports but it's questionable whether a non-Emscripten tool could
# realistically use that info to provide proper implementations.
#
# Sidebar: some of the imports are used soley by the Emscripten glue,
# which the sqlite3 JS code does not rely on.
#
# 2025-09-04: the most significant WASM imports sqlite3.wasm relies on
# are (A) sqlite3_malloc/sqlite3_free() (the memory-management APIs
# used by the whole library) and (B) the libc proxies for POSIX I/O
# emulation (arguably one of Emscripten's most convenient features
# when building C code for WASM). If we eliminate the POSIX I/O
# emulation then we could hypothetically eliminate all, or maybe all
# but one, Emscripten import dependency. We would either need to add
# our own POSIX emulation layer (not a trivial effort) or restrict the
# library to use of only in-memory VFSes and the JS-side VFSes.
#
# sqlite3-api.js.in = the amalgamated sqlite3-api.js before it gets
# preprocessed. It contains all of $(sqlite3-api.jses) but none of the
# Emscripten-specific headers and footers.
@@ -648,26 +663,27 @@ emcc.jsflags += -sSTRICT_JS=0
# -sSTRICT=1 Causes failures about unknown symbols which the build
# tools should be installing, e.g. __syscall_geteuid32
# -sENVIRONMENT values for the various build modes:
# emcc -sENVIRONMENT values for the various build modes:
emcc.environment.vanilla = web,worker
emcc.environment.bundler-friendly = $(emcc.environment.vanilla)
emcc.environment.esm = $(emcc.environment.vanilla)
emcc.environment.node = node
# Note that adding ",node" to the list for the other builds causes
# Emscripten to generate code which confuses node: it cannot reliably
# determine whether the build is for a browser or for node.
# Adding ",node" to the list for the other builds causes Emscripten to
# generate code which confuses node: it cannot reliably determine
# whether the build is for a browser or for node. We neither build nor
# test node builds on a regular basis. They are fully unsupported.
########################################################################
# -sINITIAL_MEMORY: How much memory we need to start with is governed
# at least in part by whether -sALLOW_MEMORY_GROWTH is enabled. If so,
# we can start with less. If not, we need as much as we'll ever
# possibly use (which, of course, we can't know for sure). Note,
# however, that speedtest1 shows that performance for even moderate
# workloads MAY suffer considerably if we start small and have to grow
# at runtime. e.g. OPFS-backed (speedtest1 --size 75) take MAY take X
# time with 16mb+ memory and 3X time when starting with 8MB. However,
# such test results are inconsistent due to browser internals which
# are opaque to us.
# possibly use (which, of course, we can't know for sure). speedtest1
# shows that performance for even moderate workloads MAY suffer
# considerably if we start small and have to grow at runtime.
# e.g. OPFS-backed (speedtest1 --size 75) take MAY take X time with
# 16mb+ memory and 3X time when starting with 8MB. However, such test
# results are inconsistent due to browser internals which are opaque
# to us.
#
# 2024-03-04: emsdk 3.1.55 replaces INITIAL_MEMORY with INITIAL_HEAP,
# but also says (in its changelog): "Note that it is currently not
@@ -892,6 +908,8 @@ EXPORTED_FUNCTIONS.fiddle = $(dir.tmp)/EXPORTED_FUNCTIONS.fiddle
# part, as it's unable to reliably determine whether the target is
# a browser or node.
#
# We repeat: all node.js builds are 100% untested and unsupported.
#
########################################################################
########################################################################
# We have to ensure that we do not build $(sqlite3*.*js) in parallel
@@ -921,8 +939,8 @@ ifneq (1,$(MAKING_CLEAN))
# native makefile code. Somewhat surprisingly, moving that code generation
# to C makes it slightly less illegible than the previous 3 options.
#
# Maintenance note: the various $(c-pp.D.XYZ) vars are defined in this
# step.
# Maintenance note: the various $(c-pp.D.XYZ) vars are defined via
# $(bin.mkwb).
bin.mkwb = ./mkwasmbuilds
$(bin.mkwb): $(bin.mkwb).c $(MAKEFILE)
$(CC) -o $@ $<
@@ -1101,7 +1119,7 @@ $(eval $(call SQLITE.CALL.C-PP.FILTER,tester1.c-pp.js,tester1.mjs,$(c-pp.D.sqlit
$(eval $(call SQLITE.CALL.C-PP.FILTER,tester1.c-pp.html,tester1.html))
$(eval $(call SQLITE.CALL.C-PP.FILTER,tester1.c-pp.html,tester1-esm.html,$(c-pp.D.sqlite3-esm)))
tester1: tester1.js tester1.mjs tester1.html tester1-esm.html
# Note that we do not include $(dir.dout)/sqlite3-bundler-friendly.mjs in this
# We do not include $(dir.dout)/sqlite3-bundler-friendly.mjs in this
# because bundlers are client-specific.
all quick: tester1
quick: $(sqlite3.js)
@@ -1140,7 +1158,7 @@ oz: clean
########################################################################
# Sub-makes...
# sqlite.org/fiddle application...
# https://sqlite.org/fiddle application...
include $(MAKEFILE.fiddle)
# Only add wasmfs if wasmfs.enable=1 or we're running (dist)clean
@@ -1195,8 +1213,8 @@ push-testing:
echo "SSH failed: it's likely that stale content will be served via old gzip files."
########################################################################
# If we find a copy of the sqlite.org/wasm docs checked out, copy
# certain files over to it, noting that some need automatable edits...
# If we find a copy of https://sqlite.org/wasm checked out, copy
# certain files over to it, applying some automated edits...
wasm.docs.home ?= ../../../wasm
wasm.docs.found = $(if $(wildcard $(wasm.docs.home)/api-index.md),\
$(wildcard $(wasm.docs.home)),)
+4 -4
View File
@@ -98,10 +98,10 @@ which (almost) all of the test and demo applications can be accessed.
real utility when it's used in conjunction with the project's
proprietary test suite, which most users don't have access to.)
Note that when serving this app via [althttpd][], it must be a version
from 2022-09-26 or newer so that it recognizes the `--enable-sab`
flag, which causes althttpd to emit two HTTP response headers which
are required to enable JavaScript's `SharedArrayBuffer` and `Atomics`
When serving this app via [althttpd][], it must be a version from
2022-09-26 or newer so that it recognizes the `--enable-sab` flag,
which causes althttpd to emit two HTTP response headers which are
required to enable JavaScript's `SharedArrayBuffer` and `Atomics`
APIs. Those APIs are required in order to enable the [OPFS][]-related
features in the apps which use them.
+25 -20
View File
@@ -16,9 +16,9 @@ multiple JS files because:
3. Certain components must be in their own standalone files in order
to be loaded as JS Workers.
Note that the structure described here is the current state of things,
as of this writing, but is not set in stone forever and may change
at any time.
The structure described here is the current state of things, as of
this writing, but is not set in stone forever and may change at any
time.
The overall idea is that the following files get concatenated
together, in the listed order, the resulting file is loaded by a
@@ -29,13 +29,15 @@ browser client:
objects. This is exposed as a function, rather than objects, so that
the next step can pass in a config object which abstracts away parts
of the WASM environment, to facilitate plugging it in to arbitrary
WASM toolchains.
WASM toolchains. The bootstrapping function gets removed from the
global scope in a later stage of the bootstrapping process.
- **`../common/whwasmutil.js`**\
A semi-third-party collection of JS/WASM utility code intended to
replace much of the Emscripten glue. The sqlite3 APIs internally use
these APIs instead of their Emscripten counterparts, in order to be
more portable to arbitrary WASM toolchains. This API is
configurable, in principle, for use with arbitrary WASM
more portable to arbitrary WASM toolchains and help reduce
regressions caused by toolchain-level behavioral changes. This API
is configurable, in principle, for use with arbitrary WASM
toolchains. It is "semi-third-party" in that it was created in order
to support this tree but is standalone and maintained together
with...
@@ -48,8 +50,8 @@ browser client:
- **`sqlite3-api-glue.js`**\
Invokes functionality exposed by the previous two files to flesh out
low-level parts of `sqlite3-api-prologue.js`. Most of these pieces
related to populating the `sqlite3.capi.wasm` object. This file
also deletes most global-scope symbols the above files create,
involve populating the `sqlite3.capi.wasm` object. This file also
deletes most global-scope symbols the above files create,
effectively moving them into the scope being used for initializing
the API.
- **`<build>/sqlite3-api-build-version.js`**\
@@ -60,8 +62,8 @@ browser client:
Provides a high-level object-oriented wrapper to the lower-level C
API, colloquially known as OO API #1. Its API is similar to other
high-level sqlite3 JS wrappers and should feel relatively familiar
to anyone familiar with such APIs. That said, it is not a "required
component" and can be elided from builds which do not want it.
to anyone familiar with such APIs. It is not a "required component"
and can be elided from builds which do not want it.
- **`sqlite3-api-worker1.js`**\
A Worker-thread-based API which uses OO API #1 to provide an
interface to a database which can be driven from the main Window
@@ -96,7 +98,7 @@ browser client:
amalgamation.
- **`sqlite3-vfs-opfs-sahpool.c-pp.js`**\
is another sqlite3 VFS supporting the [OPFS][], but uses a
completely different approach that the above-listed one.
completely different approach than the above-listed one.
- **`sqlite3-api-cleanup.js`**\
The previous files do not immediately extend the library. Instead
they add callback functions to be called during its
@@ -106,8 +108,11 @@ browser client:
process, which is what finally executes the initialization code
installed by the previous files. As of this writing, this code
ensures that the previous files leave no more than a single global
symbol installed. When adapting the API for non-Emscripten
toolchains, this "should" be the only file where changes are needed.
symbol installed - `sqlite3InitModule()`. When adapting the API for
non-Emscripten toolchains, this "should" be the only file, of those
in this list, where changes are needed. The Emscripten-specific
pieces described below may also require counterparts in any as-yet
hypothetical alternative build.
**Files with the extension `.c-pp.js`** are intended [to be processed
@@ -130,25 +135,25 @@ WASM-specific helper functions, at least one of which requires access
to private/static `sqlite3.c` internals. `sqlite3.wasm` is compiled
from this file rather than `sqlite3.c`.
The following files are part of the build process but are injected
into the build-generated `sqlite3.js` along with `sqlite3-api.js`.
The following Emscripten-specific files are injected into the
build-generated `sqlite3.js` along with `sqlite3-api.js`.
- `extern-pre-js.js`\
- **`extern-pre-js.js`**\
Emscripten-specific header for Emscripten's `--extern-pre-js`
flag. As of this writing, that file is only used for experimentation
purposes and holds no code relevant to the production deliverables.
- `pre-js.c-pp.js`\
- **`pre-js.c-pp.js`**\
Emscripten-specific header for Emscripten's `--pre-js` flag. This
file is intended as a place to override certain Emscripten behavior
before it starts up, but corner-case Emscripten bugs keep that from
being a reality.
- `post-js-header.js`\
- **`post-js-header.js`**\
Emscripten-specific header for the `--post-js` input. It opens up
a lexical scope by starting a post-run handler for Emscripten.
- `post-js-footer.js`\
- **`post-js-footer.js`**\
Emscripten-specific footer for the `--post-js` input. This closes
off the lexical scope opened by `post-js-header.js`.
- `extern-post-js.c-pp.js`\
- **`extern-post-js.c-pp.js`**\
Emscripten-specific header for Emscripten's `--extern-post-js`
flag. This file overwrites the Emscripten-installed
`sqlite3InitModule()` function with one which, after the module is
+6 -7
View File
@@ -4,10 +4,9 @@
a blank line for a sed-based kludge for the ES6 build. */
/* extern-post-js.js must be appended to the resulting sqlite3.js
file. It gets its name from being used as the value for the
--extern-post-js=... Emscripten flag. Note that this code, unlike
most of the associated JS code, runs outside of the
Emscripten-generated module init scope, in the current
global scope. */
--extern-post-js=... Emscripten flag. This code, unlike most of the
associated JS code, runs outside of the Emscripten-generated module
init scope, in the current global scope. */
//#if target=es6-module
const toExportForESM =
//#endif
@@ -78,9 +77,9 @@ const toExportForESM =
EmscriptenModule['ENVIRONMENT_IS_PTHREAD']){
/** Workaround for wasmfs-generated worker, which calls this
routine from each individual thread and requires that its
argument be returned. The conditional criteria above are
fragile, based solely on inspection of the offending code,
not public Emscripten details. */
argument be returned. The if() condition above is fragile,
based solely on inspection of the offending code, not
public Emscripten details. */
//console.warn("sqlite3InitModule() returning E-module.",EmscriptenModule);
return EmscriptenModule;
}
+1 -1
View File
@@ -23,7 +23,7 @@ sqlite3InitModuleState.debugModule('globalThis.location =',globalThis.location);
1) If URL param named the same as `path` is set, it is returned.
2) If sqlite3InitModuleState.sqlite3Dir is set, then (thatName + path)
is returned (note that it's assumed to end with '/').
is returned (it's assumed to end with '/').
3) If this code is running in the main UI thread AND it was loaded
from a SCRIPT tag, the directory part of that URL is used
+25 -27
View File
@@ -3,12 +3,11 @@
#
# Intended to include'd by ./GNUmakefile.
#
# 'make dist' rules for creating a distribution archive of the WASM/JS
# pieces, noting that we only build a dist of the built files, not the
# numerous pieces required to build them.
# 'make dist' rules for creating a distribution archive of the SQLite
# WASM/JS deliverables.
#
# Use 'make snapshot' to create "snapshot" releases. They use a
# distinctly different zip file and top directory name to distinguish
# Use 'make snapshot' to create "snapshot" releases. They use
# distinctly different zip file and top directory names to distinguish
# them from release builds.
#######################################################################
MAKEFILE.dist = $(lastword $(MAKEFILE_LIST))
@@ -32,17 +31,17 @@ endif
dist-name = $(dist-name-prefix)-TEMP
########################################################################
# dist.build must be the name of a target which triggers the build of
# the files to be packed into the dist archive. The intention is that
# it be one of (o0, o1, o2, o3, os, oz), each of which uses like-named
# -Ox optimization level flags. The o2 target provides the best
# overall runtime speeds. The oz target provides slightly slower
# speeds (roughly 10%) with significantly smaller WASM file
# sizes. Note that -O2 (the o2 target) results in faster binaries than
# both -O3 and -Os (the o3 and os targets) in all tests run to
# date. Our general policy is that we want the smallest binaries for
# dist zip files, so use the oz build unless there is a compelling
# reason not to.
# $(dist.build) must be the name of a target which triggers the build
# of the files to be packed into the dist archive. The intention is
# that it be one of (o0, o1, o2, o3, os, oz), each of which uses
# like-named -Ox optimization level flags. The o2 target provides the
# best overall runtime speeds. The oz target provides slightly slower
# speeds (roughly 10%) with significantly smaller WASM file sizes. -O2
# (the o2 target) consistently results in faster binaries than both
# -O3 and -Os (the o3 and os targets) in all tests run to date. Our
# general policy is that we want the smallest binaries for dist zip
# files, so use the oz build unless there is a compelling reason not
# to.
dist.build ?= oz
dist-dir.top = $(dist-name)
@@ -62,10 +61,6 @@ dist.common.extras = \
$(wildcard $(dir.common)/*.css) \
$(dir.common)/SqliteTestUtil.js
#$(info sqlite3-worker1-promiser.mjs = $(sqlite3-worker1-promiser.mjs))
#$(info sqlite3-worker1.js = $(sqlite3-worker1.js))
#$(info sqlite3-api.ext.jses = $(sqlite3-api.ext.jses))
#$(info dist.jswasm.extras = $(dist.jswasm.extras))
.PHONY: dist snapshot
# DIST_STRIP_COMMENTS $(call)able to be used in stripping C-style
# from the dist copies of certain files.
@@ -94,16 +89,19 @@ STRIP_K2.js = $(sqlite3.js) $(sqlite3.mjs) \
# dist's deps must be trimmed to non-generated files or
# files which are _not_ cleaned up by the clean target.
#
# Note that we require $(bin.version-info) in order to figure out the
# dist file's name, so cannot (without a recursive make) have the
# target name equal to the archive name.
# We require $(bin.version-info) in order to figure out the dist
# file's name, so cannot (without a recursive make) have the target
# name equal to the archive name.
#
# 2025-01-15: Emsdk 4.0.0 introduces, in its generated code, a regex
# which contains the pattern /*. That, of course, confuses any C-style
# comment-stripper which is not specifically JS-aware and smart enough
# to know that it's in a regex or string literal. Because of that,
# comment-stripping is currently disabled, which means the builds will
# be significantly larger than before.
# comment-stripping was briefly disabled, resulting in functionally
# identical but significantly larger JS files. That issue with the
# comment-stripper has been resolved, but $(apply_comment_stripper)
# can be set to false to disable it if a similar problem arises.
#
#apply_comment_stripper = false
apply_comment_stripper = true
# ^^^ shell command true or false
@@ -138,7 +136,7 @@ ifeq (,$(wasm.docs.found))
snapshot: dist
@echo "To upload the snapshot build to the wasm docs server:"; \
echo "1) move $(dist-name-prefix)*.zip to the top of a wasm docs checkout."; \
echo "2) run 'make uv-sync'"
echo "2) From that checkout run 'make uv-sync'"
else
snapshot: dist
@echo "Moving snapshot to [$(wasm.docs.found)]..."; \
@@ -150,5 +148,5 @@ endif
# copied into the new $(dist-name) dir.
.PHONY: dist-clean
clean: dist-clean
dist-clean:
dist-clean: # not to be confused with distclean
rm -fr $(dist-name) $(wildcard sqlite-wasm-*.zip)
+1 -1
View File
@@ -1963,7 +1963,7 @@ xbin: sqltclsh$(T.exe) sqlite3_analyzer$(T.exe)
sqlite3_expert$(T.exe): $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c \
$(TOP)/ext/expert/expert.c sqlite3.c
$(T.link) $(TOP)/ext/expert/sqlite3expert.h $(TOP)/ext/expert/sqlite3expert.c \
$(T.link) $(TOP)/ext/expert/sqlite3expert.c \
$(TOP)/ext/expert/expert.c sqlite3.c -o sqlite3_expert $(LDFLAGS.libsqlite3)
xbin: sqlite3_expert$(T.exe)
+43 -40
View File
@@ -1,5 +1,5 @@
C Get\sTcl_Init()\sworking\sfor\sTcl9,\sthe\smajor\scaveat\sbeing\sthat\sfor\sstatically-linked\sbuilds\sthis\sonly\sworks\sif\sthe\sTcl9\smain\slib\sZIP\sfile\s(part\sof\sits\ssource\sbuild\sbut\snot\sinstalled)\sgets\sconcatenated\sto\sthe\sresulting\scustom\sshell's\sbinary.\sThanks\sto\sJan\sNijtmans\sfor\shis\shelp\swith\sthis.
D 2025-08-28T14:21:18.899
C Typo\sfixes.\s\sMake\ssqlite3_set_errmsg()\saccessible\sto\srun-time\sloadable\nextensions.
D 2025-09-12T15:31:33.770
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -17,7 +17,7 @@ F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2
F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531
F auto.def 44a0d1bf09d78355fc88251ccbf8e64e6341fd89c11de68a01c3645e53a2bade
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
F autoconf/Makefile.in d0926d2309e563b5ebdfd711e5c218533acab79829a05eef4e97c3a92e17bf42
F autoconf/Makefile.in 306f500fce8cae9e1af9459f1ac7fe89ce46999594ef3fdc62dc9d7d651fb091
F autoconf/Makefile.msc f15ad424ca2820df8e39d9157965710af0a64d87773706706a12ea4f96e3a0d8
F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136
F autoconf/README.txt b749816b8452b3af994dc6d607394bef3df1736d7e09359f1087de8439a52807
@@ -34,20 +34,20 @@ F autoconf/tea/teaish.test.tcl cfe94e1fb79dd078f650295be59843d470125e0cc3a17a141
F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4
F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e
F autosetup/README.md ce0f95980a687bb861bd830b76bc4b48513567be5cf5ee7004f4f3439ffe3841
F autosetup/autosetup 74a9782b68d07934510190fbd03fc6ad92e63f0ea3b5cbffa5f0bd271ad60f01 x
F autosetup/autosetup b16e44924c197783df67366762dda985b45d49ebc4af15f4054e3ee0e3b65169 x
F autosetup/autosetup-config.guess dfa101c5e8220e864d5e9c72a85e87110df60260d36cb951ad0a85d6d9eaa463 x
F autosetup/autosetup-config.sub a38fb074d0dece01cf919e9fb534a26011608aa8fa606490864295328526cd73 x
F autosetup/autosetup-find-tclsh b08f883f5753cfff1ecb8581f98b314e190b7e3f3059798e274ae5f5aad571af x
F autosetup/autosetup-test-tclsh 749d20defee533a3842139df47d700fc7a334a5da7bdbd444ae5331744b06c5f
F autosetup/cc-db.tcl 6e0ed90146197a5a05b245e649975c07c548e30926b218ca3e1d4dc034b10a7b
F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795facf7360
F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78
F autosetup/cc-shared.tcl 163eda58c14cd662fd8a504bd2ad8a716ef4db7015dc1de0095d5de8dd601a4b
F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f
F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e
F autosetup/jimsh0.c 563b966c137a4ce3c9333e5196723b7ac0919140a9d7989eb440463cd855c367
F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
F autosetup/proj.tcl 3418e01d9c83e8eed28ede96e41a3197bc6991655dc04d69fd328b65bfa1df7d
F autosetup/sqlite-config.tcl f2d2cf0917a17068ab2897b2009e31a05a4481a0786cd6ea15f643fef325bbe3
F autosetup/proj.tcl ec30c4bc301b6e9eb937655744a7315f863f804fc66400d975bcf9352ac96a1d
F autosetup/sqlite-config.tcl e06b0f64079c4b303a0544f0619f95a1f1f164cddca4068372949eac4149b6ee
F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
F autosetup/teaish/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca
F autosetup/teaish/core.tcl aee092fc71986d1272b835ea7492bb55ffc213a289502e4f14da80cf67b7e3c3
@@ -361,8 +361,8 @@ F ext/misc/base85.c a70c885c5c9350261ea6e7b166038eab21a09cf4fceae856ce41fae9c221
F ext/misc/basexx.c 89ad6b76558efbceb627afd5e2ef1d84b2e96d9aaf9b7ecb20e3d00b51be6fcf
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
F ext/misc/btreeinfo.c 8f5e6da2c82ec2f06ee0216e922370a436dafdbb06ffa7a552203515ff9e7ddf
F ext/misc/carray.c 34fac63770971611c5285de0a9f0ac67d504eaf66be891f637add9290f1c76a5
F ext/misc/carray.h 503209952ccf2431c7fd899ebb92bf46bf7635b38aace42ec8aa1b8d7b6e98a5
F ext/misc/carray.c 1d32a060f60127ad38d5abd071b28443b77885b143da946a10ca16812e0f851e
F ext/misc/carray.h 4bef8af4e9ddda024f5540cc4d456c3e4a4a7624d6315edf85dce1ce8419beb8
F ext/misc/cksumvfs.c 9d7d0cf1a8893ac5d48922bfe9f3f217b4a61a6265f559263a02bb2001259913
F ext/misc/closure.c 5559daf1daf742228431db929d1aa86dd535a4224cc634a81d2fd0d1e6ad7839
F ext/misc/completion.c c3c8b3cc1293c34f04f8746a3adfbfedb43f00d113f8c984a1ed09433317e507
@@ -540,7 +540,7 @@ F ext/session/session4.test 823f6f018fcbb8dacf61e2960f8b3b848d492b094f8b495eae1d
F ext/session/session5.test 716bc6fafd625ce60dfa62ae128971628c1a1169
F ext/session/session6.test 35279f2ec45448cd2e24a61688219dc6cf7871757716063acf4a8b5455e1e926
F ext/session/session8.test 326f3273abf9d5d2d7d559eee8f5994c4ea74a5d935562454605e6607ee29904
F ext/session/session9.test 4e3aff62d6b4294498ddbe309076de06f4fddffad4fe5f5a6c033358b01df083
F ext/session/session9.test 0c4a8fbe7a5031f50855f020f3408e1f07fd7859f1daa1629eadcec3422072d6
F ext/session/sessionA.test 1feeab0b8e03527f08f2f1defb442da25480138f
F ext/session/sessionB.test c4fb7f8a688787111606e123a555f18ee04f65bb9f2a4bb2aa71d55ce4e6d02c
F ext/session/sessionC.test f8a5508bc059ae646e5ec9bdbca66ad24bc92fe99fda5790ac57e1f59fce2fdf
@@ -573,13 +573,13 @@ F ext/session/sessionrowid.test 85187c2f1b38861a5844868126f69f9ec62223a03449a98a
F ext/session/sessionsize.test 8fcf4685993c3dbaa46a24183940ab9f5aa9ed0d23e5fb63bfffbdb56134b795
F ext/session/sessionstat1.test 5e718d5888c0c49bbb33a7a4f816366db85f59f6a4f97544a806421b85dc2dec
F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009ecef8511f4cf3fc
F ext/session/sqlite3session.c 9205e6e8f389ea44a8118082ce3832374da92284a60e4fb3ea6b1b421f0dbc54
F ext/session/sqlite3session.h b81e8536ce4b83babafd700f4ff67017804b6c1d71df963b30d3972958e7f4a7
F ext/session/sqlite3session.c 9cd47bfefb23c114b7a5d9ee5822d941398902f30516bf0ddfb131d94f8bb840
F ext/session/sqlite3session.h 6641184274b1d46594e450793d39aa96053916043234fb9e653c661160a166a7
F ext/session/test_session.c 8766b5973a6323934cb51248f621c3dc87ad2a98f023c3cc280d79e7d78d36fb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile 35e730a01b32481f5483ea5bd72c3d4609e25f34cb5aab9f85eb3eba6f0c4935
F ext/wasm/GNUmakefile 89e18d6e4783841a5236930b988df27e02317b3ac440a1a5571de4a79df3c8e7
F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a
F ext/wasm/README.md b89605f65661cf35bf034ff6d43e448cc169b8017fc105d498e33b81218b482c
F ext/wasm/README.md 66ace67ae98a45e4116f2ca5425b716887bcee4d64febee804ff6398e1ae9ec7
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
F ext/wasm/SQLTester/SQLTester.mjs 66e1adc3d79467b68e3e40614fd42c1a577c7e219ec0985db966eded52a941e5
F ext/wasm/SQLTester/SQLTester.run.mjs 57f2adb33f43f2784abbf8026c1bfd049d8013af1998e7dcb8b50c89ffc332e0
@@ -589,12 +589,12 @@ F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-core 2bcbbfe3b95c043ed6037e2708a2ee078
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-extras cb4fa8842c875b6ee99381523792975c5ebb7371bd27fbd1bd863a43c7f3505a
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-see fb29e62082a658f0d81102488414d422c393c4b20cc2f685b216bc566237957b
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
F ext/wasm/api/README.md c64ec8e84449c069e0217706d9d7d31b3bd53627228b2ba0c3cddbdc2350ca66
F ext/wasm/api/extern-post-js.c-pp.js 3fcd904f1204685dea84e5ae90d8b7e65a1dcebab1e838386d8328b74cce46c9
F ext/wasm/api/README.md 7f029c5fe83b3493931d2fb915e2febd3536267d538a56408a6fef284ea38d29
F ext/wasm/api/extern-post-js.c-pp.js d8f5ffa354c790d89681d0a23594c02347d28046d60151bd598712fbdff6056c
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js 365405929f41ca0e6d389ed8a8da3f3c93e11d3ef43a90ae151e37fa9f75bf41
F ext/wasm/api/post-js-header.js 53740d824e5d9027eb1e6fd59e216abbd2136740ce260ea5f0699ff2acb0a701
F ext/wasm/api/pre-js.c-pp.js a614a2c82b12c4d96d8e3ba77330329efc53c4d56a8a7e60ade900f341866cfb
F ext/wasm/api/pre-js.c-pp.js 58f823de197e2c10d76179aa05410a593b7ae03e1ece983bb42ffd818e8857e1
F ext/wasm/api/sqlite3-api-cleanup.js 3ac1786e461ada63033143be8c3b00b26b939540661f3e839515bb92f2e35359
F ext/wasm/api/sqlite3-api-glue.c-pp.js 0b76510f3650053bac67ca8947cb6ab9d050ad2218118a2e7796dd37be832ffa
F ext/wasm/api/sqlite3-api-oo1.c-pp.js 852f2cd6acddbae487fc4f1c3ec952e6c1e2033aa4e6c7091d330d983c87c032
@@ -628,7 +628,7 @@ F ext/wasm/demo-worker1-promiser.c-pp.html 635cf90685805e21772a5f7a35d1ace80f98a
F ext/wasm/demo-worker1-promiser.c-pp.js af168699d3cab1c27ad2364ebe06cd49db300bdbf404e23b00d5742ed52816ba
F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d
F ext/wasm/demo-worker1.js 08720227e98fa5b44761cf6e219269cee3e9dd0421d8d91459535da776950314
F ext/wasm/dist.make c29018b4db479a4c170569393e5399f0625446123a7eb6ffb0677495292bb954
F ext/wasm/dist.make 57f5da2f0de5a297b5a0bc39ffec736380050578240ab24d864c2ff1b3634a3b
F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c95839afd8b05862f
F ext/wasm/fiddle.make ea505d11aa2a89551e1693ed4c71ee6a163364ca14f806dda295d0beb26ec0ea
F ext/wasm/fiddle/fiddle-worker.js 50d3edf54c0c0e3657e876724ec2c10069f55f3e40af20864d72f6f6e9ad00f8
@@ -665,7 +665,7 @@ F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36
F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61
F ext/wasm/wasmfs.make 411dd94b40406572caddf88392a1ccc4deed0f88d260516e59ca6e0c887ee861
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
F main.mk 04ca5a9737fdf10ca00bb3a8f9c04e966c058730bf25c617c141877afb016d46
F main.mk d865589aa95918787659459f7dddd0680f99034e7b111fc161035d736c670a47
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
@@ -689,7 +689,7 @@ F src/build.c 213a9d24c931ef4694564894cda8dac8dbeb1519d428fd2d7ae622ac357c05a5
F src/callback.c acae8c8dddda41ee85cfdf19b926eefe830f371069f8aadca3aa39adf5b1c859
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/date.c 9db4d604e699a73e10b8e85a44db074a1f04c0591a77e2abfd77703f50dce1e9
F src/dbpage.c b3e218f8ed74fcbb7fa805df8ca669a3718d397617b3d8a8aac3307dc315c4d6
F src/dbpage.c a6f7f16fde5656686b05705d41a4cb339db8262dc4d11699b7b40ba503db624e
F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c
F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42
F src/expr.c 0cad74107489c688449d7fec47b605c61a75c6da707031dfc4c76d1ac75667b3
@@ -705,7 +705,7 @@ F src/insert.c dfd311b0ac2d4f6359e62013db67799757f4d2cc56cca5c10f4888acfbbfa3fd
F src/json.c cb87977b1ee25ee7d27505d65a9261b687395bf895342c8ba566b7c01aee2047
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c d7edd8e671237539d795d30daaf888908a2c82e99bade4c78f3be021e8b7d655
F src/main.c 458e79da86c957a094c1c256136af43e7dfec2c58475ee9cbbda4dc202005021
F src/main.c 8faccfa7dc8a470ac57f060948ff703da1f2dbedcd4cebc0a21caeb7facf7eef
F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2
@@ -726,31 +726,31 @@ F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06
F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a
F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107
F src/os_unix.c 44f5fa0fa67595c9308a0ce4ae9e01ae2b2dcee0f6c7c2f5e8473ecd23e0216a
F src/os_unix.c b3da55bc4bb214b2bfb1e430b10e9d3ebcf6b11741921ab044c9b9539c8fcc4f
F src/os_win.c f81a7cffdfe8c593a840895b3f64290714f0186b06302d2c397012252d830374
F src/os_win.h 4c247cdb6d407c75186c94a1e84d5a22cbae4adcec93fcae8d2bc1f956fd1f19
F src/pager.c 23c0f17deb892da6b32fef1f465507df7ab5cd01d774288cb43695658a649259
F src/pager.c ee48e0cc9ae4abfd7c37b838bff62a14d520a9fa311007fa57929ac7cc5d609c
F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8
F src/parse.y 619c3e92a54686c5e47923688c4b9bf7ec534a4690db5677acc28b299c403250
F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
F src/pcache1.c 131ca0daf4e66b4608d2945ae76d6ed90de3f60539afbd5ef9ec65667a5f2fcd
F src/pragma.c 30b535d0a66348df844ee36f890617b4cf45e9a22dcbc47ec3ca92909c50aaf1
F src/pragma.c 20847ce727fa0efe64de13f54427d44d25df7a00c806f198463dc37041aeeed0
F src/prepare.c 2af0b5c1ec787c8eebd21baa9d79caf4a4dc3a18e76ce2edbf2027d706bca37a
F src/printf.c 5f0c957af9699e849d786e8fbaa3baab648ca5612230dc17916434c14bc8698f
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c f8d1d011aba0964ff1bdccd049d4d2c2fec217efd90d202a4bb775e926b2c25d
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c b95181711d59c36d9789e67f76c4cfec64b99f9629a50be5e6566e117b87d957
F src/shell.c.in 51c8452b3e6b9a0dfa3df853dd16f147e5e4ae2002deb775cf8a2fccf01c3c6c
F src/sqlite.h.in ebfc0358de0e18aabee7fa918f2f846894e23bebc74160fbe265c99046ee61b8
F src/shell.c.in c309e6e95b4de2be9dd0fbe4d40f729199a85bcc54d66759a0aef3b3e6504b22
F src/sqlite.h.in 5732519a2acb09066032ceac21f25996eb3f28f807a4468e30633c7c70faae1c
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 0bfd049bb2088cc44c2ad54f2079d1c6e43091a4e1ce8868779b75f6c1484f1e
F src/sqlite3ext.h 3f0c4ed6934e7309a61c6f3c30f70a30a5b869f785bb3d9f721a36c5e4359126
F src/sqliteInt.h 27c73e48878d31ef230ba867d1f8c3af6aed357fd93ccc605d3f1aae007ea62b
F src/sqliteLimit.h fe70bd8983e5d317a264f2ea97473b359faf3ebb0827877a76813f5cf0cdc364
F src/status.c 0e72e4f6be6ccfde2488eb63210297e75f569f3ce9920f6c3d77590ec6ce5ffd
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/tclsqlite.c 43db3e50e674d715fce53957d6607f8833a261f1e241d3df5647bd789cdeac5d
F src/tclsqlite.c 3c604c49e6cf4211960a9ddb9505280fd22cde32175f40884c641c0f5a286036
F src/tclsqlite.h 614b3780a62522bc9f8f2b9fb22689e8009958e7aa77e572d0f3149050af348a
F src/test1.c 82d8aab7162a758d030728cab6ae6011785234854b7d6d2aebd877f985d1016a
F src/test2.c 62f0830958f9075692c29c6de51b495ae8969e1bef85f239ffcd9ba5fb44a5ff
@@ -808,7 +808,7 @@ F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1
F src/utf.c 7267c3fb9e2467020507601af3354c2446c61f444387e094c779dccd5ca62165
F src/util.c 36fb1150062957280777655976f3f9a75db236cb8207a0770ceae8d5ec17fcd3
F src/vacuum.c 1bacdd0a81d2b5dc1c508fbf0d938c89fa78dd8d5b46ec92686d44030d4f4789
F src/vdbe.c a5873cd566a0e2a0344a86dd946add9d34fae3feeae8b126277ef7af8dc11f91
F src/vdbe.c 07084aa0152c8d4e74e7b86c0cf744732f0f9b1fd62bd7098252cadb741c630a
F src/vdbe.h ea1f1b52f0efe422f80d88da3c57e4eadc72856e29a22f1ff08e502ec6ba5f08
F src/vdbeInt.h 52896dd4d5b62190c53db14b09fc2484434eb594c963df0fa66eb8a94527b02e
F src/vdbeapi.c f9a4881a9674fec3fa13da35044a1484d3c4b95f9ec891cc8ffb02ef2b7a41df
@@ -819,8 +819,8 @@ F src/vdbesort.c cb6f472e83ca12c46aa7de0ac0a9d11458b357986f2617a1c90dfb19a542ecb
F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf823
F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3
F src/vtab.c 828221bdbeaaa6d62126ee6d07fd4ec0d09dcaea846f87ad01944d8b7e548859
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 20be6f0a25a80b7897cf2a5369bfd37ef198e6f0b6cdef16d83eee856056b159
F src/vxworks.h 9d18819c5235b49c2340a8a4d48195ec5d5afb637b152406de95a9436beeaeab
F src/wal.c a278339ecf5f194fd71fff1f0da1368de50e3a32edc3e9944e1ee1f4610476ff
F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452
F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014
F src/where.c f2f075bd17065922235632feb368efe92a7f03d42797eb575267574fbf6d4218
@@ -920,6 +920,7 @@ F test/bestindexA.test e1b5def6b190797cacf008e6815ffb78fb30261999030d60a728d572e
F test/bestindexB.test 328b97b69cd1a20928d5997f9ecb04d2e00f1d18e19ab27f9e9adb44d7bc51ce
F test/bestindexC.test 95b4a527b1a5d07951d731604a6d4cf7e5a806b39cea0e7819d4c9667e11c3fc
F test/bestindexD.test 6a8f6f84990bcf17dfa59652a1f935beddb7afd96f8302830fbc86b0a13df3c3
F test/bestindexE.test f0c7105d1e7facaa8f5e6c498849cc6dcadd533b35ea9e5e1176e54a9a2d70f1
F test/between.test e7587149796101cbe8d5f8abae8d2a7b87f04d8226610aa1091615005dcf4d54
F test/bigfile.test aa74f4e5db51c8e54a1d9de9fa65d01d1eb20b59
F test/bigfile2.test 1b489a3a39ae90c7f027b79110d6b4e1dbc71bfc
@@ -1146,6 +1147,7 @@ F test/fts3am.test 218aa6ba0dfc50c7c16b2022aac5c6be593d08d8
F test/fts3an.test a49ccadc07a2f7d646ec1b81bc09da2d85a85b18
F test/fts3ao.test 266989148fec6d9f1bb6c5382f7aa3dcea0e9cd444576e28dd2b9287ac7dd220
F test/fts3atoken.test dc2078ce464914efe3a8dfc545dd034a0fc14f2ab425c240471d5a5f1c721400
F test/fts3atoken2.test aa6664d26277064844ead962f5988c28b091c51b112f36d30fa33bd83fecf906
F test/fts3auto.test 649aa4c198d7acc5cd6355e19ee073d051c40d9e88a43fc3d88af46bdf3e99d5
F test/fts3aux1.test 1880eaa75c586cd10f53080479a2b819b3915ae7ce55c4e0ba8f1fe05ac0a6a7
F test/fts3aux2.test 2459e7fa3e22734aed237d1e2ae192f5541c4d8b218956ad2d90754977bf907f
@@ -1525,7 +1527,7 @@ F test/recover.test c76d05f33f0271fba0f0752170e03b0ab5952dc61dcea7ab3ba40df03c4c
F test/regexp1.test 8f2a8bc1569666e29a4cee6c1a666cd224eb6d50e2470d1dc1df995170f3e0f1
F test/regexp2.test 55ed41da802b0e284ac7e2fe944be3948f93ff25abbca0361a609acfed1368b5
F test/reindex.test cd9d6021729910ece82267b4f5e1b5ac2911a7566c43b43c176a6a4732e2118d
F test/reservebytes.test 7040eb21db538e7ae57b5919727e95ddae0195e7471830ad0036aedf05cc49fd
F test/reservebytes.test 6163640b5a5120c0dee6591481e673a0fa0bf0d12d4da7513bad692c1a49a162
F test/resetdb.test 54c06f18bc832ac6d6319e5ab23d5c8dd49fdbeec7c696d791682a8006bd5fc3
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
F test/returning1.test 212cd4111bb941a60abf608f20250db666c21eb1bc4d49217e96c87ff3ab9d1a
@@ -1976,6 +1978,7 @@ F test/wal_common.tcl 204d1721ac13c5e0c7fae6380315b5ab7f4e8423f580d826c5e9df1995
F test/walbak.test 018d4e5a3d45c6298d11b99f09a8ef6876527946
F test/walbig.test f437473a16cfb314867c6b5d1dbcd519e73e3434
F test/walblock.test 6bb472e82730e7e4e81395e907a01d8cfc2bd9e1f01f8a9184ca572e2955a4bf
F test/walckptnoop.test 5d40e7959a6ef4bdc7aaf773f86c8f210e2a1e6d0ca5c9ad1389311665741bef
F test/walcksum.test 50e204500eed9c691b6045e467bb2923f49aa93d8adf315e2be135fdb202c1c2
F test/walcrash.test 21038858cc552077b0522f50b0fa87e38139306a
F test/walcrash2.test a0edab4e5390f03b99a790de89aad15d6ec70b36
@@ -2114,7 +2117,7 @@ F tool/logest.c c34e5944318415de513d29a6098df247a9618c96d83c38d4abd88641fe46e669
F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439
F tool/merge-test.tcl de76b62f2de2a92d4c1ca4f976bce0aea6899e0229e250479b229b2a1914b176
F tool/mkamalzip.tcl 8aa5ebe7973c8b8774062d34e15fea9815c4cc2ceea3a9b184695f005910876a
F tool/mkautoconfamal.sh cf72166369d9d1df9df1ae9fcad03a7939808d7273784b56fd78b913587637a1
F tool/mkautoconfamal.sh 647dada5e34c466bef62a4408e1c99a7e5e1922805479dd57944f33f9803f2f8
F tool/mkccode.tcl c42a8f8cf78f92e83795d5447460dbce7aaf78a3bbf9082f1507dc71a3665f3c x
F tool/mkctimec.tcl 11c9eda4a8d18c74b79280b30506d832849fd1855e6d9e95e1fd506f1d211c37 x
F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559
@@ -2127,7 +2130,7 @@ F tool/mkshellc.tcl bab0a72a68384181a5706712dfdf6815f6526446d4e8aacace2de5e80cda
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
F tool/mksqlite3c-noext.tcl 351c55256213154cabb051a3c870ef9f4487de905015141ae50dc7578a901b84
F tool/mksqlite3c.tcl f11b63445c4840509248bd4aa151a81aea25d5415fef71943c8d436eba4f3b3c
F tool/mksqlite3h.tcl 989948c6a26e188e673d7c2f2f093ea3acd816ad6ac65bab596280075c8f3a45
F tool/mksqlite3h.tcl 7b8de72c29b17b338acde81c389f3af04bf34fd25e96c5f29743d1dd285ed49e
F tool/mksqlite3internalh.tcl 46ef6ed6ccd3c36e23051109dd25085d8edef3887635cea25afa81c4adf4d4db
F tool/mksrczip.tcl 81efd9974dbb36005383f2cd655520057a2ae5aa85ac2441a80c7c28f803ac52
F tool/mktoolzip.tcl c9f388b2b0751982aef29a0c1d80f7959dbe38065ebb4421c39844e92622b086
@@ -2153,7 +2156,7 @@ F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d
F tool/split-sqlite3c.tcl 4969fd642dad0ea483e4e104163021d92baf98f6a8eac981fe48525f9b873430
F tool/sqldiff.c 134be7866be19f8beb32043d5aea5657f01aaeae2df8d33d758ff722c78666b9
F tool/sqlite3_analyzer.c.in 14f02cb5ec3c264cd6107d1f1dad77092b1cf440fc196c30b69ae87b56a1a43b
F tool/sqlite3_rsync.c 0a47e601bdca0d300cbd53834bc59848b787bf3bfe3099b4eb27d08c81d571db
F tool/sqlite3_rsync.c d0e58a1e49fe2192c3ee0b697aed182d502bebfe5b4b406ba6b2baa52a04ecbe
F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898
F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848
F tool/src-verify.c 6c655d9a8d6b30f3648fc78a79bf3838ed68f8543869d380c43ea9f17b3b8501
@@ -2171,8 +2174,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 64c802ca1057ba538d9132ddcdda40f9452c80fac8ec1468661c34174c65db7f
R bb6ccca120a51cf92d1112a6136bf4a8
U stephan
Z 8a9eb4a5089b199530be54b854c32f89
P ed36b3aa4b68c6bb347b6851ea61bcad9712c4a9ed39e3fb4f84cb9b9ee48dc2
R e746890c0ffada398be86dcbb8bb6216
U drh
Z 649b29c859d66a30049be3851479ddc7
# Remove this line to create a well-formed Fossil manifest.
+2
View File
@@ -0,0 +1,2 @@
branch sqlite3-set-errmsg
tag sqlite3-set-errmsg
+1 -1
View File
@@ -1 +1 @@
404bf0d76ce01d07046cf1fa42b45a72e3b62e292e0fa3c0c4d75beb4a4d6885
93a41e31322eec70476f7d81f4af7fb8476cad21a56d6b1048a9e0c0c440bf72
+6 -6
View File
@@ -46,7 +46,7 @@ typedef struct DbpageCursor DbpageCursor;
struct DbpageCursor {
sqlite3_vtab_cursor base; /* Base class. Must be first */
int pgno; /* Current page number */
Pgno pgno; /* Current page number */
int mxPgno; /* Last page to visit on this scan */
Pager *pPager; /* Pager being read/written */
DbPage *pPage1; /* Page 1 of the database */
@@ -184,7 +184,7 @@ static int dbpageOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
}else{
memset(pCsr, 0, sizeof(DbpageCursor));
pCsr->base.pVtab = pVTab;
pCsr->pgno = -1;
pCsr->pgno = 0;
}
*ppCursor = (sqlite3_vtab_cursor *)pCsr;
@@ -284,12 +284,12 @@ static int dbpageColumn(
int rc = SQLITE_OK;
switch( i ){
case 0: { /* pgno */
sqlite3_result_int(ctx, pCsr->pgno);
sqlite3_result_int64(ctx, (sqlite3_int64)pCsr->pgno);
break;
}
case 1: { /* data */
DbPage *pDbPage = 0;
if( pCsr->pgno==((PENDING_BYTE/pCsr->szPage)+1) ){
if( pCsr->pgno==(Pgno)((PENDING_BYTE/pCsr->szPage)+1) ){
/* The pending byte page. Assume it is zeroed out. Attempting to
** request this page from the page is an SQLITE_CORRUPT error. */
sqlite3_result_zeroblob(ctx, pCsr->szPage);
@@ -363,10 +363,10 @@ static int dbpageUpdate(
goto update_fail;
}
if( sqlite3_value_type(argv[0])==SQLITE_NULL ){
pgno = (Pgno)sqlite3_value_int(argv[2]);
pgno = (Pgno)sqlite3_value_int64(argv[2]);
isInsert = 1;
}else{
pgno = sqlite3_value_int(argv[0]);
pgno = (Pgno)sqlite3_value_int64(argv[0]);
if( (Pgno)sqlite3_value_int(argv[1])!=pgno ){
zErr = "cannot insert";
goto update_fail;
+23
View File
@@ -2716,6 +2716,29 @@ const char *sqlite3_errmsg(sqlite3 *db){
return z;
}
/*
** Set the error code and error message associated with the database handle.
**
** This routine is intended to be called by outside extensions (ex: the
** Session extension). Internal logic should invoke sqlite3Error() or
** sqlite3ErrorWithMsg() directly.
*/
int sqlite3_set_errmsg(sqlite3 *db, int errcode, const char *zMsg){
int rc = SQLITE_OK;
if( !sqlite3SafetyCheckSickOrOk(db) ){
return SQLITE_MISUSE_BKPT;
}
sqlite3_mutex_enter(db->mutex);
if( zMsg ){
sqlite3ErrorWithMsg(db, errcode, "%s", zMsg);
}else{
sqlite3Error(db, errcode);
}
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(db->mutex);
return rc;
}
/*
** Return the byte offset of the most recent error
*/
+73 -24
View File
@@ -760,9 +760,8 @@ static int robust_open(const char *z, int f, mode_t m){
/*
** Helper functions to obtain and relinquish the global mutex. The
** global mutex is used to protect the unixInodeInfo and
** vxworksFileId objects used by this file, all of which may be
** shared by multiple threads.
** global mutex is used to protect the unixInodeInfo objects used by
** this file, all of which may be shared by multiple threads.
**
** Function unixMutexHeld() is used to assert() that the global mutex
** is held when required. This function is only used as part of assert()
@@ -964,6 +963,7 @@ struct vxworksFileId {
** variable:
*/
static struct vxworksFileId *vxworksFileList = 0;
static sqlite3_mutex *vxworksMutex = 0;
/*
** Simplify a filename into its canonical form
@@ -1029,14 +1029,14 @@ static struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){
** If found, increment the reference count and return a pointer to
** the existing file ID.
*/
unixEnterMutex();
sqlite3_mutex_enter(vxworksMutex);
for(pCandidate=vxworksFileList; pCandidate; pCandidate=pCandidate->pNext){
if( pCandidate->nName==n
&& memcmp(pCandidate->zCanonicalName, pNew->zCanonicalName, n)==0
){
sqlite3_free(pNew);
pCandidate->nRef++;
unixLeaveMutex();
sqlite3_mutex_leave(vxworksMutex);
return pCandidate;
}
}
@@ -1046,7 +1046,7 @@ static struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){
pNew->nName = n;
pNew->pNext = vxworksFileList;
vxworksFileList = pNew;
unixLeaveMutex();
sqlite3_mutex_leave(vxworksMutex);
return pNew;
}
@@ -1055,7 +1055,7 @@ static struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){
** the object when the reference count reaches zero.
*/
static void vxworksReleaseFileId(struct vxworksFileId *pId){
unixEnterMutex();
sqlite3_mutex_enter(vxworksMutex);
assert( pId->nRef>0 );
pId->nRef--;
if( pId->nRef==0 ){
@@ -1065,7 +1065,7 @@ static void vxworksReleaseFileId(struct vxworksFileId *pId){
*pp = pId->pNext;
sqlite3_free(pId);
}
unixLeaveMutex();
sqlite3_mutex_leave(vxworksMutex);
}
#endif /* OS_VXWORKS */
/*************** End of Unique File ID Utility Used By VxWorks ****************
@@ -1626,18 +1626,42 @@ static int osSetPosixAdvisoryLock(
struct flock *pLock, /* The description of the lock */
unixFile *pFile /* Structure holding timeout value */
){
int tm = pFile->iBusyTimeout;
int rc = osFcntl(h,F_SETLK,pLock);
while( rc<0 && tm>0 ){
/* On systems that support some kind of blocking file lock with a timeout,
** make appropriate changes here to invoke that blocking file lock. On
** generic posix, however, there is no such API. So we simply try the
** lock once every millisecond until either the timeout expires, or until
** the lock is obtained. */
unixSleep(0,1000);
int rc = 0;
if( pFile->iBusyTimeout==0 ){
/* unixFile->iBusyTimeout is set to 0. In this case, attempt a
** non-blocking lock. */
rc = osFcntl(h,F_SETLK,pLock);
tm--;
}else{
/* unixFile->iBusyTimeout is set to greater than zero. In this case,
** attempt a blocking-lock with a unixFile->iBusyTimeout ms timeout.
**
** On systems that support some kind of blocking file lock operation,
** this block should be replaced by code to attempt a blocking lock
** with a timeout of unixFile->iBusyTimeout ms. The code below is
** placeholder code. If SQLITE_TEST is defined, the placeholder code
** retries the lock once every 1ms until it succeeds or the timeout
** is reached. Or, if SQLITE_TEST is not defined, the placeholder
** code attempts a non-blocking lock and sets unixFile->iBusyTimeout
** to 0. This causes the caller to return SQLITE_BUSY, instead of
** SQLITE_BUSY_TIMEOUT to SQLite - as required by a VFS that does not
** support blocking locks.
*/
#ifdef SQLITE_TEST
int tm = pFile->iBusyTimeout;
while( tm>0 ){
rc = osFcntl(h,F_SETLK,pLock);
if( rc==0 ) break;
unixSleep(0,1000);
tm--;
}
#else
rc = osFcntl(h,F_SETLK,pLock);
pFile->iBusyTimeout = 0;
#endif
/* End of code to replace with real blocking-locks code. */
}
return rc;
}
#endif /* SQLITE_ENABLE_SETLK_TIMEOUT */
@@ -5958,10 +5982,17 @@ static int fillInUnixFile(
storeLastErrno(pNew, 0);
#if OS_VXWORKS
if( rc!=SQLITE_OK ){
if( h>=0 ) robust_close(pNew, h, __LINE__);
h = -1;
osUnlink(zFilename);
pNew->ctrlFlags |= UNIXFILE_DELETE;
if( h>=0 ){
robust_close(pNew, h, __LINE__);
h = -1;
}
if( pNew->ctrlFlags & UNIXFILE_DELETE ){
osUnlink(zFilename);
}
if( pNew->pId ){
vxworksReleaseFileId(pNew->pId);
pNew->pId = 0;
}
}
#endif
if( rc!=SQLITE_OK ){
@@ -6005,6 +6036,9 @@ static const char *unixTempFileDir(void){
while(1){
if( zDir!=0
#if OS_VXWORKS
&& zDir[0]=='/'
#endif
&& osStat(zDir, &buf)==0
&& S_ISDIR(buf.st_mode)
&& osAccess(zDir, 03)==0
@@ -6319,6 +6353,12 @@ static int unixOpen(
|| eType==SQLITE_OPEN_TRANSIENT_DB || eType==SQLITE_OPEN_WAL
);
#if OS_VXWORKS
/* The file-ID mechanism used in Vxworks requires that all pathnames
** provided to unixOpen must be absolute pathnames. */
if( zPath!=0 && zPath[0]!='/' ){ return SQLITE_CANTOPEN; }
#endif
/* Detect a pid change and reset the PRNG. There is a race condition
** here such that two or more threads all trying to open databases at
** the same instant might all reset the PRNG. But multiple resets
@@ -6519,8 +6559,11 @@ static int unixOpen(
}
#endif
assert( zPath==0 || zPath[0]=='/'
|| eType==SQLITE_OPEN_SUPER_JOURNAL || eType==SQLITE_OPEN_MAIN_JOURNAL
assert( zPath==0
|| zPath[0]=='/'
|| eType==SQLITE_OPEN_SUPER_JOURNAL
|| eType==SQLITE_OPEN_MAIN_JOURNAL
|| eType==SQLITE_OPEN_TEMP_JOURNAL
);
rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
@@ -8249,6 +8292,9 @@ int sqlite3_os_init(void){
sqlite3KvvfsInit();
#endif
unixBigLock = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
#if OS_VXWORKS
vxworksMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS2);
#endif
#ifndef SQLITE_OMIT_WAL
/* Validate lock assumptions */
@@ -8283,6 +8329,9 @@ int sqlite3_os_init(void){
*/
int sqlite3_os_end(void){
unixBigLock = 0;
#if OS_VXWORKS
vxworksMutex = 0;
#endif
return SQLITE_OK;
}
+1 -1
View File
@@ -7512,7 +7512,7 @@ int sqlite3PagerCheckpoint(
}
if( pPager->pWal ){
rc = sqlite3WalCheckpoint(pPager->pWal, db, eMode,
(eMode==SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler),
(eMode<=SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler),
pPager->pBusyHandlerArg,
pPager->walSyncFlags, pPager->pageSize, (u8 *)pPager->pTmpSpace,
pnLog, pnCkpt
+2
View File
@@ -2372,6 +2372,8 @@ void sqlite3Pragma(
eMode = SQLITE_CHECKPOINT_RESTART;
}else if( sqlite3StrICmp(zRight, "truncate")==0 ){
eMode = SQLITE_CHECKPOINT_TRUNCATE;
}else if( sqlite3StrICmp(zRight, "noop")==0 ){
eMode = SQLITE_CHECKPOINT_NOOP;
}
}
pParse->nMem = 3;
+34 -5
View File
@@ -274,7 +274,7 @@ static int cli_strncmp(const char *a, const char *b, size_t n){
** Unix epoch (1970-01-01T00:00:00Z)
*/
static sqlite3_int64 timeOfDay(void){
#if defined(_WIN32)
#if defined(_WIN64)
sqlite3_uint64 t;
FILETIME tm;
GetSystemTimePreciseAsFileTime(&tm);
@@ -282,6 +282,19 @@ static sqlite3_int64 timeOfDay(void){
t += 116444736000000000LL;
t /= 10;
return t;
#elif defined(_WIN32)
static sqlite3_vfs *clockVfs = 0;
sqlite3_int64 t;
if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0);
if( clockVfs==0 ) return 0; /* Never actually happens */
if( clockVfs->iVersion>=2 && clockVfs->xCurrentTimeInt64!=0 ){
clockVfs->xCurrentTimeInt64(clockVfs, &t);
}else{
double r;
clockVfs->xCurrentTime(clockVfs, &r);
t = (sqlite3_int64)(r*86400000.0);
}
return t*1000;
#else
struct timeval sNow;
(void)gettimeofday(&sNow,0);
@@ -331,7 +344,7 @@ static void endTimer(FILE *out){
sqlite3_int64 iEnd = timeOfDay();
struct rusage sEnd;
getrusage(RUSAGE_SELF, &sEnd);
sqlite3_fprintf(out, "Run Time: real %.6f user %f sys %f\n",
sqlite3_fprintf(out, "Run Time: real %.6f user %.6f sys %.6f\n",
(iEnd - iBegin)*0.000001,
timeDiff(&sBegin.ru_utime, &sEnd.ru_utime),
timeDiff(&sBegin.ru_stime, &sEnd.ru_stime));
@@ -410,10 +423,19 @@ static void endTimer(FILE *out){
FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd;
sqlite3_int64 ftWallEnd = timeOfDay();
getProcessTimesAddr(hProcess,&ftCreation,&ftExit,&ftKernelEnd,&ftUserEnd);
#ifdef _WIN64
/* microsecond precision on 64-bit windows */
sqlite3_fprintf(out, "Run Time: real %.6f user %f sys %f\n",
(ftWallEnd - ftWallBegin)*0.000001,
timeDiff(&ftUserBegin, &ftUserEnd),
timeDiff(&ftKernelBegin, &ftKernelEnd));
#else
/* millisecond precisino on 32-bit windows */
sqlite3_fprintf(out, "Run Time: real %.3f user %.3f sys %.3f\n",
(ftWallEnd - ftWallBegin)*0.000001,
timeDiff(&ftUserBegin, &ftUserEnd),
timeDiff(&ftKernelBegin, &ftKernelEnd));
#endif
}
}
@@ -950,7 +972,7 @@ static FILE * openChrSource(const char *zFile){
** This routine reads a line of text from FILE in, stores
** the text in memory obtained from malloc() and returns a pointer
** to the text. NULL is returned at end of file, or if malloc()
** fails.
** fails, or if the length of the line is longer than about a gigabyte.
**
** If zLine is not NULL then it is a malloced buffer returned from
** a previous call to this routine that may be reused.
@@ -961,6 +983,10 @@ static char *local_getline(char *zLine, FILE *in){
while( 1 ){
if( n+100>nLine ){
if( nLine>=1073741773 ){
free(zLine);
return 0;
}
nLine = nLine*2 + 100;
zLine = realloc(zLine, nLine);
shell_check_oom(zLine);
@@ -6707,10 +6733,13 @@ static int db_int(sqlite3 *db, const char *zSql, ...){
** Convert a 2-byte or 4-byte big-endian integer into a native integer
*/
static unsigned int get2byteInt(unsigned char *a){
return (a[0]<<8) + a[1];
return ((unsigned int)a[0]<<8) + (unsigned int)a[1];
}
static unsigned int get4byteInt(unsigned char *a){
return (a[0]<<24) + (a[1]<<16) + (a[2]<<8) + a[3];
return ((unsigned int)a[0]<<24)
+ ((unsigned int)a[1]<<16)
+ ((unsigned int)a[2]<<8)
+ (unsigned int)a[3];
}
/*
+86 -32
View File
@@ -149,6 +149,9 @@ extern "C" {
#define SQLITE_VERSION "--VERS--"
#define SQLITE_VERSION_NUMBER --VERSION-NUMBER--
#define SQLITE_SOURCE_ID "--SOURCE-ID--"
#define SQLITE_SCM_BRANCH "--SCM-BRANCH--"
#define SQLITE_SCM_TAGS "--SCM-TAGS--"
#define SQLITE_SCM_DATETIME "--SCM-DATETIME--"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -2340,17 +2343,20 @@ struct sqlite3_mem_methods {
**
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
** <dd> ^This option is used to enable or disable the
** [fts3_tokenizer()] function which is part of the
** [FTS3] full-text search engine extension.
** There must be two additional arguments.
** The first argument is an integer which is 0 to disable fts3_tokenizer() or
** positive to enable fts3_tokenizer() or negative to leave the setting
** unchanged.
** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled
** following this call. The second parameter may be a NULL pointer, in
** which case the new setting is not reported back. </dd>
** <dd> ^This option is used to enable or disable using the
** [fts3_tokenizer()] function - part of the [FTS3] full-text search engine
** extension - without using bound parameters as the parameters. Doing so
** is disabled by default. There must be two additional arguments. The first
** argument is an integer. If it is passed 0, then using fts3_tokenizer()
** without bound parameters is disabled. If it is passed a positive value,
** then calling fts3_tokenizer without bound parameters is enabled. If it
** is passed a negative value, this setting is not modified - this can be
** used to query for the current setting. The second parameter is a pointer
** to an integer into which is written 0 or 1 to indicate the current value
** of this setting (after it is modified, if applicable). The second
** parameter may be a NULL pointer, in which case the value of the setting
** is not reported back. Refer to [FTS3] documentation for further details.
** </dd>
**
** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]]
** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt>
@@ -4200,6 +4206,34 @@ const void *sqlite3_errmsg16(sqlite3*);
const char *sqlite3_errstr(int);
int sqlite3_error_offset(sqlite3 *db);
/*
** CAPI3REF: Set Error Codes And Message
** METHOD: sqlite3
**
** Set the error code of the database handle passed as the first argument
** to errcode, and the error message to a copy of nul-terminated string
** zErrMsg. If zErrMsg is passed NULL, then the error message is set to
** the default message associated with the supplied error code. Subsequent
** calls to [sqlite3_errcode()] and [sqlite3_errmsg()] and similar will
** return the values set by this routine in place of what was previously
** set by SQLite itself.
**
** This function returns SQLITE_OK if the error code and error message are
** successfully set, SQLITE_NOMEM if an OOM occurs, and SQLITE_MISUSE if
** the database handle is NULL or invalid.
**
** The error code and message set by this routine remains in effect until
** they are changed, either by another call to this routine or until they are
** changed to by SQLite itself to reflect the result of some subsquent
** API call.
**
** This function is intended for use by SQLite extensions or wrappers. The
** idea is that an extension or wrapper can use this routine to set error
** messages and error codes and thus behave more like a core SQLite
** feature from the point of view of an application.
*/
int sqlite3_set_errmsg(sqlite3 *db, int errcode, const char *zErrMsg);
/*
** CAPI3REF: Prepared Statement Object
** KEYWORDS: {prepared statement} {prepared statements}
@@ -9782,7 +9816,7 @@ void sqlite3_log(int iErrCode, const char *zFormat, ...);
** is the number of pages currently in the write-ahead log file,
** including those that were just committed.
**
** The callback function should normally return [SQLITE_OK]. ^If an error
** ^The callback function should normally return [SQLITE_OK]. ^If an error
** code is returned, that error will propagate back up through the
** SQLite code base to cause the statement that provoked the callback
** to report an error, though the commit will have still occurred. If the
@@ -9790,13 +9824,26 @@ void sqlite3_log(int iErrCode, const char *zFormat, ...);
** that does not correspond to any valid SQLite error code, the results
** are undefined.
**
** A single database handle may have at most a single write-ahead log callback
** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
** previously registered write-ahead log callback. ^The return value is
** a copy of the third parameter from the previous call, if any, or 0.
** ^Note that the [sqlite3_wal_autocheckpoint()] interface and the
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
** overwrite any prior [sqlite3_wal_hook()] settings.
** ^A single database handle may have at most a single write-ahead log
** callback registered at one time. ^Calling [sqlite3_wal_hook()]
** replaces the default behavior or previously registered write-ahead
** log callback.
**
** ^The return value is a copy of the third parameter from the
** previous call, if any, or 0.
**
** ^The [sqlite3_wal_autocheckpoint()] interface and the
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and
** will overwrite any prior [sqlite3_wal_hook()] settings.
**
** ^If a write-ahead log callback is set using this function then
** [sqlite3_wal_checkpoint_v2()] or [PRAGMA wal_checkpoint]
** should be invoked periodically to keep the write-ahead log file
** from growing without bound.
**
** ^Passing a NULL pointer for the callback disables automatic
** checkpointing entirely. To re-enable the default behavior, call
** sqlite3_wal_autocheckpoint(db,1000) or use [PRAGMA wal_checkpoint].
*/
void *sqlite3_wal_hook(
sqlite3*,
@@ -9813,7 +9860,7 @@ void *sqlite3_wal_hook(
** to automatically [checkpoint]
** after committing a transaction if there are N or
** more frames in the [write-ahead log] file. ^Passing zero or
** a negative value as the nFrame parameter disables automatic
** a negative value as the N parameter disables automatic
** checkpoints entirely.
**
** ^The callback registered by this function replaces any existing callback
@@ -9829,9 +9876,10 @@ void *sqlite3_wal_hook(
**
** ^Every new [database connection] defaults to having the auto-checkpoint
** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
** pages. The use of this interface
** is only necessary if the default setting is found to be suboptimal
** for a particular application.
** pages.
**
** ^The use of this interface is only necessary if the default setting
** is found to be suboptimal for a particular application.
*/
int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
@@ -9896,6 +9944,11 @@ int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
** addition that it also truncates the log file to zero bytes just prior
** to a successful return.
**
** <dt>SQLITE_CHECKPOINT_NOOP<dd>
** ^This mode always checkpoints zero frames. The only reason to invoke
** a NOOP checkpoint is to access the values returned by
** sqlite3_wal_checkpoint_v2() via output parameters *pnLog and *pnCkpt.
** </dl>
**
** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
@@ -9966,6 +10019,7 @@ int sqlite3_wal_checkpoint_v2(
** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
** meaning of each of these checkpoint modes.
*/
#define SQLITE_CHECKPOINT_NOOP -1 /* Do no work at all */
#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for readers */
@@ -10986,15 +11040,15 @@ unsigned char *sqlite3_serialize(
/*
** CAPI3REF: Deserialize a database
**
** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the [database
** connection] D to disconnect from database S and then reopen S as an
** in-memory database based on the serialization contained in P. If S
** is a NULL pointer, the main database is used. The serialized
** database P is N bytes in size. M is the size of the buffer P,
** which might be larger than N. If M is larger than N, and the
** SQLITE_DESERIALIZE_READONLY bit is not set in F, then SQLite is
** permitted to add content to the in-memory database as long as the
** total size does not exceed M bytes.
** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the
** [database connection] D to disconnect from database S and then
** reopen S as an in-memory database based on the serialization
** contained in P. If S is a NULL pointer, the main database is
** used. The serialized database P is N bytes in size. M is the size
** of the buffer P, which might be larger than N. If M is larger than
** N, and the SQLITE_DESERIALIZE_READONLY bit is not set in F, then
** SQLite is permitted to add content to the in-memory database as
** long as the total size does not exceed M bytes.
**
** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will
** invoke sqlite3_free() on the serialization buffer when the database
+4
View File
@@ -368,6 +368,8 @@ struct sqlite3_api_routines {
int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*));
/* Version 3.50.0 and later */
int (*setlk_timeout)(sqlite3*,int,int);
/* Version 3.51.0 and later */
int (*set_errmsg)(sqlite3*,int,const char*);
};
/*
@@ -703,6 +705,8 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_set_clientdata sqlite3_api->set_clientdata
/* Version 3.50.0 and later */
#define sqlite3_setlk_timeout sqlite3_api->setlk_timeout
/* Version 3.51.0 and later */
#define sqlite3_set_errmsg sqlite3_api->set_errmsg
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
-10
View File
@@ -4187,19 +4187,9 @@ int SQLITE_CDECL TCLSH_MAIN(int argc, char **argv){
sqlite3_shutdown();
Tcl_FindExecutable(argv[0]);
#if TCL_MAJOR_VERSION > 8 && (!defined(_WIN32) || defined(UNICODE))
/* Tcl 9.0. Does not work on Windows without UNICODE because it
** requires a WCHAR string for argv[0] here. Also, for
** statically-linked tcl9 this only works if this binary has tcl9's
** main library ZIP file attached to it somehow (and the canonical
** build does not do that). */
TclZipfs_AppHook(&argc, &argv);
#endif
Tcl_SetSystemEncoding(NULL, "utf-8");
interp = Tcl_CreateInterp();
Sqlite3_Init(interp);
Tcl_Init(interp);
sqlite3_snprintf(sizeof(zArgc), zArgc, "%d", argc-1);
Tcl_SetVar(interp,"argc", zArgc, TCL_GLOBAL_ONLY);
+1
View File
@@ -7960,6 +7960,7 @@ case OP_Checkpoint: {
|| pOp->p2==SQLITE_CHECKPOINT_FULL
|| pOp->p2==SQLITE_CHECKPOINT_RESTART
|| pOp->p2==SQLITE_CHECKPOINT_TRUNCATE
|| pOp->p2==SQLITE_CHECKPOINT_NOOP
);
rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]);
if( rc ){
+3 -1
View File
@@ -25,7 +25,9 @@
#define HAVE_UTIME 1
#else
/* This is not VxWorks. */
#define OS_VXWORKS 0
#ifndef OS_VXWORKS
# define OS_VXWORKS 0
#endif
#define HAVE_FCHOWN 1
#define HAVE_READLINK 1
#define HAVE_LSTAT 1
+30 -25
View File
@@ -4297,7 +4297,8 @@ int sqlite3WalCheckpoint(
/* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
** in the SQLITE_CHECKPOINT_PASSIVE mode. */
assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
assert( SQLITE_CHECKPOINT_NOOP<SQLITE_CHECKPOINT_PASSIVE );
assert( eMode>SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );
if( pWal->readOnly ) return SQLITE_READONLY;
WALTRACE(("WAL%p: checkpoint begins\n", pWal));
@@ -4314,31 +4315,35 @@ int sqlite3WalCheckpoint(
** EVIDENCE-OF: R-53820-33897 Even if there is a busy-handler configured,
** it will not be invoked in this case.
*/
rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1);
testcase( rc==SQLITE_BUSY );
testcase( rc!=SQLITE_OK && xBusy2!=0 );
if( rc==SQLITE_OK ){
pWal->ckptLock = 1;
if( eMode!=SQLITE_CHECKPOINT_NOOP ){
rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1);
testcase( rc==SQLITE_BUSY );
testcase( rc!=SQLITE_OK && xBusy2!=0 );
if( rc==SQLITE_OK ){
pWal->ckptLock = 1;
/* IMPLEMENTATION-OF: R-59782-36818 The SQLITE_CHECKPOINT_FULL, RESTART and
** TRUNCATE modes also obtain the exclusive "writer" lock on the database
** file.
**
** EVIDENCE-OF: R-60642-04082 If the writer lock cannot be obtained
** immediately, and a busy-handler is configured, it is invoked and the
** writer lock retried until either the busy-handler returns 0 or the
** lock is successfully obtained.
*/
if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){
rc = walBusyLock(pWal, xBusy2, pBusyArg, WAL_WRITE_LOCK, 1);
if( rc==SQLITE_OK ){
pWal->writeLock = 1;
}else if( rc==SQLITE_BUSY ){
eMode2 = SQLITE_CHECKPOINT_PASSIVE;
xBusy2 = 0;
rc = SQLITE_OK;
/* IMPLEMENTATION-OF: R-59782-36818 The SQLITE_CHECKPOINT_FULL, RESTART
** and TRUNCATE modes also obtain the exclusive "writer" lock on the
** database file.
**
** EVIDENCE-OF: R-60642-04082 If the writer lock cannot be obtained
** immediately, and a busy-handler is configured, it is invoked and the
** writer lock retried until either the busy-handler returns 0 or the
** lock is successfully obtained.
*/
if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){
rc = walBusyLock(pWal, xBusy2, pBusyArg, WAL_WRITE_LOCK, 1);
if( rc==SQLITE_OK ){
pWal->writeLock = 1;
}else if( rc==SQLITE_BUSY ){
eMode2 = SQLITE_CHECKPOINT_PASSIVE;
xBusy2 = 0;
rc = SQLITE_OK;
}
}
}
}else{
rc = SQLITE_OK;
}
@@ -4352,7 +4357,7 @@ int sqlite3WalCheckpoint(
** immediately and do a partial checkpoint if it cannot obtain it. */
walDisableBlocking(pWal);
rc = walIndexReadHdr(pWal, &isChanged);
if( eMode2!=SQLITE_CHECKPOINT_PASSIVE ) (void)walEnableBlocking(pWal);
if( eMode2>SQLITE_CHECKPOINT_PASSIVE ) (void)walEnableBlocking(pWal);
if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){
sqlite3OsUnfetch(pWal->pDbFd, 0, 0);
}
@@ -4362,7 +4367,7 @@ int sqlite3WalCheckpoint(
if( rc==SQLITE_OK ){
if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){
rc = SQLITE_CORRUPT_BKPT;
}else{
}else if( eMode2!=SQLITE_CHECKPOINT_NOOP ){
rc = walCheckpoint(pWal, db, eMode2, xBusy2, pBusyArg, sync_flags,zBuf);
}
+130
View File
@@ -0,0 +1,130 @@
# 2025-09-02
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix bestindex1
ifcapable !vtab {
finish_test
return
}
register_tcl_module db
proc pretty_constraint {lCol cons} {
array set C $cons
set ret ""
if {$C(usable)} {
set OP(eq) =
set ret "[lindex $lCol $C(column)]$OP($C(op))?"
}
return $ret
}
proc vtab_command {zName lCol method args} {
switch -- $method {
xConnect {
return "CREATE TABLE $zName ([join $lCol ,]) "
}
xBestIndex {
set hdl [lindex $args 0]
set conslist [$hdl constraints]
set ret [list]
foreach cons $conslist {
set pretty [pretty_constraint $lCol $cons]
if {$pretty != ""} { lappend ret $pretty }
}
lappend ::xBestIndex "$zName: [join $ret { AND }]"
return "cost 1000 rows 1000 idxnum 555"
}
}
return {}
}
proc do_bestindex_test {tn sql lCons} {
set ::xBestIndex [list]
do_execsql_test $tn.1 $sql
uplevel [list do_test $tn.2 [list set ::xBestIndex] [list {*}$lCons]]
}
proc create_vtab {tname clist} {
set cmd [list vtab_command $tname $clist]
execsql "
CREATE VIRTUAL TABLE $tname USING tcl('$cmd')
"
}
do_test 1.0 {
create_vtab x1 {a b c}
} {}
do_bestindex_test 1.1 {
SELECT * FROM x1 WHERE a=?
} {{x1: a=?}}
do_bestindex_test 1.2 {
SELECT * FROM x1 WHERE a=? AND b=?
} {{x1: a=? AND b=?}}
#--------------------------------------------------------------------------
reset_db
register_tcl_module db
do_test 2.0 {
create_vtab Delivery {id customer}
create_vtab ReturnDelivery {id customer}
create_vtab Customer {oid name}
} {}
do_bestindex_test 2.1 {
SELECT Delivery.ID, Customer.Name
FROM Delivery LEFT JOIN
Customer ON Delivery.Customer = Customer.OID
} {
{Delivery: }
{Customer: oid=?}
}
do_bestindex_test 2.2 {
SELECT * FROM
(
SELECT Delivery.ID, Customer.Name
FROM Delivery LEFT JOIN
Customer ON Delivery.Customer = Customer.OID
UNION
SELECT ReturnDelivery.ID, Customer.Name
FROM ReturnDelivery LEFT JOIN
Customer ON ReturnDelivery.Customer = Customer.OID
)
WHERE ID = 1
} {
{Delivery: id=?}
{Customer: oid=?}
{ReturnDelivery: id=?}
{Customer: oid=?}
}
finish_test
+106
View File
@@ -0,0 +1,106 @@
# 2025 September 5
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#*************************************************************************
# This file implements regression tests for SQLite library. The focus
# of this script is testing the pluggable tokeniser feature of the
# FTS3 module.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# If SQLITE_ENABLE_FTS3 is defined, omit this file.
ifcapable !fts3 {
finish_test
return
}
set ::testprefix fts3atoken2
reset_db
sqlite3_db_config db SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 0
# With ENABLE_FTS3_TOKENIZER set to 0:
#
# * It is not possible to get a pointer to a token implementation
# using single arg fts3_tokenize() unless the name of the tokenizer
# is a bound paramter - function should return NULL.
#
# * But it is possible with a bound parameter.
#
do_execsql_test 1.1.1 {
SELECT typeof( fts3_tokenizer('simple') );
} {null}
set bound "simple"
do_execsql_test 1.1.2 {
SELECT typeof( fts3_tokenizer($bound) );
} {blob}
# With ENABLE_FTS3_TOKENIZER set to 0:
#
# * It is not possible to create a token implementation using anything
# other than a bound parameter.
#
# * But it is possible with a bound parameter.
#
set literal [db one {SELECT quote( fts3_tokenizer($bound) )}]
set blob [db one {SELECT fts3_tokenizer($bound) }]
do_catchsql_test 1.2.1 "
SELECT fts3_tokenizer('mytok', $literal)
" {1 {fts3tokenize disabled}}
do_catchsql_test 1.2.2 {
CREATE VIRTUAL TABLE x1 USING fts3(col, tokenize=mytok);
} {1 {unknown tokenizer: mytok}}
do_catchsql_test 1.2.3 {
SELECT fts3_tokenizer('mytok', $blob)
} {0 {{}}}
do_execsql_test 1.2.4 {
CREATE VIRTUAL TABLE x1 USING fts3(col, tokenize=mytok);
}
# With ENABLE_FTS3_TOKENIZER set to 1:
#
# * It is possible to get a pointer to a token implementation with either
# a bound parameter or a literal.
#
sqlite3_db_config db SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1
set bound "simple"
do_execsql_test 1.3.1 {
SELECT typeof( fts3_tokenizer('simple') );
} {blob}
do_execsql_test 1.3.2 {
SELECT typeof( fts3_tokenizer($bound) );
} {blob}
# With ENABLE_FTS3_TOKENIZER set to 1:
#
# * It is not possible to create a token implementation using either
# a bound parameter or a literal.
#
set literal [db one {SELECT quote( fts3_tokenizer($bound) )}]
set blob [db one {SELECT fts3_tokenizer($bound) }]
do_execsql_test 1.4.1 "
SELECT typeof( fts3_tokenizer('mytok2', $literal) );
" {blob}
do_execsql_test 1.4.2 {
CREATE VIRTUAL TABLE x2 USING fts3(col, tokenize=mytok2);
}
do_execsql_test 1.4.3 {
SELECT typeof( fts3_tokenizer('mytok3', $blob) );
} {blob}
do_execsql_test 1.4.4 {
CREATE VIRTUAL TABLE x3 USING fts3(col, tokenize=mytok3);
}
finish_test
+6 -3
View File
@@ -19,6 +19,7 @@ set testprefix reservebytes
reset_db
file_control_reservebytes db 0
do_execsql_test 1.0 {
CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c);
CREATE INDEX i1 ON t1(b, c);
@@ -29,15 +30,17 @@ do_execsql_test 1.0 {
}
sqlite3 db2 test.db
if {[permutation]=="prepare"} { db2 cache size 0 }
do_execsql_test -db db2 1.1 { PRAGMA integrity_check } {ok}
file_control_reservebytes db 8
do_test 1.2.1 { hexio_read test.db 20 1 } {00}
do_execsql_test -db db2 1.2.2 { PRAGMA integrity_check } {ok}
do_execsql_test 1.3.1 { VACUUM }
do_execsql_test -db db2 1.3.2 { PRAGMA integrity_check } {ok}
do_test 1.3.3 { hexio_read test.db 20 1 } {08}
do_execsql_test 1.3.2 { VACUUM }
do_execsql_test -db db2 1.3.4 { PRAGMA integrity_check } {ok}
do_test 1.3.5 { hexio_read test.db 20 1 } {08}
file_control_reservebytes db 16
do_test 1.4.1 { hexio_read test.db 20 1 } {08}
+83
View File
@@ -0,0 +1,83 @@
# 2025 September 5
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The
# focus of this file is testing the operation of the library in
# "PRAGMA wal_checkpoint = noop" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
source $testdir/wal_common.tcl
set testprefix walckpotnoop
ifcapable !wal {finish_test ; return }
do_execsql_test 1.0 {
CREATE TABLE t1(x INTEGER PRIMARY KEY, y TEXT);
CREATE INDEX i1 ON t1(y);
PRAGMA journal_mode = wal;
WITH s(i) AS (
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000
)
INSERT INTO t1 SELECT NULL, hex(randomblob(64)) FROM s;
} {wal}
do_execsql_test 1.1 {
PRAGMA wal_checkpoint = noop;
} {0 320 0}
do_execsql_test 1.2 {
PRAGMA wal_checkpoint = noop;
} {0 320 0}
do_execsql_test 1.3 {
PRAGMA wal_checkpoint = passive;
} {0 320 320}
do_execsql_test 1.4 {
PRAGMA wal_checkpoint = noop;
} {0 320 320}
db_save_and_close
db_restore_and_reopen
do_execsql_test 1.5 {
PRAGMA wal_checkpoint = noop;
} {0 320 0}
db close
sqlite3 db test.db
do_execsql_test 1.6 {
PRAGMA wal_checkpoint = noop;
} {0 0 0}
do_catchsql_test 1.7 {
BEGIN;
DELETE FROM t1;
PRAGMA wal_checkpoint = noop;
} {1 {database table is locked}}
do_catchsql_test 1.8 {
COMMIT;
PRAGMA wal_checkpoint = noop;
} {0 {0 5 0}}
explain_i {
PRAGMA wal_checkpoint = noop;
}
do_execsql_test 1.9 {
PRAGMA journal_mode = delete;
PRAGMA wal_checkpoint = noop;
} {delete 0 -1 -1}
finish_test
+1 -1
View File
@@ -86,7 +86,7 @@ find . -type f -name '#*#' -exec rm -f \{} \; # emacs lock files
find . -type f -name '*.o' -exec rm -f \{} \;
find . -type f -name '*.so' -exec rm -f \{} \;
./configure && make dist
./configure && ${MAKE-make} dist
tar xzf sqlite-$VERSION.tar.gz
mv sqlite-$VERSION $TARBALLNAME
tar czf $TARBALLNAME.tar.gz $TARBALLNAME
+32 -3
View File
@@ -79,6 +79,13 @@ set nVersion [eval format "%d%03d%03d" [split $zVersion .]]
# Get the source-id
#
proc file-content {fn} {
set fd [open $fn rb]
set rv [string trim [read $fd]]
close $fd
return $rv
}
set PWD [pwd]
cd $TOP
set tmpfile $PWD/tmp-[clock millisec]-[expr {int(rand()*100000000000)}].txt
@@ -89,12 +96,31 @@ if {![file exists $mksourceid] && [file exists ${mksourceid}.exe]} {
set mksourceid ${mksourceid}.exe
}
exec $mksourceid manifest > $tmpfile
set fd [open $tmpfile rb]
set zSourceId [string trim [read $fd]]
close $fd
set zSourceId [file-content $tmpfile]
file delete -force $tmpfile
cd $PWD
# Collect SQLITE_SCM_BRANCH, SQLITE_SCM_TAGS, and SQLITE_SCM_DATETIME
set zVerTime [lindex [lindex [split [file-content $TOP/manifest] "\n"] 1] 1]Z; # D-card
if {![file exists $TOP/manifest.tags]} {
puts stderr "WARNING: building sqlite3.h without manifest.tags, which is generated by the SCM."
puts stderr "This means that we cannot record the tag/branch info. We will continue with "
puts stderr "a placeholder value. To remedy this, run the following command from a "
puts stderr "check-out:\n"
puts stderr " fossil set manifest urt\n"
set zSourceId [string range $zSourceId 1 end-13]-experimental; # Keep SHA3 hash length
set zBranch "unknown"
set zTags "unknown"
} else {
# Read the list of branch/tags from manifest.tags
set content [file-content $TOP/manifest.tags];
set zTags {}
foreach {x tag} [lassign $content - zBranch] {
if {$tag eq $zBranch} continue
lappend zTags $tag
}
}
# Set up patterns for recognizing API declarations.
#
set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+sqlite3_[_a-zA-Z0-9]+(\[|;| =)}
@@ -157,6 +183,9 @@ foreach file $filelist {
regsub -- --VERS-- $line $zVersion line
regsub -- --VERSION-NUMBER-- $line $nVersion line
regsub -- --SOURCE-ID-- $line "$zSourceId" line
regsub -- --SCM-BRANCH-- $line "$zBranch" line
regsub -- --SCM-TAGS-- $line "$zTags" line
regsub -- --SCM-DATETIME-- $line "$zVerTime" line
if {[regexp $varpattern $line] && ![regexp {^ *typedef} $line]} {
set line "SQLITE_API $line"
+1 -1
View File
@@ -1854,7 +1854,7 @@ static void replicaSide(SQLiteRsync *p){
nRPage);
}else{
runSql(p,"INSERT INTO sendHash VALUES(1,1)");
subdivideHashRange(p, 2, nRPage);
subdivideHashRange(p, 2, nRPage-1);
}
sendHashMessages(p, 1, 1);
runSql(p, "PRAGMA writable_schema=ON");