Compare commits

..

2 Commits

Author SHA1 Message Date
drh 843418ae70 In the CLI on the ".mode" command, replace the recently added --no-limits option with
"--limits L,C".  And add --sw as an alias for --screenwidth.

FossilOrigin-Name: caefe4c746599b22aec446f3aeb296e53edaf8c54f8ae803381e8c21d5e29ab4
2025-11-24 12:27:18 +00:00
dan 0ec8c56567 Remove the the SQLITE_SYNC_DATAONLY flag from the core on the grounds that it is not currently used by either built-in VFS and is therefore untested.
FossilOrigin-Name: ff2065b533769cbf5278d13d09ffa93a7a0f841b1b59b6be0e5f27e3d1c341d0
2025-11-24 11:22:56 +00:00
84 changed files with 1588 additions and 3369 deletions
+97 -169
View File
@@ -11,8 +11,6 @@
TOP = .
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
#
# Set this non-0 to create and use the SQLite amalgamation file.
#
!IFNDEF USE_AMALGAMATION
@@ -103,6 +101,13 @@ NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
!ENDIF
!ENDIF
# Set this non-0 to use the library paths and other options necessary for
# Windows Phone 8.1.
#
!IFNDEF USE_WP81_OPTS
USE_WP81_OPTS = 0
!ENDIF
# Set this non-0 to split the SQLite amalgamation file into chunks to
# be used for debugging with Visual Studio.
#
@@ -111,8 +116,14 @@ SPLIT_AMALGAMATION = 0
!ENDIF
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
# Set this non-0 to have this makefile assume the Tcl shell executable
# (tclsh*.exe) is available in the PATH. By default, this is disabled
# for compatibility with older build environments. This setting only
# applies if TCLSH_CMD is not set manually.
#
!IFNDEF USE_TCLSH_IN_PATH
USE_TCLSH_IN_PATH = 0
!ENDIF
# Set this non-0 to use zlib, possibly compiling it from source code.
#
@@ -175,6 +186,14 @@ USE_NATIVE_LIBPATHS = 0
USE_RC = 1
!ENDIF
# Set this non-0 to compile binaries suitable for the WinRT environment.
# This setting does not apply to any binaries that require Tcl to operate
# properly (i.e. the text fixture, etc).
#
!IFNDEF FOR_WINRT
FOR_WINRT = 0
!ENDIF
# Set this non-0 to compile binaries suitable for the UWP environment.
# This setting does not apply to any binaries that require Tcl to operate
# properly (i.e. the text fixture, etc).
@@ -190,8 +209,6 @@ FOR_WIN10 = 0
!ENDIF
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
#
# Set this non-0 to skip attempting to look for and/or link with the Tcl
# runtime library.
#
@@ -248,8 +265,6 @@ DEBUG = 0
!ENDIF
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
#
# By default, use --linemacros=1 argument to the mksqlite3c.tcl tool, which
# is used to build the amalgamation. This can be turned off to ease debug
# of the amalgamation away from the source tree.
@@ -345,8 +360,6 @@ SQLITE3EXEPDB = /pdb:sqlite3sh.pdb
!ENDIF
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
#
# These are the names of the customized Tcl header files used by various parts
# of this makefile when the stdcall calling convention is in use. It is not
# used for any other purpose.
@@ -628,24 +641,16 @@ RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src $(RCOPTS) $(RCCOPTS)
!IF "$(PLATFORM)"=="x86"
CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
#
TEST_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl
# <</mark>>
!ELSE
!IFNDEF PLATFORM
CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
#
TEST_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall -DINCLUDE_SQLITE_TCL_H=1 -DSQLITE_TCLAPI=__cdecl
# <</mark>>
!ELSE
CORE_CCONV_OPTS =
SHELL_CCONV_OPTS =
@@ -772,6 +777,18 @@ SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
TCC = $(TCC) -FAcs
!ENDIF
# When compiling the library for use in the WinRT environment,
# the following compile-time options must be used as well to
# disable use of Win32 APIs that are not available and to enable
# use of Win32 APIs that are specific to Windows 8 and/or WinRT.
#
!IF $(FOR_WINRT)!=0
TCC = $(TCC) -DSQLITE_OS_WINRT=1
RCC = $(RCC) -DSQLITE_OS_WINRT=1
TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
!ENDIF
# C compiler options for the Windows 10 platform (needs MSVC 2015).
#
!IF $(FOR_WIN10)!=0
@@ -784,7 +801,7 @@ BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
# USE_CRT_DLL option is set to force dynamically linking to the
# MSVC runtime library.
#
!IF $(USE_CRT_DLL)!=0
!IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
!IF $(DEBUG)>1
TCC = $(TCC) -MDd
BCC = $(BCC) -MDd
@@ -803,8 +820,6 @@ BCC = $(BCC) -MT
!ENDIF
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
#
# The mksqlite3c.tcl and mksqlite3h.tcl scripts will pull in
# any extension header files by default. For non-amalgamation
# builds, we need to make sure the compiler can find these.
@@ -855,6 +870,16 @@ MKSQLITE3H_ARGS =
!ENDIF
# <</mark>>
# Define -DNDEBUG to compile without debugging (i.e., for production usage)
# Omitting the define will cause extra debugging code to be inserted and
# includes extra comments when "EXPLAIN stmt" is used.
#
!IF $(DEBUG)==0
TCC = $(TCC) -DNDEBUG
BCC = $(BCC) -DNDEBUG
RCC = $(RCC) -DNDEBUG
!ENDIF
!IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
@@ -920,8 +945,6 @@ TCC = $(TCC) /fsanitize=address
!ENDIF
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
#
# The locations of the Tcl header and library files. Also, the library that
# non-stubs enabled programs using Tcl must link against. These variables
# (TCLINCDIR, TCLLIBDIR, and LIBTCL) may be overridden via the environment
@@ -1161,8 +1184,6 @@ BCC = $(BCC) -Zi
!ENDIF
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
#
# If zlib support is enabled, add the compiler options for it.
#
!IF $(USE_ZLIB)!=0
@@ -1215,6 +1236,56 @@ LTLINKOPTS = /NOLOGO
LTLIBOPTS = /NOLOGO
!ENDIF
# When compiling for use in the WinRT environment, the following
# linker option must be used to mark the executable as runnable
# only in the context of an application container.
#
!IF $(FOR_WINRT)!=0
LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
!IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
!IFNDEF STORELIBPATH
!IF "$(PLATFORM)"=="x86"
STORELIBPATH = $(CRTLIBPATH)\store
!ELSEIF "$(PLATFORM)"=="x64"
STORELIBPATH = $(CRTLIBPATH)\store\amd64
!ELSEIF "$(PLATFORM)"=="ARM"
STORELIBPATH = $(CRTLIBPATH)\store\arm
!ELSE
STORELIBPATH = $(CRTLIBPATH)\store
!ENDIF
!ENDIF
STORELIBPATH = $(STORELIBPATH:\\=\)
LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
!ENDIF
!ENDIF
# When compiling for Windows Phone 8.1, an extra library path is
# required.
#
!IF $(USE_WP81_OPTS)!=0
!IFNDEF WP81LIBPATH
!IF "$(PLATFORM)"=="x86"
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
!ELSEIF "$(PLATFORM)"=="ARM"
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
!ELSE
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
!ENDIF
!ENDIF
!ENDIF
# When compiling for Windows Phone 8.1, some extra linker options
# are also required.
#
!IF $(USE_WP81_OPTS)!=0
!IFDEF WP81LIBPATH
LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
!ENDIF
LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
!ENDIF
# When compiling for UWP or the Windows 10 platform, some extra linker
# options are also required.
#
@@ -1238,14 +1309,12 @@ LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
# If either debugging or symbols are enabled, enable PDBs.
#
!IF $(DEBUG)>1 || $(SYMBOLS)!=0
LDFLAGS = /NODEFAULTLIB:msvcrt /DEBUG $(LDOPTS)
LDFLAGS = /DEBUG $(LDOPTS)
!ELSE
LDFLAGS = /NODEFAULTLIB:msvcrt $(LDOPTS)
LDFLAGS = $(LDOPTS)
!ENDIF
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
#
# Start with the Tcl related linker options.
#
!IF $(NO_TCL)==0
@@ -1272,8 +1341,6 @@ LTLIBS = $(LTLIBS) $(LIBICU)
###############################################################################
# <<mark>>
# ^^^^^^^^-- content between mark and /mark omitted from autoconf/Makefile.msc
#
# Object files for the SQLite library (non-amalgamation).
#
LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \
@@ -2597,17 +2664,6 @@ devtest: srctree-check sourcetest
mdevtest:
$(TCLSH_CMD) $(TOP)\test\testrunner.tcl mdevtest
# Show all errors from the most reason testrunner invocation
#
errors:
$(TCLSH_CMD) $(TOP)\test\testrunner.tcl errors
# Show the status of the current testrunner invocation,
# updated every couple of seconds
#
status:
$(TCLSH_CMD) $(TOP)\test\testrunner.tcl status -d 2
# Validate that various generated files in the source tree
# are up-to-date.
#
@@ -2768,134 +2824,6 @@ tcl-env:
@echo JIM_TCLSH = $(JIM_TCLSH)
@echo VISUALSTUDIOVERSION = $(VISUALSTUDIOVERSION)
env:
@echo ALL_TCL_TARGETS = $(ALL_TCL_TARGETS)
@echo API_ARMOR = $(API_ARMOR)
@echo ASAN = $(ASAN)
@echo BCC = $(BCC)
@echo BUILD_ZLIB = $(BUILD_ZLIB)
@echo CC = $(CC)
@echo CCOPTS = $(CCOPTS)
@echo CHECKER_DEPS = $(CHECKER_DEPS)
@echo CORE_CCONV_OPTS = $(CORE_CCONV_OPTS)
@echo CORE_COMPILE_OPTS = $(CORE_COMPILE_OPTS)
@echo CORE_LINK_DEP = $(CORE_LINK_DEP)
@echo CORE_LINK_OPTS = $(CORE_LINK_OPTS)
@echo CRTLIBPATH = $(CRTLIBPATH)
@echo CSC = $(CSC)
@echo DBFUZZ_COMPILE_OPTS = $(DBFUZZ_COMPILE_OPTS)
@echo DEBUG = $(DEBUG)
@echo DYNAMIC_SHELL = $(DYNAMIC_SHELL)
@echo EXT_FEATURE_FLAGS = $(EXT_FEATURE_FLAGS)
@echo EXTHDR = $(EXTHDR)
@echo EXTRA_SRC = $(EXTRA_SRC)
@echo FOR_UWP = $(FOR_UWP)
@echo FUZZCHECK_OPTS = $(FUZZCHECK_OPTS)
@echo FUZZCHECK_SRC = $(FUZZCHECK_SRC)
@echo FUZZDATA = $(FUZZDATA)
@echo FUZZERSHELL_COMPILE_OPTS = $(FUZZERSHELL_COMPILE_OPTS)
@echo HDR = $(HDR)
@echo ICUDIR = $(ICUDIR)
@echo ICUINCDIR = $(ICUINCDIR)
@echo ICULIBDIR = $(ICULIBDIR)
@echo JIM_TCLSH = $(JIM_TCLSH)
@echo KV_COMPILE_OPTS = $(KV_COMPILE_OPTS)
@echo LDFLAGS = $(LDFLAGS)
@echo LD = $(LD)
@echo LIBICU = $(LIBICU)
@echo LIBOBJ = $(LIBOBJ)
@echo LIBREADLINE = $(LIBREADLINE)
@echo LIBRESOBJS = $(LIBRESOBJS)
@echo LIBTCLPATH = $(LIBTCLPATH)
@echo LIBTCLSTUB = $(LIBTCLSTUB)
@echo LIBTCL = $(LIBTCL)
@echo LTCOMPILE = $(LTCOMPILE)
@echo LTLIB = $(LTLIB)
@echo LTLIBOPTS = $(LTLIBOPTS)
@echo LTLIBPATHS = $(LTLIBPATHS)
@echo LTLIBS = $(LTLIBS)
@echo LTLINK = $(LTLINK)
@echo LTLINKOPTS = $(LTLINKOPTS)
@echo LTRCOMPILE = $(LTRCOMPILE)
@echo MEMDEBUG = $(MEMDEBUG)
@echo MINIMAL_AMALGAMATION = $(MINIMAL_AMALGAMATION)
@echo MPTESTER_COMPILE_OPTS = $(MPTESTER_COMPILE_OPTS)
@echo NCC = $(NCC)
@echo NCRTLIBPATH = $(NCRTLIBPATH)
@echo NLTLIBPATHS = $(NLTLIBPATHS)
@echo NO_LINEMACROS = $(NO_LINEMACROS)
@echo NO_TCL = $(NO_TCL)
@echo NO_WARN = $(NO_WARN)
@echo NSDKLIBPATH = $(NSDKLIBPATH)
@echo NUCRTLIBPATH = $(NUCRTLIBPATH)
@echo OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS)
@echo OPTIMIZATIONS = $(OPTIMIZATIONS)
@echo OSSSHELL_SRC = $(OSSSHELL_SRC)
@echo OSTRACE = $(OSTRACE)
@echo RBU = $(RBU)
@echo RCC = $(RCC)
@echo RC = $(RC)
@echo READLINE_FLAGS = $(READLINE_FLAGS)
@echo REQ_FEATURE_FLAGS = $(REQ_FEATURE_FLAGS)
@echo RSYNC_OPT = $(RSYNC_OPT)
@echo RSYNC_SRC = $(RSYNC_SRC)
@echo SESSION = $(SESSION)
@echo SETLK_TIMEOUT = $(SETLK_TIMEOUT)
@echo SHELL_CCONV_OPTS = $(SHELL_CCONV_OPTS)
@echo SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS)
@echo SHELL_CORE_DEP = $(SHELL_CORE_DEP)
@echo SHELL_CORE_LIB = $(SHELL_CORE_LIB)
@echo SHELL_CORE_SRC = $(SHELL_CORE_SRC)
@echo SHELL_DEP = $(SHELL_DEP)
@echo SHELL_LINK_OPTS = $(SHELL_LINK_OPTS)
@echo SPLIT_AMALGAMATION = $(SPLIT_AMALGAMATION)
@echo SQLITETCLDECLSH = $(SQLITETCLDECLSH)
@echo SQLITE_TCL_DEP = $(SQLITE_TCL_DEP)
@echo SQLITETCLH = $(SQLITETCLH)
@echo SRC = $(SRC)
@echo STATICALLY_LINK_TCL = $(STATICALLY_LINK_TCL)
@echo ST_COMPILE_OPTS = $(ST_COMPILE_OPTS)
@echo STORELIBPATH = $(STORELIBPATH)
@echo SYMBOLS = $(SYMBOLS)
@echo TCC = $(TCC)
@echo TCLDIR = $(TCLDIR)
@echo TCLINCDIR = $(TCLINCDIR)
@echo TCLLIBDIR = $(TCLLIBDIR)
@echo TCLLIBPATHS = $(TCLLIBPATHS)
@echo TCLLIBS = $(TCLLIBS)
@echo TCLSH_CMD = $(TCLSH_CMD)
@echo TCLSQLITEEX = $(TCLSQLITEEX)
@echo TCLSUFFIX = $(TCLSUFFIX)
@echo TCLVERSION = $(TCLVERSION)
@echo TEST_CCONV_OPTS = $(TEST_CCONV_OPTS)
@echo TESTEXT = $(TESTEXT)
@echo TESTFIXTURE_DEP = $(TESTFIXTURE_DEP)
@echo TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS)
@echo TESTFIXTURE_SRC = $(TESTFIXTURE_SRC)
@echo TESTOPTS = $(TESTOPTS)
@echo TESTPROGS = $(TESTPROGS)
@echo TESTSRC = $(TESTSRC)
@echo TLIBS = $(TLIBS)
@echo TOP = $(TOP)
@echo UCRTLIBPATH = $(UCRTLIBPATH)
@echo USE_AMALGAMATION = $(USE_AMALGAMATION)
@echo USE_CRT_DLL = $(USE_CRT_DLL)
@echo USE_FATAL_WARN = $(USE_FATAL_WARN)
@echo USE_FULLWARN = $(USE_FULLWARN)
@echo USE_ICU = $(USE_ICU)
@echo USE_LISTINGS = $(USE_LISTINGS)
@echo USE_NATIVE_LIBPATHS = $(USE_NATIVE_LIBPATHS)
@echo USE_RC = $(USE_RC)
@echo USE_RUNTIME_CHECKS = $(USE_RUNTIME_CHECKS)
@echo USE_SEH = $(USE_SEH)
@echo USE_STDCALL = $(USE_STDCALL)
@echo USE_ZLIB = $(USE_ZLIB)
@echo XCOMPILE = $(XCOMPILE)
@echo ZLIBDIR = $(ZLIBDIR)
@echo ZLIBINCDIR = $(ZLIBINCDIR)
@echo ZLIBLIBDIR = $(ZLIBLIBDIR)
@echo ZLIBLIB = $(ZLIBLIB)
moreclean: clean
del /Q $(SQLITE3C) $(SQLITE3H) 2>NUL
# <</mark>>
+48 -47
View File
@@ -1,9 +1,8 @@
<h1 align="center">SQLite Source Repository</h1>
This repository contains the complete source code for the
[SQLite database engine](https://sqlite.org/) going back
to 2000-05-29. The tree includes many tests and some
documentation, though additional tests and most documentation
[SQLite database engine](https://sqlite.org/), including
many tests. Additional tests and most documentation
are managed separately.
See the [on-line documentation](https://sqlite.org/) for more information
@@ -100,16 +99,16 @@ script found at the root of the source tree. Then run "make".
For example:
apt install gcc make tcl-dev ;# Install the necessary build tools
apt install gcc make tcl-dev ;# Make sure you have all the necessary build tools
tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite"
mkdir bld ;# Build happens in a sibling directory
mkdir bld ;# Build will occur in a sibling directory
cd bld ;# Change to the build directory
../sqlite/configure ;# Run the configure script
make sqlite3 ;# The "sqlite3" command-line tool
make sqlite3.c ;# The "amalgamation" source file
make sqldiff ;# The "sqldiff" command-line tool
#### Targets below require tcl-dev ####
make tclextension-install ;# Install the SQLite TCL extension
make sqlite3 ;# Builds the "sqlite3" command-line tool
make sqlite3.c ;# Build the "amalgamation" source file
make sqldiff ;# Builds the "sqldiff" command-line tool
# Makefile targets below this point require tcl-dev
make tclextension-install ;# Build and install the SQLite TCL extension
make devtest ;# Run development tests
make releasetest ;# Run full release tests
make sqlite3_analyzer ;# Builds the "sqlite3_analyzer" tool
@@ -117,15 +116,14 @@ For example:
See the makefile for additional targets. For debugging builds, the
core developers typically run "configure" with options like this:
../sqlite/configure --all --debug CFLAGS='-O0 -g'
../sqlite/configure --enable-all --enable-debug CFLAGS='-O0 -g'
For release builds, the core developers usually do:
../sqlite/configure --all
../sqlite/configure --enable-all
Core deliverables (sqlite3.c, sqlite3) can be built without a TCL, but
many makefile targets require a "tclsh" TCL interpreter version 8.6
or later. The "tclextension-install" target and the test targets that follow
Almost all makefile targets require a "tclsh" TCL interpreter version 8.6 or
later. The "tclextension-install" target and the test targets that follow
all require TCL development libraries too. ("apt install tcl-dev"). It is
helpful, but is not required, to install the SQLite TCL extension (the
"tclextension-install" target) prior to running tests. The "releasetest"
@@ -135,20 +133,20 @@ On "make" command-lines, one can add "OPTIONS=..." to specify additional
compile-time options over and above those set by ./configure. For example,
to compile with the SQLITE_OMIT_DEPRECATED compile-time option, one could say:
./configure --all
./configure --enable-all
make OPTIONS=-DSQLITE_OMIT_DEPRECATED sqlite3
The configure script uses [autosetup](https://msteveb.github.io/autosetup/).
If the configure script does not work out for you, there is a generic
makefile named "Makefile.linux-gcc" in the top directory of the source tree
that you can copy and edit to suit your needs. Comments on the generic
makefile show what changes are needed.
The configure script uses autoconf 2.61 and libtool. If the configure
script does not work out for you, there is a generic makefile named
"Makefile.linux-gcc" in the top directory of the source tree that you
can copy and edit to suit your needs. Comments on the generic makefile
show what changes are needed.
## Compiling for Windows Using MSVC
On Windows, everything can be compiled with MSVC.
You will also need a working installation of TCL if you want to run tests,
though TCL is not required if you just want to build SQLite itself.
You will also need a working installation of TCL if you want to run tests.
TCL is not required if you just want to build SQLite itself.
See the [compile-for-windows.md](doc/compile-for-windows.md) document for
additional information about how to install MSVC and TCL and configure your
build environment.
@@ -158,25 +156,24 @@ TCL library, using a command like this:
set TCLDIR=c:\Tcl
SQLite itself does not contain any TCL code, but it does use TCL to run
tests. You may need to install TCL development libraries in order to
successfully complete some makefile targets. It is helpful, but is not
required, to install the SQLite TCL extension (the "tclextension-install"
target) prior to running tests.
SQLite uses "tclsh.exe" as part of the build process, and so that
program will need to be somewhere on your %PATH%. SQLite itself
does not contain any TCL code, but it does use TCL to run tests.
You may need to install TCL development
libraries in order to successfully complete some makefile targets.
It is helpful, but is not required, to install the SQLite TCL extension
(the "tclextension-install" target) prior to running tests.
The source tree contains a "make.bat" file that allows the same "make"
commands of Unix to work on Windows. In the following, you can substitute
"nmake /f Makefile.msc" in place of "make", if you prefer to avoid this BAT
file:
Build using Makefile.msc. Example:
make sqlite3.exe
make sqlite3.c
make sqldiff.exe
#### Targets below require TCL development libraries ####
make tclextension-install
make devtest
make releasetest
make sqlite3_analyzer.exe
nmake /f Makefile.msc sqlite3.exe
nmake /f Makefile.msc sqlite3.c
nmake /f Makefile.msc sqldiff.exe
# Makefile targets below this point require TCL development libraries
nmake /f Makefile.msc tclextension-install
nmake /f Makefile.msc devtest
nmake /f Makefile.msc releasetest
nmake /f Makefile.msc sqlite3_analyzer.exe
There are many other makefile targets. See comments in Makefile.msc for
details.
@@ -184,7 +181,7 @@ details.
As with the unix Makefile, the OPTIONS=... argument can be passed on the nmake
command-line to enable new compile-time options. For example:
make OPTIONS=-DSQLITE_OMIT_DEPRECATED sqlite3.exe
nmake /f Makefile.msc OPTIONS=-DSQLITE_OMIT_DEPRECATED sqlite3.exe
## Source Tree Map
@@ -197,7 +194,8 @@ command-line to enable new compile-time options. For example:
* **test/** - This directory and its subdirectories contains code used
for testing. Files that end in "`.test`" are TCL scripts that run
tests using an augmented TCL interpreter named "testfixture". Use
a command like "`make testfixture`" to build that
a command like "`make testfixture`" (unix) or
"`nmake /f Makefile.msc testfixture.exe`" (windows) to build that
augmented TCL interpreter, then run individual tests using commands like
"`testfixture test/main.test`". This test/ subdirectory also contains
additional C code modules and scripts for other kinds of testing.
@@ -379,11 +377,10 @@ implementation. It will not be the easiest library in the world to hack.
(and some other test programs too) is built and run when you type
"make test".
* **VERSION**, **manifest**, **manifest.tags**, and **manifest.uuid** -
These files define the current SQLite version number. The "VERSION" file
is human generated, but the "manifest", "manifest.tags", and
"manifest.uuid" files are automatically generated by the
[Fossil version control system](https://fossil-scm.org/).
* **VERSION**, **manifest**, and **manifest.uuid** - These files define
the current SQLite version number. The "VERSION" file is human generated,
but the "manifest" and "manifest.uuid" files are automatically generated
by the [Fossil version control system](https://fossil-scm.org/).
There are many other source files. Each has a succinct header comment that
describes its purpose and role within the larger system.
@@ -409,6 +406,10 @@ makefile:
> make verify-source
Or on windows:
> nmake /f Makefile.msc verify-source
Using the makefile to verify source integrity is good for detecting
accidental changes to the source tree, but malicious changes could be
hidden by also modifying the makefiles.
+90 -7
View File
@@ -101,6 +101,13 @@ NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706
!ENDIF
!ENDIF
# Set this non-0 to use the library paths and other options necessary for
# Windows Phone 8.1.
#
!IFNDEF USE_WP81_OPTS
USE_WP81_OPTS = 0
!ENDIF
# Set this non-0 to split the SQLite amalgamation file into chunks to
# be used for debugging with Visual Studio.
#
@@ -149,6 +156,14 @@ USE_NATIVE_LIBPATHS = 0
USE_RC = 1
!ENDIF
# Set this non-0 to compile binaries suitable for the WinRT environment.
# This setting does not apply to any binaries that require Tcl to operate
# properly (i.e. the text fixture, etc).
#
!IFNDEF FOR_WINRT
FOR_WINRT = 0
!ENDIF
# Set this non-0 to compile binaries suitable for the UWP environment.
# This setting does not apply to any binaries that require Tcl to operate
# properly (i.e. the text fixture, etc).
@@ -548,14 +563,10 @@ RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) $(RCOPTS) $(RCCOPTS)
!IF "$(PLATFORM)"=="x86"
CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
!ELSE
!IFNDEF PLATFORM
CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -DSQLITE_SYSAPI=__stdcall
!ELSE
CORE_CCONV_OPTS =
SHELL_CCONV_OPTS =
@@ -656,6 +667,18 @@ SHELL_LINK_OPTS = $(SHELL_CORE_LIB)
TCC = $(TCC) -FAcs
!ENDIF
# When compiling the library for use in the WinRT environment,
# the following compile-time options must be used as well to
# disable use of Win32 APIs that are not available and to enable
# use of Win32 APIs that are specific to Windows 8 and/or WinRT.
#
!IF $(FOR_WINRT)!=0
TCC = $(TCC) -DSQLITE_OS_WINRT=1
RCC = $(RCC) -DSQLITE_OS_WINRT=1
TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
RCC = $(RCC) -DWINAPI_FAMILY=WINAPI_FAMILY_APP
!ENDIF
# C compiler options for the Windows 10 platform (needs MSVC 2015).
#
!IF $(FOR_WIN10)!=0
@@ -668,7 +691,7 @@ BCC = $(BCC) /d2guard4 -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
# USE_CRT_DLL option is set to force dynamically linking to the
# MSVC runtime library.
#
!IF $(USE_CRT_DLL)!=0
!IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
!IF $(DEBUG)>1
TCC = $(TCC) -MDd
BCC = $(BCC) -MDd
@@ -687,6 +710,16 @@ BCC = $(BCC) -MT
!ENDIF
# Define -DNDEBUG to compile without debugging (i.e., for production usage)
# Omitting the define will cause extra debugging code to be inserted and
# includes extra comments when "EXPLAIN stmt" is used.
#
!IF $(DEBUG)==0
TCC = $(TCC) -DNDEBUG
BCC = $(BCC) -DNDEBUG
RCC = $(RCC) -DNDEBUG
!ENDIF
!IF $(DEBUG)>0 || $(API_ARMOR)!=0 || $(FOR_WIN10)!=0
TCC = $(TCC) -DSQLITE_ENABLE_API_ARMOR=1
RCC = $(RCC) -DSQLITE_ENABLE_API_ARMOR=1
@@ -876,6 +909,56 @@ LTLINKOPTS = /NOLOGO
LTLIBOPTS = /NOLOGO
!ENDIF
# When compiling for use in the WinRT environment, the following
# linker option must be used to mark the executable as runnable
# only in the context of an application container.
#
!IF $(FOR_WINRT)!=0
LTLINKOPTS = $(LTLINKOPTS) /APPCONTAINER
!IF "$(VISUALSTUDIOVERSION)"=="12.0" || "$(VISUALSTUDIOVERSION)"=="14.0"
!IFNDEF STORELIBPATH
!IF "$(PLATFORM)"=="x86"
STORELIBPATH = $(CRTLIBPATH)\store
!ELSEIF "$(PLATFORM)"=="x64"
STORELIBPATH = $(CRTLIBPATH)\store\amd64
!ELSEIF "$(PLATFORM)"=="ARM"
STORELIBPATH = $(CRTLIBPATH)\store\arm
!ELSE
STORELIBPATH = $(CRTLIBPATH)\store
!ENDIF
!ENDIF
STORELIBPATH = $(STORELIBPATH:\\=\)
LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(STORELIBPATH)"
!ENDIF
!ENDIF
# When compiling for Windows Phone 8.1, an extra library path is
# required.
#
!IF $(USE_WP81_OPTS)!=0
!IFNDEF WP81LIBPATH
!IF "$(PLATFORM)"=="x86"
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
!ELSEIF "$(PLATFORM)"=="ARM"
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\ARM
!ELSE
WP81LIBPATH = $(PROGRAMFILES_X86)\Windows Phone Kits\8.1\lib\x86
!ENDIF
!ENDIF
!ENDIF
# When compiling for Windows Phone 8.1, some extra linker options
# are also required.
#
!IF $(USE_WP81_OPTS)!=0
!IFDEF WP81LIBPATH
LTLINKOPTS = $(LTLINKOPTS) "/LIBPATH:$(WP81LIBPATH)"
!ENDIF
LTLINKOPTS = $(LTLINKOPTS) /DYNAMICBASE
LTLINKOPTS = $(LTLINKOPTS) WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib
LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib
!ENDIF
# When compiling for UWP or the Windows 10 platform, some extra linker
# options are also required.
#
@@ -899,9 +982,9 @@ LTLINKOPTS = $(LTLINKOPTS) /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
# If either debugging or symbols are enabled, enable PDBs.
#
!IF $(DEBUG)>1 || $(SYMBOLS)!=0
LDFLAGS = /NODEFAULTLIB:msvcrt /DEBUG $(LDOPTS)
LDFLAGS = /DEBUG $(LDOPTS)
!ELSE
LDFLAGS = /NODEFAULTLIB:msvcrt $(LDOPTS)
LDFLAGS = $(LDOPTS)
!ENDIF
-10
View File
@@ -375,11 +375,6 @@ configure process, and check it in.
Patching Autosetup for Project-local Changes
------------------------------------------------------------------------
The autosetup files require the following patches after updating
from their upstream sources:
### `--debug` flag
Autosetup reserves the flag name **`--debug`** for its own purposes,
and its own special handling of `--enable-...` flags makes `--debug`
an alias for `--enable-debug`. As this project has a long history of
@@ -393,11 +388,6 @@ If autosetup is upgraded and this patch is _not_ applied the invoking
`./configure` will fail loudly because of the declaration of the
`debug` flag in `auto.def` - duplicated flags are not permitted.
### Fail on `malloc()` error
See [check-in 72c8a5b94cdf5d](/info/72c8a5b94cdf5d).
<a name="branch-customization"></a>
Branch-specific Customization
========================================================================
+4 -6
View File
@@ -7409,13 +7409,11 @@ void *JimDefaultAllocator(void *ptr, size_t size)
free(ptr);
return NULL;
}
else if (ptr) {
return realloc(ptr, size);
}
else {
void *p = realloc(ptr, size);
if( p==0 ){
fprintf(stderr,"Out of memory\n");
exit(1);
}
return p;
return malloc(size);
}
}
-1
View File
@@ -679,7 +679,6 @@ proc sqlite-check-common-system-deps {} {
define HAVE_ZLIB 1
define LDFLAGS_ZLIB -lz
sqlite-add-shell-opt -DSQLITE_HAVE_ZLIB=1
sqlite-add-feature-flag -DSQLITE_HAVE_ZLIB=1
} else {
define HAVE_ZLIB 0
define LDFLAGS_ZLIB ""
+5 -9
View File
@@ -98,9 +98,9 @@ typedef struct SegmentWriter SegmentWriter;
** incrementally. See function fts3PendingListAppend() for details.
*/
struct PendingList {
sqlite3_int64 nData;
int nData;
char *aData;
sqlite3_int64 nSpace;
int nSpace;
sqlite3_int64 iLastDocid;
sqlite3_int64 iLastCol;
sqlite3_int64 iLastPos;
@@ -760,9 +760,7 @@ static int fts3PendingTermsAddOne(
pList = (PendingList *)fts3HashFind(pHash, zToken, nToken);
if( pList ){
assert( (i64)pList->nData+(i64)nToken+(i64)sizeof(Fts3HashElem)
<= (i64)p->nPendingData );
p->nPendingData -= (int)(pList->nData + nToken + sizeof(Fts3HashElem));
p->nPendingData -= (pList->nData + nToken + sizeof(Fts3HashElem));
}
if( fts3PendingListAppend(&pList, p->iPrevDocid, iCol, iPos, &rc) ){
if( pList==fts3HashInsert(pHash, zToken, nToken, pList) ){
@@ -775,9 +773,7 @@ static int fts3PendingTermsAddOne(
}
}
if( rc==SQLITE_OK ){
assert( (i64)p->nPendingData + pList->nData + nToken
+ sizeof(Fts3HashElem) <= 0x3fffffff );
p->nPendingData += (int)(pList->nData + nToken + sizeof(Fts3HashElem));
p->nPendingData += (pList->nData + nToken + sizeof(Fts3HashElem));
}
return rc;
}
@@ -5461,7 +5457,7 @@ static int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){
v = atoi(&zVal[9]);
if( v>=24 && v<=p->nPgsz-35 ) p->nNodeSize = v;
rc = SQLITE_OK;
}else if( nVal>11 && 0==sqlite3_strnicmp(zVal, "maxpending=", 11) ){
}else if( nVal>11 && 0==sqlite3_strnicmp(zVal, "maxpending=", 9) ){
v = atoi(&zVal[11]);
if( v>=64 && v<=FTS3_MAX_PENDING_DATA ) p->nMaxPendingData = v;
rc = SQLITE_OK;
-1
View File
@@ -2074,7 +2074,6 @@ static void fts5SegIterReverseInitPage(Fts5Index *p, Fts5SegIter *pIter){
while( 1 ){
u64 iDelta = 0;
if( i>=n ) break;
if( eDetail==FTS5_DETAIL_NONE ){
/* todo */
if( i<n && a[i]==0 ){
-11
View File
@@ -396,12 +396,7 @@ static int fts5VocabOpenMethod(
return rc;
}
/*
** Restore cursor pCsr to the state it was in immediately after being
** created by the xOpen() method.
*/
static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
int nCol = pCsr->pFts5->pConfig->nCol;
pCsr->rowid = 0;
sqlite3Fts5IterClose(pCsr->pIter);
sqlite3Fts5StructureRelease(pCsr->pStruct);
@@ -411,12 +406,6 @@ static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){
pCsr->nLeTerm = -1;
pCsr->zLeTerm = 0;
pCsr->bEof = 0;
pCsr->iCol = 0;
pCsr->iInstPos = 0;
pCsr->iInstOff = 0;
pCsr->colUsed = 0;
memset(pCsr->aCnt, 0, sizeof(i64)*nCol);
memset(pCsr->aDoc, 0, sizeof(i64)*nCol);
}
/*
-362
View File
@@ -16124,367 +16124,5 @@ do_catchsql_test 83.1 {
SELECT * FROM t1('R*R*R*R*R*R*R*R*') WHERE (a,b)<=(current_date,0 BETWEEN 'a'<>11 AND '') ORDER BY rowid DESC;
} {/.*fts5: corruption found/}
#-------------------------------------------------------------------------
reset_db
do_test 84.0 {
sqlite3 db {}
db deserialize [decode_hexdb {
.open --hexdb
| size 53248 pagesize 4096 filename c1a.txt.db
| page 1 offset 0
| 0: 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 SQLite format 3.
| 16: 10 00 01 01 00 40 20 20 00 00 00 00 00 00 00 0d .....@ ........
| 32: 00 00 00 02 00 00 00 01 00 00 00 09 00 00 00 04 ................
| 48: 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 ................
| 96: 00 00 00 00 0d 0f c7 00 07 0d 92 00 0f 8d 0f 36 ...............6
| 112: 0e cb 0e 6b 0e 0e 0d b6 0d 92 0d 92 00 00 00 00 ...k............
| 3472: 00 00 22 08 06 17 11 11 01 31 74 61 62 6c 65 74 .........1tablet
| 3488: 32 74 32 0d 43 52 45 41 54 45 20 54 41 42 4c 45 2t2.CREATE TABLE
| 3504: 20 74 32 28 78 29 56 07 06 17 1f 1f 01 7d 74 61 t2(x)V.......ta
| 3520: 62 6c 65 74 31 5f 63 6f 6e 66 69 67 74 31 5f 63 blet1_configt1_c
| 3536: 6f 6e 66 69 67 07 43 52 45 41 54 45 20 54 41 42 onfig.CREATE TAB
| 3552: 4c 45 20 27 74 31 5f 63 6f 6e 66 69 67 27 28 6b LE 't1_config'(k
| 3568: 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 76 29 PRIMARY KEY, v)
| 3584: 20 57 49 54 48 4f 55 54 20 52 4f 57 49 44 5b 06 WITHOUT ROWID[.
| 3600: 07 17 21 21 01 81 01 74 61 62 6c 65 74 31 5f 64 ..!!...tablet1_d
| 3616: 6f 63 73 69 7a 65 74 31 5f 64 6f 63 73 69 7a 65 ocsizet1_docsize
| 3632: 06 43 52 45 41 54 45 20 54 41 42 4c 45 20 27 74 .CREATE TABLE 't
| 3648: 31 5f 64 6f 63 73 69 7a 65 27 28 69 64 20 49 4e 1_docsize'(id IN
| 3664: 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 TEGER PRIMARY KE
| 3680: 59 2c 20 73 7a 20 42 4c 4f 42 29 5e 05 07 17 21 Y, sz BLOB)^...!
| 3696: 21 01 81 07 74 61 62 6c 65 74 31 5f 63 6f 6e 74 !...tablet1_cont
| 3712: 65 6e 74 74 31 5f 63 6f 6e 74 65 6e 74 05 43 52 entt1_content.CR
| 3728: 45 41 54 45 20 54 41 42 4c 45 20 27 74 31 5f 63 EATE TABLE 't1_c
| 3744: 6f 6e 74 65 6e 74 27 28 69 64 20 49 4e 54 45 47 ontent'(id INTEG
| 3760: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 20 ER PRIMARY KEY,
| 3776: 63 30 2c 20 63 31 2c 20 63 32 29 69 04 07 17 19 c0, c1, c2)i....
| 3792: 19 01 81 2d 74 61 62 6c 65 74 31 5f 69 64 78 74 ...-tablet1_idxt
| 3808: 31 5f 69 64 78 04 43 52 45 41 54 45 20 54 41 42 1_idx.CREATE TAB
| 3824: 4c 45 20 27 74 31 5f 69 64 78 27 28 73 65 67 69 LE 't1_idx'(segi
| 3840: 64 2c 20 74 65 72 6d 2c 20 70 67 6e 6f 2c 20 50 d, term, pgno, P
| 3856: 52 49 4d 41 52 59 20 4b 45 59 28 73 65 67 69 64 RIMARY KEY(segid
| 3872: 2c 20 74 65 72 6d 29 29 20 57 49 54 48 4f 55 54 , term)) WITHOUT
| 3888: 20 52 4f 57 49 44 55 03 07 17 1b 1b 01 81 01 74 ROWIDU........t
| 3904: 61 62 6c 65 74 31 5f 64 61 74 61 74 31 5f 64 61 ablet1_datat1_da
| 3920: 74 61 03 43 52 45 41 54 45 20 54 41 42 4c 45 20 ta.CREATE TABLE
| 3936: 27 74 31 5f 64 61 74 61 27 28 69 64 20 49 4e 54 't1_data'(id INT
| 3952: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 EGER PRIMARY KEY
| 3968: 2c 20 62 6c 6f 63 6b 20 42 4c 4f 42 29 38 02 06 , block BLOB)8..
| 3984: 17 11 11 08 5f 74 61 62 6c 65 74 31 74 31 43 52 ...._tablet1t1CR
| 4000: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB
| 4016: 4c 45 20 74 31 20 55 53 49 4e 47 20 66 74 73 35 LE t1 USING fts5
| 4032: 28 61 2c 62 2c 63 29 00 00 00 39 00 00 00 00 00 (a,b,c)...9.....
| page 3 offset 8192
| 0: 05 00 00 00 02 0f f1 00 00 00 00 0c 0f fb 0f f1 ................
| 4064: 00 00 0b 01 03 00 1c 81 3a 84 5e 81 3a 81 3a 0a ........:.^.:.:.
| 4080: 0a 00 00 00 0b 84 80 80 80 80 01 00 00 00 0a 0a ................
| page 4 offset 12288
| 0: 0a 00 00 00 01 0f fa 00 0f fa 00 00 00 00 00 00 ................
| 4080: 00 00 00 00 00 00 00 00 00 00 05 04 09 0c 01 02 ................
| page 7 offset 24576
| 0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00 ................
| 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version.
| page 10 offset 36864
| 0: 0d 00 00 00 02 0f e2 00 0f e2 0f ef 00 00 00 00 ................
| 4064: 00 00 0b 01 03 00 1c 81 3a 84 5e 81 3a 81 3a 0f ........:.^.:.:.
| 4080: 0a 03 00 24 00 00 00 00 01 01 02 00 01 01 01 09 ...$............
| page 11 offset 40960
| 0: 0d 00 00 00 01 00 22 00 00 22 00 00 00 00 00 00 ................
| 32: 00 00 9f 56 84 80 80 80 80 01 04 00 bf 30 00 00 ...V.........0..
| 48: 0f 58 02 30 30 19 02 05 01 02 05 01 02 05 16 02 .X.00...........
| 64: 05 01 02 05 01 02 05 61 02 05 01 02 05 01 02 05 .......a........
| 80: 13 02 05 01 02 05 01 02 05 0d 02 03 01 02 03 01 ................
| 96: 02 03 02 09 78 66 66 66 66 66 66 66 65 81 17 02 ....xfffffffe...
| 112: 05 01 02 05 01 02 05 01 01 31 04 02 04 01 02 04 .........1......
| 128: 01 02 04 01 02 05 01 02 05 01 02 05 0d 02 06 01 ................
| 144: 02 06 01 02 06 02 01 30 79 02 04 01 02 04 01 02 .......0y.......
| 160: 04 03 02 30 30 2b 02 05 01 02 05 01 02 05 58 02 ...00+........X.
| 176: 05 01 02 05 01 02 05 01 02 05 01 02 05 01 02 05 ................
| 192: 16 02 05 01 02 05 01 02 05 05 06 30 30 30 30 30 ...........00000
| 208: 30 81 0b 02 04 01 02 04 01 02 04 10 02 05 01 02 0...............
| 224: 05 01 02 05 03 02 32 34 76 02 05 01 02 05 01 02 ......24v.......
| 240: 05 02 01 38 07 02 04 01 02 04 01 02 04 01 01 32 ...8...........2
| 256: 28 02 04 01 02 04 01 02 04 04 02 05 01 02 05 01 (...............
| 272: 02 05 02 01 30 1f 02 05 01 02 05 01 02 05 03 02 ....0...........
| 288: 30 30 10 02 05 01 02 05 01 02 05 6a 02 04 01 02 00.........j....
| 304: 04 01 02 04 02 08 35 30 30 30 30 30 30 30 81 26 ......50000000.&
| 320: 02 05 01 02 05 01 02 05 01 01 33 07 02 06 01 02 ..........3.....
| 336: 06 01 02 06 81 2c 02 04 01 02 04 01 02 04 02 04 .....,..........
| 352: 32 37 36 36 81 23 02 05 01 02 05 01 02 05 01 01 2766.#..........
| 368: 34 13 02 05 01 02 05 01 02 05 02 03 30 39 36 1c 4...........096.
| 384: 02 05 01 02 05 01 02 05 07 02 05 01 02 05 01 02 ................
| 400: 05 01 03 35 30 30 7f 02 05 01 02 05 01 02 05 04 ...500..........
| 416: 02 30 30 81 0e 02 06 01 02 06 01 02 06 06 03 30 .00............0
| 432: 30 30 81 11 02 04 01 02 04 01 02 04 01 05 36 35 00............65
| 448: 35 33 36 81 1a 02 05 01 02 05 01 02 05 01 04 38 536............8
| 464: 31 39 32 81 02 02 06 01 02 06 01 02 06 01 05 61 192............a
| 480: 6c 6c 6f 77 01 02 02 01 02 02 01 02 02 02 02 72 llow...........r
| 496: 67 81 08 02 04 01 02 04 01 02 04 02 05 74 6f 6d g............tom
| 512: 69 63 04 02 02 01 02 02 01 02 02 03 06 74 61 63 ic...........tac
| 528: 68 65 64 79 02 03 01 02 03 01 02 03 02 0d 75 74 hedy..........ut
| 544: 6f 63 68 65 63 6b 70 6f 69 6e 74 2b 02 04 01 02 ocheckpoint+....
| 560: 04 01 02 04 05 06 76 61 63 75 75 6d 0d 02 03 01 ......vacuum....
| 576: 02 03 01 02 03 01 06 62 69 6e 61 72 79 03 06 01 .......binary...
| 592: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 608: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 624: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 640: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 656: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 672: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 688: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 704: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 720: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 736: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 752: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 768: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 784: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 800: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 816: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 832: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 848: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 864: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 880: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 896: 01 02 02 02 07 79 74 65 63 6f 64 65 37 02 03 01 .....ytecode7...
| 912: 02 03 01 02 03 01 05 63 61 63 68 65 10 02 03 01 .......cache....
| 928: 02 03 01 01 03 02 04 6c 61 6e 67 07 02 03 01 02 .......lang.....
| 944: 03 01 02 03 02 05 6f 6c 75 6d 6e 7c 02 03 01 02 ......olumn|....
| 960: 03 01 02 03 03 06 6d 6d 65 6e 74 73 43 02 04 01 ......mmentsC...
| 976: 02 04 01 02 04 04 05 70 69 6c 65 72 07 02 02 01 .......piler....
| 992: 02 02 01 02 02 05 04 6f 75 6e 64 7f 02 03 01 02 .......ound.....
| 1008: 03 01 02 03 03 03 75 6e 74 81 17 02 04 01 02 04 ......unt.......
| 1024: 01 02 04 02 05 75 72 73 6f 72 3a 02 03 01 02 03 .....ursor:.....
| 1040: 01 02 03 01 06 64 62 70 61 67 65 3d 02 03 01 02 .....dbpage=....
| 1056: 03 01 02 03 03 04 73 74 61 74 40 02 03 01 02 03 ......stat@.....
| 1072: 01 02 03 02 04 65 62 75 67 0a 02 02 01 02 02 01 .....ebug.......
| 1088: 02 02 03 05 66 61 75 6c 74 0d 02 02 01 02 02 01 ....fault.......
| 1104: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1120: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1136: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1152: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1168: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1184: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1200: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 4f 02 ..............O.
| 1216: 03 01 02 03 01 02 03 03 03 70 74 68 81 05 02 04 .........pth....
| 1232: 01 02 04 01 02 04 19 02 04 01 02 04 01 02 04 02 ................
| 1248: 05 69 72 65 63 74 34 02 02 01 02 02 01 02 02 01 .irect4.........
| 1264: 06 65 6e 61 62 6c 65 37 02 02 01 02 02 01 02 02 .enable7........
| 1280: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1296: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1312: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1328: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1344: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1360: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1376: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1392: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1408: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1424: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1440: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1456: 02 01 02 02 02 06 78 70 6c 61 69 6e 43 02 03 01 ......xplainC...
| 1472: 02 03 01 02 03 04 01 72 81 05 02 03 01 02 03 01 .......r........
| 1488: 02 03 03 07 74 65 6e 73 69 6f 6e 81 2f 02 04 01 ....tension./...
| 1504: 02 04 01 02 04 01 04 66 69 6c 65 13 02 03 01 02 .......file.....
| 1520: 03 01 02 03 02 05 6f 72 6d 61 74 13 02 04 01 02 ......ormat.....
| 1536: 04 01 02 04 02 03 74 73 33 46 02 03 01 02 03 01 ......ts3F......
| 1552: 02 03 01 02 03 01 02 03 01 02 03 04 01 34 4c 02 .............4L.
| 1568: 03 01 02 03 01 02 03 04 01 35 4f 02 03 01 02 03 .........5O.....
| 1584: 01 02 03 02 03 75 6e 63 5e 02 05 01 02 05 01 02 .....unc^.......
| 1600: 05 05 04 74 69 6f 6e 73 02 05 01 02 05 01 02 05 ...tions........
| 1616: 13 02 03 01 02 03 01 02 03 09 01 73 55 02 04 01 ...........sU...
| 1632: 02 04 01 02 04 01 07 67 65 6f 70 6f 6c 79 52 02 .......geopolyR.
| 1648: 03 01 02 03 01 02 03 01 05 68 69 6e 74 73 3a 02 .........hints:.
| 1664: 04 01 02 04 01 02 04 02 03 6f 6f 6b 61 02 04 01 .........ooka...
| 1680: 02 04 01 02 04 01 02 69 6e 01 02 04 01 02 04 01 .......in.......
| 1696: 02 04 03 04 69 74 73 7a 1f 02 04 01 02 04 01 02 ....itsz........
| 1712: 04 03 08 74 72 69 6e 73 69 63 73 04 02 03 01 02 ...trinsics.....
| 1728: 03 01 02 03 01 07 6a 6f 75 72 6e 61 6c 16 02 03 ......journal...
| 1744: 01 02 03 01 02 03 01 06 6c 65 6e 67 74 68 81 0b ........length..
| 1760: 02 03 01 02 03 01 02 03 01 02 05 01 02 05 01 02 ................
| 1776: 05 0d 02 04 01 02 04 01 02 04 02 03 69 6b 65 81 ............ike.
| 1792: 0e 02 03 01 02 03 01 02 03 03 03 6d 69 74 16 02 ...........mit..
| 1808: 05 01 02 05 01 02 05 5e 02 04 01 02 04 01 02 04 .......^........
| 1824: 02 03 6f 61 64 81 2f 02 03 01 02 03 01 02 03 01 ..oad./.........
| 1840: 06 6d 61 6c 6c 6f 63 76 02 02 01 02 02 01 02 02 .mallocv........
| 1856: 3a 02 03 01 02 03 01 02 03 03 02 74 68 55 02 03 :..........thU..
| 1872: 01 02 03 01 02 03 03 01 78 79 02 02 01 02 02 01 ........xy......
| 1888: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1904: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1920: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1936: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 1952: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 1968: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 1984: 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 ................
| 2000: 02 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 ................
| 2016: 01 02 02 01 02 02 01 02 02 01 02 02 01 02 02 01 ................
| 2032: 02 02 02 05 65 6d 6f 72 79 81 11 02 03 01 02 03 ....emory.......
| 2048: 01 02 03 04 04 73 79 73 35 58 02 03 01 02 03 01 .....sys5X......
| 2064: 02 03 02 03 6d 61 70 19 02 03 01 02 03 01 02 03 ....map.........
| 2080: 79 02 03 01 02 03 01 02 03 02 04 75 74 65 78 81 y..........utex.
| 2096: 2c 02 02 01 02 02 01 02 02 01 06 6e 6f 63 61 73 ,..........nocas
| 2112: 65 02 06 01 02 02 03 06 01 02 02 03 06 01 02 02 e...............
| 2128: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2144: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2160: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2176: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2192: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2208: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2224: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2240: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2256: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2272: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2288: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2304: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2320: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2336: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2352: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2368: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2384: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2400: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2416: 02 02 03 06 01 02 02 03 07 72 6d 61 6c 69 7a 65 .........rmalize
| 2432: 5b 02 03 01 02 03 01 02 03 02 05 75 6d 62 65 72 [..........umber
| 2448: 81 23 02 04 01 02 04 01 02 04 01 06 6f 66 66 73 .#..........offs
| 2464: 65 74 5e 02 03 01 02 03 01 02 03 02 03 6d 69 74 et^..........mit
| 2480: 81 2c 02 03 01 02 03 01 02 03 01 02 02 01 02 02 .,..............
| 2496: 01 02 02 02 01 70 81 26 02 04 01 02 04 01 02 04 .....p.&........
| 2512: 02 07 76 65 72 66 6c 6f 77 34 02 03 01 02 03 01 ..verflow4......
| 2528: 02 03 01 04 70 61 67 65 1c 02 03 01 02 03 01 02 ....page........
| 2544: 03 64 02 04 01 02 04 01 02 04 13 02 03 01 02 03 .d..............
| 2560: 01 02 03 01 02 03 01 02 03 01 02 03 03 09 72 65 ..............re
| 2576: 6e 74 68 65 73 69 73 49 02 04 01 02 04 01 02 04 nthesisI........
| 2592: 03 05 74 74 65 72 6e 81 0e 02 04 01 02 04 01 02 ..ttern.........
| 2608: 04 02 05 63 61 63 68 65 1f 02 03 01 02 03 01 02 ...cache........
| 2624: 03 02 08 72 65 75 70 64 61 74 65 61 02 03 01 02 ...reupdatea....
| 2640: 03 01 02 03 01 04 72 65 61 64 34 02 04 01 02 04 ......read4.....
| 2656: 01 02 04 03 07 63 75 72 73 69 76 65 22 02 03 01 .....cursive....
| 2672: 02 03 01 02 03 02 04 6f 77 69 64 01 02 03 01 02 .......owid.....
| 2688: 03 01 02 03 02 04 74 72 65 65 64 02 03 01 02 03 ......treed.....
| 2704: 01 02 03 04 02 69 6d 01 06 01 02 02 03 06 01 02 .....im.........
| 2720: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2736: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2752: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2768: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2784: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2800: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2816: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2832: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2848: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2864: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2880: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2896: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2912: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 2928: 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 ................
| 2944: 02 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 ................
| 2960: 02 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 ................
| 2976: 03 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 ................
| 2992: 06 01 02 02 03 06 01 02 02 03 06 01 02 02 03 06 ................
| 3008: 01 02 02 03 06 01 02 02 03 06 01 02 02 01 0a 73 ...............s
| 3024: 63 61 6e 73 74 61 74 75 73 70 02 04 01 02 04 01 canstatusp......
| 3040: 02 04 02 05 65 63 74 6f 72 25 02 03 01 02 03 01 ....ector%......
| 3056: 02 03 03 04 6c 65 63 74 7f 02 04 01 02 04 01 02 ....lect........
| 3072: 04 03 05 73 73 69 6f 6e 67 02 03 01 02 03 01 02 ...ssiong.......
| 3088: 03 02 03 69 7a 65 10 02 04 01 02 04 01 02 04 04 ...ize..........
| 3104: 02 04 01 02 04 01 02 04 01 02 04 01 02 04 01 02 ................
| 3120: 04 01 02 04 01 02 04 01 02 04 07 02 04 01 02 04 ................
| 3136: 01 02 04 5b 02 05 01 02 05 01 02 05 10 02 04 01 ...[............
| 3152: 02 04 01 02 04 04 02 04 01 02 04 01 02 04 02 03 ................
| 3168: 6f 66 74 76 02 03 01 02 03 01 02 03 02 02 71 6c oftv..........ql
| 3184: 5e 02 04 01 02 04 01 02 04 13 02 04 01 02 04 01 ^...............
| 3200: 02 04 28 02 03 01 02 03 01 02 03 02 04 74 61 74 ..(..........tat
| 3216: 34 6a 02 03 01 02 03 01 02 03 03 02 6d 74 70 02 4j..........mtp.
| 3232: 03 01 02 03 01 02 03 05 04 76 74 61 62 6d 02 03 .........vtabm..
| 3248: 01 02 03 01 02 03 03 03 6f 72 65 81 35 02 03 01 ........ore.5...
| 3264: 02 03 01 02 03 02 0a 79 6e 63 68 72 6f 6e 6f 75 .......ynchronou
| 3280: 73 28 02 03 01 02 03 01 02 03 04 02 04 01 02 04 s(..............
| 3296: 01 02 04 03 04 73 74 65 6d 81 32 02 02 01 02 02 .....stem.2.....
| 3312: 01 02 02 01 04 74 65 6d 70 81 35 02 02 01 02 02 .....temp.5.....
| 3328: 01 02 02 02 06 68 72 65 61 64 73 31 02 04 01 02 .....hreads1....
| 3344: 04 01 02 04 76 02 04 01 02 04 01 02 04 08 03 61 ....v..........a
| 3360: 66 65 81 38 02 02 01 02 02 01 02 02 02 06 72 69 fe.8..........ri
| 3376: 67 67 65 72 81 20 02 03 01 02 03 01 02 03 08 01 gger. ..........
| 3392: 73 22 02 04 01 02 04 01 02 04 01 07 75 6e 6b 6e s...........unkn
| 3408: 6f 77 6e 73 02 03 01 02 03 01 02 03 01 08 76 61 owns..........va
| 3424: 72 69 61 62 6c 65 81 23 02 03 01 02 03 01 02 03 riable.#........
| 3440: 02 03 64 62 65 81 26 02 03 01 02 03 01 02 03 02 ..dbe.&.........
| 3456: 03 69 65 77 01 02 05 01 02 05 01 02 05 02 03 74 .iew...........t
| 3472: 61 62 37 02 04 01 02 04 01 02 04 04 02 04 01 02 ab7.............
| 3488: 04 01 02 04 01 02 04 01 02 04 01 02 04 01 03 77 ...............w
| 3504: 61 6c 2b 02 03 01 02 03 01 02 03 01 02 03 01 02 al+.............
| 3520: 03 01 02 03 02 05 6f 72 6b 65 72 31 02 03 01 02 ......orker1....
| 3536: 03 01 02 03 76 02 03 01 02 03 01 02 03 01 01 78 ....v..........x
| 3552: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3568: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3584: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3600: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3616: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3632: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3648: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3664: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3680: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3696: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3712: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3728: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3744: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3760: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3776: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3792: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3808: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3824: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3840: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3856: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3872: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3888: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3904: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3920: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3936: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3952: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3968: 06 01 01 02 01 06 04 30 15 1e 0c 28 1b 0d 0c 15 .......0...(....
| 3984: 0c 16 14 16 10 0c 17 0e 0e 0f 11 10 10 0e 10 11 ................
| 4000: 18 11 82 3e 12 10 0f 10 11 10 0f 0f 10 11 0f 0f ...>............
| 4016: 81 05 18 10 81 45 11 0d 13 0f 10 17 0c 0c 0e 18 .....E..........
| 4032: 0c 12 10 0e 0d 0f 13 12 24 0f 17 0f 1a 0d 81 1c ........$.......
| 4048: 11 0f 17 10 82 3e 12 11 11 18 0d 12 2a 14 11 10 .....>......*...
| 4064: 13 0f 12 0f 0f 82 3a 15 10 0f 10 4d 0e 1f 0f 0d ......:....M....
| 4080: 0f 0f 1e 10 10 1a 0f 12 0c 12 14 0f 0e 20 17 19 ............. ..
| page 12 offset 45056
| 0: 0d 00 00 00 01 0d f4 00 0d f4 00 00 00 00 00 00 ................
| 3568: 00 00 00 00 84 04 84 80 80 80 80 02 04 00 88 0c ................
| 3584: 00 07 02 00 01 01 02 56 06 01 01 02 01 06 01 01 .......V........
| 3600: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3616: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3632: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3648: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3664: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3680: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3696: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3712: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3728: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3744: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3760: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3776: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3792: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3808: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3824: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3840: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3856: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3872: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3888: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3904: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 3920: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 3936: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 3952: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 3968: 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 ................
| 3984: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 4000: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| 4016: 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 ................
| 4032: 06 01 01 02 01 06 01 01 02 01 06 01 01 02 01 06 ................
| 4048: 52 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 R...............
| 4064: 01 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 ................
| 4080: 02 01 06 01 01 02 01 06 01 01 02 01 06 01 01 02 ................
| end c1a.txt.db
}]} {}
do_catchsql_test 84.1 {
SELECT * FROM t1('R*R*x') ORDER BY rowid DESC;
} {1 {fts5: corruption found reading blob 137438953475 from table "t1"}}
sqlite3_fts5_may_be_corrupt 0
finish_test
-22
View File
@@ -305,28 +305,6 @@ do_catchsql_test 6.2 {
sqlite3_fts5_may_be_corrupt 0
#-------------------------------------------------------------------------
reset_db
do_execsql_test 7.0 {
CREATE VIRTUAL TABLE t1 USING fts5(a, b);
CREATE VIRTUAL TABLE v1 USING fts5vocab(t1, col);
INSERT INTO t1 VALUES('xx', 'xx');
CREATE TABLE x1(t);
INSERT INTO x1 VALUES('xx');
INSERT INTO x1 VALUES('xx');
SELECT term, col FROM v1;
} {
xx a xx b
}
do_execsql_test 7.1 {
SELECT * FROM x1 WHERE 'a'=(SELECT col FROM v1 WHERE term=t)
} {xx xx}
finish_test
+2 -1
View File
@@ -329,7 +329,6 @@ static int fileStat(
b1[sz] = 0;
rc = _wstat(b1, pStatBuf);
if( rc==0 ) statTimesToUtc(zPath, pStatBuf);
sqlite3_free(b1);
return rc;
#else
return stat(zPath, pStatBuf);
@@ -460,6 +459,7 @@ static int writeFile(
if( mtime>=0 ){
#if defined(_WIN32)
#if !SQLITE_OS_WINRT
/* Windows */
FILETIME lastAccess;
FILETIME lastWrite;
@@ -490,6 +490,7 @@ static int writeFile(
}else{
return 1;
}
#endif
#elif defined(AT_FDCWD) && 0 /* utimensat() is not universally available */
/* Recent unix */
struct timespec times[2];
+5 -10
View File
@@ -230,16 +230,13 @@ static void hash_finish(
*****************************************************************************/
/*
** Two SQL functions: sha1(X) and sha1b(X).
** Implementation of the sha1(X) function.
**
** sha1(X) returns a lower-case hexadecimal rendering of the SHA1 hash
** of the argument X. If X is a BLOB, it is hashed as is. For all other
** Return a lower-case hexadecimal rendering of the SHA1 hash of the
** argument X. If X is a BLOB, it is hashed as is. For all other
** types of input, X is converted into a UTF-8 string and the string
** is hashed without the trailing 0x00 terminator. The hash of a NULL
** is hash without the trailing 0x00 terminator. The hash of a NULL
** value is NULL.
**
** sha1b(X) is the same except that it returns a 20-byte BLOB containing
** the binary hash instead of a hexadecimal string.
*/
static void sha1Func(
sqlite3_context *context,
@@ -260,13 +257,11 @@ static void sha1Func(
hash_step(&cx, sqlite3_value_text(argv[0]), nByte);
}
if( sqlite3_user_data(context)!=0 ){
/* sha1b() - binary result */
hash_finish(&cx, zOut, 1);
sqlite3_result_blob(context, zOut, 20, SQLITE_TRANSIENT);
}else{
/* sha1() - hexadecimal text result */
hash_finish(&cx, zOut, 0);
sqlite3_result_text(context, zOut, 40, SQLITE_TRANSIENT);
sqlite3_result_blob(context, zOut, 40, SQLITE_TRANSIENT);
}
}
+2 -3
View File
@@ -900,12 +900,11 @@ static int zipfileGetEntry(
rc = zipfileReadData(pFile, aRead, szFix, pNew->cds.iOffset, pzErr);
}else{
aRead = (u8*)&aBlob[pNew->cds.iOffset];
if( (pNew->cds.iOffset + ZIPFILE_LFH_FIXED_SZ)>(unsigned)nBlob ){
if( (pNew->cds.iOffset + ZIPFILE_LFH_FIXED_SZ)>nBlob ){
rc = zipfileCorrupt(pzErr);
}
}
memset(&lfh, 0, sizeof(lfh));
if( rc==SQLITE_OK ) rc = zipfileReadLFH(aRead, &lfh);
if( rc==SQLITE_OK ){
pNew->iDataOff = pNew->cds.iOffset + ZIPFILE_LFH_FIXED_SZ;
@@ -1009,7 +1008,7 @@ static void zipfileInflate(
if( err!=Z_STREAM_END ){
zipfileCtxErrorMsg(pCtx, "inflate() failed (%d)", err);
}else{
sqlite3_result_blob(pCtx, aRes, (int)str.total_out, zipfileFree);
sqlite3_result_blob(pCtx, aRes, nOut, zipfileFree);
aRes = 0;
}
}
+29 -98
View File
@@ -19,10 +19,10 @@ that can be incorporated and reused by other applications.
## 1.0 Overview Of Operation
Suppose variable `sqlite3_stmt *pStmt` is a pointer to an SQLite
prepared statement that has been reset and bound and is ready to run.
Then to format the output from this prepared statement, use code
similar to the following:
Suppose `pStmt` is a pointer to an SQLite prepared statement
(a pointer to an `sqlite3_stmt` object) that has been reset and
bound and is ready to run. Then to format the output from this
prepared statement, use code similar to the following:
> ~~~
sqlite3_qrf_spec spec; /* Format specification */
@@ -41,60 +41,21 @@ if( rc ){
sqlite3_free(zErrMsg); /* Free the error message text */
}else{
printf("%s", zResult); /* Report the results */
sqlite3_free(zResult); /* Free memory used to hold results */
}
sqlite3_free(zResult); /* Free memory used to hold results */
~~~
The `sqlite3_qrf_spec` object describes the desired output format
and where to send the generated output. Most of the work in using
and what to do with the generated output. Most of the work in using
the QRF involves filling out the sqlite3_qrf_spec.
### 1.1 Using QRF with SQL text
If you start with SQL text instead of an sqlite3_stmt pointer, and
especially if the SQL text might comprise two or more statements, then
the SQL text needs to be converted into sqlite3_stmt objects separately.
If the original SQL text is in a variable `const char *zSql` and the
database connection is in variable `sqlite3 *db`, then code
similar to the following should work:
> ~~~
sqlite3_qrf_spec spec; /* Format specification */
char *zErrMsg; /* Text error message (optional) */
char *zResult = 0; /* Formatted output written here */
sqlite3_stmt *pStmt; /* Next prepared statement */
int rc; /* Result code */
memset(&spec, 0, sizeof(spec)); /* Initialize the spec */
spec.iVersion = 1; /* Version number must be 1 */
spec.pzOutput = &zResult; /* Write results in variable zResult */
/* Optionally fill in other settings in spec here, as needed */
zErrMsg = 0; /* Not required; just being pedantic */
while( zSql && zSql[0] ){
pStmt = 0; /* Not required; just being pedantic */
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zSql);
if( rc!=SQLITE_OK ){
printf("Error: %s\n", sqlite3_errmsg(db));
}else{
rc = sqlite3_format_query_result(pStmt, &spec, &zErrMsg); /* Get results */
if( rc ){
printf("Error (%d): %s\n", rc, zErrMsg); /* Report an error */
sqlite3_free(zErrMsg); /* Free the error message text */
}else{
printf("%s", zResult); /* Report the results */
sqlite3_free(zResult); /* Free memory used to hold results */
zResult = 0;
}
}
sqlite3_finalize(pStmt);
}
~~~
## 2.0 The `sqlite3_qrf_spec` object
The most recent definition of `sqlite3_qrf_spec` is shown below.
The `sqlite3_qrf_spec` structure defines how the results of a query
are to be formatted, and what to do with the formatted text. The
most recent definition of `sqlite3_qrf_spec` is shown below.
Do not be alarmed by the complexity of this structure. You only need
Do not be alarmed by the complexity of this structure. You only have
to understand the properties you want to modify. Zero is always a good
default for all of the attributes (except iVersion and pzOutput/xWrite)
and so simply zeroing out the bulk of this structure is a good start.
@@ -113,10 +74,9 @@ struct sqlite3_qrf_spec {
unsigned char bTitles; /* True to show column names */
unsigned char bWordWrap; /* Try to wrap on word boundaries */
unsigned char bTextJsonb; /* Render JSONB blobs as JSON text */
unsigned char bTextNull; /* Apply eText encoding to zNull[] */
unsigned char eDfltAlign; /* Default alignment, no covered by aAlignment */
unsigned char eTitleAlign; /* Alignment for column headers */
unsigned char bSplitColumn; /* Wrap single-column output into many columns */
unsigned char bBorder; /* Show outer border in Box and Table styles */
short int nWrap; /* Wrap columns wider than this */
short int nScreenWidth; /* Maximum overall table width */
short int nLineLimit; /* Maximum number of lines for any row */
@@ -152,7 +112,7 @@ Further detail on the meanings of each of the fields in the
### 2.1 Structure Version Number
The sqlite3_qrf_spec.iVersion field must be 1. Future enhancements to
the QRF might add new fields to the bottom of the sqlite3_qrf_spec
the QRF might add new fields onto the bottom of the sqlite3_qrf_spec
object. Those new fields will only be accessible if the iVersion is greater
than 1. Thus the iVersion field is used to support upgradability.
@@ -166,7 +126,7 @@ first argument) to transmit the formatted output. Or, if
sqlite3_qrf_spec.pzOutput points to a pointer to a character, then that
pointer is made to point to memory obtained from sqlite3_malloc() that
contains the complete text of the formatted output. If spec.pzOutput\[0\]
is initially non-NULL, then it is assumed to already point to memory obtained
is initially non-NULL, then it is assumed to point to memory obtained
from sqlite3_malloc(). In that case, the buffer is resized using
sqlite3_realloc() and the new text is appended.
@@ -180,8 +140,8 @@ value might be returned.
### 2.3 Output Format
The sqlite3_qrf_spec.eStyle field is an integer code that defines the
specific output format that will be generated. See [section 4.0](#style)
below for details on the meaning of the various style options.
specific output format that will be generated. See section 4.0 below
for details on the meaning of the various style options.
Other fields in sqlite3_qrf_spec might be used or might be
ignored, depending on the value of eStyle.
@@ -254,7 +214,6 @@ Both fields can have one of the following values:
#define QRF_TEXT_Html 4 /* HTML-style quoting */
#define QRF_TEXT_Tcl 5 /* C/Tcl quoting */
#define QRF_TEXT_Json 6 /* JSON quoting */
#define QRF_TEXT_Relaxed 7 /* Relaxed SQL quoting */
~~~
A value of QRF_TEXT_Auto means that the query result formatter will choose
@@ -268,14 +227,6 @@ look like SQL literals. That means the value will be surrounded by
single-quotes (U+0027) and any single-quotes contained within the text
will be doubled.
QRF_TEXT_Relaxed is similar to QRF_TEXT_Sql, except that it automatically
reverts to QRF_TEXT_Plain if the value to be displayed does not contain
special characters and is not easily confused with a NULL or a numeric
value. QRF_TEXT_Relaxed strives to minimize the amount of quoting syntax
while keeping the result unambiguous and easy for humans to read. The
precise rules for when quoting is omitted in QRF_TEXT_Relaxed, and when
it is applied, might be adjusted in future releases.
A value of QRF_TEXT_Csv means that text values are escaped in accordance
with RFC&nbsp;4180, which defines Comma-Separated-Value or CSV files.
Text strings that contain no special values appears as-is. Text strings
@@ -314,7 +265,6 @@ how the BLOB value is formatted. The following options are available;
#define QRF_BLOB_Hex 3 /* Hexadecimal representation */
#define QRF_BLOB_Tcl 4 /* "\000" notation */
#define QRF_BLOB_Json 5 /* A JSON string */
#define QRF_BLOB_Size 6 /* Display the blob size only */
~~~
A value of QRF_BLOB_Auto means that display format is selected automatically
@@ -342,10 +292,6 @@ the C/Tcl/Perl octal backslash escapes. So the string from the
previous paragraph would be shown as
`"\u0005\u0028\u0081\u00f3"`.
A value of QRF_BLOB_Size does not show any BLOB content at all.
Instead, it substitutes a text string that says how many bytes
the BLOB contains.
### 2.8 Maximum size of displayed content (nLineLimit, nCharLimit)
If the sqlite3_qrf_spec.nCharLimit setting is non-zero, then the formatter
@@ -404,10 +350,6 @@ The nScreenWidth is a hint to the formatter, not a requirement.
The formatter trieds to keep lines below the nScreenWidth limit,
but it does not guarantee that it will.
The nScreenWidth field currently only makes a difference in
columnar styles (**Box**, **Column**, **Markdown**, and **Table**)
and in the **Line** style.
### 2.11 Individual Column Width (nWidth and aWidth)
The sqlite3_qrf_spec.aWidth field is a pointer to an array of
@@ -515,9 +457,8 @@ entry for that column takes precedence. If either the horizontal
or vertical alignment has an "auto" value for that column or if
a column is beyond the first nAlign entries, then eDfltAlign
is used as a backup. If neither aAlign\[\] nor eDfltAlign
specify a horizontal alignment, then values are right-aligned
(QRF_ALIGN_Right) if they are numeric and left-aligned
(QRF_ALIGN_Left) otherwise. If neither aAlign\[\] nor eDfltAlign
specify a horizontal alignment, then values are left-aligned
(QRF_ALIGN_Left). If neither aAlign\[\] nor eDfltAlign
specify a vertical alignment, then values are top-aligned
(QRF_ALIGN_Top).
@@ -538,12 +479,17 @@ and these settings are ignored for those styles.
The sqlite3_qrf_spec.zTableName value is the name of the output table
when eStyle is QRF_STYLE_Insert.
### 2.15 The Rendering Of NULL (zNull)
### 2.15 The Rendering Of NULL (zNull, eTextNull)
If a value is NULL then show the NULL using the string
found in sqlite3_qrf_spec.zNull. If zNull is itself a NULL pointer
then NULL values are rendered as an empty string.
If the sqlite3_qrf_spec.bTextNull field is QRF_Yes, then the
text encoding specified by eText is applied to the value in
zNull. If bTextNull is QRF_No or QRF_Auto, then the value
in zNull is shown verbatim.
### 2.16 Optional Value Rendering Callback
If the sqlite3_qrf_spec.xRender field is not NULL, then each
@@ -577,13 +523,12 @@ into *E. Any error message text will be stored in memory obtained
from sqlite3_malloc() and it is the responsibility of the caller to
free that memory by a subsequent call to sqlite3_free().
<a id="style"></a>
## 4.0 Output Styles
The result formatter supports a variety of output styles. The
output style (sometimes called "output mode") is determined by
the eStyle field of the sqlite3_qrf_spec object. The set of
supported output modes might increase in future versions.
output style used is determined by the eStyle setting of the
sqlite3_qrf_spec object. The set of supported output modes
might increase in future versions.
The following output modes are currently defined:
> ~~~
@@ -639,22 +584,8 @@ to draw the grid. The **Column** arranges the results in neat columns
but does not draw in column or row separator, except that it does draw
lines horizontal lines using "`-`" characters to separate the column names
from the data below. This is very similar to default output styling in
psql. The **Markdown** renders its result in the Markdown table format.
The **Box** and **Table** styles normally have a border that surrounds
the entire result. However, if sqlite3_qrf_spec.bBorder is QRF_No, then
that border is omitted, saving a little space both horizontally and
vertically.
#### 4.2.1 Split Column Mode
If the bSplitColumn field is QRF_Yes, and eStyle is QRF_STYLE_Column,
and bTitles is QRF_No, and nScreenWidth is greater than zero, and if
the query only returns a single column, then a special rendering known
as "Split Column Mode" will be used. In split column mode, instead
of showing all results in one tall column, the content wraps vertically
so that it appears on the screen as multiple columns, as many as will
fit in the available screen width.
psql. The **Markdown** renders its result in the
Markdown table format.
### 4.3 Line-oriented Styles
@@ -737,7 +668,7 @@ The SQLite Query Result Formatter is implemented in three source code files:
* `qrf.c` &rarr; The implementation, written in portable C99
* `qrf.h` &rarr; A header file defining interfaces
* `README.md` &rarr; This documentation
* `README.md` &rarr; This documentation, in Markdown
To use the SQLite result formatter, include the "`qrf.h`" header file
and link the application against the "`qrf.c`" source file.
-14
View File
@@ -1,14 +0,0 @@
# Developer Notes
## Measuring Test Coverage On Linux
On Mint Linux, as of 2025-12-02:
> ~~~
./configure --dev CFLAGS='-O0 -g -fprofile-arcs -ftest-coverage'
make clean testfixture
./testfixture test/qrf*.test
gcov -b -c testfixture-tclsqlite-ex.c
~~~
View results in tclsqlite-ex.c.gcov
+86 -238
View File
@@ -102,15 +102,6 @@ static const char qrfCType[] = {
#define qrfAlpha(x) ((qrfCType[(unsigned char)x]&4)!=0)
#define qrfAlnum(x) ((qrfCType[(unsigned char)x]&6)!=0)
#ifndef deliberate_fall_through
/* Quiet some compilers about some of our intentional code. */
# if defined(GCC_VERSION) && GCC_VERSION>=7000000
# define deliberate_fall_through __attribute__((fallthrough));
# else
# define deliberate_fall_through
# endif
#endif
/*
** Set an error code and error message.
*/
@@ -437,7 +428,7 @@ static const struct {
{1, 0x00f7f}, {0, 0x00f80}, {1, 0x00f85}, {0, 0x00f86}, {1, 0x00f88},
{0, 0x00f90}, {1, 0x00f98}, {0, 0x00f99}, {1, 0x00fbd}, {0, 0x00fc6},
{1, 0x00fc7}, {0, 0x0102d}, {1, 0x01031}, {0, 0x01032}, {1, 0x01033},
{0, 0x01036}, {1, 0x0103b}, {0, 0x01058},
{0, 0x01036}, {1, 0x01038}, {0, 0x01039}, {1, 0x0103a}, {0, 0x01058},
{1, 0x0105a}, {2, 0x01100}, {0, 0x01160}, {1, 0x01200}, {0, 0x0135f},
{1, 0x01360}, {0, 0x01712}, {1, 0x01715}, {0, 0x01732}, {1, 0x01735},
{0, 0x01752}, {1, 0x01754}, {0, 0x01772}, {1, 0x01774}, {0, 0x017b4},
@@ -480,7 +471,7 @@ int sqlite3_qrf_wcwidth(int c){
int iFirst, iLast;
/* Fast path for common characters */
if( c<0x300 ) return 1;
if( c<=0x300 ) return 1;
/* The general case */
iFirst = 0;
@@ -546,20 +537,13 @@ static int qrfIsVt100(const unsigned char *z){
/*
** Return the length of a string in display characters.
**
** Most characters of the input string count as 1, including
** multi-byte UTF8 characters. However, zero-width unicode
** characters and VT100 escape sequences count as zero, and
** double-width characters count as two.
**
** The definition of "zero-width" and "double-width" characters
** is not precise. It depends on the output device, to some extent,
** and it varies according to the Unicode version. This routine
** makes the best guess that it can.
** Multibyte UTF8 characters count as a single character
** for single-width characters, or as two characters for
** double-width characters.
*/
size_t sqlite3_qrf_wcswidth(const char *zIn){
static int qrfDisplayLength(const char *zIn){
const unsigned char *z = (const unsigned char*)zIn;
size_t n = 0;
int n = 0;
while( *z ){
if( z[0]<' ' ){
int k;
@@ -593,14 +577,11 @@ size_t sqlite3_qrf_wcswidth(const char *zIn){
** it will need to be split.
*/
static int qrfDisplayWidth(const char *zIn, sqlite3_int64 nByte, int *pnNL){
const unsigned char *z;
const unsigned char *zEnd;
const unsigned char *z = (const unsigned char*)zIn;
const unsigned char *zEnd = &z[nByte];
int mx = 0;
int n = 0;
int nNL = 0;
if( zIn==0 ) zIn = "";
z = (const unsigned char*)zIn;
zEnd = &z[nByte];
while( z<zEnd ){
if( z[0]<' ' ){
int k;
@@ -712,45 +693,6 @@ static void qrfEscape(
}
}
/*
** Determine if the string z[] can be shown as plain text. Return true
** if z[] is unambiguously text. Return false if z[] needs to be
** quoted.
**
** All of the following must be true in order for z[] to be relaxable:
**
** (1) z[] does not begin or end with ' or whitespace
** (2) z[] is not the same as the NULL rendering
** (3) z[] does not looks like a numeric literal
*/
static int qrfRelaxable(Qrf *p, const char *z){
size_t i, n;
if( z[0]=='\'' || qrfSpace(z[0]) ) return 0;
if( z[0]==0 && (p->spec.zNull==0 || p->spec.zNull[0]==0) ) return 0;
n = strlen(z);
if( z[n-1]=='\'' || qrfSpace(z[n-1]) ) return 0;
if( p->spec.zNull && strcmp(p->spec.zNull,z)==0 ) return 0;
i = (z[0]=='-' || z[0]=='+');
if( strcmp(z+i,"Inf")==0 ) return 0;
if( !qrfDigit(z[i]) ) return 1;
i++;
while( qrfDigit(z[i]) ){ i++; }
if( z[i]==0 ) return 0;
if( z[i]=='.' ){
i++;
while( qrfDigit(z[i]) ){ i++; }
if( z[i]==0 ) return 0;
}
if( z[i]=='e' || z[i]=='E' ){
i++;
if( z[i]=='+' || z[i]=='-' ){ i++; }
if( !qrfDigit(z[i]) ) return 1;
i++;
while( qrfDigit(z[i]) ){ i++; }
}
return z[i]!=0;
}
/*
** If a field contains any character identified by a 1 in the following
** array, then the string must be quoted for CSV.
@@ -780,12 +722,6 @@ static const char qrfCsvQuote[] = {
static void qrfEncodeText(Qrf *p, sqlite3_str *pOut, const char *zTxt){
int iStart = sqlite3_str_length(pOut);
switch( p->spec.eText ){
case QRF_TEXT_Relaxed:
if( qrfRelaxable(p, zTxt) ){
sqlite3_str_appendall(pOut, zTxt);
break;
}
deliberate_fall_through; /* FALLTHRU */
case QRF_TEXT_Sql: {
if( p->spec.eEsc==QRF_ESC_Off ){
sqlite3_str_appendf(pOut, "%Q", zTxt);
@@ -1047,11 +983,6 @@ static void qrfRenderValue(Qrf *p, sqlite3_str *pOut, int iCol){
}
break;
}
case QRF_BLOB_Size: {
int nBlob = sqlite3_column_bytes(p->pStmt,iCol);
sqlite3_str_appendf(pOut, "(%d-byte blob)", nBlob);
break;
}
default: {
const char *zTxt = (const char*)sqlite3_column_text(p->pStmt,iCol);
qrfEncodeText(p, pOut, zTxt);
@@ -1060,7 +991,11 @@ static void qrfRenderValue(Qrf *p, sqlite3_str *pOut, int iCol){
break;
}
case SQLITE_NULL: {
sqlite3_str_appendall(pOut, p->spec.zNull);
if( p->spec.bTextNull==QRF_Yes ){
qrfEncodeText(p, pOut, p->spec.zNull);
}else{
sqlite3_str_appendall(pOut, p->spec.zNull);
}
break;
}
case SQLITE_TEXT: {
@@ -1195,15 +1130,15 @@ static void qrfWrapLine(
const unsigned char *z = (const unsigned char*)zIn;
unsigned char c = 0;
if( z[0]==0 ){
if( zIn[0]==0 ){
*pnThis = 0;
*pnWide = 0;
*piNext = 0;
return;
}
n = 0;
for(i=0; n<=w; i++){
c = z[i];
for(i=0; n<w; i++){
c = zIn[i];
if( c>=0xc0 ){
int u;
int len = sqlite3_qrf_decode_utf8(&z[i], &u);
@@ -1214,12 +1149,11 @@ static void qrfWrapLine(
continue;
}
if( c>=' ' ){
if( n==w ) break;
n++;
continue;
}
if( c==0 || c=='\n' ) break;
if( c=='\r' && z[i+1]=='\n' ){ c = z[++i]; break; }
if( c=='\r' && zIn[i+1]=='\n' ){ c = zIn[++i]; break; }
if( c=='\t' ){
int wcw = 8 - (n&7);
if( n+wcw>w ) break;
@@ -1228,8 +1162,6 @@ static void qrfWrapLine(
}
if( c==0x1b && (k = qrfIsVt100(&z[i]))>0 ){
i += k-1;
}else if( n==w ){
break;
}else{
n++;
}
@@ -1329,6 +1261,36 @@ static void qrfAppendWithTabs(
sqlite3_str_append(pOut, (const char*)z, i);
}
/*
** Output horizontally justified text into pOut. The text is the
** first nVal bytes of zVal. Include nWS bytes of whitespace, either
** split between both sides, or on the left, or on the right, depending
** on eAlign.
*/
static void qrfPrintAligned(
sqlite3_str *pOut, /* Append text here */
const char *zVal, /* Text to append */
int nVal, /* Use only the first nVal bytes of zVal[] */
int nWS, /* Whitespace for horizonal alignment */
unsigned char eAlign /* Alignment type */
){
eAlign &= QRF_ALIGN_HMASK;
if( eAlign==QRF_ALIGN_Center ){
/* Center the text */
sqlite3_str_appendchar(pOut, nWS/2, ' ');
qrfAppendWithTabs(pOut, zVal, nVal);
sqlite3_str_appendchar(pOut, nWS - nWS/2, ' ');
}else if( eAlign==QRF_ALIGN_Right){
/* Right justify the text */
sqlite3_str_appendchar(pOut, nWS, ' ');
qrfAppendWithTabs(pOut, zVal, nVal);
}else{
/* Left justify the next */
qrfAppendWithTabs(pOut, zVal, nVal);
sqlite3_str_appendchar(pOut, nWS, ' ');
}
}
/*
** GCC does not define the offsetof() macro so we'll have to do it
** ourselves.
@@ -1352,47 +1314,15 @@ struct qrfColData {
sqlite3_int64 n; /* Number of cells. nCol*nRow */
char **az; /* Content of all cells */
int *aiWth; /* Width of each cell */
unsigned char *abNum; /* True for each numeric cell */
struct qrfPerCol { /* Per-column data */
char *z; /* Cache of text for current row */
int w; /* Computed width of this column */
int mxW; /* Maximum natural (unwrapped) width */
unsigned char e; /* Alignment */
unsigned char fx; /* Width is fixed */
unsigned char bNum; /* True if is numeric */
} *a; /* One per column */
};
/*
** Output horizontally justified text into pOut. The text is the
** first nVal bytes of zVal. Include nWS bytes of whitespace, either
** split between both sides, or on the left, or on the right, depending
** on eAlign.
*/
static void qrfPrintAligned(
sqlite3_str *pOut, /* Append text here */
struct qrfPerCol *pCol, /* Information about the text to print */
int nVal, /* Use only the first nVal bytes of zVal[] */
int nWS /* Whitespace for horizonal alignment */
){
unsigned char eAlign = pCol->e & QRF_ALIGN_HMASK;
if( eAlign==QRF_Auto && pCol->bNum ) eAlign = QRF_ALIGN_Right;
if( eAlign==QRF_ALIGN_Center ){
/* Center the text */
sqlite3_str_appendchar(pOut, nWS/2, ' ');
qrfAppendWithTabs(pOut, pCol->z, nVal);
sqlite3_str_appendchar(pOut, nWS - nWS/2, ' ');
}else if( eAlign==QRF_ALIGN_Right ){
/* Right justify the text */
sqlite3_str_appendchar(pOut, nWS, ' ');
qrfAppendWithTabs(pOut, pCol->z, nVal);
}else{
/* Left justify the text */
qrfAppendWithTabs(pOut, pCol->z, nVal);
sqlite3_str_appendchar(pOut, nWS, ' ');
}
}
/*
** Free all the memory allocates in the qrfColData object
*/
@@ -1401,7 +1331,6 @@ static void qrfColDataFree(qrfColData *p){
for(i=0; i<p->n; i++) sqlite3_free(p->az[i]);
sqlite3_free(p->az);
sqlite3_free(p->aiWth);
sqlite3_free(p->abNum);
sqlite3_free(p->a);
memset(p, 0, sizeof(*p));
}
@@ -1413,7 +1342,6 @@ static void qrfColDataFree(qrfColData *p){
static int qrfColDataEnlarge(qrfColData *p){
char **azData;
int *aiWth;
unsigned char *abNum;
p->nAlloc = 2*p->nAlloc + 10*p->nCol;
azData = sqlite3_realloc64(p->az, p->nAlloc*sizeof(char*));
if( azData==0 ){
@@ -1429,13 +1357,6 @@ static int qrfColDataEnlarge(qrfColData *p){
return 1;
}
p->aiWth = aiWth;
abNum = sqlite3_realloc64(p->abNum, p->nAlloc);
if( abNum==0 ){
qrfOom(p->p);
qrfColDataFree(p);
return 1;
}
p->abNum = abNum;
return 0;
}
@@ -1445,18 +1366,13 @@ static int qrfColDataEnlarge(qrfColData *p){
static void qrfRowSeparator(sqlite3_str *pOut, qrfColData *p, char cSep){
int i;
if( p->nCol>0 ){
int useBorder = p->p->spec.bBorder!=QRF_No;
if( useBorder ){
sqlite3_str_append(pOut, &cSep, 1);
}
sqlite3_str_append(pOut, &cSep, 1);
sqlite3_str_appendchar(pOut, p->a[0].w+p->nMargin, '-');
for(i=1; i<p->nCol; i++){
sqlite3_str_append(pOut, &cSep, 1);
sqlite3_str_appendchar(pOut, p->a[i].w+p->nMargin, '-');
}
if( useBorder ){
sqlite3_str_append(pOut, &cSep, 1);
}
sqlite3_str_append(pOut, &cSep, 1);
}
sqlite3_str_append(pOut, "\n", 1);
}
@@ -1486,33 +1402,20 @@ static void qrfRowSeparator(sqlite3_str *pOut, qrfColData *p, char cSep){
#define BOX_124 "\342\224\264" /* U+2534 -'- */
#define BOX_1234 "\342\224\274" /* U+253c -|- */
/* Rounded corners: */
#define BOX_R12 "\342\225\260" /* U+2570 '- */
#define BOX_R23 "\342\225\255" /* U+256d ,- */
#define BOX_R34 "\342\225\256" /* U+256e -, */
#define BOX_R14 "\342\225\257" /* U+256f -' */
/* Doubled horizontal lines: */
#define DBL_24 "\342\225\220" /* U+2550 === */
#define DBL_123 "\342\225\236" /* U+255e |= */
#define DBL_134 "\342\225\241" /* U+2561 =| */
#define DBL_1234 "\342\225\252" /* U+256a =|= */
/* Draw horizontal line N characters long using unicode box
** characters
*/
static void qrfBoxLine(sqlite3_str *pOut, int N, int bDbl){
const char *azDash[2] = {
BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24,
DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24 DBL_24
};/* 0 1 2 3 4 5 6 7 8 9 */
const int nDash = 30;
static void qrfBoxLine(sqlite3_str *pOut, int N){
const char zDash[] =
BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24
BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24;
const int nDash = sizeof(zDash) - 1;
N *= 3;
while( N>nDash ){
sqlite3_str_append(pOut, azDash[bDbl], nDash);
sqlite3_str_append(pOut, zDash, nDash);
N -= nDash;
}
sqlite3_str_append(pOut, azDash[bDbl], N);
sqlite3_str_append(pOut, zDash, N);
}
/*
@@ -1523,23 +1426,17 @@ static void qrfBoxSeparator(
qrfColData *p,
const char *zSep1,
const char *zSep2,
const char *zSep3,
int bDbl
const char *zSep3
){
int i;
if( p->nCol>0 ){
int useBorder = p->p->spec.bBorder!=QRF_No;
if( useBorder ){
sqlite3_str_appendall(pOut, zSep1);
}
qrfBoxLine(pOut, p->a[0].w+p->nMargin, bDbl);
sqlite3_str_appendall(pOut, zSep1);
qrfBoxLine(pOut, p->a[0].w+p->nMargin);
for(i=1; i<p->nCol; i++){
sqlite3_str_appendall(pOut, zSep2);
qrfBoxLine(pOut, p->a[i].w+p->nMargin, bDbl);
}
if( useBorder ){
sqlite3_str_appendall(pOut, zSep3);
qrfBoxLine(pOut, p->a[i].w+p->nMargin);
}
sqlite3_str_appendall(pOut, zSep3);
}
sqlite3_str_append(pOut, "\n", 1);
}
@@ -1622,7 +1519,6 @@ static void qrfSplitColumn(qrfColData *pData, Qrf *p){
int *aw = 0;
char **az = 0;
int *aiWth = 0;
unsigned char *abNum = 0;
int nColNext = 2;
int w;
struct qrfPerCol *a = 0;
@@ -1661,18 +1557,9 @@ static void qrfSplitColumn(qrfColData *pData, Qrf *p){
qrfOom(p);
return;
}
abNum = sqlite3_malloc64( nRow*nCol );
if( abNum==0 ){
sqlite3_free(az);
sqlite3_free(aiWth);
sqlite3_free(a);
qrfOom(p);
return;
}
for(i=0; i<pData->n; i++){
sqlite3_int64 j = (i%nRow)*nCol + (i/nRow);
az[j] = pData->az[i];
abNum[j]= pData->abNum[i];
pData->az[i] = 0;
aiWth[j] = pData->aiWth[i];
}
@@ -1681,7 +1568,6 @@ static void qrfSplitColumn(qrfColData *pData, Qrf *p){
az[j] = sqlite3_mprintf("");
if( az[j]==0 ) qrfOom(p);
aiWth[j] = 0;
abNum[j] = 0;
i++;
}
for(i=0; i<nCol; i++){
@@ -1691,12 +1577,10 @@ static void qrfSplitColumn(qrfColData *pData, Qrf *p){
sqlite3_free(pData->az);
sqlite3_free(pData->aiWth);
sqlite3_free(pData->a);
sqlite3_free(pData->abNum);
sqlite3_free(aw);
pData->az = az;
pData->aiWth = aiWth;
pData->a = a;
pData->abNum = abNum;
pData->nCol = nCol;
pData->n = pData->nAlloc = nRow*nCol;
for(i=w=0; i<nCol; i++) w += a[i].w;
@@ -1720,7 +1604,6 @@ static void qrfRestrictScreenWidth(qrfColData *pData, Qrf *p){
sepW = pData->nCol*2 - 2;
}else{
sepW = pData->nCol*3 + 1;
if( p->spec.bBorder==QRF_No ) sepW -= 2;
}
nCol = pData->nCol;
for(i=sumW=0; i<nCol; i++) sumW += pData->a[i].w;
@@ -1732,7 +1615,6 @@ static void qrfRestrictScreenWidth(qrfColData *pData, Qrf *p){
sepW = pData->nCol - 1;
}else{
sepW = pData->nCol + 1;
if( p->spec.bBorder==QRF_No ) sepW -= 2;
}
targetW = p->spec.nScreenWidth - sepW;
@@ -1805,7 +1687,6 @@ static void qrfColumnar(Qrf *p){
/* Initialize the data container */
memset(&data, 0, sizeof(data));
data.nCol = p->nCol;
data.p = p;
data.a = sqlite3_malloc64( nColumn*sizeof(struct qrfPerCol) );
if( data.a==0 ){
qrfOom(p);
@@ -1819,7 +1700,6 @@ static void qrfColumnar(Qrf *p){
if( p->spec.bTitles==QRF_Yes ){
unsigned char saved_eText = p->spec.eText;
p->spec.eText = p->spec.eTitle;
memset(data.abNum, 0, nColumn);
for(i=0; i<nColumn; i++){
const char *z = (const char*)sqlite3_column_name(p->pStmt,i);
int nNL = 0;
@@ -1844,12 +1724,10 @@ static void qrfColumnar(Qrf *p){
char *z;
int nNL = 0;
int n, w;
int eType = sqlite3_column_type(p->pStmt,i);
pStr = sqlite3_str_new(p->db);
qrfRenderValue(p, pStr, i);
n = sqlite3_str_length(pStr);
z = data.az[data.n] = sqlite3_str_finish(pStr);
data.abNum[data.n] = eType==SQLITE_INTEGER || eType==SQLITE_FLOAT;
data.aiWth[data.n] = w = qrfDisplayWidth(z, n, &nNL);
data.n++;
if( w>data.a[i].mxW ) data.a[i].mxW = w;
@@ -1939,12 +1817,7 @@ static void qrfColumnar(Qrf *p){
colSep = BOX_13;
rowSep = BOX_13 "\n";
}
if( p->spec.bBorder==QRF_No){
rowStart += 3;
rowSep = "\n";
}else{
qrfBoxSeparator(p->pOut, &data, BOX_R23, BOX_234, BOX_R34, 0);
}
qrfBoxSeparator(p->pOut, &data, BOX_23, BOX_234, BOX_34);
break;
case QRF_STYLE_Table:
if( data.nMargin ){
@@ -1956,26 +1829,19 @@ static void qrfColumnar(Qrf *p){
colSep = "|";
rowSep = "|\n";
}
if( p->spec.bBorder==QRF_No ){
rowStart += 1;
rowSep = "\n";
}else{
qrfRowSeparator(p->pOut, &data, '+');
}
qrfRowSeparator(p->pOut, &data, '+');
break;
case QRF_STYLE_Column: {
static const char zSpace[] = " ";
case QRF_STYLE_Column:
rowStart = "";
if( data.nMargin<2 ){
colSep = " ";
}else if( data.nMargin<=5 ){
colSep = &zSpace[5-data.nMargin];
colSep = " " + (5-data.nMargin);
}else{
colSep = zSpace;
colSep = " ";
}
rowSep = "\n";
break;
}
default: /*case QRF_STYLE_Markdown:*/
if( data.nMargin ){
rowStart = "| ";
@@ -1993,15 +1859,7 @@ static void qrfColumnar(Qrf *p){
szColSep = (int)strlen(colSep);
bWW = (p->spec.bWordWrap==QRF_Yes && data.bMultiRow);
if( p->spec.eStyle==QRF_STYLE_Column
|| (p->spec.bBorder==QRF_No
&& (p->spec.eStyle==QRF_STYLE_Box || p->spec.eStyle==QRF_STYLE_Table)
)
){
bRTrim = 1;
}else{
bRTrim = 0;
}
bRTrim = (p->spec.eStyle==QRF_STYLE_Column);
for(i=0; i<data.n; i+=nColumn){
int bMore;
int nRow = 0;
@@ -2010,11 +1868,7 @@ static void qrfColumnar(Qrf *p){
** (if there is a title line) or a row in the body of the table.
** The column number will be j. The row number is i/nColumn.
*/
for(j=0; j<nColumn; j++){
data.a[j].z = data.az[i+j];
if( data.a[j].z==0 ) data.a[j].z = "";
data.a[j].bNum = data.abNum[i+j];
}
for(j=0; j<nColumn; j++){ data.a[j].z = data.az[i+j]; }
do{
sqlite3_str_append(p->pOut, rowStart, szRowStart);
bMore = 0;
@@ -2025,7 +1879,7 @@ static void qrfColumnar(Qrf *p){
int nWS;
qrfWrapLine(data.a[j].z, data.a[j].w, bWW, &nThis, &nWide, &iNext);
nWS = data.a[j].w - nWide;
qrfPrintAligned(p->pOut, &data.a[j], nThis, nWS);
qrfPrintAligned(p->pOut, data.a[j].z, nThis, nWS, data.a[j].e);
data.a[j].z += iNext;
if( data.a[j].z[0]!=0 ){
bMore = 1;
@@ -2047,8 +1901,7 @@ static void qrfColumnar(Qrf *p){
}else{
int nE = 3;
if( nE>data.a[j].w ) nE = data.a[j].w;
data.a[j].z = "...";
qrfPrintAligned(p->pOut, &data.a[j], nE, data.a[j].w-nE);
qrfPrintAligned(p->pOut, "...", nE, data.a[j].w-nE, data.a[j].e);
}
if( j<nColumn-1 ){
sqlite3_str_append(p->pOut, colSep, szColSep);
@@ -2076,10 +1929,8 @@ static void qrfColumnar(Qrf *p){
break;
}
case QRF_STYLE_Box: {
if( isTitleDataSeparator ){
qrfBoxSeparator(p->pOut, &data, DBL_123, DBL_1234, DBL_134, 1);
}else if( data.bMultiRow ){
qrfBoxSeparator(p->pOut, &data, BOX_123, BOX_1234, BOX_134, 0);
if( isTitleDataSeparator || data.bMultiRow ){
qrfBoxSeparator(p->pOut, &data, BOX_123, BOX_1234, BOX_134);
}
break;
}
@@ -2111,15 +1962,13 @@ static void qrfColumnar(Qrf *p){
}
/* Draw the line across the bottom of the table */
if( p->spec.bBorder!=QRF_No ){
switch( p->spec.eStyle ){
case QRF_STYLE_Box:
qrfBoxSeparator(p->pOut, &data, BOX_R12, BOX_124, BOX_R14, 0);
break;
case QRF_STYLE_Table:
qrfRowSeparator(p->pOut, &data, '+');
break;
}
switch( p->spec.eStyle ){
case QRF_STYLE_Box:
qrfBoxSeparator(p->pOut, &data, BOX_12, BOX_124, BOX_14);
break;
case QRF_STYLE_Table:
qrfRowSeparator(p->pOut, &data, '+');
break;
}
qrfWrite(p);
@@ -2275,7 +2124,7 @@ static void qrfExplain(Qrf *p){
int len;
if( i==nArg-1 ) w = 0;
if( zVal==0 ) zVal = "";
len = (int)sqlite3_qrf_wcswidth(zVal);
len = qrfDisplayLength(zVal);
if( len>w ){
w = len;
zSep = " ";
@@ -2465,7 +2314,7 @@ static void qrfOneSimpleRow(Qrf *p){
int sz;
p->u.sLine.azCol[i] = sqlite3_column_name(p->pStmt, i);
if( p->u.sLine.azCol[i]==0 ) p->u.sLine.azCol[i] = "unknown";
sz = (int)sqlite3_qrf_wcswidth(p->u.sLine.azCol[i]);
sz = qrfDisplayLength(p->u.sLine.azCol[i]);
if( sz > p->u.sLine.mxColWth ) p->u.sLine.mxColWth = sz;
}
}
@@ -2569,11 +2418,6 @@ static void qrfInitialize(
if( p->mxWidth<=0 ) p->mxWidth = QRF_MAX_WIDTH;
p->mxHeight = p->spec.nLineLimit;
if( p->mxHeight<=0 ) p->mxHeight = 2147483647;
if( p->spec.eStyle>QRF_STYLE_Table ) p->spec.eStyle = QRF_Auto;
if( p->spec.eEsc>QRF_ESC_Symbol ) p->spec.eEsc = QRF_Auto;
if( p->spec.eText>QRF_TEXT_Relaxed ) p->spec.eText = QRF_Auto;
if( p->spec.eTitle>QRF_TEXT_Relaxed ) p->spec.eTitle = QRF_Auto;
if( p->spec.eBlob>QRF_BLOB_Size ) p->spec.eBlob = QRF_Auto;
qrf_reinit:
switch( p->spec.eStyle ){
case QRF_Auto: {
@@ -2592,6 +2436,7 @@ qrf_reinit:
case QRF_STYLE_JObject:
case QRF_STYLE_Json: {
p->spec.eText = QRF_TEXT_Json;
p->spec.eBlob = QRF_BLOB_Json;
p->spec.zNull = "null";
break;
}
@@ -2602,6 +2447,7 @@ qrf_reinit:
}
case QRF_STYLE_Insert: {
p->spec.eText = QRF_TEXT_Sql;
p->spec.eBlob = QRF_BLOB_Sql;
p->spec.zNull = "NULL";
if( p->spec.zTableName==0 || p->spec.zTableName[0]==0 ){
p->spec.zTableName = "tab";
@@ -2611,6 +2457,7 @@ qrf_reinit:
case QRF_STYLE_Csv: {
p->spec.eStyle = QRF_STYLE_List;
p->spec.eText = QRF_TEXT_Csv;
p->spec.eBlob = QRF_BLOB_Text;
p->spec.zColumnSep = ",";
p->spec.zRowSep = "\r\n";
p->spec.zNull = "";
@@ -2618,6 +2465,7 @@ qrf_reinit:
}
case QRF_STYLE_Quote: {
p->spec.eText = QRF_TEXT_Sql;
p->spec.eBlob = QRF_BLOB_Sql;
p->spec.zNull = "NULL";
p->spec.zColumnSep = ",";
p->spec.zRowSep = "\n";
+2 -12
View File
@@ -34,10 +34,10 @@ struct sqlite3_qrf_spec {
unsigned char bTitles; /* True to show column names */
unsigned char bWordWrap; /* Try to wrap on word boundaries */
unsigned char bTextJsonb; /* Render JSONB blobs as JSON text */
unsigned char bTextNull; /* Apply eText encoding to zNull[] */
unsigned char eDfltAlign; /* Default alignment, no covered by aAlignment */
unsigned char eTitleAlign; /* Alignment for column headers */
unsigned char bSplitColumn; /* Wrap single-column output into many columns */
unsigned char bBorder; /* Show outer border in Box and Table styles */
short int nWrap; /* Wrap columns wider than this */
short int nScreenWidth; /* Maximum overall table width */
short int nLineLimit; /* Maximum number of lines for any row */
@@ -109,7 +109,6 @@ int sqlite3_format_query_result(
#define QRF_TEXT_Html 4 /* HTML-style quoting */
#define QRF_TEXT_Tcl 5 /* C/Tcl quoting */
#define QRF_TEXT_Json 6 /* JSON quoting */
#define QRF_TEXT_Relaxed 7 /* Relaxed SQL quoting */
/*
** Quoting styles for BLOBs
@@ -121,7 +120,6 @@ int sqlite3_format_query_result(
#define QRF_BLOB_Hex 3 /* Hexadecimal representation */
#define QRF_BLOB_Tcl 4 /* "\000" notation */
#define QRF_BLOB_Json 5 /* A JSON string */
#define QRF_BLOB_Size 6 /* Display the blob size only */
/*
** Control-character escape modes.
@@ -177,21 +175,13 @@ int sqlite3_format_query_result(
** character c. For normal characters, the answer is always 1. But the
** estimate might be 0 or 2 for zero-width and double-width characters.
**
** Different devices display unicode using different widths. So
** Different display devices display unicode using different widths. So
** it is impossible to know that true display width with 100% accuracy.
** Inaccuracies in the width estimates might cause columns to be misaligned.
** Unfortunately, there is nothing we can do about that.
*/
int sqlite3_qrf_wcwidth(int c);
/*
** Return an estimate of the number of display columns used by the
** string in the argument. The width of individual characters is
** determined as for sqlite3_qrf_wcwidth(). VT100 escape code sequences
** are assigned a width of zero.
*/
size_t sqlite3_qrf_wcswidth(const char*);
#ifdef __cplusplus
}
+12 -68
View File
@@ -874,6 +874,7 @@ $(sqlite3-license-version.js): $(bin.version-info) \
awk '/define SQLITE_VERSION/{$$1=""; print "**" $$0}' $(sqlite3.h); \
awk '/define SQLITE_SOURCE_ID/{$$1=""; print "**" $$0}' $(sqlite3.h); \
echo '**'; echo '** Emscripten SDK: $(emcc.version)'; \
echo '**'; echo '** Preprocessed by:'; echo '** @c-pp::ARGV@'; \
echo '*/'; \
} > $@
@@ -996,21 +997,14 @@ endif
# /shell.c
########################################################################
#
# Fiddle-related decls we need before .wasmbuilds is included
#
fiddle.c.in = $(dir.top)/shell.c $(sqlite3-wasm.c)
EXPORTED_FUNCTIONS.fiddle = $(dir.tmp)/EXPORTED_FUNCTIONS.fiddle
$(EXPORTED_FUNCTIONS.fiddle): $(EXPORTED_FUNCTIONS.api.in) \
$(MAKEFILE_LIST) $(bin.c-pp)
@$(call b.mkdir@)
@$(call b.c-pp.shcmd,fiddle,$(EXPORTED_FUNCTIONS.api.in),\
@$(call b.c-pp.shcmd,filter,$(EXPORTED_FUNCTIONS.api.in),\
$@,$(EXPORTED_FUNCTIONS.c-pp.flags) -Dfiddle)
@echo $(logtag.@) $(emo.disk)
emcc.flags.fiddle = \
$(emcc.cflags) $(emcc_opt_full) \
--minify 0 \
@@ -1035,23 +1029,21 @@ emcc.flags.fiddle = \
-USQLITE_WASM_BARE_BONES \
-DSQLITE_SHELL_FIDDLE
clean: clean-fiddle
clean-fiddle:
rm -f $(dir.fiddle)/fiddle-module.js \
$(dir.fiddle)/*.wasm \
$(dir.fiddle)/sqlite3-opfs-*.js \
$(dir.fiddle)/*.gz \
$(EXPORTED_FUNCTIONS.fiddle)
rm -fr $(dir.fiddle-debug)
emcc.flags.fiddle.debug = $(emcc.flags.fiddle) \
-DSQLITE_DEBUG \
-DSQLITE_ENABLE_SELECTTRACE \
-DSQLITE_ENABLE_WHERETRACE
clean: clean-fiddle
clean-fiddle:
rm -f $(dir.fiddle)/fiddle-module.js \
$(dir.fiddle)/*.wasm \
$(dir.fiddle)/sqlite3-opfs-*.js \
$(dir.fiddle)/*.gz \
$(dir.fiddle)/index.html \
$(EXPORTED_FUNCTIONS.fiddle)
rm -fr $(dir.fiddle-debug)
distclean: distclean-fiddle
distclean-fiddle:
rm -fr $(dir.fiddle)/jqterm
fiddle.c.in = $(dir.top)/shell.c $(sqlite3-wasm.c)
#
# WASMFS build - unsupported and untested. We used WASMFS
@@ -1380,54 +1372,6 @@ all: tester1
# end tester1
#
#
# jquery.terminal support for fiddle:
#
# If a clone of https://github.com/jcubic/jquery.terminal
# is found in $(JQTERM), defaulting to $(HOME)/src/jquery.terminal
# then add jquery.terminal support to fiddle.
#
# To build that package, from its checkout dir:
#
# npm install
# make
#
c-pp.D.fiddle ?=
JQTERM ?= $(HOME)/src/jquery.terminal
dir.jqtermExt = $(firstword $(wildcard $(JQTERM)))
#$(info dir.jqtermExt=$(dir.jqtermExt))
ifeq (0,$(MAKING_CLEAN))
ifeq (,$(wildcard $(dir.jqtermExt)/js/jquery.terminal.min.js))
$(info $(emo.magic) To add jquery.terminal support to fiddle, set JQTERM=/path/to/its/built/checkout)
else
$(info $(emo.magic) jquery.terminal found in $(dir.jqtermExt) - adding it to fiddle. Make sure it is built!)
dir.jqterm = $(dir.fiddle)/jqterm
$(dir.fiddle)/jqterm/jquery.terminal.bundle.min.js:
@$(call b.mkdir@)
cat $(dir.jqtermExt)/js/jquery-1*.min.js \
$(dir.jqtermExt)/js/jquery.terminal.min.js > $@
$(dir.fiddle)/jqterm/jquery.terminal.min.css: $(dir.jqtermExt)/css/jquery.terminal.min.css
@$(call b.mkdir@)
@$(call b.cp,fiddle,$<,$(dir $@))
$(dir.fiddle)/index.html: $(dir.fiddle)/jqterm/jquery.terminal.bundle.min.js \
$(dir.fiddle)/jqterm/jquery.terminal.min.css
c-pp.D.fiddle += -Djqterm
endif
endif
# ^^^ JQTERM/MAKING_CLEAN
#
# Generate fiddle/index.html. Must come after JQTERM is handled.
#
$(dir.fiddle)/index.html: $(dir.fiddle)/index.c-pp.html
$(eval $(call b.c-pp.target,fiddle,\
$(dir.fiddle)/index.c-pp.html,$(dir.fiddle)/index.html,$(c-pp.D.fiddle)))
$(out.fiddle.wasm): $(dir.fiddle)/index.html
#
# Convenience rules to rebuild with various -Ox levels. Much
# experimentation shows -O2 to be the clear winner in terms of speed.
+3 -3
View File
@@ -62,7 +62,7 @@ by concatenating the following files together in their listed order:
- **`sqlite3-api-prologue.js`**
Contains the initial bootstrap setup of the sqlite3 API
objects. This is exposed as a bootstrapping function so that
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. The bootstrapping function gets removed from the
@@ -116,10 +116,10 @@ by concatenating the following files together in their listed order:
a Promise-based interface into the Worker #1 API. This is
a far user-friendlier way to interface with databases running
in a Worker thread.
- **`sqlite3-vfs-helper.c-pp.js`**
- **`sqlite3-vfs-helper.js`**
Installs the `sqlite3.vfs` namespace, which contain helpers for use
by downstream code which creates `sqlite3_vfs` implementations.
- **`sqlite3-vtab-helper.c-pp.js`**
- **`sqlite3-vtab-helper.js`**
Installs the `sqlite3.vtab` namespace, which contain helpers for use
by downstream code which creates `sqlite3_module` implementations.
- **`sqlite3-vfs-opfs.c-pp.js`**
+1 -1
View File
@@ -18,7 +18,7 @@
This file was preprocessed using:
//#@policy error
@c-pp::argv@
@c-pp::ARGV@
//#@policy off
*/
//#if unsupported-build
+40 -17
View File
@@ -88,8 +88,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
wasm.installFunction('i(ippp)', function(t,c,p,x){
if(capi.SQLITE_TRACE_STMT===t){
// x == SQL, p == sqlite3_stmt*
console.log("SQL TRACE #"+(++this.counter),
'via sqlite3@'+c+'['+capi.sqlite3_db_filename(c,null)+']',
console.log("SQL TRACE #"+(++this.counter)+' via sqlite3@'+c+':',
wasm.cstrToJs(x));
}
}.bind({counter: 0}));
@@ -223,6 +222,32 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
It also accepts those as the first 3 arguments.
*/
const dbCtorHelper = function ctor(...args){
if(!ctor._name2vfs){
/**
Map special filenames which we handle here (instead of in C)
to some helpful metadata...
As of 2022-09-20, the C API supports the names :localStorage:
and :sessionStorage: for kvvfs. However, C code cannot
determine (without embedded JS code, e.g. via Emscripten's
EM_JS()) whether the kvvfs is legal in the current browser
context (namely the main UI thread). In order to help client
code fail early on, instead of it being delayed until they
try to read or write a kvvfs-backed db, we'll check for those
names here and throw if they're not legal in the current
context.
*/
ctor._name2vfs = Object.create(null);
const isWorkerThread = ('function'===typeof importScripts/*===running in worker thread*/)
? (n)=>toss3("VFS",n,"is only available in the main window thread.")
: false;
ctor._name2vfs[':localStorage:'] = {
vfs: 'kvvfs', filename: isWorkerThread || (()=>'local')
};
ctor._name2vfs[':sessionStorage:'] = {
vfs: 'kvvfs', filename: isWorkerThread || (()=>'session')
};
}
const opt = ctor.normalizeArgs(...args);
//sqlite3.config.debug("DB ctor",opt);
let pDb;
@@ -244,6 +269,12 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
sqlite3.config.error("Invalid DB ctor args",opt,arguments);
toss3("Invalid arguments for DB constructor:", arguments, "opts:", opt);
}
let fnJs = wasm.isPtr(fn) ? wasm.cstrToJs(fn) : fn;
const vfsCheck = ctor._name2vfs[fnJs];
if(vfsCheck){
vfsName = vfsCheck.vfs;
fn = fnJs = vfsCheck.filename(fnJs);
}
let oflags = 0;
if( flagsStr.indexOf('c')>=0 ){
oflags |= capi.SQLITE_OPEN_CREATE | capi.SQLITE_OPEN_READWRITE;
@@ -268,15 +299,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
}finally{
wasm.pstack.restore(stack);
}
this.filename =
/* A poor design choice we have to keep: this.filename may be
in the form "file:....?....". It really should have been
sqlite3_db_filename(pDb) but that discrepancy went too long
unnoticed to be able to change without risk of
breakage. DB.dbFilename() can be used to fetch _just_ the
name part.
*/ wasm.isPtr(fn) ? wasm.cstrToJs(fn) : fn;
this.filename = fnJs;
}
__ptrMap.set(this, pDb);
__stmtMap.set(this, Object.create(null));
@@ -367,12 +390,12 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
The given db filename must be resolvable using whatever
filesystem layer (virtual or otherwise) is set up for the default
sqlite3 VFS or a VFS which can resolve it must be specified.
sqlite3 VFS.
The special sqlite3 db names ":memory:" and "" (temporary db)
have their normal special meanings here and need not resolve to
real filenames, but "" uses an on-storage temporary database and
requires that the VFS support that.
Note that the special sqlite3 db names ":memory:" and ""
(temporary db) have their normal special meanings here and need
not resolve to real filenames, but "" uses an on-storage
temporary database and requires that the VFS support that.
The second argument specifies the open/create mode for the
database. It must be string containing a sequence of letters (in
@@ -1107,11 +1130,11 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
sqlite3.config.warn("DB.exec() is propagating exception",opt,e);
throw e;
}*/finally{
wasm.scopedAllocPop(stack);
if(stmt){
__execLock.delete(stmt);
stmt.finalize();
}
wasm.scopedAllocPop(stack);
}
return arg.returnVal();
}/*exec()*/,
+3 -5
View File
@@ -2090,11 +2090,9 @@ globalThis.sqlite3ApiBootstrap = async function sqlite3ApiBootstrap(
delete globalThis.sqlite3ApiBootstrap;
delete sqlite3ApiBootstrap.defaultConfig;
return sqlite3.asyncPostInit().then((s)=>{
if( 'undefined'!==typeof sqlite3InitScriptInfo/* from post-js-header.js */ ){
sqlite3InitScriptInfo.debugModule(
"sqlite3.asyncPostInit() complete", s
);
}
sqlite3InitScriptInfo.debugModule(
"sqlite3.asyncPostInit() complete", sqlite3
);
delete s.asyncPostInit;
delete s.scriptInfo;
delete s.emscripten;
@@ -358,7 +358,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
try{
const [cMsg, n] = wasm.scopedAllocCString(e.message, true);
wasm.cstrncpy(pOut, cMsg, nOut);
if(n > nOut) wasm.poke8(wasm.ptr.add(pOut,nOut,-1), 0);
if(n > nOut) wasm.poke8(pOut + nOut - 1, 0);
}catch(e){
return capi.SQLITE_NOMEM;
}finally{
+1 -1
View File
@@ -2603,7 +2603,7 @@ static int arg_is_flag( char const *zFlag, char const *zArg,
static void define_argv(int argc, char const * const * argv){
sqlite3_str * const s = sqlite3_str_new(g.db);
sqlite3_str_append(s, "c-pp::argv=", 11);
sqlite3_str_append(s, "c-pp::ARGV=", 11);
for( int i = 0; i < argc; ++i ){
if( i ) sqlite3_str_appendchar(s, 1, ' ');
sqlite3_str_appendf(s, "%s", argv[i]);
@@ -5,29 +5,20 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SQLite3 Fiddle</title>
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
//#if jqterm
<!--
To add a terminal-style view using jquery.terminal[^1],
uncomment the following two HTML lines and ensure that these
files are on the web server.
jquery.terminal.bundle.min.js is a concatenation of jquery.min.js from
jquery-bundle.min.js is a concatenation of jquery.min.js from
[^2] and jquery.terminal.min.js from [^1].
jquery.terminal.min.css is from [^1]. Alterntely, jquery-VERSION.min.js
can be found in jquery.terminal's source tree.
Fiddle automatically enables support for this if it's installed.
In the canonical build process, if the JQTERM env var is set
to a dir containing a clone of [^1] then this block gets
enabled and a copy of [^1] is integrated automatically.
jquery.terminal.min.css is from [^1].
[^1]: https://github.com/jcubic/jquery.terminal
[^2]: https://jquery.com
-->
<script src="jqterm/jquery.terminal.bundle.min.js"></script>
<link rel="stylesheet" href="jqterm/jquery.terminal.min.css">
//#endif
<!--script src="jqterm/jqterm-bundle.min.js"></script>
<link rel="stylesheet" href="jqterm/jquery.terminal.min.css"-->
<style>
/* The following styles are for app-level use. */
:root {
-6
View File
@@ -1863,12 +1863,6 @@ mdevtest: srctree-check has_tclsh85
sdevtest: has_tclsh85
$(TCLSH_CMD) $(TOP)/test/testrunner.tcl sdevtest $(TSTRNNR_OPTS)
errors:
$(TCLSH_CMD) $(TOP)/test/testrunner.tcl errors
status:
$(TCLSH_CMD) $(TOP)/test/testrunner.tcl status -d 2
# Like releasetest, except it omits srctree-check and verify-source so
# that it can be used on a modified source tree.
#
-2
View File
@@ -1,2 +0,0 @@
@echo off
nmake /f Makefile.msc %*
+81 -89
View File
@@ -1,13 +1,13 @@
C In\sthe\szipfile\sextension,\sonly\sreturn\sas\smany\sbytes\sas\sInflate\sactually\ngenerated.\s\s[forum:/forumpost/761eac3c82|Forum\spost\s761eac3c82].\nAdjust\s./configure\sso\sthat\sit\sbuilds\szipfile\sinto\stestfixture\sif\sZLIB\nis\savailable,\sso\sthat\stests\sget\srun\son\sunix\splatforms.
D 2025-12-06T20:41:24.037
C In\sthe\sCLI\son\sthe\s".mode"\scommand,\sreplace\sthe\srecently\sadded\s--no-limits\soption\swith\n"--limits\sL,C".\s\sAnd\sadd\s--sw\sas\san\salias\sfor\s--screenwidth.
D 2025-11-24T12:27:18.181
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md 6bc480fc673fb4acbc4094e77edb326267dd460162d7723c7f30bee2d3d9e97d
F Makefile.in 3ce07126d7e87c7464301482e161fdae6a51d0a2aa06b200b8f0000ef4d6163b
F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0
F Makefile.msc cc18f77083ff3b94f8bba823a3759b7a0c0e87ffe8733c8b8dff66371df4e880
F README.md 3fa51fc7ababc32edd175ae8b2986c86d5ea120c1cb1e57c7f7849492d1405ec
F Makefile.msc 8c5ed7173ee4cc3c03ba8e21065128f7ca5292c83d68f3bf971786e21fc6e382
F README.md dae499194b75deed76a13a4a83c82493f2530331882d7dfe5754d63287d3f8f7
F VERSION 74672bfd4c7826c0fc6f84762488a707c52e7d2d94af42ccb0edcc6c74311c41
F art/icon-243x273.gif 9750b734f82fdb3dc43127753d5e6fbf3b62c9f4e136c2fbf573b2f57ea87af5
F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d87031
@@ -18,7 +18,7 @@ F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821
F auto.def 44a0d1bf09d78355fc88251ccbf8e64e6341fd89c11de68a01c3645e53a2bade
F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
F autoconf/Makefile.in 306f500fce8cae9e1af9459f1ac7fe89ce46999594ef3fdc62dc9d7d651fb091
F autoconf/Makefile.msc 5edea0afa71af09f45ab25a6a09d204e8744cbe9f3cf54222502cf9e41aa4325
F autoconf/Makefile.msc 7952ed1fbb824f9421688e6b46d09fc4d5a13decec791a6264be4f65e64dfc08
F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136
F autoconf/README.txt b749816b8452b3af994dc6d607394bef3df1736d7e09359f1087de8439a52807
F autoconf/auto.def 3d994f3a9cc9b712dbce92a5708570ddcf3b988141b6eb738f2ed16127a9f0ac
@@ -33,7 +33,7 @@ F autoconf/tea/teaish.tcl 81feb417e718ed75cdd7e2fdf6771f3da80dae97377a90c4d5b62b
F autoconf/tea/teaish.test.tcl cfe94e1fb79dd078f650295be59843d470125e0cc3a17a1414c1fb8d77f4aea6
F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4
F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e
F autosetup/README.md e8503618f6cb31b692383ca662f6eb9ef4345463f5e3c1fc84a5d6863c7058be
F autosetup/README.md ce0f95980a687bb861bd830b76bc4b48513567be5cf5ee7004f4f3439ffe3841
F autosetup/autosetup b16e44924c197783df67366762dda985b45d49ebc4af15f4054e3ee0e3b65169 x
F autosetup/autosetup-config.guess dfa101c5e8220e864d5e9c72a85e87110df60260d36cb951ad0a85d6d9eaa463 x
F autosetup/autosetup-config.sub a38fb074d0dece01cf919e9fb534a26011608aa8fa606490864295328526cd73 x
@@ -44,10 +44,10 @@ F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795f
F autosetup/cc-shared.tcl 163eda58c14cd662fd8a504bd2ad8a716ef4db7015dc1de0095d5de8dd601a4b
F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f
F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e
F autosetup/jimsh0.c 916bbdf8023fbda9937afae57d81a853d8c2ea00f2320aa27becbc33574f963d
F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049
F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
F autosetup/proj.tcl 6fc14ef82b19b77a95788ffbcfad7989b4e3cb4ce96a21dcb5cf7312f362fba9
F autosetup/sqlite-config.tcl 7463d59c9c5e86ca286ea16fdab943058beb9346110049eca435154795890f71
F autosetup/sqlite-config.tcl 97dc76d332ae3344d02d15c99c57db0ac063537e9133cbee0520d48ba0eddc08
F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
F autosetup/teaish/README.txt b40071e6f8506500a2f7f71d5fc69e0bf87b9d7678dd9da1e5b4d0acbf40b1ca
F autosetup/teaish/core.tcl e014dd95900c7f9a34e8e0f460f47e94841059827bce8b4c49668b0c7ae3f1a0
@@ -97,7 +97,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3
F ext/fts3/fts3_tokenizer1.c c1de4ae28356ad98ccb8b2e3388a7fdcce7607b5523738c9afb6275dab765154
F ext/fts3/fts3_unicode.c de426ff05c1c2e7bce161cf6b706638419c3a1d9c2667de9cb9dc0458c18e226
F ext/fts3/fts3_unicode2.c 416eb7e1e81142703520d284b768ca2751d40e31fa912cae24ba74860532bf0f
F ext/fts3/fts3_write.c 3a412c62e39c72283e34a51ec60c59eee6d684882fea7156b09a9733bd1f10e8
F ext/fts3/fts3_write.c 2bee1c5828f6401adffd07ca64260aeb79d64138958273a56de8fa5e8759a0c1
F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9
F ext/fts3/tool/fts3cov.sh c331d006359456cf6f8f953e37f2b9c7d568f3863f00bb5f7eb87fea4ac01b73
F ext/fts3/tool/fts3view.c 413c346399159df81f86c4928b7c4a455caab73bfbc8cd68f950f632e5751674
@@ -113,7 +113,7 @@ F ext/fts5/fts5_buffer.c f1e6d0324d7c55329d340673befc26681a372a4d36086caa8d1ec7d
F ext/fts5/fts5_config.c e7d8dd062b44a66cd77e5a0f74f23a2354cd1f3f8575afb967b2773c3384f7f8
F ext/fts5/fts5_expr.c b8c32da1127bafaf10d6b4768b0dcb92285798524bed2d87a8686f99a8e8d259
F ext/fts5/fts5_hash.c a6266cedd801ab7964fa9e74ebcdda6d30ec6a96107fa24148ec6b7b5b80f6e0
F ext/fts5/fts5_index.c 5e82963a6691ae519df1e018cc7971272a3da1fd47daca5029af0e9ce24f1a8b
F ext/fts5/fts5_index.c 8dbda33a9830764167d7697f1c9980c8a6ee74f5decb28206b963222583b8cdd
F ext/fts5/fts5_main.c 42025174a556257287071e90516d3ab8115daf1dd525a301883544469a260014
F ext/fts5/fts5_storage.c 19bc7c4cbe1e6a2dd9849ef7d84b5ca1fcbf194cefc3e386b901e00e08bf05c2
F ext/fts5/fts5_tcl.c 7fb5a3d3404099075aaa2457307cb459bbc257c0de3dbd52b1e80a5b503e0329
@@ -122,7 +122,7 @@ F ext/fts5/fts5_test_tok.c 3cb0a9b508b30d17ef025ccddd26ae3dc8ddffbe76c057616e59a
F ext/fts5/fts5_tokenize.c 49aea8cc400a690a6c4f83c4cedc67f4f8830c6789c4ee343404f62bcaebca7b
F ext/fts5/fts5_unicode2.c 536a6dae41d16edadd6a6b58c56e2ebbb133f0dfe757562a2edbcdc9b8362e50
F ext/fts5/fts5_varint.c e64d2113f6e1bfee0032972cffc1207b77af63319746951bf1d09885d1dadf80
F ext/fts5/fts5_vocab.c 23e263ad94ac357cfffd19bd7e001c3f15c4420fb10fa35b5993142127e780e6
F ext/fts5/fts5_vocab.c ff0441c4ea165081e8152dec6d29056faa0cdc281a9f218a00e3d7aacc1958bc
F ext/fts5/fts5parse.y eb526940f892ade5693f22ffd6c4f2702543a9059942772526eac1fde256bb05
F ext/fts5/mkportersteps.tcl 5acf962d2e0074f701620bb5308155fa1e4a63ba
F ext/fts5/test/fts5_common.tcl c5aa7cf7148b6dcffb5b61520ae18212baf169936af734ab265143f59db328fe
@@ -162,7 +162,7 @@ F ext/fts5/test/fts5contentless4.test ec34dc69ef474ca9997dae6d91e072906e0e9a5a4b
F ext/fts5/test/fts5contentless5.test 38cd0392c730dc7090c550321ce3c24ba4c392bc97308b51a4180e9959dca7b5
F ext/fts5/test/fts5corrupt.test 237fce1c3261bb3a5bec333b0f0dbf5b105ec32627ef14cccbda3cfe13833193
F ext/fts5/test/fts5corrupt2.test 4a03a158c2cb617c9f76d26b35c1ef2534124bc0bbddcea38dfd5b170ebea27b
F ext/fts5/test/fts5corrupt3.test e489b51b6c4ded2a808e0f78bdbe126f6d369de41a59ac2717878e37fc3db0e8
F ext/fts5/test/fts5corrupt3.test 43d6a836892d79ab738ab89b3b6f4ae46c07ee966193e4b357bbb14e7f81d5da
F ext/fts5/test/fts5corrupt4.test dc08d19f5b8943e95a7778a7d8da592042504faf18dd93f68f7d7a0d7d7dd733
F ext/fts5/test/fts5corrupt5.test 73985d4fe6d8f0d5d5c7bcf79ae7c6522c376cd6ad710a0ff2f26e0c2e222abe
F ext/fts5/test/fts5corrupt6.test 2d72db743db7b5d9c9a6d0cfef24d799ed1aa5e8192b66c40e871a37ed9eed06
@@ -269,7 +269,7 @@ F ext/fts5/test/fts5update.test b8affd796e45c94a4d19ad5c26606ea06065a0f162a9562d
F ext/fts5/test/fts5update2.test c5baa76799ac605ebb8e5e21035db2014b396cef25c903eb96ba39b1d6f9f046
F ext/fts5/test/fts5version.test 44ab35566267b7618c090443de2d9ad84f633df5d20bf72e9bad199ae5fced84
F ext/fts5/test/fts5vocab.test 2a2bdb60d0998fa3124d541b6d30b019504918dc43a6584645b63a24be72f992
F ext/fts5/test/fts5vocab2.test 4265137a3747b27deb1e2e2bde5654120c6de72bfed3238e67806d85af60fc4c
F ext/fts5/test/fts5vocab2.test bbba149c254375d00055930c1a501c9a51e80b0d20bf7b98f3e9fa3b03786373
F ext/fts5/tool/fts5speed.tcl b0056f91a55b2d1a3684ec05729de92b042e2f85
F ext/fts5/tool/fts5txt2db.tcl c0d43c8590656f8240e622b00957b3a0facc49482411a9fdc2870b45c0c82f9f
F ext/fts5/tool/loadfts5.tcl 95b03429ee6b138645703c6ca192c3ac96eaf093
@@ -372,7 +372,7 @@ F ext/misc/dbdump.c 678f1b9ae2317b4473f65d03132a2482c3f4b08920799ed80feedd2941a0
F ext/misc/decimal.c d4883de142f6dcd36eda23da40b55e2b51374e7b01eb54a7173940191389fc5e
F ext/misc/eval.c 04bc9aada78c888394204b4ed996ab834b99726fb59603b0ee3ed6e049755dc1
F ext/misc/explain.c 606100185fb90d6a1eade1ed0414d53503c86820d8956a06e3b0a56291894f2b
F ext/misc/fileio.c 452300ca34fadafd2bb9eb09557de5a518da1fd2349f9f9cedd22b1566a7164f
F ext/misc/fileio.c 61af623160c073b605b4ff1f67d278c4c348956efa08f6201756577c7a050d17
F ext/misc/fossildelta.c 2fc2dd4f34f478df674887db62586b1071c4cd3c9e73ee40f9ee669670e482d1
F ext/misc/fuzzer.c 6b231352815304ba60d8e9ec2ee73d4918e74d9b76bda8940ba2b64e8777515e
F ext/misc/ieee754.c 176c061c94857b543313959289cb60cf777c999fd002f82b53d194b95e9f347a
@@ -392,7 +392,7 @@ F ext/misc/remember.c add730f0f7e7436cd15ea3fd6a90fd83c3f706ab44169f7f048438b7d6
F ext/misc/rot13.c 51ac5f51e9d5fd811db58a9c23c628ad5f333c173f1fc53c8491a3603d38556c
F ext/misc/scrub.c 2a44b0d44c69584c0580ad2553f6290a307a49df4668941d2812135bfb96a946
F ext/misc/series.c 22c6d8f00cc1b5089b1b37392e9097e9df9a5db53be86daf9a7669d95bb179f4
F ext/misc/sha1.c 3030b5926b34bb09459200e100fae34e48c04077cf175381a7560f72bbf3d9cf
F ext/misc/sha1.c cb5002148c2661b5946f34561701e9105e9d339b713ec8ac057fd888b196dcb9
F ext/misc/shathree.c fd22d70620f86a0467acfdd3acd8435d5cb54eb1e2d9ff36ae44e389826993df
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
F ext/misc/spellfix.c 693c8fd3293087fa821322967a97e59dfa24051e5d2ca7fa85790a4034db6fa4
@@ -414,12 +414,11 @@ F ext/misc/vtablog.c 2d04386c2f5a3bb93bc9ae978f0b7dcd5a264e126abd640dd6d82aa9067
F ext/misc/vtshim.c e5bce24ab8c532f4fdc600148718fe1802cb6ed57417f1c1032d8961f72b0e8f
F ext/misc/wholenumber.c 0fa0c082676b7868bf2fa918e911133f2b349bcdceabd1198bba5f65b4fc0668
F ext/misc/windirent.h 02211ce51f3034c675f2dbf4d228194d51b3ee05734678bad5106fff6292e60c
F ext/misc/zipfile.c d792ed9b936ddfe9a210ecc893352afaee306c63b084187f6e44951f6f669e21
F ext/misc/zipfile.c 09e6e3a3ff40a99677de3c0bc6569bd5f4709b1844ac3d1c1452a456c5a62f1c
F ext/misc/zorder.c bddff2e1b9661a90c95c2a9a9c7ecd8908afab5763256294dd12d609d4664eee
F ext/qrf/README.md 6ee2f6431c8260854f815123c7e14769e77c7d0547424b852ae6216099cfdc50
F ext/qrf/dev-notes.md e68a6d91ce4c7eb296ef2daadc2bb79c95c317ad15b9fafe40850c67b29c2430
F ext/qrf/qrf.c 7fb2c4b600fcba4439a3ce8f7aed95f726f15548ce375b78cd983388a0ecebf7
F ext/qrf/qrf.h 0f0387eb4c56eaa46405cd640132624933377e46df3d2baa940392f9a7d35768
F ext/qrf/README.md dd565fd1ca0c46ea37dbf4d496e368b9ecade768c92669640bc106e039629016
F ext/qrf/qrf.c 7f8498231be49e9fa6290f75c611ccb8658e2d50f0e0dc4207923e59bc63c6f9
F ext/qrf/qrf.h bccc9d1c1b6a05fa0da56332bba29d85782318926f022c849114a63da916393f
F ext/rbu/rbu.c 801450b24eaf14440d8fd20385aacc751d5c9d6123398df41b1b5aa804bf4ce8
F ext/rbu/rbu1.test 25870dd7db7eb5597e2b4d6e29e7a7e095abf332660f67d89959552ce8f8f255
F ext/rbu/rbu10.test 7c22caa32c2ff26983ca8320779a31495a6555737684af7aba3daaf762ef3363
@@ -579,7 +578,7 @@ F ext/session/sessionwor.test 6fd9a2256442cebde5b2284936ae9e0d54bde692d0f5fd009e
F ext/session/sqlite3session.c b3de195ce668cace9b324599bf6255a70290cbfb5451e826e946f3aee6e64c54
F ext/session/sqlite3session.h 7404723606074fcb2afdc6b72c206072cdb2b7d8ba097ca1559174a80bc26f7a
F ext/session/test_session.c 8766b5973a6323934cb51248f621c3dc87ad2a98f023c3cc280d79e7d78d36fb
F ext/wasm/GNUmakefile 2fe52720144ab481755c6df45f46dcf6c540f8622a5387ed280f1d0b26a6d28f
F ext/wasm/GNUmakefile 58b851cb13559027499f25050a8c4a103b4c674d97f2ce4e75f2acc8cb112de7
F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a
F ext/wasm/README.md 2e87804e12c98f1d194b7a06162a88441d33bb443efcfe00dc6565a780d2f259
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
@@ -588,27 +587,27 @@ F ext/wasm/SQLTester/SQLTester.run.mjs 57f2adb33f43f2784abbf8026c1bfd049d8013af1
F ext/wasm/SQLTester/index.html 64f3435084c7d6139b08d1f2a713828a73f68de2ae6a3112cbb5980d991ba06f
F ext/wasm/SQLTester/touint8array.c 2d5ece04ec1393a6a60c4bf96385bda5e1a10ad49f3038b96460fc5e5aa7e536
F ext/wasm/api/EXPORTED_FUNCTIONS.c-pp 7ba933e8f1290cc65459dd371c0c9a031d96bdf14d7a2244fa761d9775117b90
F ext/wasm/api/README.md a905d5c6bfc3e2df875bd391d6d6b7b48d41b43bdee02ad115b47244781a7e81
F ext/wasm/api/README.md aae128e14711dafac29e7b645ff1b6be42305b73f74b1303d8401351f8448631
F ext/wasm/api/extern-post-js.c-pp.js 4b310c9891886e7c1ea4e2419966ff45dfeda825b897fdaa4119332509f7e3d1
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js a50c1a2c4d008aede7b2aa1f18891a7ee71437c2f415b8aeb3db237ddce2935b
F ext/wasm/api/post-js-header.js d24bd0d065f3489c8b78ddf3ead6321e5d047187a162cd503c41700e03dd1f06
F ext/wasm/api/pre-js.c-pp.js d73088472f91856a27837c0588ac355516cea441ff67d2990effc2ca0627bf21
F ext/wasm/api/pre-js.c-pp.js ad2546290e0c8ce5ca2081bff6e85cc25eeb904a3303921f1184290a7ff1b32f
F ext/wasm/api/sqlite3-api-glue.c-pp.js 9b33e3ee467791dec4fd1b444b12a8545dfbb6c8b28ac651c7bdc7661a3b5a5c
F ext/wasm/api/sqlite3-api-oo1.c-pp.js b2fa08dc02a0d852d88c59ce4a77cce3af033982f7eb41eeb81f1ba80f5f1b10
F ext/wasm/api/sqlite3-api-prologue.js fd836265adefbe4ed8a978326e0273bafcfb7d42f754b69a5d131a9031428c9f
F ext/wasm/api/sqlite3-api-oo1.c-pp.js 8ce38bd4b22aa2b0311c7a8e87e748e06213766fe2141de7574672d103ece255
F ext/wasm/api/sqlite3-api-prologue.js 7004b569624765c5132984bfecee2305bef928a6adf44e0202dacc9cbc5c8e2a
F ext/wasm/api/sqlite3-api-worker1.c-pp.js 1041dd645e8e821c082b628cd8d9acf70c667430f9d45167569633ffc7567938
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
F ext/wasm/api/sqlite3-opfs-async-proxy.js 9654b565b346dc609b75d15337f20acfa7af7d9d558da1afeb9b6d8eaa404966
F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d
F ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js f44a4396b2305b27dc81c00a1629fe4f615520f7fb11ed4e606255e365956ba2
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js a2eea6442556867b589e04107796c6e1d04a472219529eeb45b7cd221d7d048b
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js 26cb41d5a62f46a106b6371eb00fef02de3cdbfaa51338ba087a45f53028e0d0
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 88ce2078267a2d1af57525a32d896295f4a8db7664de0e17e82dc9ff006ed8d3
F ext/wasm/api/sqlite3-vtab-helper.c-pp.js 9097074724172e31e56ce20ccd7482259cf72a76124213cbc9469d757676da86
F ext/wasm/api/sqlite3-wasm.c 7778527bdbb241b8e742a5fc50e470e8b8d0529c41fab9ac127c2c63f3c90d47
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bda1c75bd674a92a0e27cc2f3d46dbbf21e422413f8046814515a0bd7409328a
F ext/wasm/api/sqlite3-worker1.c-pp.js 802d69ead8c38dc1be52c83afbfc77e757da8a91a2e159e7ed3ecda8b8dba2e7
F ext/wasm/c-pp-lite.c f38254fba42561728c2e4764a7ba8d68700091e7c2f4418112868c0daba16783
F ext/wasm/c-pp-lite.c 943be1a36774d58385dca32de36fc18d4f432fe79f7aa35e6c85dd6a6b825bd0
F ext/wasm/common/SqliteTestUtil.js 7adaeffef757d8708418dc9190f72df22367b531831775804b31598b44f6aa51
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
F ext/wasm/common/testing.css e97549bab24126c24e0daabfe2de9bb478fb0a69fdb2ddd0a73a992c091aad6f
@@ -626,7 +625,7 @@ F ext/wasm/demo-worker1.js 08720227e98fa5b44761cf6e219269cee3e9dd0421d8d91459535
F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c95839afd8b05862f
F ext/wasm/fiddle/fiddle-worker.js 7798af02e672e088ff192716f80626c8895e19301a65b8af6d5d12b2d13d2451
F ext/wasm/fiddle/fiddle.js 84fd75967e0af8b69d3dd849818342227d0f81d13db92e0dcbc63649b31a4893
F ext/wasm/fiddle/index.c-pp.html 72c7e5517217960b3809648429ea396a7cbad0ffb2c92f6a2f5703abecb27317
F ext/wasm/fiddle/index.html a27b8127ef9ecf19612da93b2a6a73bdb3777b5c56b5450bb7200a94bc108ff9
F ext/wasm/index-dist.html db23748044e286773f2768eec287669501703b5d5f72755e8db73607dc54d290
F ext/wasm/index.html 54e27db740695ab2cb296e02d42c4c66b3f11b65797340d19fa6590f5b287da1
F ext/wasm/jaccwabyt/jaccwabyt.js 4e2b797dc170851c9c530c3567679f4aa509eec0fab73b466d945b00b356574b
@@ -658,8 +657,7 @@ F ext/wasm/tests/opfs/sahpool/index.html be736567fd92d3ecb9754c145755037cbbd2bca
F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36e0f6991460fff0cb7c15079454679a4e2
F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
F main.mk 822f9eda3e689748341597f4327a071c2b0ce41cc3ed477d72f2560b956eb5c0
F make.bat a136fd0b1c93e89854a86d5f4edcf0386d211e5d5ec2434480f6eea436c7420c
F main.mk 27a0769b40a813343f19e8fca2e9d55405f0311cb3cc5327f5702640df0182a0
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
@@ -669,9 +667,9 @@ F mptest/multiwrite01.test dab5c5f8f9534971efce679152c5146da265222d
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 1b9c24374a85dfc7eb8fa7c4266ee0db4f9609cceecfc5481cd8307e5af04366
F sqlite3.pc.in e6dee284fba59ef500092fdc1843df3be8433323a3733c91da96690a50a5b398
F src/alter.c fc36b19273ffe364aeb4d00ba04bda8798ad7a67fec7a035ee8ee56272e1bdbe
F src/alter.c f31437552c733957f19351cdfae8fad8e8f0c7d11041e5b7966aae57206ad91f
F src/analyze.c 03bcfc083fc0cccaa9ded93604e1d4244ea245c17285d463ef6a60425fcb247d
F src/attach.c 7cf07d4fa42b9fc8662237c60c40b730326c30aa90ae5fffc0b18b2d726ebf61
F src/attach.c 9af61b63b10ee702b1594ecd24fb8cea0839cfdb6addee52fba26fa879f5db9d
F src/auth.c 54ab9c6c5803b47c0d45b76ce27eff22a03b4b1f767c5945a3a4eb13aa4c78dc
F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523
F src/bitvec.c e242d4496774dfc88fa278177dd23b607dce369ccafb3f61b41638eea2c9b399
@@ -679,7 +677,7 @@ F src/btmutex.c 30dada73a819a1ef5b7583786370dce1842e12e1ad941e4d05ac29695528daea
F src/btree.c 8850125300b9780fa54bc45a41af88eb2796b90f2f97942279094beef9b0e971
F src/btree.h e823c46d87f63d904d735a24b76146d19f51f04445ea561f71cc3382fd1307f0
F src/btreeInt.h 9c0f9ea5c9b5f4dcaea18111d43efe95f2ac276cd86d770dce10fd99ccc93886
F src/build.c 4e1afafc56504ed6253e1b115c1502de4243c2287a0c799f4967fcd2d7716ad9
F src/build.c 611e07299d72ff04bbcb9e7109183467e30925d203c3e121ef9bb3cf6876289b
F src/callback.c 3605bbf02bd7ed46c79cd48346db4a32fc51d67624400539c0532f4eead804ad
F src/carray.c ff6081a31878fc34df8fa1052a9cbf17ddc22652544dcb3e2326886ed1053b55
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
@@ -687,9 +685,9 @@ F src/date.c e19e0cfff9a41bfdd884c655755f6f00bca4c1a22272b56e0dd6667b7ea893a2
F src/dbpage.c c9ea81c11727f27e02874611e92773e68e2a90a875ef2404b084564c235fd91f
F src/dbstat.c 73362c0df0f40ad5523a6f5501224959d0976757b511299bf892313e79d14f5c
F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42
F src/expr.c b4530f3e23d8ea38c7de4c7b55af52d43156c79128c042a580e670776f59a9bc
F src/expr.c 17b0cbe08e004c1653030f5de9b6b050e84feaa112239f7f576af2dc5e53a5fb
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c c065da737307a29e4d240ac727758dbf4102cb3218a1f651eb689b6a6fa12531
F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f
F src/func.c 0b802107498048d3dcac0b757720bcb8506507ce02159e213ab8161458eb293b
F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b
F src/hash.c 03c8c0f4be9e8bcb6de65aa26d34a61d48a9430747084a69f9469fbb00ea52ca
@@ -700,7 +698,7 @@ F src/insert.c dfd311b0ac2d4f6359e62013db67799757f4d2cc56cca5c10f4888acfbbfa3fd
F src/json.c fb031340edee159c07ad37dbe668ffe945ed86f525b0eb3822e4a67cbc498a72
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 4747f72084dc80520a2d23e5bb0bc0760672208a81a2b115ce0b657acd65edf4
F src/main.c 8ee5d36123330e7a6a8ef3acd6c05cdc254d6d4ef6ca2e472c702ac1ee9a5617
F src/main.c c99e86fd7dc6c8c2c0f67395562e3300bca2780b845db9bdc2bdac6acf13c6aa
F src/malloc.c 410e570b30c26cc36e3372577df50f7a96ee3eed5b2b161c6b6b48773c650c5e
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2
@@ -714,19 +712,19 @@ F src/mutex.c 06bcd9c3dbf2d9b21fcd182606c00fafb9bfe0287983c8e17acd13d2c81a2fa9
F src/mutex.h a7b2293c48db5f27007c3bdb21d438873637d12658f5a0bf8ad025bb96803c4a
F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4
F src/mutex_unix.c f7ee5a2061a4c11815a2bf4fc0e2bfa6fb8d9dc89390eb613ca0cec32fc9a3d1
F src/mutex_w32.c e1d317d29cb623667d43de94714264d1e1871cc4bb39fa67dd17048e8138c739
F src/mutex_w32.c 28f8d480387db5b2ef5248705dd4e19db0cfc12c3ba426695a7d2c45c48e6885
F src/notify.c 57c2d1a2805d6dee32acd5d250d928ab94e02d76369ae057dee7d445fd64e878
F src/os.c 509452169d5ea739723e213b8e2481cf0e587f0e88579a912d200db5269f5f6d
F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06
F src/os_kv.c fb7ba8d6204197357f1eb7e1c7450d09c10043bf7e99aba602f4aa46b8fb11a3
F src/os_setup.h 8efc64eda6a6c2f221387eefc2e7e45fd5a3d5c8337a7a83519ba4fbd2957ae2
F src/os_unix.c dcf7988ddbdd68619b821c9a722f9377abb46f1d26c9279eb5a50402fd43d749
F src/os_win.c 7eb8a49b18ac8bbd0b8e31bf346469074b65d4cebd6ff7259d07190d0853b534
F src/os_win.h 5e168adf482484327195d10f9c3bce3520f598e04e07ffe62c9c5a8067c1037b
F src/pager.c a81461de271ac4886ad75b7ca2cca8157a48635820c4646cd2714acdc2c17e5f
F src/os_unix.c bf55d195730393a9faf31dcec65257710c61f61a728342151af06a8267ffb35d
F src/os_win.c a89b501fc195085c7d6c9eec7f5bd782625e94bb2a96b000f4d009703df1083f
F src/os_win.h 4c247cdb6d407c75186c94a1e84d5a22cbae4adcec93fcae8d2bc1f956fd1f19
F src/pager.c 52bae5ea11f25cbdc425be7b0a8c3310b3ec2a1381e73b5d5b6af20c26094108
F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8
F src/parse.y 7c2184b5665c671258c4e96a10bbc9dbf7e1ede462ebc4e614249de0d54c8a26
F src/parse.y 424d195ea70f4656a3f6440e0b79ca8f712ae4da9431033a19ec8c9816469287
F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484
F src/pcache.h 1497ce1b823cf00094bb0cf3bac37b345937e6f910890c626b16512316d3abf5
F src/pcache1.c 131ca0daf4e66b4608d2945ae76d6ed90de3f60539afbd5ef9ec65667a5f2fcd
@@ -734,18 +732,18 @@ F src/pragma.c ecec75795c1821520266e4f93fa8840cce48979af532db06f085e36a7813860f
F src/prepare.c f6a6e28a281bd1d1da12f47d370a81af46159b40f73bf7fa0b276b664f9c8b7d
F src/printf.c b1b29b5e58e1530d5daeee5963d3c318d8ab2d7e38437580e28755753e0c1ded
F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
F src/resolve.c 8d53771eb51a4ab5f970150c3a70969d8db79cd04a8774c2d296bbcf471a0dd0
F src/resolve.c 5616fbcf3b833c7c705b24371828215ad0925d0c0073216c4f153348d5753f0a
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c 344518c1bba9c4636bf651b7642304abd2e7075ba35feb4bae42a51e5efe991f
F src/shell.c.in 5eb15c585bd49b8cce88e762353a92b470b99a95e459bb434da41576a4f1b6eb
F src/sqlite.h.in 706cacea5308b0244fb6cec92e08310fb427a125375c64137cc1f878ae4cf5c0
F src/select.c ba9cd07ffa3277883c1986085f6ddc4320f4d35d5f212ab58df79a7ecc1a576a
F src/shell.c.in bc2185e0e988f93643dbaac3c8f190b3687475cd7ac802c035d20347b8e27fbb
F src/sqlite.h.in b5b2450724c9aa2d7ae2861c881385bc21ba940c79122c893f5ae9bb36ad10dd
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 5d5330f5f8461f5ce74960436ddcfa53ecd09c2b8b23901e22ae38aec3243998
F src/sqliteInt.h af67bc95fa6b66cd3c7f3d18d2d040ad386e4cbb02965ee318cc721ee9d5fa45
F src/sqliteLimit.h 7e705474d59912388832cc5465edbc0dbb552872e23452812846e90d280987f3
F src/sqliteInt.h a89c3a9296928dffcb4c287df176a739f9cf620c7c9d33aec59e8efb9b39cbbd
F src/sqliteLimit.h 0a5516b4ec192a205c541e05f67009028a9451dc6678aae4cf8e68596903c246
F src/status.c 7565d63a79aa2f326339a24a0461a60096d0bd2bce711fefb50b5c89335f3592
F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
F src/tclsqlite.c 1411438584e8e08c0959e6341acb0487039de662dab223ae0fef26d361211b6e
F src/tclsqlite.c f5aca78b32b2ba823a6dc7dbb9b2272c93e0f71df2f93104d5a61a6348f3b115
F src/tclsqlite.h 614b3780a62522bc9f8f2b9fb22689e8009958e7aa77e572d0f3149050af348a
F src/test1.c 0e71fbcb484a271564e98e0158192c28c24f5521594218c3ba48bcb4cf634f91
F src/test2.c 62f0830958f9075692c29c6de51b495ae8969e1bef85f239ffcd9ba5fb44a5ff
@@ -760,7 +758,7 @@ F src/test_backup.c a2bfd90d2ff2511b8635507bdb30fa9b605ade19c16b533066cae3077f5b
F src/test_bestindex.c d75fad21369d80910238032bcf8d9ca1f2bffda13c1ceec63bfbb7f704448b15
F src/test_blob.c 77b994e17f2c87055f44fd96c9a206c5a7155bae2cda2769af60c2f3582f962c
F src/test_btree.c 28283787d32b8fa953eb77412ad0de2c9895260e4e5bd5a94b3c7411664f90d5
F src/test_config.c 9b6dac5bc4ab56c9c6289ca9a6a73a156e178e58bcfdac19a69f6e17e28ad5ac
F src/test_config.c 18aa596d37de1d5968c439fd58ebf38bc4d9c9d1db63621504e241fde375cecd
F src/test_delete.c d0e8f6dc55cfc98a7c27c057fb88d512260564bf0b611482656c68b8f7f401ed
F src/test_demovfs.c 3efa2adf4f21e10d95521721687d5ca047aea91fa62dd8cc22ac9e5a9c942383
F src/test_devsym.c 649434ed34d0b03fbd5a6b42df80f0f9a7e53f94dd1710aad5dd8831e91c4e86
@@ -777,10 +775,10 @@ F src/test_md5.c 811a45330c9391933360f998156a8907ee29909c828ab83ac05d329942cbea8
F src/test_multiplex.c 82f0aa8eee629b6949782cfab8782ed35a9b56dc80d12877af52147f304d22b8
F src/test_multiplex.h f0ff5b6f4462bfd46dac165d6375b9530d08089b7bcbe75e88e0926110db5363
F src/test_mutex.c dacae6790956c0d4e705aaed2090227792e291b0496cccd688e9994c1e21f740
F src/test_onefile.c f31e52e891c5fef6709b9fcef54ce660648a34172423a9cbdf4cbce3ba0049f4
F src/test_onefile.c f52ae709489837863521e6e0e1a8965b6716d45f784445b98641b6ce0fc2137b
F src/test_osinst.c 269039d9c0820a02ee928014c30860d57ee757ecda54df42e463d0ca1377b835
F src/test_pcache.c 496da3f7e2ca66aefbc36bbf22138b1eff43ba0dff175c228b760fa020a37bd0
F src/test_quota.c 5bb44452b9c6c248bb3c82d2466a20915aa6d12801f6c1784b6499aaa04d9811
F src/test_quota.c 180e87437250bed7e17e4e61c106730939e39fec9be73d28961f27f579a92078
F src/test_quota.h 2a8ad1952d1d2ca9af0ce0465e56e6c023b5e15d
F src/test_rtree.c d844d746a3cc027247318b970025a927f14772339c991f40e7911583ea5ed0d9
F src/test_schema.c b06d3ddc3edc173c143878f3edb869dd200d57d918ae2f38820534f9a5e3d7d9
@@ -791,13 +789,13 @@ F src/test_tclsh.c c01706ac60bd3176754d3ccd37da74c6ad97c2e14489f8ed71b497c1c0ac0
F src/test_tclvar.c ae873248a0188459b1c16ca7cc431265dacce524399e8b46725c2b3b7e048424
F src/test_thread.c 3edb4a5b5aeb1a6e9a275dccc848ac95acab7f496b3e9230f6d2d04953a2b862
F src/test_vdbecov.c 5c426d9cd2b351f5f9ceb30cabf8c64a63bfcad644c507e0bd9ce2f6ae1a3bf3
F src/test_vfs.c b4135c1308516adf0dfd494e6d6c33114e03732be899eace0502919b674586b5
F src/test_vfs.c 7b06f2f82584a9e723e62cb6894d60d21dc4cd9bcd02d6de976e5434e5d60a30
F src/test_window.c 6d80e11fba89a1796525e6f0048ff0c7789aa2c6b0b11c80827dc1437bd8ea72
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c ca1382f02a3990d1a770acd5c55731dee10cd644465b2855eca33e4d2ea299ed
F src/tokenize.c cb3294cf23c11106b50d9af6998a6c1bf389b52e15b17698c9fab97bbaa9b37f
F src/treeview.c 3ce7ac9835d2d70cc1c868b01b747ae8a062322e155701e58e3d62ca79aada7a
F src/trigger.c 96e5ceb7461b0c469a6e155feb00f39b992b6205f3f5118d01905f45f8234372
F src/trigger.c d5cf2541ff048f30b6a0507eb3d1ec4e695c53584e3b2298a5bf248714fe185e
F src/update.c 3e5e7ff66fa19ebe4d1b113d480639a24cc1175adbefabbd1a948a07f28e37cf
F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1
F src/utf.c 7267c3fb9e2467020507601af3354c2446c61f444387e094c779dccd5ca62165
@@ -818,11 +816,11 @@ F src/vxworks.h 9d18819c5235b49c2340a8a4d48195ec5d5afb637b152406de95a9436beeaeab
F src/wal.c 505a98fbc599a971d92cb90371cf54546c404cd61e04fd093e7b0c8ff978f9b6
F src/wal.h ba252daaa94f889f4b2c17c027e823d9be47ce39da1d3799886bbd51f0490452
F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014
F src/where.c 287324fe73a0ae8e55b3be89bb2fe4148e3a8394e1e2f10ed2113713a037d8a3
F src/where.c 1b554a868134cbc9ca2192385403c0b63e5073ff01a6cdd600a846c09f843165
F src/whereInt.h 8d94cb116c9e06205c3d5ac87af065fc044f8cf08bfdccd94b6ea1c1308e65da
F src/wherecode.c 71c5c6804b7f882dec8ec858758accae02fcfca13df3cc720f1f258e663ec7c5
F src/whereexpr.c 5f412da6616e26b8000dd736a5ce5da0018dff0933cd656bbb25f407db16bf93
F src/window.c c0a38cd32473e8e8e7bc435039f914a36ca42465506dc491c65870c01ddac9fb
F src/whereexpr.c 403a44eeec1a0f0914fccc6a59376b6924bc00ef6728fe6ffce4cf3051b320fc
F src/window.c 538195bbc75bb924e18e368fbd4ed731a3fe3f901351b44f6466ec486f53affe
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test 4d7a34d328e58ca2a2d78fd76c27614a41ca7ddf4312ded9c68c04f430b3b47d
F test/affinity3.test 9b7d1133e11d5edd7805573c4ab6f3ba73b0b74a1f280d5b130d4bf3506a93ff
@@ -844,7 +842,7 @@ F test/altercons2.test 3c1f58312817df43aeada3b1827fdc3ce3fc50c6f49a95ef62cf4cbba
F test/altercorrupt.test 2e1d705342cf9d7de884518ddbb053fd52d7e60d2b8869b7b63b2fda68435c12
F test/alterdropcol.test a653a3945f964d26845ec0cd0a8e74189f46de3119a984c5bc45457da392612e
F test/alterdropcol2.test 527fce683b200d620f560f666c44ae33e22728e990a10a48a543280dfd4b4d41
F test/alterfault.test 2bb3103954ea60f2e2777b1ae12e79ec3e1fd278f2b1398ad316c68835a62898
F test/alterfault.test 9baff95be91ad77e955701454fa9e4bdd8c94f7fe6e814939962d3d5efb83220
F test/alterlegacy.test f38c6d06cda39e1f7b955bbce57f2e3ef5b7cb566d3d1234502093e228c15811
F test/altermalloc.test 167a47de41b5c638f5f5c6efb59784002b196fff70f98d9b4ed3cd74a3fb80c9
F test/altermalloc2.test 17fb3724c4b004c469c27dc4ef181608aa644555fbd3f3236767584f73747c81
@@ -852,8 +850,8 @@ F test/altermalloc3.test 8040e486368403f2fdd6fc3998258b499bd4cc2f3ddbb5f8f874cd4
F test/alterqf.test 8ec03d776de9c391daa0078ea8f838903bdcfb11dfae4ba3576b48436834ccba
F test/altertab.test 8a2712f9076da5012a002d0b5cc0a421398a5bf61c25bab41b77c427586a7a27
F test/altertab2.test 0889ba0700cc1cdb7bc7d25975aa61fece34f621de963d0886e2395716b38576
F test/altertab3.test 575e771e2f02b13eb98798dc92eabacd187d6dbcf596e70f11d699b0b6b5d0b2
F test/altertrig.test b1590647076add5a47aea0f2236c609ca0bc8a7a2462463edd3e5882c7894802
F test/altertab3.test 471b8898d10bbc6488db9c23dc76811f405de6707d2d342b1b8b6fd1f13cd3c8
F test/altertrig.test aacc980b657354fe2d3d4d3a004f07d04ccc1a93e5ef82d68a79088c274ddc6b
F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f
F test/analyze.test 2fb21d7d64748636384e6cb8998dbf83968caf644c07fcb4f76c18f2e7ede94b
F test/analyze3.test c5156cef33f04b90a6b9e9d5d0bbc273a0fb44147d4508407bf1080811e2c6c8
@@ -1075,7 +1073,7 @@ F test/e_resolve.test a61751c368b109db73df0f20fc75fb47e166b1d8
F test/e_select.test 327a15f14068bbd6f647cedc67210f8680fcb2f05e481a0a855fccd2abfa1292
F test/e_select2.test aceb80ab927d46fba5ce7586ebabf23e2bb0604f
F test/e_totalchanges.test c927f7499dc3aa28b9b556b7d6d115a2f0fe41f012b128d16bf1f3b30e9b41e4
F test/e_update.test 9f8bb82b8760ac66f2c9c2aadb78a418bd639d22f041d712570c9db56f20afda
F test/e_update.test f46c2554d915c9197548681e8d8c33a267e84528
F test/e_uri.test 86564382132d9c453845eeb5293c7e375487b625900ab56c181a0464908417d8
F test/e_vacuum.test 89fc48e8beee2f9dfd6de1fbb2edea6542dae9121dc0fbe6313764169e742104
F test/e_wal.test db7c33642711cf3c7959714b5f012aca08cacfa78da0382f95e849eb3ba66aa4
@@ -1107,7 +1105,7 @@ F test/extension01.test 5de412c66276105901c370770175003381fdcb0c4da7054fa43cf4a3
F test/external_reader.test 6fdec43eeca23eb32faad1e95a4d1abc402bc8b3db70df12d6fc08a637f4a2b5
F test/extraquick.test cb254400bd42bfb777ff675356aabf3287978f79
F test/fallocate.test 37a62e396a68eeede8f8d2ecf23573a80faceb630788d314d0a073d862616717
F test/filectrl.test 3344987f143f3cb9914895dc63d9e9518a535ef1b1438d22caf3ba2fa76cc6da
F test/filectrl.test 4b720117388cf6766d0b798e2dddd785953f8f371633b0c0084d2f34cf72336a
F test/filefmt.test f393e80c4b8d493b7a7f8f3809a8425bbf4292af1f5140f01cb1427798a2bbd4
F test/filter1.test 590f8ba9a0cd0823b80d89ac75c5ce72276189cef9225d2436adaf1ee87f3727
F test/filter2.tcl 44e525497ce07382915f01bd29ffd0fa49dab3adb87253b5e5103ba8f93393e8
@@ -1214,7 +1212,7 @@ F test/fts4merge.test 57d093660a5093ae6e9fbd2d17592a88b45bbd66db2703c4b640b28828
F test/fts4merge2.test 5faa558d1b672f82b847d2a337465fa745e46891
F test/fts4merge3.test 8d9ccb4a3d41c4c617a149d6c4b13ad02de797d0
F test/fts4merge4.test 66fce89934cd9508cbdc67de486558c34912ffb2e8ffe5c9a1bbb9b8a4408ba7
F test/fts4merge5.test 987af90c930e8555f74ab994f597431caec7f8defc52de7718655c32da07af9e
F test/fts4merge5.test 69932d85cda8a1c4dcfb742865900ed8fbda51724b8cf9a45bbe226dfd06c596
F test/fts4min.test 1c11e4bde16674a0c795953509cbc3731a7d9cbd1ddc7f35467bf39d632d749f
F test/fts4noti.test d5d933705b1b1516b67a5e3f8e514ecb19c6522fb3357bb744776d48427c2292
F test/fts4onepass.test d69ddc4ee3415e40b0c5d1d0408488a87614d4f63ba9c44f3e52db541d6b7cc7
@@ -1441,7 +1439,7 @@ F test/mmap4.test 2e2b4e32555b58da15176e6fe750f17c9dcf7f93
F test/mmapcorrupt.test 470fb44fe92e99c1d23701d156f8c17865f5b027063c9119dcfdb842791f4465
F test/mmapfault.test d4c9eff9cd8c2dc14bc43e71e042f175b0a26fe3
F test/mmapwarm.test 2272005969cd17a910077bd5082f70bc1fefad9a875afec7fc9af483898ecaf3
F test/modeA.clitest 96939c5fac8595213d84de82f3e09e4d126bafed19ec30167953627f4afa1723
F test/modeA.clitest 43098858465029ebe9229009fbd59528adf89f265fb82af87fc5c58f7901b2bc
F test/multiplex.test d74c034e52805f6de8cc5432cef8c9eb774bb64ec29b83a22effc8ca4dac1f08
F test/multiplex2.test 580ca5817c7edbe4cc68fa150609c9473393003a
F test/multiplex3.test fac575e0b1b852025575a6a8357701d80933e98b5d2fe6d35ddaa68f92f6a1f7
@@ -1511,12 +1509,10 @@ F test/printf2.test 3f55c1871a5a65507416076f6eb97e738d5210aeda7595a74ee895f2224c
F test/progress.test ebab27f670bd0d4eb9d20d49cef96e68141d92fb
F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
F test/pushdown.test 46a626ef1c0ca79b85296ff2e078b9da20a50e9b804b38f441590c3987580ddd
F test/qrf01.test 7ad8bb08eaaf9dee2a76a807741dfe4d6752614baa3c03afc734580bccc59afa
F test/qrf01.test a6ecc051613ea4dde796e4ff20fdb2c59a2138faf926d90a2a92c1e291776617
F test/qrf02.test 39b4afdc000bedccdafc0aecf17638df67a67aaa2d2942865ae6abcc48ba0e92
F test/qrf03.test e7efe46d204671726b4707585126cd78d107368de4a7d0c7b8d5157cdd8624ed
F test/qrf03.test 9de53aea459f5a127283db03cbb6011500757685646d21aa3c29c44c6ef23e86
F test/qrf04.test 0894692c998d2401dcc33449c02051b503ecce0c94217be54fb007c82d2d1379
F test/qrf05.test 8ade5bfa7ef0b448e531687203fa8ae9ef41f1d7e4c11d5ba0c4846af75b13d5
F test/qrf06.test cd7d0f0e2904904ab88141630a8fff5718ef7e3cc23e5a9c519cf29bb0919d89
F test/queryonly.test 5f653159e0f552f0552d43259890c1089391dcca
F test/quick.test 1681febc928d686362d50057c642f77a02c62e57
F test/quickcheck.test a4b7e878cd97e46108291c409b0bf8214f29e18fddd68a42bc5c1375ad1fb80a
@@ -1610,8 +1606,8 @@ F test/sharedA.test 64bdd21216dda2c6a3bd3475348ccdc108160f34682c97f2f51c19fc0e21
F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8ee707
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
F test/shell1.test 4e1b57c43b6246fb3e617903992b704ce3798c437b01cbf1e7a5e75060fdb7ea
F test/shell2.test 9d55aa53ca36c6889dedf5a23d849793afbd2dbe62d512ce066cb293a8a66a88
F test/shell1.test 9438957ab1c0d4c4622b98a11648999a86b6184c8317a87d3c5cb760d2f7bca9
F test/shell2.test 103140814bdc7508aa41dd3462413cbc4aa84b4261112cb8d501d74275cb7d48
F test/shell3.test 840192774cc4edf7653520c0434a311c7477b9bc324abbc7bd2887915792fa8c
F test/shell4.test e25580a792b7b54560c3a76b6968bd8189261f38979fe28e6bc6312c5db280db
F test/shell5.test 7a249400bb2af59ac8524f357f8cf2844a62b6ac5ff8ecd69b045ceb688700ae
@@ -1619,7 +1615,7 @@ F test/shell6.test e3b883b61d4916b6906678a35f9d19054861123ad91b856461e0a456273bd
F test/shell7.test 43fd8e511c533bab5232e95c7b4be93b243451709e89582600d4b6e67693d5c3
F test/shell8.test 641cf21a99c59404c24e3062923734951c4099a6b6b6520de00cf7a1249ee871
F test/shell9.test 8742a5b390cdcef6369f5aa223e415aa4255a4129ef249b177887dc635a87209
F test/shellA.test 5fa0bdb7a19b0c1ba32649eab3eca0f7164bd9d33d391fff17586abcbc6c6e18
F test/shellA.test 4b8983a40703b5550f691592b6c5bc64886c26755eeb7a474af849d1e39b51f2
F test/shellB.test de879b1ea7c25daf1a06b2c882b45a5d002e6580c81c57169ce47084cc6afb6b
F test/shmlock.test 9f1f729a7fe2c46c88b156af819ac9b72c0714ac6f7246638a73c5752b5fd13c
F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
@@ -1675,7 +1671,7 @@ F test/strict1.test a7f9091603fe71cdc62baab0766684cba12a97ec69bfbb70be965532669c
F test/strict2.test b22c7a98b5000aef937f1990776497f0e979b1a23bc4f63e2d53b00e59b20070
F test/subjournal.test 8d4e2572c0ee9a15549f0d8e40863161295107e52f07a3e8012a2e1fdd093c49
F test/subquery.test 23087f9b1c15ab9cc5231d04946bdebc51db527c95eb9d7434a2222127e17a84
F test/subquery2.test ab96ff3fa9c4e3dce0d699f74e61c50250ed4335bc8f400e127707d552a8999e
F test/subquery2.test 5f06ec2dbce42a3f595ab1b73b146592f9ce001cd4ff023d887d643d3560c281
F test/subselect.test 0966aa8e720224dbd6a5e769a3ec2a723e332303
F test/substr.test a673e3763e247e9b5e497a6cacbaf3da2bd8ec8921c0677145c109f2e633f36b
F test/subtype1.test 96fd2a59bfc845c955b5f339d23b37ef4d50de5f8a04acd1450a68605fa2e3e7
@@ -1701,12 +1697,11 @@ F test/tempfault.test 0c0d349c9a99bf5f374655742577f8712c647900
F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30
F test/temptable2.test 76821347810ecc88203e6ef0dd6897b6036ac788e9dd3e6b04fd4d1631311a16
F test/temptable3.test d11a0974e52b347e45ee54ef1923c91ed91e4637
F test/temptrigfault.tes fc5918e64f3867156fefe7cfca9d8e1f495134a5229b2b511b0dc11c07f2eab4
F test/temptrigger.test a00f258ed8d21a0e8fd4f322f15e8cfb5cef2e43655670e07a753e3fb4769d61
F test/tester.tcl 2d943f60200e0a36bcd3f1f0baf181a751cd3604ef6b6bd4c8dc39b4e8a53116
F test/temptrigger.test 38f0ca479b1822d3117069e014daabcaacefffcc
F test/tester.tcl 463ae33b8bf75ac77451df19bd65e7c415c2e9891227c7c9e657d0a2d8e1074a
F test/testloadext.c 862b848783eaed9985fbce46c65cd214664376b549fae252b364d5d1ef350a27
F test/testrunner.tcl 6cbda5d6ff9b26b11993f1e1ddd57d9521cec7c31676ad323a40a6821ce43ad6 x
F test/testrunner_data.tcl 87b8afd37c8e517fa87b7936540b2fc1ede8291f0567fb88744b9bff272a2e8b
F test/testrunner.tcl 86179a8e78997e9257cb8f738c5624cb23897da5297855578ba74715e64f1602 x
F test/testrunner_data.tcl c507a9afa911c03446ed90442ffd4a98aca02882c3d51bd1177c24795674def8
F test/testrunner_estwork.tcl 81e2ae10238f50540f42fbf2d94913052a99bfb494b69e546506323f195dcff9
F test/thread001.test a0985c117eab62c0c65526e9fa5d1360dd1cac5b03bde223902763274ce21899
F test/thread002.test c24c83408e35ba5a952a3638b7ac03ccdf1ce4409289c54a050ac4c5f1de7502
@@ -1930,7 +1925,7 @@ F test/upsertfault.test f21ca47740841fdb4d61acfa7b17646d773e67724fe8c185b71c018d
F test/uri.test 1250724af9beeed2d6c3716f5b990c483200c54f408d3c0ec9543a3c7961f8fc
F test/uri2.test 9d3ba7a53ee167572d53a298ee4a5d38ec4a8fb7
F test/utf16align.test 9fde0bb5d3a821594aa68c6829ab9c5453a084384137ebb9f6153e2d678039da
F test/vacuum-into.test 5a489714feecfdabfc7b293be4111564a173dee92c0d6818dd0207f3ade65783
F test/vacuum-into.test ebd223213fde4c985818b9d6dc33fe29a7cdd4272738d82e3e14aa2e686d228b
F test/vacuum.test f3b2257a4fcd659513c866a5d9e5f70999cc58fd5d74e979290385fa350b79ee
F test/vacuum2.test 9fd45ce6ce29f5614c249e03938d3567c06a9e772d4f155949f8eafe2d8af520
F test/vacuum3.test d9d9a04ee58c485b94694fd4f68cffaba49c32234fdefe1ac1a622c5e17d4ce3
@@ -2046,7 +2041,7 @@ F test/wherelimit3.test 22d73e046870cf8bbe15573eda6b432b07ebe64a88711f9f849c6b36
F test/widetab1.test c296a98e123762de79917350e45fa33fdf88577a2571eb3a64c8bf7e44ef74d1
F test/win32heap.test 1ec2ce646aee491ec23bfcdfd005b33c79f13bf91467966f374a76ffe7c7e85f
F test/win32lock.test e56d7a9b6cf9d5f3867c2dd19ff36c5326881e4038c6867610ecb3a9868ea4eb
F test/win32longpath.test 2641e3a5dbb59f49456f6caf78c0acd6ec7dbba27cb56363bab8fbfe93995caa
F test/win32longpath.test 0f9837039b306735c13521c5f25b6ed42937b600dace58e28a3d2f8baf429b6a
F test/win32nolock.test 95854dc0206b8a95e4aee15a76acc082767b38f079b2e24676aed6cbb0f32798
F test/window1.test b46d28b9698559e66aa4adafd8074b940faee498bf0c4fbdb62548bfcccc67e7
F test/window2.tcl 492c125fa550cda1dd3555768a2303b3effbeceee215293adf8871efc25f1476
@@ -2090,13 +2085,13 @@ F test/writecrash.test 13520af28f376bfc8c0bcd130efc1fff20bb165198e8b94cf153f1f75
F test/zeroblob.test 7b74cefc7b281dfa2b07cd237987fbe94b4a2037a7771e9e83f2d5f608b1d99e
F test/zeroblobfault.test 861d8191a0d944dfebb3cb4d2c5b4e46a5a119eaec5a63dd996c2389f8063441
F test/zerodamage.test 9c41628db7e8d9e8a0181e59ea5f189df311a9f6ce99cc376dc461f66db6f8dc
F test/zipfile.test ca3fb01d900c06efd7cf61b709576b714eeb249cbc7cae30af303536f1b4e91e
F test/zipfile.test 82d402903199d193073af2c3c56b3c6839d229160fdc9ba437fa959db8da3ecc
F test/zipfile2.test a577e0775e32ef8972e7d5e9a45bc071a5ae061b5b965a08c9c4b709ad036a25
F test/zipfilefault.test 44d4d7a7f7cca7521d569d7f71026b241d65a6b1757aa409c1a168827edbbc2c
F tool/GetFile.cs 47852aa0d806fe47ed1ac5138bdce7f000fe87aaa7f28107d0cb1e26682aeb44
F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e04534bbf
F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91
F tool/build-all-msvc.bat 1ee9dbadcc07fc23268025854e97b392bcbad72376b47aee7b22f3797a4f2c87 x
F tool/build-all-msvc.bat 1960a7a3e5d8176c4329e31476f6e3dfa9543675355fa9020a569f4452628458 x
F tool/build-shell.sh 369c4b171cc877ad974fef691e4da782b4c1e99fe8f4361316c735f64d49280f
F tool/buildtclext.tcl d09b753d7858314104eeaf5f4def85d35784470279809e47a633f142226f2b3f
F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x
@@ -2130,7 +2125,7 @@ F tool/mkautoconfamal.sh 647dada5e34c466bef62a4408e1c99a7e5e1922805479dd57944f33
F tool/mkccode.tcl c42a8f8cf78f92e83795d5447460dbce7aaf78a3bbf9082f1507dc71a3665f3c x
F tool/mkcombo.tcl 2a5189b219c4a495e1ff7fc980bd568d3cfb82ae9d50c84e77f7a161e96fc132
F tool/mkctimec.tcl 3fb5cad05922f5da61262cb6bcd5868a34e94a49ca8833ae2d7796e7df075576 x
F tool/mkkeywordhash.c 82d5af1d0e677900739fba59155cddac172d8c712c2d91ab73d6e6bcb30060f0
F tool/mkkeywordhash.c 6b0be901c47f9ad42215fc995eb2f4384ac49213b1fba395102ec3e999acf559
F tool/mkmsvcmin.tcl d76c45efda1cce2d4005bcea7b8a22bb752e3256009f331120fb4fecb14ebb7a
F tool/mkopcodec.tcl 33d20791e191df43209b77d37f0ff0904620b28465cca6990cf8d60da61a07ef
F tool/mkopcodeh.tcl 2b4e6967a670ef21bf53a164964c35c6163277d002a4c6f56fa231d68c88d023
@@ -2184,11 +2179,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 108691a3cb2f296f0ede06c34271ee185f299bfd76e97a1bd06c730a28d94ff4
R 24c7fadd707464dc0ec7c3ced472d67c
T *branch * zipfile-fix
T *sym-zipfile-fix *
T -sym-trunk *
P ff2065b533769cbf5278d13d09ffa93a7a0f841b1b59b6be0e5f27e3d1c341d0
R 628a0162ba8f0d8ab2de4d5bcae00f5f
U drh
Z fd7beb6b2e5c6334685d635e089624bf
Z 990cca7d1ccfde0bfbdaf6f519eba45c
# Remove this line to create a well-formed Fossil manifest.
+2 -2
View File
@@ -1,2 +1,2 @@
branch zipfile-fix
tag zipfile-fix
branch remove-sync-dataonly
tag remove-sync-dataonly
+1 -1
View File
@@ -1 +1 @@
3d459f1fb1bd1b5e723629c463ab392af7b206ece3388bda216c6a4c26160909
caefe4c746599b22aec446f3aeb296e53edaf8c54f8ae803381e8c21d5e29ab4
+74 -85
View File
@@ -1368,8 +1368,8 @@ static int renameResolveTrigger(Parse *pParse){
sqlite3SelectPrep(pParse, pStep->pSelect, &sNC);
if( pParse->nErr ) rc = pParse->rc;
}
if( rc==SQLITE_OK && pStep->pSrc ){
SrcList *pSrc = sqlite3SrcListDup(db, pStep->pSrc, 0);
if( rc==SQLITE_OK && pStep->zTarget ){
SrcList *pSrc = sqlite3TriggerStepSrc(pParse, pStep);
if( pSrc ){
Select *pSel = sqlite3SelectNew(
pParse, pStep->pExprList, pSrc, 0, 0, 0, 0, 0, 0
@@ -1397,10 +1397,10 @@ static int renameResolveTrigger(Parse *pParse){
pSel->pSrc = 0;
sqlite3SelectDelete(db, pSel);
}
if( ALWAYS(pStep->pSrc) ){
if( pStep->pFrom ){
int i;
for(i=0; i<pStep->pSrc->nSrc && rc==SQLITE_OK; i++){
SrcItem *p = &pStep->pSrc->a[i];
for(i=0; i<pStep->pFrom->nSrc && rc==SQLITE_OK; i++){
SrcItem *p = &pStep->pFrom->a[i];
if( p->fg.isSubquery ){
assert( p->u4.pSubq!=0 );
sqlite3SelectPrep(pParse, p->u4.pSubq->pSelect, 0);
@@ -1469,13 +1469,13 @@ static void renameWalkTrigger(Walker *pWalker, Trigger *pTrigger){
sqlite3WalkExpr(pWalker, pUpsert->pUpsertWhere);
sqlite3WalkExpr(pWalker, pUpsert->pUpsertTargetWhere);
}
if( pStep->pSrc ){
if( pStep->pFrom ){
int i;
SrcList *pSrc = pStep->pSrc;
for(i=0; i<pSrc->nSrc; i++){
if( pSrc->a[i].fg.isSubquery ){
assert( pSrc->a[i].u4.pSubq!=0 );
sqlite3WalkSelect(pWalker, pSrc->a[i].u4.pSubq->pSelect);
SrcList *pFrom = pStep->pFrom;
for(i=0; i<pFrom->nSrc; i++){
if( pFrom->a[i].fg.isSubquery ){
assert( pFrom->a[i].u4.pSubq!=0 );
sqlite3WalkSelect(pWalker, pFrom->a[i].u4.pSubq->pSelect);
}
}
}
@@ -1646,8 +1646,8 @@ static void renameColumnFunc(
if( rc!=SQLITE_OK ) goto renameColumnFunc_done;
for(pStep=sParse.pNewTrigger->step_list; pStep; pStep=pStep->pNext){
if( pStep->pSrc ){
Table *pTarget = sqlite3LocateTableItem(&sParse, 0, &pStep->pSrc->a[0]);
if( pStep->zTarget ){
Table *pTarget = sqlite3LocateTable(&sParse, 0, pStep->zTarget, zDb);
if( pTarget==pTab ){
if( pStep->pUpsert ){
ExprList *pUpsertSet = pStep->pUpsert->pUpsertSet;
@@ -1659,6 +1659,7 @@ static void renameColumnFunc(
}
}
/* Find tokens to edit in UPDATE OF clause */
if( sParse.pTriggerTab==pTab ){
renameColumnIdlistNames(&sParse, &sCtx,sParse.pNewTrigger->pColumns,zOld);
@@ -1860,10 +1861,13 @@ static void renameTableFunc(
if( rc==SQLITE_OK ){
renameWalkTrigger(&sWalker, pTrigger);
for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){
if( pStep->pSrc ){
if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
renameTokenFind(&sParse, &sCtx, pStep->zTarget);
}
if( pStep->pFrom ){
int i;
for(i=0; i<pStep->pSrc->nSrc; i++){
SrcItem *pItem = &pStep->pSrc->a[i];
for(i=0; i<pStep->pFrom->nSrc; i++){
SrcItem *pItem = &pStep->pFrom->a[i];
if( 0==sqlite3_stricmp(pItem->zName, zOld) ){
renameTokenFind(&sParse, &sCtx, pItem->zName);
}
@@ -2110,57 +2114,6 @@ static void renameTableTest(
#endif
}
/*
** Return the number of bytes until the end of the next non-whitespace and
** non-comment token. For the purpose of this function, a "(" token includes
** all of the bytes through and including the matching ")", or until the
** first illegal token, whichever comes first.
**
** Write the token type into *piToken.
**
** The value returned is the number of bytes in the token itself plus
** the number of bytes of leading whitespace and comments skipped plus
** all bytes through the next matching ")" if the token is TK_LP.
**
** Example: (Note: '.' used in place of '*' in the example z[] text)
**
** ,--------- *piToken := TK_RP
** v
** z[] = " /.comment./ --comment\n (two three four) five"
** | |
** |<-------------------------------------->|
** |
** `--- return value
*/
static int getConstraintToken(const u8 *z, int *piToken){
int iOff = 0;
int t = 0;
do {
iOff += sqlite3GetToken(&z[iOff], &t);
}while( t==TK_SPACE || t==TK_COMMENT );
*piToken = t;
if( t==TK_LP ){
int nNest = 1;
while( nNest>0 ){
iOff += sqlite3GetToken(&z[iOff], &t);
if( t==TK_LP ){
nNest++;
}else if( t==TK_RP ){
t = TK_LP;
nNest--;
}else if( t==TK_ILLEGAL ){
break;
}
}
}
*piToken = t;
return iOff;
}
/*
** The implementation of internal UDF sqlite_drop_column().
**
@@ -2205,24 +2158,15 @@ static void dropColumnFunc(
goto drop_column_done;
}
pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol].zCnName);
if( iCol<pTab->nCol-1 ){
RenameToken *pEnd;
pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol].zCnName);
pEnd = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol+1].zCnName);
zEnd = (const char*)pEnd->t.z;
}else{
int eTok;
assert( IsOrdinaryTable(pTab) );
assert( iCol!=0 );
/* Point pCol->t.z at the "," immediately preceding the definition of
** the column being dropped. To do this, start at the name of the
** previous column, and tokenize until the next ",". */
pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol-1].zCnName);
do {
pCol->t.z += getConstraintToken((const u8*)pCol->t.z, &eTok);
}while( eTok!=TK_COMMA );
pCol->t.z--;
zEnd = (const char*)&zSql[pTab->u.tab.addColOffset];
while( ALWAYS(pCol->t.z[0]!=0) && pCol->t.z[0]!=',' ) pCol->t.z--;
}
zNew = sqlite3MPrintf(db, "%.*s%s", pCol->t.z-zSql, zSql, zEnd);
@@ -2406,6 +2350,56 @@ static int getWhitespace(const u8 *z){
}
/*
** Return the number of bytes until the end of the next non-whitespace and
** non-comment token. For the purpose of this function, a "(" token includes
** all of the bytes through and including the matching ")", or until the
** first illegal token, whichever comes first.
**
** Write the token type into *piToken.
**
** The value returned is the number of bytes in the token itself plus
** the number of bytes of leading whitespace and comments skipped plus
** all bytes through the next matching ")" if the token is TK_LP.
**
** Example: (Note: '.' used in place of '*' in the example z[] text)
**
** ,--------- *piToken := TK_RP
** v
** z[] = " /.comment./ --comment\n (two three four) five"
** | |
** |<-------------------------------------->|
** |
** `--- return value
*/
static int getConstraintToken(const u8 *z, int *piToken){
int iOff = 0;
int t = 0;
do {
iOff += sqlite3GetToken(&z[iOff], &t);
}while( t==TK_SPACE || t==TK_COMMENT );
*piToken = t;
if( t==TK_LP ){
int nNest = 1;
while( nNest>0 ){
iOff += sqlite3GetToken(&z[iOff], &t);
if( t==TK_LP ){
nNest++;
}else if( t==TK_RP ){
t = TK_LP;
nNest--;
}else if( t==TK_ILLEGAL ){
break;
}
}
}
*piToken = t;
return iOff;
}
/*
** Argument z points into the body of a constraint - specifically the
** second token of the constraint definition. For a named constraint,
@@ -2455,7 +2449,6 @@ static int getConstraint(const u8 *z){
*/
static int quotedCompare(
sqlite3_context *ctx, /* Function context on which to report errors */
int t, /* Token type */
const u8 *zQuote, /* Possibly quoted text. Not zero-terminated. */
int nQuote, /* Length of zQuote in bytes */
const u8 *zCmp, /* Zero-terminated, unquoted name to compare against */
@@ -2463,10 +2456,6 @@ static int quotedCompare(
){
char *zCopy = 0; /* De-quoted, zero-terminated copy of zQuote[] */
if( t==TK_ILLEGAL ){
*pRes = 1;
return SQLITE_OK;
}
zCopy = sqlite3MallocZero(nQuote+1);
if( zCopy==0 ){
sqlite3_result_error_nomem(ctx);
@@ -2565,7 +2554,7 @@ static void dropConstraintFunc(
** the constraint being dropped. */
nTok = getConstraintToken(&zSql[iOff], &t);
if( zCons ){
if( quotedCompare(ctx, t, &zSql[iOff], nTok, zCons, &cmp) ) return;
if( quotedCompare(ctx, &zSql[iOff], nTok, zCons, &cmp) ) return;
}
iOff += nTok;
@@ -2959,7 +2948,7 @@ static void findConstraintFunc(
int cmp = 0;
iOff += getWhitespace(&zSql[iOff]);
nTok = getConstraintToken(&zSql[iOff], &t);
if( quotedCompare(ctx, t, &zSql[iOff], nTok, zCons, &cmp) ) return;
if( quotedCompare(ctx, &zSql[iOff], nTok, zCons, &cmp) ) return;
if( cmp==0 ){
sqlite3_result_int(ctx, 1);
return;
+1 -1
View File
@@ -596,7 +596,7 @@ int sqlite3FixTriggerStep(
if( sqlite3WalkSelect(&pFix->w, pStep->pSelect)
|| sqlite3WalkExpr(&pFix->w, pStep->pWhere)
|| sqlite3WalkExprList(&pFix->w, pStep->pExprList)
|| sqlite3FixSrcList(pFix, pStep->pSrc)
|| sqlite3FixSrcList(pFix, pStep->pFrom)
){
return 1;
}
+2 -2
View File
@@ -2059,8 +2059,8 @@ void sqlite3ChangeCookie(Parse *pParse, int iDb){
** The estimate is conservative. It might be larger that what is
** really needed.
*/
static i64 identLength(const char *z){
i64 n;
static int identLength(const char *z){
int n;
for(n=0; *z; n++, z++){
if( *z=='"' ){ n++; }
}
+27 -46
View File
@@ -935,22 +935,34 @@ Expr *sqlite3ExprAlloc(
int dequote /* True to dequote */
){
Expr *pNew;
int nExtra = pToken ? pToken->n+1 : 0;
int nExtra = 0;
int iValue = 0;
assert( db!=0 );
if( pToken ){
if( op!=TK_INTEGER || pToken->z==0
|| sqlite3GetInt32(pToken->z, &iValue)==0 ){
nExtra = pToken->n+1; /* tag-20240227-a */
assert( iValue>=0 );
}
}
pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra);
if( pNew ){
memset(pNew, 0, sizeof(Expr));
pNew->op = (u8)op;
pNew->iAgg = -1;
if( nExtra ){
assert( pToken!=0 );
pNew->u.zToken = (char*)&pNew[1];
assert( pToken->z!=0 || pToken->n==0 );
if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
pNew->u.zToken[pToken->n] = 0;
if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
sqlite3DequoteExpr(pNew);
if( pToken ){
if( nExtra==0 ){
pNew->flags |= EP_IntValue|EP_Leaf|(iValue?EP_IsTrue:EP_IsFalse);
pNew->u.iValue = iValue;
}else{
pNew->u.zToken = (char*)&pNew[1];
assert( pToken->z!=0 || pToken->n==0 );
if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
pNew->u.zToken[pToken->n] = 0;
if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
sqlite3DequoteExpr(pNew);
}
}
}
#if SQLITE_MAX_EXPR_DEPTH>0
@@ -975,24 +987,6 @@ Expr *sqlite3Expr(
return sqlite3ExprAlloc(db, op, &x, 0);
}
/*
** Allocate an expression for a 32-bit signed integer literal.
*/
Expr *sqlite3ExprInt32(sqlite3 *db, int iVal){
Expr *pNew = sqlite3DbMallocRawNN(db, sizeof(Expr));
if( pNew ){
memset(pNew, 0, sizeof(Expr));
pNew->op = TK_INTEGER;
pNew->iAgg = -1;
pNew->flags = EP_IntValue|EP_Leaf|(iVal?EP_IsTrue:EP_IsFalse);
pNew->u.iValue = iVal;
#if SQLITE_MAX_EXPR_DEPTH>0
pNew->nHeight = 1;
#endif
}
return pNew;
}
/*
** Attach subtrees pLeft and pRight to the Expr node pRoot.
**
@@ -1155,7 +1149,7 @@ Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){
){
sqlite3ExprDeferredDelete(pParse, pLeft);
sqlite3ExprDeferredDelete(pParse, pRight);
return sqlite3ExprInt32(db, 0);
return sqlite3Expr(db, TK_INTEGER, "0");
}else{
return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);
}
@@ -2630,7 +2624,7 @@ static int exprIsConst(Parse *pParse, Expr *p, int initFlag){
/*
** Walk an expression tree. Return non-zero if the expression is constant
** or return zero if the expression involves variables or function calls.
** and 0 if it involves variables or function calls.
**
** For the purposes of this function, a double-quoted string (ex: "abc")
** is considered a variable but a single-quoted string (ex: 'abc') is
@@ -3897,22 +3891,9 @@ int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
pParse->nMem += nReg;
if( pExpr->op==TK_SELECT ){
dest.eDest = SRT_Mem;
if( (pSel->selFlags&SF_Distinct) && pSel->pLimit && pSel->pLimit->pRight ){
/* If there is both a DISTINCT and an OFFSET clause, then allocate
** a separate dest.iSdst array for sqlite3Select() and other
** routines to populate. In this case results will be copied over
** into the dest.iSDParm array only after OFFSET processing. This
** ensures that in the case where OFFSET excludes all rows, the
** dest.iSDParm array is not left populated with the contents of the
** last row visited - it should be all NULLs if all rows were
** excluded by OFFSET. */
dest.iSdst = pParse->nMem+1;
pParse->nMem += nReg;
}else{
dest.iSdst = dest.iSDParm;
}
dest.iSdst = dest.iSDParm;
dest.nSdst = nReg;
sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, pParse->nMem);
sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, dest.iSDParm+nReg-1);
VdbeComment((v, "Init subquery result"));
}else{
dest.eDest = SRT_Exists;
@@ -3928,7 +3909,7 @@ int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
|| (pLeft->u.iValue!=1 && pLeft->u.iValue!=0)
){
sqlite3 *db = pParse->db;
pLimit = sqlite3ExprInt32(db, 0);
pLimit = sqlite3Expr(db, TK_INTEGER, "0");
if( pLimit ){
pLimit->affExpr = SQLITE_AFF_NUMERIC;
pLimit = sqlite3PExpr(pParse, TK_NE,
@@ -3939,7 +3920,7 @@ int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
}
}else{
/* If there is no pre-existing limit add a limit of 1 */
pLimit = sqlite3ExprInt32(pParse->db, 1);
pLimit = sqlite3Expr(pParse->db, TK_INTEGER, "1");
pSel->pLimit = sqlite3PExpr(pParse, TK_LIMIT, pLimit, 0);
}
pSel->iLimit = 0;
+5 -6
View File
@@ -688,7 +688,6 @@ FKey *sqlite3FkReferences(Table *pTab){
static void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){
if( p ){
TriggerStep *pStep = p->step_list;
sqlite3SrcListDelete(dbMem, pStep->pSrc);
sqlite3ExprDelete(dbMem, pStep->pWhere);
sqlite3ExprListDelete(dbMem, pStep->pExprList);
sqlite3SelectDelete(dbMem, pStep->pSelect);
@@ -1355,14 +1354,14 @@ static Trigger *fkActionTrigger(
pTrigger = (Trigger *)sqlite3DbMallocZero(db,
sizeof(Trigger) + /* struct Trigger */
sizeof(TriggerStep) /* Single step in trigger program */
sizeof(TriggerStep) + /* Single step in trigger program */
nFrom + 1 /* Space for pStep->zTarget */
);
if( pTrigger ){
pStep = pTrigger->step_list = (TriggerStep *)&pTrigger[1];
pStep->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
if( pStep->pSrc ){
pStep->pSrc->a[0].zName = sqlite3DbStrNDup(db, zFrom, nFrom);
}
pStep->zTarget = (char *)&pStep[1];
memcpy((char *)pStep->zTarget, zFrom, nFrom);
pStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);
pStep->pExprList = sqlite3ExprListDup(db, pList, EXPRDUP_REDUCE);
pStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE);
-3
View File
@@ -2945,9 +2945,6 @@ static const int aHardLimit[] = {
#if SQLITE_MAX_SQL_LENGTH>SQLITE_MAX_LENGTH
# error SQLITE_MAX_SQL_LENGTH must not be greater than SQLITE_MAX_LENGTH
#endif
#if SQLITE_MAX_SQL_LENGTH>2147482624 /* 1024 less than 2^31 */
# error SQLITE_MAX_SQL_LENGTH must not be greater than 2147482624
#endif
#if SQLITE_MAX_COMPOUND_SELECT<2
# error SQLITE_MAX_COMPOUND_SELECT must be at least 2
#endif
+8
View File
@@ -129,7 +129,11 @@ static int winMutexInit(void){
if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
int i;
for(i=0; i<ArraySize(winMutex_staticMutexes); i++){
#if SQLITE_OS_WINRT
InitializeCriticalSectionEx(&winMutex_staticMutexes[i].mutex, 0, 0);
#else
InitializeCriticalSection(&winMutex_staticMutexes[i].mutex);
#endif
}
winMutex_isInit = 1;
}else{
@@ -219,7 +223,11 @@ static sqlite3_mutex *winMutexAlloc(int iType){
p->trace = 1;
#endif
#endif
#if SQLITE_OS_WINRT
InitializeCriticalSectionEx(&p->mutex, 0, 0);
#else
InitializeCriticalSection(&p->mutex);
#endif
}
break;
}
+34 -45
View File
@@ -2027,18 +2027,12 @@ static int unixLock(sqlite3_file *id, int eFileLock){
pInode->nLock++;
pInode->nShared = 1;
}
}else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){
}else if( (eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1)
|| unixIsSharingShmNode(pFile)
){
/* We are trying for an exclusive lock but another thread in this
** same process is still holding a shared lock. */
rc = SQLITE_BUSY;
}else if( unixIsSharingShmNode(pFile) ){
/* We are in WAL mode and attempting to delete the SHM and WAL
** files due to closing the connection or changing out of WAL mode,
** but another process still holds locks on the SHM file, thus
** indicating that database locks have been broken, perhaps due
** to a rogue close(open(dbFile)) or similar.
*/
rc = SQLITE_BUSY;
}else{
/* The request was for a RESERVED or EXCLUSIVE lock. It is
** assumed that there is a SHARED or greater lock on the file
@@ -3762,20 +3756,18 @@ int sqlite3_fullsync_count = 0;
** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash
** or power failure will likely corrupt the database file.
**
** SQLite sets the dataOnly flag if the size of the file is unchanged.
** The idea behind dataOnly is that it should only write the file content
** to disk, not the inode. We only set dataOnly if the file size is
** unchanged since the file size is part of the inode. However,
** Ted Ts'o tells us that fdatasync() will also write the inode if the
** file size has changed. The only real difference between fdatasync()
** and fsync(), Ted tells us, is that fdatasync() will not flush the
** inode if the mtime or owner or other inode attributes have changed.
** We only care about the file size, not the other file attributes, so
** as far as SQLite is concerned, an fdatasync() is always adequate.
** So, we always use fdatasync() if it is available, regardless of
** the value of the dataOnly flag.
** At one point we attempted to pass a flag to this function if the
** file-size had not changed to tell it to use fdatasync() instead of
** fsync() in this case. However, Ted Ts'o tells us that fdatasync() will
** also write the inode if the file size has changed. The only real
** difference between fdatasync() and fsync(), Ted tells us, is that
** fdatasync() will not flush the inode if the mtime or owner or other
** inode attributes have changed. We only care about the file size, not
** the other file attributes, so as far as SQLite is concerned, an
** fdatasync() is always adequate. So, we always use fdatasync() if it is
** available.
*/
static int full_fsync(int fd, int fullSync, int dataOnly){
static int full_fsync(int fd, int fullSync){
int rc;
/* The following "ifdef/elif/else/" block has the same structure as
@@ -3785,12 +3777,9 @@ static int full_fsync(int fd, int fullSync, int dataOnly){
#ifdef SQLITE_NO_SYNC
UNUSED_PARAMETER(fd);
UNUSED_PARAMETER(fullSync);
UNUSED_PARAMETER(dataOnly);
#elif HAVE_FULLFSYNC
UNUSED_PARAMETER(dataOnly);
#else
UNUSED_PARAMETER(fullSync);
UNUSED_PARAMETER(dataOnly);
#endif
/* Record the number of times that we do a normal fsync() and
@@ -3896,10 +3885,6 @@ static int openDirectory(const char *zFilename, int *pFd){
/*
** Make sure all writes to a particular file are committed to disk.
**
** If dataOnly==0 then both the file itself and its metadata (file
** size, access time, etc) are synced. If dataOnly!=0 then only the
** file data is synced.
**
** Under Unix, also make sure that the directory entry for the file
** has been created by fsync-ing the directory that contains the file.
** If we do not do this and we encounter a power failure, the directory
@@ -3912,7 +3897,6 @@ static int unixSync(sqlite3_file *id, int flags){
int rc;
unixFile *pFile = (unixFile*)id;
int isDataOnly = (flags&SQLITE_SYNC_DATAONLY);
int isFullsync = (flags&0x0F)==SQLITE_SYNC_FULL;
/* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */
@@ -3927,7 +3911,7 @@ static int unixSync(sqlite3_file *id, int flags){
assert( pFile );
OSTRACE(("SYNC %-3d\n", pFile->h));
rc = full_fsync(pFile->h, isFullsync, isDataOnly);
rc = full_fsync(pFile->h, isFullsync);
SimulateIOError( rc=1 );
if( rc ){
storeLastErrno(pFile, errno);
@@ -3944,7 +3928,7 @@ static int unixSync(sqlite3_file *id, int flags){
HAVE_FULLFSYNC, isFullsync));
rc = osOpenDirectory(pFile->zPath, &dirfd);
if( rc==SQLITE_OK ){
full_fsync(dirfd, 0, 0);
full_fsync(dirfd, 0);
robust_close(pFile, dirfd, __LINE__);
}else{
assert( rc==SQLITE_CANTOPEN );
@@ -4677,21 +4661,26 @@ static int unixFcntlExternalReader(unixFile *pFile, int *piOut){
** still not a disaster.
*/
static int unixIsSharingShmNode(unixFile *pFile){
int rc;
unixShmNode *pShmNode;
struct flock lock;
if( pFile->pShm==0 ) return 0;
if( pFile->ctrlFlags & UNIXFILE_EXCL ) return 0;
pShmNode = pFile->pShm->pShmNode;
#if SQLITE_ATOMIC_INTRINSICS
assert( AtomicLoad(&pShmNode->nRef)==1 );
#endif
memset(&lock, 0, sizeof(lock));
lock.l_whence = SEEK_SET;
lock.l_start = UNIX_SHM_DMS;
lock.l_len = 1;
lock.l_type = F_WRLCK;
osFcntl(pShmNode->hShm, F_GETLK, &lock);
return (lock.l_type!=F_UNLCK);
rc = 1;
unixEnterMutex();
if( ALWAYS(pShmNode->nRef==1) ){
struct flock lock;
lock.l_whence = SEEK_SET;
lock.l_start = UNIX_SHM_DMS;
lock.l_len = 1;
lock.l_type = F_WRLCK;
osFcntl(pShmNode->hShm, F_GETLK, &lock);
if( lock.l_type==F_UNLCK ){
rc = 0;
}
}
unixLeaveMutex();
return rc;
}
/*
@@ -6855,7 +6844,7 @@ static int unixDelete(
int fd;
rc = osOpenDirectory(zPath, &fd);
if( rc==SQLITE_OK ){
if( full_fsync(fd,0,0) ){
if( full_fsync(fd, 0) ){
rc = unixLogError(SQLITE_IOERR_DIR_FSYNC, "fsync", zPath);
}
robust_close(0, fd, __LINE__);
@@ -7911,7 +7900,7 @@ static int proxyTakeConch(unixFile *pFile){
writeSize = PROXY_PATHINDEX + strlen(&writeBuffer[PROXY_PATHINDEX]);
robust_ftruncate(conchFile->h, writeSize);
rc = unixWrite((sqlite3_file *)conchFile, writeBuffer, writeSize, 0);
full_fsync(conchFile->h,0,0);
full_fsync(conchFile->h, 0);
/* If we created a new conch file (not just updated the contents of a
** valid conch file), try to match the permissions of the database
*/
+326 -42
View File
@@ -43,7 +43,7 @@
** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions
** based on the sub-platform)?
*/
#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_ANSI)
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI)
# define SQLITE_WIN32_HAS_ANSI
#endif
@@ -51,7 +51,7 @@
** Are most of the Win32 Unicode APIs available (i.e. with certain exceptions
** based on the sub-platform)?
*/
#if (SQLITE_OS_WINCE || SQLITE_OS_WINNT) && \
#if (SQLITE_OS_WINCE || SQLITE_OS_WINNT || SQLITE_OS_WINRT) && \
!defined(SQLITE_WIN32_NO_WIDE)
# define SQLITE_WIN32_HAS_WIDE
#endif
@@ -190,7 +190,16 @@
*/
#if SQLITE_WIN32_FILEMAPPING_API && \
(!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
/*
** Two of the file mapping APIs are different under WinRT. Figure out which
** set we need.
*/
#if SQLITE_OS_WINRT
WINBASEAPI HANDLE WINAPI CreateFileMappingFromApp(HANDLE, \
LPSECURITY_ATTRIBUTES, ULONG, ULONG64, LPCWSTR);
WINBASEAPI LPVOID WINAPI MapViewOfFileFromApp(HANDLE, ULONG, ULONG64, SIZE_T);
#else
#if defined(SQLITE_WIN32_HAS_ANSI)
WINBASEAPI HANDLE WINAPI CreateFileMappingA(HANDLE, LPSECURITY_ATTRIBUTES, \
DWORD, DWORD, DWORD, LPCSTR);
@@ -202,6 +211,7 @@ WINBASEAPI HANDLE WINAPI CreateFileMappingW(HANDLE, LPSECURITY_ATTRIBUTES, \
#endif /* defined(SQLITE_WIN32_HAS_WIDE) */
WINBASEAPI LPVOID WINAPI MapViewOfFile(HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#endif /* SQLITE_OS_WINRT */
/*
** These file mapping APIs are common to both Win32 and WinRT.
@@ -492,7 +502,7 @@ static LONG SQLITE_WIN32_VOLATILE sqlite3_os_type = 0;
** This function is not available on Windows CE or WinRT.
*/
#if SQLITE_OS_WINCE
#if SQLITE_OS_WINCE || SQLITE_OS_WINRT
# define osAreFileApisANSI() 1
#endif
@@ -507,7 +517,7 @@ static struct win_syscall {
sqlite3_syscall_ptr pCurrent; /* Current value of the system call */
sqlite3_syscall_ptr pDefault; /* Default value */
} aSyscall[] = {
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
{ "AreFileApisANSI", (SYSCALL)AreFileApisANSI, 0 },
#else
{ "AreFileApisANSI", (SYSCALL)0, 0 },
@@ -546,7 +556,7 @@ static struct win_syscall {
#define osCreateFileA ((HANDLE(WINAPI*)(LPCSTR,DWORD,DWORD, \
LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[4].pCurrent)
#if defined(SQLITE_WIN32_HAS_WIDE)
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
{ "CreateFileW", (SYSCALL)CreateFileW, 0 },
#else
{ "CreateFileW", (SYSCALL)0, 0 },
@@ -555,7 +565,7 @@ static struct win_syscall {
#define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \
LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent)
#if defined(SQLITE_WIN32_HAS_ANSI) && \
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_ANSI) && \
(!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) && \
SQLITE_WIN32_CREATEFILEMAPPINGA
{ "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 },
@@ -566,8 +576,8 @@ static struct win_syscall {
#define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent)
#if (SQLITE_OS_WINCE || defined(SQLITE_WIN32_HAS_WIDE)) && \
(!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
(!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
{ "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 },
#else
{ "CreateFileMappingW", (SYSCALL)0, 0 },
@@ -576,7 +586,7 @@ static struct win_syscall {
#define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \
DWORD,DWORD,DWORD,LPCWSTR))aSyscall[7].pCurrent)
#if defined(SQLITE_WIN32_HAS_WIDE)
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
{ "CreateMutexW", (SYSCALL)CreateMutexW, 0 },
#else
{ "CreateMutexW", (SYSCALL)0, 0 },
@@ -662,7 +672,7 @@ static struct win_syscall {
#define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \
LPDWORD))aSyscall[18].pCurrent)
#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
{ "GetDiskFreeSpaceW", (SYSCALL)GetDiskFreeSpaceW, 0 },
#else
{ "GetDiskFreeSpaceW", (SYSCALL)0, 0 },
@@ -679,7 +689,7 @@ static struct win_syscall {
#define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[20].pCurrent)
#if defined(SQLITE_WIN32_HAS_WIDE)
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
{ "GetFileAttributesW", (SYSCALL)GetFileAttributesW, 0 },
#else
{ "GetFileAttributesW", (SYSCALL)0, 0 },
@@ -696,7 +706,11 @@ static struct win_syscall {
#define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \
LPVOID))aSyscall[22].pCurrent)
#if !SQLITE_OS_WINRT
{ "GetFileSize", (SYSCALL)GetFileSize, 0 },
#else
{ "GetFileSize", (SYSCALL)0, 0 },
#endif
#define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[23].pCurrent)
@@ -709,7 +723,7 @@ static struct win_syscall {
#define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \
LPSTR*))aSyscall[24].pCurrent)
#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE)
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
{ "GetFullPathNameW", (SYSCALL)GetFullPathNameW, 0 },
#else
{ "GetFullPathNameW", (SYSCALL)0, 0 },
@@ -744,10 +758,16 @@ static struct win_syscall {
#define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \
LPCSTR))aSyscall[27].pCurrent)
#if !SQLITE_OS_WINRT
{ "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 },
#else
{ "GetSystemInfo", (SYSCALL)0, 0 },
#endif
#define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[28].pCurrent)
{ "GetSystemTime", (SYSCALL)GetSystemTime, 0 },
#define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[29].pCurrent)
#if !SQLITE_OS_WINCE
@@ -767,7 +787,7 @@ static struct win_syscall {
#define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[31].pCurrent)
#if defined(SQLITE_WIN32_HAS_WIDE)
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE)
{ "GetTempPathW", (SYSCALL)GetTempPathW, 0 },
#else
{ "GetTempPathW", (SYSCALL)0, 0 },
@@ -775,7 +795,11 @@ static struct win_syscall {
#define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[32].pCurrent)
#if !SQLITE_OS_WINRT
{ "GetTickCount", (SYSCALL)GetTickCount, 0 },
#else
{ "GetTickCount", (SYSCALL)0, 0 },
#endif
#define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent)
@@ -788,7 +812,7 @@ static struct win_syscall {
#define osGetVersionExA ((BOOL(WINAPI*)( \
LPOSVERSIONINFOA))aSyscall[34].pCurrent)
#if defined(SQLITE_WIN32_HAS_WIDE) && \
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
SQLITE_WIN32_GETVERSIONEX
{ "GetVersionExW", (SYSCALL)GetVersionExW, 0 },
#else
@@ -803,12 +827,20 @@ static struct win_syscall {
#define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \
SIZE_T))aSyscall[36].pCurrent)
#if !SQLITE_OS_WINRT
{ "HeapCreate", (SYSCALL)HeapCreate, 0 },
#else
{ "HeapCreate", (SYSCALL)0, 0 },
#endif
#define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \
SIZE_T))aSyscall[37].pCurrent)
#if !SQLITE_OS_WINRT
{ "HeapDestroy", (SYSCALL)HeapDestroy, 0 },
#else
{ "HeapDestroy", (SYSCALL)0, 0 },
#endif
#define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[38].pCurrent)
@@ -826,12 +858,16 @@ static struct win_syscall {
#define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \
LPCVOID))aSyscall[41].pCurrent)
#if !SQLITE_OS_WINRT
{ "HeapValidate", (SYSCALL)HeapValidate, 0 },
#else
{ "HeapValidate", (SYSCALL)0, 0 },
#endif
#define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \
LPCVOID))aSyscall[42].pCurrent)
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
{ "HeapCompact", (SYSCALL)HeapCompact, 0 },
#else
{ "HeapCompact", (SYSCALL)0, 0 },
@@ -847,7 +883,7 @@ static struct win_syscall {
#define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[44].pCurrent)
#if defined(SQLITE_WIN32_HAS_WIDE) && \
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \
!defined(SQLITE_OMIT_LOAD_EXTENSION)
{ "LoadLibraryW", (SYSCALL)LoadLibraryW, 0 },
#else
@@ -856,11 +892,15 @@ static struct win_syscall {
#define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[45].pCurrent)
#if !SQLITE_OS_WINRT
{ "LocalFree", (SYSCALL)LocalFree, 0 },
#else
{ "LocalFree", (SYSCALL)0, 0 },
#endif
#define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[46].pCurrent)
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
{ "LockFile", (SYSCALL)LockFile, 0 },
#else
{ "LockFile", (SYSCALL)0, 0 },
@@ -882,7 +922,8 @@ static struct win_syscall {
LPOVERLAPPED))aSyscall[48].pCurrent)
#endif
#if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && \
(!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0))
{ "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 },
#else
{ "MapViewOfFile", (SYSCALL)0, 0 },
@@ -910,12 +951,20 @@ static struct win_syscall {
#define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[53].pCurrent)
#if !SQLITE_OS_WINRT
{ "SetFilePointer", (SYSCALL)SetFilePointer, 0 },
#else
{ "SetFilePointer", (SYSCALL)0, 0 },
#endif
#define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \
DWORD))aSyscall[54].pCurrent)
#if !SQLITE_OS_WINRT
{ "Sleep", (SYSCALL)Sleep, 0 },
#else
{ "Sleep", (SYSCALL)0, 0 },
#endif
#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[55].pCurrent)
@@ -924,7 +973,7 @@ static struct win_syscall {
#define osSystemTimeToFileTime ((BOOL(WINAPI*)(const SYSTEMTIME*, \
LPFILETIME))aSyscall[56].pCurrent)
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
{ "UnlockFile", (SYSCALL)UnlockFile, 0 },
#else
{ "UnlockFile", (SYSCALL)0, 0 },
@@ -962,7 +1011,11 @@ static struct win_syscall {
#define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \
LPOVERLAPPED))aSyscall[61].pCurrent)
#if SQLITE_OS_WINRT
{ "CreateEventExW", (SYSCALL)CreateEventExW, 0 },
#else
{ "CreateEventExW", (SYSCALL)0, 0 },
#endif
#define osCreateEventExW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,LPCWSTR, \
DWORD,DWORD))aSyscall[62].pCurrent)
@@ -987,26 +1040,64 @@ static struct win_syscall {
#define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \
BOOL))aSyscall[64].pCurrent)
#if SQLITE_OS_WINRT
{ "SetFilePointerEx", (SYSCALL)SetFilePointerEx, 0 },
#else
{ "SetFilePointerEx", (SYSCALL)0, 0 },
#endif
#define osSetFilePointerEx ((BOOL(WINAPI*)(HANDLE,LARGE_INTEGER, \
PLARGE_INTEGER,DWORD))aSyscall[65].pCurrent)
#if SQLITE_OS_WINRT
{ "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 },
#else
{ "GetFileInformationByHandleEx", (SYSCALL)0, 0 },
#endif
#define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \
FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[66].pCurrent)
#if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
{ "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 },
#else
{ "MapViewOfFileFromApp", (SYSCALL)0, 0 },
#endif
#define osMapViewOfFileFromApp ((LPVOID(WINAPI*)(HANDLE,ULONG,ULONG64, \
SIZE_T))aSyscall[67].pCurrent)
#if SQLITE_OS_WINRT
{ "CreateFile2", (SYSCALL)CreateFile2, 0 },
#else
{ "CreateFile2", (SYSCALL)0, 0 },
#endif
#define osCreateFile2 ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD,DWORD, \
LPCREATEFILE2_EXTENDED_PARAMETERS))aSyscall[68].pCurrent)
#if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_LOAD_EXTENSION)
{ "LoadPackagedLibrary", (SYSCALL)LoadPackagedLibrary, 0 },
#else
{ "LoadPackagedLibrary", (SYSCALL)0, 0 },
#endif
#define osLoadPackagedLibrary ((HMODULE(WINAPI*)(LPCWSTR, \
DWORD))aSyscall[69].pCurrent)
#if SQLITE_OS_WINRT
{ "GetTickCount64", (SYSCALL)GetTickCount64, 0 },
#else
{ "GetTickCount64", (SYSCALL)0, 0 },
#endif
#define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[70].pCurrent)
#if SQLITE_OS_WINRT
{ "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 },
#else
{ "GetNativeSystemInfo", (SYSCALL)0, 0 },
#endif
#define osGetNativeSystemInfo ((VOID(WINAPI*)( \
LPSYSTEM_INFO))aSyscall[71].pCurrent)
@@ -1031,6 +1122,15 @@ static struct win_syscall {
#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[74].pCurrent)
#if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)
{ "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 },
#else
{ "CreateFileMappingFromApp", (SYSCALL)0, 0 },
#endif
#define osCreateFileMappingFromApp ((HANDLE(WINAPI*)(HANDLE, \
LPSECURITY_ATTRIBUTES,ULONG,ULONG64,LPCWSTR))aSyscall[75].pCurrent)
/*
** NOTE: On some sub-platforms, the InterlockedCompareExchange "function"
** is really just a macro that uses a compiler intrinsic (e.g. x64).
@@ -1047,7 +1147,7 @@ static struct win_syscall {
SQLITE_WIN32_VOLATILE*, LONG,LONG))aSyscall[76].pCurrent)
#endif /* defined(InterlockedCompareExchange) */
#if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
{ "UuidCreate", (SYSCALL)UuidCreate, 0 },
#else
{ "UuidCreate", (SYSCALL)0, 0 },
@@ -1055,7 +1155,7 @@ static struct win_syscall {
#define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[77].pCurrent)
#if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
{ "UuidCreateSequential", (SYSCALL)UuidCreateSequential, 0 },
#else
{ "UuidCreateSequential", (SYSCALL)0, 0 },
@@ -1266,10 +1366,10 @@ int sqlite3_win32_compact_heap(LPUINT pnLargest){
hHeap = winMemGetHeap();
assert( hHeap!=0 );
assert( hHeap!=INVALID_HANDLE_VALUE );
#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
#endif
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
if( (nLargest=osHeapCompact(hHeap, SQLITE_WIN32_HEAP_FLAGS))==0 ){
DWORD lastErrno = osGetLastError();
if( lastErrno==NO_ERROR ){
@@ -1382,11 +1482,28 @@ void sqlite3_win32_write_debug(const char *zBuf, int nBuf){
}
#endif /* _WIN32 */
/*
** The following routine suspends the current thread for at least ms
** milliseconds. This is equivalent to the Win32 Sleep() interface.
*/
#if SQLITE_OS_WINRT
static HANDLE sleepObj = NULL;
#endif
void sqlite3_win32_sleep(DWORD milliseconds){
#if SQLITE_OS_WINRT
if ( sleepObj==NULL ){
sleepObj = osCreateEventExW(NULL, NULL, CREATE_EVENT_MANUAL_RESET,
SYNCHRONIZE);
}
assert( sleepObj!=NULL );
osWaitForSingleObjectEx(sleepObj, milliseconds, FALSE);
#else
osSleep(milliseconds);
#endif
}
#if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINCE && \
#if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \
SQLITE_THREADSAFE>0
DWORD sqlite3Win32Wait(HANDLE hObject){
DWORD rc;
@@ -1410,7 +1527,7 @@ DWORD sqlite3Win32Wait(HANDLE hObject){
#if !SQLITE_WIN32_GETVERSIONEX
# define osIsNT() (1)
#elif SQLITE_OS_WINCE || !defined(SQLITE_WIN32_HAS_ANSI)
#elif SQLITE_OS_WINCE || SQLITE_OS_WINRT || !defined(SQLITE_WIN32_HAS_ANSI)
# define osIsNT() (1)
#elif !defined(SQLITE_WIN32_HAS_WIDE)
# define osIsNT() (0)
@@ -1423,7 +1540,13 @@ DWORD sqlite3Win32Wait(HANDLE hObject){
** based on the NT kernel.
*/
int sqlite3_win32_is_nt(void){
#if SQLITE_WIN32_GETVERSIONEX
#if SQLITE_OS_WINRT
/*
** NOTE: The WinRT sub-platform is always assumed to be based on the NT
** kernel.
*/
return 1;
#elif SQLITE_WIN32_GETVERSIONEX
if( osInterlockedCompareExchange(&sqlite3_os_type, 0, 0)==0 ){
#if defined(SQLITE_WIN32_HAS_ANSI)
OSVERSIONINFOA sInfo;
@@ -1465,7 +1588,7 @@ static void *winMemMalloc(int nBytes){
hHeap = winMemGetHeap();
assert( hHeap!=0 );
assert( hHeap!=INVALID_HANDLE_VALUE );
#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
#endif
assert( nBytes>=0 );
@@ -1487,7 +1610,7 @@ static void winMemFree(void *pPrior){
hHeap = winMemGetHeap();
assert( hHeap!=0 );
assert( hHeap!=INVALID_HANDLE_VALUE );
#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
#endif
if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */
@@ -1508,7 +1631,7 @@ static void *winMemRealloc(void *pPrior, int nBytes){
hHeap = winMemGetHeap();
assert( hHeap!=0 );
assert( hHeap!=INVALID_HANDLE_VALUE );
#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
#endif
assert( nBytes>=0 );
@@ -1536,7 +1659,7 @@ static int winMemSize(void *p){
hHeap = winMemGetHeap();
assert( hHeap!=0 );
assert( hHeap!=INVALID_HANDLE_VALUE );
#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, p) );
#endif
if( !p ) return 0;
@@ -1566,7 +1689,7 @@ static int winMemInit(void *pAppData){
assert( pWinMemData->magic1==WINMEM_MAGIC1 );
assert( pWinMemData->magic2==WINMEM_MAGIC2 );
#if SQLITE_WIN32_HEAP_CREATE
#if !SQLITE_OS_WINRT && SQLITE_WIN32_HEAP_CREATE
if( !pWinMemData->hHeap ){
DWORD dwInitialSize = SQLITE_WIN32_HEAP_INIT_SIZE;
DWORD dwMaximumSize = (DWORD)sqlite3GlobalConfig.nHeap;
@@ -1599,7 +1722,7 @@ static int winMemInit(void *pAppData){
#endif
assert( pWinMemData->hHeap!=0 );
assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
#endif
return SQLITE_OK;
@@ -1617,7 +1740,7 @@ static void winMemShutdown(void *pAppData){
if( pWinMemData->hHeap ){
assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
#if defined(SQLITE_WIN32_MALLOC_VALIDATE)
#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE)
assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
#endif
if( pWinMemData->bOwned ){
@@ -1998,6 +2121,17 @@ static int winGetLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){
char *zOut = 0;
if( osIsNT() ){
#if SQLITE_OS_WINRT
WCHAR zTempWide[SQLITE_WIN32_MAX_ERRMSG_CHARS+1];
dwLen = osFormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
lastErrno,
0,
zTempWide,
SQLITE_WIN32_MAX_ERRMSG_CHARS,
0);
#else
LPWSTR zTempWide = NULL;
dwLen = osFormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
@@ -2008,13 +2142,16 @@ static int winGetLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){
(LPWSTR) &zTempWide,
0,
0);
#endif
if( dwLen > 0 ){
/* allocate a buffer and convert to UTF8 */
sqlite3BeginBenignMalloc();
zOut = winUnicodeToUtf8(zTempWide);
sqlite3EndBenignMalloc();
#if !SQLITE_OS_WINRT
/* free the system buffer allocated by FormatMessage */
osLocalFree(zTempWide);
#endif
}
}
#ifdef SQLITE_WIN32_HAS_ANSI
@@ -2675,6 +2812,7 @@ static int winHandleUnlock(HANDLE h, int iOff, int nByte){
static int winHandleSeek(HANDLE h, sqlite3_int64 iOffset){
int rc = SQLITE_OK; /* Return value */
#if !SQLITE_OS_WINRT
LONG upperBits; /* Most sig. 32 bits of new offset */
LONG lowerBits; /* Least sig. 32 bits of new offset */
DWORD dwRet; /* Value returned by SetFilePointer() */
@@ -2696,7 +2834,20 @@ static int winHandleSeek(HANDLE h, sqlite3_int64 iOffset){
rc = SQLITE_IOERR_SEEK;
}
}
OSTRACE(("SEEK file=%p, offset=%lld rc=%s\n", h, iOffset,sqlite3ErrName(rc)));
#else
/* This implementation works for WinRT. */
LARGE_INTEGER x; /* The new offset */
BOOL bRet; /* Value returned by SetFilePointerEx() */
x.QuadPart = iOffset;
bRet = osSetFilePointerEx(h, x, 0, FILE_BEGIN);
if(!bRet){
rc = SQLITE_IOERR_SEEK;
}
#endif
OSTRACE(("SEEK file=%p, offset=%lld rc=%s\n", h, iOffset, sqlite3ErrName(rc)));
return rc;
}
@@ -2997,6 +3148,17 @@ static int winHandleTruncate(HANDLE h, sqlite3_int64 nByte){
*/
static int winHandleSize(HANDLE h, sqlite3_int64 *pnByte){
int rc = SQLITE_OK;
#if SQLITE_OS_WINRT
FILE_STANDARD_INFO info;
BOOL b;
b = osGetFileInformationByHandleEx(h, FileStandardInfo, &info, sizeof(info));
if( b ){
*pnByte = info.EndOfFile.QuadPart;
}else{
rc = SQLITE_IOERR_FSTAT;
}
#else
DWORD upperBits = 0;
DWORD lowerBits = 0;
@@ -3006,6 +3168,8 @@ static int winHandleSize(HANDLE h, sqlite3_int64 *pnByte){
if( lowerBits==INVALID_FILE_SIZE && osGetLastError()!=NO_ERROR ){
rc = SQLITE_IOERR_FSTAT;
}
#endif
return rc;
}
@@ -3204,6 +3368,20 @@ static int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){
assert( pSize!=0 );
SimulateIOError(return SQLITE_IOERR_FSTAT);
OSTRACE(("SIZE file=%p, pSize=%p\n", pFile->h, pSize));
#if SQLITE_OS_WINRT
{
FILE_STANDARD_INFO info;
if( osGetFileInformationByHandleEx(pFile->h, FileStandardInfo,
&info, sizeof(info)) ){
*pSize = info.EndOfFile.QuadPart;
}else{
pFile->lastErrno = osGetLastError();
rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
"winFileSize", pFile->zPath);
}
}
#else
{
DWORD upperBits;
DWORD lowerBits;
@@ -3218,6 +3396,7 @@ static int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){
"winFileSize", pFile->zPath);
}
}
#endif
OSTRACE(("SIZE file=%p, pSize=%p, *pSize=%lld, rc=%s\n",
pFile->h, pSize, *pSize, sqlite3ErrName(rc)));
return rc;
@@ -4179,6 +4358,20 @@ static int winHandleOpen(
** TODO: retry-on-ioerr.
*/
if( osIsNT() ){
#if SQLITE_OS_WINRT
CREATEFILE2_EXTENDED_PARAMETERS extendedParameters;
memset(&extendedParameters, 0, sizeof(extendedParameters));
extendedParameters.dwSize = sizeof(extendedParameters);
extendedParameters.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
extendedParameters.dwFileFlags = flag_overlapped;
extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS;
h = osCreateFile2((LPCWSTR)zConverted,
(GENERIC_READ | (bReadonly ? 0 : GENERIC_WRITE)),/* dwDesiredAccess */
FILE_SHARE_READ | FILE_SHARE_WRITE, /* dwShareMode */
OPEN_ALWAYS, /* dwCreationDisposition */
&extendedParameters
);
#else
h = osCreateFileW((LPCWSTR)zConverted, /* lpFileName */
(GENERIC_READ | (bReadonly ? 0 : GENERIC_WRITE)), /* dwDesiredAccess */
FILE_SHARE_READ | FILE_SHARE_WRITE, /* dwShareMode */
@@ -4187,6 +4380,7 @@ static int winHandleOpen(
FILE_ATTRIBUTE_NORMAL|flag_overlapped,
NULL
);
#endif
}else{
/* Due to pre-processor directives earlier in this file,
** SQLITE_WIN32_HAS_ANSI is always defined if osIsNT() is false. */
@@ -4654,7 +4848,9 @@ static int winShmMap(
HANDLE hMap = NULL; /* file-mapping handle */
void *pMap = 0; /* Mapped memory region */
#if defined(SQLITE_WIN32_HAS_WIDE)
#if SQLITE_OS_WINRT
hMap = osCreateFileMappingFromApp(hShared, NULL, protect, nByte, NULL);
#elif defined(SQLITE_WIN32_HAS_WIDE)
hMap = osCreateFileMappingW(hShared, NULL, protect, 0, nByte, NULL);
#elif defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_CREATEFILEMAPPINGA
hMap = osCreateFileMappingA(hShared, NULL, protect, 0, nByte, NULL);
@@ -4666,9 +4862,15 @@ static int winShmMap(
if( hMap ){
int iOffset = pShmNode->nRegion*szRegion;
int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity;
#if SQLITE_OS_WINRT
pMap = osMapViewOfFileFromApp(hMap, flags,
iOffset - iOffsetShift, szRegion + iOffsetShift
);
#else
pMap = osMapViewOfFile(hMap, flags,
0, iOffset - iOffsetShift, szRegion + iOffsetShift
);
#endif
OSTRACE(("SHM-MAP-MAP pid=%lu, region=%d, offset=%d, size=%d, rc=%s\n",
osGetCurrentProcessId(), pShmNode->nRegion, iOffset,
szRegion, pMap ? "ok" : "failed"));
@@ -4801,7 +5003,9 @@ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){
flags |= FILE_MAP_WRITE;
}
#endif
#if defined(SQLITE_WIN32_HAS_WIDE)
#if SQLITE_OS_WINRT
pFd->hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL);
#elif defined(SQLITE_WIN32_HAS_WIDE)
pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect,
(DWORD)((nMap>>32) & 0xffffffff),
(DWORD)(nMap & 0xffffffff), NULL);
@@ -4821,7 +5025,11 @@ static int winMapfile(winFile *pFd, sqlite3_int64 nByte){
}
assert( (nMap % winSysInfo.dwPageSize)==0 );
assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff );
#if SQLITE_OS_WINRT
pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap);
#else
pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap);
#endif
if( pNew==NULL ){
osCloseHandle(pFd->hMap);
pFd->hMap = NULL;
@@ -5156,6 +5364,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
}
#endif
#if !SQLITE_OS_WINRT && defined(_WIN32)
else if( osIsNT() ){
char *zMulti;
LPWSTR zWidePath = sqlite3MallocZero( nMax*sizeof(WCHAR) );
@@ -5209,6 +5418,7 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
}
}
#endif /* SQLITE_WIN32_HAS_ANSI */
#endif /* !SQLITE_OS_WINRT */
/*
** Check to make sure the temporary directory ends with an appropriate
@@ -5383,6 +5593,13 @@ static int winOpen(
memset(pFile, 0, sizeof(winFile));
pFile->h = INVALID_HANDLE_VALUE;
#if SQLITE_OS_WINRT
if( !zUtf8Name && !sqlite3_temp_directory ){
sqlite3_log(SQLITE_ERROR,
"sqlite3_temp_directory variable should be set for WinRT");
}
#endif
/* If the second argument to this function is NULL, generate a
** temporary file name to use
*/
@@ -5465,6 +5682,31 @@ static int winOpen(
#endif
if( osIsNT() ){
#if SQLITE_OS_WINRT
CREATEFILE2_EXTENDED_PARAMETERS extendedParameters;
extendedParameters.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
extendedParameters.dwFileAttributes =
dwFlagsAndAttributes & FILE_ATTRIBUTE_MASK;
extendedParameters.dwFileFlags = dwFlagsAndAttributes & FILE_FLAG_MASK;
extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS;
extendedParameters.lpSecurityAttributes = NULL;
extendedParameters.hTemplateFile = NULL;
do{
h = osCreateFile2((LPCWSTR)zConverted,
dwDesiredAccess,
dwShareMode,
dwCreationDisposition,
&extendedParameters);
if( h!=INVALID_HANDLE_VALUE ) break;
if( isReadWrite ){
int rc2;
sqlite3BeginBenignMalloc();
rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ|NORETRY, &isRO);
sqlite3EndBenignMalloc();
if( rc2==SQLITE_OK && isRO ) break;
}
}while( winRetryIoerr(&cnt, &lastErrno) );
#else
do{
h = osCreateFileW((LPCWSTR)zConverted,
dwDesiredAccess,
@@ -5481,6 +5723,7 @@ static int winOpen(
if( rc2==SQLITE_OK && isRO ) break;
}
}while( winRetryIoerr(&cnt, &lastErrno) );
#endif
}
#ifdef SQLITE_WIN32_HAS_ANSI
else{
@@ -5617,7 +5860,25 @@ static int winDelete(
}
if( osIsNT() ){
do {
#if SQLITE_OS_WINRT
WIN32_FILE_ATTRIBUTE_DATA sAttrData;
memset(&sAttrData, 0, sizeof(sAttrData));
if ( osGetFileAttributesExW(zConverted, GetFileExInfoStandard,
&sAttrData) ){
attr = sAttrData.dwFileAttributes;
}else{
lastErrno = osGetLastError();
if( lastErrno==ERROR_FILE_NOT_FOUND
|| lastErrno==ERROR_PATH_NOT_FOUND ){
rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */
}else{
rc = SQLITE_ERROR;
}
break;
}
#else
attr = osGetFileAttributesW(zConverted);
#endif
if ( attr==INVALID_FILE_ATTRIBUTES ){
lastErrno = osGetLastError();
if( lastErrno==ERROR_FILE_NOT_FOUND
@@ -5908,7 +6169,7 @@ static int winFullPathnameNoMutex(
int nFull, /* Size of output buffer in bytes */
char *zFull /* Output buffer */
){
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
int nByte;
void *zConverted;
char *zOut;
@@ -5997,7 +6258,7 @@ static int winFullPathnameNoMutex(
}
#endif /* __CYGWIN__ */
#if SQLITE_OS_WINCE && defined(_WIN32)
#if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && defined(_WIN32)
SimulateIOError( return SQLITE_ERROR );
/* WinCE has no concept of a relative pathname, or so I am told. */
/* WinRT has no way to convert a relative path to an absolute one. */
@@ -6016,7 +6277,7 @@ static int winFullPathnameNoMutex(
return SQLITE_OK;
#endif
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
#if defined(_WIN32)
/* It's odd to simulate an io-error here, but really this is just
** using the io-error infrastructure to test that SQLite handles this
@@ -6148,7 +6409,11 @@ static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
return 0;
}
if( osIsNT() ){
#if SQLITE_OS_WINRT
h = osLoadPackagedLibrary((LPCWSTR)zConverted, 0);
#else
h = osLoadLibraryW((LPCWSTR)zConverted);
#endif
}
#ifdef SQLITE_WIN32_HAS_ANSI
else{
@@ -6230,16 +6495,23 @@ static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
DWORD pid = osGetCurrentProcessId();
xorMemory(&e, (unsigned char*)&pid, sizeof(DWORD));
}
#if SQLITE_OS_WINRT
{
ULONGLONG cnt = osGetTickCount64();
xorMemory(&e, (unsigned char*)&cnt, sizeof(ULONGLONG));
}
#else
{
DWORD cnt = osGetTickCount();
xorMemory(&e, (unsigned char*)&cnt, sizeof(DWORD));
}
#endif /* SQLITE_OS_WINRT */
{
LARGE_INTEGER i;
osQueryPerformanceCounter(&i);
xorMemory(&e, (unsigned char*)&i, sizeof(LARGE_INTEGER));
}
#if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
{
UUID id;
memset(&id, 0, sizeof(UUID));
@@ -6249,7 +6521,7 @@ static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
osUuidCreateSequential(&id);
xorMemory(&e, (unsigned char*)&id, sizeof(UUID));
}
#endif /* !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID */
#endif /* !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID */
return e.nXor>nBuf ? nBuf : e.nXor;
#endif /* defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS) */
}
@@ -6480,11 +6752,15 @@ int sqlite3_os_init(void){
/* Double-check that the aSyscall[] array has been constructed
** correctly. See ticket [bb3a86e890c8e96ab] */
assert( ArraySize(aSyscall)==86 );
assert( ArraySize(aSyscall)==89 );
/* get memory map allocation granularity */
memset(&winSysInfo, 0, sizeof(SYSTEM_INFO));
#if SQLITE_OS_WINRT
osGetNativeSystemInfo(&winSysInfo);
#else
osGetSystemInfo(&winSysInfo);
#endif
assert( winSysInfo.dwAllocationGranularity>0 );
assert( winSysInfo.dwPageSize>0 );
@@ -6508,9 +6784,17 @@ int sqlite3_os_init(void){
}
int sqlite3_os_end(void){
#if SQLITE_OS_WINRT
if( sleepObj!=NULL ){
osCloseHandle(sleepObj);
sleepObj = NULL;
}
#endif
#ifndef SQLITE_OMIT_WAL
winBigLock = 0;
#endif
return SQLITE_OK;
}
+9 -1
View File
@@ -58,6 +58,14 @@
# define SQLITE_OS_WINCE 0
#endif
/*
** Determine if we are dealing with WinRT, which provides only a subset of
** the full Win32 API.
*/
#if !defined(SQLITE_OS_WINRT)
# define SQLITE_OS_WINRT 0
#endif
/*
** For WinCE, some API function parameters do not appear to be declared as
** volatile.
@@ -72,7 +80,7 @@
** For some Windows sub-platforms, the _beginthreadex() / _endthreadex()
** functions are not available (e.g. those not using MSVC, Cygwin, etc).
*/
#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && \
#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \
SQLITE_THREADSAFE>0 && !defined(__CYGWIN__)
# define SQLITE_OS_WIN_THREADS 1
#else
+2 -4
View File
@@ -1400,7 +1400,7 @@ static int zeroJournalHdr(Pager *pPager, int doTruncate){
rc = sqlite3OsWrite(pPager->jfd, zeroHdr, sizeof(zeroHdr), 0);
}
if( rc==SQLITE_OK && !pPager->noSync ){
rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_DATAONLY|pPager->syncFlags);
rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);
}
/* At this point the transaction is committed but the write lock
@@ -4367,9 +4367,7 @@ static int syncJournal(Pager *pPager, int newHdr){
if( 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){
PAGERTRACE(("SYNC journal of %d\n", PAGERID(pPager)));
IOTRACE(("JSYNC %p\n", pPager))
rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags|
(pPager->syncFlags==SQLITE_SYNC_FULL?SQLITE_SYNC_DATAONLY:0)
);
rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);
if( rc!=SQLITE_OK ) return rc;
}
+56 -87
View File
@@ -833,35 +833,18 @@ fullname(A) ::= nm(X) DOT nm(Y). {
%type xfullname {SrcList*}
%destructor xfullname {sqlite3SrcListDelete(pParse->db, $$);}
xfullname(A) ::= nm(X). {
A = sqlite3SrcListAppend(pParse,0,&X,0);
if( IN_RENAME_OBJECT && A ) sqlite3RenameTokenMap(pParse, A->a[0].zName, &X);
xfullname(A) ::= nm(X).
{A = sqlite3SrcListAppend(pParse,0,&X,0); /*A-overwrites-X*/}
xfullname(A) ::= nm(X) DOT nm(Y).
{A = sqlite3SrcListAppend(pParse,0,&X,&Y); /*A-overwrites-X*/}
xfullname(A) ::= nm(X) DOT nm(Y) AS nm(Z). {
A = sqlite3SrcListAppend(pParse,0,&X,&Y); /*A-overwrites-X*/
if( A ) A->a[0].zAlias = sqlite3NameFromToken(pParse->db, &Z);
}
xfullname(A) ::= nm(X) DOT nm(Y). {
A = sqlite3SrcListAppend(pParse,0,&X,&Y);
if( IN_RENAME_OBJECT && A ) sqlite3RenameTokenMap(pParse, A->a[0].zName, &Y);
xfullname(A) ::= nm(X) AS nm(Z). {
A = sqlite3SrcListAppend(pParse,0,&X,0); /*A-overwrites-X*/
if( A ) A->a[0].zAlias = sqlite3NameFromToken(pParse->db, &Z);
}
xfullname(A) ::= nm(X) AS nm(Z). {
A = sqlite3SrcListAppend(pParse,0,&X,0);
if( A ){
if( IN_RENAME_OBJECT ){
sqlite3RenameTokenMap(pParse, A->a[0].zName, &X);
}else{
A->a[0].zAlias = sqlite3NameFromToken(pParse->db, &Z);
}
}
}
xfullname(A) ::= nm(X) DOT nm(Y) AS nm(Z). {
A = sqlite3SrcListAppend(pParse,0,&X,&Y);
if( A ){
if( IN_RENAME_OBJECT ){
sqlite3RenameTokenMap(pParse, A->a[0].zName, &Y);
}else{
A->a[0].zAlias = sqlite3NameFromToken(pParse->db, &Z);
}
}
}
%type joinop {int}
joinop(X) ::= COMMA|JOIN. { X = JT_INNER; }
@@ -1193,12 +1176,7 @@ expr(A) ::= nm(X) DOT nm(Y) DOT nm(Z). {
term(A) ::= NULL|FLOAT|BLOB(X). {A=tokenExpr(pParse,@X,X); /*A-overwrites-X*/}
term(A) ::= STRING(X). {A=tokenExpr(pParse,@X,X); /*A-overwrites-X*/}
term(A) ::= INTEGER(X). {
int iValue;
if( sqlite3GetInt32(X.z, &iValue)==0 ){
A = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &X, 0);
}else{
A = sqlite3ExprInt32(pParse->db, iValue);
}
A = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &X, 1);
if( A ) A->w.iOfst = (int)(X.z - pParse->zTail);
}
expr(A) ::= VARIABLE(X). {
@@ -1380,67 +1358,43 @@ expr(A) ::= expr(A) likeop(OP) expr(Y) ESCAPE expr(E). [LIKE_KW] {
if( A ) A->flags |= EP_InfixFunc;
}
%include {
/* Create a TK_ISNULL or TK_NOTNULL expression, perhaps optimized to
** to TK_TRUEFALSE, if possible */
static Expr *sqlite3PExprIsNull(
Parse *pParse, /* Parsing context */
int op, /* TK_ISNULL or TK_NOTNULL */
Expr *pLeft /* Operand */
){
Expr *p = pLeft;
assert( op==TK_ISNULL || op==TK_NOTNULL );
assert( pLeft!=0 );
while( p->op==TK_UPLUS || p->op==TK_UMINUS ){
p = p->pLeft;
assert( p!=0 );
}
switch( p->op ){
case TK_INTEGER:
case TK_STRING:
case TK_FLOAT:
case TK_BLOB:
sqlite3ExprDeferredDelete(pParse, pLeft);
return sqlite3ExprInt32(pParse->db, op==TK_NOTNULL);
default:
break;
}
return sqlite3PExpr(pParse, op, pLeft, 0);
}
expr(A) ::= expr(A) ISNULL|NOTNULL(E). {A = sqlite3PExpr(pParse,@E,A,0);}
expr(A) ::= expr(A) NOT NULL. {A = sqlite3PExpr(pParse,TK_NOTNULL,A,0);}
/* Create a TK_IS or TK_ISNOT operator, perhaps optimized to
** TK_ISNULL or TK_NOTNULL or TK_TRUEFALSE. */
static Expr *sqlite3PExprIs(
Parse *pParse, /* Parsing context */
int op, /* TK_IS or TK_ISNOT */
Expr *pLeft, /* Left operand */
Expr *pRight /* Right operand */
){
if( pRight && pRight->op==TK_NULL ){
sqlite3ExprDeferredDelete(pParse, pRight);
return sqlite3PExprIsNull(pParse, op==TK_IS ? TK_ISNULL : TK_NOTNULL, pLeft);
%include {
/* A routine to convert a binary TK_IS or TK_ISNOT expression into a
** unary TK_ISNULL or TK_NOTNULL expression. */
static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){
sqlite3 *db = pParse->db;
if( pA && pY && pY->op==TK_NULL && !IN_RENAME_OBJECT ){
pA->op = (u8)op;
sqlite3ExprDelete(db, pA->pRight);
pA->pRight = 0;
}
return sqlite3PExpr(pParse, op, pLeft, pRight);
}
}
expr(A) ::= expr(A) ISNULL|NOTNULL(E). {A = sqlite3PExprIsNull(pParse,@E,A);}
expr(A) ::= expr(A) NOT NULL. {A = sqlite3PExprIsNull(pParse,TK_NOTNULL,A);}
// expr1 IS expr2 same as expr1 IS NOT DISTICT FROM expr2
// expr1 IS NOT expr2 same as expr1 IS DISTINCT FROM expr2
// expr1 IS expr2
// expr1 IS NOT expr2
//
// If expr2 is NULL then code as TK_ISNULL or TK_NOTNULL. If expr2
// is any other expression, code as TK_IS or TK_ISNOT.
//
expr(A) ::= expr(A) IS expr(Y). {
A = sqlite3PExprIs(pParse, TK_IS, A, Y);
A = sqlite3PExpr(pParse,TK_IS,A,Y);
binaryToUnaryIfNull(pParse, Y, A, TK_ISNULL);
}
expr(A) ::= expr(A) IS NOT expr(Y). {
A = sqlite3PExprIs(pParse, TK_ISNOT, A, Y);
A = sqlite3PExpr(pParse,TK_ISNOT,A,Y);
binaryToUnaryIfNull(pParse, Y, A, TK_NOTNULL);
}
expr(A) ::= expr(A) IS NOT DISTINCT FROM expr(Y). {
A = sqlite3PExprIs(pParse, TK_IS, A, Y);
A = sqlite3PExpr(pParse,TK_IS,A,Y);
binaryToUnaryIfNull(pParse, Y, A, TK_ISNULL);
}
expr(A) ::= expr(A) IS DISTINCT FROM expr(Y). {
A = sqlite3PExprIs(pParse, TK_ISNOT, A, Y);
A = sqlite3PExpr(pParse,TK_ISNOT,A,Y);
binaryToUnaryIfNull(pParse, Y, A, TK_NOTNULL);
}
expr(A) ::= NOT(B) expr(X).
@@ -1770,13 +1724,28 @@ when_clause(A) ::= WHEN expr(X). { A = X; }
%type trigger_cmd_list {TriggerStep*}
%destructor trigger_cmd_list {sqlite3DeleteTriggerStep(pParse->db, $$);}
trigger_cmd_list(A) ::= trigger_cmd_list(A) trigger_cmd(X) SEMI. {
assert( A!=0 );
A->pLast->pNext = X;
A->pLast = X;
}
trigger_cmd_list(A) ::= trigger_cmd(A) SEMI. {
assert( A!=0 );
A->pLast = A;
}
// Disallow qualified table names on INSERT, UPDATE, and DELETE statements
// within a trigger. The table to INSERT, UPDATE, or DELETE is always in
// the same database as the table that the trigger fires on.
//
%type trnm {Token}
trnm(A) ::= nm(A).
trnm(A) ::= nm DOT nm(X). {
A = X;
sqlite3ErrorMsg(pParse,
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
"statements within triggers");
}
// Disallow the INDEX BY and NOT INDEXED clauses on UPDATE and DELETE
// statements within triggers. We make a specific error message for this
// since it is an exception to the default grammar rules.
@@ -1799,17 +1768,17 @@ tridxby ::= NOT INDEXED. {
%destructor trigger_cmd {sqlite3DeleteTriggerStep(pParse->db, $$);}
// UPDATE
trigger_cmd(A) ::=
UPDATE(B) orconf(R) xfullname(X) tridxby SET setlist(Y) from(F) where_opt(Z) scanpt(E).
{A = sqlite3TriggerUpdateStep(pParse, X, F, Y, Z, R, B.z, E);}
UPDATE(B) orconf(R) trnm(X) tridxby SET setlist(Y) from(F) where_opt(Z) scanpt(E).
{A = sqlite3TriggerUpdateStep(pParse, &X, F, Y, Z, R, B.z, E);}
// INSERT
trigger_cmd(A) ::= scanpt(B) insert_cmd(R) INTO
xfullname(X) idlist_opt(F) select(S) upsert(U) scanpt(Z). {
A = sqlite3TriggerInsertStep(pParse,X,F,S,R,U,B,Z);/*A-overwrites-R*/
trnm(X) idlist_opt(F) select(S) upsert(U) scanpt(Z). {
A = sqlite3TriggerInsertStep(pParse,&X,F,S,R,U,B,Z);/*A-overwrites-R*/
}
// DELETE
trigger_cmd(A) ::= DELETE(B) FROM xfullname(X) tridxby where_opt(Y) scanpt(E).
{A = sqlite3TriggerDeleteStep(pParse, X, Y, B.z, E);}
trigger_cmd(A) ::= DELETE(B) FROM trnm(X) tridxby where_opt(Y) scanpt(E).
{A = sqlite3TriggerDeleteStep(pParse, &X, Y, B.z, E);}
// SELECT
trigger_cmd(A) ::= scanpt(B) select(X) scanpt(E).
+3 -1
View File
@@ -1656,8 +1656,10 @@ static int resolveCompoundOrderBy(
/* Convert the ORDER BY term into an integer column number iCol,
** taking care to preserve the COLLATE clause if it exists. */
if( !IN_RENAME_OBJECT ){
Expr *pNew = sqlite3ExprInt32(db, iCol);
Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
if( pNew==0 ) return 1;
pNew->flags |= EP_IntValue;
pNew->u.iValue = iCol;
if( pItem->pExpr==pE ){
pItem->pExpr = pNew;
}else{
+7 -10
View File
@@ -1445,14 +1445,9 @@ static void selectInnerLoop(
assert( nResultCol<=pDest->nSdst );
pushOntoSorter(
pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg);
pDest->iSDParm = regResult;
}else{
assert( nResultCol==pDest->nSdst );
if( regResult!=iParm ){
/* This occurs in cases where the SELECT had both a DISTINCT and
** an OFFSET clause. */
sqlite3VdbeAddOp3(v, OP_Copy, regResult, iParm, nResultCol-1);
}
assert( regResult==iParm );
/* The LIMIT clause will jump out of the loop for us */
}
break;
@@ -2435,8 +2430,8 @@ void sqlite3SubqueryColumnTypes(
}
}
if( zType ){
const i64 k = strlen(zType);
n = strlen(pCol->zCnName);
const i64 k = sqlite3Strlen30(zType);
n = sqlite3Strlen30(pCol->zCnName);
pCol->zCnName = sqlite3DbReallocOrFree(db, pCol->zCnName, n+k+2);
pCol->colFlags &= ~(COLFLAG_HASTYPE|COLFLAG_HASCOLL);
if( pCol->zCnName ){
@@ -3617,8 +3612,10 @@ static int multiSelectOrderBy(
if( pItem->u.x.iOrderByCol==i ) break;
}
if( j==nOrderBy ){
Expr *pNew = sqlite3ExprInt32(db, i);
Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0);
if( pNew==0 ) return SQLITE_NOMEM_BKPT;
pNew->flags |= EP_IntValue;
pNew->u.iValue = i;
p->pOrderBy = pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew);
if( pOrderBy ) pOrderBy->a[nOrderBy++].u.x.iOrderByCol = (u16)i;
}
@@ -7134,7 +7131,7 @@ static int havingToWhereExprCb(Walker *pWalker, Expr *pExpr){
&& pExpr->pAggInfo==0
){
sqlite3 *db = pWalker->pParse->db;
Expr *pNew = sqlite3ExprInt32(db, 1);
Expr *pNew = sqlite3Expr(db, TK_INTEGER, "1");
if( pNew ){
Expr *pWhere = pS->pWhere;
SWAP(Expr, *pNew, *pExpr);
+94 -153
View File
@@ -31,6 +31,14 @@ typedef unsigned short int u16;
# include SHELL_STRINGIFY(SQLITE_CUSTOM_INCLUDE)
#endif
/*
** Determine if we are dealing with WinRT, which provides only a subset of
** the full Win32 API.
*/
#if !defined(SQLITE_OS_WINRT)
# define SQLITE_OS_WINRT 0
#endif
/*
** If SQLITE_SHELL_FIDDLE is defined then the shell is modified
** somewhat for use as a WASM module in a web browser. This flag
@@ -170,6 +178,9 @@ typedef unsigned char u8;
#endif
#if defined(_WIN32) || defined(WIN32)
# if SQLITE_OS_WINRT
# define SQLITE_OMIT_POPEN 1
# else
# include <io.h>
# include <fcntl.h>
# define isatty(h) _isatty(h)
@@ -184,6 +195,7 @@ typedef unsigned char u8;
# endif
# undef pclose
# define pclose _pclose
# endif
#else
/* Make sure isatty() has a prototype. */
extern int isatty(int);
@@ -214,6 +226,9 @@ typedef unsigned char u8;
#define IsAlpha(X) isalpha((unsigned char)X)
#if defined(_WIN32) || defined(WIN32)
#if SQLITE_OS_WINRT
#include <intrin.h>
#endif
#undef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -421,6 +436,7 @@ static int hasTimer(void){
if( getProcessTimesAddr ){
return 1;
} else {
#if !SQLITE_OS_WINRT
/* GetProcessTimes() isn't supported in WIN95 and some other Windows
** versions. See if the version we are running on has it, and if it
** does, save off a pointer to it and the current process handle.
@@ -437,6 +453,7 @@ static int hasTimer(void){
FreeLibrary(hinstLib);
}
}
#endif
}
return 0;
}
@@ -1369,7 +1386,7 @@ static ShellState shellState;
*/
static const char *qrfEscNames[] = { "auto", "off", "ascii", "symbol" };
static const char *qrfQuoteNames[] =
{ "off","off","sql","hex","csv","tcl","json","relaxed"};
{ "off","off","sql","hex","csv","tcl","json"};
/*
** These are the allowed shellFlgs values
@@ -1411,16 +1428,15 @@ static const char *qrfQuoteNames[] =
#define MODE_List 12 /* One record per line with a separator */
#define MODE_Markdown 13 /* Markdown formatting */
#define MODE_Off 14 /* No query output shown */
#define MODE_Psql 15 /* Similar to psql */
#define MODE_QBox 16 /* BOX with SQL-quoted content */
#define MODE_Quote 17 /* Quote values as for SQL */
#define MODE_Split 18 /* Split-column mode */
#define MODE_Table 19 /* MySQL-style table formatting */
#define MODE_Tabs 20 /* Tab-separated values */
#define MODE_Tcl 21 /* Space-separated list of TCL strings */
#define MODE_Www 22 /* Full web-page output */
#define MODE_QBox 15 /* BOX with SQL-quoted content */
#define MODE_Quote 16 /* Quote values as for SQL */
#define MODE_Split 17 /* Split-column mode */
#define MODE_Table 18 /* MySQL-style table formatting */
#define MODE_Tabs 19 /* Tab-separated values */
#define MODE_Tcl 20 /* Space-separated list of TCL strings */
#define MODE_Www 21 /* Full web-page output */
#define MODE_BUILTIN 22 /* Maximum built-in mode */
#define MODE_BUILTIN 21 /* Maximum built-in mode */
#define MODE_BATCH 50 /* Default mode for batch processing */
#define MODE_TTY 51 /* Default mode for interactive processing */
#define MODE_USER 75 /* First user-defined mode */
@@ -1441,7 +1457,6 @@ struct ModeInfo {
unsigned char bHdr; /* Show headers by default. 0: n/a, 1: no 2: yes */
unsigned char eStyle; /* Underlying QRF style */
unsigned char eCx; /* 0: other, 1: line, 2: columnar */
unsigned char mFlg; /* Flags. 1=border-off 2=split-column */
};
/* String constants used by built-in modes */
@@ -1452,30 +1467,29 @@ static const char *aModeStr[] =
/* 9 10 11 12 */
static const ModeInfo aModeInfo[] = {
/* zName eCSep eRSep eNull eText eHdr eBlob bHdr eStyle eCx mFlg */
{ "ascii", 7, 6, 9, 1, 1, 0, 1, 12, 0, 0 },
{ "box", 0, 0, 9, 1, 1, 0, 2, 1, 2, 0 },
{ "c", 4, 1, 10, 5, 5, 4, 1, 12, 0, 0 },
{ "column", 0, 0, 9, 1, 1, 0, 2, 2, 2, 0 },
{ "count", 0, 0, 0, 0, 0, 0, 0, 3, 0, 0 },
{ "csv", 4, 5, 9, 3, 3, 0, 1, 12, 0, 0 },
{ "html", 0, 0, 9, 4, 4, 0, 2, 7, 0, 0 },
{ "insert", 0, 0, 10, 2, 2, 0, 1, 8, 0, 0 },
{ "jatom", 4, 1, 11, 6, 6, 0, 1, 12, 0, 0 },
{ "jobject", 0, 1, 11, 6, 6, 0, 0, 10, 0, 0 },
{ "json", 0, 0, 11, 6, 6, 0, 0, 9, 0, 0 },
{ "line", 0, 1, 9, 1, 1, 0, 0, 11, 1, 0 },
{ "list", 2, 1, 9, 1, 1, 0, 1, 12, 0, 0 },
{ "markdown", 0, 0, 9, 1, 1, 0, 2, 13, 2, 0 },
{ "off", 0, 0, 0, 0, 0, 0, 0, 14, 0, 0 },
{ "psql", 0, 0, 9, 1, 1, 0, 2, 19, 2, 1 },
{ "qbox", 0, 0, 10, 2, 1, 0, 2, 1, 2, 0 },
{ "quote", 4, 1, 10, 2, 2, 0, 1, 12, 0, 0 },
{ "split", 0, 0, 9, 1, 1, 0, 1, 2, 2, 2 },
{ "table", 0, 0, 9, 1, 1, 0, 2, 19, 2, 0 },
{ "tabs", 8, 1, 9, 3, 3, 0, 1, 12, 0, 0 },
{ "tcl", 3, 1, 12, 5, 5, 4, 1, 12, 0, 0 },
{ "www", 0, 0, 9, 4, 4, 0, 2, 7, 0, 0 }
/* zName eCSep eRSep eNull eText eHdr eBlob bHdr eStyle eCx */
{ "ascii", 7, 6, 9, 1, 1, 1, 1, 12, 0 },
{ "box", 0, 0, 9, 1, 1, 1, 2, 1, 2 },
{ "c", 4, 1, 10, 5, 5, 4, 1, 12, 0 },
{ "column", 0, 0, 9, 1, 1, 1, 2, 2, 2 },
{ "count", 0, 0, 0, 0, 0, 0, 0, 3, 0 },
{ "csv", 4, 5, 9, 3, 3, 3, 1, 12, 0 },
{ "html", 0, 0, 9, 4, 4, 1, 2, 7, 0 },
{ "insert", 0, 0, 10, 2, 2, 2, 1, 8, 0 },
{ "jatom", 4, 1, 11, 6, 6, 5, 1, 12, 0 },
{ "jobject", 0, 1, 11, 6, 6, 5, 0, 10, 0 },
{ "json", 0, 0, 11, 6, 6, 0, 0, 9, 0 },
{ "line", 0, 1, 9, 1, 1, 0, 0, 11, 1 },
{ "list", 2, 1, 9, 1, 1, 1, 1, 12, 0 },
{ "markdown", 0, 0, 9, 1, 1, 1, 2, 13, 2 },
{ "off", 0, 0, 0, 0, 0, 0, 0, 14, 0 },
{ "qbox", 0, 0, 9, 2, 1, 2, 2, 1, 2 },
{ "quote", 4, 1, 10, 2, 2, 2, 1, 12, 0 },
{ "split", 0, 0, 9, 1, 1, 1, 1, 2, 2 },
{ "table", 0, 0, 9, 1, 1, 1, 2, 19, 2 },
{ "tabs", 8, 1, 9, 3, 3, 1, 1, 12, 0 },
{ "tcl", 3, 1, 12, 5, 5, 4, 1, 12, 0 },
{ "www", 0, 0, 9, 4, 4, 1, 2, 7, 0 }
}; /* | / / | / / | | \
** | / / | / / | | \_ 2: columnar
** Index into aModeStr[] | / / | | 1: line
@@ -1485,13 +1499,12 @@ static const ModeInfo aModeInfo[] = {
** v-------------------' | hdrs? | The QRF style
** 0: n/a blob | v-----'
** 1: plain v_---------' 0: n/a
** 2: sql 0: auto 1: no
** 2: sql 0: n/a 1: no
** 3: csv 1: as-text 2: yes
** 4: html 2: sql
** 5: c 3: hex
** 6: json 4: c
** 5: json
** 6: size
******************************************************************/
/*
** These are the column/row/line separators used by the various
@@ -1601,12 +1614,7 @@ static void modeChange(ShellState *p, unsigned char eMode){
pM->spec.eBlob = pI->eBlob;
pM->spec.bTitles = pI->bHdr;
pM->spec.eTitle = pI->eHdr;
if( pI->mFlg & 0x01 ){
pM->spec.bBorder = QRF_No;
}else{
pM->spec.bBorder = QRF_Auto;
}
if( pI->mFlg & 0x02 ){
if( eMode==MODE_Split ){
pM->spec.bSplitColumn = QRF_Yes;
pM->bAutoScreenWidth = 1;
}else{
@@ -1625,7 +1633,6 @@ static void modeChange(ShellState *p, unsigned char eMode){
modeFree(&p->mode);
modeChange(p, MODE_QBox);
p->mode.bAutoScreenWidth = 1;
p->mode.spec.eText = QRF_TEXT_Relaxed;
p->mode.spec.nCharLimit = 300;
p->mode.spec.nLineLimit = 5;
p->mode.spec.bTextJsonb = QRF_Yes;
@@ -2375,8 +2382,6 @@ static void shellFormatSchema(
for(i=j=0; (c = z[i])!=0; i++){ /* Copy from z[i] back to z[j] */
if( c==cEnd ){
cEnd = 0;
}else if( cEnd!=0){
/* No-op */
}else if( c=='"' || c=='\'' || c=='`' ){
cEnd = c;
}else if( c=='[' ){
@@ -3189,14 +3194,6 @@ static int shell_exec(
if( pArg->mode.bAutoScreenWidth ){
spec.nScreenWidth = shellScreenWidth();
}
if( spec.eBlob==QRF_BLOB_Auto ){
switch( spec.eText ){
case QRF_TEXT_Relaxed: /* fall through */
case QRF_TEXT_Sql: spec.eBlob = QRF_BLOB_Sql; break;
case QRF_TEXT_Json: spec.eBlob = QRF_BLOB_Json; break;
default: spec.eBlob = QRF_BLOB_Text; break;
}
}
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_AUTHORIZATION)
if( pArg->expert.pExpert ){
@@ -3205,7 +3202,7 @@ static int shell_exec(
}
#endif
while( zSql && zSql[0] && (SQLITE_OK == rc) ){
while( zSql[0] && (SQLITE_OK == rc) ){
static const char *zStmtSql;
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
if( SQLITE_OK != rc ){
@@ -3564,8 +3561,6 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){
savedMode = p->mode;
p->mode.spec.zTableName = (char*)zTable;
p->mode.eMode = MODE_Insert;
p->mode.spec.eText = QRF_TEXT_Sql;
p->mode.spec.eBlob = QRF_BLOB_Sql;
p->mode.spec.bTitles = QRF_No;
rc = shell_exec(p, sSelect.zTxt, 0);
if( (rc&0xff)==SQLITE_CORRUPT ){
@@ -6883,9 +6878,7 @@ static int recoverDatabaseCmd(ShellState *pState, int nArg, char **azArg){
pState->db, "main", recoverSqlCb, (void*)pState
);
if( !pState->bSafeMode ){
sqlite3_recover_config(p, 789, (void*)zRecoveryDb); /* Debug use only */
}
sqlite3_recover_config(p, 789, (void*)zRecoveryDb); /* Debug use only */
sqlite3_recover_config(p, SQLITE_RECOVER_LOST_AND_FOUND, (void*)zLAF);
sqlite3_recover_config(p, SQLITE_RECOVER_ROWIDS, (void*)&bRowids);
sqlite3_recover_config(p, SQLITE_RECOVER_FREELIST_CORRUPT,(void*)&bFreelist);
@@ -7670,16 +7663,13 @@ static int modeTitleDsply(ShellState *p, int bAll){
** meaning "left", "centered", and "right", with
** one letter per column starting from the left.
** Unspecified alignment defaults to 'L'.
** --blob-quote ARG ARG can be "auto", "text", "sql", "hex", "tcl",
** "json", or "size". Default is "auto".
** --border on|off Show outer border on "box" and "table" modes.
** --charlimit N Set the maximum number of output characters to
** show for any single SQL value to N. Longer values
** truncated. Zero means "no limit".
** --colsep STRING Use STRING as the column separator
** --escape ESC Enable/disable escaping of control characters
** found in the output. ESC can be "off", "ascii",
** or "symbol".
** in output. ESC can be "off", "ascii", or
** "symbol".
** --linelimit N Set the maximum number of output lines to show for
** any single SQL value to N. Longer values are
** truncated. Zero means "no limit". Only works
@@ -7691,9 +7681,9 @@ static int modeTitleDsply(ShellState *p, int bAll){
** --once Setting changes to the right are reverted after
** the next SQL command.
** --quote ARG Enable/disable quoting of text. ARG can be
** "off", "on", "sql", "relaxed", "csv", "html",
** "tcl", or "json". "off" means show the text as-is.
** "on" is an alias for "sql".
** "off", "on", "sql", "csv", "html", "tcl",
** or "json". "off" means show the text as-is.
** "on and "sql" are synonyms.
** --reset Changes all mode settings back to their default.
** --rowsep STRING Use STRING as the row separator
** --sw|--screenwidth N Declare the screen width of the output device
@@ -7778,29 +7768,6 @@ static int dotCmdMode(ShellState *p){
"Should contain only characters L, C, and R.");
return 1;
}
}else if( pickStr(z,0,"-blob","-blob-quote","")>=0 ){
if( (++i)>=nArg ){
dotCmdError(p, i-1, "missing argument", 0);
return 1;
}
k = pickStr(azArg[i], 0,
"auto", "text", "sql", "hex", "tcl", "json", "size", "");
/* 0 1 2 3 4 5 6
** Must match QRF_BLOB_xxxx values. See also tag-20251124a */
if( k>=0 ){
p->mode.spec.eBlob = k & 0xff;
}
chng = 1;
}else if( optionMatch(z,"border") ){
if( (++i)>=nArg ){
dotCmdError(p, i-1, "missing argument", 0);
return 1;
}
k = pickStr(azArg[i], 0, "auto", "off", "on", "");
if( k>=0 ){
p->mode.spec.bBorder = k & 0x3;
}
chng = 1;
}else if( 0<=(k=pickStr(z,0,"-charlimit","-linelimit","")) ){
int w; /* 0 1 */
if( i+1>=nArg ){
@@ -7878,8 +7845,6 @@ static int dotCmdMode(ShellState *p){
cli_printf(p->out, " %s", p->aSavedModes[ii].zTag);
}
cli_puts(" batch tty\n", p->out);
chng = 1; /* Not really a change, but we still want to suppress the
** "current mode" output */
}else if( optionMatch(z,"once") ){
p->nPopMode = 0;
modePush(p);
@@ -7887,7 +7852,7 @@ static int dotCmdMode(ShellState *p){
}else if( optionMatch(z,"noquote") ){
/* (undocumented legacy) --noquote always turns quoting off */
p->mode.spec.eText = QRF_TEXT_Plain;
p->mode.spec.eBlob = QRF_BLOB_Auto;
p->mode.spec.eBlob = QRF_BLOB_Text;
chng = 1;
}else if( optionMatch(z,"quote") ){
if( i+1<nArg
@@ -7901,10 +7866,9 @@ static int dotCmdMode(ShellState *p){
if( (k = pickStr(azArg[i],0,"no","yes","0","1",""))>=0 ){
k &= 1; /* 0 for "off". 1 for "on". */
}else{
char *zErr = 0;
k = pickStr(azArg[i],&zErr,
"off","on","sql","csv","html","tcl","json","relaxed","");
/* 0 1 2 3 4 5 6 7 */
char *zErr = 0; /* 0 1 2 3 4 5 6 */
k = pickStr(azArg[i],&zErr,"off","on","sql","csv","html","tcl","json",
"");
if( k<0 ){
dotCmdError(p, i, "unknown", "%z", zErr);
return 1;
@@ -7916,28 +7880,29 @@ static int dotCmdMode(ShellState *p){
}
switch( k ){
case 1: /* on */
modeSetStr(&p->mode.spec.zNull, "NULL");
/* Fall through */
case 2: /* sql */
p->mode.spec.eText = QRF_TEXT_Sql;
p->mode.spec.eBlob = QRF_BLOB_Sql;
break;
case 3: /* csv */
p->mode.spec.eText = QRF_TEXT_Csv;
p->mode.spec.eBlob = QRF_BLOB_Text;
break;
case 4: /* html */
p->mode.spec.eText = QRF_TEXT_Html;
p->mode.spec.eBlob = QRF_BLOB_Text;
break;
case 5: /* tcl */
p->mode.spec.eText = QRF_TEXT_Tcl;
p->mode.spec.eBlob = QRF_BLOB_Text;
break;
case 6: /* json */
p->mode.spec.eText = QRF_TEXT_Json;
p->mode.spec.eBlob = QRF_BLOB_Json;
break;
case 7: /* relaxed */
p->mode.spec.eText = QRF_TEXT_Relaxed;
break;
default: /* off */
default: /* off */
p->mode.spec.eText = QRF_TEXT_Plain;
p->mode.spec.eBlob = QRF_BLOB_Text;
break;
}
chng = 1;
@@ -8026,12 +7991,12 @@ static int dotCmdMode(ShellState *p){
** specify, so strlen(zW) bytes should be plenty of space to hold the
** result. */
aWidth = malloc( strlen(zW) );
while( IsSpace(zW[0]) ) zW++;
while( isspace(zW[0]) ) zW++;
while( zW[0] ){
int w = 0;
int nDigit = 0;
k = zW[0]=='-' && IsDigit(zW[1]);
while( IsDigit(zW[k]) ){
k = zW[0]=='-' && isdigit(zW[1]);
while( isdigit(zW[k]) ){
w = w*10 + zW[k] - '0';
if( w>QRF_MAX_WIDTH ){
dotCmdError(p,i+1,"width too big",
@@ -8052,7 +8017,7 @@ static int dotCmdMode(ShellState *p){
aWidth[nWidth++] = w;
zW += k;
if( zW[0]==',' ) zW++;
while( IsSpace(zW[0]) ) zW++;
while( isspace(zW[0]) ) zW++;
}
free(p->mode.spec.aWidth);
p->mode.spec.aWidth = aWidth;
@@ -8107,21 +8072,7 @@ static int dotCmdMode(ShellState *p){
}
sqlite3_str_append(pDesc, "\"", 1);
}
if( bAll
|| (p->mode.spec.bBorder==QRF_No) != ((pI->mFlg&1)!=0)
){
sqlite3_str_appendf(pDesc," --border %s",
p->mode.spec.bBorder==QRF_No ? "off" : "on");
}
if( bAll || p->mode.spec.eBlob!=QRF_BLOB_Auto ){
const char *azBQuote[] =
{ "auto", "text", "sql", "hex", "tcl", "json", "size" };
/* 0 1 2 3 4 5 6
** Must match QRF_BLOB_xxxx values. See all instances of tag-20251124a */
u8 e = p->mode.spec.eBlob;
sqlite3_str_appendf(pDesc, " --blob-quote %s", azBQuote[e]);
}
if( !bAll && p->mode.spec.nLineLimit==0 && p->mode.spec.nCharLimit>0 ){
if( bAll || p->mode.spec.nCharLimit>0 ){
sqlite3_str_appendf(pDesc, " --charlimit %d",p->mode.spec.nCharLimit);
}
zSetting = aModeStr[pI->eCSep];
@@ -8132,15 +8083,7 @@ static int dotCmdMode(ShellState *p){
if( bAll || p->mode.spec.eEsc!=QRF_Auto ){
sqlite3_str_appendf(pDesc, " --escape %s",qrfEscNames[p->mode.spec.eEsc]);
}
if( bAll || (p->mode.spec.nLineLimit>0 && p->mode.spec.nCharLimit>0) ){
if( p->mode.spec.nLineLimit==0 && p->mode.spec.nCharLimit==0 ){
sqlite3_str_appendf(pDesc, " --limits off");
}else{
sqlite3_str_appendf(pDesc, " --limits %d,%d",
p->mode.spec.nLineLimit, p->mode.spec.nCharLimit);
}
}else
if( p->mode.spec.nCharLimit==0 && p->mode.spec.nLineLimit>0 && pI->eCx>0 ){
if( bAll || (p->mode.spec.nLineLimit>0 && pI->eCx>0) ){
sqlite3_str_appendf(pDesc, " --linelimit %d",p->mode.spec.nLineLimit);
}
zSetting = aModeStr[pI->eNull];
@@ -9678,8 +9621,6 @@ static int do_meta_command(const char *zLine, ShellState *p){
int openMode = SHELL_OPEN_UNSPEC;
int openFlags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;
if( p->bSafeMode ) openFlags = SQLITE_OPEN_READONLY;
/* Check for command-line arguments */
for(iName=1; iName<nArg; iName++){
const char *z = azArg[iName];
@@ -9687,10 +9628,10 @@ static int do_meta_command(const char *zLine, ShellState *p){
if( optionMatch(z,"new") ){
newFlag = 1;
#ifdef SQLITE_HAVE_ZLIB
}else if( optionMatch(z, "zip") && !p->bSafeMode ){
}else if( optionMatch(z, "zip") ){
openMode = SHELL_OPEN_ZIPFILE;
#endif
}else if( optionMatch(z, "append") && !p->bSafeMode ){
}else if( optionMatch(z, "append") ){
openMode = SHELL_OPEN_APPENDVFS;
}else if( optionMatch(z, "readonly") ){
openFlags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
@@ -10859,6 +10800,7 @@ static int do_meta_command(const char *zLine, ShellState *p){
|| (c=='i' && (cli_strncmp(azArg[0], "indices", n)==0
|| cli_strncmp(azArg[0], "indexes", n)==0) )
){
int ii;
sqlite3_stmt *pStmt;
sqlite3_str *pSql;
const char *zPattern = nArg>1 ? azArg[1] : 0;
@@ -10880,7 +10822,7 @@ static int do_meta_command(const char *zLine, ShellState *p){
goto meta_command_exit;
}
pSql = sqlite3_str_new(p->db);
while( sqlite3_step(pStmt)==SQLITE_ROW ){
for(ii=0; sqlite3_step(pStmt)==SQLITE_ROW; ii++){
const char *zDbName = (const char*)sqlite3_column_text(pStmt, 1);
if( zDbName==0 ) continue;
if( sqlite3_str_length(pSql) ){
@@ -12361,14 +12303,18 @@ static void main_init(ShellState *p) {
*/
#if defined(_WIN32) || defined(WIN32)
static void printBold(const char *zText){
#if !SQLITE_OS_WINRT
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO defaultScreenInfo;
GetConsoleScreenBufferInfo(out, &defaultScreenInfo);
SetConsoleTextAttribute(out,
FOREGROUND_RED|FOREGROUND_INTENSITY
);
#endif
sputz(stdout, zText);
#if !SQLITE_OS_WINRT
SetConsoleTextAttribute(out, defaultScreenInfo.wAttributes);
#endif
}
#else
static void printBold(const char *zText){
@@ -12474,7 +12420,11 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
}
}else{
#if defined(_WIN32) || defined(WIN32)
#if SQLITE_OS_WINRT
__debugbreak();
#else
DebugBreak();
#endif
#elif defined(SIGTRAP)
raise(SIGTRAP);
#endif
@@ -12765,8 +12715,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
#else
cli_printf(stderr,
"%s: Error: no database filename specified\n", Argv0);
rc = 1;
goto shell_main_exit;
return 1;
#endif
}
data.out = stdout;
@@ -12820,8 +12769,6 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
modeChange(&data, MODE_Markdown);
}else if( cli_strcmp(z,"-table")==0 ){
modeChange(&data, MODE_Table);
}else if( cli_strcmp(z,"-psql")==0 ){
modeChange(&data, MODE_Psql);
}else if( cli_strcmp(z,"-box")==0 ){
modeChange(&data, MODE_Box);
}else if( cli_strcmp(z,"-csv")==0 ){
@@ -12908,8 +12855,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
}else if( cli_strcmp(z,"-version")==0 ){
cli_printf(stdout, "%s %s (%d-bit)\n",
sqlite3_libversion(), sqlite3_sourceid(), 8*(int)sizeof(char*));
rc = 0;
goto shell_main_exit;
return 0;
}else if( cli_strcmp(z,"-interactive")==0 ){
/* Need to check for interactive override here to so that it can
** affect console setup (for Windows only) and testing thereof.
@@ -12966,29 +12912,25 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
z = cmdline_option_value(argc,argv,++i);
if( z[0]=='.' ){
rc = do_meta_command(z, &data);
if( rc && bail_on_error ){
if( rc==2 ) rc = 0;
goto shell_main_exit;
}
if( rc && bail_on_error ) return rc==2 ? 0 : rc;
}else{
open_db(&data, 0);
rc = shell_exec(&data, z, &zErrMsg);
if( zErrMsg!=0 ){
shellEmitError(zErrMsg);
sqlite3_free(zErrMsg);
if( !rc ) rc = 1;
if( bail_on_error ) return rc!=0 ? rc : 1;
}else if( rc!=0 ){
cli_printf(stderr,"Error: unable to process SQL \"%s\"\n", z);
if( bail_on_error ) return rc;
}
if( bail_on_error ) goto shell_main_exit;
}
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB)
}else if( cli_strncmp(z, "-A", 2)==0 ){
if( nCmd>0 ){
cli_printf(stderr,"Error: cannot mix regular SQL or dot-commands"
" with \"%s\"\n", z);
rc = 1;
goto shell_main_exit;
return 1;
}
open_db(&data, OPEN_DB_ZIPFILE);
if( z[2] ){
@@ -13008,8 +12950,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
}else{
cli_printf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
eputz("Use -help for a list of options.\n");
rc = 1;
goto shell_main_exit;
return 1;
}
}
+3 -6
View File
@@ -766,9 +766,7 @@ struct sqlite3_file {
**
** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
** [SQLITE_SYNC_FULL]. The first choice is the normal fsync().
** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY]
** flag may be ORed in to indicate that only the data of the file
** and not its inode needs to be synced.
** The second choice is a Mac OS X style fullsync.
**
** The integer values to xLock() and xUnlock() are one of
** <ul>
@@ -1490,7 +1488,7 @@ typedef const char *sqlite3_filename;
** greater and the function pointer is not NULL) and will fall back
** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
**
** ^The xSetSystemCall(), xGetSystemCall(), and xNextSystemCall() interfaces
** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
** are not used by the SQLite core. These optional interfaces are provided
** by some VFSes to facilitate testing of the VFS code. By overriding
** system calls with functions under its control, a test program can
@@ -4174,7 +4172,6 @@ void sqlite3_free_filename(sqlite3_filename);
** <li> sqlite3_errmsg()
** <li> sqlite3_errmsg16()
** <li> sqlite3_error_offset()
** <li> sqlite3_db_handle()
** </ul>
**
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
@@ -8731,7 +8728,7 @@ sqlite3_str *sqlite3_str_new(sqlite3*);
** pass the returned value to [sqlite3_free()] to avoid a memory leak.
** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
** errors were encountered during construction of the string. ^The
** [sqlite3_str_finish(X)] interface might also return a NULL pointer if the
** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the
** string in [sqlite3_str] object X is zero bytes long.
**
** ^The [sqlite3_str_free(X)] interface destroys both the sqlite3_str object
+10 -8
View File
@@ -4152,19 +4152,19 @@ struct Trigger {
** orconf -> stores the ON CONFLICT algorithm
** pSelect -> The content to be inserted - either a SELECT statement or
** a VALUES clause.
** pSrc -> Table to insert into.
** zTarget -> Dequoted name of the table to insert into.
** pIdList -> If this is an INSERT INTO ... (<column-names>) VALUES ...
** statement, then this stores the column-names to be
** inserted into.
** pUpsert -> The ON CONFLICT clauses for an Upsert
**
** (op == TK_DELETE)
** pSrc -> Table to delete from
** zTarget -> Dequoted name of the table to delete from.
** pWhere -> The WHERE clause of the DELETE statement if one is specified.
** Otherwise NULL.
**
** (op == TK_UPDATE)
** pSrc -> Table to update, followed by any FROM clause tables.
** zTarget -> Dequoted name of the table to update.
** pWhere -> The WHERE clause of the UPDATE statement if one is specified.
** Otherwise NULL.
** pExprList -> A list of the columns to update and the expressions to update
@@ -4184,7 +4184,8 @@ struct TriggerStep {
u8 orconf; /* OE_Rollback etc. */
Trigger *pTrig; /* The trigger that this step is a part of */
Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */
SrcList *pSrc; /* Table to insert/update/delete */
char *zTarget; /* Target table for DELETE, UPDATE, INSERT */
SrcList *pFrom; /* FROM clause for UPDATE statement (if any) */
Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */
ExprList *pExprList; /* SET clause for UPDATE, or RETURNING clause */
IdList *pIdList; /* Column names for INSERT */
@@ -4933,7 +4934,6 @@ int sqlite3NoTempsInRange(Parse*,int,int);
#endif
Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
Expr *sqlite3Expr(sqlite3*,int,const char*);
Expr *sqlite3ExprInt32(sqlite3*,int);
void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*);
void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
@@ -5252,16 +5252,17 @@ void sqlite3MaterializeView(Parse*, Table*, Expr*, ExprList*,Expr*,int);
void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);
TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*,
const char*,const char*);
TriggerStep *sqlite3TriggerInsertStep(Parse*,SrcList*, IdList*,
TriggerStep *sqlite3TriggerInsertStep(Parse*,Token*, IdList*,
Select*,u8,Upsert*,
const char*,const char*);
TriggerStep *sqlite3TriggerUpdateStep(Parse*,SrcList*,SrcList*,ExprList*,
TriggerStep *sqlite3TriggerUpdateStep(Parse*,Token*,SrcList*,ExprList*,
Expr*, u8, const char*,const char*);
TriggerStep *sqlite3TriggerDeleteStep(Parse*,SrcList*, Expr*,
TriggerStep *sqlite3TriggerDeleteStep(Parse*,Token*, Expr*,
const char*,const char*);
void sqlite3DeleteTrigger(sqlite3*, Trigger*);
void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);
u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int);
SrcList *sqlite3TriggerStepSrc(Parse*, TriggerStep*);
# define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p))
# define sqlite3IsToplevel(p) ((p)->pToplevel==0)
#else
@@ -5275,6 +5276,7 @@ void sqlite3MaterializeView(Parse*, Table*, Expr*, ExprList*,Expr*,int);
# define sqlite3ParseToplevel(p) p
# define sqlite3IsToplevel(p) 1
# define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0
# define sqlite3TriggerStepSrc(A,B) 0
#endif
int sqlite3JoinType(Parse*, Token*, Token*, Token*);
-3
View File
@@ -60,9 +60,6 @@
** It used to be the case that setting this value to zero would
** turn the limit off. That is no longer true. It is not possible
** to turn this limit off.
**
** The hard limit is the largest possible 32-bit signed integer less
** 1024, or 2147482624.
*/
#ifndef SQLITE_MAX_SQL_LENGTH
# define SQLITE_MAX_SQL_LENGTH 1000000000
+12 -18
View File
@@ -2062,10 +2062,10 @@ static void DbHookCmd(
** -blob ("auto"|"text"|"sql"|...) How to escape BLOB values
** -wordwrap ("auto"|"off"|"on") Try to wrap at word boundry?
** -textjsonb ("auto"|"off"|"on") Auto-convert JSONB to text?
** -textnull ("auto"|"off"|"on") Use text encoding for -null.
** -splitcolumn ("auto"|"off"|"on") Enable split-column mode
** -defaultalign ("auto"|"left"|...) Default alignment
** -titalalign ("auto"|"left"|"right"|...) Default column name alignment
** -border ("auto"|"off"|"on") Border for box and table styles
** -wrap NUMBER Max width of any single column
** -screenwidth NUMBER Width of the display TTY
** -linelimit NUMBER Max lines for any cell
@@ -2089,10 +2089,10 @@ static void DbHookCmd(
** -blob eBlob
** -wordwrap bWordWrap
** -textjsonb bTextJsonb
** -textnull bTestNull
** -splitcolumn bSplitColumn
** -defaultalign eDfltAlign
** -titlealign eTitleAlign
** -border bBorder
** -wrap nWrap
** -screenwidth nScreenWidth
** -linelimit nLineLimit
@@ -2193,13 +2193,13 @@ static int dbQrf(SqliteDb *pDb, int objc, Tcl_Obj *const*objv){
** thrid element of the array when processing --text */
static const char *azText[] = { "off", "on",
"auto", "csv", "html",
"json", "plain", "relaxed",
"sql", "tcl", 0
"json", "plain", "sql",
"tcl", 0
};
static unsigned char aTextMap[] = {
QRF_TEXT_Auto, QRF_TEXT_Csv, QRF_TEXT_Html,
QRF_TEXT_Json, QRF_TEXT_Plain, QRF_TEXT_Relaxed,
QRF_TEXT_Sql, QRF_TEXT_Tcl
QRF_TEXT_Json, QRF_TEXT_Plain, QRF_TEXT_Sql,
QRF_TEXT_Tcl
};
int txt;
int k = zArg[2]=='e';
@@ -2219,13 +2219,11 @@ static int dbQrf(SqliteDb *pDb, int objc, Tcl_Obj *const*objv){
}else if( strcmp(zArg,"-blob")==0 ){
static const char *azBlob[] = {
"auto", "hex", "json",
"tcl", "text", "sql",
"size", 0
"tcl", "text", "sql", 0
};
static unsigned char aBlobMap[] = {
QRF_BLOB_Auto, QRF_BLOB_Hex, QRF_BLOB_Json,
QRF_BLOB_Tcl, QRF_BLOB_Text, QRF_BLOB_Sql,
QRF_BLOB_Size
QRF_BLOB_Tcl, QRF_BLOB_Text, QRF_BLOB_Sql
};
int blob;
rc = Tcl_GetIndexFromObj(pDb->interp, objv[i+1], azBlob,
@@ -2241,17 +2239,17 @@ static int dbQrf(SqliteDb *pDb, int objc, Tcl_Obj *const*objv){
qrf.bWordWrap = aBoolMap[v];
i++;
}else if( strcmp(zArg,"-textjsonb")==0
|| strcmp(zArg,"-textnull")==0
|| strcmp(zArg,"-splitcolumn")==0
|| strcmp(zArg,"-border")==0
){
int v = 0;
rc = Tcl_GetIndexFromObj(pDb->interp, objv[i+1], azBool,
zArg, 0, &v);
if( rc ) goto format_failed;
if( zArg[1]=='t' ){
if( zArg[5]=='j' ){
qrf.bTextJsonb = aBoolMap[v];
}else if( zArg[1]=='b' ){
qrf.bBorder = aBoolMap[v];
}else if( zArg[5]=='n' ){
qrf.bTextNull = aBoolMap[v];
}else{
qrf.bSplitColumn = aBoolMap[v];
}
@@ -2361,10 +2359,6 @@ static int dbQrf(SqliteDb *pDb, int objc, Tcl_Obj *const*objv){
}else if( strcmp(zArg,"-null")==0 ){
qrf.zNull = Tcl_GetString(objv[i+1]);
i++;
}else if( strcmp(zArg,"-version")==0 ){
/* Undocumented. Testing use only */
qrf.iVersion = atoi(Tcl_GetString(objv[i+1]));
i++;
}else{
Tcl_AppendResult(pDb->interp, "unknown option: ", zArg, (char*)0);
rc = TCL_ERROR;
+7 -1
View File
@@ -82,7 +82,7 @@ static void set_options(Tcl_Interp *interp){
Tcl_SetVar2(interp, "sqlite_options","configslower","1.0",TCL_GLOBAL_ONLY);
#endif
#if !SQLITE_OS_WINCE
#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT
Tcl_SetVar2(interp, "sqlite_options", "curdir", "1", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "curdir", "0", TCL_GLOBAL_ONLY);
@@ -94,6 +94,12 @@ static void set_options(Tcl_Interp *interp){
Tcl_SetVar2(interp, "sqlite_options", "win32malloc", "0", TCL_GLOBAL_ONLY);
#endif
#if defined(SQLITE_OS_WINRT) && SQLITE_OS_WINRT
Tcl_SetVar2(interp, "sqlite_options", "winrt", "1", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "winrt", "0", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_DEBUG
Tcl_SetVar2(interp, "sqlite_options", "debug", "1", TCL_GLOBAL_ONLY);
#else
+1 -1
View File
@@ -514,7 +514,7 @@ static int fsSync(sqlite3_file *pFile, int flags){
rc = pRealFile->pMethods->xWrite(pRealFile, zSize, 4, 0);
}
if( rc==SQLITE_OK ){
rc = pRealFile->pMethods->xSync(pRealFile, flags&(~SQLITE_SYNC_DATAONLY));
rc = pRealFile->pMethods->xSync(pRealFile, flags);
}
return rc;
+4
View File
@@ -387,7 +387,11 @@ static char *quota_utf8_to_mbcs(const char *zUtf8){
zTmpWide = (LPWSTR)sqlite3_malloc( (nWide+1)*sizeof(zTmpWide[0]) );
if( zTmpWide==0 ) return 0;
MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zTmpWide, nWide);
#ifdef SQLITE_OS_WINRT
codepage = CP_ACP;
#else
codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;
#endif
nMbcs = WideCharToMultiByte(codepage, 0, zTmpWide, nWide, 0, 0, 0, 0);
zMbcs = nMbcs ? (char*)sqlite3_malloc( nMbcs+1 ) : 0;
if( zMbcs ){
-6
View File
@@ -436,12 +436,6 @@ static int tvfsSync(sqlite3_file *pFile, int flags){
case SQLITE_SYNC_FULL:
zFlags = "full";
break;
case SQLITE_SYNC_NORMAL|SQLITE_SYNC_DATAONLY:
zFlags = "normal|dataonly";
break;
case SQLITE_SYNC_FULL|SQLITE_SYNC_DATAONLY:
zFlags = "full|dataonly";
break;
default:
assert(0);
}
+1 -1
View File
@@ -604,7 +604,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql){
int tokenType; /* type of the next token */
int lastTokenParsed = -1; /* type of the previous token */
sqlite3 *db = pParse->db; /* The database connection */
i64 mxSqlLen; /* Max length of an SQL string */
int mxSqlLen; /* Max length of an SQL string */
Parse *pParentParse = 0; /* Outer parse context, if any */
#ifdef sqlite3Parser_ENGINEALWAYSONSTACK
yyParser sEngine; /* Space to hold the Lemon-generated Parser object */
+74 -56
View File
@@ -26,7 +26,7 @@ void sqlite3DeleteTriggerStep(sqlite3 *db, TriggerStep *pTriggerStep){
sqlite3SelectDelete(db, pTmp->pSelect);
sqlite3IdListDelete(db, pTmp->pIdList);
sqlite3UpsertDelete(db, pTmp->pUpsert);
sqlite3SrcListDelete(db, pTmp->pSrc);
sqlite3SrcListDelete(db, pTmp->pFrom);
sqlite3DbFree(db, pTmp->zSpan);
sqlite3DbFree(db, pTmp);
@@ -365,12 +365,12 @@ void sqlite3FinishTrigger(
if( sqlite3ReadOnlyShadowTables(db) ){
TriggerStep *pStep;
for(pStep=pTrig->step_list; pStep; pStep=pStep->pNext){
if( pStep->pSrc!=0
&& sqlite3ShadowTableName(db, pStep->pSrc->a[0].zName)
if( pStep->zTarget!=0
&& sqlite3ShadowTableName(db, pStep->zTarget)
){
sqlite3ErrorMsg(pParse,
"trigger \"%s\" may not write to shadow table \"%s\"",
pTrig->zName, pStep->pSrc->a[0].zName);
pTrig->zName, pStep->zTarget);
goto triggerfinish_cleanup;
}
}
@@ -461,39 +461,26 @@ TriggerStep *sqlite3TriggerSelectStep(
static TriggerStep *triggerStepAllocate(
Parse *pParse, /* Parser context */
u8 op, /* Trigger opcode */
SrcList *pTabList, /* Target table */
Token *pName, /* The target name */
const char *zStart, /* Start of SQL text */
const char *zEnd /* End of SQL text */
){
Trigger *pNew = pParse->pNewTrigger;
sqlite3 *db = pParse->db;
TriggerStep *pTriggerStep = 0;
TriggerStep *pTriggerStep;
if( pParse->nErr==0 ){
if( pNew
&& pNew->pSchema!=db->aDb[1].pSchema
&& pTabList->a[0].u4.zDatabase
){
sqlite3ErrorMsg(pParse,
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
"statements within triggers");
}else{
pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep));
if( pTriggerStep ){
pTriggerStep->pSrc = sqlite3SrcListDup(db, pTabList, EXPRDUP_REDUCE);
pTriggerStep->op = op;
pTriggerStep->zSpan = triggerSpanDup(db, zStart, zEnd);
if( pTriggerStep->pSrc && IN_RENAME_OBJECT ){
sqlite3RenameTokenRemap(pParse,
pTriggerStep->pSrc->a[0].zName,
pTabList->a[0].zName
);
}
}
if( pParse->nErr ) return 0;
pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n + 1);
if( pTriggerStep ){
char *z = (char*)&pTriggerStep[1];
memcpy(z, pName->z, pName->n);
sqlite3Dequote(z);
pTriggerStep->zTarget = z;
pTriggerStep->op = op;
pTriggerStep->zSpan = triggerSpanDup(db, zStart, zEnd);
if( IN_RENAME_OBJECT ){
sqlite3RenameTokenMap(pParse, pTriggerStep->zTarget, pName);
}
}
sqlite3SrcListDelete(db, pTabList);
return pTriggerStep;
}
@@ -506,7 +493,7 @@ static TriggerStep *triggerStepAllocate(
*/
TriggerStep *sqlite3TriggerInsertStep(
Parse *pParse, /* Parser */
SrcList *pTabList, /* Table to INSERT into */
Token *pTableName, /* Name of the table into which we insert */
IdList *pColumn, /* List of columns in pTableName to insert into */
Select *pSelect, /* A SELECT statement that supplies values */
u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */
@@ -519,7 +506,7 @@ TriggerStep *sqlite3TriggerInsertStep(
assert(pSelect != 0 || db->mallocFailed);
pTriggerStep = triggerStepAllocate(pParse, TK_INSERT, pTabList, zStart, zEnd);
pTriggerStep = triggerStepAllocate(pParse, TK_INSERT, pTableName,zStart,zEnd);
if( pTriggerStep ){
if( IN_RENAME_OBJECT ){
pTriggerStep->pSelect = pSelect;
@@ -551,7 +538,7 @@ TriggerStep *sqlite3TriggerInsertStep(
*/
TriggerStep *sqlite3TriggerUpdateStep(
Parse *pParse, /* Parser */
SrcList *pTabList, /* Name of the table to be updated */
Token *pTableName, /* Name of the table to be updated */
SrcList *pFrom, /* FROM clause for an UPDATE-FROM, or NULL */
ExprList *pEList, /* The SET clause: list of column and new values */
Expr *pWhere, /* The WHERE clause */
@@ -562,36 +549,21 @@ TriggerStep *sqlite3TriggerUpdateStep(
sqlite3 *db = pParse->db;
TriggerStep *pTriggerStep;
pTriggerStep = triggerStepAllocate(pParse, TK_UPDATE, pTabList, zStart, zEnd);
pTriggerStep = triggerStepAllocate(pParse, TK_UPDATE, pTableName,zStart,zEnd);
if( pTriggerStep ){
SrcList *pFromDup = 0;
if( IN_RENAME_OBJECT ){
pTriggerStep->pExprList = pEList;
pTriggerStep->pWhere = pWhere;
pFromDup = pFrom;
pTriggerStep->pFrom = pFrom;
pEList = 0;
pWhere = 0;
pFrom = 0;
}else{
pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE);
pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE);
pFromDup = sqlite3SrcListDup(db, pFrom, EXPRDUP_REDUCE);
pTriggerStep->pFrom = sqlite3SrcListDup(db, pFrom, EXPRDUP_REDUCE);
}
pTriggerStep->orconf = orconf;
if( pFromDup && !IN_RENAME_OBJECT){
Select *pSub;
Token as = {0, 0};
pSub = sqlite3SelectNew(pParse, 0, pFromDup, 0,0,0,0, SF_NestedFrom, 0);
pFromDup = sqlite3SrcListAppendFromTerm(pParse, 0, 0, 0, &as, pSub ,0);
}
if( pFromDup && pTriggerStep->pSrc ){
pTriggerStep->pSrc = sqlite3SrcListAppendList(
pParse, pTriggerStep->pSrc, pFromDup
);
}else{
sqlite3SrcListDelete(db, pFromDup);
}
}
sqlite3ExprListDelete(db, pEList);
sqlite3ExprDelete(db, pWhere);
@@ -606,7 +578,7 @@ TriggerStep *sqlite3TriggerUpdateStep(
*/
TriggerStep *sqlite3TriggerDeleteStep(
Parse *pParse, /* Parser */
SrcList *pTabList, /* The table from which rows are deleted */
Token *pTableName, /* The table from which rows are deleted */
Expr *pWhere, /* The WHERE clause */
const char *zStart, /* Start of SQL text */
const char *zEnd /* End of SQL text */
@@ -614,7 +586,7 @@ TriggerStep *sqlite3TriggerDeleteStep(
sqlite3 *db = pParse->db;
TriggerStep *pTriggerStep;
pTriggerStep = triggerStepAllocate(pParse, TK_DELETE, pTabList, zStart, zEnd);
pTriggerStep = triggerStepAllocate(pParse, TK_DELETE, pTableName,zStart,zEnd);
if( pTriggerStep ){
if( IN_RENAME_OBJECT ){
pTriggerStep->pWhere = pWhere;
@@ -876,6 +848,52 @@ Trigger *sqlite3TriggersExist(
return triggersReallyExist(pParse,pTab,op,pChanges,pMask);
}
/*
** Convert the pStep->zTarget string into a SrcList and return a pointer
** to that SrcList.
**
** This routine adds a specific database name, if needed, to the target when
** forming the SrcList. This prevents a trigger in one database from
** referring to a target in another database. An exception is when the
** trigger is in TEMP in which case it can refer to any other database it
** wants.
*/
SrcList *sqlite3TriggerStepSrc(
Parse *pParse, /* The parsing context */
TriggerStep *pStep /* The trigger containing the target token */
){
sqlite3 *db = pParse->db;
SrcList *pSrc; /* SrcList to be returned */
char *zName = sqlite3DbStrDup(db, pStep->zTarget);
pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
assert( pSrc==0 || pSrc->nSrc==1 );
assert( zName || pSrc==0 );
if( pSrc ){
Schema *pSchema = pStep->pTrig->pSchema;
pSrc->a[0].zName = zName;
if( pSchema!=db->aDb[1].pSchema ){
assert( pSrc->a[0].fg.fixedSchema || pSrc->a[0].u4.zDatabase==0 );
pSrc->a[0].u4.pSchema = pSchema;
pSrc->a[0].fg.fixedSchema = 1;
}
if( pStep->pFrom ){
SrcList *pDup = sqlite3SrcListDup(db, pStep->pFrom, 0);
if( pDup && pDup->nSrc>1 && !IN_RENAME_OBJECT ){
Select *pSubquery;
Token as;
pSubquery = sqlite3SelectNew(pParse,0,pDup,0,0,0,0,SF_NestedFrom,0);
as.n = 0;
as.z = 0;
pDup = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0);
}
pSrc = sqlite3SrcListAppendList(pParse, pSrc, pDup);
}
}else{
sqlite3DbFree(db, zName);
}
return pSrc;
}
/*
** Return true if the pExpr term from the RETURNING clause argument
** list is of the form "*". Raise an error if the terms if of the
@@ -1141,7 +1159,7 @@ static int codeTriggerProgram(
switch( pStep->op ){
case TK_UPDATE: {
sqlite3Update(pParse,
sqlite3SrcListDup(db, pStep->pSrc, 0),
sqlite3TriggerStepSrc(pParse, pStep),
sqlite3ExprListDup(db, pStep->pExprList, 0),
sqlite3ExprDup(db, pStep->pWhere, 0),
pParse->eOrconf, 0, 0, 0
@@ -1151,7 +1169,7 @@ static int codeTriggerProgram(
}
case TK_INSERT: {
sqlite3Insert(pParse,
sqlite3SrcListDup(db, pStep->pSrc, 0),
sqlite3TriggerStepSrc(pParse, pStep),
sqlite3SelectDup(db, pStep->pSelect, 0),
sqlite3IdListDup(db, pStep->pIdList),
pParse->eOrconf,
@@ -1162,7 +1180,7 @@ static int codeTriggerProgram(
}
case TK_DELETE: {
sqlite3DeleteFrom(pParse,
sqlite3SrcListDup(db, pStep->pSrc, 0),
sqlite3TriggerStepSrc(pParse, pStep),
sqlite3ExprDup(db, pStep->pWhere, 0), 0, 0
);
sqlite3VdbeAddOp0(v, OP_ResetCount);
+23 -30
View File
@@ -7380,9 +7380,6 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
sqlite3 *db = pParse->db;
int iEnd = sqlite3VdbeCurrentAddr(v);
int nRJ = 0;
#ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
int addrSeek = 0;
#endif
/* Generate loop termination code.
*/
@@ -7395,10 +7392,7 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
** the RIGHT JOIN table */
WhereRightJoin *pRJ = pLevel->pRJ;
sqlite3VdbeResolveLabel(v, pLevel->addrCont);
/* Replace addrCont with a new label that will never be used, just so
** the subsequent call to resolve pLevel->addrCont will have something
** to resolve. */
pLevel->addrCont = sqlite3VdbeMakeLabel(pParse);
pLevel->addrCont = 0;
pRJ->endSubrtn = sqlite3VdbeCurrentAddr(v);
sqlite3VdbeAddOp3(v, OP_Return, pRJ->regReturn, pRJ->addrSubrtn, 1);
VdbeCoverage(v);
@@ -7407,6 +7401,7 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
pLoop = pLevel->pWLoop;
if( pLevel->op!=OP_Noop ){
#ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
int addrSeek = 0;
Index *pIdx;
int n;
if( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED
@@ -7429,26 +7424,25 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
sqlite3VdbeAddOp2(v, OP_Goto, 1, pLevel->p2);
}
#endif /* SQLITE_DISABLE_SKIPAHEAD_DISTINCT */
}
if( pTabList->a[pLevel->iFrom].fg.fromExists && i==pWInfo->nLevel-1 ){
/* If the EXISTS-to-JOIN optimization was applied, then the EXISTS
** loop(s) will be the inner-most loops of the join. There might be
** multiple EXISTS loops, but they will all be nested, and the join
** order will not have been changed by the query planner. If the
** inner-most EXISTS loop sees a single successful row, it should
** break out of *all* EXISTS loops. But only the inner-most of the
** nested EXISTS loops should do this breakout. */
int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */
while( nOuter<i ){
if( !pTabList->a[pLevel[-nOuter-1].iFrom].fg.fromExists ) break;
nOuter++;
if( pTabList->a[pLevel->iFrom].fg.fromExists && i==pWInfo->nLevel-1 ){
/* If the EXISTS-to-JOIN optimization was applied, then the EXISTS
** loop(s) will be the inner-most loops of the join. There might be
** multiple EXISTS loops, but they will all be nested, and the join
** order will not have been changed by the query planner. If the
** inner-most EXISTS loop sees a single successful row, it should
** break out of *all* EXISTS loops. But only the inner-most of the
** nested EXISTS loops should do this breakout. */
int nOuter = 0; /* Nr of outer EXISTS that this one is nested within */
while( nOuter<i ){
if( !pTabList->a[pLevel[-nOuter-1].iFrom].fg.fromExists ) break;
nOuter++;
}
testcase( nOuter>0 );
sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk);
VdbeComment((v, "EXISTS break"));
}
testcase( nOuter>0 );
sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel[-nOuter].addrBrk);
VdbeComment((v, "EXISTS break"));
}
sqlite3VdbeResolveLabel(v, pLevel->addrCont);
if( pLevel->op!=OP_Noop ){
/* The common case: Advance to the next row */
if( pLevel->addrCont ) sqlite3VdbeResolveLabel(v, pLevel->addrCont);
sqlite3VdbeAddOp3(v, pLevel->op, pLevel->p1, pLevel->p2, pLevel->p3);
sqlite3VdbeChangeP5(v, pLevel->p5);
VdbeCoverage(v);
@@ -7461,11 +7455,10 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
VdbeCoverage(v);
}
#ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT
if( addrSeek ){
sqlite3VdbeJumpHere(v, addrSeek);
addrSeek = 0;
}
if( addrSeek ) sqlite3VdbeJumpHere(v, addrSeek);
#endif
}else if( pLevel->addrCont ){
sqlite3VdbeResolveLabel(v, pLevel->addrCont);
}
if( (pLoop->wsFlags & WHERE_IN_ABLE)!=0 && pLevel->u.in.nIn>0 ){
struct InLoop *pIn;
+4 -2
View File
@@ -1609,11 +1609,13 @@ static void whereAddLimitExpr(
int iVal = 0;
if( sqlite3ExprIsInteger(pExpr, &iVal, pParse) && iVal>=0 ){
Expr *pVal = sqlite3ExprInt32(db, iVal);
Expr *pVal = sqlite3Expr(db, TK_INTEGER, 0);
if( pVal==0 ) return;
ExprSetProperty(pVal, EP_IntValue);
pVal->u.iValue = iVal;
pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal);
}else{
Expr *pVal = sqlite3ExprAlloc(db, TK_REGISTER, 0, 0);
Expr *pVal = sqlite3Expr(db, TK_REGISTER, 0);
if( pVal==0 ) return;
pVal->iTable = iReg;
pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal);
+4 -2
View File
@@ -717,7 +717,7 @@ void sqlite3WindowUpdate(
pWin->eEnd = aUp[i].eEnd;
pWin->eExclude = 0;
if( pWin->eStart==TK_FOLLOWING ){
pWin->pStart = sqlite3ExprInt32(db, 1);
pWin->pStart = sqlite3Expr(db, TK_INTEGER, "1");
}
break;
}
@@ -1062,7 +1062,9 @@ int sqlite3WindowRewrite(Parse *pParse, Select *p){
** keep everything legal in this case.
*/
if( pSublist==0 ){
pSublist = sqlite3ExprListAppend(pParse, 0, sqlite3ExprInt32(db, 0));
pSublist = sqlite3ExprListAppend(pParse, 0,
sqlite3Expr(db, TK_INTEGER, "0")
);
}
pSub = sqlite3SelectNew(
-3
View File
@@ -23,9 +23,6 @@ ifcapable !altertable {
do_execsql_test 1.0 {
CREATE TABLE t1(a);
CREATE TEMP TRIGGER tr1 AFTER INSERT ON t1 BEGIN
SELECT 123;
END;
}
faultsim_save_and_close
-48
View File
@@ -778,52 +778,4 @@ do_execsql_test 31.2 {
SELECT rr FROM t1 LIMIT 1
} {5.0}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 32.1.0 {
CREATE TABLE t1(
a INT,
b INT,
-- comment with comma
c INT
);
}
do_execsql_test 32.1.1 {
ALTER TABLE t1 DROP COLUMN c;
}
do_execsql_test 32.1.2 {
SELECT sql FROM sqlite_schema
} {{CREATE TABLE t1(
a INT,
b INT)}}
reset_db
do_execsql_test 32.2.0 {
CREATE TABLE t1(
a INT,
b INT,
-- comment with, comma
c INT
);
}
do_execsql_test 32.2.1 {
ALTER TABLE t1 DROP COLUMN c;
}
do_execsql_test 32.2.2 {
SELECT sql FROM sqlite_schema
} {{CREATE TABLE t1(
a INT,
b INT)}}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 33.1 {
CREATE TABLE x1(a TEXT, b INTEGER, c CHECK(c!=0));
}
do_execsql_test 33.2 {
ALTER TABLE x1 DROP COLUMN b;
SELECT sql FROM sqlite_schema;
} {{CREATE TABLE x1(a TEXT, c CHECK(c!=0))}}
finish_test
+1 -1
View File
@@ -41,7 +41,7 @@ do_execsql_test 1.0 {
CREATE TABLE t4(a);
CREATE TRIGGER r1 INSERT ON t1 BEGIN
UPDATE t1 SET d='xyz' FROM t2, t3;
UPDATE t1 SET d='xyz' FROM t2, t3;
END;
}
+5 -9
View File
@@ -325,8 +325,6 @@ foreach {tn sql error ac data } {
# EVIDENCE-OF: R-43190-62442 In other words, the schema-name. prefix on
# the table name of the UPDATE is not allowed within triggers.
#
# Update: Unless the trigger is in the temp schema.
#
do_update_tests e_update-2.1 -error {
qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers
} {
@@ -341,14 +339,12 @@ do_update_tests e_update-2.1 -error {
UPDATE aux.t1 SET a=1, b=2;
END;
} {}
}
# Qualified table name is allowed as t4 is a temp table.
do_execsql_test e_update-2.1.3 {
CREATE TRIGGER tr1 AFTER DELETE ON t4 BEGIN
UPDATE main.t1 SET a=1, b=2;
END;
DROP TRIGGER tr1;
3 {
CREATE TRIGGER tr1 AFTER DELETE ON t4 BEGIN
UPDATE main.t1 SET a=1, b=2;
END;
} {}
}
# EVIDENCE-OF: R-06085-13761 Unless the table to which the trigger is
+7 -5
View File
@@ -36,11 +36,13 @@ do_test filectrl-1.5 {
sqlite3 db test_control_lockproxy.db
file_control_lockproxy_test db [get_pwd]
} {}
do_test filectrl-1.6 {
sqlite3 db test.db
set fn [file_control_tempfilename db]
set fn
} {/etilqs_/}
ifcapable !winrt {
do_test filectrl-1.6 {
sqlite3 db test.db
set fn [file_control_tempfilename db]
set fn
} {/etilqs_/}
}
db close
forcedelete .test_control_lockproxy.db-conch test.proxy
forcedelete test.db test2.db
-3
View File
@@ -53,9 +53,6 @@ for {set tn 1} {1} {incr tn} {
}
}
do_catchsql_test 1.5 {
INSERT INTO x1(x1) VALUES('maxpendinAB64');
} {1 {SQL logic error}}
finish_test
+14 -53
View File
@@ -24,67 +24,28 @@ INSERT INTO t1 SELECT d,e,a,b,c FROM t1;
.output memory
SELECT * FROM t1;
.output --verify END
─────┬───────┬───────┬───────┬───────
─────┬───────┬───────┬───────┬───────
│ a │ b │ c │ d │ e │
╞═════╪═══════╪═══════╪═══════╪═══════╡
1 2.5 │ three │ DD │ │
│ 2.5 │ three │ DD │ │ 1
│ DD │ │ 1 2.5 │ three │
│ │ 1 2.5 │ three │ DD │
─────┴───────┴───────┴───────┴───────
├─────┼───────┼───────┼───────┼───────┤
│ 1 2.5 │ three │ DD │ │
│ 2.5 │ three │ DD │ │ 1
│ DD │ │ 1 │ 2.5 │ three │
│ │ 1 │ 2.5 │ three │ DD │
─────┴───────┴───────┴───────┴───────
END
.output memory
.mode --null xyz
SELECT * FROM t1;
.output --verify END
─────┬───────┬───────┬───────┬───────
─────┬───────┬───────┬───────┬───────
│ a │ b │ c │ d │ e │
╞═════╪═══════╪═══════╪═══════╪═══════╡
1 2.5 │ three │ DD │ xyz │
│ 2.5 │ three │ DD │ xyz │ 1
│ DD │ xyz │ 1 2.5 │ three │
│ xyz │ 1 2.5 │ three │ DD │
─────┴───────┴───────┴───────┴───────
END
# Default output mode is qbox --quote relaxed
#
.mode tty --wrap 10
CREATE TABLE t2(a,b,c,d);
INSERT INTO t2 VALUES(1,2.5,'three',x'4444');
INSERT INTO t2 VALUES('The quick fox jumps over the lazy brown dog',2,3,4);
INSERT INTO t2 VALUES('10','', -1.25,NULL);
INSERT INTO t2 VALUES('a,b,c','"Double-Quoted"','-1.25','NULL');
.output memory
SELECT * FROM t2;
.output --verify END
╭────────────┬────────────┬─────────┬─────────╮
│ a │ b │ c │ d │
╞════════════╪════════════╪═════════╪═════════╡
│ 1 │ 2.5 │ three │ x'4444' │
├────────────┼────────────┼─────────┼─────────┤
│ The quick │ 2 │ 3 │ 4 │
│ fox jumps │ │ │ │
│ over the │ │ │ │
│ lazy brown │ │ │ │
│ dog │ │ │ │
├────────────┼────────────┼─────────┼─────────┤
│ '10' │ │ -1.25 │ NULL │
├────────────┼────────────┼─────────┼─────────┤
│ a,b,c │ "Double- │ '-1.25' │ 'NULL' │
│ │ Quoted" │ │ │
╰────────────┴────────────┴─────────┴─────────╯
END
.output memory
.mode
.output --verify END
current output mode: qbox --limits 5,300 --quote relaxed --screenwidth auto --textjsonb on
END
.output memory
.mode -v
.output --verify END
current output mode: qbox --align "" --border on --blob-quote auto --colsep "" --escape auto --limits 5,300 --null "NULL" --quote relaxed --rowsep "" --screenwidth auto --tablename "" --textjsonb on --titles on --widths "" --wordwrap off --wrap 10
├─────┼───────┼───────┼───────┼───────┤
│ 1 2.5 │ three │ DD │ xyz │
│ 2.5 │ three │ DD │ xyz │ 1
│ DD │ xyz │ 1 │ 2.5 │ three │
│ xyz │ 1 │ 2.5 │ three │ DD │
─────┴───────┴───────┴───────┴───────
END
.output memory --error-prefix "Error:"
+122 -239
View File
@@ -24,76 +24,59 @@ do_execsql_test 1.0 {
do_test 1.10 {
set result "\n[db format {SELECT * FROM t1}]"
} {
──────┬─────┬───────
──────┬─────┬───────
│ a │ b │ c │
╞══════╪═════╪═══════╡
1 │ 2.5 │ three │
├──────┼─────┼───────┤
1 │ 2.5 │ three │
│ BLOB │ │ Ἀμήν │
──────┴─────┴───────
──────┴─────┴───────
}
do_test 1.11a {
set result "\n[db format -title off {SELECT * FROM t1}]"
} {
──────┬─────┬───────
1 │ 2.5 │ three │
──────┬─────┬───────
1 │ 2.5 │ three │
│ BLOB │ │ Ἀμήν │
──────┴─────┴───────
──────┴─────┴───────
}
do_test 1.11b {
set result "\n[db format -text sql {SELECT * FROM t1}]"
} {
─────────────┬─────┬─────────
─────────────┬─────┬─────────
│ a │ b │ c │
╞═════════════╪═════╪═════════╡
1 │ 2.5 │ 'three' │
├─────────────┼─────┼─────────┤
1 │ 2.5 │ 'three' │
│ x'424c4f42' │ │ 'Ἀμήν' │
─────────────┴─────┴─────────
}
do_test 1.11c {
set result "\n[db format -text sql -border off {SELECT * FROM t1}]"
} {
a │ b │ c
═════════════╪═════╪═════════
1 │ 2.5 │ 'three'
x'424c4f42' │ │ 'Ἀμήν'
}
do_test 1.11d {
set result "\n[db format -text relaxed -blob sql -border off \
{SELECT * FROM t1}]"
} {
a │ b │ c
═════════════╪═════╪═══════
1 │ 2.5 │ three
x'424c4f42' │ │ Ἀμήν
─────────────┴─────┴─────────
}
do_test 1.12 {
set result "\n[db format -text csv {SELECT * FROM t1}]"
} {
────────────────────┬─────┬────────
────────────────────┬─────┬────────
│ a │ b │ c │
╞════════════════════╪═════╪════════╡
1 │ 2.5 │ three │
├────────────────────┼─────┼────────┤
1 │ 2.5 │ three │
│ "\102\114\117\102" │ │ "Ἀμήν" │
────────────────────┴─────┴────────
────────────────────┴─────┴────────
}
do_test 1.13 {
set result "\n[db format -text csv -blob hex {SELECT * FROM t1}]"
} {
──────────┬─────┬────────
──────────┬─────┬────────
│ a │ b │ c │
╞══════════╪═════╪════════╡
1 │ 2.5 │ three │
├──────────┼─────┼────────┤
1 │ 2.5 │ three │
│ 424c4f42 │ │ "Ἀμήν" │
──────────┴─────┴────────
──────────┴─────┴────────
}
do_test 1.14 {
catch {db format -text unk -blob hex {SELECT * FROM t1}} res
set res
} {bad -text "unk": must be auto, csv, html, json, plain, relaxed, sql, or tcl}
} {bad -text "unk": must be auto, csv, html, json, plain, sql, or tcl}
do_test 1.15 {
catch {db format -text sql -blob unk {SELECT * FROM t1}} res
set res
} {bad BLOB encoding (-blob) "unk": must be auto, hex, json, tcl, text, sql, or size}
} {bad BLOB encoding (-blob) "unk": must be auto, hex, json, tcl, text, or sql}
do_test 1.16 {
catch {db format -text sql -style unk {SELECT * FROM t1}} res
set res
@@ -103,12 +86,12 @@ do_test 1.16 {
do_test 1.20 {
set result "\n[db format -style box {SELECT * FROM t1}]"
} {
──────┬─────┬───────
──────┬─────┬───────
│ a │ b │ c │
╞══════╪═════╪═══════╡
1 │ 2.5 │ three │
├──────┼─────┼───────┤
1 │ 2.5 │ three │
│ BLOB │ │ Ἀμήν │
──────┴─────┴───────
──────┴─────┴───────
}
do_test 1.30 {
@@ -129,44 +112,6 @@ do_test 1.31 {
| BLOB | | Ἀμήν |
+------+-----+-------+
}
do_test 1.32 {
set result "\n[db format -style table -border off {SELECT * FROM t1}]"
} {
a | b | c
------+-----+-------
1 | 2.5 | three
BLOB | | Ἀμήν
}
do_test 1.33 {
set result "\n[db format -style table -border off \
-screenwidth 15 \
{SELECT * FROM t1}]"
} {
a | b | c
----+---+-----
1|2.5|three
BLOB| |Ἀμήν
}
do_test 1.34 {
set result "\n[db format -style box -border off \
-screenwidth 30 \
{SELECT * FROM t1}]"
} {
a │ b │ c
══════╪═════╪═══════
1 │ 2.5 │ three
BLOB │ │ Ἀμήν
}
do_test 1.35 {
set result "\n[db format -style box -border off \
-screenwidth 15 \
{SELECT * FROM t1}]"
} {
a │ b │ c
════╪═══╪═════
1│2.5│three
BLOB│ │Ἀμήν
}
do_test 1.40 {
set result "\n[db format -style column {SELECT * FROM t1}]"
@@ -192,19 +137,19 @@ do_test 1.60a {
} "1,2.5,three\r\n\"\\102\\114\\117\\102\",,\"Ἀμήν\"\r\n"
do_test 1.60b {
db format -style csv -columnsep xyz -rowsep pqr -text sql -blob sql {SELECT * FROM t1}
} "1,2.5,three\r\nx'424c4f42',,\"Ἀμήν\"\r\n"
} "1,2.5,three\r\nBLOB,,\"Ἀμήν\"\r\n"
do_test 1.61a {
db format -style list -columnsep , -rowsep \r\n -text csv -title auto -blob tcl {SELECT * FROM t1}
} "a,b,c\r\n1,2.5,three\r\n\"\\102\\114\\117\\102\",,\"Ἀμήν\"\r\n"
do_test 1.61b {
db format -style csv -title auto -blob tcl {SELECT * FROM t1}
} "a,b,c\r\n1,2.5,three\r\n\"\\102\\114\\117\\102\",,\"Ἀμήν\"\r\n"
} "a,b,c\r\n1,2.5,three\r\nBLOB,,\"Ἀμήν\"\r\n"
do_test 1.62a {
db format -style list -columnsep , -rowsep \r\n -text csv -title csv -blob tcl {SELECT a AS 'a x y', b, c FROM t1}
} "\"a x y\",b,c\r\n1,2.5,three\r\n\"\\102\\114\\117\\102\",,\"Ἀμήν\"\r\n"
do_test 1.62b {
db format -style csv -title csv -blob tcl {SELECT a AS 'a x y', b, c FROM t1}
} "\"a x y\",b,c\r\n1,2.5,three\r\n\"\\102\\114\\117\\102\",,\"Ἀμήν\"\r\n"
} "\"a x y\",b,c\r\n1,2.5,three\r\nBLOB,,\"Ἀμήν\"\r\n"
do_test 1.70 {
set result "\n[db format -style html {SELECT * FROM t1}]"
@@ -345,7 +290,7 @@ x'424c4f42'|NULL|'Ἀμήν'
do_test 1.118 {
set rc [catch {db format -style list -title unk {SELECT * FROM t1}} res]
lappend rc $res
} {1 {bad -title "unk": must be off, on, auto, csv, html, json, plain, relaxed, sql, or tcl}}
} {1 {bad -title "unk": must be off, on, auto, csv, html, json, plain, sql, or tcl}}
do_test 1.120 {
@@ -386,86 +331,86 @@ do_test 2.1 {
set result "\n[db format -widths {5 -5 19} -wordwrap on \
{SELECT * FROM t1}]"
} {
───────┬───────┬─────────────────────
───────┬───────┬─────────────────────
│ a │ b │ c │
╞═══════╪═══════╪═════════════════════╡
1 │ 2 │ The quick fox jumps │
├───────┼───────┼─────────────────────┤
1 │ 2 │ The quick fox jumps │
│ │ │ over the lazy brown │
│ │ │ dog. │
───────┴───────┴─────────────────────
───────┴───────┴─────────────────────
}
do_test 2.2 {
set result "\n[db format -widths {5 -5 19} -wordwrap off \
{SELECT * FROM t1}]"
} {
───────┬───────┬─────────────────────
───────┬───────┬─────────────────────
│ a │ b │ c │
╞═══════╪═══════╪═════════════════════╡
1 │ 2 │ The quick fox jumps │
├───────┼───────┼─────────────────────┤
1 │ 2 │ The quick fox jumps │
│ │ │ over the lazy brown │
│ │ │ dog. │
───────┴───────┴─────────────────────
───────┴───────┴─────────────────────
}
do_test 2.3 {
set result "\n[db format -widths {5 -5 18} -wordwrap on \
{SELECT * FROM t1}]"
} {
───────┬───────┬────────────────────
───────┬───────┬────────────────────
│ a │ b │ c │
╞═══════╪═══════╪════════════════════╡
1 │ 2 │ The quick fox │
├───────┼───────┼────────────────────┤
1 │ 2 │ The quick fox │
│ │ │ jumps over the │
│ │ │ lazy brown dog. │
───────┴───────┴────────────────────
───────┴───────┴────────────────────
}
do_test 2.4 {
set result "\n[db format -widths {5 -5 -18} -wordwrap on \
{SELECT * FROM t1}]"
} {
───────┬───────┬────────────────────
───────┬───────┬────────────────────
│ a │ b │ c │
╞═══════╪═══════╪════════════════════╡
1 │ 2 │ The quick fox │
├───────┼───────┼────────────────────┤
1 │ 2 │ The quick fox │
│ │ │ jumps over the │
│ │ │ lazy brown dog. │
───────┴───────┴────────────────────
───────┴───────┴────────────────────
}
do_test 2.5 {
set result "\n[db format -widths {5 -5 19} -wordwrap off \
{SELECT * FROM t1}]"
} {
───────┬───────┬─────────────────────
───────┬───────┬─────────────────────
│ a │ b │ c │
╞═══════╪═══════╪═════════════════════╡
1 │ 2 │ The quick fox jumps │
├───────┼───────┼─────────────────────┤
1 │ 2 │ The quick fox jumps │
│ │ │ over the lazy brown │
│ │ │ dog. │
───────┴───────┴─────────────────────
───────┴───────┴─────────────────────
}
do_test 2.6 {
set result "\n[db format -widths {5 -5 18} -wordwrap off \
{SELECT * FROM t1}]"
} {
───────┬───────┬────────────────────
───────┬───────┬────────────────────
│ a │ b │ c │
╞═══════╪═══════╪════════════════════╡
1 │ 2 │ The quick fox jump │
├───────┼───────┼────────────────────┤
1 │ 2 │ The quick fox jump │
│ │ │ s over the lazy br │
│ │ │ own dog. │
───────┴───────┴────────────────────
───────┴───────┴────────────────────
}
do_test 2.7 {
set result "\n[db format -widths {5 5 18} -wordwrap yes \
-align {left center right} -titlealign right \
{SELECT * FROM t1}]"
} {
───────┬───────┬────────────────────
───────┬───────┬────────────────────
│ a │ b │ c │
╞═══════╪═══════╪════════════════════╡
├───────┼───────┼────────────────────┤
│ 1 │ 2 │ The quick fox │
│ │ │ jumps over the │
│ │ │ lazy brown dog. │
───────┴───────┴────────────────────
───────┴───────┴────────────────────
}
do_test 2.8 {
set result "\n[db format -widths {5 8 11} -wordwrap yes \
@@ -473,15 +418,15 @@ do_test 2.8 {
-defaultalign right \
{SELECT * FROM t1}]"
} {
───────┬──────────┬─────────────
───────┬──────────┬─────────────
│ a │ b │ c │
╞═══════╪══════════╪═════════════╡
├───────┼──────────┼─────────────┤
│ 1 │ 2 │ The quick │
│ │ │ fox jumps │
│ │ │ over the │
│ │ │ lazy brown │
│ │ │ dog. │
───────┴──────────┴─────────────
───────┴──────────┴─────────────
}
do_test 2.9 {
catch {db format -align {auto xyz 123} {SELECT * FROM t1}} res
@@ -505,27 +450,27 @@ do_test 2.31 {
set result "\n[db format -widths {5 -5 18} -wordwrap on \
{SELECT * FROM t1}]"
} {
───────┬───────┬────────────────────
───────┬───────┬────────────────────
│ a │ b │ c │
╞═══════╪═══════╪════════════════════╡
1 │ 2 │ Η γρήγορη αλεπού │
├───────┼───────┼────────────────────┤
1 │ 2 │ Η γρήγορη αλεπού │
│ │ │ πηδάει πάνω από το │
│ │ │ τεμπέλικο καφέ │
│ │ │ σκυλί │
───────┴───────┴────────────────────
───────┴───────┴────────────────────
}
do_test 2.32 {
set result "\n[db format -widths {5 5 18} -align {left center center} -wordwrap on \
{SELECT * FROM t1}]"
} {
───────┬───────┬────────────────────
───────┬───────┬────────────────────
│ a │ b │ c │
╞═══════╪═══════╪════════════════════╡
│ 1 │ 2 Η γρήγορη αλεπού │
├───────┼───────┼────────────────────┤
│ 1 │ 2Η γρήγορη αλεπού
│ │ │ πηδάει πάνω από το │
│ │ │ τεμπέλικο καφέ │
│ │ │ σκυλί
───────┴───────┴────────────────────
│ │ │ τεμπέλικο καφέ
│ │ │ σκυλί
───────┴───────┴────────────────────
}
@@ -536,39 +481,39 @@ do_execsql_test 3.0 {
do_test 3.1 {
set result "\n[db format {SELECT * FROM t1}]"
} {
───┬───┬────────────────────────
───┬───┬────────────────────────
│ a │ b │ c │
╞═══╪═══╪════════════════════════╡
├───┼───┼────────────────────────┤
│ 1 │ 2 │ abc^[[1;31m123^[[0mxyz │
───┴───┴────────────────────────
───┴───┴────────────────────────
}
do_test 3.2 {
set result "\n[db format -esc off {SELECT * FROM t1}]"
string map [list \033 X] $result
} {
───┬───┬───────────
───┬───┬───────────
│ a │ b │ c │
╞═══╪═══╪═══════════╡
├───┼───┼───────────┤
│ 1 │ 2 │ abcX[1;31m123X[0mxyz │
───┴───┴───────────
───┴───┴───────────
}
do_test 3.3 {
set result "\n[db format -esc symbol {SELECT * FROM t1}]"
} {
───┬───┬──────────────────────
───┬───┬──────────────────────
│ a │ b │ c │
╞═══╪═══╪══════════════════════╡
├───┼───┼──────────────────────┤
│ 1 │ 2 │ abc␛[1;31m123␛[0mxyz │
───┴───┴──────────────────────
───┴───┴──────────────────────
}
do_test 3.4 {
set result "\n[db format -esc ascii {SELECT * FROM t1}]"
} {
───┬───┬────────────────────────
───┬───┬────────────────────────
│ a │ b │ c │
╞═══╪═══╪════════════════════════╡
├───┼───┼────────────────────────┤
│ 1 │ 2 │ abc^[[1;31m123^[[0mxyz │
───┴───┴────────────────────────
───┴───┴────────────────────────
}
do_test 3.5 {
catch {db format -esc unk {SELECT * FROM t1}} res
@@ -582,31 +527,31 @@ do_execsql_test 4.0 {
do_test 4.1 {
set result "\n[db format -text sql {SELECT * FROM t1}]"
} {
─────────────────┬───────────────────────┬────
─────────────────┬───────────────────────┬────
│ a │ b │ c │
╞═════════════════╪═══════════════════════╪════╡
├─────────────────┼───────────────────────┼────┤
│ '{"a":5,"b":6}' │ x'8c1763133117641332' │ 99 │
─────────────────┴───────────────────────┴────
─────────────────┴───────────────────────┴────
}
do_test 4.2 {
set result "\n[db format -text sql -textjsonb on {SELECT * FROM t1}]"
} {
─────────────────┬────────────────────────┬────
─────────────────┬────────────────────────┬────
│ a │ b │ c │
╞═════════════════╪════════════════════════╪════╡
├─────────────────┼────────────────────────┼────┤
│ '{"a":5,"b":6}' │ jsonb('{"c":1,"d":2}') │ 99 │
─────────────────┴────────────────────────┴────
─────────────────┴────────────────────────┴────
}
do_test 4.3 {
set result "\n[db format -text plain -textjsonb on -wrap 11 \
{SELECT a AS json, b AS jsonb, c AS num FROM t1}]"
} {
─────────────┬─────────────┬─────
─────────────┬─────────────┬─────
│ json │ jsonb │ num │
╞═════════════╪═════════════╪═════╡
│ {"a":5,"b": │ {"c":1,"d": │ 99 │
├─────────────┼─────────────┼─────┤
│ {"a":5,"b": │ {"c":1,"d": │ 99
│ 6} │ 2} │ │
─────────────┴─────────────┴─────
─────────────┴─────────────┴─────
}
do_execsql_test 5.0 {
@@ -692,9 +637,9 @@ do_test 5.3a {
-text plain -esc off -textjsonb no \
-wordwrap yes -linelimit 2 $sql]"
} {
──────────────┬────────────┬────────────┬────────────────
──────────────┬────────────┬────────────┬────────────────
│ name │ mtime │ time │ value │
╞══════════════╪════════════╪════════════╪════════════════╡
├──────────────┼────────────┼────────────┼────────────────┤
│ sample-jsonb │ 1333101221 │ 2012-03-30 │ x'cc7c57616c70 │
│ │ │ 09:53:41 │ 6861b535332e31 │
│ │ │ │ ... │
@@ -706,7 +651,7 @@ do_test 5.3a {
│ entry-one │ 1708791504 │ 2024-02-24 │ x'000000000000 │
│ │ │ 16:18:24 │ 00000000000000 │
│ │ │ │ ... │
──────────────┴────────────┴────────────┴────────────────
──────────────┴────────────┴────────────┴────────────────
}
do_test 5.3b {
set result "\n[db format -style table -widths {0 10 10 14}\
@@ -763,14 +708,14 @@ do_test 5.4 {
set result "\n[db format -style box -widths {1 2 3 4 5}\
-linelimit 3 -wordwrap off {SELECT *, 'x' AS x FROM t2}]"
} {
────┬────┬─────┬──────┬───────┬───
────┬────┬─────┬──────┬───────┬───
│ a │ b │ c │ d │ e │ x │
╞════╪════╪═════╪══════╪═══════╪═══╡
├────┼────┼─────┼──────┼───────┼───┤
│ ab │ ab │ abc │ abcd │ abcde │ x │
│ cd │ cd │ def │ efgh │ fghij │ │
│ ef │ ef │ ghi │ ijkl │ klmno │ │
│ .. │ .. │ ... │ ... │ ... │ │
────┴────┴─────┴──────┴───────┴───
────┴────┴─────┴──────┴───────┴───
}
do_execsql_test 6.0 {
@@ -785,6 +730,31 @@ do_test 6.1a {
} {
1,2.5,"three","\064\040\050\146\157\165\162\051",NULL
}
do_test 6.1b {
set result "\n[db format -style list -null NULL \
-text tcl -columnsep , -textnull off \
{SELECT * FROM t2}]"
} {
1,2.5,"three","\064\040\050\146\157\165\162\051",NULL
}
do_test 6.1c {
set result "\n[db format -style list -null NULL \
-text tcl -columnsep , -textnull auto \
{SELECT * FROM t2}]"
} {
1,2.5,"three","\064\040\050\146\157\165\162\051",NULL
}
do_test 6.2 {
set result "\n[db format -style list -null NULL \
-text tcl -columnsep , -textnull yes \
{SELECT * FROM t2}]"
} {
1,2.5,"three","\064\040\050\146\157\165\162\051","NULL"
}
do_test 6.3 {
catch {db format -textnull xyz {SELECT * FROM t2}} res
set res
} {bad -textnull "xyz": must be auto, yes, no, on, or off}
do_execsql_test 7.0 {
CREATE TABLE t7(a,b);
@@ -1019,93 +989,6 @@ cinderella-cinderella gertrude lisa paula tammy xanthippe
daniel harold mike quintus ulysses yates
}
do_test 11.1 {
set result "\n[db format -style table -blob size {SELECT randomblob(1234)}]"
} {
+------------------+
| randomblob(1234) |
+------------------+
| (1234-byte blob) |
+------------------+
}
do_test 12.1 {
set result "\n[db format -style box -text html \
{SELECT 'abc','','xyz'}]"
} {
╭───────┬────┬───────╮
│ 'abc' │ '' │ 'xyz' │
╞═══════╪════╪═══════╡
│ abc │ │ xyz │
╰───────┴────┴───────╯
}
# Tests for "relaxed" quoting
#
do_test 13.2 {
db eval {
CREATE TABLE t13(a,b);
INSERT INTO t13(a,b) VALUES
(1,'NULL'),
(0,'-NULL-'),
(0,''),
(1,'''abcde'),
(1,'abcde'''),
(0,'abcde'),
(1,' abcde'),
(1,'abcde '),
(1,'+0'),
(1,'-0'),
(1,'012345'),
(0,'012xyz345'),
(1,'0123.45'),
(0,'12.34.56'),
(0,'12.3e'),
(1,'12.3e+123'),
(1,'12.3e-34'),
(1,'12.3E56'),
(1,'12E56'),
(0,'12.5E5.6'),
(0,'12.5e+'),
(0,'12.5e-'),
(1,'+Inf'),(1,'-Inf'),(1,'Inf');
}
set result \n[db format -style box -text relaxed -null NULL \
-align {center left} \
{SELECT if(a,'yes','') AS 'quoted?', b AS string
FROM t13 ORDER BY rowid}]
} {
╭─────────┬─────────────╮
│ quoted? │ string │
╞═════════╪═════════════╡
│ yes │ 'NULL' │
│ │ -NULL- │
│ │ │
│ yes │ '''abcde' │
│ yes │ 'abcde''' │
│ │ abcde │
│ yes │ ' abcde' │
│ yes │ 'abcde ' │
│ yes │ '+0' │
│ yes │ '-0' │
│ yes │ '012345' │
│ │ 012xyz345 │
│ yes │ '0123.45' │
│ │ 12.34.56 │
│ │ 12.3e │
│ yes │ '12.3e+123' │
│ yes │ '12.3e-34' │
│ yes │ '12.3E56' │
│ yes │ '12E56' │
│ │ 12.5E5.6 │
│ │ 12.5e+ │
│ │ 12.5e- │
│ yes │ '+Inf' │
│ yes │ '-Inf' │
│ yes │ 'Inf' │
╰─────────┴─────────────╯
}
db close
finish_test
+36 -36
View File
@@ -60,30 +60,30 @@ do_test 1.10 {
{SELECT * FROM mlink ORDER BY rowid}]"
} {
───────┬───────┬───────┬───────┬──────┬───────┬───────┬───────
───────┬───────┬───────┬───────┬──────┬───────┬───────┬───────
│ mid │ fid │ pmid │ pid │ fnid │ pfnid │ mperm │ isaux │
╞═══════╪═══════╪═══════╪═══════╪══════╪═══════╪═══════╪═══════╡
│ 28775 │ 28774 │ 28773 │ 28706 │ 1000
│ 28773 │ 28706 │ 28770 │ 28685 │ 1000
│ 28770 │ 28736 │ 28769 │ 28695 │ 2000
│ 28770 │ 28697 │ 28769 │ 28698 │ 3000
│ 28767 │ 28768 │ 28759 │ 28746 │ 4000
───────┴───────┴───────┴───────┴──────┴───────┴───────┴───────
├───────┼───────┼───────┼───────┼──────┼───────┼───────┼───────┤
│ 28775 │ 28774 │ 28773 │ 28706 │ 1000
│ 28773 │ 28706 │ 28770 │ 28685 │ 1000
│ 28770 │ 28736 │ 28769 │ 28695 │ 2000
│ 28770 │ 28697 │ 28769 │ 28698 │ 3000
│ 28767 │ 28768 │ 28759 │ 28746 │ 4000
───────┴───────┴───────┴───────┴──────┴───────┴───────┴───────
}
do_test 1.11 {
set x "\n[db format -style box -screenwidth 52 \
{SELECT * FROM mlink ORDER BY rowid}]"
} {
─────┬─────┬─────┬─────┬────┬─────┬─────┬─────
─────┬─────┬─────┬─────┬────┬─────┬─────┬─────
│ mid │ fid │pmid │ pid │fnid│pfnid│mperm│isaux│
╞═════╪═════╪═════╪═════╪════╪═════╪═════╪═════╡
│28775│28774│28773│28706│ 1000
│28773│28706│28770│28685│ 1000
│28770│28736│28769│28695│ 2000
│28770│28697│28769│28698│ 3000
│28767│28768│28759│28746│ 4000
─────┴─────┴─────┴─────┴────┴─────┴─────┴─────
├─────┼─────┼─────┼─────┼────┼─────┼─────┼─────┤
│28775│28774│28773│28706│1000
│28773│28706│28770│28685│1000
│28770│28736│28769│28695│2000
│28770│28697│28769│28698│3000
│28767│28768│28759│28746│4000
─────┴─────┴─────┴─────┴────┴─────┴─────┴─────
}
do_test 1.20 {
@@ -94,11 +94,11 @@ do_test 1.20 {
+-------+-------+-------+-------+------+-------+-------+-------+
| mid | fid | pmid | pid | fnid | pfnid | mperm | isaux |
+-------+-------+-------+-------+------+-------+-------+-------+
| 28775 | 28774 | 28773 | 28706 | 1 | 0 | 0 | 0 |
| 28773 | 28706 | 28770 | 28685 | 1 | 0 | 0 | 0 |
| 28770 | 28736 | 28769 | 28695 | 2 | 0 | 0 | 0 |
| 28770 | 28697 | 28769 | 28698 | 3 | 0 | 0 | 0 |
| 28767 | 28768 | 28759 | 28746 | 4 | 0 | 0 | 0 |
| 28775 | 28774 | 28773 | 28706 | 1 | 0 | 0 | 0 |
| 28773 | 28706 | 28770 | 28685 | 1 | 0 | 0 | 0 |
| 28770 | 28736 | 28769 | 28695 | 2 | 0 | 0 | 0 |
| 28770 | 28697 | 28769 | 28698 | 3 | 0 | 0 | 0 |
| 28767 | 28768 | 28759 | 28746 | 4 | 0 | 0 | 0 |
+-------+-------+-------+-------+------+-------+-------+-------+
}
do_test 1.21 {
@@ -109,11 +109,11 @@ do_test 1.21 {
+-----+-----+-----+-----+----+-----+-----+-----+
| mid | fid |pmid | pid |fnid|pfnid|mperm|isaux|
+-----+-----+-----+-----+----+-----+-----+-----+
|28775|28774|28773|28706| 1| 0| 0| 0|
|28773|28706|28770|28685| 1| 0| 0| 0|
|28770|28736|28769|28695| 2| 0| 0| 0|
|28770|28697|28769|28698| 3| 0| 0| 0|
|28767|28768|28759|28746| 4| 0| 0| 0|
|28775|28774|28773|28706|1 |0 |0 |0 |
|28773|28706|28770|28685|1 |0 |0 |0 |
|28770|28736|28769|28695|2 |0 |0 |0 |
|28770|28697|28769|28698|3 |0 |0 |0 |
|28767|28768|28759|28746|4 |0 |0 |0 |
+-----+-----+-----+-----+----+-----+-----+-----+
}
@@ -124,11 +124,11 @@ do_test 1.30 {
} {
| mid | fid | pmid | pid | fnid | pfnid | mperm | isaux |
|-------|-------|-------|-------|------|-------|-------|-------|
| 28775 | 28774 | 28773 | 28706 | 1 | 0 | 0 | 0 |
| 28773 | 28706 | 28770 | 28685 | 1 | 0 | 0 | 0 |
| 28770 | 28736 | 28769 | 28695 | 2 | 0 | 0 | 0 |
| 28770 | 28697 | 28769 | 28698 | 3 | 0 | 0 | 0 |
| 28767 | 28768 | 28759 | 28746 | 4 | 0 | 0 | 0 |
| 28775 | 28774 | 28773 | 28706 | 1 | 0 | 0 | 0 |
| 28773 | 28706 | 28770 | 28685 | 1 | 0 | 0 | 0 |
| 28770 | 28736 | 28769 | 28695 | 2 | 0 | 0 | 0 |
| 28770 | 28697 | 28769 | 28698 | 3 | 0 | 0 | 0 |
| 28767 | 28768 | 28759 | 28746 | 4 | 0 | 0 | 0 |
}
do_test 1.31 {
set x "\n[db format -style markdown -screenwidth 52 \
@@ -137,11 +137,11 @@ do_test 1.31 {
} {
| mid | fid |pmid | pid |fnid|pfnid|mperm|isaux|
|-----|-----|-----|-----|----|-----|-----|-----|
|28775|28774|28773|28706| 1| 0| 0| 0|
|28773|28706|28770|28685| 1| 0| 0| 0|
|28770|28736|28769|28695| 2| 0| 0| 0|
|28770|28697|28769|28698| 3| 0| 0| 0|
|28767|28768|28759|28746| 4| 0| 0| 0|
|28775|28774|28773|28706|1 |0 |0 |0 |
|28773|28706|28770|28685|1 |0 |0 |0 |
|28770|28736|28769|28695|2 |0 |0 |0 |
|28770|28697|28769|28698|3 |0 |0 |0 |
|28767|28768|28759|28746|4 |0 |0 |0 |
}
do_test 1.40 {
-37
View File
@@ -1,37 +0,0 @@
# 2025-12-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.
#
#***********************************************************************
#
# Test cases for the Query Result Formatter (QRF)
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix qrf05
do_execsql_test 1.0 {
CREATE TABLE t1(a INT NOT NULL);
}
do_test 1.1 {
set rc [catch {db format -style list \
{INSERT INTO t1 VALUES(123) RETURNING *}} msg]
list $rc [string trim $msg]
} {0 123}
do_test 1.2 {
set rc [catch {db format -style list \
{INSERT INTO t1 VALUES(NULL) RETURNING *}} msg]
list $rc [string trim $msg]
} {1 {NOT NULL constraint failed: t1.a}}
do_test 1.3 {
set rc [catch {db format -version 99 {SELECT * FROM t1}} msg]
list $rc [string trim $msg]
} {1 {unusable sqlite3_qrf_spec.iVersion (99)}}
finish_test
-576
View File
@@ -1,576 +0,0 @@
# 2025-12-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.
#
#***********************************************************************
#
# Test cases for the Query Result Formatter (QRF), and especially
# the sqlite3_qrf_wcwidth() function and its utilization.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix qrf06
# Data
db eval {
BEGIN TRANSACTION;
CREATE TABLE language(name TEXT);
INSERT INTO language(name) VALUES
('العربية'),
('Deutsch'),
('English'),
('Español'),
('فارسی'),
('Français'),
('Italiano'),
('مصرى'),
('Nederlands'),
('日本語'),
('Polski'),
('Português'),
('Sinugboanong Binisaya'),
('Svenska'),
('Українська'),
('Tiếng Việt'),
('Winaray'),
('中文'),
('Русский'),
('Afrikaans'),
('Shqip'),
('Asturianu'),
('Azərbaycanca'),
('Български'),
('閩南語 / Bân-lâm-gú'),
('বাংলা'),
('Беларуская'),
('Català'),
('Čeština'),
('Cymraeg'),
('Dansk'),
('Eesti'),
('Ελληνικά'),
('Esperanto'),
('Euskara'),
('Galego'),
('한국어'),
('Հայերեն'),
('हिन्दी'),
('Hrvatski'),
('Bahasa Indonesia'),
('עברית'),
('ქართული'),
('Ladin'),
('Latina'),
('Latviešu'),
('Lietuvių'),
('Magyar'),
('Македонски'),
('Malagasy'),
('मराठी'),
('Bahasa Melayu'),
('Bahaso Minangkabau'),
('မြန်မာဘာသာ'),
('Norskbokmålnynorsk'),
('Нохчийн'),
('Oʻzbekcha / Ўзбекча'),
('Қазақша / Qazaqşa / قازاقشا'),
('Română'),
('Simple English'),
('Slovenčina'),
('Slovenščina'),
('Српски / Srpski'),
('Srpskohrvatski / Српскохрватски'),
('Suomi'),
('Kiswahili'),
('தமிழ்'),
('Татарча / Tatarça'),
('తెలుగు'),
('ภาษาไทย'),
('Тоҷикӣ'),
('تۆرکجه'),
('Türkçe'),
('اردو'),
('粵語'),
('Bahsa Acèh'),
('Alemannisch'),
('አማርኛ'),
('Aragonés'),
('Արեւմտահայերէն'),
('Bahasa Hulontalo'),
('Basa Bali'),
('Bahasa Banjar'),
('Basa Banyumasan'),
('Башҡортса'),
('Беларуская (тарашкевіца)'),
('Bikol Central'),
('বিষ্ণুপ্রিয়া মণিপুরী'),
('Boarisch'),
('Bosanski'),
('Brezhoneg'),
('Чӑвашла'),
('Dagbanli'),
('الدارجة'),
('Diné Bizaad'),
('EmigliànRumagnòl'),
('Fiji Hindi'),
('Føroyskt'),
('Frysk'),
('Fulfulde'),
('Gaeilge'),
('Gàidhlig'),
('گیلکی'),
('ગુજરાતી'),
('Hak-kâ-ngî / 客家語'),
('Hausa'),
('Hornjoserbsce'),
('Ido'),
('Igbo'),
('Ilokano'),
('Interlingua'),
('Interlingue'),
('Ирон'),
('Íslenska'),
('Jawa'),
('ಕನ್ನಡ'),
('Kapampangan'),
('ភាសាខ្មែរ'),
('Kotava'),
('Kreyòl Ayisyen'),
('Kurdî / كوردی'),
('کوردیی ناوەندی'),
('Кыргызча'),
('Кырык мары'),
('Lëtzebuergesch'),
('Lìgure'),
('Limburgs'),
('Lombard'),
('मैथिली'),
('മലയാളം'),
('მარგალური'),
('مازِرونی'),
('Mìng-dĕ̤ng-ngṳ̄ / 閩東語'),
('Монгол'),
('Napulitano'),
('नेपाल भाषा'),
('Nordfriisk'),
('Occitan'),
('Олык марий'),
('ଓଡି଼ଆ'),
('অসমীযা়'),
('ਪੰਜਾਬੀ'),
('پنجابی (شاہ مکھی)'),
('پښتو'),
('Piemontèis'),
('Plattdüütsch'),
('Qaraqalpaqsha'),
('Qırımtatarca'),
('Runa Simi'),
('Русиньскый'),
('संस्कृतम्'),
('ᱥᱟᱱᱛᱟᱲᱤ'),
('سرائیکی'),
('Саха Тыла'),
('Scots'),
('ChiShona'),
('Sicilianu'),
('සිංහල'),
('سنڌي'),
('Ślůnski'),
('Basa Sunda'),
('Taclḥit'),
('Tagalog'),
('ၽႃႇသႃႇတႆး'),
('ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ'),
('tolışi'),
('chiTumbuka'),
('Basa Ugi'),
('Vèneto'),
('Volapük'),
('Walon'),
('文言'),
('吴语'),
('ייִדיש'),
('Yorùbá'),
('Zazaki'),
('žemaitėška'),
('isiZulu'),
('नेपाली'),
('ꯃꯤꯇꯩ ꯂꯣꯟ'),
('Dzhudezmo / לאדינו'),
('Адыгэбзэ'),
('Ænglisc'),
('Anarâškielâ'),
('अंगिका'),
('Аԥсшәа'),
('armãneashti'),
('Arpitan'),
('atikamekw'),
('ܐܬܘܪܝܐ'),
('Avañe’ẽ'),
('Авар'),
('Aymar'),
('Batak Toba'),
('Betawi'),
('भोजपुरी'),
('Bislama'),
('བོད་ཡིག'),
('Буряад'),
('Chavacano de Zamboanga'),
('Chichewa'),
('Corsu'),
('Vahcuengh / 話僮'),
('Dagaare'),
('Davvisámegiella'),
('Deitsch'),
('ދިވެހިބަސް'),
('Dolnoserbski'),
('Dusun Bundu-liwan'),
('Эрзянь'),
('Estremeñu'),
('Eʋegbe'),
('Farefare'),
('Fɔ̀ngbè'),
('Furlan'),
('Gaelg'),
('Gagauz'),
('ГӀалгӀай'),
('Ghanaian Pidgin'),
('Gĩkũyũ'),
('赣语 / 贛語'),
('Gungbe'),
('Хальмг'),
('ʻŌlelo Hawaiʻi'),
('Ikinyarwanda'),
('Jaku Iban'),
('Kabɩyɛ'),
('Yerwa Kanuri'),
('Kaszëbsczi'),
('Kernewek'),
('Коми'),
('Перем коми'),
('Kongo'),
('कोंकणी / Konknni'),
('كٲشُر'),
('Kriyòl Gwiyannen'),
('Kumoring'),
('Kʋsaal'),
('ພາສາລາວ'),
('Лакку'),
('Latgaļu'),
('Лезги'),
('Li Niha'),
('Lingála'),
('Lingua Franca Nova'),
('livvinkarjala'),
('lojban'),
('Luganda'),
('Madhurâ'),
('Malti'),
('Mandailing'),
('Māori'),
('Mfantse'),
('Mirandés'),
('Мокшень'),
('ဘာသာ မန်'),
('Moore'),
('ߒߞߏ'),
('Na Vosa Vaka-Viti'),
('Nāhuatlahtōlli'),
('Naijá'),
('Nedersaksisch'),
('Nouormand / Normaund'),
('Novial'),
('Afaan Oromoo'),
('ပအိုဝ်ႏဘာႏသာႏ'),
('Pangasinán'),
('Pangcah'),
('Papiamentu'),
('Patois'),
('Pfälzisch'),
('Picard'),
('Къарачай–малкъар'),
('Ripoarisch'),
('Rumantsch'),
('Sakizaya'),
('Gagana Sāmoa'),
('Sardu'),
('Seediq'),
('Seeltersk'),
('Sesotho'),
('Sesotho sa Leboa'),
('Setswana'),
('ꠍꠤꠟꠐꠤ'),
('Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ'),
('Soomaaliga'),
('Sranantongo'),
('SiSwati'),
('Reo tahiti'),
('Taqbaylit'),
('Tarandíne'),
('Tayal'),
('Tetun'),
('Tok Pisin'),
('faka Tonga'),
('Türkmençe'),
('Twi'),
('Tyap'),
('Тыва дыл'),
('Удмурт'),
('ئۇيغۇرچه'),
('Vepsän'),
('võro'),
('West-Vlams'),
('Wolof'),
('isiXhosa'),
('Zeêuws'),
('алтай тил'),
('अवधी'),
('डोटेली'),
('ತುಳು'),
('ရခိုင်'),
('Bajau Sama'),
('Bamanankan'),
('Chamoru'),
('རྫོང་ཁ'),
('𐌲𐌿𐍄𐌹𐍃𐌺x'),
('Igala'),
('ᐃᓄᒃᑎᑐᑦ / Inuktitut'),
('Iñupiak'),
('isiNdebele seSewula'),
('Kalaallisut'),
('Nupe'),
('Obolo'),
('पालि'),
('pinayuanan'),
('Ποντιακά'),
('romani čhib'),
('Ikirundi'),
('руски'),
('Sängö'),
('ᥖᥭᥰᥖᥬᥳᥑᥨᥒᥰ'),
('ትግርኛ'),
('Thuɔŋjäŋ'),
('ᏣᎳᎩ'),
('Tsėhesenėstsestotse'),
('Xitsonga'),
('Tshivenḓa'),
('Wayuunaiki'),
('адыгабзэ');
COMMIT;
}
do_test 1.2 {
set res \n[db format -style box {
SELECT name, rowid AS id FROM language
WHERE length(name)=2
ORDER BY name
}]
set exp {
╭──────┬─────╮
│ name │ id │
╞══════╪═════╡
│ 中文 │ 18 │
│ 吴语 │ 173 │
│ 文言 │ 172 │
│ 粵語 │ 75 │
╰──────┴─────╯
}
if {$res ne $exp} {
puts [list $res]
puts [list $exp]
}
string compare $res $exp
} {0}
do_test 1.3 {
set res \n[db format -style box {
SELECT name, rowid AS id FROM language
WHERE length(name)=3
ORDER BY name
}]
set exp {
╭────────┬─────╮
│ name │ id │
╞════════╪═════╡
│ Ido │ 108 │
│ Twi │ 297 │
│ ߒߞߏ │ 258 │
│ ᏣᎳᎩ │ 335 │
│ 日本語 │ 10 │
│ 한국어 │ 37 │
╰────────┴─────╯
}
if {$res ne $exp} {
puts [list $res]
puts [list $exp]
}
string compare $res $exp
} {0}
do_test 1.4 {
set res \n[db format -style box {
SELECT name, rowid AS id FROM language
WHERE length(name)=4
ORDER BY name
}]
set exp {
╭──────┬─────╮
│ name │ id │
╞══════╪═════╡
│ Igbo │ 109 │
│ Jawa │ 115 │
│ Nupe │ 323 │
│ Tyap │ 298 │
│ võro │ 303 │
│ Авар │ 192 │
│ Ирон │ 113 │
│ Коми │ 231 │
│ اردو │ 74 │
│ سنڌي │ 159 │
│ مصرى │ 8 │
│ پښتو │ 144 │
│ अवधी │ 309 │
│ पालि │ 325 │
│ ತುಳು │ 311 │
│ ትግርኛ │ 333 │
│ አማርኛ │ 78 │
╰──────┴─────╯
}
if {$res ne $exp} {
puts [list $res]
puts [list $exp]
}
string compare $res $exp
} {0}
do_test 1.5 {
set res \n[db format -style box {
SELECT name, rowid AS id FROM language
WHERE length(name)=5
ORDER BY name
}]
set exp {
╭───────┬─────╮
│ name │ id │
╞═══════╪═════╡
│ Aymar │ 193 │
│ Corsu │ 202 │
│ Dansk │ 31 │
│ Eesti │ 32 │
│ Frysk │ 99 │
│ Gaelg │ 216 │
│ Hausa │ 106 │
│ Igala │ 318 │
│ Kongo │ 233 │
│ Ladin │ 44 │
│ Malti │ 250 │
│ Moore │ 257 │
│ Māori │ 252 │
│ Naijá │ 261 │
│ Obolo │ 324 │
│ Sardu │ 278 │
│ Scots │ 155 │
│ Shqip │ 21 │
│ Suomi │ 65 │
│ Sängö │ 331 │
│ Tayal │ 292 │
│ Tetun │ 293 │
│ Walon │ 171 │
│ Wolof │ 305 │
│ Лакку │ 240 │
│ Лезги │ 242 │
│ руски │ 330 │
│ עברית │ 42 │
│ فارسی │ 5 │
│ كٲشُر │ 235 │
│ گیلکی │ 103 │
│ मराठी │ 51 │
│ বাংলা │ 26 │
│ ଓଡି଼ଆ │ 140 │
│ தமிழ் │ 67 │
│ ಕನ್ನಡ │ 116 │
│ සිංහල │ 158 │
│ ꠍꠤꠟꠐꠤ │ 284 │
╰───────┴─────╯
}
if {$res ne $exp} {
puts [list $res]
puts [list $exp]
}
string compare $res $exp
} {0}
do_test 1.6 {
set res \n[db format -style box {
SELECT name, rowid AS id FROM language
WHERE length(name)=6
ORDER BY name
}]
set exp {
╭────────┬─────╮
│ name │ id │
╞════════╪═════╡
│ Betawi │ 195 │
│ Català │ 28 │
│ Eʋegbe │ 212 │
│ Furlan │ 215 │
│ Gagauz │ 217 │
│ Galego │ 36 │
│ Gungbe │ 222 │
│ Gĩkũyũ │ 220 │
│ Kabɩyɛ │ 227 │
│ Kotava │ 119 │
│ Kʋsaal │ 238 │
│ Latina │ 45 │
│ Lìgure │ 126 │
│ Magyar │ 48 │
│ Novial │ 264 │
│ Patois │ 270 │
│ Picard │ 272 │
│ Polski │ 11 │
│ Română │ 59 │
│ Seediq │ 279 │
│ Türkçe │ 73 │
│ Vepsän │ 302 │
│ Vèneto │ 169 │
│ Yorùbá │ 175 │
│ Zazaki │ 176 │
│ Zeêuws │ 307 │
│ lojban │ 247 │
│ tolışi │ 166 │
│ Аԥсшәа │ 186 │
│ Буряад │ 199 │
│ Монгол │ 134 │
│ Тоҷикӣ │ 71 │
│ Удмурт │ 300 │
│ Хальмг │ 223 │
│ Эрзянь │ 210 │
│ ייִדיש │ 174 │
│ تۆرکجه │ 72 │
│ ܐܬܘܪܝܐ │ 190 │
│ अंगिका │ 185 │
│ डोटेली │ 310 │
│ नेपाली │ 179 │
│ मैथिली │ 129 │
│ हिन्दी │ 39 │
│ ਪੰਜਾਬੀ │ 142 │
│ తెలుగు │ 69 │
│ മലയാളം │ 130 │
│ རྫོང་ཁ │ 316 │
│ ရခိုင် │ 312 │
╰────────┴─────╯
}
if {$res ne $exp} {
puts [list $res]
puts [list $exp]
}
string compare $res $exp
} {0}
finish_test
+27 -42
View File
@@ -302,7 +302,9 @@ do_test shell1-3.2.4 {
catchcmd "test.db" ".bail OFF BAD"
} {1 {Usage: .bail on|off}}
ifcapable vtab {
# This test will not work on winrt, as winrt has no concept of the absolute
# paths that the test expects in the result. It uses relative paths only.
ifcapable vtab&&!winrt {
# .databases List names and files of attached databases
do_test shell1-3.3.1 {
catchcmd "-csv test.db" ".databases"
@@ -613,20 +615,6 @@ CREATE VIEW v1 AS SELECT y+1 FROM v2
catch {db eval {DROP VIEW v1; DROP VIEW v2; DROP TABLE t1;}}
}
do_test shell1-3.21.5 {
exec {*}$CLI -noinit test.db \
{CREATE TABLE t2(a INTEGER PRIMARY KEY, b BLOB DEFAULT(jsonb('[]')),c TEXT NOT NULL)STRICT;} \
{.schema -indent t2}
} {CREATE TABLE t2(
a INTEGER PRIMARY KEY,
b BLOB DEFAULT(jsonb('[]')),
c TEXT NOT NULL
)STRICT;}
do_test shell1-3.21.6 {
exec {*}$CLI -noinit test.db \
{DROP TABLE t2;} \
{.schema -indent t2}
} {}
# .separator STRING Change column separator used by output and .import
do_test shell1-3.22.1 {
@@ -750,9 +738,12 @@ do_test shell1-3.26.6 {
do_test shell1-3.27.1 {
catchcmd "test.db" ".timer"
} {1 {Usage: .timer on|off}}
do_test shell1-3.27.2 {
catchcmd "test.db" ".timer ON"
} {0 {}}
ifcapable !winrt {
# No timer support on winrt.
do_test shell1-3.27.2 {
catchcmd "test.db" ".timer ON"
} {0 {}}
}
do_test shell1-3.27.3 {
catchcmd "test.db" ".timer OFF"
} {0 {}}
@@ -940,7 +931,7 @@ do_test shell1-4.1.6 {
(4,2.25), (5,'hello'), (6,x'807f');
}
catchcmd test2.db {.dump --preserve-rowids}
} {/.* --preserve-rowids option is not compatible with SQLITE_OMIT_VIRTUALTABLE/}
} {1 {The --preserve-rowids option is not compatible with SQLITE_OMIT_VIRTUALTABLE}}
}
@@ -1299,20 +1290,20 @@ do_test_with_ansi_output shell1-8.2 {
.mode box
SELECT ieee754(47.49) AS x;
}
} {0 {───────────────────────────────
} {0 {───────────────────────────────
│ x │
╞═══════════════════════════════╡
├───────────────────────────────┤
│ ieee754(6683623321994527,-47) │
───────────────────────────────}}
───────────────────────────────}}
do_test_with_ansi_output shell1-8.3 {
catchcmd ":memory: --box" {
select ieee754(6683623321994527,-47) as x;
}
} {0 {───────
} {0 {───────
│ x │
╞═══════╡
├───────┤
│ 47.49 │
───────}}
───────}}
do_test shell1-8.4 {
catchcmd ":memory: --table" {SELECT ieee754_mantissa(47.49) AS M, ieee754_exponent(47.49) AS E;}
} {0 {+------------------+-----+
@@ -1320,12 +1311,6 @@ do_test shell1-8.4 {
+------------------+-----+
| 6683623321994527 | -47 |
+------------------+-----+}}
do_test shell1-8.4b {
catchcmd ":memory: --psql" \
{SELECT ieee754_mantissa(47.49) AS M, ieee754_exponent(47.49) AS E;}
} {0 { M | E
------------------+-----
6683623321994527 | -47}}
do_test_with_ansi_output shell1-8.5 {
catchcmd ":memory: --box" {
create table t(a text, b int);
@@ -1335,15 +1320,15 @@ insert into t values ('too long for one line', 1), ('shorter', NULL);
.width 10 10
.nullvalue NADA
select * from t;}
} {0 {────────────┬────────────
} {0 {────────────┬────────────
│ a │ b │
╞════════════╪════════════╡
│ too long f │ 1
├────────────┼────────────┤
│ too long f │ 1
│ or one lin │ │
│ e │ │
├────────────┼────────────┤
│ shorter │ NADA │
────────────┴────────────}}
────────────┴────────────}}
#----------------------------------------------------------------------------
# Test cases shell1-9.*: Basic test that "dot" commands and SQL intermix ok.
@@ -1399,24 +1384,24 @@ select base85(zeroblob(2000000000));
# qbox --screenwidth auto --linelimit 5 --charlimit 300 --textjsonb on
#
do_test shell1-12.1 {
catchcmd :memory: {.mode tty -quote sql
catchcmd :memory: {.mode tty
.print
SELECT jsonb(1234) AS x;}
} {0 {
───────────────
───────────────
│ x │
╞═══════════════╡
├───────────────┤
│ jsonb('1234') │
───────────────}}
───────────────}}
do_test shell1-12.2 {
catchcmd :memory: {.mode box --textjsonb on
.print
SELECT jsonb(1234) AS x;}
} {0 {
──────
──────
│ x │
╞══════╡
├──────┤
│ 1234 │
──────}}
──────}}
finish_test
+32 -32
View File
@@ -275,49 +275,49 @@ do_test shell2-1.4.10b {
SELECT * FROM generate_series(0,-2);
SELECT * FROM generate_series(0,2) LIMIT 3;}]]
} {0 {
─────────────────────
─────────────────────
│ value │
╞═════════════════════╡
├─────────────────────┤
│ 9223372036854775807 │
─────────────────────
─────────────────────
─────────────────────
─────────────────────
│ value │
╞═════════════════════╡
├─────────────────────┤
│ 9223372036854775807 │
─────────────────────
────────────┬──────────────────────┬─────────────────────
─────────────────────
────────────┬──────────────────────┬─────────────────────
│ avg(value) │ min(value) │ max(value) │
╞════════════╪══════════════════════╪═════════════════════╡
-0.5 │ -9223372036854775808 │ 9223372036854775807 │
────────────┴──────────────────────┴─────────────────────
──────────────────────
├────────────┼──────────────────────┼─────────────────────┤
-0.5 │ -9223372036854775808 │ 9223372036854775807 │
────────────┴──────────────────────┴─────────────────────
──────────────────────
│ value │
╞══════════════════════╡
├──────────────────────┤
│ -9223372036854775808 │
-1
9223372036854775806 │
──────────────────────
──────────────────────
-1
│ 9223372036854775806
──────────────────────
──────────────────────
│ value │
╞══════════════════════╡
4611686018427387904 │
0
├──────────────────────┤
│ 4611686018427387904
0
│ -4611686018427387904 │
──────────────────────
───────
──────────────────────
───────
│ value │
╞═══════╡
0
-1
-2
───────
───────
├───────┤
0
-1
-2
───────
───────
│ value │
╞═══════╡
0
1
2
───────}}
├───────┤
0
1
2
───────}}
} ;# ifcapable vtab
ifcapable vtab {
+9 -39
View File
@@ -38,9 +38,9 @@ do_execsql_test shellA-1.0 {
do_test_with_ansi_output shellA-1.2 {
exec {*}$CLI -noinit test.db {.mode box -quote off --escape symbol} {SELECT * FROM t1;}
} {
───┬──────────────────────────
───┬──────────────────────────
│ a │ x │
╞═══╪══════════════════════════╡
├───┼──────────────────────────┤
│ 1 │ line with ' single quote │
├───┼──────────────────────────┤
│ 2 │ ␛[31mVT-100 codes␛[0m │
@@ -57,7 +57,7 @@ do_test_with_ansi_output shellA-1.2 {
│ 7 │ carriage␍return │
├───┼──────────────────────────┤
│ 8 │ last line │
───┴──────────────────────────
───┴──────────────────────────
}
# ".mode list"
@@ -182,9 +182,9 @@ do_test_with_ansi_output shellA-4.1 {
exec {*}$CLI -noinit test.db --box --escape ascii \
{SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
} {
───┬──────────────────────────
───┬──────────────────────────
│ a │ x │
╞═══╪══════════════════════════╡
├───┼──────────────────────────┤
│ 1 │ line with ' single quote │
├───┼──────────────────────────┤
│ 2 │ ^[[31mVT-100 codes^[[0m │
@@ -195,50 +195,20 @@ do_test_with_ansi_output shellA-4.1 {
│ 7 │ carriage^Mreturn │
├───┼──────────────────────────┤
│ 8 │ last line │
───┴──────────────────────────
}
do_test_with_ansi_output shellA-4.1b {
exec {*}$CLI -noinit test.db --box --escape ascii \
{.mode -border off} \
{SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
} {
a │ x
═══╪══════════════════════════
1 │ line with ' single quote
───┼──────────────────────────
2 │ ^[[31mVT-100 codes^[[0m
───┼──────────────────────────
6 │ new
│ line
───┼──────────────────────────
7 │ carriage^Mreturn
───┼──────────────────────────
8 │ last line
───┴──────────────────────────
}
do_test_with_ansi_output shellA-4.2 {
exec {*}$CLI -noinit test.db {.mode qbox} {SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
} {
───┬───────────────────────────────────────────
───┬───────────────────────────────────────────
│ a │ x │
╞═══╪═══════════════════════════════════════════╡
├───┼───────────────────────────────────────────┤
│ 1 │ 'line with '' single quote' │
│ 2 │ unistr('\u001b[31mVT-100 codes\u001b[0m') │
│ 6 │ unistr('new\u000aline') │
│ 7 │ unistr('carriage\u000dreturn') │
│ 8 │ 'last line' │
───┴───────────────────────────────────────────
}
do_test_with_ansi_output shellA-4.2b {
exec {*}$CLI -noinit test.db {.mode qbox -border off} \
{SELECT a, x FROM t1 WHERE a IN (1,2,6,7,8)}
} {
a │ x
═══╪═══════════════════════════════════════════
1 │ 'line with '' single quote'
2 │ unistr('\u001b[31mVT-100 codes\u001b[0m')
6 │ unistr('new\u000aline')
7 │ unistr('carriage\u000dreturn')
8 │ 'last line'
───┴───────────────────────────────────────────
}
# ".mode insert"
-68
View File
@@ -215,72 +215,4 @@ do_execsql_test 5.1 {
SELECT ( SELECT y FROM t2 WHERE x = y ORDER BY y, z) FROM t1;
} {ALFKI ANATR}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 6.0 {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(1234);
}
do_execsql_test 6.1 {
SELECT DISTINCT 'string' FROM t1 LIMIT 1 OFFSET 5;
}
do_execsql_test 6.2 {
SELECT (
SELECT 'string' FROM t1 LIMIT 1 OFFSET 5
);
} {{}}
do_execsql_test 6.3 {
SELECT (
SELECT DISTINCT 'string' FROM t1 LIMIT 1 OFFSET 5
);
} {{}}
do_execsql_test 6.4 {
SELECT (
SELECT DISTINCT 'string' FROM t1 ORDER BY 1 LIMIT 1 OFFSET 5
);
} {{}}
do_execsql_test 6.5 {
SELECT (
SELECT 'string' FROM t1 ORDER BY 1 LIMIT 1 OFFSET 5
);
} {{}}
do_execsql_test 6.6 {
SELECT (SELECT DISTINCT x, x FROM t1 LIMIT 1 OFFSET 5)==(1234, 1234)
} {{}}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 7.0 {
CREATE TABLE t1(x);
CREATE INDEX i1 ON t1(x);
INSERT INTO t1 VALUES(1234);
}
do_execsql_test 7.1 {
SELECT (
SELECT DISTINCT 'string' FROM t1 ORDER BY x LIMIT 1 OFFSET 5
);
} {{}}
do_execsql_test 7.2 {
DROP INDEX i1;
CREATE UNIQUE INDEX i1 ON t1(x);
}
do_execsql_test 7.3 {
SELECT (
SELECT DISTINCT x FROM t1 ORDER BY 1 LIMIT 1 OFFSET 5
);
} {{}}
do_execsql_test 7.4 {
SELECT (SELECT DISTINCT x FROM t1 ORDER BY +x LIMIT 1 OFFSET 0);
} {1234}
finish_test
-120
View File
@@ -1,120 +0,0 @@
# 2025 November 11
#
# 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 temptrigfault
forcedelete test.db2
do_execsql_test 1.0 {
CREATE TABLE t1(x, y);
ATTACH 'test.db2' AS aux;
CREATE TABLE aux.t1(x, y);
}
do_faultsim_test 1.1 -faults oom* -prep {
} -body {
execsql {
CREATE TEMP TRIGGER tmptrig AFTER INSERT ON t1 BEGIN
INSERT INTO aux.t1 VALUES(new.x, new.y);
END;
}
} -test {
faultsim_test_result {0 {}}
catchsql { DROP TRIGGER tmptrig }
}
do_execsql_test 2.0 {
CREATE TEMP TRIGGER tmptrig AFTER INSERT ON t1 BEGIN
INSERT INTO aux.t1 VALUES(new.x, new.y);
END;
}
do_faultsim_test 2 -faults oom* -prep {
} -body {
execsql {
INSERT INTO t1 VALUES('x', 'y');
}
} -test {
faultsim_test_result {0 {}}
}
do_execsql_test 3.0.1 {
SELECT * FROM t1;
DELETE FROM t1;
DELETE FROM aux.t1;
} [db eval {SELECT * FROM aux.t1}]
do_execsql_test 3.0.2 {
CREATE TEMP TRIGGER tmptrig2 AFTER INSERT ON aux.t1 BEGIN
INSERT INTO t1 VALUES(new.x||'2', new.y||'2');
END;
}
do_faultsim_test 3 -faults oom* -prep {
} -body {
execsql {
INSERT INTO aux.t1 VALUES('aaa', 'bbb');
}
} -test {
faultsim_test_result {0 {}}
}
proc repeatlist {list n} {
set ret [list]
for {set i 0} {$i < $n} {incr i} {
set ret [concat $ret $list]
}
set ret
}
do_execsql_test 3.x.1 {
SELECT * FROM main.t1;
} [repeatlist {aaa2 bbb2} 5]
do_execsql_test 3.x.2 {
SELECT * FROM aux.t1;
} [repeatlist {aaa bbb aaa2 bbb2} 5]
faultsim_save_and_close
do_faultsim_test 4 -faults oom* -prep {
faultsim_restore_and_reopen
execsql { ATTACH 'test.db2' AS aux; }
} -body {
execsql {
CREATE TEMP TRIGGER xyz AFTER DELETE ON main.t1 BEGIN
DELETE FROM aux.t1 WHERE rowid=old.rowid;
END;
DELETE FROM t1 WHERE rowid=2;
}
} -test {
faultsim_test_result {0 {}} {1 {unable to open a temporary database file for storing temporary tables}}
}
faultsim_save_and_close
do_faultsim_test 5 -faults oom* -prep {
faultsim_restore_and_reopen
execsql { ATTACH 'test.db2' AS aux; }
} -body {
execsql {
CREATE TEMP TRIGGER xyz AFTER UPDATE ON aux.t1 BEGIN
UPDATE main.t1 SET x=new.x, y=new.y WHERE rowid=new.rowid;
END;
UPDATE aux.t1 SET x=x||x WHERE rowid=1+abs(random() % 5);
}
} -test {
faultsim_test_result {0 {}} {1 {unable to open a temporary database file for storing temporary tables}}
}
finish_test
-187
View File
@@ -276,191 +276,4 @@ do_catchsql_test 6.3 {
} {1 error}
db2 close
#-------------------------------------------------------------------------
reset_db
forcedelete test.db2
do_execsql_test 7.0 {
CREATE TABLE m1(a, b);
ATTACH 'test.db2' AS aux;
CREATE TABLE aux.a1(c, d);
}
do_execsql_test 7.1 {
CREATE TEMP TRIGGER tr1 AFTER INSERT ON m1 BEGIN
INSERT INTO a1 VALUES(new.a, new.b);
END;
INSERT INTO m1 VALUES(5, 6);
SELECT * FROM aux.a1;
} {5 6}
do_execsql_test 7.2 {
CREATE TABLE a1(e, f);
INSERT INTO m1 VALUES(7, 8);
}
do_execsql_test 7.3.1 { SELECT * FROM main.a1 } {7 8}
do_execsql_test 7.3.2 { SELECT * FROM aux.a1 } {5 6}
do_execsql_test 7.4 {
DROP TRIGGER tr1;
CREATE TEMP TRIGGER tr1 AFTER INSERT ON m1 BEGIN
INSERT INTO a1 SELECT d, c FROM aux.a1;
END;
DELETE FROM aux.a1;
DELETE FROM main.a1;
INSERT INTO aux.a1 VALUES('hello', 'world');
}
do_execsql_test 7.5 {
INSERT INTO m1 VALUES(9, 10);
SELECT * FROM main.a1;
} {world hello}
do_catchsql_test 7.6 {
DROP TRIGGER tr1;
CREATE TRIGGER tr1 AFTER INSERT ON m1 BEGIN
INSERT INTO a1 SELECT d, c FROM aux.a1;
END;
} {1 {trigger tr1 cannot reference objects in database aux}}
#-------------------------------------------------------------------------
# Check that temp triggers may INSERT/UPDATE/DELETE to fully qualified
# table names.
reset_db
forcedelete {*}[glob -nocomplain *mj*]
forcedelete test.db2
do_execsql_test 8.0 {
ATTACH 'test.db2' AS aux;
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d);
CREATE TABLE aux.t1(e, f);
CREATE TABLE aux.t2(g, h);
}
do_catchsql_test 8.1.1 {
CREATE TRIGGER tr1 AFTER INSERT ON t2 BEGIN
INSERT INTO aux.t1 VALUES(new.c, new.d);
END;
} {1 {qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers}}
do_execsql_test 8.1.2 {
CREATE TEMP TRIGGER tr1 AFTER INSERT ON t2 BEGIN
INSERT INTO aux.t1 VALUES(new.c, new.d);
END;
INSERT INTO main.t2 VALUES('x', 'y');
SELECT * FROM aux.t1;
} {x y}
do_execsql_test 8.1.3 { SELECT * FROM t1 } {}
do_catchsql_test 8.2.1 {
CREATE TRIGGER aux.tr2 AFTER UPDATE ON aux.t1 BEGIN
UPDATE main.t2 SET c=new.e, d=new.f;
END;
} {1 {qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers}}
do_execsql_test 8.2.2 {
CREATE TEMP TRIGGER tr2 AFTER UPDATE ON aux.t1 BEGIN
UPDATE main.t2 SET c=new.e, d=new.f;
END;
UPDATE aux.t1 SET e=1, f=2;
SELECT * FROM t2;
} {1 2}
do_execsql_test 8.2.3 { SELECT * FROM aux.t2 } {}
do_catchsql_test 8.3.1 {
CREATE TRIGGER tr3 AFTER DELETE ON t2 BEGIN
DELETE FROM aux.t1;
END;
} {1 {qualified table names are not allowed on INSERT, UPDATE, and DELETE statements within triggers}}
do_execsql_test 8.3.2 {
INSERT INTO main.t1 VALUES('a', 'b');
CREATE TEMP TRIGGER tr3 AFTER DELETE ON t2 BEGIN
DELETE FROM aux.t1;
END;
DELETE FROM main.t2;
SELECT * FROM aux.t1;
} {}
do_execsql_test 8.3.3 { SELECT * FROM t1 } {a b}
#-------------------------------------------------------------------------
reset_db
set nDb 8
do_test 9.0 {
for {set ii 0} {$ii < $nDb} {incr ii} {
db eval "ATTACH ':memory:' AS db$ii"
db eval "CREATE TABLE db$ii.tbl(a, b, c)"
}
for {set ii 0} {$ii < ($nDb-1)} {incr ii} {
set jj [expr $ii+1]
db eval "
CREATE TEMP TRIGGER tr$ii AFTER INSERT ON db$ii.tbl BEGIN
INSERT INTO db$jj.tbl VALUES(new.b, new.c, new.a);
END;
"
}
} {}
do_execsql_test 9.1 { INSERT INTO db0.tbl VALUES('a', 'b', 'c'); }
do_execsql_test 9.1.1 { SELECT * FROM db0.tbl } {a b c}
do_execsql_test 9.1.2 { SELECT * FROM db1.tbl } {b c a}
do_execsql_test 9.1.3 { SELECT * FROM db2.tbl } {c a b}
do_execsql_test 9.1.1 { SELECT * FROM db3.tbl } {a b c}
do_execsql_test 9.1.2 { SELECT * FROM db4.tbl } {b c a}
do_execsql_test 9.1.3 { SELECT * FROM db5.tbl } {c a b}
do_execsql_test 9.1.1 { SELECT * FROM db6.tbl } {a b c}
do_execsql_test 9.1.2 { SELECT * FROM db7.tbl } {b c a}
do_test 9.2 {
for {set ii 0} {$ii < ($nDb-1)} {incr ii} {
set jj [expr $ii+1]
db eval "
CREATE TEMP TRIGGER tru$ii AFTER UPDATE ON db$ii.tbl BEGIN
UPDATE db$jj.tbl SET a=new.b, b=new.c, c=new.a;
END;
"
}
} {}
do_execsql_test 9.3 { UPDATE db0.tbl SET a=1, b=2, c=3 }
do_execsql_test 9.3.1 { SELECT * FROM db0.tbl } {1 2 3}
do_execsql_test 9.3.2 { SELECT * FROM db1.tbl } {2 3 1}
do_execsql_test 9.3.3 { SELECT * FROM db2.tbl } {3 1 2}
do_execsql_test 9.3.1 { SELECT * FROM db3.tbl } {1 2 3}
do_execsql_test 9.3.2 { SELECT * FROM db4.tbl } {2 3 1}
do_execsql_test 9.3.3 { SELECT * FROM db5.tbl } {3 1 2}
do_execsql_test 9.3.1 { SELECT * FROM db6.tbl } {1 2 3}
do_execsql_test 9.3.2 { SELECT * FROM db7.tbl } {2 3 1}
do_test 9.4 {
for {set ii 0} {$ii < ($nDb-1)} {incr ii} {
set jj [expr $ii+1]
db eval "
CREATE TEMP TRIGGER trd$ii BEFORE DELETE ON db$ii.tbl BEGIN
DELETE FROM db$jj.tbl;
END;
"
}
} {}
do_execsql_test 9.5 { DELETE FROM db0.tbl }
do_execsql_test 9.5.1 { SELECT * FROM db0.tbl } {}
do_execsql_test 9.5.2 { SELECT * FROM db1.tbl } {}
do_execsql_test 9.5.3 { SELECT * FROM db2.tbl } {}
do_execsql_test 9.5.1 { SELECT * FROM db3.tbl } {}
do_execsql_test 9.5.2 { SELECT * FROM db4.tbl } {}
do_execsql_test 9.5.3 { SELECT * FROM db5.tbl } {}
do_execsql_test 9.5.1 { SELECT * FROM db6.tbl } {}
do_execsql_test 9.5.2 { SELECT * FROM db7.tbl } {}
finish_test
+5
View File
@@ -1785,6 +1785,11 @@ proc crashsql {args} {
# cfSync(), which can be different then what TCL uses by
# default, so here we force it to the "nativename" format.
set cfile [string map {\\ \\\\} [file nativename [file join [get_pwd] $crashfile]]]
ifcapable winrt {
# Except on winrt. Winrt has no way to transform a relative path into
# an absolute one, so it just uses the relative paths.
set cfile $crashfile
}
set f [open crash.tcl w]
puts $f "sqlite3_initialize ; sqlite3_shutdown"
+4 -14
View File
@@ -212,8 +212,7 @@ proc default_njob {} {
if {$nCore<=2} {
set nHelper 1
} else {
set nHelper [expr int($nCore*0.8)]
if {$nHelper>20} {set nHelper 20}
set nHelper [expr int($nCore*0.5)]
}
return $nHelper
}
@@ -707,18 +706,9 @@ if {[llength $argv]>=1
}
}
set once 1
while {![file readable $TRG(dbname)]} {
if {$delay==0} {
puts "Database missing: $TRG(dbname)"
exit
}
if {$once} {
set once 0
puts "Waiting for testing to start...."
flush stdout
}
after [expr {$delay*1000}]
if {![file readable $TRG(dbname)]} {
puts "Database missing: $TRG(dbname)"
exit
}
sqlite3 mydb $TRG(dbname)
mydb timeout 2000
+7
View File
@@ -37,6 +37,7 @@ namespace eval trd {
set tcltest(win.Windows-Memdebug) veryquick
set tcltest(win.Windows-Win32Heap) veryquick
set tcltest(win.Windows-Sanitize) veryquick
set tcltest(win.Windows-WinRT) veryquick
set tcltest(win.Default) {full win_unc_locking}
# Extra [make xyz] tests that should be run for various builds.
@@ -363,6 +364,12 @@ namespace eval trd {
set build(Windows-Sanitize) {
ASAN=1
}
set build(Windows-WinRT) {
FOR_WINRT=1
ENABLE_SETLK=1
-DSQLITE_TEMP_STORE=3
}
}
+1 -1
View File
@@ -198,7 +198,7 @@ foreach {tn pragma res} {
750 {
PRAGMA fullfsync = 1;
PRAGMA synchronous = full;
} {full|dataonly 1 full 2}
} {full 3}
} {
forcedelete test.db2
+4
View File
@@ -115,7 +115,11 @@ do_test 1.6 {
db3 close
# winrt platforms do not handle paths with unix-style '/' directory separators.
#
set lUri [list 1a 1b 1c 1d 1e 1f]
ifcapable winrt { set lUri [list 1a 1c 1e] }
foreach tn $lUri {
sqlite3 db3 $uri($tn) -vfs win32-longpath -uri 1 -translatefilename 0
-3
View File
@@ -885,10 +885,7 @@ do_test 19.1 {
INSERT INTO v0 DEFAULT VALUES;
}
} {}
db close
forcedelete zipfile19.zip
sqlite3 db :memory:
load_static_extension db zipfile
#-------------------------------------------------------------------------
do_catchsql_test 20.0 {
+2 -1
View File
@@ -105,6 +105,7 @@ REM When set, these values are expanded and passed to the NMAKE command line,
REM after its other arguments. These may be used to specify additional NMAKE
REM options, for example:
REM
REM SET NMAKE_ARGS=FOR_WINRT=1
REM SET NMAKE_ARGS_DEBUG=MEMDEBUG=1
REM SET NMAKE_ARGS_RETAIL=WIN32HEAP=1
REM
@@ -860,4 +861,4 @@ GOTO no_errors
GOTO end_of_file
:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%
%__ECHO% EXIT /B %ERRORLEVEL%
+2 -2
View File
@@ -668,8 +668,8 @@ int main(int argc, char **argv){
printf("/* Check to see if z[0..n-1] is a keyword. If it is, write the\n");
printf("** parser symbol code for that keyword into *pType. Always\n");
printf("** return the integer n (the length of the token). */\n");
printf("static i64 keywordCode(const char *z, i64 n, int *pType){\n");
printf(" i64 i, j;\n");
printf("static int keywordCode(const char *z, int n, int *pType){\n");
printf(" int i, j;\n");
printf(" const char *zKW;\n");
printf(" assert( n>=2 );\n");
printf(" i = ((charMap(z[0])*%d) %c", HASH_C0, HASH_CC);